aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-09-29 22:33:32 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-09-29 22:33:32 -0400
commit95dcc4dc38e407bb2af9c7c45c9bc4c995eefeeb (patch)
treebe274393849509ea976422488b4d47d89fd085d2
parent99637e4268ea27f6fa52c4b3717d3c0675e5c20c (diff)
parentf3a0c7b3fa7cdf6783827c245c62772687f8b3ac (diff)
Merge tag 'led_fixes-4.14-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds
Pull LED fixes from Jacek Anaszewski: "Four fixes for the as3645a LED flash controller and one update to MAINTAINERS" * tag 'led_fixes-4.14-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds: MAINTAINERS: Add entry for MediaTek PMIC LED driver as3645a: Unregister indicator LED on device unbind as3645a: Use integer numbers for parsing LEDs dt: bindings: as3645a: Use LED number to refer to LEDs as3645a: Use ams,input-max-microamp as documented in DT bindings
-rw-r--r--Documentation/devicetree/bindings/leds/ams,as3645a.txt28
-rw-r--r--MAINTAINERS6
-rw-r--r--arch/arm/boot/dts/omap3-n950-n9.dtsi10
-rw-r--r--drivers/leds/leds-as3645a.c29
4 files changed, 57 insertions, 16 deletions
diff --git a/Documentation/devicetree/bindings/leds/ams,as3645a.txt b/Documentation/devicetree/bindings/leds/ams,as3645a.txt
index 12c5ef26ec73..fdc40e354a64 100644
--- a/Documentation/devicetree/bindings/leds/ams,as3645a.txt
+++ b/Documentation/devicetree/bindings/leds/ams,as3645a.txt
@@ -15,11 +15,14 @@ Required properties
15 15
16compatible : Must be "ams,as3645a". 16compatible : Must be "ams,as3645a".
17reg : The I2C address of the device. Typically 0x30. 17reg : The I2C address of the device. Typically 0x30.
18#address-cells : 1
19#size-cells : 0
18 20
19 21
20Required properties of the "flash" child node 22Required properties of the flash child node (0)
21============================================= 23===============================================
22 24
25reg: 0
23flash-timeout-us: Flash timeout in microseconds. The value must be in 26flash-timeout-us: Flash timeout in microseconds. The value must be in
24 the range [100000, 850000] and divisible by 50000. 27 the range [100000, 850000] and divisible by 50000.
25flash-max-microamp: Maximum flash current in microamperes. Has to be 28flash-max-microamp: Maximum flash current in microamperes. Has to be
@@ -33,20 +36,21 @@ ams,input-max-microamp: Maximum flash controller input current. The
33 and divisible by 50000. 36 and divisible by 50000.
34 37
35 38
36Optional properties of the "flash" child node 39Optional properties of the flash child node
37============================================= 40===========================================
38 41
39label : The label of the flash LED. 42label : The label of the flash LED.
40 43
41 44
42Required properties of the "indicator" child node 45Required properties of the indicator child node (1)
43================================================= 46===================================================
44 47
48reg: 1
45led-max-microamp: Maximum indicator current. The allowed values are 49led-max-microamp: Maximum indicator current. The allowed values are
46 2500, 5000, 7500 and 10000. 50 2500, 5000, 7500 and 10000.
47 51
48Optional properties of the "indicator" child node 52Optional properties of the indicator child node
49================================================= 53===============================================
50 54
51label : The label of the indicator LED. 55label : The label of the indicator LED.
52 56
@@ -55,16 +59,20 @@ Example
55======= 59=======
56 60
57 as3645a@30 { 61 as3645a@30 {
62 #address-cells: 1
63 #size-cells: 0
58 reg = <0x30>; 64 reg = <0x30>;
59 compatible = "ams,as3645a"; 65 compatible = "ams,as3645a";
60 flash { 66 flash@0 {
67 reg = <0x0>;
61 flash-timeout-us = <150000>; 68 flash-timeout-us = <150000>;
62 flash-max-microamp = <320000>; 69 flash-max-microamp = <320000>;
63 led-max-microamp = <60000>; 70 led-max-microamp = <60000>;
64 ams,input-max-microamp = <1750000>; 71 ams,input-max-microamp = <1750000>;
65 label = "as3645a:flash"; 72 label = "as3645a:flash";
66 }; 73 };
67 indicator { 74 indicator@1 {
75 reg = <0x1>;
68 led-max-microamp = <10000>; 76 led-max-microamp = <10000>;
69 label = "as3645a:indicator"; 77 label = "as3645a:indicator";
70 }; 78 };
diff --git a/MAINTAINERS b/MAINTAINERS
index 6671f375f7fc..65b0c88d5ee0 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -8597,6 +8597,12 @@ M: Sean Wang <sean.wang@mediatek.com>
8597S: Maintained 8597S: Maintained
8598F: drivers/media/rc/mtk-cir.c 8598F: drivers/media/rc/mtk-cir.c
8599 8599
8600MEDIATEK PMIC LED DRIVER
8601M: Sean Wang <sean.wang@mediatek.com>
8602S: Maintained
8603F: drivers/leds/leds-mt6323.c
8604F: Documentation/devicetree/bindings/leds/leds-mt6323.txt
8605
8600MEDIATEK ETHERNET DRIVER 8606MEDIATEK ETHERNET DRIVER
8601M: Felix Fietkau <nbd@openwrt.org> 8607M: Felix Fietkau <nbd@openwrt.org>
8602M: John Crispin <john@phrozen.org> 8608M: John Crispin <john@phrozen.org>
diff --git a/arch/arm/boot/dts/omap3-n950-n9.dtsi b/arch/arm/boot/dts/omap3-n950-n9.dtsi
index cb47ae79a5f9..1b0bd72945f2 100644
--- a/arch/arm/boot/dts/omap3-n950-n9.dtsi
+++ b/arch/arm/boot/dts/omap3-n950-n9.dtsi
@@ -267,15 +267,19 @@
267 clock-frequency = <400000>; 267 clock-frequency = <400000>;
268 268
269 as3645a@30 { 269 as3645a@30 {
270 #address-cells = <1>;
271 #size-cells = <0>;
270 reg = <0x30>; 272 reg = <0x30>;
271 compatible = "ams,as3645a"; 273 compatible = "ams,as3645a";
272 flash { 274 flash@0 {
275 reg = <0x0>;
273 flash-timeout-us = <150000>; 276 flash-timeout-us = <150000>;
274 flash-max-microamp = <320000>; 277 flash-max-microamp = <320000>;
275 led-max-microamp = <60000>; 278 led-max-microamp = <60000>;
276 peak-current-limit = <1750000>; 279 ams,input-max-microamp = <1750000>;
277 }; 280 };
278 indicator { 281 indicator@1 {
282 reg = <0x1>;
279 led-max-microamp = <10000>; 283 led-max-microamp = <10000>;
280 }; 284 };
281 }; 285 };
diff --git a/drivers/leds/leds-as3645a.c b/drivers/leds/leds-as3645a.c
index bbbbe0898233..9a257f969300 100644
--- a/drivers/leds/leds-as3645a.c
+++ b/drivers/leds/leds-as3645a.c
@@ -112,6 +112,10 @@
112#define AS_PEAK_mA_TO_REG(a) \ 112#define AS_PEAK_mA_TO_REG(a) \
113 ((min_t(u32, AS_PEAK_mA_MAX, a) - 1250) / 250) 113 ((min_t(u32, AS_PEAK_mA_MAX, a) - 1250) / 250)
114 114
115/* LED numbers for Devicetree */
116#define AS_LED_FLASH 0
117#define AS_LED_INDICATOR 1
118
115enum as_mode { 119enum as_mode {
116 AS_MODE_EXT_TORCH = 0 << AS_CONTROL_MODE_SETTING_SHIFT, 120 AS_MODE_EXT_TORCH = 0 << AS_CONTROL_MODE_SETTING_SHIFT,
117 AS_MODE_INDICATOR = 1 << AS_CONTROL_MODE_SETTING_SHIFT, 121 AS_MODE_INDICATOR = 1 << AS_CONTROL_MODE_SETTING_SHIFT,
@@ -491,10 +495,29 @@ static int as3645a_parse_node(struct as3645a *flash,
491 struct device_node *node) 495 struct device_node *node)
492{ 496{
493 struct as3645a_config *cfg = &flash->cfg; 497 struct as3645a_config *cfg = &flash->cfg;
498 struct device_node *child;
494 const char *name; 499 const char *name;
495 int rval; 500 int rval;
496 501
497 flash->flash_node = of_get_child_by_name(node, "flash"); 502 for_each_child_of_node(node, child) {
503 u32 id = 0;
504
505 of_property_read_u32(child, "reg", &id);
506
507 switch (id) {
508 case AS_LED_FLASH:
509 flash->flash_node = of_node_get(child);
510 break;
511 case AS_LED_INDICATOR:
512 flash->indicator_node = of_node_get(child);
513 break;
514 default:
515 dev_warn(&flash->client->dev,
516 "unknown LED %u encountered, ignoring\n", id);
517 break;
518 }
519 }
520
498 if (!flash->flash_node) { 521 if (!flash->flash_node) {
499 dev_err(&flash->client->dev, "can't find flash node\n"); 522 dev_err(&flash->client->dev, "can't find flash node\n");
500 return -ENODEV; 523 return -ENODEV;
@@ -534,11 +557,10 @@ static int as3645a_parse_node(struct as3645a *flash,
534 of_property_read_u32(flash->flash_node, "voltage-reference", 557 of_property_read_u32(flash->flash_node, "voltage-reference",
535 &cfg->voltage_reference); 558 &cfg->voltage_reference);
536 559
537 of_property_read_u32(flash->flash_node, "peak-current-limit", 560 of_property_read_u32(flash->flash_node, "ams,input-max-microamp",
538 &cfg->peak); 561 &cfg->peak);
539 cfg->peak = AS_PEAK_mA_TO_REG(cfg->peak); 562 cfg->peak = AS_PEAK_mA_TO_REG(cfg->peak);
540 563
541 flash->indicator_node = of_get_child_by_name(node, "indicator");
542 if (!flash->indicator_node) { 564 if (!flash->indicator_node) {
543 dev_warn(&flash->client->dev, 565 dev_warn(&flash->client->dev,
544 "can't find indicator node\n"); 566 "can't find indicator node\n");
@@ -721,6 +743,7 @@ static int as3645a_remove(struct i2c_client *client)
721 as3645a_set_control(flash, AS_MODE_EXT_TORCH, false); 743 as3645a_set_control(flash, AS_MODE_EXT_TORCH, false);
722 744
723 v4l2_flash_release(flash->vf); 745 v4l2_flash_release(flash->vf);
746 v4l2_flash_release(flash->vfind);
724 747
725 led_classdev_flash_unregister(&flash->fled); 748 led_classdev_flash_unregister(&flash->fled);
726 led_classdev_unregister(&flash->iled_cdev); 749 led_classdev_unregister(&flash->iled_cdev);