From patchwork Tue Sep 6 21:58:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 603226 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CDFFDECAAA1 for ; Tue, 6 Sep 2022 21:59:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229635AbiIFV7G (ORCPT ); Tue, 6 Sep 2022 17:59:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229522AbiIFV7F (ORCPT ); Tue, 6 Sep 2022 17:59:05 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3B6393523; Tue, 6 Sep 2022 14:59:04 -0700 (PDT) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 286LHrmk005609; Tue, 6 Sep 2022 21:58:59 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=pp1; bh=S0nSleMeoxkZR/mPLbGj26GS4xQuDMvTjjtjimwBpaI=; b=rBv5EF1OFzq00Pg2IpYfFat7i6e9qQXelv0ht2QB5BLLHpJUdJ6eF9TbWAU+AdOqH8xY z4rawByC2MK0XpqQerzpdFTvV7n14y6vll4De6kMEKYJaZa5SHtOemiCya7mzCBuLCHH y1oVx4KpE3uj6sGT7JVLQm1ILVGL8zHRksaO0XlLTxBo4kCEjLv7m4vp4uMWhOs8n06x BDHDShzrQ8nq9pc+aZvHiyR/K2oryFXXVskIy/sUQlE5f0cqnWHTVwqLCtPZUoq6zUxx VEBCi7t+B55YNPiKipCXQqK+bHFSdDJtqy5+iYQQvZUBXm/O/4A7xkIuvtk3mCZSReOr VA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3jee0f8x3f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Sep 2022 21:58:59 +0000 Received: from m0098404.ppops.net (m0098404.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 286LM3E4032644; Tue, 6 Sep 2022 21:58:58 GMT Received: from ppma05wdc.us.ibm.com (1b.90.2fa9.ip4.static.sl-reverse.com [169.47.144.27]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3jee0f8x2x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Sep 2022 21:58:58 +0000 Received: from pps.filterd (ppma05wdc.us.ibm.com [127.0.0.1]) by ppma05wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 286LoHMj024617; Tue, 6 Sep 2022 21:58:57 GMT Received: from b01cxnp22033.gho.pok.ibm.com (b01cxnp22033.gho.pok.ibm.com [9.57.198.23]) by ppma05wdc.us.ibm.com with ESMTP id 3jbxj9x2kf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Sep 2022 21:58:57 +0000 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp22033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 286LwvfK2884190 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 6 Sep 2022 21:58:57 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 056CDB2065; Tue, 6 Sep 2022 21:58:57 +0000 (GMT) Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6C92DB205F; Tue, 6 Sep 2022 21:58:56 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.160.74.237]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP; Tue, 6 Sep 2022 21:58:56 +0000 (GMT) From: Eddie James To: pavel@ucw.cz Cc: linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org, andy.shevchenko@gmail.com, joel@jms.id.au, dan.carpenter@oracle.com, eajames@linux.ibm.com Subject: [PATCH v6 0/4] leds: pca955x: Add HW blink support Date: Tue, 6 Sep 2022 16:58:51 -0500 Message-Id: <20220906215855.1937331-1-eajames@linux.ibm.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 4NZnexjLE-QY5-cKhACxv5BI5CZGZnGU X-Proofpoint-GUID: 2kMH-qvjtT52SUXdKpyG5Tb8ZuQtiIMK X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-06_09,2022-09-06_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 lowpriorityscore=0 malwarescore=0 mlxlogscore=742 clxscore=1011 impostorscore=0 phishscore=0 mlxscore=0 spamscore=0 priorityscore=1501 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2209060100 Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org This series adds support for blinking using the PCA955x chip, falling back to software blinking if another LED on the chip is already blinking at a different rate, or if the requested rate isn't representable with the PCA955x. Also included are some minor clean up and optimization changes that make the HW blinking a bit easier. Changes since v5: - Use auto-incrementing control register to read all the led selectors at once during initialization Changes since v4: - Set duty cycle to fifty percent for blinked LEDs in order to maintain the specified blink rate. Changes since v3: - Initialize return value in the blink function Thanks Dan Carpenter and kernel test robot Changes since v2: - Split the cleanup patch - Prettier dev_err calls - Include units for blink period and use defined unit translations rather than just a number. - Use positive conditionals. Changes since v1: - Rework the blink function to fallback to software blinking if the period is out of range of the chip's capabilities or if another LED on the chip is already blinking at a different rate. - Add the cleanup patch Eddie James (4): leds: pca955x: Refactor with helper functions and renaming leds: pca955x: Use pointers to driver data rather than I2C client leds: pca955x: Optimize probe led selection leds: pca955x: Add HW blink support drivers/leds/leds-pca955x.c | 350 ++++++++++++++++++++++++------------ 1 file changed, 239 insertions(+), 111 deletions(-)