From: Peter Ujfalusi <peter.ujfalusi@ti.com>
To: Bryan Wu <cooloney@gmail.com>
Cc: Richard Purdie <rpurdie@rpsys.net>,
linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org,
devicetree-discuss@lists.ozlabs.org
Subject: Re: [PATCH v2 1/3] leds: leds-pwm: Convert to use devm_get_pwm
Date: Mon, 3 Dec 2012 15:13:37 +0100 [thread overview]
Message-ID: <50BCB391.1070305@ti.com> (raw)
In-Reply-To: <CAK5ve-JDCSSOKHQG-F1RoDii62=-DiPevaD6SafndYVvOgB6Fw@mail.gmail.com>
Hi Bryan,
On 11/14/2012 02:14 AM, Bryan Wu wrote:
> On Mon, Nov 12, 2012 at 6:41 AM, Peter Ujfalusi <peter.ujfalusi@ti.com> wrote:
>> Update the driver to use the new API for requesting pwm so we can take
>> advantage of the pwm_lookup table to find the correct pwm to be used for the
>> LED functionality.
>> If the devm_get_pwm fails we fall back to legacy mode to try to get the pwm.
>>
>> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
>> ---
>> drivers/leds/leds-pwm.c | 19 ++++++-------------
>> include/linux/leds_pwm.h | 2 +-
>> 2 files changed, 7 insertions(+), 14 deletions(-)
>>
>> diff --git a/drivers/leds/leds-pwm.c b/drivers/leds/leds-pwm.c
>> index f2e44c7..c953c75 100644
>> --- a/drivers/leds/leds-pwm.c
>> +++ b/drivers/leds/leds-pwm.c
>> @@ -67,12 +67,11 @@ static int led_pwm_probe(struct platform_device *pdev)
>> cur_led = &pdata->leds[i];
>> led_dat = &leds_data[i];
>>
>> - led_dat->pwm = pwm_request(cur_led->pwm_id,
>> - cur_led->name);
>> + led_dat->pwm = devm_pwm_get(&pdev->dev, cur_led->name);
>> if (IS_ERR(led_dat->pwm)) {
>> ret = PTR_ERR(led_dat->pwm);
>> - dev_err(&pdev->dev, "unable to request PWM %d\n",
>> - cur_led->pwm_id);
>> + dev_err(&pdev->dev, "unable to request PWM for %s\n",
>> + cur_led->name);
>> goto err;
>> }
>>
>> @@ -86,10 +85,8 @@ static int led_pwm_probe(struct platform_device *pdev)
>> led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME;
>>
>> ret = led_classdev_register(&pdev->dev, &led_dat->cdev);
>> - if (ret < 0) {
>> - pwm_free(led_dat->pwm);
>> + if (ret < 0)
>> goto err;
>> - }
>> }
>>
>> platform_set_drvdata(pdev, leds_data);
>> @@ -98,10 +95,8 @@ static int led_pwm_probe(struct platform_device *pdev)
>>
>> err:
>> if (i > 0) {
>> - for (i = i - 1; i >= 0; i--) {
>> + for (i = i - 1; i >= 0; i--)
>> led_classdev_unregister(&leds_data[i].cdev);
>> - pwm_free(leds_data[i].pwm);
>> - }
>> }
>>
>> return ret;
>> @@ -115,10 +110,8 @@ static int __devexit led_pwm_remove(struct platform_device *pdev)
>>
>> leds_data = platform_get_drvdata(pdev);
>>
>> - for (i = 0; i < pdata->num_leds; i++) {
>> + for (i = 0; i < pdata->num_leds; i++)
>> led_classdev_unregister(&leds_data[i].cdev);
>> - pwm_free(leds_data[i].pwm);
>> - }
>>
>> return 0;
>> }
>> diff --git a/include/linux/leds_pwm.h b/include/linux/leds_pwm.h
>> index 33a0711..a65e964 100644
>> --- a/include/linux/leds_pwm.h
>> +++ b/include/linux/leds_pwm.h
>> @@ -7,7 +7,7 @@
>> struct led_pwm {
>> const char *name;
>> const char *default_trigger;
>> - unsigned pwm_id;
>> + unsigned pwm_id __deprecated;
>
> I suggest we remove this later, we can provide patches from this from
> platform data of board file. And I think this patch is good for me to
> merge, will do it soon.
I have marked the pwm_id as deprecated for now to allow one kernel cycle for
external (?) drivers to adopt. We can remove it for 3.9 I think.
I just checked linux-next today and this series is still not there. Do you
want me to resend it for you? I can rebase the patches on top of linux-next or
if you have preference on which tree should I use please let me know.
>
> Thanks,
> -Bryan
>
>> u8 active_low;
>> unsigned max_brightness;
>> unsigned pwm_period_ns;
>> --
>> 1.8.0
>>
Thanks,
Péter
WARNING: multiple messages have this Message-ID (diff)
From: Peter Ujfalusi <peter.ujfalusi@ti.com>
To: Bryan Wu <cooloney@gmail.com>
Cc: Richard Purdie <rpurdie@rpsys.net>, <linux-leds@vger.kernel.org>,
<linux-kernel@vger.kernel.org>,
<devicetree-discuss@lists.ozlabs.org>
Subject: Re: [PATCH v2 1/3] leds: leds-pwm: Convert to use devm_get_pwm
Date: Mon, 3 Dec 2012 15:13:37 +0100 [thread overview]
Message-ID: <50BCB391.1070305@ti.com> (raw)
In-Reply-To: <CAK5ve-JDCSSOKHQG-F1RoDii62=-DiPevaD6SafndYVvOgB6Fw@mail.gmail.com>
Hi Bryan,
On 11/14/2012 02:14 AM, Bryan Wu wrote:
> On Mon, Nov 12, 2012 at 6:41 AM, Peter Ujfalusi <peter.ujfalusi@ti.com> wrote:
>> Update the driver to use the new API for requesting pwm so we can take
>> advantage of the pwm_lookup table to find the correct pwm to be used for the
>> LED functionality.
>> If the devm_get_pwm fails we fall back to legacy mode to try to get the pwm.
>>
>> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
>> ---
>> drivers/leds/leds-pwm.c | 19 ++++++-------------
>> include/linux/leds_pwm.h | 2 +-
>> 2 files changed, 7 insertions(+), 14 deletions(-)
>>
>> diff --git a/drivers/leds/leds-pwm.c b/drivers/leds/leds-pwm.c
>> index f2e44c7..c953c75 100644
>> --- a/drivers/leds/leds-pwm.c
>> +++ b/drivers/leds/leds-pwm.c
>> @@ -67,12 +67,11 @@ static int led_pwm_probe(struct platform_device *pdev)
>> cur_led = &pdata->leds[i];
>> led_dat = &leds_data[i];
>>
>> - led_dat->pwm = pwm_request(cur_led->pwm_id,
>> - cur_led->name);
>> + led_dat->pwm = devm_pwm_get(&pdev->dev, cur_led->name);
>> if (IS_ERR(led_dat->pwm)) {
>> ret = PTR_ERR(led_dat->pwm);
>> - dev_err(&pdev->dev, "unable to request PWM %d\n",
>> - cur_led->pwm_id);
>> + dev_err(&pdev->dev, "unable to request PWM for %s\n",
>> + cur_led->name);
>> goto err;
>> }
>>
>> @@ -86,10 +85,8 @@ static int led_pwm_probe(struct platform_device *pdev)
>> led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME;
>>
>> ret = led_classdev_register(&pdev->dev, &led_dat->cdev);
>> - if (ret < 0) {
>> - pwm_free(led_dat->pwm);
>> + if (ret < 0)
>> goto err;
>> - }
>> }
>>
>> platform_set_drvdata(pdev, leds_data);
>> @@ -98,10 +95,8 @@ static int led_pwm_probe(struct platform_device *pdev)
>>
>> err:
>> if (i > 0) {
>> - for (i = i - 1; i >= 0; i--) {
>> + for (i = i - 1; i >= 0; i--)
>> led_classdev_unregister(&leds_data[i].cdev);
>> - pwm_free(leds_data[i].pwm);
>> - }
>> }
>>
>> return ret;
>> @@ -115,10 +110,8 @@ static int __devexit led_pwm_remove(struct platform_device *pdev)
>>
>> leds_data = platform_get_drvdata(pdev);
>>
>> - for (i = 0; i < pdata->num_leds; i++) {
>> + for (i = 0; i < pdata->num_leds; i++)
>> led_classdev_unregister(&leds_data[i].cdev);
>> - pwm_free(leds_data[i].pwm);
>> - }
>>
>> return 0;
>> }
>> diff --git a/include/linux/leds_pwm.h b/include/linux/leds_pwm.h
>> index 33a0711..a65e964 100644
>> --- a/include/linux/leds_pwm.h
>> +++ b/include/linux/leds_pwm.h
>> @@ -7,7 +7,7 @@
>> struct led_pwm {
>> const char *name;
>> const char *default_trigger;
>> - unsigned pwm_id;
>> + unsigned pwm_id __deprecated;
>
> I suggest we remove this later, we can provide patches from this from
> platform data of board file. And I think this patch is good for me to
> merge, will do it soon.
I have marked the pwm_id as deprecated for now to allow one kernel cycle for
external (?) drivers to adopt. We can remove it for 3.9 I think.
I just checked linux-next today and this series is still not there. Do you
want me to resend it for you? I can rebase the patches on top of linux-next or
if you have preference on which tree should I use please let me know.
>
> Thanks,
> -Bryan
>
>> u8 active_low;
>> unsigned max_brightness;
>> unsigned pwm_period_ns;
>> --
>> 1.8.0
>>
Thanks,
Péter
next prev parent reply other threads:[~2012-12-03 14:13 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-12 14:41 [PATCH v2 0/3] leds: leds-pwm: Device tree support Peter Ujfalusi
2012-11-12 14:41 ` Peter Ujfalusi
[not found] ` <1352731270-27534-1-git-send-email-peter.ujfalusi-l0cyMroinI0@public.gmane.org>
2012-11-12 14:41 ` [PATCH v2 1/3] leds: leds-pwm: Convert to use devm_get_pwm Peter Ujfalusi
2012-11-12 14:41 ` Peter Ujfalusi
2012-11-14 1:14 ` Bryan Wu
[not found] ` <CAK5ve-JDCSSOKHQG-F1RoDii62=-DiPevaD6SafndYVvOgB6Fw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-11-14 7:13 ` Peter Ujfalusi
2012-11-14 7:13 ` Peter Ujfalusi
2012-12-03 14:13 ` Peter Ujfalusi [this message]
2012-12-03 14:13 ` Peter Ujfalusi
2012-12-03 18:32 ` Bryan Wu
[not found] ` <CAK5ve-+1eQ3mPLAu2Qxw4LjNA85oEtJE-wZcL=YpQ0xBFJ6+hQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-12-04 8:11 ` Peter Ujfalusi
2012-12-04 8:11 ` Peter Ujfalusi
2012-12-04 17:34 ` Bryan Wu
2012-12-05 15:36 ` Peter Ujfalusi
2012-12-05 15:36 ` Peter Ujfalusi
2012-11-12 14:41 ` [PATCH v2 2/3] leds: leds-pwm: Preparing the driver for device tree support Peter Ujfalusi
2012-11-12 14:41 ` Peter Ujfalusi
2012-11-12 14:41 ` [PATCH v2 3/3] leds: leds-pwm: Add device tree bindings Peter Ujfalusi
2012-11-12 14:41 ` Peter Ujfalusi
[not found] ` <1352731270-27534-4-git-send-email-peter.ujfalusi-l0cyMroinI0@public.gmane.org>
2012-12-06 10:00 ` Grant Likely
2012-12-06 10:00 ` Grant Likely
2012-12-06 12:36 ` Peter Ujfalusi
2012-12-06 12:36 ` Peter Ujfalusi
[not found] ` <50C0913B.9070802-l0cyMroinI0@public.gmane.org>
2012-12-07 13:34 ` Grant Likely
2012-12-07 13:34 ` Grant Likely
2012-12-07 14:04 ` Peter Ujfalusi
2012-12-07 14:04 ` Peter Ujfalusi
2012-12-10 22:37 ` Grant Likely
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50BCB391.1070305@ti.com \
--to=peter.ujfalusi@ti.com \
--cc=cooloney@gmail.com \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=rpurdie@rpsys.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.