Re: [PATCH] leds: pwm: Allow changing the pinctrl state

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

 



Hi Jacek,

On Fri, Nov 17, 2017 at 6:51 PM, Jacek Anaszewski
<jacek.anaszewski@xxxxxxxxx> wrote:

> On power down event brightness is set to 0 on each registered
> LED class device that set LED_CORE_SUSPENDRESUME flag (leds-pwm does).
>
> It may be the case that pwm subsystem (or underlaying bus used by
> particular controller) is suspended before LED subsystem, or the
> culprit is the generic LED subsystem workqueue in which brightness
> setting events are queued for drivers that use brightness_set_blocking
> op (leds-pwm case).

Thanks for your comments.

I realized that this issue can be fixed inside drivers/pwm/pwm-imx.c :

--- a/drivers/pwm/pwm-imx.c
+++ b/drivers/pwm/pwm-imx.c
@@ -35,6 +35,7 @@
 #define MX3_PWMSAR                     0x0C    /* PWM Sample Register */
 #define MX3_PWMPR                      0x10    /* PWM Period Register */
 #define MX3_PWMCR_PRESCALER(x)         ((((x) - 1) & 0xFFF) << 4)
+#define MX3_PWMCR_STOPEN               (1 << 25)
 #define MX3_PWMCR_DOZEEN               (1 << 24)
 #define MX3_PWMCR_WAITEN               (1 << 23)
 #define MX3_PWMCR_DBGEN                        (1 << 22)
@@ -209,7 +210,7 @@ static int imx_pwm_apply_v2(struct pwm_chip *chip,
struct pwm_device *pwm,
                writel(duty_cycles, imx->mmio_base + MX3_PWMSAR);
                writel(period_cycles, imx->mmio_base + MX3_PWMPR);

-               cr = MX3_PWMCR_PRESCALER(prescale) |
+               cr = MX3_PWMCR_PRESCALER(prescale) | MX3_PWMCR_STOPEN |
                     MX3_PWMCR_DOZEEN | MX3_PWMCR_WAITEN |
                     MX3_PWMCR_DBGEN | MX3_PWMCR_CLKSRC_IPG_HIGH |
                     MX3_PWMCR_EN;

Setting the STOPEN bit, which "keeps PWM functional while in stop
mode" does the trick.

Maybe I will convert this into an optional device tree property to
keep the original behavior.

Thanks



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux