public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] atmel uaba : Adding invert vbus_pin
@ 2010-01-04 13:01 Eirik Aanonsen
  2010-01-04 21:37 ` Sergei Shtylyov
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Eirik Aanonsen @ 2010-01-04 13:01 UTC (permalink / raw)
  To: kernel@avr32linux.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org

Adding vbus_pin_inverted so that the usb detect pin can be active high or low.
This because depending on HW implementation it is better to have active low.
Also replaced the pio_get_value(udc->vbus_pin); with a call to vbus_is_present(udc);

Signed-off-by: Eirik Aanonsen <eaa@wprmedical.com>
---
 drivers/usb/gadget/atmel_usba_udc.c |   16 +++++++++++++---
 drivers/usb/gadget/atmel_usba_udc.h |    1 +
 include/linux/usb/atmel_usba_udc.h  |    1 +
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c
index 4e970cf..1c469d4 100644
--- a/drivers/usb/gadget/atmel_usba_udc.c
+++ b/drivers/usb/gadget/atmel_usba_udc.c
@@ -320,8 +320,17 @@ static inline void usba_cleanup_debugfs(struct usba_udc *udc)
 static int vbus_is_present(struct usba_udc *udc)
 {
 	if (gpio_is_valid(udc->vbus_pin))
-		return gpio_get_value(udc->vbus_pin);
-
+	{	
+		if(udc->vbus_pin_inverted)
+		{
+			if( gpio_get_value(udc->vbus_pin) == 1)
+				return 0;
+			else
+				return 1;
+		}
+		else
+			return gpio_get_value(udc->vbus_pin);
+	}
 	/* No Vbus detection: Assume always present */
 	return 1;
 }
@@ -1763,7 +1772,7 @@ static irqreturn_t usba_vbus_irq(int irq, void *devid)
 	if (!udc->driver)
 		goto out;
 
-	vbus = gpio_get_value(udc->vbus_pin);
+	vbus = vbus_is_present(udc);
 	if (vbus != udc->vbus_prev) {
 		if (vbus) {
 			toggle_bias(1);
@@ -2000,6 +2009,7 @@ static int __init usba_udc_probe(struct platform_device *pdev)
 	if (gpio_is_valid(pdata->vbus_pin)) {
 		if (!gpio_request(pdata->vbus_pin, "atmel_usba_udc")) {
 			udc->vbus_pin = pdata->vbus_pin;
+			udc->vbus_pin_inverted = pdata->vbus_pin_inverted;
 
 			ret = request_irq(gpio_to_irq(udc->vbus_pin),
 					usba_vbus_irq, 0,
diff --git a/drivers/usb/gadget/atmel_usba_udc.h b/drivers/usb/gadget/atmel_usba_udc.h
index f7baea3..88a2e07 100644
--- a/drivers/usb/gadget/atmel_usba_udc.h
+++ b/drivers/usb/gadget/atmel_usba_udc.h
@@ -323,6 +323,7 @@ struct usba_udc {
 	struct platform_device *pdev;
 	int irq;
 	int vbus_pin;
+	int vbus_pin_inverted;
 	struct clk *pclk;
 	struct clk *hclk;
 
diff --git a/include/linux/usb/atmel_usba_udc.h b/include/linux/usb/atmel_usba_udc.h
index 6311fa2..643c4c5 100644
--- a/include/linux/usb/atmel_usba_udc.h
+++ b/include/linux/usb/atmel_usba_udc.h
@@ -15,6 +15,7 @@ struct usba_ep_data {
 
 struct usba_platform_data {
 	int			vbus_pin;
+	unsigned char vbus_pin_inverted;
 	int			num_ep;
 	struct usba_ep_data	ep[0];
 };
-- 
1.5.4.3

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/1] atmel uaba : Adding invert vbus_pin
  2010-01-04 13:01 [PATCH 1/1] atmel uaba : Adding invert vbus_pin Eirik Aanonsen
@ 2010-01-04 21:37 ` Sergei Shtylyov
  2010-01-04 21:54 ` Ben Nizette
  2010-01-15 18:54 ` Greg KH
  2 siblings, 0 replies; 11+ messages in thread
