devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] leds: cpcap: add support for the keyboard light channel
@ 2022-12-04 10:43 Carl Philipp Klemm
  2022-12-04 10:43 ` [PATCH 2/4] leds: cpcap: make leds-cpcap an independent platform device to allow varying led setups Carl Philipp Klemm
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Carl Philipp Klemm @ 2022-12-04 10:43 UTC (permalink / raw)
  To: linux-omap, tony, sre; +Cc: devicetree, Carl Philipp Klemm

The keyboard light channel is used on xt875 for the touchscreen
button lights.
This commit also adds a checks for the sucessfull return of
device_get_match_data.

Signed-off-by: Carl Philipp Klemm <philipp@uvos.xyz>
---
 drivers/leds/leds-cpcap.c    | 15 +++++++++++++++
 drivers/mfd/motorola-cpcap.c |  4 ++++
 2 files changed, 19 insertions(+)

diff --git a/drivers/leds/leds-cpcap.c b/drivers/leds/leds-cpcap.c
index 7d41ce8c9bb1..11a9b857d8ea 100644
--- a/drivers/leds/leds-cpcap.c
+++ b/drivers/leds/leds-cpcap.c
@@ -58,6 +58,15 @@ static const struct cpcap_led_info cpcap_led_cp = {
 	.init_val	= 0x0008,
 };
 
+/* keyboard led */
+static const struct cpcap_led_info cpcap_led_kl = {
+	.reg		= CPCAP_REG_KLC,
+	.mask		= 0x0001,
+	.limit		= 1,
+	.init_mask	= 0x07FF,
+	.init_val	= 0x07F0,
+};
+
 struct cpcap_led {
 	struct led_classdev led;
 	const struct cpcap_led_info *info;
@@ -152,6 +161,7 @@ static const struct of_device_id cpcap_led_of_match[] = {
 	{ .compatible = "motorola,cpcap-led-blue",  .data = &cpcap_led_blue },
 	{ .compatible = "motorola,cpcap-led-adl", .data = &cpcap_led_adl },
 	{ .compatible = "motorola,cpcap-led-cp", .data = &cpcap_led_cp },
+	{ .compatible = "motorola,cpcap-led-kl", .data = &cpcap_led_kl },
 	{},
 };
 MODULE_DEVICE_TABLE(of, cpcap_led_of_match);
@@ -168,6 +178,11 @@ static int cpcap_led_probe(struct platform_device *pdev)
 	led->info = device_get_match_data(&pdev->dev);
 	led->dev = &pdev->dev;
 
+	if (!led->info) {
+		dev_warn(led->dev, "Can't get match data");
+		return -ENODEV;
+	}
+
 	if (led->info->reg == 0x0000) {
 		dev_err(led->dev, "Unsupported LED");
 		return -ENODEV;
diff --git a/drivers/mfd/motorola-cpcap.c b/drivers/mfd/motorola-cpcap.c
index 265464b5d7cc..57b3378a8829 100644
--- a/drivers/mfd/motorola-cpcap.c
+++ b/drivers/mfd/motorola-cpcap.c
@@ -285,6 +285,10 @@ static const struct mfd_cell cpcap_mfd_devices[] = {
 		.name          = "cpcap-led",
 		.id            = 4,
 		.of_compatible = "motorola,cpcap-led-cp",
+	}, {
+		.name          = "cpcap-led",
+		.id            = 5,
+		.of_compatible = "motorola,cpcap-led-kl",
 	}, {
 		.name          = "cpcap-codec",
 	}
-- 
2.38.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-12-05 22:16 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-04 10:43 [PATCH 1/4] leds: cpcap: add support for the keyboard light channel Carl Philipp Klemm
2022-12-04 10:43 ` [PATCH 2/4] leds: cpcap: make leds-cpcap an independent platform device to allow varying led setups Carl Philipp Klemm
2022-12-05 17:48   ` Sebastian Reichel
2022-12-05 18:15     ` Carl Philipp Klemm
2022-12-05 21:41       ` Sebastian Reichel
2022-12-04 10:43 ` [PATCH 3/4] dt-bindings: leds: leds-cpcap Carl Philipp Klemm
2022-12-04 10:43 ` [PATCH 4/4] arch: arm: dts: cpcap-mapphone: Move cpcap leds from common dts file to devices as apropriate Carl Philipp Klemm
2022-12-05 22:16   ` Rob Herring
2022-12-05 17:41 ` [PATCH 1/4] leds: cpcap: add support for the keyboard light channel Sebastian Reichel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).