Re: [PATCH v3 3/3] pwm: New driver to support PWM driven LEDs onTWL4030/6030 series of PMICs
From: Peter Ujfalusi
Date: Tue Nov 20 2012 - 06:54:06 EST
On 11/20/2012 10:56 AM, Peter Ujfalusi wrote:
> The driver supports the following LED outputs as generic PWM driver:
> TWL4030 LEDA and LEDB (PWMA and PWMB)
> TWL6030 Charging indicator LED (PWM LED)
>
> On TWL6030 when the PWM requested LED is configured to be controlled by SW.
> In this case the user can enable/disable and set the duty period freely.
> When the PWM has been freed, the LED driver is put back to HW control.
>
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@xxxxxx>
> ---
> drivers/pwm/Kconfig | 10 ++
> drivers/pwm/Makefile | 1 +
> drivers/pwm/pwm-twl-led.c | 303 ++++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 314 insertions(+)
> create mode 100644 drivers/pwm/pwm-twl-led.c
...
> +static int twl4030_pwmled_config(struct pwm_chip *chip, struct pwm_device *pwm,
> + int duty_ns, int period_ns)
> +{
> + int duty_cycle = DIV_ROUND_UP(duty_ns * TWL4030_LED_MAX, period_ns);
> + u8 pwm_config[2] = {1, 0};
> + int base, ret;
> +
> + /*
> + * To configure the duty period:
> + * On-cycle is set to 1 (the minimum allowed value)
> + * The off time of 0 is not configurable, so the mapping is:
> + * 0 -> off cycle = 2,
> + * 1 -> off cycle = 2,
> + * 2 -> off cycle = 3,
> + * 125 - > off cycle 127,
> + * 126 - > off cycle 1
Oh, I missed to save the updated comment before I commited the change.
Can I just send and update patch instead of the whole series again?
> + * When on cycle == off cycle the PWM will be always on
> + */
--
Péter
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/