From: Sergei Shtylyov @ 2010-01-04 21:37 UTC (permalink / raw)
  To: Eirik Aanonsen
  Cc: kernel@avr32linux.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org

Hello.

Eirik Aanonsen wrote:

> Adding vbus_pin_inverted so that the usb detect pin can be active high or low.
> This because depending on HW implementation it is better to have active low.
> Also replaced the pio_get_value(udc->vbus_pin); with a call to vbus_is_present(udc);
>
> Signed-off-by: Eirik Aanonsen <eaa@wprmedical.com>
>   
[...]
> diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c
> index 4e970cf..1c469d4 100644
> --- a/drivers/usb/gadget/atmel_usba_udc.c
> +++ b/drivers/usb/gadget/atmel_usba_udc.c
> @@ -320,8 +320,17 @@ static inline void usba_cleanup_debugfs(struct usba_udc *udc)
>  static int vbus_is_present(struct usba_udc *udc)
>  {
>  	if (gpio_is_valid(udc->vbus_pin))
> -		return gpio_get_value(udc->vbus_pin);
> -
> +	{	
> +		if(udc->vbus_pin_inverted)
>   

   Space missing after *if*.

> +		{
> +			if( gpio_get_value(udc->vbus_pin) == 1)
>   

   Space missing after *if* and there should be no space after (.

> +				return 0;
> +			else
> +				return 1;
>   

   Why not simply:

			return !gpio_get_value(udc->vbus_pin);


> +		}
> +		else
>   

   } and *else* should be on the same line.
   Please run your patches thru scripts/checkpatch.pl before submitting...

WBR, Sergei



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/1] atmel uaba : Adding invert vbus_pin
  2010-01-04 13:01 [PATCH 1/1] atmel uaba : Adding invert vbus_pin Eirik Aanonsen
  2010-01-04 21:37 ` Sergei Shtylyov
@ 2010-01-04 21:54 ` Ben Nizette
  2010-01-15 18:54 ` Greg KH
  2 siblings, 0 replies; 11+ messages in thread
From: Ben Nizette @ 2010-01-04 21:54 UTC (permalink / raw)
  To: Eirik Aanonsen
  Cc: kernel@avr32linux.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org


On 05/01/2010, at 12:01 AM, Eirik Aanonsen wrote:

> Adding vbus_pin_inverted so that the usb detect pin can be active high or low.
> This because depending on HW implementation it is better to have active low.
> Also replaced the pio_get_value(udc->vbus_pin); with a call to vbus_is_present(udc);
> 
> Signed-off-by: Eirik Aanonsen <eaa@wprmedical.com>
> ---
> drivers/usb/gadget/atmel_usba_udc.c |   16 +++++++++++++---
> drivers/usb/gadget/atmel_usba_udc.h |    1 +
> include/linux/usb/atmel_usba_udc.h  |    1 +
> 3 files changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c
> index 4e970cf..1c469d4 100644
> --- a/drivers/usb/gadget/atmel_usba_udc.c
> +++ b/drivers/usb/gadget/atmel_usba_udc.c
> @@ -320,8 +320,17 @@ static inline void usba_cleanup_debugfs(struct usba_udc *udc)
> static int vbus_is_present(struct usba_udc *udc)
> {
> 	if (gpio_is_valid(udc->vbus_pin))
> -		return gpio_get_value(udc->vbus_pin);
> -
> +	{	
> +		if(udc->vbus_pin_inverted)
> +		{
> +			if( gpio_get_value(udc->vbus_pin) == 1)
> +				return 0;
> +			else
> +				return 1;
> +		}
> +		else
> +			return gpio_get_value(udc->vbus_pin);
> +	}

return gpio_get_value(udc->vbus_pin) ^ udc->vbus_pin_inverted

	--Ben.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/1] atmel uaba : Adding invert vbus_pin
@ 2010-01-05  8:47 Eirik Aanonsen
  2010-01-13 13:20 ` Eirik Aanonsen
  0 siblings, 1 reply; 11+ messages in thread
From: Eirik Aanonsen @ 2010-01-05  8:47 UTC (permalink / raw)
  To: kernel@avr32linux.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org

Thanks to Ben Nizette [bn@niasdigital.com] and Sergei Shtylyov [sshtylyov@ru.mvista.com] for good feedback

Adding vbus_pin_inverted so that the usb detect pin can be active high or low.
This because depending on HW implementation it is better to have active low.
Also replaced the pio_get_value(udc->vbus_pin); with a call to vbus_is_present(udc);

Signed-off-by: Eirik Aanonsen <eaa@wprmedical.com>
---
 drivers/usb/gadget/atmel_usba_udc.c |    6 +++---
 drivers/usb/gadget/atmel_usba_udc.h |    1 +
 include/linux/usb/atmel_usba_udc.h  |    1 +
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c
index 4e970cf..e1282fc 100644
--- a/drivers/usb/gadget/atmel_usba_udc.c
+++ b/drivers/usb/gadget/atmel_usba_udc.c
@@ -320,8 +320,7 @@ static inline void usba_cleanup_debugfs(struct usba_udc *udc)
 static int vbus_is_present(struct usba_udc *udc)
 {
 	if (gpio_is_valid(udc->vbus_pin))
-		return gpio_get_value(udc->vbus_pin);
-
+		return gpio_get_value(udc->vbus_pin) ^ udc->vbus_pin_inverted;
 	/* No Vbus detection: Assume always present */
 	return 1;
 }
@@ -1763,7 +1762,7 @@ static irqreturn_t usba_vbus_irq(int irq, void *devid)
 	if (!udc->driver)
 		goto out;
 
-	vbus = gpio_get_value(udc->vbus_pin);
+	vbus = vbus_is_present(udc);
 	if (vbus != udc->vbus_prev) {
 		if (vbus) {
 			toggle_bias(1);
@@ -2000,6 +1999,7 @@ static int __init usba_udc_probe(struct platform_device *pdev)
 	if (gpio_is_valid(pdata->vbus_pin)) {
 		if (!gpio_request(pdata->vbus_pin, "atmel_usba_udc")) {
 			udc->vbus_pin = pdata->vbus_pin;
+			udc->vbus_pin_inverted = pdata->vbus_pin_inverted;
 
 			ret = request_irq(gpio_to_irq(udc->vbus_pin),
 					usba_vbus_irq, 0,
diff --git a/drivers/usb/gadget/atmel_usba_udc.h b/drivers/usb/gadget/atmel_usba_udc.h
index f7baea3..88a2e07 100644
--- a/drivers/usb/gadget/atmel_usba_udc.h
+++ b/drivers/usb/gadget/atmel_usba_udc.h
@@ -323,6 +323,7 @@ struct usba_udc {
 	struct platform_device *pdev;
 	int irq;
 	int vbus_pin;
+	int vbus_pin_inverted;
 	struct clk *pclk;
 	struct clk *hclk;
 
diff --git a/include/linux/usb/atmel_usba_udc.h b/include/linux/usb/atmel_usba_udc.h
index 6311fa2..643c4c5 100644
--- a/include/linux/usb/atmel_usba_udc.h
+++ b/include/linux/usb/atmel_usba_udc.h
@@ -15,6 +15,7 @@ struct usba_ep_data {
 
 struct usba_platform_data {
 	int			vbus_pin;
+	unsigned char vbus_pin_inverted;
 	int			num_ep;
 	struct usba_ep_data	ep[0];
 };
-- 
1.5.4.3

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* RE: [PATCH 1/1] atmel uaba : Adding invert vbus_pin
  2010-01-05  8:47 Eirik Aanonsen
@ 2010-01-13 13:20 ` Eirik Aanonsen
  0 siblings, 0 replies; 11+ messages in thread
From: Eirik Aanonsen @ 2010-01-13 13:20 UTC (permalink / raw)
  To: Eirik Aanonsen, kernel@avr32linux.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org

> Subject: [PATCH 1/1] atmel uaba : Adding invert vbus_pin
> 
> Thanks to Ben Nizette [bn@niasdigital.com] and Sergei Shtylyov
> [sshtylyov@ru.mvista.com] for good feedback
> 
> Adding vbus_pin_inverted so that the usb detect pin can be active high
> or low.
> This because depending on HW implementation it is better to have active
> low.
> Also replaced the pio_get_value(udc->vbus_pin); with a call to
> vbus_is_present(udc);
> 
> Signed-off-by: Eirik Aanonsen <eaa@wprmedical.com>
> ---

...

No one that have any comments on this? 

Haavard is it possible to get this upstream?

The patch allows the USB driver to be active and when the USB bus is disconnected (with reversed signaling).
I observe a drop in power consumption of 150mW, and for people dependent on battery that is a lot.
And in our design we need to have this pin inverted.

Regards
____________________________________________________
 
Eirik Aanonsen
SW Developer
E-mail: eaa@wprmedical.com 
Phone: +47 90 68 11 92
Fax: +47 37 03 56 77
____________________________________________________



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/1] atmel uaba : Adding invert vbus_pin
  2010-01-04 13:01 [PATCH 1/1] atmel uaba : Adding invert vbus_pin Eirik Aanonsen
  2010-01-04 21:37 ` Sergei Shtylyov
  2010-01-04 21:54 ` Ben Nizette
@ 2010-01-15 18:54 ` Greg KH
  2010-01-18  7:02   ` Eirik Aanonsen
  2 siblings, 1 reply; 11+ messages in thread
From: Greg KH @ 2010-01-15 18:54 UTC (permalink / raw)
  To: Eirik Aanonsen
  Cc: kernel@avr32linux.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org

On Mon, Jan 04, 2010 at 02:01:59PM +0100, Eirik Aanonsen wrote:
> Adding vbus_pin_inverted so that the usb detect pin can be active high or low.
> This because depending on HW implementation it is better to have active low.
> Also replaced the pio_get_value(udc->vbus_pin); with a call to vbus_is_present(udc);
> 
> Signed-off-by: Eirik Aanonsen <eaa@wprmedical.com>

Please always run your patches through 'scripts/checkpatch.pl' before
sending them so that you don't accidentally add coding style errors.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: [PATCH 1/1] atmel uaba : Adding invert vbus_pin
  2010-01-15 18:54 ` Greg KH
@ 2010-01-18  7:02   ` Eirik Aanonsen
  2010-01-19  4:49     ` Greg KH
  0 siblings, 1 reply; 11+ messages in thread
From: Eirik Aanonsen @ 2010-01-18  7:02 UTC (permalink / raw)
  To: Greg KH
  Cc: kernel@avr32linux.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org

> 
> On Mon, Jan 04, 2010 at 02:01:59PM +0100, Eirik Aanonsen wrote:
> > Adding vbus_pin_inverted so that the usb detect pin can be active
> high or low.
> > This because depending on HW implementation it is better to have
> active low.
> > Also replaced the pio_get_value(udc->vbus_pin); with a call to
> vbus_is_present(udc);
> >
> > Signed-off-by: Eirik Aanonsen <eaa@wprmedical.com>
> 
> Please always run your patches through 'scripts/checkpatch.pl' before
> sending them so that you don't accidentally add coding style errors.
> 
> thanks,
> 
> greg k-h

Yes I'm sorry I got that feedback from several others as well.

That is why I resubmitted the patch on 05.Jan. But under the same name, and since then I have not received any feedback on that patch.

***
Snip from local:

./scripts/checkpatch.pl 0014-Adding-vbus_pin_inverted-so-that-the-usb-detect-pin.patch 
total: 0 errors, 0 warnings, 38 lines checked

0014-Adding-vbus_pin_inverted-so-that-the-usb-detect-pin.patch has no obvious style problems and is ready for submission.
***

Best regards
____________________________________________________
 
Eirik Aanonsen
SW Developer
E-mail: eaa@wprmedical.com 
Phone: +47 90 68 11 92
Fax: +47 37 03 56 77
____________________________________________________




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/1] atmel uaba : Adding invert vbus_pin
  2010-01-18  7:02   ` Eirik Aanonsen
@ 2010-01-19  4:49     ` Greg KH
  2010-01-19  7:16       ` Eirik Aanonsen
  0 siblings, 1 reply; 11+ messages in thread
From: Greg KH @ 2010-01-19  4:49 UTC (permalink / raw)
  To: Eirik Aanonsen
  Cc: kernel@avr32linux.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org

On Mon, Jan 18, 2010 at 08:02:46AM +0100, Eirik Aanonsen wrote:
> > 
> > On Mon, Jan 04, 2010 at 02:01:59PM +0100, Eirik Aanonsen wrote:
> > > Adding vbus_pin_inverted so that the usb detect pin can be active
> > high or low.
> > > This because depending on HW implementation it is better to have
> > active low.
> > > Also replaced the pio_get_value(udc->vbus_pin); with a call to
> > vbus_is_present(udc);
> > >
> > > Signed-off-by: Eirik Aanonsen <eaa@wprmedical.com>
> > 
> > Please always run your patches through 'scripts/checkpatch.pl' before
> > sending them so that you don't accidentally add coding style errors.
> > 
> > thanks,
> > 
> > greg k-h
> 
> Yes I'm sorry I got that feedback from several others as well.
> 
> That is why I resubmitted the patch on 05.Jan. But under the same name, and since then I have not received any feedback on that patch.
> 
> ***
> Snip from local:
> 
> ./scripts/checkpatch.pl 0014-Adding-vbus_pin_inverted-so-that-the-usb-detect-pin.patch 
> total: 0 errors, 0 warnings, 38 lines checked
> 
> 0014-Adding-vbus_pin_inverted-so-that-the-usb-detect-pin.patch has no obvious style problems and is ready for submission.
> ***

I don't see it in my queue, care to resend?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: [PATCH 1/1] atmel uaba : Adding invert vbus_pin
  2010-01-19  4:49     ` Greg KH
@ 2010-01-19  7:16       ` Eirik Aanonsen
  2010-01-27 22:40         ` Greg KH
  0 siblings, 1 reply; 11+ messages in thread
From: Eirik Aanonsen @ 2010-01-19  7:16 UTC (permalink / raw)
  To: Greg KH
  Cc: kernel@avr32linux.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org

...

> > > Please always run your patches through 'scripts/checkpatch.pl'
> before
> > > sending them so that you don't accidentally add coding style
> errors.
> > >
> > > thanks,
> > >
> > > greg k-h
> >
> > Yes I'm sorry I got that feedback from several others as well.
> >
> > That is why I resubmitted the patch on 05.Jan. But under the same
> name, and since then I have not received any feedback on that patch.
> >

...

> 
> I don't see it in my queue, care to resend?
> 
> thanks,
> 
> greg k-h


Adding it here:

---

Thanks to Greg KH [greg@koah.com], Ben Nizette [bn@niasdigital.com] and Sergei Shtylyov [sshtylyov@ru.mvista.com] for good feedback

Adding vbus_pin_inverted so that the usb detect pin can be active high or low.
This because depending on HW implementation it is better to have active low.
Also replaced the pio_get_value(udc->vbus_pin); with a call to vbus_is_present(udc);
This change allows avr32 designes with vbus pin inverted to save 0,15watt when disconnected from a host.

Signed-off-by: Eirik Aanonsen <eaa@wprmedical.com>
---
 drivers/usb/gadget/atmel_usba_udc.c |    6 +++---
 drivers/usb/gadget/atmel_usba_udc.h |    1 +
 include/linux/usb/atmel_usba_udc.h  |    1 +
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c
index 4e970cf..e1282fc 100644
--- a/drivers/usb/gadget/atmel_usba_udc.c
+++ b/drivers/usb/gadget/atmel_usba_udc.c
@@ -320,8 +320,7 @@ static inline void usba_cleanup_debugfs(struct usba_udc *udc)  static int vbus_is_present(struct usba_udc *udc)  {
 	if (gpio_is_valid(udc->vbus_pin))
-		return gpio_get_value(udc->vbus_pin);
-
+		return gpio_get_value(udc->vbus_pin) ^ udc->vbus_pin_inverted;
 	/* No Vbus detection: Assume always present */
 	return 1;
 }
@@ -1763,7 +1762,7 @@ static irqreturn_t usba_vbus_irq(int irq, void *devid)
 	if (!udc->driver)
 		goto out;
 
-	vbus = gpio_get_value(udc->vbus_pin);
+	vbus = vbus_is_present(udc);
 	if (vbus != udc->vbus_prev) {
 		if (vbus) {
 			toggle_bias(1);
@@ -2000,6 +1999,7 @@ static int __init usba_udc_probe(struct platform_device *pdev)
 	if (gpio_is_valid(pdata->vbus_pin)) {
 		if (!gpio_request(pdata->vbus_pin, "atmel_usba_udc")) {
 			udc->vbus_pin = pdata->vbus_pin;
+			udc->vbus_pin_inverted = pdata->vbus_pin_inverted;
 
 			ret = request_irq(gpio_to_irq(udc->vbus_pin),
 					usba_vbus_irq, 0,
diff --git a/drivers/usb/gadget/atmel_usba_udc.h b/drivers/usb/gadget/atmel_usba_udc.h
index f7baea3..88a2e07 100644
--- a/drivers/usb/gadget/atmel_usba_udc.h
+++ b/drivers/usb/gadget/atmel_usba_udc.h
@@ -323,6 +323,7 @@ struct usba_udc {
 	struct platform_device *pdev;
 	int irq;
 	int vbus_pin;
+	int vbus_pin_inverted;
 	struct clk *pclk;
 	struct clk *hclk;
 
diff --git a/include/linux/usb/atmel_usba_udc.h b/include/linux/usb/atmel_usba_udc.h
index 6311fa2..643c4c5 100644
--- a/include/linux/usb/atmel_usba_udc.h
+++ b/include/linux/usb/atmel_usba_udc.h
@@ -15,6 +15,7 @@ struct usba_ep_data {
 
 struct usba_platform_data {
 	int			vbus_pin;
+	unsigned char vbus_pin_inverted;
 	int			num_ep;
 	struct usba_ep_data	ep[0];
 };
--
1.5.4.3


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/1] atmel uaba : Adding invert vbus_pin
  2010-01-19  7:16       ` Eirik Aanonsen
@ 2010-01-27 22:40         ` Greg KH
  2010-02-05  8:49           ` Eirik Aanonsen
  0 siblings, 1 reply; 11+ messages in thread
From: Greg KH @ 2010-01-27 22:40 UTC (permalink / raw)
  To: Eirik Aanonsen
  Cc: kernel@avr32linux.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org

On Tue, Jan 19, 2010 at 08:16:26AM +0100, Eirik Aanonsen wrote:
> ...
> 
> > > > Please always run your patches through 'scripts/checkpatch.pl'
> > before
> > > > sending them so that you don't accidentally add coding style
> > errors.
> > > >
> > > > thanks,
> > > >
> > > > greg k-h
> > >
> > > Yes I'm sorry I got that feedback from several others as well.
> > >
> > > That is why I resubmitted the patch on 05.Jan. But under the same
> > name, and since then I have not received any feedback on that patch.
> > >
> 
> ...
> 
> > 
> > I don't see it in my queue, care to resend?
> > 
> > thanks,
> > 
> > greg k-h
> 
> 
> Adding it here:

The patch below is somehow corrupted, and I couldn't figure out why.

Care to regenerate it and send it again?

Sorry for the delay,

greg k-h

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: [PATCH 1/1] atmel uaba : Adding invert vbus_pin
  2010-01-27 22:40         ` Greg KH
@ 2010-02-05  8:49           ` Eirik Aanonsen
  0 siblings, 0 replies; 11+ messages in thread
From: Eirik Aanonsen @ 2010-02-05  8:49 UTC (permalink / raw)
  To: Greg KH
  Cc: kernel@avr32linux.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org

...
> 
> The patch below is somehow corrupted, and I couldn't figure out why.
> 
> Care to regenerate it and send it again?
> 
> Sorry for the delay,
> 
> greg k-h

Hi

Trying again

Eirik



Adding vbus_pin_inverted so that the usb detect pin can be active high or low depending on HW implementation
 also replaced the gpio_get_value(udc->vbus_pin); with a call to vbus_is_present(udc);
This allows the driver to be loaded and save about 0,15W on the consumption.

Signed-off-by: Eirik Aanonsen <eaa@wprmedical.com>
---
 arch/avr32/mach-at32ap/at32ap700x.c |    7 +++++--
 drivers/usb/gadget/atmel_usba_udc.c |    5 +++--
 drivers/usb/gadget/atmel_usba_udc.h |    1 +
 include/linux/usb/atmel_usba_udc.h  |    1 +
 4 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c
index 1aa1ea5..83d55f0 100644
--- a/arch/avr32/mach-at32ap/at32ap700x.c
+++ b/arch/avr32/mach-at32ap/at32ap700x.c
@@ -1767,10 +1767,13 @@ at32_add_device_usba(unsigned int id, struct usba_platform_data *data)
 					  ARRAY_SIZE(usba0_resource)))
 		goto out_free_pdev;
 
-	if (data)
+	if (data) {
 		usba_data.pdata.vbus_pin = data->vbus_pin;
-	else
+		usba_data.pdata.vbus_pin_inverted = data->vbus_pin_inverted;
+	} else {
 		usba_data.pdata.vbus_pin = -EINVAL;
+		usba_data.pdata.vbus_pin_inverted = -EINVAL;
+	}
 
 	data = &usba_data.pdata;
 	data->num_ep = ARRAY_SIZE(at32_usba_ep);
diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c
index 4e970cf..93344d7 100644
--- a/drivers/usb/gadget/atmel_usba_udc.c
+++ b/drivers/usb/gadget/atmel_usba_udc.c
@@ -320,7 +320,7 @@ static inline void usba_cleanup_debugfs(struct usba_udc *udc)
 static int vbus_is_present(struct usba_udc *udc)
 {
 	if (gpio_is_valid(udc->vbus_pin))
-		return gpio_get_value(udc->vbus_pin);
+		return gpio_get_value(udc->vbus_pin) ^ udc->vbus_pin_inverted;
 
 	/* No Vbus detection: Assume always present */
 	return 1;
@@ -1763,7 +1763,7 @@ static irqreturn_t usba_vbus_irq(int irq, void *devid)
 	if (!udc->driver)
 		goto out;
 
-	vbus = gpio_get_value(udc->vbus_pin);
+	vbus = vbus_is_present(udc);
 	if (vbus != udc->vbus_prev) {
 		if (vbus) {
 			toggle_bias(1);
@@ -2000,6 +2000,7 @@ static int __init usba_udc_probe(struct platform_device *pdev)
 	if (gpio_is_valid(pdata->vbus_pin)) {
 		if (!gpio_request(pdata->vbus_pin, "atmel_usba_udc")) {
 			udc->vbus_pin = pdata->vbus_pin;
+			udc->vbus_pin_inverted = pdata->vbus_pin_inverted;
 
 			ret = request_irq(gpio_to_irq(udc->vbus_pin),
 					usba_vbus_irq, 0,
diff --git a/drivers/usb/gadget/atmel_usba_udc.h b/drivers/usb/gadget/atmel_usba_udc.h
index f7baea3..88a2e07 100644
--- a/drivers/usb/gadget/atmel_usba_udc.h
+++ b/drivers/usb/gadget/atmel_usba_udc.h
@@ -323,6 +323,7 @@ struct usba_udc {
 	struct platform_device *pdev;
 	int irq;
 	int vbus_pin;
+	int vbus_pin_inverted;
 	struct clk *pclk;
 	struct clk *hclk;
 
diff --git a/include/linux/usb/atmel_usba_udc.h b/include/linux/usb/atmel_usba_udc.h
index 6311fa2..baf41c8 100644
--- a/include/linux/usb/atmel_usba_udc.h
+++ b/include/linux/usb/atmel_usba_udc.h
@@ -15,6 +15,7 @@ struct usba_ep_data {
 
 struct usba_platform_data {
 	int			vbus_pin;
+	int		 	vbus_pin_inverted;
 	int			num_ep;
 	struct usba_ep_data	ep[0];
 };
-- 
1.5.4.3

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2010-02-05  8:52 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-04 13:01 [PATCH 1/1] atmel uaba : Adding invert vbus_pin Eirik Aanonsen
2010-01-04 21:37 ` Sergei Shtylyov
2010-01-04 21:54 ` Ben Nizette
2010-01-15 18:54 ` Greg KH
2010-01-18  7:02   ` Eirik Aanonsen
2010-01-19  4:49     ` Greg KH
2010-01-19  7:16       ` Eirik Aanonsen
2010-01-27 22:40         ` Greg KH
2010-02-05  8:49           ` Eirik Aanonsen
  -- strict thread matches above, loose matches on Subject: below --
2010-01-05  8:47 Eirik Aanonsen
2010-01-13 13:20 ` Eirik Aanonsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox