*** Add support for QTI TRI_LED and LPG module ***
Subsystems (4)
cover *** Add support for QTI TRI_LED and LPG module ***
From: Fenglin Wu <[email protected]>
QTI TRI_LED module and LPG modules are existing in some Qualcomm PMICs like PMI8998, PM660, etc. TRI_LED module has 3 LED drivers and each is controlled by a PWM channel used for LED dimming or blinking. LPG (Light Pulse Generator) module can be configured to operate in PWM mode to output PWM signal with a fixed amplitude or in LUT (Look Up Table) mode to output PWM signal with a modulated amplitude. Normally, each LED driver in TRI_LED module is controlled by the output of a LPG module.
This patchset adds the support of registering TRI_LED as LED devices and adding LPGs as PWM devices, but only the LPG PWM mode is supported. LUT mode is not included because current PWM driver framework doesn't support hardware autonomously modulating amplitude with vary duties. This is going to be supported in next patchset with some PWM framework change.
Fenglin Wu (2):
leds: leds-qti-rgb: Add LED driver for QTI TRI_LED module
pwm: pwm-qti-lpg: Add PWM driver for QTI LPG module
.../devicetree/bindings/leds/leds-qti-rgb.txt | 66 +++ .../devicetree/bindings/pwm/pwm-qti-lpg.txt | 39 ++ drivers/leds/Kconfig | 8 + drivers/leds/Makefile | 1 + drivers/leds/leds-qti-rgb.c | 634 +++++++++++++++++++++ drivers/pwm/Kconfig | 10 + drivers/pwm/Makefile | 1 + drivers/pwm/pwm-qti-lpg.c | 578 +++++++++++++++++++ 8 files changed, 1337 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/leds-qti-rgb.txt create mode 100644 Documentation/devicetree/bindings/pwm/pwm-qti-lpg.txt create mode 100644 drivers/leds/leds-qti-rgb.c create mode 100644 drivers/pwm/pwm-qti-lpg.c
Signature · 2 lines
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
PATCH 1/2 leds: leds-qti-rgb: Add LED driver for QTI TRI_LED module
From: Fenglin Wu <[email protected]>
QTI TRI_LED module has 3 current sinks for LED driver and each is controlled by a PWM channel used for LED dimming or blinking. Add the driver to support it.
--- .../devicetree/bindings/leds/leds-qti-rgb.txt | 66 +++ drivers/leds/Kconfig | 8 + drivers/leds/Makefile | 1 + drivers/leds/leds-qti-rgb.c | 634 +++++++++++++++++++++ 4 files changed, 709 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/leds-qti-rgb.txt create mode 100644 drivers/leds/leds-qti-rgb.c
Documentation/devicetree/bindings/leds/leds-qti-rgb.txt new file +66 -0
@@ -0,0 +1,66 @@ +Qualcomm Technologies, Inc. TRI_LED driver specific bindings + +This binding document describes the properties of TRI_LED module in +Qualcomm Technologies, Inc. PMIC chips. + +- compatible: + Usage: required + Value type: <string> + Definition: Must be "qcom,leds-rgb". + +- reg: + Usage: required + Value type: <prop-encoded-array> + Definition: Register base of the TRI_LED module and length. + +- pwm-names: + Usage: required + Value type: <stringlist> + Definition: A list of string to label the PWM devices defined in pwms + property which are using for controlling LEDs. + It must be: "blue", "green", "red". + +- pwms: + Usage: required + Value type: <prop-encoded-array> + Definition: A list of the PWM devices (phandles) used for controlling + LEDs. + +- qcom,support-blink: + Usage: optional + Value type: <prop-encoded-array> + Definition: An array of integer values to indicate if "blue", "green", "red" + LEDs support blink control. The values are listed as the fixed + order for "blue", "green", "red" LEDs. + +- qcom,on-ms: + Usage: optional + Value type: <prop-encoded-array> + Definition: An array of time values (milli-seconds) to represent the + on duration for "blue", "green", "red" LEDs. The values are + listed as the fixed order for "blue", "green", "red" LEDs. + This property has to be defined if "qcom,support-blink" is + present. + +- qcom,off-ms: + Usage: optional + Value type: <prop-encoded-array> + Definition: An array of time values (milli-seconds) to represent the + off duration for "blue", "green", "red" LEDs. The values are + listed as the fixed order for "blue", "green", "red" LEDs. + This property has to be defined if "qcom,support-blink" is + present. + +Example: + + pmi8998_rgb: rgb@d000{ + compatible = "qcom,leds-rgb"; + reg = <0xd000 0x100>; + pwm-names = "blue", "green", "red"; + pwms = <&pmi8998_pwm_3 0 1000000>, + <&pmi8998_pwm_4 0 1000000>, + <&pmi8998_pwm_5 0 1000000>; + qcom,support-blink = <1 1 1>; + qcom,on-ms = <500 500 500>; + qcom,off-ms = <500 500 500>; + };
drivers/leds/Kconfig +8 -0
@@ -667,6 +667,14 @@ config LEDS_PM8058 Choose this option if you want to use the LED drivers in the Qualcomm PM8058 PMIC. +config LEDS_QTI_RGB + tristate "Qualcomm Technologies, Inc. TRI_LED driver" + depends on LEDS_CLASS && MFD_SPMI_PMIC && PWM && OF + help + This driver supports the TRI_LED module found in Qualcomm + Technologies, Inc. PMIC's chips. TRI_LED supports 3 LED drivers and + each is controlled by a PWM channel used for dimming or blinking. + config LEDS_MLXCPLD tristate "LED support for the Mellanox boards" depends on X86_64 && DMI
drivers/leds/Makefile +1 -0
@@ -24,6 +24,7 @@ obj-$(CONFIG_LEDS_COBALT_QUBE) += leds-cobalt-qube.o obj-$(CONFIG_LEDS_COBALT_RAQ) += leds-cobalt-raq.o obj-$(CONFIG_LEDS_SUNFIRE) += leds-sunfire.o obj-$(CONFIG_LEDS_PCA9532) += leds-pca9532.o +obj-$(CONFIG_LEDS_QTI_RGB) += leds-qti-rgb.o obj-$(CONFIG_LEDS_GPIO_REGISTER) += leds-gpio-register.o obj-$(CONFIG_LEDS_GPIO) += leds-gpio.o obj-$(CONFIG_LEDS_LP3944) += leds-lp3944.o
drivers/leds/leds-qti-rgb.c new file +634 -0
634 lines not on this page · raw message
Signature · 2 lines
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
Re: [PATCH V1 1/2] leds: leds-qti-rgb: Add LED driver for QTI TRI_LED module
Hi!
Documentation/devicetree/bindings/leds/leds-qti-rgb.txt line 34
Quoted 6 lines
+- qcom,support-blink:
Documentation/devicetree/bindings/leds/leds-qti-rgb.txt new file +5
-0+ Usage: optional + Value type: <prop-encoded-array> + Definition: An array of integer values to indicate if "blue", "green", "red" + LEDs support blink control. The values are listed as the fixed + order for "blue", "green", "red" LEDs.
Normal order is RGB, and no need for the "s.
Quoted 7 lines
+- qcom,on-ms:
Documentation/devicetree/bindings/leds/leds-qti-rgb.txt new file +6
-0+ Usage: optional + Value type: <prop-encoded-array> + Definition: An array of time values (milli-seconds) to represent the + on duration for "blue", "green", "red" LEDs. The values are + listed as the fixed order for "blue", "green", "red" LEDs. + This property has to be defined if "qcom,support-blink" is
Documentation/devicetree/bindings/leds/leds-qti-rgb.txt line 52
Quoted 10 lines
Documentation/devicetree/bindings/leds/leds-qti-rgb.txt new file +10
-0+ present. + +- qcom,off-ms: + Usage: optional + Value type: <prop-encoded-array> + Definition: An array of time values (milli-seconds) to represent the + off duration for "blue", "green", "red" LEDs. The values are + listed as the fixed order for "blue", "green", "red" LEDs. + This property has to be defined if "qcom,support-blink" is + present.
I don't get it; why is this needed?
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
RE: [PATCH V1 1/2] leds: leds-qti-rgb: Add LED driver for QTI TRI_LED module
Hi Pavel,
Thanks for the reviewing.
For the order, the hardware register mapping has this order (blue/green/red) from bit0/1/2, I can revert it to (red/green/blue) if there is a strong concern.
For these two properties: qcom,off-ms/ qcom,on-ms, I am using them to assign the default blinking on/off time, then the LEDs would have a default blinking pattern if you do "echo 1 > /sys/class/leds/red/blink"
Fenglin Wu
-----Original Message-----
From: Pavel Machek [mailto:[email protected]]
Sent: Wednesday, May 31, 2017 3:56 PM
To: [email protected]
Cc: [email protected]; [email protected]; Richard Purdie <[email protected]>; Jacek Anaszewski <[email protected]>; Rob Herring <[email protected]>; Mark Rutland <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH V1 1/2] leds: leds-qti-rgb: Add LED driver for QTI TRI_LED module
Hi!
Documentation/devicetree/bindings/leds/leds-qti-rgb.txt
Quoted 4 lines
+- qcom,support-blink:
Documentation/devicetree/bindings/leds/leds-qti-rgb.txt new file +3
-0+ Usage: optional + Value type: <prop-encoded-array> + Definition: An array of integer values to indicate if "blue",
"green", "red"
Review
Quoted 1 line
(quoted diff) +1
-0+ LEDs support blink control. The values are listed as the
fixed
Documentation/devicetree/bindings/leds/leds-qti-rgb.txt line 34
Quoted 1 line
Documentation/devicetree/bindings/leds/leds-qti-rgb.txt new file +1
-0+ order for "blue", "green", "red" LEDs.
Normal order is RGB, and no need for the "s.
Quoted 7 lines
+- qcom,on-ms:
Documentation/devicetree/bindings/leds/leds-qti-rgb.txt new file +6
-0+ Usage: optional + Value type: <prop-encoded-array> + Definition: An array of time values (milli-seconds) to represent the + on duration for "blue", "green", "red" LEDs. The values are + listed as the fixed order for "blue", "green", "red" LEDs. + This property has to be defined if "qcom,support-blink" is
Documentation/devicetree/bindings/leds/leds-qti-rgb.txt line 52
Quoted 10 lines
Documentation/devicetree/bindings/leds/leds-qti-rgb.txt new file +10
-0+ present. + +- qcom,off-ms: + Usage: optional + Value type: <prop-encoded-array> + Definition: An array of time values (milli-seconds) to represent the + off duration for "blue", "green", "red" LEDs. The values are + listed as the fixed order for "blue", "green", "red" LEDs. + This property has to be defined if "qcom,support-blink" is + present.
I don't get it; why is this needed?
Signature · 3 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: [PATCH V1 1/2] leds: leds-qti-rgb: Add LED driver for QTI TRI_LED module
Hi!
Quoted 5 lines
Thanks for the reviewing.
For the order, the hardware register mapping has this order (blue/green/red) from bit0/1/2, I can revert it to (red/green/blue) if there is a strong concern.
I'd do that.
Quoted 3 lines
For these two properties: qcom,off-ms/ qcom,on-ms, I am using them to assign the default blinking on/off time, then the LEDs would have a default blinking pattern if you do "echo 1 >
/sys/class/leds/red/blink"
Normally, dts describes hardware; this does not seem to be hardware description, so I'd leave it out.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
RE: [PATCH V1 1/2] leds: leds-qti-rgb: Add LED driver for QTI TRI_LED module
Thanks Pavel.
I will remove these two dts properties and define the default on/off time values in C code.
--
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
Re: [PATCH V1 1/2] leds: leds-qti-rgb: Add LED driver for QTI TRI_LED module
Hi Wu,
Quoted 3 lines · Wu Fenglin
Thanks Pavel.
I will remove these two dts properties and define the default on/off time values in C code.
There are many things to sort out regarding your patch. I'll be able to give you a detailed feedback probably no sooner than at the weekend.
Signature · 6 lines
Best regards, Jacek Anaszewski -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 2/2 pwm: pwm-qti-lpg: Add PWM driver for QTI LPG module
In reply to [email protected]From: Fenglin Wu <[email protected]>
Add pwm_chip to support QTI LPG module and export LPG channels as PWM devices for consumer drivers' usage.
--- .../devicetree/bindings/pwm/pwm-qti-lpg.txt | 39 ++ drivers/pwm/Kconfig | 10 + drivers/pwm/Makefile | 1 + drivers/pwm/pwm-qti-lpg.c | 578 +++++++++++++++++++++ 4 files changed, 628 insertions(+) create mode 100644 Documentation/devicetree/bindings/pwm/pwm-qti-lpg.txt create mode 100644 drivers/pwm/pwm-qti-lpg.c
Documentation/devicetree/bindings/pwm/pwm-qti-lpg.txt new file +39 -0
@@ -0,0 +1,39 @@ +Qualcomm Technologies, Inc. LPG driver specific bindings + +This binding document describes the properties of LPG (Light Pulse Generator) +device module in Qualcomm Technologies, Inc. PMIC chips. + +- compatible: + Usage: required + Value type: <string> + Definition: Must be "qcom,pwm-lpg". + +- reg: + Usage: required + Value type: <prop-encoded-array> + Definition: Register base and length for LPG modules. The length + varies based on the number of channels available in + the PMIC chips. + +- reg-names: + Usage: required + Value type: <string> + Definition: The name of the register defined in the reg property. + It must be "lpg-base". + +- #pwm-cells: + Usage: required + Value type: <u32> + Definition: The number of cells in "pwms" property specified in + PWM user nodes. It should be 2. The first cell is + the PWM channel ID indexed from 0, and the second + cell is the PWM default period in nanoseconds. + +Example: + + pmi8998_lpg: lpg@b100 { + compatible = "qcom,pwm-lpg"; + reg = <0xb100 0x600>; + reg-names = "lpg-base"; + #pwm-cells = <2>; + };
drivers/pwm/Kconfig +10 -0
@@ -349,6 +349,16 @@ config PWM_PXA To compile this driver as a module, choose M here: the module will be called pwm-pxa. +config PWM_QTI_LPG + tristate "Qualcomm Technologies, Inc. LPG driver" + depends on MFD_SPMI_PMIC && OF + help + This driver supports the LPG (Light Pulse Generator) module found in + Qualcomm Technologies, Inc. PMIC chips. Each LPG channel can be + configured to operate in PWM mode to output a fixed amplitude with + variable duty cycle or in LUT (Look up table) mode to output PWM + signal with a modulated amplitude. + config PWM_RCAR tristate "Renesas R-Car PWM support" depends on ARCH_RENESAS || COMPILE_TEST
drivers/pwm/Makefile +1 -0
@@ -33,6 +33,7 @@ obj-$(CONFIG_PWM_OMAP_DMTIMER) += pwm-omap-dmtimer.o obj-$(CONFIG_PWM_PCA9685) += pwm-pca9685.o obj-$(CONFIG_PWM_PUV3) += pwm-puv3.o obj-$(CONFIG_PWM_PXA) += pwm-pxa.o +obj-$(CONFIG_PWM_QTI_LPG) += pwm-qti-lpg.o obj-$(CONFIG_PWM_RCAR) += pwm-rcar.o obj-$(CONFIG_PWM_RENESAS_TPU) += pwm-renesas-tpu.o obj-$(CONFIG_PWM_ROCKCHIP) += pwm-rockchip.o
drivers/pwm/pwm-qti-lpg.c new file +578 -0
578 lines not on this page · raw message
Signature · 2 lines
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
kbuild test robot
build botRe: [PATCH V1 2/2] pwm: pwm-qti-lpg: Add PWM driver for QTI LPG module
reproduce: wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross…
Hi Fenglin,
[auto build test ERROR on j.anaszewski-leds/for-next]
[also build test ERROR on v4.12-rc3 next-20170602]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/fenglinw-codeaurora-org/leds-leds-qti-rgb-Add-LED-driver-for-QTI-TRI_LED-module/20170531-153634 base: https://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds.git for-next config: m68k-allyesconfig (attached as .config) compiler: m68k-linux-gcc (GCC) 4.9.0
reproduce:
wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=m68k
All errors (new ones prefixed by >>):
drivers/pwm/pwm-qti-lpg.c: In function 'qti_lpg_pwm_dbg_show':
>> drivers/pwm/pwm-qti-lpg.c:428:4: error: implicit declaration of function 'seq_printf' [-Werror=implicit-function-declaration]
seq_printf(s, "LPG %d is requested by %s\n",
^
>> drivers/pwm/pwm-qti-lpg.c:437:4: error: implicit declaration of function 'seq_puts' [-Werror=implicit-function-declaration]
seq_puts(s, " enabled\n");
^cc1: some warnings being treated as errors
vim +/seq_printf +428 drivers/pwm/pwm-qti-lpg.c
422 if (lpg == NULL) {
423 dev_err(pwm_chip->dev, "lpg not found\n");
424 return;
425 }
426
427 if (test_bit(PWMF_REQUESTED, &pwm->flags)) {
> 428 seq_printf(s, "LPG %d is requested by %s\n",
429 lpg->lpg_idx + 1, pwm->label);
430 } else {
431 seq_printf(s, "LPG %d is free\n",
432 lpg->lpg_idx + 1);
433 continue;
434 }
435
436 if (pwm_is_enabled(pwm)) {
> 437 seq_puts(s, " enabled\n"); 438 } else {
439 seq_puts(s, " disabled\n");
440 continue;
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Rob Herring
maintainerRe: [PATCH V1 2/2] pwm: pwm-qti-lpg: Add PWM driver for QTI LPG module
In reply to [email protected]Quoted 8 lines · On Wed, May 31, 2017 at 02:14:38PM +0800, [email protected] wrote:
From: Fenglin Wu <[email protected]>
Add
pwm_chipto support QTI LPG module and export LPG channels as PWM devices for consumer drivers' usage.Signed-off-by Fenglin Wu <[email protected]>--- .../devicetree/bindings/pwm/pwm-qti-lpg.txt | 39 ++
Please put binding in a separate patch.
Quoted 13 lines
drivers/pwm/Kconfig | 10 + drivers/pwm/Makefile | 1 + drivers/pwm/pwm-qti-lpg.c | 578 +++++++++++++++++++++ 4 files changed, 628 insertions(+) create mode 100644 Documentation/devicetree/bindings/pwm/pwm-qti-lpg.txt create mode 100644 drivers/pwm/pwm-qti-lpg.cDocumentation/devicetree/bindings/pwm/pwm-qti-lpg.txt new file +0
-0
Documentation/devicetree/bindings/pwm/pwm-qti-lpg.txt line 9
Quoted 9 lines
Documentation/devicetree/bindings/pwm/pwm-qti-lpg.txt new file +9
-0@@ -0,0 +1,39 @@ +Qualcomm Technologies, Inc. LPG driver specific bindings + +This binding document describes the properties of LPG (Light Pulse Generator) +device module in Qualcomm Technologies, Inc. PMIC chips. + +- compatible: + Usage: required + Value type: <string> + Definition: Must be "qcom,pwm-lpg".
Needs SoC specific compatible strings.
Documentation/devicetree/bindings/pwm/pwm-qti-lpg.txt line 22
Quoted 13 lines
Documentation/devicetree/bindings/pwm/pwm-qti-lpg.txt new file +13
-0+ +- reg: + Usage: required + Value type: <prop-encoded-array> + Definition: Register base and length for LPG modules. The length + varies based on the number of channels available in + the PMIC chips. + +- reg-names: + Usage: required + Value type: <string> + Definition: The name of the register defined in the reg property. + It must be "lpg-base".
-names is pointless when there is only 1.
Quoted 17 lines
Documentation/devicetree/bindings/pwm/pwm-qti-lpg.txt new file +17
-0+ +- #pwm-cells: + Usage: required + Value type: <u32> + Definition: The number of cells in "pwms" property specified in + PWM user nodes. It should be 2. The first cell is + the PWM channel ID indexed from 0, and the second + cell is the PWM default period in nanoseconds. + +Example: + + pmi8998_lpg: lpg@b100 { + compatible = "qcom,pwm-lpg"; + reg = <0xb100 0x600>; + reg-names = "lpg-base"; + #pwm-cells = <2>; + };