Re: [PATCH v4 3/5] leds-lm3530: support pwm input mode

From: Andrew Morton
Date: Tue Feb 07 2012 - 17:55:12 EST


On Mon, 6 Feb 2012 21:14:21 -0800
"Kim, Milo" <Milo.Kim@xxxxxx> wrote:

> * add 'struct lm3530_pwm_data' in the platform data
> The pwm data is the platform specific functions which generate the pwm.
> The pwm data is only valid when brightness is pwm input mode.
> Functions should be implemented by the pwm driver.
> pwm_set_intensity() : set duty of pwm.
> pwm_get_intensity() : get current the brightness.
>
> * brightness control by pwm
> If the control mode is pwm, then brightness is changed by the duty of pwm.
> So pwm platform function should be called in lm3530_brightness_set().
>
> * do not update brightness register when pwm input mode
> In pwm input mode, brightness register is not used.
> If any value is updated in this register, then the led will be off.
>
> * when input mode is changed, set duty of pwm to 0 if unnecessary.
>
> * patch base version : kernel 3.2.4
>
>
> ...
>
> @@ -327,14 +344,11 @@ static ssize_t lm3530_mode_set(struct device *dev, struct device_attribute
> return -EINVAL;
> }
>
> - if (mode == LM3530_BL_MODE_MANUAL)
> - drvdata->mode = LM3530_BL_MODE_MANUAL;
> - else if (mode == LM3530_BL_MODE_ALS)
> - drvdata->mode = LM3530_BL_MODE_ALS;
> - else if (mode == LM3530_BL_MODE_PWM) {
> - dev_err(dev, "PWM mode not supported\n");
> - return -EINVAL;
> - }
> + drvdata->mode = mode;
> +
> + /* set pwm to low if unnecessary */
> + if (mode != LM3530_BL_MODE_PWM && pwm->pwm_set_intensity)
> + pwm->pwm_set_intensity(0, max_brightness);

lm3530_mode_set() has no local variable "pwm" and has no local variable
"brightness".

I see now that you prepared the patches against 3.2.4, which might
contribute to this problem, but I don't see how the patches could work
in 3.2 either. Perhaps 3.2.4 is significantly different from 3.2.

Anyway, I think I will drop all the patches again until we can get this
fully sorted out. Please don't prepare patches against ancient old
kernels like 3.2.4! They should be prepared and tested against the
latest Linus tree, from
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git. Or
against the latest linux-next from
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
--
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/