From patchwork Mon Aug 22 06:18:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Looijmans X-Patchwork-Id: 599395 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 1F43DC28D13 for ; Mon, 22 Aug 2022 06:22:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232724AbiHVGV7 (ORCPT ); Mon, 22 Aug 2022 02:21:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230161AbiHVGV6 (ORCPT ); Mon, 22 Aug 2022 02:21:58 -0400 Received: from atl4mhfb02.myregisteredsite.com (atl4mhfb02.myregisteredsite.com [209.17.115.118]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F74826AF6 for ; Sun, 21 Aug 2022 23:21:56 -0700 (PDT) Received: from atl4mhob17.registeredsite.com (atl4mhob17.registeredsite.com [209.17.115.110]) by atl4mhfb02.myregisteredsite.com (8.14.4/8.14.4) with ESMTP id 27M6IjrP025493 for ; Mon, 22 Aug 2022 02:18:45 -0400 Received: from mailpod.hostingplatform.com ([10.30.71.204]) by atl4mhob17.registeredsite.com (8.14.4/8.14.4) with ESMTP id 27M6Ifn7033912 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 22 Aug 2022 02:18:41 -0400 Received: (qmail 3289 invoked by uid 0); 22 Aug 2022 06:18:41 -0000 X-TCPREMOTEIP: 81.173.50.109 X-Authenticated-UID: mike@milosoftware.com Received: from unknown (HELO phenom.domain?not?set.invalid) (mike@milosoftware.com@81.173.50.109) by 0 with ESMTPA; 22 Aug 2022 06:18:41 -0000 From: Mike Looijmans To: linux-leds@vger.kernel.org Cc: Mike Looijmans , Pavel Machek , linux-kernel@vger.kernel.org, p.meerwald@bct-electronic.com Subject: [PATCH 1/2] leds: pca963x: Add support for PCA962x chips Date: Mon, 22 Aug 2022 08:18:37 +0200 Message-Id: <20220822061838.8212-1-mike.looijmans@topic.nl> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org The PCA962x family shares the same I2C register layout and functionality. This adds support for the following chips: PCA9623 4-channel PCA9624 8-channel PCA9622 16-channel PCA9626 24-channel Tested only the PCA9624. Other devices based on datasheet information. Signed-off-by: Mike Looijmans Acked-by: Rob Herring --- drivers/leds/Kconfig | 8 ++++---- drivers/leds/leds-pca963x.c | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index 499d0f215a8b..9a99190c13af 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -497,13 +497,13 @@ config LEDS_PCA955X_GPIO config LEDS_PCA963X - tristate "LED support for PCA963x I2C chip" + tristate "LED support for PCA962x and PCA963x I2C chips" depends on LEDS_CLASS depends on I2C help - This option enables support for LEDs connected to the PCA963x - LED driver chip accessed via the I2C bus. Supported - devices include PCA9633 and PCA9634 + This option enables support for LEDs connected to the PCA96xx + LED driver chip accessed via the I2C bus. Supported devices: + PCA9622, PCA9623, PCA9624, PCA9626, PCA9633, PCA9634, PCA9635. config LEDS_WM831X_STATUS tristate "LED support for status LEDs on WM831x PMICs" diff --git a/drivers/leds/leds-pca963x.c b/drivers/leds/leds-pca963x.c index 00aecd67e348..4d589624d192 100644 --- a/drivers/leds/leds-pca963x.c +++ b/drivers/leds/leds-pca963x.c @@ -48,6 +48,10 @@ #define PCA963X_PWM_BASE 0x02 enum pca963x_type { + pca9622, + pca9623, + pca9624, + pca9626, pca9633, pca9634, pca9635, @@ -62,6 +66,30 @@ struct pca963x_chipdef { }; static struct pca963x_chipdef pca963x_chipdefs[] = { + [pca9622] = { + .grppwm = 0x12, + .grpfreq = 0x13, + .ledout_base = 0x14, + .n_leds = 16, + }, + [pca9623] = { + .grppwm = 0x6, + .grpfreq = 0x7, + .ledout_base = 0x8, + .n_leds = 4, + }, + [pca9624] = { + .grppwm = 0xa, + .grpfreq = 0xb, + .ledout_base = 0xc, + .n_leds = 8, + }, + [pca9626] = { + .grppwm = 0x1a, + .grpfreq = 0x1b, + .ledout_base = 0x1d, + .n_leds = 24, + }, [pca9633] = { .grppwm = 0x6, .grpfreq = 0x7, @@ -87,6 +115,10 @@ static struct pca963x_chipdef pca963x_chipdefs[] = { #define PCA963X_BLINK_PERIOD_MAX 10667 static const struct i2c_device_id pca963x_id[] = { + { "pca9622", pca9622 }, + { "pca9623", pca9623 }, + { "pca9624", pca9624 }, + { "pca9626", pca9626 }, { "pca9632", pca9633 }, { "pca9633", pca9633 }, { "pca9634", pca9634 }, @@ -363,6 +395,10 @@ static int pca963x_register_leds(struct i2c_client *client, } static const struct of_device_id of_pca963x_match[] = { + { .compatible = "nxp,pca9622", }, + { .compatible = "nxp,pca9623", }, + { .compatible = "nxp,pca9624", }, + { .compatible = "nxp,pca9626", }, { .compatible = "nxp,pca9632", }, { .compatible = "nxp,pca9633", }, { .compatible = "nxp,pca9634", },