* [PATCH 1/3] leds: pm8058: add device tree bindings @ 2016-06-29 14:21 Linus Walleij 2016-06-29 14:21 ` [PATCH 2/3] leds: add PM8058 LEDs driver Linus Walleij ` (3 more replies) 0 siblings, 4 replies; 6+ messages in thread From: Linus Walleij @ 2016-06-29 14:21 UTC (permalink / raw) To: Jacek Anaszewski, Richard Purdie Cc: linux-leds, Linus Walleij, devicetree, linux-arm-msm, Andy Gross, Stephen Boyd, Bjorn Andersson This adds the device tree bindings for the PM8058 LEDs. Cc: devicetree@vger.kernel.org Cc: linux-arm-msm@vger.kernel.org Cc: Andy Gross <andy.gross@linaro.org> Cc: Stephen Boyd <sboyd@codeaurora.org> Cc: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- .../devicetree/bindings/leds/leds-pm8058.txt | 67 ++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/leds-pm8058.txt diff --git a/Documentation/devicetree/bindings/leds/leds-pm8058.txt b/Documentation/devicetree/bindings/leds/leds-pm8058.txt new file mode 100644 index 000000000000..5d4e6369b9f6 --- /dev/null +++ b/Documentation/devicetree/bindings/leds/leds-pm8058.txt @@ -0,0 +1,67 @@ +Qualcomm PM8058 LED driver + +The Qualcomm PM8058 is a multi-functional device which contain +a LED driver block for up to six LEDs: three normal LEDs, two +"flash" LEDs and one "keypad backlight" LED. The names are +quoted because sometimes these LED drivers are used for wildly +different things than flash or keypad backlight: their names +are more of a suggestion than a hard-wired usecase. + +Hardware-wise the different LEDs support slightly different +output currents. The "flash" LEDs do not need to charge nor +do they support external triggers. They are just powerful LED +drivers. + +The LEDs appear as children to the PM8058 device, with the +proper compatible string. For the PM8058 bindings see: +mfd/qcom-pm8xxx.txt. + +Each LED is represented as a sub-node of the syscon device. Each +node's name represents the name of the corresponding LED. + +LED sub-node properties: + +Required properties: +- compatible: on of + "qcom,pm8058-led" (for the normal LEDs at 0x131, 0x132 and 0x133) + "qcom,pm8058-keypad-led" (for the "keypad" LED at 0x48) + "qcom,pm8058-flash-led" (for the "flash" LEDs at 0x49 and 0xFB) + +Optional properties: +- label: descriptive name for the LED see common.txt +- default-state: The initial state of the LED see common.txt +- linux,default-trigger: Linux trigger, see common.txt + +Example: + +qcom,ssbi@500000 { + pmicintc: pmic@0 { + compatible = "qcom,pm8058"; + led@48 { + compatible = "qcom,pm8058-keypad-led"; + reg = <0x48>; + label = "keypad"; + default-state = "off"; + }; + led@131 { + compatible = "qcom,pm8058-led"; + reg = <0x131>; + label = "pm8058:red"; + default-state = "off"; + }; + led@132 { + compatible = "qcom,pm8058-led"; + reg = <0x132>; + label = "pm8058:yellow"; + default-state = "off"; + linux,default-trigger = "mmc0"; + }; + led@133 { + compatible = "qcom,pm8058-led"; + reg = <0x133>; + label = "pm8058:green"; + default-state = "on"; + linux,default-trigger = "heartbeat"; + }; + }; +}; -- 2.4.11 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] leds: add PM8058 LEDs driver 2016-06-29 14:21 [PATCH 1/3] leds: pm8058: add device tree bindings Linus Walleij @ 2016-06-29 14:21 ` Linus Walleij 2016-06-30 8:26 ` Jacek Anaszewski 2016-06-29 14:22 ` [PATCH 3/3] ARM: dts: add PM8058 LEDs to the APQ8060 Dragonboard Linus Walleij ` (2 subsequent siblings) 3 siblings, 1 reply; 6+ messages in thread From: Linus Walleij @ 2016-06-29 14:21 UTC (permalink / raw) To: Jacek Anaszewski, Richard Purdie Cc: linux-leds, Linus Walleij, linux-arm-msm, Andy Gross, Stephen Boyd, Bjorn Andersson This adds a driver for the six PM8058 LEDs, three ordinary LEDs, two "flash" LEDs and one "keypad" LED. The "keypad" and "flash" LEDs are not really hard-wired to these usecases: for example on the APQ8060 Dragonboard, the "keypad" LED is instead used to drive an IR LED used for the proximity sensor. The "flash" LEDs are just ordinary high-current LED drivers. Cc: linux-arm-msm@vger.kernel.org Cc: Andy Gross <andy.gross@linaro.org> Cc: Stephen Boyd <sboyd@codeaurora.org> Cc: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- drivers/leds/Kconfig | 8 ++ drivers/leds/Makefile | 1 + drivers/leds/leds-pm8058.c | 194 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 203 insertions(+) create mode 100644 drivers/leds/leds-pm8058.c diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index 5ae28340a98b..a6731f00641f 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -617,6 +617,14 @@ config LEDS_VERSATILE This option enabled support for the LEDs on the ARM Versatile and RealView boards. Say Y to enabled these. +config LEDS_PM8058 + tristate "LED Support for the Qualcomm PM8058 PMIC" + depends on MFD_PM8921_CORE + depends on LEDS_CLASS + help + Choose this option if you want to use the LED drivers in + the Qualcomm PM8058 PMIC. + comment "LED Triggers" source "drivers/leds/trigger/Kconfig" diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile index cb2013df52d9..9ee31057f468 100644 --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile @@ -67,6 +67,7 @@ obj-$(CONFIG_LEDS_KTD2692) += leds-ktd2692.o obj-$(CONFIG_LEDS_POWERNV) += leds-powernv.o obj-$(CONFIG_LEDS_SEAD3) += leds-sead3.o obj-$(CONFIG_LEDS_IS31FL32XX) += leds-is31fl32xx.o +obj-$(CONFIG_LEDS_PM8058) += leds-pm8058.o # LED SPI Drivers obj-$(CONFIG_LEDS_DAC124S085) += leds-dac124s085.o diff --git a/drivers/leds/leds-pm8058.c b/drivers/leds/leds-pm8058.c new file mode 100644 index 000000000000..3ab27ec6f2de --- /dev/null +++ b/drivers/leds/leds-pm8058.c @@ -0,0 +1,194 @@ +/* Copyright (c) 2010, 2011, 2016 The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ +#include <linux/of.h> +#include <linux/module.h> +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/pm.h> +#include <linux/regmap.h> +#include <linux/slab.h> +#include <linux/spinlock.h> +#include <linux/leds.h> + +#define PM8058_LED_TYPE_COMMON 0x00 +#define PM8058_LED_TYPE_KEYPAD 0x01 +#define PM8058_LED_TYPE_FLASH 0x02 + +#define PM8058_LED_TYPE_COMMON_MASK 0xf8 +#define PM8058_LED_TYPE_KEYPAD_MASK 0xf0 + +struct pm8058_led { + struct regmap *map; + unsigned int reg; + u32 ledtype; + struct led_classdev cdev; +}; + +static void pm8058_led_set(struct led_classdev *cled, + enum led_brightness value) +{ + struct pm8058_led *led; + int ret = 0; + + led = container_of(cled, struct pm8058_led, cdev); + switch (led->ledtype) { + case PM8058_LED_TYPE_COMMON: + ret = regmap_update_bits(led->map, led->reg, + PM8058_LED_TYPE_COMMON_MASK, + value << 3); + break; + case PM8058_LED_TYPE_KEYPAD: + case PM8058_LED_TYPE_FLASH: + ret = regmap_update_bits(led->map, led->reg, + PM8058_LED_TYPE_KEYPAD_MASK, + value << 4); + break; + default: + break; + } + if (ret) + pr_err("Failed to set LED brightness\n"); +} + +static enum led_brightness pm8058_led_get(struct led_classdev *cled) +{ + struct pm8058_led *led; + int ret; + u32 val; + + led = container_of(cled, struct pm8058_led, cdev); + switch (led->ledtype) { + case PM8058_LED_TYPE_COMMON: + ret = regmap_read(led->map, led->reg, &val); + if (ret) { + pr_err("Failed to get LED brightness\n"); + return LED_OFF; + } + return ((val & 0xf8) >> 3); + break; + case PM8058_LED_TYPE_KEYPAD: + case PM8058_LED_TYPE_FLASH: + ret = regmap_read(led->map, led->reg, &val); + if (ret) { + pr_err("Failed to get LED brightness\n"); + return LED_OFF; + } + return ((val & 0xf0) >> 4); + break; + default: + break; + } + + return LED_OFF; +} + +static const struct of_device_id pm8058_leds_id_table[] = { + { + .compatible = "qcom,pm8058-led", + .data = (void *)PM8058_LED_TYPE_COMMON + }, + { + .compatible = "qcom,pm8058-keypad-led", + .data = (void *)PM8058_LED_TYPE_KEYPAD + }, + { + .compatible = "qcom,pm8058-flash-led", + .data = (void *)PM8058_LED_TYPE_FLASH + }, +}; +MODULE_DEVICE_TABLE(of, pm8058_leds_id_table); + +static int pm8058_led_probe(struct platform_device *pdev) +{ + struct pm8058_led *led; + struct device_node *np = pdev->dev.of_node; + int ret; + struct regmap *map; + const struct of_device_id *match; + const char *state; + + led = devm_kzalloc(&pdev->dev, sizeof(*led), GFP_KERNEL); + if (led == NULL) + return -ENOMEM; + + match = of_match_node(pm8058_leds_id_table, np); + if (!match) + return -ENXIO; + led->ledtype = (u32)match->data; + + map = dev_get_regmap(pdev->dev.parent, NULL); + if (!map) { + dev_err(&pdev->dev, "Parent regmap unavailable.\n"); + return -ENXIO; + } + led->map = map; + + ret = of_property_read_u32(np, "reg", &led->reg); + if (ret) { + dev_err(&pdev->dev, "no register offset specified\n"); + return -EINVAL; + } + + /* Use label else node name */ + led->cdev.name = of_get_property(np, "label", NULL) ? : np->name; + led->cdev.default_trigger = + of_get_property(np, "linux,default-trigger", NULL); + led->cdev.brightness_set = pm8058_led_set; + led->cdev.brightness_get = pm8058_led_get; + led->cdev.max_brightness = 15; + + state = of_get_property(np, "default-state", NULL); + if (state) { + if (!strcmp(state, "keep")) { + led->cdev.brightness = pm8058_led_get(&led->cdev); + } else if (!strcmp(state, "on")) { + led->cdev.brightness = LED_FULL; + pm8058_led_set(&led->cdev, LED_FULL); + } else { + led->cdev.brightness = LED_OFF; + pm8058_led_set(&led->cdev, LED_OFF); + } + } + led->cdev.flags = LED_CORE_SUSPENDRESUME; + + ret = led_classdev_register(&pdev->dev, &led->cdev); + if (ret) { + dev_err(&pdev->dev, "unable to register led \"%s\"\n", + led->cdev.name); + return ret; + } + platform_set_drvdata(pdev, led); + + return 0; +} + +static int __exit pm8058_led_remove(struct platform_device *pdev) +{ + struct pm8058_led *led = platform_get_drvdata(pdev); + + led_classdev_unregister(&led->cdev); + return 0; +} + +static struct platform_driver pm8058_led_driver = { + .probe = pm8058_led_probe, + .remove = __exit_p(pm8058_led_remove), + .driver = { + .name = "pm8058-leds", + .of_match_table = pm8058_leds_id_table, + }, +}; +module_platform_driver(pm8058_led_driver); + +MODULE_DESCRIPTION("PM8058 LEDs driver"); +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:pm8058-leds"); -- 2.4.11 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/3] leds: add PM8058 LEDs driver 2016-06-29 14:21 ` [PATCH 2/3] leds: add PM8058 LEDs driver Linus Walleij @ 2016-06-30 8:26 ` Jacek Anaszewski 0 siblings, 0 replies; 6+ messages in thread From: Jacek Anaszewski @ 2016-06-30 8:26 UTC (permalink / raw) To: Linus Walleij Cc: Richard Purdie, linux-leds, linux-arm-msm, Andy Gross, Stephen Boyd, Bjorn Andersson Hi Linus, Thanks for the patch. Please refer to my comments below. On 06/29/2016 04:21 PM, Linus Walleij wrote: > This adds a driver for the six PM8058 LEDs, three ordinary LEDs, > two "flash" LEDs and one "keypad" LED. > > The "keypad" and "flash" LEDs are not really hard-wired to these > usecases: for example on the APQ8060 Dragonboard, the "keypad" > LED is instead used to drive an IR LED used for the proximity > sensor. The "flash" LEDs are just ordinary high-current LED > drivers. > > Cc: linux-arm-msm@vger.kernel.org > Cc: Andy Gross <andy.gross@linaro.org> > Cc: Stephen Boyd <sboyd@codeaurora.org> > Cc: Bjorn Andersson <bjorn.andersson@linaro.org> > Signed-off-by: Linus Walleij <linus.walleij@linaro.org> > --- > drivers/leds/Kconfig | 8 ++ > drivers/leds/Makefile | 1 + > drivers/leds/leds-pm8058.c | 194 +++++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 203 insertions(+) > create mode 100644 drivers/leds/leds-pm8058.c > > diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig > index 5ae28340a98b..a6731f00641f 100644 > --- a/drivers/leds/Kconfig > +++ b/drivers/leds/Kconfig > @@ -617,6 +617,14 @@ config LEDS_VERSATILE > This option enabled support for the LEDs on the ARM Versatile > and RealView boards. Say Y to enabled these. > > +config LEDS_PM8058 > + tristate "LED Support for the Qualcomm PM8058 PMIC" > + depends on MFD_PM8921_CORE > + depends on LEDS_CLASS > + help > + Choose this option if you want to use the LED drivers in > + the Qualcomm PM8058 PMIC. > + > comment "LED Triggers" > source "drivers/leds/trigger/Kconfig" > > diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile > index cb2013df52d9..9ee31057f468 100644 > --- a/drivers/leds/Makefile > +++ b/drivers/leds/Makefile > @@ -67,6 +67,7 @@ obj-$(CONFIG_LEDS_KTD2692) += leds-ktd2692.o > obj-$(CONFIG_LEDS_POWERNV) += leds-powernv.o > obj-$(CONFIG_LEDS_SEAD3) += leds-sead3.o > obj-$(CONFIG_LEDS_IS31FL32XX) += leds-is31fl32xx.o > +obj-$(CONFIG_LEDS_PM8058) += leds-pm8058.o > > # LED SPI Drivers > obj-$(CONFIG_LEDS_DAC124S085) += leds-dac124s085.o > diff --git a/drivers/leds/leds-pm8058.c b/drivers/leds/leds-pm8058.c > new file mode 100644 > index 000000000000..3ab27ec6f2de > --- /dev/null > +++ b/drivers/leds/leds-pm8058.c > @@ -0,0 +1,194 @@ > +/* Copyright (c) 2010, 2011, 2016 The Linux Foundation. All rights reserved. Please put only opening "/*" in the first line. > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License version 2 and > + * only version 2 as published by the Free Software Foundation. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + */ > +#include <linux/of.h> > +#include <linux/module.h> > +#include <linux/init.h> > +#include <linux/platform_device.h> > +#include <linux/pm.h> > +#include <linux/regmap.h> > +#include <linux/slab.h> > +#include <linux/spinlock.h> > +#include <linux/leds.h> Please arrange include directives in the alphabetical order. > + > +#define PM8058_LED_TYPE_COMMON 0x00 > +#define PM8058_LED_TYPE_KEYPAD 0x01 > +#define PM8058_LED_TYPE_FLASH 0x02 > + > +#define PM8058_LED_TYPE_COMMON_MASK 0xf8 > +#define PM8058_LED_TYPE_KEYPAD_MASK 0xf0 > + > +struct pm8058_led { > + struct regmap *map; > + unsigned int reg; > + u32 ledtype; > + struct led_classdev cdev; > +}; > + > +static void pm8058_led_set(struct led_classdev *cled, > + enum led_brightness value) > +{ > + struct pm8058_led *led; > + int ret = 0; > + > + led = container_of(cled, struct pm8058_led, cdev); > + switch (led->ledtype) { > + case PM8058_LED_TYPE_COMMON: > + ret = regmap_update_bits(led->map, led->reg, > + PM8058_LED_TYPE_COMMON_MASK, > + value << 3); Add a macro definition for 3. > + break; > + case PM8058_LED_TYPE_KEYPAD: > + case PM8058_LED_TYPE_FLASH: > + ret = regmap_update_bits(led->map, led->reg, > + PM8058_LED_TYPE_KEYPAD_MASK, > + value << 4); Add a macro definition for 4. > + break; > + default: > + break; > + } > + if (ret) > + pr_err("Failed to set LED brightness\n"); > +} > + > +static enum led_brightness pm8058_led_get(struct led_classdev *cled) > +{ > + struct pm8058_led *led; > + int ret; > + u32 val; > + > + led = container_of(cled, struct pm8058_led, cdev); > + switch (led->ledtype) { > + case PM8058_LED_TYPE_COMMON: > + ret = regmap_read(led->map, led->reg, &val); > + if (ret) { > + pr_err("Failed to get LED brightness\n"); > + return LED_OFF; > + } > + return ((val & 0xf8) >> 3); Use PM8058_LED_TYPE_COMMON_MASK instead of 0xf8. > + break; This break is redundant. > + case PM8058_LED_TYPE_KEYPAD: > + case PM8058_LED_TYPE_FLASH: > + ret = regmap_read(led->map, led->reg, &val); > + if (ret) { > + pr_err("Failed to get LED brightness\n"); > + return LED_OFF; > + } > + return ((val & 0xf0) >> 4); Use PM8058_LED_TYPE_KEYPAD_MASK instead of 0xf0. > + break; This break is redundant. > + default: > + break; > + } > + > + return LED_OFF; > +} > + > +static const struct of_device_id pm8058_leds_id_table[] = { > + { > + .compatible = "qcom,pm8058-led", > + .data = (void *)PM8058_LED_TYPE_COMMON > + }, > + { > + .compatible = "qcom,pm8058-keypad-led", > + .data = (void *)PM8058_LED_TYPE_KEYPAD > + }, > + { > + .compatible = "qcom,pm8058-flash-led", > + .data = (void *)PM8058_LED_TYPE_FLASH > + }, Please add terminating {} entry. > +}; > +MODULE_DEVICE_TABLE(of, pm8058_leds_id_table); > + > +static int pm8058_led_probe(struct platform_device *pdev) > +{ > + struct pm8058_led *led; > + struct device_node *np = pdev->dev.of_node; > + int ret; > + struct regmap *map; > + const struct of_device_id *match; > + const char *state; > + > + led = devm_kzalloc(&pdev->dev, sizeof(*led), GFP_KERNEL); > + if (led == NULL) > + return -ENOMEM; > + > + match = of_match_node(pm8058_leds_id_table, np); > + if (!match) > + return -ENXIO; > + led->ledtype = (u32)match->data; > + > + map = dev_get_regmap(pdev->dev.parent, NULL); > + if (!map) { > + dev_err(&pdev->dev, "Parent regmap unavailable.\n"); > + return -ENXIO; > + } > + led->map = map; > + > + ret = of_property_read_u32(np, "reg", &led->reg); > + if (ret) { > + dev_err(&pdev->dev, "no register offset specified\n"); > + return -EINVAL; > + } > + > + /* Use label else node name */ > + led->cdev.name = of_get_property(np, "label", NULL) ? : np->name; > + led->cdev.default_trigger = > + of_get_property(np, "linux,default-trigger", NULL); > + led->cdev.brightness_set = pm8058_led_set; > + led->cdev.brightness_get = pm8058_led_get; > + led->cdev.max_brightness = 15; > + > + state = of_get_property(np, "default-state", NULL); > + if (state) { > + if (!strcmp(state, "keep")) { > + led->cdev.brightness = pm8058_led_get(&led->cdev); > + } else if (!strcmp(state, "on")) { > + led->cdev.brightness = LED_FULL; > + pm8058_led_set(&led->cdev, LED_FULL); > + } else { > + led->cdev.brightness = LED_OFF; > + pm8058_led_set(&led->cdev, LED_OFF); > + } > + } > + led->cdev.flags = LED_CORE_SUSPENDRESUME; > + > + ret = led_classdev_register(&pdev->dev, &led->cdev); Use devm prefixed version. > + if (ret) { > + dev_err(&pdev->dev, "unable to register led \"%s\"\n", > + led->cdev.name); > + return ret; > + } > + platform_set_drvdata(pdev, led); And this call will not be needed then. > + > + return 0; > +} > + > +static int __exit pm8058_led_remove(struct platform_device *pdev) > +{ > + struct pm8058_led *led = platform_get_drvdata(pdev); > + > + led_classdev_unregister(&led->cdev); > + return 0; > +} As well as the remove op. > + > +static struct platform_driver pm8058_led_driver = { > + .probe = pm8058_led_probe, > + .remove = __exit_p(pm8058_led_remove), > + .driver = { > + .name = "pm8058-leds", > + .of_match_table = pm8058_leds_id_table, > + }, > +}; > +module_platform_driver(pm8058_led_driver); > + > +MODULE_DESCRIPTION("PM8058 LEDs driver"); > +MODULE_LICENSE("GPL v2"); > +MODULE_ALIAS("platform:pm8058-leds"); > -- Best regards, Jacek Anaszewski ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 3/3] ARM: dts: add PM8058 LEDs to the APQ8060 Dragonboard 2016-06-29 14:21 [PATCH 1/3] leds: pm8058: add device tree bindings Linus Walleij 2016-06-29 14:21 ` [PATCH 2/3] leds: add PM8058 LEDs driver Linus Walleij @ 2016-06-29 14:22 ` Linus Walleij 2016-06-29 18:38 ` [PATCH 1/3] leds: pm8058: add device tree bindings Stephen Boyd 2016-06-30 8:24 ` Jacek Anaszewski 3 siblings, 0 replies; 6+ messages in thread From: Linus Walleij @ 2016-06-29 14:22 UTC (permalink / raw) To: Jacek Anaszewski, Richard Purdie Cc: linux-leds, Linus Walleij, linux-arm-msm, Andy Gross, Stephen Boyd, Bjorn Andersson This adds the PM8058 LEDs as used in the platform. Cc: linux-arm-msm@vger.kernel.org Cc: Andy Gross <andy.gross@linaro.org> Cc: Stephen Boyd <sboyd@codeaurora.org> Cc: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- arch/arm/boot/dts/qcom-apq8060-dragonboard.dts | 39 ++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/arch/arm/boot/dts/qcom-apq8060-dragonboard.dts b/arch/arm/boot/dts/qcom-apq8060-dragonboard.dts index 0abc93e5bb00..b0800b988174 100644 --- a/arch/arm/boot/dts/qcom-apq8060-dragonboard.dts +++ b/arch/arm/boot/dts/qcom-apq8060-dragonboard.dts @@ -239,6 +239,45 @@ }; }; }; + + led@48 { + /* + * The keypad LED @0x48 is routed to + * the sensor board where it is + * connected to an infrared LED + * SFH4650 (60mW, @850nm) next to the + * ambient light and proximity sensor + * Capella Microsystems CM3605. + */ + compatible = "qcom,pm8058-keypad-led"; + reg = <0x48>; + label = "proximity0"; + default-state = "off"; + }; + led@131 { + compatible = "qcom,pm8058-led"; + reg = <0x131>; + label = "pm8058:red"; + default-state = "off"; + }; + led@132 { + /* + * This is actually green too on my + * board, but documented as yellow. + */ + compatible = "qcom,pm8058-led"; + reg = <0x132>; + label = "pm8058:yellow"; + default-state = "off"; + linux,default-trigger = "mmc0"; + }; + led@133 { + compatible = "qcom,pm8058-led"; + reg = <0x133>; + label = "pm8058:green"; + default-state = "on"; + linux,default-trigger = "heartbeat"; + }; }; }; -- 2.4.11 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] leds: pm8058: add device tree bindings 2016-06-29 14:21 [PATCH 1/3] leds: pm8058: add device tree bindings Linus Walleij 2016-06-29 14:21 ` [PATCH 2/3] leds: add PM8058 LEDs driver Linus Walleij 2016-06-29 14:22 ` [PATCH 3/3] ARM: dts: add PM8058 LEDs to the APQ8060 Dragonboard Linus Walleij @ 2016-06-29 18:38 ` Stephen Boyd 2016-06-30 8:24 ` Jacek Anaszewski 3 siblings, 0 replies; 6+ messages in thread From: Stephen Boyd @ 2016-06-29 18:38 UTC (permalink / raw) To: Linus Walleij Cc: Jacek Anaszewski, Richard Purdie, linux-leds, devicetree, linux-arm-msm, Andy Gross, Bjorn Andersson On 06/29, Linus Walleij wrote: > diff --git a/Documentation/devicetree/bindings/leds/leds-pm8058.txt b/Documentation/devicetree/bindings/leds/leds-pm8058.txt > new file mode 100644 > index 000000000000..5d4e6369b9f6 > --- /dev/null > +++ b/Documentation/devicetree/bindings/leds/leds-pm8058.txt > @@ -0,0 +1,67 @@ > +Qualcomm PM8058 LED driver > + > +The Qualcomm PM8058 is a multi-functional device which contain s/contain/contains/ > +a LED driver block for up to six LEDs: three normal LEDs, two s/a/an/ > +"flash" LEDs and one "keypad backlight" LED. The names are > +quoted because sometimes these LED drivers are used for wildly > +different things than flash or keypad backlight: their names > +are more of a suggestion than a hard-wired usecase. > + > +Hardware-wise the different LEDs support slightly different > +output currents. The "flash" LEDs do not need to charge nor > +do they support external triggers. They are just powerful LED > +drivers. > + > +The LEDs appear as children to the PM8058 device, with the > +proper compatible string. For the PM8058 bindings see: > +mfd/qcom-pm8xxx.txt. > + > +Each LED is represented as a sub-node of the syscon device. Each > +node's name represents the name of the corresponding LED. > + > +LED sub-node properties: > + > +Required properties: > +- compatible: on of s/on/one/ -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] leds: pm8058: add device tree bindings 2016-06-29 14:21 [PATCH 1/3] leds: pm8058: add device tree bindings Linus Walleij ` (2 preceding siblings ...) 2016-06-29 18:38 ` [PATCH 1/3] leds: pm8058: add device tree bindings Stephen Boyd @ 2016-06-30 8:24 ` Jacek Anaszewski 3 siblings, 0 replies; 6+ messages in thread From: Jacek Anaszewski @ 2016-06-30 8:24 UTC (permalink / raw) To: Linus Walleij Cc: Richard Purdie, linux-leds, devicetree, linux-arm-msm, Andy Gross, Stephen Boyd, Bjorn Andersson Hi Linus, Thanks for the patch. On 06/29/2016 04:21 PM, Linus Walleij wrote: > This adds the device tree bindings for the PM8058 LEDs. > > Cc: devicetree@vger.kernel.org > Cc: linux-arm-msm@vger.kernel.org > Cc: Andy Gross <andy.gross@linaro.org> > Cc: Stephen Boyd <sboyd@codeaurora.org> > Cc: Bjorn Andersson <bjorn.andersson@linaro.org> > Signed-off-by: Linus Walleij <linus.walleij@linaro.org> > --- > .../devicetree/bindings/leds/leds-pm8058.txt | 67 ++++++++++++++++++++++ > 1 file changed, 67 insertions(+) > create mode 100644 Documentation/devicetree/bindings/leds/leds-pm8058.txt > > diff --git a/Documentation/devicetree/bindings/leds/leds-pm8058.txt b/Documentation/devicetree/bindings/leds/leds-pm8058.txt > new file mode 100644 > index 000000000000..5d4e6369b9f6 > --- /dev/null > +++ b/Documentation/devicetree/bindings/leds/leds-pm8058.txt > @@ -0,0 +1,67 @@ > +Qualcomm PM8058 LED driver > + > +The Qualcomm PM8058 is a multi-functional device which contain > +a LED driver block for up to six LEDs: three normal LEDs, two > +"flash" LEDs and one "keypad backlight" LED. The names are > +quoted because sometimes these LED drivers are used for wildly > +different things than flash or keypad backlight: their names > +are more of a suggestion than a hard-wired usecase. > + > +Hardware-wise the different LEDs support slightly different > +output currents. The "flash" LEDs do not need to charge nor > +do they support external triggers. They are just powerful LED > +drivers. > + > +The LEDs appear as children to the PM8058 device, with the > +proper compatible string. For the PM8058 bindings see: > +mfd/qcom-pm8xxx.txt. > + > +Each LED is represented as a sub-node of the syscon device. Each > +node's name represents the name of the corresponding LED. > + > +LED sub-node properties: > + > +Required properties: > +- compatible: on of > + "qcom,pm8058-led" (for the normal LEDs at 0x131, 0x132 and 0x133) > + "qcom,pm8058-keypad-led" (for the "keypad" LED at 0x48) > + "qcom,pm8058-flash-led" (for the "flash" LEDs at 0x49 and 0xFB) > + > +Optional properties: > +- label: descriptive name for the LED see common.txt Please use just "see Documentation/devicetree/bindings/leds/common.txt" as a description of this property. > +- default-state: The initial state of the LED see common.txt Please use just "Documentation/devicetree/bindings/leds/leds-gpio.txt" as a description of this property. > +- linux,default-trigger: Linux trigger, see common.txt Please use just "see Documentation/devicetree/bindings/leds/common.txt" as a description of this property. > + > +Example: > + > +qcom,ssbi@500000 { > + pmicintc: pmic@0 { > + compatible = "qcom,pm8058"; > + led@48 { > + compatible = "qcom,pm8058-keypad-led"; > + reg = <0x48>; > + label = "keypad"; > + default-state = "off"; > + }; > + led@131 { > + compatible = "qcom,pm8058-led"; > + reg = <0x131>; > + label = "pm8058:red"; > + default-state = "off"; > + }; > + led@132 { > + compatible = "qcom,pm8058-led"; > + reg = <0x132>; > + label = "pm8058:yellow"; > + default-state = "off"; > + linux,default-trigger = "mmc0"; > + }; > + led@133 { > + compatible = "qcom,pm8058-led"; > + reg = <0x133>; > + label = "pm8058:green"; > + default-state = "on"; > + linux,default-trigger = "heartbeat"; > + }; > + }; > +}; > -- Best regards, Jacek Anaszewski ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-06-30 8:26 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-06-29 14:21 [PATCH 1/3] leds: pm8058: add device tree bindings Linus Walleij 2016-06-29 14:21 ` [PATCH 2/3] leds: add PM8058 LEDs driver Linus Walleij 2016-06-30 8:26 ` Jacek Anaszewski 2016-06-29 14:22 ` [PATCH 3/3] ARM: dts: add PM8058 LEDs to the APQ8060 Dragonboard Linus Walleij 2016-06-29 18:38 ` [PATCH 1/3] leds: pm8058: add device tree bindings Stephen Boyd 2016-06-30 8:24 ` Jacek Anaszewski
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).