pwm: lpc32xx: Add support to control PWM_PIN_LEVEL bit
Subsystems (3)
v2 cover pwm: lpc32xx: Add support to control PWM_PIN_LEVEL bit
From: Sylvain Lemieux <[email protected]>
The PWM_PIN_LEVEL bit is leave unset by the kernel PWM driver.
Prior to commit 08ee77b5a5de27ad63c92262ebcb4efe0da93b58, the PWM_PIN_LEVEL bit was always clear when the PWM was disable and a 0 logic level was apply to the output.
According to the LPC32x0 User Manual [1], the default value for bit 30 (PWM_PIN_LEVEL) is 0.
First patch:
* initialize the pin level to 0 (default value) and update the register value accordingly.
Second anf third patches:
* provide support to configure the pin output (i.e. PWM_PIN_LEVEL bit) when the PWM is disabled.
Note:
* Follow this URL to access the discussion for version 1 of this
patch: http://thread.gmane.org/gmane.linux.pwm/3882
[1] http://www.nxp.com/documents/user_manual/UM10326.pdf
Sylvain Lemieux (3):
pwm: lpc32xx: Set PWM_PIN_LEVEL bit to default value
pwm: lpc32xx: Add support for PWM_PIN_LEVEL bit configuration
dt-bindings: pwm: lpc32xx: Add nxp,pwm-disabled-level-high property
Documentation/devicetree/bindings/pwm/lpc32xx-pwm.txt | 3 +++ drivers/pwm/pwm-lpc32xx.c | 11 +++++++++++ 2 files changed, 14 insertions(+)
Signature · 1 line
1.8.3.1
PATCH v2 1/3 pwm: lpc32xx: Set PWM_PIN_LEVEL bit to default value
From: Sylvain Lemieux <[email protected]>
The PWM_PIN_LEVEL bit is leave unset by the kernel PWM driver.
Prior to commit 08ee77b5a5de27ad63c92262ebcb4efe0da93b58, the PWM_PIN_LEVEL bit was always clear when the PWM was disable and a 0 logic level was apply to the output.
According to the LPC32x0 User Manual [1], the default value for bit 30 (PWM_PIN_LEVEL) is 0.
This change initialize the pin level to 0 (default value) and update the register value accordingly.
[1] http://www.nxp.com/documents/user_manual/UM10326.pdf
---
Changes from v1 to v2:
* Only setup the "PWMx_PIN_LEVEL" once on probe.
drivers/pwm/pwm-lpc32xx.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/pwm/pwm-lpc32xx.c +7 -0
@@ -25,6 +25,7 @@ struct lpc32xx_pwm_chip { };#define PWM_ENABLE BIT(31) +#define PWM_PIN_LEVEL BIT(30)#define to_lpc32xx_pwm_chip (_chip) \ container_of(_chip, struct lpc32xx_pwm_chip, chip)
@@ -103,6 +104,7 @@ static int lpc32xx_pwm_probe(struct platform_device *pdev)struct lpc32xx_pwm_chip *lpc32xx;struct resource *res;int ret; +u32 val; lpc32xx =devm_kzalloc (&pdev->dev,sizeof (*lpc32xx),GFP_KERNEL );if (!lpc32xx)
@@ -128,6 +130,11 @@ static int lpc32xx_pwm_probe(struct platform_device *pdev)return ret; } +/* When PWM is disable, configure the output to the default value */ + val =readl (lpc32xx->base + (lpc32xx->chip.pwms[0 ].hwpwm <<2 )); + val &= ~PWM_PIN_LEVEL ; +writel (val, lpc32xx->base + (lpc32xx->chip.pwms[0 ].hwpwm <<2 )); +platform_set_drvdata (pdev, lpc32xx);return 0 ;
Signature · 1 line
1.8.3.1
Thierry Reding
AppliedPATCH v2 1/3 pwm: lpc32xx: Set PWM_PIN_LEVEL bit to default value
Quoted 16 lines · Sylvain Lemieux
From: Sylvain Lemieux <[email protected]>
The
PWM_PIN_LEVELbit is leave unset by the kernel PWM driver.Prior to commit
08ee77b5a5de27ad63c92262ebcb4efe0da93b58, thePWM_PIN_LEVELbit was always clear when the PWM was disable and a 0 logic level was apply to the output.According to the LPC32x0 User Manual [1], the default value for bit 30 (
PWM_PIN_LEVEL) is 0.This change initialize the pin level to 0 (default value) and update the register value accordingly.
Quoted 7 lines
Signed-off-by Sylvain Lemieux <[email protected]>---
Changes from v1 to v2:
* Only setup the "PWMx_PIN_LEVEL" once on probe.drivers/pwm/pwm-lpc32xx.c | 7 +++++++ 1 file changed, 7 insertions(+)
Applied, thanks.
Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160711/1096e082/attachment.sig>
PATCH v2 2/3 pwm: lpc32xx: Add support for PWM_PIN_LEVEL bit configuration
In reply to Sylvain LemieuxFrom: Sylvain Lemieux <[email protected]>
Provide support to configure the pin output (i.e. PWM_PIN_LEVEL bit) when the PWM is disabled.
Note:
When the LPC32xx PWM is disabled, both options of pin output high and low level values are valid; however this particular controller does not have polarity control.
Refer to the LPC32x0 User Manual [1], for details.
[1] http://www.nxp.com/documents/user_manual/UM10326.pdf
---
Changes from v1 to v2:
* New patch in version 2.
drivers/pwm/pwm-lpc32xx.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/pwm/pwm-lpc32xx.c +6 -2
@@ -130,9 +130,13 @@ static int lpc32xx_pwm_probe(struct platform_device *pdev)return ret; } -/* When PWM is disable, configure the output to the default value */ +/* When PWM is disable, configure the output correctly */ val =readl (lpc32xx->base + (lpc32xx->chip.pwms[0 ].hwpwm <<2 )); - val &= ~PWM_PIN_LEVEL ; +if (device_property_read_bool (&pdev->dev, +"nxp,pwm-disabled-level-high" )) + val |=PWM_PIN_LEVEL ; +else + val &= ~PWM_PIN_LEVEL ;writel (val, lpc32xx->base + (lpc32xx->chip.pwms[0 ].hwpwm <<2 ));platform_set_drvdata (pdev, lpc32xx);
Signature · 1 line
1.8.3.1
PATCH v2 3/3 dt-bindings: pwm: lpc32xx: Add nxp, pwm-disabled-level-high property
In reply to Sylvain LemieuxFrom: Sylvain Lemieux <[email protected]>
Document the nxp,pwm-disabled-level-high property used by the pwm-lpc32xx driver to setup the pin output level to high when the PWM is disabled.
The driver setup the pin output level to the reset value by default.
---
Changes from v1 to v2:
* New patch in version 2.
Documentation/devicetree/bindings/pwm/lpc32xx-pwm.txt | 3 +++ 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/pwm/lpc32xx-pwm.txt +3 -0
@@ -4,6 +4,9 @@ Required properties: - compatible: should be "nxp,lpc3220-pwm" - reg: physical base address and length of the controller's registers +Optional properties: +- nxp,pwm-disabled-level-high: Set the PWM output level to high when disabled + Examples: pwm at 4005c000 {
Signature · 1 line
1.8.3.1
Vladimir Zapolskiy
maintainerv2 cover pwm: lpc32xx: Add support to control PWM_PIN_LEVEL bit
In reply to Sylvain LemieuxHi Sylvain,
Quoted 11 lines · Sylvain Lemieux
From: Sylvain Lemieux <[email protected]>
The
PWM_PIN_LEVELbit is leave unset by the kernel PWM driver.Prior to commit
08ee77b5a5de27ad63c92262ebcb4efe0da93b58, thePWM_PIN_LEVELbit was always clear when the PWM was disable and a 0 logic level was apply to the output.According to the LPC32x0 User Manual [1], the default value for bit 30 (
PWM_PIN_LEVEL) is 0.
Quoted 7 lines
First patch:
* initialize the pin level to 0 (default value) and update the register value accordingly.Second anf third patches:
* provide support to configure the pin output (i.e.PWM_PIN_LEVELbit) when the PWM is disabled.
a short question, how do you use PWM? Does it serve as a backlight or something else?
Quoted 6 lines
Note:
* Follow this URL to access the discussion for version 1 of this
patch: http://thread.gmane.org/gmane.linux.pwm/3882
Quoted 9 lines
Sylvain Lemieux (3):
pwm: lpc32xx: SetPWM_PIN_LEVELbit to default value
pwm: lpc32xx: Add support forPWM_PIN_LEVELbit configuration
dt-bindings: pwm: lpc32xx: Add nxp,pwm-disabled-level-high propertyDocumentation/devicetree/bindings/pwm/lpc32xx-pwm.txt | 3 +++ drivers/pwm/pwm-lpc32xx.c | 11 +++++++++++ 2 files changed, 14 insertions(+)
--
With best wishes,
Vladimir
v2 cover pwm: lpc32xx: Add support to control PWM_PIN_LEVEL bit
Hi Vladimir,
Quoted 18 lines · Vladimir Zapolskiy
Hi Sylvain,
Quoted 15 lines · Sylvain Lemieux
From: Sylvain Lemieux <[email protected]>
The
PWM_PIN_LEVELbit is leave unset by the kernel PWM driver.Prior to commit
08ee77b5a5de27ad63c92262ebcb4efe0da93b58, thePWM_PIN_LEVELbit was always clear when the PWM was disable and a 0 logic level was apply to the output.According to the LPC32x0 User Manual [1], the default value for bit 30 (
PWM_PIN_LEVEL) is 0.First patch:
* initialize the pin level to 0 (default value) and update the register value accordingly.
Quoted 7 lines
Quoted 3 lines
Second anf third patches:
* provide support to configure the pin output (i.e.PWM_PIN_LEVELbit) when the PWM is disabled.a short question, how do you use PWM? Does it serve as a backlight or something else?
The PWM is used to control the LCD backlight intensity.
When we setup the backlight brightness level to 0, it should turn off the LCD display by disabling the PWM.
This is what was added to our board dts for it:
backlight {
compatible = "pwm-backlight";
pwms = <&pwm1 0 1250000>;
brightness-levels = <0 20 100>;
default-brightness-level = <2>;
};Quoted 11 lines
Quoted 11 lines
Note:
* Follow this URL to access the discussion for version 1 of this
patch: http://thread.gmane.org/gmane.linux.pwm/3882[1] http://www.nxp.com/documents/user_manual/UM10326.pdf
Sylvain Lemieux (3):
pwm: lpc32xx: SetPWM_PIN_LEVELbit to default value
pwm: lpc32xx: Add support forPWM_PIN_LEVELbit configuration
dt-bindings: pwm: lpc32xx: Add nxp,pwm-disabled-level-high property
Quoted 8 lines
Quoted 4 lines
Documentation/devicetree/bindings/pwm/lpc32xx-pwm.txt | 3 +++ drivers/pwm/pwm-lpc32xx.c | 11 +++++++++++ 2 files changed, 14 insertions(+)--
With best wishes,
Vladimir
Sylvain
Vladimir Zapolskiy
maintainerv2 cover pwm: lpc32xx: Add support to control PWM_PIN_LEVEL bit
Hi Sylvain,
Quoted 33 lines · Sylvain Lemieux
Hi Vladimir,
Quoted 18 lines · Vladimir Zapolskiy
Hi Sylvain,
Quoted 15 lines · Sylvain Lemieux
From: Sylvain Lemieux <[email protected]>
The
PWM_PIN_LEVELbit is leave unset by the kernel PWM driver.Prior to commit
08ee77b5a5de27ad63c92262ebcb4efe0da93b58, thePWM_PIN_LEVELbit was always clear when the PWM was disable and a 0 logic level was apply to the output.According to the LPC32x0 User Manual [1], the default value for bit 30 (
PWM_PIN_LEVEL) is 0.First patch:
* initialize the pin level to 0 (default value) and update the register value accordingly.Quoted 7 lines
Quoted 3 lines
Second anf third patches:
* provide support to configure the pin output (i.e.PWM_PIN_LEVELbit) when the PWM is disabled.a short question, how do you use PWM? Does it serve as a backlight or something else?
The PWM is used to control the LCD backlight intensity.
When we setup the backlight brightness level to 0, it should turn off the LCD display by disabling the PWM.
Quoted 9 lines
This is what was added to our board dts for it:
backlight { compatible = "pwm-backlight"; pwms = <&pwm1 0 1250000>; brightness-levels = <0 20 100>; default-brightness-level = <2>; };
this is good that there is a consumer and we are not talking in general, then it might be more visual that the new property probably is not needed due to the lack of use cases.
I think that we should start from something as simple as one-time setting of PWMx_PIN_LEVEL to default 0 in lpc32xx_pwm_probe() and then implement a proper support of boundary values as suggested in discussion of v1 series.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Note:
* Follow this URL to access the discussion for version 1 of this
patch: http://thread.gmane.org/gmane.linux.pwm/3882
--
With best wishes,
Vladimir
v2 cover pwm: lpc32xx: Add support to control PWM_PIN_LEVEL bit
Hi Thierry,
Quoted 46 lines · Vladimir Zapolskiy
Hi Sylvain,
Quoted 33 lines · Sylvain Lemieux
Hi Vladimir,
Quoted 18 lines · Vladimir Zapolskiy
Hi Sylvain,
Quoted 15 lines · Sylvain Lemieux
From: Sylvain Lemieux <[email protected]>
The
PWM_PIN_LEVELbit is leave unset by the kernel PWM driver.Prior to commit
08ee77b5a5de27ad63c92262ebcb4efe0da93b58, thePWM_PIN_LEVELbit was always clear when the PWM was disable and a 0 logic level was apply to the output.According to the LPC32x0 User Manual [1], the default value for bit 30 (
PWM_PIN_LEVEL) is 0.First patch:
* initialize the pin level to 0 (default value) and update the register value accordingly.Quoted 7 lines
Quoted 3 lines
Second anf third patches:
* provide support to configure the pin output (i.e.PWM_PIN_LEVELbit) when the PWM is disabled.a short question, how do you use PWM? Does it serve as a backlight or something else?
The PWM is used to control the LCD backlight intensity.
When we setup the backlight brightness level to 0, it should turn off the LCD display by disabling the PWM.
Quoted 9 lines
This is what was added to our board dts for it:
backlight { compatible = "pwm-backlight"; pwms = <&pwm1 0 1250000>; brightness-levels = <0 20 100>; default-brightness-level = <2>; };
Quoted 9 lines
this is good that there is a consumer and we are not talking in general, then it might be more visual that the new property probably is not needed due to the lack of use cases.
I think that we should start from something as simple as one-time setting of
PWMx_PIN_LEVELto default 0 inlpc32xx_pwm_probe()and then implement a proper support of boundary values as suggested in discussion of v1 series.
Can you take the patch 1 of this series? This resolved an issue with the LPC32xx PWM when use to control the LCD backlight brightness level.
As suggested, we can later discuss the best way to implement proper support of boundary values.
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Note:
* Follow this URL to access the discussion for version 1 of this
patch: http://thread.gmane.org/gmane.linux.pwm/3882--
With best wishes,
Vladimir