[PATCH 1/4] leds: cpcap: add support for the keyboard light channel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxx>
---
 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





[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux