From: Kate Hsuan <hpa@redhat.com>
To: Pavel Machek <pavel@ucw.cz>, Lee Jones <lee@kernel.org>,
linux-leds@vger.kernel.org, platform-driver-x86@vger.kernel.org,
Hans de Goede <hdegoede@redhat.com>,
Daniel Scally <djrscally@gmail.com>,
Mark Gross <markgross@kernel.org>
Subject: [PATCH v2 4/4] platform: x86: int3472: Register a LED lookup table entry for the privacy LED
Date: Fri, 10 Mar 2023 17:56:35 +0800 [thread overview]
Message-ID: <20230310095635.813262-5-hpa@redhat.com> (raw)
In-Reply-To: <20230310095635.813262-1-hpa@redhat.com>
From: Hans de Goede <hdegoede@redhat.com>
All currently known models using the tps68470 PMIC have a privacy LED for
the back sensor (first ACPI consumer dev of the PMIC) connected to the
ileda output of the PMIC.
Add a LED lookup table entry for this, so that the v4l2-core code turns on
the LED when streaming from the sensor.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/platform/x86/intel/int3472/tps68470.c | 30 +++++++++++++++++--
1 file changed, 28 insertions(+), 2 deletions(-)
diff --git a/drivers/platform/x86/intel/int3472/tps68470.c b/drivers/platform/x86/intel/int3472/tps68470.c
index 82ef022f8916..a53de9cd0540 100644
--- a/drivers/platform/x86/intel/int3472/tps68470.c
+++ b/drivers/platform/x86/intel/int3472/tps68470.c
@@ -140,11 +140,18 @@ skl_int3472_fill_clk_pdata(struct device *dev, struct tps68470_clk_platform_data
return n_consumers;
}
+static void skl_int3472_tps68470_unregister_led_lookup(void *led_lookup)
+{
+ led_remove_lookup(led_lookup);
+}
+
static int skl_int3472_tps68470_probe(struct i2c_client *client)
{
- struct acpi_device *adev = ACPI_COMPANION(&client->dev);
+ struct device *dev = &client->dev;
+ struct acpi_device *adev = ACPI_COMPANION(dev);
const struct int3472_tps68470_board_data *board_data;
struct tps68470_clk_platform_data *clk_pdata;
+ struct led_lookup_data *led_lookup;
struct mfd_cell *cells;
struct regmap *regmap;
int n_consumers;
@@ -177,6 +184,25 @@ static int skl_int3472_tps68470_probe(struct i2c_client *client)
if (!board_data)
return dev_err_probe(&client->dev, -ENODEV, "No board-data found for this model\n");
+ /* Add a LED lookup table entry for the privacy LED */
+ led_lookup = devm_kzalloc(&client->dev, sizeof(*led_lookup), GFP_KERNEL);
+ if (!led_lookup)
+ return -ENOMEM;
+
+ ret = skl_int3472_get_sensor_adev_and_name(&client->dev, NULL, &led_lookup->dev_id);
+ if (ret)
+ return ret;
+
+ led_lookup->provider = "tps68470-ileda";
+ led_lookup->con_id = "privacy-led";
+ led_add_lookup(led_lookup);
+
+ ret = devm_add_action_or_reset(&client->dev,
+ skl_int3472_tps68470_unregister_led_lookup,
+ led_lookup);
+ if (ret)
+ return ret;
+
cells = kcalloc(TPS68470_WIN_MFD_CELL_COUNT, sizeof(*cells), GFP_KERNEL);
if (!cells)
return -ENOMEM;
@@ -259,4 +285,4 @@ module_i2c_driver(int3472_tps68470);
MODULE_DESCRIPTION("Intel SkyLake INT3472 ACPI TPS68470 Device Driver");
MODULE_AUTHOR("Daniel Scally <djrscally@gmail.com>");
MODULE_LICENSE("GPL v2");
-MODULE_SOFTDEP("pre: clk-tps68470 tps68470-regulator");
+MODULE_SOFTDEP("pre: clk-tps68470 tps68470-regulator leds-tps68470");
--
2.37.3
next prev parent reply other threads:[~2023-03-10 9:58 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-10 9:56 [PATCH v2 0/4] leds: tps68470: LED driver for TPS68470 Kate Hsuan
2023-03-10 9:56 ` [PATCH v2 1/4] platform: x86: int3472: Add MFD cell for tps68470 LED Kate Hsuan
2023-03-10 11:13 ` Dan Scally
2023-03-10 9:56 ` [PATCH v2 2/4] include: mfd: tps68470: Add masks for LEDA and LEDB Kate Hsuan
2023-03-10 9:56 ` [PATCH v2 3/4] leds: tps68470: Add LED control for tps68470 Kate Hsuan
2023-03-10 10:43 ` Dan Scally
2023-03-13 3:21 ` Kate Hsuan
2023-03-20 14:23 ` Dan Scally
2023-03-21 9:36 ` Kate Hsuan
2023-03-10 9:56 ` Kate Hsuan [this message]
2023-03-10 11:23 ` [PATCH v2 4/4] platform: x86: int3472: Register a LED lookup table entry for the privacy LED Dan Scally
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230310095635.813262-5-hpa@redhat.com \
--to=hpa@redhat.com \
--cc=djrscally@gmail.com \
--cc=hdegoede@redhat.com \
--cc=lee@kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=markgross@kernel.org \
--cc=pavel@ucw.cz \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox