From patchwork Wed Mar 22 16:09:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 666005 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 7A706C6FD1C for ; Wed, 22 Mar 2023 16:10:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229726AbjCVQKC (ORCPT ); Wed, 22 Mar 2023 12:10:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231181AbjCVQJt (ORCPT ); Wed, 22 Mar 2023 12:09:49 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A453474E7; Wed, 22 Mar 2023 09:09:44 -0700 (PDT) Received: from mail.ideasonboard.com (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net [86.13.91.161]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 74B5D183F; Wed, 22 Mar 2023 17:09:42 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1679501382; bh=vd8p6qebXW2YlQuhzH6NusDPMe/bXH029dav7Dn+O0o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vckmTrxqaWU+EpsFTO/p+KCEn8pAAgKcC8879n7Uw+oety7bVXJH6GLXu5yZM4U+v /fC2XbbamfIChrgHVLcN7MXCRblnzItX2W8ZKSDoyY057pNCqtVG7Q/N/gL660zTcR a+WZ7+7J1KaZurgbBrIYJEcs+2OrAMXO8wf1+ndg= From: Daniel Scally To: linux-leds@vger.kernel.org, platform-driver-x86@vger.kernel.org Cc: pavel@ucw.cz, lee@kernel.org, hdegoede@redhat.com, markgross@kernel.org, sboyd@kernel.org, hpa@redhat.com, Daniel Scally Subject: [PATCH 1/8] platform/x86: int3472: Add platform data for LEDs Date: Wed, 22 Mar 2023 16:09:19 +0000 Message-Id: <20230322160926.948687-2-dan.scally@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230322160926.948687-1-dan.scally@ideasonboard.com> References: <20230322160926.948687-1-dan.scally@ideasonboard.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org Some of the LEDs that can be provided by the TPS68470 PMIC come with various configuration registers that must be set to appropriate values. Add a platform data struct so that those data can be defined and passed to the tps68470-led platform device. Signed-off-by: Daniel Scally --- drivers/platform/x86/intel/int3472/tps68470.c | 2 ++ drivers/platform/x86/intel/int3472/tps68470.h | 2 ++ include/linux/platform_data/tps68470.h | 11 +++++++++++ 3 files changed, 15 insertions(+) diff --git a/drivers/platform/x86/intel/int3472/tps68470.c b/drivers/platform/x86/intel/int3472/tps68470.c index 82ef022f8916..53b0459f278a 100644 --- a/drivers/platform/x86/intel/int3472/tps68470.c +++ b/drivers/platform/x86/intel/int3472/tps68470.c @@ -194,6 +194,8 @@ static int skl_int3472_tps68470_probe(struct i2c_client *client) cells[1].platform_data = (void *)board_data->tps68470_regulator_pdata; cells[1].pdata_size = sizeof(struct tps68470_regulator_platform_data); cells[2].name = "tps68470-led"; + cells[2].platform_data = (void *)board_data->tps68470_led_pdata; + cells[2].pdata_size = sizeof(struct tps68470_led_platform_data); cells[3].name = "tps68470-gpio"; for (i = 0; i < board_data->n_gpiod_lookups; i++) diff --git a/drivers/platform/x86/intel/int3472/tps68470.h b/drivers/platform/x86/intel/int3472/tps68470.h index 35915e701593..ce50687db6fb 100644 --- a/drivers/platform/x86/intel/int3472/tps68470.h +++ b/drivers/platform/x86/intel/int3472/tps68470.h @@ -13,10 +13,12 @@ struct gpiod_lookup_table; struct tps68470_regulator_platform_data; +struct tps68470_led_platform_data; struct int3472_tps68470_board_data { const char *dev_name; const struct tps68470_regulator_platform_data *tps68470_regulator_pdata; + const struct tps68470_led_platform_data *tps68470_led_pdata; unsigned int n_gpiod_lookups; struct gpiod_lookup_table *tps68470_gpio_lookup_tables[]; }; diff --git a/include/linux/platform_data/tps68470.h b/include/linux/platform_data/tps68470.h index e605a2cab07f..5d55ad5c17ed 100644 --- a/include/linux/platform_data/tps68470.h +++ b/include/linux/platform_data/tps68470.h @@ -37,4 +37,15 @@ struct tps68470_clk_platform_data { struct tps68470_clk_consumer consumers[]; }; +struct tps68470_led_platform_data { + u8 iledctl_ctrlb; + u8 wledmaxf; + u8 wledto; + u8 wledc1; + u8 wledc2; + u8 wledctl_mode; + bool wledctl_disled1; + bool wledctl_disled2; +}; + #endif From patchwork Wed Mar 22 16:09:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 667262 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 86B22C76195 for ; Wed, 22 Mar 2023 16:10:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229987AbjCVQKJ (ORCPT ); Wed, 22 Mar 2023 12:10:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231241AbjCVQJz (ORCPT ); Wed, 22 Mar 2023 12:09:55 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3664350735; Wed, 22 Mar 2023 09:09:51 -0700 (PDT) Received: from mail.ideasonboard.com (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net [86.13.91.161]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 1B050189E; Wed, 22 Mar 2023 17:09:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1679501383; bh=pZY90u7KkfOtP1TIz5peMx43dbUdcVVnyNdUReBsERo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KFjrnEh0zRTfRlVnCXSjTrmBa4tQMQj/bexDPF7H4qH/1a+0Ubo/Xl8lBQKqj7z8S sJF23s7HO4ef3amdJ6DCPr1XO24zF9ZCHvrMHP+d27cSPa3zMDZD8/FkwfoDHNnx3F AT+Q3E5lU8td/DpE6XMO5TP5UuHkYaohNClAiA3Q= From: Daniel Scally To: linux-leds@vger.kernel.org, platform-driver-x86@vger.kernel.org Cc: pavel@ucw.cz, lee@kernel.org, hdegoede@redhat.com, markgross@kernel.org, sboyd@kernel.org, hpa@redhat.com, Daniel Scally Subject: [PATCH 2/8] platform/x86: int3472: Init LED registers using platform data Date: Wed, 22 Mar 2023 16:09:20 +0000 Message-Id: <20230322160926.948687-3-dan.scally@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230322160926.948687-1-dan.scally@ideasonboard.com> References: <20230322160926.948687-1-dan.scally@ideasonboard.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org Check platform data to discover the appropriate settings for the PMIC's WLED registers and set them during probe. Signed-off-by: Daniel Scally --- drivers/leds/leds-tps68470.c | 51 ++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/drivers/leds/leds-tps68470.c b/drivers/leds/leds-tps68470.c index 35aeb5db89c8..d2060fe4259d 100644 --- a/drivers/leds/leds-tps68470.c +++ b/drivers/leds/leds-tps68470.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -113,6 +114,52 @@ static int tps68470_ledb_current_init(struct platform_device *pdev, return ret; } +static int tps68470_leds_init(struct tps68470_device *tps68470) +{ + struct tps68470_led_platform_data *pdata = tps68470->dev->platform_data; + int ret; + + if (!pdata) + return 0; + + ret = regmap_write(tps68470->regmap, TPS68470_REG_ILEDCTL, pdata->iledctl_ctrlb); + if (ret) + return dev_err_probe(tps68470->dev, ret, "failed to set ILED CTRLB\n"); + + ret = regmap_write(tps68470->regmap, TPS68470_REG_WLEDMAXF, + pdata->wledmaxf & TPS68470_WLEDMAXF_MAX_CUR_MASK); + if (ret) + return dev_err_probe(tps68470->dev, ret, "failed to set WLEDMAXF\n"); + + ret = regmap_write(tps68470->regmap, TPS68470_REG_WLEDTO, pdata->wledto); + if (ret) + return dev_err_probe(tps68470->dev, ret, "failed to set WLEDTO\n"); + + ret = regmap_write(tps68470->regmap, TPS68470_REG_WLEDC1, + pdata->wledc1 & TPS68470_WLEDC_ILED_MASK); + if (ret) + return dev_err_probe(tps68470->dev, ret, "failed to set WLEDC1\n"); + + ret = regmap_write(tps68470->regmap, TPS68470_REG_WLEDC2, + pdata->wledc2 & TPS68470_WLEDC_ILED_MASK); + if (ret) + return dev_err_probe(tps68470->dev, ret, "failed to set WLEDC2\n"); + + ret = regmap_update_bits(tps68470->regmap, TPS68470_REG_WLEDCTL, + TPS68470_WLED_DISLED1, + pdata->wledctl_disled1 ? TPS68470_WLED_DISLED1 : 0); + if (ret) + return dev_err_probe(tps68470->dev, ret, "failed to set DISLED1\n"); + + ret = regmap_update_bits(tps68470->regmap, TPS68470_REG_WLEDCTL, + TPS68470_WLED_DISLED2, + pdata->wledctl_disled2 ? TPS68470_WLED_DISLED2 : 0); + if (ret) + dev_err_probe(tps68470->dev, ret, "failed to set DISLED2\n"); + + return 0; +} + static int tps68470_leds_probe(struct platform_device *pdev) { int i = 0; @@ -160,6 +207,10 @@ static int tps68470_leds_probe(struct platform_device *pdev) } } + ret = tps68470_leds_init(tps68470); + if (ret) + goto err_exit; + err_exit: if (ret) { for (i = 0; i < TPS68470_NUM_LEDS; i++) { From patchwork Wed Mar 22 16:09:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 666004 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 4E029C6FD1F for ; Wed, 22 Mar 2023 16:10:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229870AbjCVQKI (ORCPT ); Wed, 22 Mar 2023 12:10:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231233AbjCVQJy (ORCPT ); Wed, 22 Mar 2023 12:09:54 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CE665072A; Wed, 22 Mar 2023 09:09:51 -0700 (PDT) Received: from mail.ideasonboard.com (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net [86.13.91.161]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id BBF4518A4; Wed, 22 Mar 2023 17:09:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1679501384; bh=3thhCzpSnD7EzFfqxqceXEfOwcXqCz1VjVfiLb1SzZo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a3Lj54PIlJveWDIEdiDL1hOtdFWDbTojaCiz9CK9IMKWBsnSIAKOUEHNXvllQMjgL G+NNGfwHUAXKgFly6EO3/HlUDYMtAwLNc3vWXgC07ta97k2Ypo19xO7Fn5kNHH+WBt zLHsBrKgS3XpfldL5rFklDfJEy1kDvPqdYH4wcx0= From: Daniel Scally To: linux-leds@vger.kernel.org, platform-driver-x86@vger.kernel.org Cc: pavel@ucw.cz, lee@kernel.org, hdegoede@redhat.com, markgross@kernel.org, sboyd@kernel.org, hpa@redhat.com, Daniel Scally Subject: [PATCH 3/8] platform/x86: int3472: Add TPS68470 LED Board Data Date: Wed, 22 Mar 2023 16:09:21 +0000 Message-Id: <20230322160926.948687-4-dan.scally@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230322160926.948687-1-dan.scally@ideasonboard.com> References: <20230322160926.948687-1-dan.scally@ideasonboard.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org Add the board data for the Surface Go platforms to configure the LEDs provided by the TPS68470 PMIC. Signed-off-by: Daniel Scally Reviewed-by: Hans de Goede --- .../x86/intel/int3472/tps68470_board_data.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/platform/x86/intel/int3472/tps68470_board_data.c b/drivers/platform/x86/intel/int3472/tps68470_board_data.c index 322237e056f3..0d46a238b630 100644 --- a/drivers/platform/x86/intel/int3472/tps68470_board_data.c +++ b/drivers/platform/x86/intel/int3472/tps68470_board_data.c @@ -146,9 +146,21 @@ static struct gpiod_lookup_table surface_go_int347e_gpios = { } }; +static const struct tps68470_led_platform_data surface_go_tps68470_led_pdata = { + .iledctl_ctrlb = 0x30, + .wledmaxf = 0x1f, + .wledto = 0x07, + .wledc1 = 0x1f, + .wledc2 = 0x1f, + .wledctl_mode = 0x00, + .wledctl_disled1 = true, + .wledctl_disled2 = false, +}; + static const struct int3472_tps68470_board_data surface_go_tps68470_board_data = { .dev_name = "i2c-INT3472:05", .tps68470_regulator_pdata = &surface_go_tps68470_pdata, + .tps68470_led_pdata = &surface_go_tps68470_led_pdata, .n_gpiod_lookups = 2, .tps68470_gpio_lookup_tables = { &surface_go_int347a_gpios, @@ -159,6 +171,7 @@ static const struct int3472_tps68470_board_data surface_go_tps68470_board_data = static const struct int3472_tps68470_board_data surface_go3_tps68470_board_data = { .dev_name = "i2c-INT3472:01", .tps68470_regulator_pdata = &surface_go_tps68470_pdata, + .tps68470_led_pdata = &surface_go_tps68470_led_pdata, .n_gpiod_lookups = 2, .tps68470_gpio_lookup_tables = { &surface_go_int347a_gpios, From patchwork Wed Mar 22 16:09:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 666003 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 367D2C6FD1C for ; Wed, 22 Mar 2023 16:10:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230260AbjCVQKL (ORCPT ); Wed, 22 Mar 2023 12:10:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231292AbjCVQJ6 (ORCPT ); Wed, 22 Mar 2023 12:09:58 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBBD2521E8; Wed, 22 Mar 2023 09:09:55 -0700 (PDT) Received: from mail.ideasonboard.com (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net [86.13.91.161]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 65A8918D7; Wed, 22 Mar 2023 17:09:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1679501384; bh=nVbNpDosvTKOVfBSy3DMDBbSRZ1zjxzz1+TYw+Bz/nk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fBk2X51v5S+PuNyvg50N5Boitxh9maFdyLG6Le3F/Lm3nDsZIndIYdBH8RKxt6Kro DzxCiT0zaRwu1EWSQN50ykCb2J/PPRwn9uqUKqFuzCcngIdCCnquPEF64IuyMqn+JH T+FALBx42xpjR2IsrWJvdjWUS72SlMcQWrw0O8j4= From: Daniel Scally To: linux-leds@vger.kernel.org, platform-driver-x86@vger.kernel.org Cc: pavel@ucw.cz, lee@kernel.org, hdegoede@redhat.com, markgross@kernel.org, sboyd@kernel.org, hpa@redhat.com, Daniel Scally Subject: [PATCH 4/8] platform/x86: int3472: Add tps68470-led as clock consumer Date: Wed, 22 Mar 2023 16:09:22 +0000 Message-Id: <20230322160926.948687-5-dan.scally@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230322160926.948687-1-dan.scally@ideasonboard.com> References: <20230322160926.948687-1-dan.scally@ideasonboard.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org Some of the LEDs provided by the TPS68470 require the clock that it provides to be active in order to function. Add the platform driver for the leds as a consumer of the clock so that the led driver can discover it during .probe() Signed-off-by: Daniel Scally --- drivers/platform/x86/intel/int3472/tps68470.c | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/platform/x86/intel/int3472/tps68470.c b/drivers/platform/x86/intel/int3472/tps68470.c index 53b0459f278a..818f2fc5bf2a 100644 --- a/drivers/platform/x86/intel/int3472/tps68470.c +++ b/drivers/platform/x86/intel/int3472/tps68470.c @@ -105,25 +105,30 @@ skl_int3472_fill_clk_pdata(struct device *dev, struct tps68470_clk_platform_data { struct acpi_device *adev = ACPI_COMPANION(dev); struct acpi_device *consumer; - unsigned int n_consumers = 0; + unsigned int n_consumers = 1; const char *sensor_name; - unsigned int i = 0; + const char *led_name; + unsigned int i = 1; for_each_acpi_consumer_dev(adev, consumer) n_consumers++; - if (!n_consumers) { - dev_err(dev, "INT3472 seems to have no dependents\n"); - return -ENODEV; - } - *clk_pdata = devm_kzalloc(dev, struct_size(*clk_pdata, consumers, n_consumers), GFP_KERNEL); if (!*clk_pdata) return -ENOMEM; (*clk_pdata)->n_consumers = n_consumers; - i = 0; + + /* + * The TPS68470 includes an LED driver which requires the clock be active + * to function. Add the led platform device as a consumer of the clock. + */ + led_name = devm_kstrdup(dev, "tps68470-led", GFP_KERNEL); + if (!led_name) + return -ENOMEM; + + (*clk_pdata)->consumers[0].consumer_dev_name = led_name; for_each_acpi_consumer_dev(adev, consumer) { sensor_name = devm_kasprintf(dev, GFP_KERNEL, I2C_DEV_NAME_FORMAT, From patchwork Wed Mar 22 16:09:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 667261 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 797E6C6FD1F for ; Wed, 22 Mar 2023 16:10:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230362AbjCVQKM (ORCPT ); Wed, 22 Mar 2023 12:10:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231309AbjCVQJ7 (ORCPT ); Wed, 22 Mar 2023 12:09:59 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB54A136FB; Wed, 22 Mar 2023 09:09:56 -0700 (PDT) Received: from mail.ideasonboard.com (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net [86.13.91.161]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0E99018CE; Wed, 22 Mar 2023 17:09:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1679501385; bh=JjQ9fwbnmnE9m2wYDgra5491TAmNPrzPruanD8GkQR4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VhxqCraFyggvPesvHrQoEG8SUW3beWallumTpHpdH4pls6Sz1RGB3ukETNIiu7XCc 5/zjdQ2BXKAQx/ga3rjm5MYX3qucEV540f1761yL5DEoh9rUXFPT5ztbrmuyUzQ3iH YwCilMc82frbVwrsHVKURoneGIreesGcAXzb4XeQ= From: Daniel Scally To: linux-leds@vger.kernel.org, platform-driver-x86@vger.kernel.org Cc: pavel@ucw.cz, lee@kernel.org, hdegoede@redhat.com, markgross@kernel.org, sboyd@kernel.org, hpa@redhat.com, Daniel Scally Subject: [PATCH 5/8] leds: tps68470: Refactor tps68470_brightness_get() Date: Wed, 22 Mar 2023 16:09:23 +0000 Message-Id: <20230322160926.948687-6-dan.scally@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230322160926.948687-1-dan.scally@ideasonboard.com> References: <20230322160926.948687-1-dan.scally@ideasonboard.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org We want to extend tps68470_brightness_get() to be usable with the other LEDs supplied by the IC; refactor it to make that easier. Signed-off-by: Daniel Scally --- drivers/leds/leds-tps68470.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/leds/leds-tps68470.c b/drivers/leds/leds-tps68470.c index d2060fe4259d..44df175d25de 100644 --- a/drivers/leds/leds-tps68470.c +++ b/drivers/leds/leds-tps68470.c @@ -77,23 +77,24 @@ static enum led_brightness tps68470_brightness_get(struct led_classdev *led_cdev int ret = 0; int value = 0; - ret = regmap_read(regmap, TPS68470_REG_ILEDCTL, &value); - if (ret) - return dev_err_probe(led_cdev->dev, -EINVAL, "failed on reading register\n"); - switch (led->led_id) { case TPS68470_ILED_A: - value = value & TPS68470_ILEDCTL_ENA; - break; case TPS68470_ILED_B: - value = value & TPS68470_ILEDCTL_ENB; + ret = regmap_read(regmap, TPS68470_REG_ILEDCTL, &value); + if (ret) + return dev_err_probe(led_cdev->dev, ret, + "failed to read LED status\n"); + + value &= led->led_id == TPS68470_ILED_A ? TPS68470_ILEDCTL_ENA : + TPS68470_ILEDCTL_ENB; break; + default: + return dev_err_probe(led_cdev->dev, -EINVAL, "invalid LED ID\n"); } return value ? LED_ON : LED_OFF; } - static int tps68470_ledb_current_init(struct platform_device *pdev, struct tps68470_device *tps68470) { From patchwork Wed Mar 22 16:09:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 666002 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 8355DC76196 for ; Wed, 22 Mar 2023 16:10:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230402AbjCVQKN (ORCPT ); Wed, 22 Mar 2023 12:10:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231327AbjCVQKB (ORCPT ); Wed, 22 Mar 2023 12:10:01 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90C044DE20; Wed, 22 Mar 2023 09:09:59 -0700 (PDT) Received: from mail.ideasonboard.com (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net [86.13.91.161]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id AFD511AE7; Wed, 22 Mar 2023 17:09:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1679501386; bh=5O8A7MyJYloFejDLmqIUwe4p0b0RhtgGmZc5Wdz/hQc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fRCYvyuYIneMBgZ+OyYir5MJASaL8XSpN+v80odf1YBc85WKKRDxf+ICQx1iEDOiD GgHFNMw332TjJiRBQvuk/RBkfcZnTeOiEAJZmj2ui15tEVqhUiXyZWGsakepvggNzr PXipy+mvcnfIur/mQhvMphOuzF7gYICv//XDg+xo= From: Daniel Scally To: linux-leds@vger.kernel.org, platform-driver-x86@vger.kernel.org Cc: pavel@ucw.cz, lee@kernel.org, hdegoede@redhat.com, markgross@kernel.org, sboyd@kernel.org, hpa@redhat.com, Daniel Scally Subject: [PATCH 6/8] leds: tps68470: Support the WLED driver Date: Wed, 22 Mar 2023 16:09:24 +0000 Message-Id: <20230322160926.948687-7-dan.scally@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230322160926.948687-1-dan.scally@ideasonboard.com> References: <20230322160926.948687-1-dan.scally@ideasonboard.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org The TPS68470 PMIC provides a third LED driver in addition to the two indicator LEDs. Add support for the WLED. To ensure the LED is active for as long as the kernel instructs it to be we need to re-trigger it periodically to avoid the IC's internal timeouts. Signed-off-by: Daniel Scally --- drivers/leds/leds-tps68470.c | 102 ++++++++++++++++++++++++++++++++++- include/linux/mfd/tps68470.h | 12 +++++ 2 files changed, 113 insertions(+), 1 deletion(-) diff --git a/drivers/leds/leds-tps68470.c b/drivers/leds/leds-tps68470.c index 44df175d25de..abcd3494b1a8 100644 --- a/drivers/leds/leds-tps68470.c +++ b/drivers/leds/leds-tps68470.c @@ -8,6 +8,7 @@ * Kate Hsuan */ +#include #include #include #include @@ -15,7 +16,10 @@ #include #include #include +#include +#define work_to_led(work) \ + container_of(work, struct tps68470_led, keepalive_work) #define lcdev_to_led(led_cdev) \ container_of(led_cdev, struct tps68470_led, lcdev) @@ -26,20 +30,25 @@ enum tps68470_led_ids { TPS68470_ILED_A, TPS68470_ILED_B, + TPS68470_WLED, TPS68470_NUM_LEDS }; static const char *tps68470_led_names[] = { [TPS68470_ILED_A] = "tps68470-iled_a", [TPS68470_ILED_B] = "tps68470-iled_b", + [TPS68470_WLED] = "tps68470-wled", }; struct tps68470_led { unsigned int led_id; struct led_classdev lcdev; + enum led_brightness state; + struct work_struct keepalive_work; }; struct tps68470_device { + struct clk *clk; struct device *dev; struct regmap *regmap; struct tps68470_led leds[TPS68470_NUM_LEDS]; @@ -52,11 +61,33 @@ enum ctrlb_current { CTRLB_16MA = 3, }; +/* + * The WLED can operate in different modes, including a Flash and Torch mode. In + * each mode there's a timeout which ranges from a matter of milliseconds to up + * to 13 seconds. We don't want that timeout to apply though because the LED + * should be lit until we say that it should no longer be lit, re-trigger the + * LED periodically to keep it alive. + */ +static void tps68470_wled_keepalive_work(struct work_struct *work) +{ + struct tps68470_device *tps68470; + struct tps68470_led *led; + + led = work_to_led(work); + tps68470 = led_to_tps68470(led, led->led_id); + + regmap_update_bits_async(tps68470->regmap, TPS68470_REG_WLEDCTL, + TPS68470_WLED_CTL_MASK, TPS68470_WLED_CTL_MASK); + schedule_work(&led->keepalive_work); +} + static int tps68470_brightness_set(struct led_classdev *led_cdev, enum led_brightness brightness) { struct tps68470_led *led = lcdev_to_led(led_cdev); struct tps68470_device *tps68470 = led_to_tps68470(led, led->led_id); struct regmap *regmap = tps68470->regmap; + const char *errmsg; + int ret; switch (led->led_id) { case TPS68470_ILED_A: @@ -65,8 +96,59 @@ static int tps68470_brightness_set(struct led_classdev *led_cdev, enum led_brigh case TPS68470_ILED_B: return regmap_update_bits(regmap, TPS68470_REG_ILEDCTL, TPS68470_ILEDCTL_ENB, brightness ? TPS68470_ILEDCTL_ENB : 0); + case TPS68470_WLED: + /* + * LED core does not prevent re-setting brightness to its current + * value; we need to do so here to avoid unbalanced calls to clk + * enable/disable. + */ + if (led->state == brightness) + return 0; + + if (brightness) { + schedule_work(&led->keepalive_work); + + ret = clk_prepare_enable(tps68470->clk); + if (ret) { + errmsg = "failed to start clock\n"; + goto err_cancel_work; + } + } else { + cancel_work_sync(&led->keepalive_work); + clk_disable_unprepare(tps68470->clk); + } + + ret = regmap_update_bits(tps68470->regmap, TPS68470_REG_WLEDCTL, + TPS68470_WLED_EN_MASK, + brightness ? TPS68470_WLED_EN_MASK : + ~TPS68470_WLED_EN_MASK); + if (ret) { + errmsg = "failed to set WLED EN\n"; + goto err_disable_clk; + } + + ret = regmap_update_bits(tps68470->regmap, TPS68470_REG_WLEDCTL, + TPS68470_WLED_CTL_MASK, + brightness ? TPS68470_WLED_CTL_MASK : + ~TPS68470_WLED_CTL_MASK); + if (ret) { + errmsg = "failed to set WLED START\n"; + goto err_disable_clk; + } + + led->state = brightness; + break; + default: + return dev_err_probe(led_cdev->dev, -EINVAL, "invalid LED ID\n"); } - return -EINVAL; + + return ret; + +err_disable_clk: + clk_disable_unprepare(tps68470->clk); +err_cancel_work: + cancel_work_sync(&led->keepalive_work); + return dev_err_probe(tps68470->dev, ret, errmsg); } static enum led_brightness tps68470_brightness_get(struct led_classdev *led_cdev) @@ -88,6 +170,14 @@ static enum led_brightness tps68470_brightness_get(struct led_classdev *led_cdev value &= led->led_id == TPS68470_ILED_A ? TPS68470_ILEDCTL_ENA : TPS68470_ILEDCTL_ENB; break; + case TPS68470_WLED: + ret = regmap_read(regmap, TPS68470_REG_WLEDCTL, &value); + if (ret) + return dev_err_probe(led_cdev->dev, ret, + "failed to read LED status\n"); + + value &= TPS68470_WLED_CTL_MASK; + break; default: return dev_err_probe(led_cdev->dev, -EINVAL, "invalid LED ID\n"); } @@ -177,6 +267,11 @@ static int tps68470_leds_probe(struct platform_device *pdev) tps68470->dev = &pdev->dev; tps68470->regmap = dev_get_drvdata(pdev->dev.parent); + tps68470->clk = devm_clk_get(tps68470->dev, NULL); + if (IS_ERR(tps68470->clk)) + return dev_err_probe(tps68470->dev, PTR_ERR(tps68470->clk), + "failed to get clock\n"); + for (i = 0; i < TPS68470_NUM_LEDS; i++) { led = &tps68470->leds[i]; lcdev = &led->lcdev; @@ -206,6 +301,11 @@ static int tps68470_leds_probe(struct platform_device *pdev) if (ret) goto err_exit; } + + if (led->led_id == TPS68470_WLED) { + INIT_WORK(&led->keepalive_work, + tps68470_wled_keepalive_work); + } } ret = tps68470_leds_init(tps68470); diff --git a/include/linux/mfd/tps68470.h b/include/linux/mfd/tps68470.h index 2d2abb25b944..103ff730e028 100644 --- a/include/linux/mfd/tps68470.h +++ b/include/linux/mfd/tps68470.h @@ -35,6 +35,11 @@ #define TPS68470_REG_GPDI 0x26 #define TPS68470_REG_GPDO 0x27 #define TPS68470_REG_ILEDCTL 0x28 +#define TPS68470_REG_WLEDMAXF 0x2F +#define TPS68470_REG_WLEDTO 0x30 +#define TPS68470_REG_WLEDC1 0x34 +#define TPS68470_REG_WLEDC2 0x35 +#define TPS68470_REG_WLEDCTL 0x36 #define TPS68470_REG_VCMVAL 0x3C #define TPS68470_REG_VAUX1VAL 0x3D #define TPS68470_REG_VAUX2VAL 0x3E @@ -98,5 +103,12 @@ #define TPS68470_ILEDCTL_ENA BIT(2) #define TPS68470_ILEDCTL_ENB BIT(6) #define TPS68470_ILEDCTL_CTRLB GENMASK(5, 4) +#define TPS68470_WLEDMAXF_MAX_CUR_MASK GENMASK(4, 0) +#define TPS68470_WLEDC_ILED_MASK GENMASK(4, 0) +#define TPS68470_WLED_MODE_MASK GENMASK(1, 0) +#define TPS68470_WLED_EN_MASK BIT(2) +#define TPS68470_WLED_DISLED1 BIT(3) +#define TPS68470_WLED_DISLED2 BIT(4) +#define TPS68470_WLED_CTL_MASK BIT(5) #endif /* __LINUX_MFD_TPS68470_H */ From patchwork Wed Mar 22 16:09:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 667260 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 6B80BC6FD1C for ; Wed, 22 Mar 2023 16:10:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229731AbjCVQKO (ORCPT ); Wed, 22 Mar 2023 12:10:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231332AbjCVQKB (ORCPT ); Wed, 22 Mar 2023 12:10:01 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68045166C3; Wed, 22 Mar 2023 09:10:00 -0700 (PDT) Received: from mail.ideasonboard.com (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net [86.13.91.161]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 5618B2A7C; Wed, 22 Mar 2023 17:09:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1679501386; bh=qC00Wvd7JQTpf/phl9rkMjcm/jtZyTBCOWYWZNrACuM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nHESJunAZZqHSNbY6qIujhf+6O5cVJVq4PhNJEn+TNTb0+PuvgnFRcBoMOvXnIUpy lO49V+75EDtac0XA+QwIt53kjLNAR32mSBxhjj/3S/maRJuZdKqQwfANhdMxVN28lu O6F+ZlqRhjbL1zHXTMqqQhHccZJz1CwD3pSjqdbk= From: Daniel Scally To: linux-leds@vger.kernel.org, platform-driver-x86@vger.kernel.org Cc: pavel@ucw.cz, lee@kernel.org, hdegoede@redhat.com, markgross@kernel.org, sboyd@kernel.org, hpa@redhat.com, Daniel Scally Subject: [PATCH 7/8] platform/x86: int3472: Support LED lookups in board data Date: Wed, 22 Mar 2023 16:09:25 +0000 Message-Id: <20230322160926.948687-8-dan.scally@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230322160926.948687-1-dan.scally@ideasonboard.com> References: <20230322160926.948687-1-dan.scally@ideasonboard.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org On platforms with the TPS68470 PMIC, we need to be able to define which of the LEDs powered by the PMIC should be used by each of the sensors that consume its resources. Add the ability to define tables of LED lookup data to the board data file. Signed-off-by: Daniel Scally --- drivers/platform/x86/intel/int3472/tps68470.c | 8 ++++++++ drivers/platform/x86/intel/int3472/tps68470.h | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/drivers/platform/x86/intel/int3472/tps68470.c b/drivers/platform/x86/intel/int3472/tps68470.c index 818f2fc5bf2a..07ac7b5b9082 100644 --- a/drivers/platform/x86/intel/int3472/tps68470.c +++ b/drivers/platform/x86/intel/int3472/tps68470.c @@ -206,6 +206,10 @@ static int skl_int3472_tps68470_probe(struct i2c_client *client) for (i = 0; i < board_data->n_gpiod_lookups; i++) gpiod_add_lookup_table(board_data->tps68470_gpio_lookup_tables[i]); + if (board_data->led_lookups) + for (i = 0; i < board_data->led_lookups->n_lookups; i++) + led_add_lookup(&board_data->led_lookups->lookup_table[i]); + ret = devm_mfd_add_devices(&client->dev, PLATFORM_DEVID_NONE, cells, TPS68470_WIN_MFD_CELL_COUNT, NULL, 0, NULL); @@ -214,6 +218,10 @@ static int skl_int3472_tps68470_probe(struct i2c_client *client) if (ret) { for (i = 0; i < board_data->n_gpiod_lookups; i++) gpiod_remove_lookup_table(board_data->tps68470_gpio_lookup_tables[i]); + + if (board_data->led_lookups) + for (i = 0; i < board_data->led_lookups->n_lookups; i++) + led_remove_lookup(&board_data->led_lookups->lookup_table[i]); } break; diff --git a/drivers/platform/x86/intel/int3472/tps68470.h b/drivers/platform/x86/intel/int3472/tps68470.h index ce50687db6fb..c03884654898 100644 --- a/drivers/platform/x86/intel/int3472/tps68470.h +++ b/drivers/platform/x86/intel/int3472/tps68470.h @@ -11,14 +11,22 @@ #ifndef _INTEL_SKL_INT3472_TPS68470_H #define _INTEL_SKL_INT3472_TPS68470_H +#include + struct gpiod_lookup_table; struct tps68470_regulator_platform_data; struct tps68470_led_platform_data; +struct tps68470_led_lookups { + unsigned int n_lookups; + struct led_lookup_data lookup_table[]; +}; + struct int3472_tps68470_board_data { const char *dev_name; const struct tps68470_regulator_platform_data *tps68470_regulator_pdata; const struct tps68470_led_platform_data *tps68470_led_pdata; + struct tps68470_led_lookups *led_lookups; unsigned int n_gpiod_lookups; struct gpiod_lookup_table *tps68470_gpio_lookup_tables[]; }; From patchwork Wed Mar 22 16:09:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 666001 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 9E08CC77B60 for ; Wed, 22 Mar 2023 16:10:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229745AbjCVQKP (ORCPT ); Wed, 22 Mar 2023 12:10:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229747AbjCVQKE (ORCPT ); Wed, 22 Mar 2023 12:10:04 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64A4D1ACD5; Wed, 22 Mar 2023 09:10:02 -0700 (PDT) Received: from mail.ideasonboard.com (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net [86.13.91.161]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 007FA32EC; Wed, 22 Mar 2023 17:09:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1679501387; bh=97wvt0y0TEfMp4ScZwkJFAKsZ9bT3v1tLRviaXe7EsM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O7h23+/m8bKJVmSix0sEvBZZQURkvQ5yzWnto11+juplKRmyfN9AbJylVJ/29tK0F PI4kTdsXARBq7HXedOZgHbMFVINMjWRGRN8XRY7n1uX3YqPVE/DKTXt4tAUMG4W2bv VTNxvr7ferRivtiYXgEj0QOeMqHimrEr2HbVu3ys= From: Daniel Scally To: linux-leds@vger.kernel.org, platform-driver-x86@vger.kernel.org Cc: pavel@ucw.cz, lee@kernel.org, hdegoede@redhat.com, markgross@kernel.org, sboyd@kernel.org, hpa@redhat.com, Daniel Scally Subject: [PATCH 8/8] platform/x86: int3472: Define LED lookup data for MS Surface Go Date: Wed, 22 Mar 2023 16:09:26 +0000 Message-Id: <20230322160926.948687-9-dan.scally@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230322160926.948687-1-dan.scally@ideasonboard.com> References: <20230322160926.948687-1-dan.scally@ideasonboard.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org Add LED lookup data to tps68470_board_data.c for the Microsoft Surface Go line of devices. Signed-off-by: Daniel Scally --- .../x86/intel/int3472/tps68470_board_data.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/platform/x86/intel/int3472/tps68470_board_data.c b/drivers/platform/x86/intel/int3472/tps68470_board_data.c index 0d46a238b630..e2c53319e112 100644 --- a/drivers/platform/x86/intel/int3472/tps68470_board_data.c +++ b/drivers/platform/x86/intel/int3472/tps68470_board_data.c @@ -157,10 +157,27 @@ static const struct tps68470_led_platform_data surface_go_tps68470_led_pdata = { .wledctl_disled2 = false, }; +static struct tps68470_led_lookups surface_go_tps68470_led_lookups = { + .n_lookups = 2, + .lookup_table = { + { + .provider = "tps68470-iled_a::indicator", + .dev_id = "i2c-INT347A:00", + .con_id = "privacy-led", + }, + { + .provider = "tps68470-wled::indicator", + .dev_id = "i2c-INT347E:00", + .con_id = "privacy-led", + }, + }, +}; + static const struct int3472_tps68470_board_data surface_go_tps68470_board_data = { .dev_name = "i2c-INT3472:05", .tps68470_regulator_pdata = &surface_go_tps68470_pdata, .tps68470_led_pdata = &surface_go_tps68470_led_pdata, + .led_lookups = &surface_go_tps68470_led_lookups, .n_gpiod_lookups = 2, .tps68470_gpio_lookup_tables = { &surface_go_int347a_gpios, @@ -172,6 +189,7 @@ static const struct int3472_tps68470_board_data surface_go3_tps68470_board_data .dev_name = "i2c-INT3472:01", .tps68470_regulator_pdata = &surface_go_tps68470_pdata, .tps68470_led_pdata = &surface_go_tps68470_led_pdata, + .led_lookups = &surface_go_tps68470_led_lookups, .n_gpiod_lookups = 2, .tps68470_gpio_lookup_tables = { &surface_go_int347a_gpios,