public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: nicolas.ferre@atmel•com (Nicolas Ferre)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH 2/3] at91_udc: Add vbus polarity and polling mode
Date: Thu, 01 Jul 2010 15:45:02 +0200	[thread overview]
Message-ID: <4C2C9BDE.8090504@atmel.com> (raw)
In-Reply-To: <1277699955-9931-3-git-send-email-ryan@bluewatersys.com>

Le 28/06/2010 06:39, Ryan Mallon :
> Allow the vbus signal to optionally use polling. This is required if
> the vbus signal is connected to an non-interrupting io expander for
> example. If vbus is in polling mode, then it is assumed that the vbus
> gpio may sleep. Also add an option to have vbus be an active low
> signal. Both options are set in the platform data for the device.
> 
> Signed-off-by: Ryan Mallon <ryan@bluewatersys•com>

Looks good, but... one question:

> @@ -1763,13 +1793,22 @@ static int __init at91udc_probe(struct platform_device *pdev)
>  		 * Get the initial state of VBUS - we cannot expect
>  		 * a pending interrupt.
>  		 */
> -		udc->vbus = gpio_get_value(udc->board.vbus_pin);
> -		if (request_irq(udc->board.vbus_pin, at91_vbus_irq,
> -				IRQF_DISABLED, driver_name, udc)) {
> -			DBG("request vbus irq %d failed\n",
> -					udc->board.vbus_pin);
> -			retval = -EBUSY;
> -			goto fail3;
> +		if (udc->board.vbus_polled) {
> +			udc->vbus = gpio_get_value_cansleep(udc->board.vbus_pin);

Shouldn't we need here something like:
udc->vbus =  (udc->board.vbus_active_low) ^ gpio_get_value_cansleep(udc->board.vbus_pin);

?

> +			INIT_WORK(&udc->vbus_timer_work, at91_vbus_timer_work);
> +			setup_timer(&udc->vbus_timer, at91_vbus_timer,
> +				    (unsigned long)udc);		
> +			mod_timer(&udc->vbus_timer,
> +				  jiffies + VBUS_POLL_TIMEOUT);
> +		} else {
> +			udc->vbus = gpio_get_value(udc->board.vbus_pin);

Ditto.

> +			if (request_irq(udc->board.vbus_pin, at91_vbus_irq,
> +					IRQF_DISABLED, driver_name, udc)) {
> +				DBG("request vbus irq %d failed\n",
> +				    udc->board.vbus_pin);
> +				retval = -EBUSY;
> +				goto fail3;
> +			}


Best regards,
-- 
Nicolas Ferre

  parent reply	other threads:[~2010-07-01 13:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-28  4:39 [PATCH 0/3] at91: Add support for Bluewater Systems Snapper 9260/9G20 modules Ryan Mallon
2010-06-28  4:39 ` [PATCH 1/3] AT91: Define NR_BUILTIN_GPIO Ryan Mallon
2010-06-28  5:41   ` avictor.za at gmail.com
2010-06-28  4:39 ` [PATCH 2/3] at91_udc: Add vbus polarity and polling mode Ryan Mallon
2010-06-30 21:02   ` Ryan Mallon
2010-07-01 13:45   ` Nicolas Ferre [this message]
2010-07-02  4:40     ` Ryan Mallon
2010-07-05 21:01       ` Ryan Mallon
2010-07-06  8:32       ` Nicolas Ferre
2010-06-28  4:39 ` [PATCH 3/3] at91: Add support for Bluewater Systems Snapper 9260/9G20 modules Ryan Mallon
2010-06-28  5:47   ` avictor.za at gmail.com
2010-06-28  9:17     ` Ryan Mallon
  -- strict thread matches above, loose matches on Subject: below --
2010-06-16 21:20 [PATCH 0/3] at91: Add support for " Ryan Mallon
2010-06-16 21:20 ` [PATCH 2/3] at91_udc: Add vbus polarity and polling mode Ryan Mallon
2010-06-17 22:03   ` Ryan Mallon

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=4C2C9BDE.8090504@atmel.com \
    --to=nicolas.ferre@atmel$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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