linux-embedded.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bill Gatliff <bgat@billgatliff.com>
To: Mike Frysinger <vapier.adi@gmail.com>
Cc: linux-embedded@vger.kernel.org
Subject: Re: [[RFC] 2/5] Emulates PWM hardware using a high-resolution timer and a GPIO pin
Date: Mon, 19 Oct 2009 20:47:13 -0500	[thread overview]
Message-ID: <4ADD16A1.6010508@billgatliff.com> (raw)
In-Reply-To: <8bd0f97a0910191456n1b8f1aabr9b54b1126b2ec0c6@mail.gmail.com>

Mike Frysinger wrote:
> On Mon, Oct 19, 2009 at 16:32, Bill Gatliff wrote:
>   
>> --- /dev/null
>> +++ b/drivers/pwm/gpio.c
>> @@ -0,0 +1,318 @@
>> +#define DEBUG 99
>>     
>
> whoops
>
>   

Indeed!


>> +       pr_debug("%s:%d start, %lu ticks\n",
>> +                dev_name(p->pwm->dev), p->chan, p->duty_ticks);
>>     
>
> you already have a struct device, so this is just odd.  use dev_dbg()
> instead and let it worry about dev_name() stuff.  plus you're already
> using dev_dbg() in the rest of the code, so i guess you just forgot
> about this.
>   

Yea, I think so.

>> +       case PWM_CONFIG_START:
>> +               if (!hrtimer_active(&gp->t)) {
>> +                       gpio_pwm_start(p);
>> +               }
>>     
>
> dont really need those braces
>   

Agreed.

>> +       struct gpio_pwm *gp = container_of(p->pwm, struct gpio_pwm, pwm);
>>     
>
> helper macro for this ?
>   

Ditto.

>> +static int
>> +gpio_pwm_config(struct pwm_channel *p,
>> +               struct pwm_channel_config *c)
>> +{
>> +       struct gpio_pwm *gp = container_of(p->pwm, struct gpio_pwm, pwm);
>> +       int was_on = 0;
>> +
>> +       if (p->pwm->config_nosleep) {
>> +               if (!p->pwm->config_nosleep(p, c))
>> +                       return 0;
>> +       }
>> +
>> +       might_sleep();
>>     
>
> shouldnt this be above the config_n
>   

Actually, not.  In this example I'm hoping that the requested action can 
be handled by the config_nosleep code, and if it can then I just 
return.  Otherwise, I go through the might_sleep and then into the code 
that might actually sleep.

But, I think the upper-level code might already do this same thing, so 
the above might be entirely redundant.  I'll have to check on that.


>> +static int __init
>> +gpio_pwm_probe(struct platform_device *pdev)
>>     
>
> __devinit
>   

Yep.

>> +static struct platform_driver gpio_pwm_driver = {
>> +       .driver = {
>> +               .name = "gpio_pwm",
>> +               .owner = THIS_MODULE,
>> +       },
>>     
>
> dont need the explicit .owner ?
>   

Again, not sure.


>   
>> +static void gpio_pwm_exit(void)
>>     
>
> __exit
>   

I think so, yes.


>> +MODULE_DESCRIPTION("PWM output using GPIO and an itimer");
>>     
>
> itimer -> hrtimer ?
>   

Yep.


b.g.

-- 
Bill Gatliff
bgat@billgatliff.com

  reply	other threads:[~2009-10-20  1:47 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-19 20:32 [[RFC] 0/5] Generic PWM API Proposal Bill Gatliff
2009-10-19 20:32 ` [[RFC] 1/5] API to consolidate PWM devices behind a common user and kernel interface Bill Gatliff
2009-10-19 20:32   ` [[RFC] 2/5] Emulates PWM hardware using a high-resolution timer and a GPIO pin Bill Gatliff
2009-10-19 20:32     ` [[RFC] 3/5] Expunge old Atmel PWMC driver, replacing it with one that conforms to the PWM API Bill Gatliff
2009-10-19 20:32       ` [[RFC] 4/5] An LED "dimmer" trigger, which uses the PWM API to vary the brightness of an LED according to system load Bill Gatliff
2009-10-19 20:32         ` [[RFC] 5/5] Incorporate PWM API code into KBuild Bill Gatliff
2009-10-19 22:30           ` Mike Frysinger
2009-10-19 21:51         ` [[RFC] 4/5] An LED "dimmer" trigger, which uses the PWM API to vary the brightness of an LED according to system load Mike Frysinger
2009-10-20  1:42           ` Bill Gatliff
2009-10-20  3:58             ` Mike Frysinger
2009-10-30 14:03             ` Luotao Fu
2009-10-31  7:43               ` Trilok Soni
2009-10-31  7:45                 ` Trilok Soni
2009-10-19 22:34       ` [[RFC] 3/5] Expunge old Atmel PWMC driver, replacing it with one that conforms to the PWM API Mike Frysinger
2009-10-20  2:02         ` Bill Gatliff
2009-10-19 21:56     ` [[RFC] 2/5] Emulates PWM hardware using a high-resolution timer and a GPIO pin Mike Frysinger
2009-10-20  1:47       ` Bill Gatliff [this message]
2009-11-17  8:29     ` David Brownell
2009-11-17 16:00       ` Bill Gatliff
2009-11-18 21:02         ` Aras Vaichas
2009-10-19 22:29   ` [[RFC] 1/5] API to consolidate PWM devices behind a common user and kernel interface Mike Frysinger
2009-10-20  1:59     ` Bill Gatliff

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=4ADD16A1.6010508@billgatliff.com \
    --to=bgat@billgatliff.com \
    --cc=linux-embedded@vger.kernel.org \
    --cc=vapier.adi@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).