All of lore.kernel.org
 help / color / mirror / Atom feed
* [RESEND patch 2.6.28-rc4] isp1301_omap build fixes
@ 2008-11-14 20:28 David Brownell
       [not found] ` <200811141228.35262.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: David Brownell @ 2008-11-14 20:28 UTC (permalink / raw)
  To: linux-i2c-u79uwXL29TY76Z2rM5mHXA

From: David Brownell <dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>

Build fixes for isp1301_omap; no behavior changes:

  - fix incorrect probe() signature (it changed many months ago)
  - provide missing functions on H3 and H4 boards
  - "sparse" fixes (static, NULL-vs-0)

The H3 build bits subset some of the stuff that was previously in
the OMAP tree but never went to mainline.

Signed-off-by: David Brownell <dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
---
Refreshed against RC4; original sent 30-Oct.

 drivers/i2c/chips/isp1301_omap.c |   65 ++++++++++++++++++++++++++-----------
 1 file changed, 47 insertions(+), 18 deletions(-)

--- a/drivers/i2c/chips/isp1301_omap.c
+++ b/drivers/i2c/chips/isp1301_omap.c
@@ -25,6 +25,7 @@
 #include <linux/slab.h>
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
+#include <linux/gpio.h>
 #include <linux/usb/ch9.h>
 #include <linux/usb/gadget.h>
 #include <linux/usb.h>
@@ -33,7 +34,10 @@
 #include <linux/workqueue.h>
 
 #include <asm/irq.h>
+#include <asm/mach-types.h>
+
 #include <mach/usb.h>
+#include <mach/mux.h>
 
 
 #ifndef	DEBUG
@@ -88,14 +92,9 @@ struct isp1301 {
 
 /*-------------------------------------------------------------------------*/
 
-#ifdef	CONFIG_MACH_OMAP_H2
-
 /* board-specific PM hooks */
 
-#include <asm/gpio.h>
-#include <mach/mux.h>
-#include <asm/mach-types.h>
-
+#if defined(CONFIG_MACH_OMAP_H2) || defined(CONFIG_MACH_OMAP_H3)
 
 #if	defined(CONFIG_TPS65010) || defined(CONFIG_TPS65010_MODULE)
 
@@ -135,6 +134,33 @@ static inline void notresponding(struct 
 
 #endif
 
+#if defined(CONFIG_MACH_OMAP_H4)
+
+static void enable_vbus_draw(struct isp1301 *isp, unsigned mA)
+{
+	/* H4 controls this by DIP switch S2.4; no soft control.
+	 * ON means the charger is always enabled.  Leave it OFF
+	 * unless the OTG port is used only in B-peripheral mode.
+	 */
+}
+
+static void enable_vbus_source(struct isp1301 *isp)
+{
+	/* this board won't supply more than 8mA vbus power.
+	 * some boards can switch a 100ma "unit load" (or more).
+	 */
+}
+
+
+/* products will deliver OTG messages with LEDs, GUI, etc */
+static inline void notresponding(struct isp1301 *isp)
+{
+	printk(KERN_NOTICE "OTG device not responding.\n");
+}
+
+
+#endif
+
 /*-------------------------------------------------------------------------*/
 
 static struct i2c_driver isp1301_driver;
@@ -334,8 +360,7 @@ static int gadget_suspend(struct isp1301
  * NOTE: guaranteeing certain response times might mean we shouldn't
  * share keventd's work queue; a realtime task might be safest.
  */
-void
-isp1301_defer_work(struct isp1301 *isp, int work)
+static void isp1301_defer_work(struct isp1301 *isp, int work)
 {
 	int status;
 
@@ -512,7 +537,6 @@ static void update_otg1(struct isp1301 *
 	otg_ctrl &= ~OTG_XCEIV_INPUTS;
 	otg_ctrl &= ~(OTG_ID|OTG_ASESSVLD|OTG_VBUSVLD);
 
-
 	if (int_src & INTR_SESS_VLD)
 		otg_ctrl |= OTG_ASESSVLD;
 	else if (isp->otg.state == OTG_STATE_A_WAIT_VFALL) {
@@ -886,11 +910,11 @@ static int otg_probe(struct platform_dev
 
 static int otg_remove(struct platform_device *dev)
 {
-	otg_dev = 0;
+	otg_dev = NULL;
 	return 0;
 }
 
-struct platform_driver omap_otg_driver = {
+static struct platform_driver omap_otg_driver = {
 	.probe		= otg_probe,
 	.remove		= otg_remove,
 	.driver		= {
@@ -1212,6 +1236,8 @@ static void isp1301_release(struct devic
 
 	isp = dev_get_drvdata(dev);
 
+	/* FIXME -- not with a "new style" driver, it doesn't!! */
+
 	/* ugly -- i2c hijacks our memory hook to wait_for_completion() */
 	if (isp->i2c_release)
 		isp->i2c_release(dev);
@@ -1233,7 +1259,7 @@ static int __exit isp1301_remove(struct 
 	otg_unbind(isp);
 #endif
 	if (machine_is_omap_h2())
-		omap_free_gpio(2);
+		gpio_free(2);
 
 	isp->timer.data = 0;
 	set_bit(WORK_STOP, &isp->todo);
@@ -1241,7 +1267,7 @@ static int __exit isp1301_remove(struct 
 	flush_scheduled_work();
 
 	put_device(&i2c->dev);
-	the_transceiver = 0;
+	the_transceiver = NULL;
 
 	return 0;
 }
@@ -1295,7 +1321,7 @@ isp1301_set_host(struct otg_transceiver 
 	if (!host) {
 		omap_writew(0, OTG_IRQ_EN);
 		power_down(isp);
-		isp->otg.host = 0;
+		isp->otg.host = NULL;
 		return 0;
 	}
 
@@ -1344,7 +1370,9 @@ static int
 isp1301_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *gadget)
 {
 	struct isp1301	*isp = container_of(otg, struct isp1301, otg);
+#ifndef	CONFIG_USB_OTG
 	u32 l;
+#endif
 
 	if (!otg || isp != the_transceiver)
 		return -ENODEV;
@@ -1354,7 +1382,7 @@ isp1301_set_peripheral(struct otg_transc
 		if (!isp->otg.default_a)
 			enable_vbus_draw(isp, 0);
 		usb_gadget_vbus_disconnect(isp->otg.gadget);
-		isp->otg.gadget = 0;
+		isp->otg.gadget = NULL;
 		power_down(isp);
 		return 0;
 	}
@@ -1379,7 +1407,7 @@ isp1301_set_peripheral(struct otg_transc
 	power_up(isp);
 	isp->otg.state = OTG_STATE_B_IDLE;
 
-	if (machine_is_omap_h2())
+	if (machine_is_omap_h2() || machine_is_omap_h3())
 		isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1, MC1_DAT_SE0);
 
 	isp1301_set_bits(isp, ISP1301_INTERRUPT_RISING,
@@ -1499,7 +1527,8 @@ isp1301_start_hnp(struct otg_transceiver
 
 /*-------------------------------------------------------------------------*/
 
-static int __init isp1301_probe(struct i2c_client *i2c)
+static int __init
+isp1301_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
 {
 	int			status;
 	struct isp1301		*isp;
@@ -1647,7 +1676,7 @@ module_init(isp_init);
 static void __exit isp_exit(void)
 {
 	if (the_transceiver)
-		otg_set_transceiver(0);
+		otg_set_transceiver(NULL);
 	i2c_del_driver(&isp1301_driver);
 }
 module_exit(isp_exit);

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

* Re: [RESEND patch 2.6.28-rc4] isp1301_omap build fixes
       [not found] ` <200811141228.35262.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
@ 2008-11-17 20:36   ` Jean Delvare
       [not found]     ` <20081117213615.57c3d494-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Jean Delvare @ 2008-11-17 20:36 UTC (permalink / raw)
  To: David Brownell; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA

Hi David,

On Fri, 14 Nov 2008 12:28:35 -0800, David Brownell wrote:
> From: David Brownell <dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
> 
> Build fixes for isp1301_omap; no behavior changes:
> 
>   - fix incorrect probe() signature (it changed many months ago)
>   - provide missing functions on H3 and H4 boards
>   - "sparse" fixes (static, NULL-vs-0)
> 
> The H3 build bits subset some of the stuff that was previously in
> the OMAP tree but never went to mainline.
> 
> Signed-off-by: David Brownell <dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
> ---
> Refreshed against RC4; original sent 30-Oct.

Sorry about that, I thought this patch would go through the omap tree.
But I've picked it and applied it now and will send it to Linus in the
next i2c batch.

I think that this kind of issue would probably be avoided if the
isp1301_omap driver lived somewhere under arch/arm/plat-omap. Where it
lives now (drivers/i2c/chips) it doesn't get the attention it deserves,
or when it does, that's not from the right persons. Could you please
work on this? Directory drivers/i2c/chips will be deleted "soon"
anyway, so all the drivers it contains will need a new home.

Thanks.

> 
>  drivers/i2c/chips/isp1301_omap.c |   65 ++++++++++++++++++++++++++-----------
>  1 file changed, 47 insertions(+), 18 deletions(-)
> 
> --- a/drivers/i2c/chips/isp1301_omap.c
> +++ b/drivers/i2c/chips/isp1301_omap.c
> @@ -25,6 +25,7 @@
>  #include <linux/slab.h>
>  #include <linux/interrupt.h>
>  #include <linux/platform_device.h>
> +#include <linux/gpio.h>
>  #include <linux/usb/ch9.h>
>  #include <linux/usb/gadget.h>
>  #include <linux/usb.h>
> @@ -33,7 +34,10 @@
>  #include <linux/workqueue.h>
>  
>  #include <asm/irq.h>
> +#include <asm/mach-types.h>
> +
>  #include <mach/usb.h>
> +#include <mach/mux.h>
>  
>  
>  #ifndef	DEBUG
> @@ -88,14 +92,9 @@ struct isp1301 {
>  
>  /*-------------------------------------------------------------------------*/
>  
> -#ifdef	CONFIG_MACH_OMAP_H2
> -
>  /* board-specific PM hooks */
>  
> -#include <asm/gpio.h>
> -#include <mach/mux.h>
> -#include <asm/mach-types.h>
> -
> +#if defined(CONFIG_MACH_OMAP_H2) || defined(CONFIG_MACH_OMAP_H3)
>  
>  #if	defined(CONFIG_TPS65010) || defined(CONFIG_TPS65010_MODULE)
>  
> @@ -135,6 +134,33 @@ static inline void notresponding(struct 
>  
>  #endif
>  
> +#if defined(CONFIG_MACH_OMAP_H4)
> +
> +static void enable_vbus_draw(struct isp1301 *isp, unsigned mA)
> +{
> +	/* H4 controls this by DIP switch S2.4; no soft control.
> +	 * ON means the charger is always enabled.  Leave it OFF
> +	 * unless the OTG port is used only in B-peripheral mode.
> +	 */
> +}
> +
> +static void enable_vbus_source(struct isp1301 *isp)
> +{
> +	/* this board won't supply more than 8mA vbus power.
> +	 * some boards can switch a 100ma "unit load" (or more).
> +	 */
> +}
> +
> +
> +/* products will deliver OTG messages with LEDs, GUI, etc */
> +static inline void notresponding(struct isp1301 *isp)
> +{
> +	printk(KERN_NOTICE "OTG device not responding.\n");
> +}
> +
> +
> +#endif
> +
>  /*-------------------------------------------------------------------------*/
>  
>  static struct i2c_driver isp1301_driver;
> @@ -334,8 +360,7 @@ static int gadget_suspend(struct isp1301
>   * NOTE: guaranteeing certain response times might mean we shouldn't
>   * share keventd's work queue; a realtime task might be safest.
>   */
> -void
> -isp1301_defer_work(struct isp1301 *isp, int work)
> +static void isp1301_defer_work(struct isp1301 *isp, int work)
>  {
>  	int status;
>  
> @@ -512,7 +537,6 @@ static void update_otg1(struct isp1301 *
>  	otg_ctrl &= ~OTG_XCEIV_INPUTS;
>  	otg_ctrl &= ~(OTG_ID|OTG_ASESSVLD|OTG_VBUSVLD);
>  
> -
>  	if (int_src & INTR_SESS_VLD)
>  		otg_ctrl |= OTG_ASESSVLD;
>  	else if (isp->otg.state == OTG_STATE_A_WAIT_VFALL) {
> @@ -886,11 +910,11 @@ static int otg_probe(struct platform_dev
>  
>  static int otg_remove(struct platform_device *dev)
>  {
> -	otg_dev = 0;
> +	otg_dev = NULL;
>  	return 0;
>  }
>  
> -struct platform_driver omap_otg_driver = {
> +static struct platform_driver omap_otg_driver = {
>  	.probe		= otg_probe,
>  	.remove		= otg_remove,
>  	.driver		= {
> @@ -1212,6 +1236,8 @@ static void isp1301_release(struct devic
>  
>  	isp = dev_get_drvdata(dev);
>  
> +	/* FIXME -- not with a "new style" driver, it doesn't!! */
> +
>  	/* ugly -- i2c hijacks our memory hook to wait_for_completion() */
>  	if (isp->i2c_release)
>  		isp->i2c_release(dev);
> @@ -1233,7 +1259,7 @@ static int __exit isp1301_remove(struct 
>  	otg_unbind(isp);
>  #endif
>  	if (machine_is_omap_h2())
> -		omap_free_gpio(2);
> +		gpio_free(2);
>  
>  	isp->timer.data = 0;
>  	set_bit(WORK_STOP, &isp->todo);
> @@ -1241,7 +1267,7 @@ static int __exit isp1301_remove(struct 
>  	flush_scheduled_work();
>  
>  	put_device(&i2c->dev);
> -	the_transceiver = 0;
> +	the_transceiver = NULL;
>  
>  	return 0;
>  }
> @@ -1295,7 +1321,7 @@ isp1301_set_host(struct otg_transceiver 
>  	if (!host) {
>  		omap_writew(0, OTG_IRQ_EN);
>  		power_down(isp);
> -		isp->otg.host = 0;
> +		isp->otg.host = NULL;
>  		return 0;
>  	}
>  
> @@ -1344,7 +1370,9 @@ static int
>  isp1301_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *gadget)
>  {
>  	struct isp1301	*isp = container_of(otg, struct isp1301, otg);
> +#ifndef	CONFIG_USB_OTG
>  	u32 l;
> +#endif
>  
>  	if (!otg || isp != the_transceiver)
>  		return -ENODEV;
> @@ -1354,7 +1382,7 @@ isp1301_set_peripheral(struct otg_transc
>  		if (!isp->otg.default_a)
>  			enable_vbus_draw(isp, 0);
>  		usb_gadget_vbus_disconnect(isp->otg.gadget);
> -		isp->otg.gadget = 0;
> +		isp->otg.gadget = NULL;
>  		power_down(isp);
>  		return 0;
>  	}
> @@ -1379,7 +1407,7 @@ isp1301_set_peripheral(struct otg_transc
>  	power_up(isp);
>  	isp->otg.state = OTG_STATE_B_IDLE;
>  
> -	if (machine_is_omap_h2())
> +	if (machine_is_omap_h2() || machine_is_omap_h3())
>  		isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1, MC1_DAT_SE0);
>  
>  	isp1301_set_bits(isp, ISP1301_INTERRUPT_RISING,
> @@ -1499,7 +1527,8 @@ isp1301_start_hnp(struct otg_transceiver
>  
>  /*-------------------------------------------------------------------------*/
>  
> -static int __init isp1301_probe(struct i2c_client *i2c)
> +static int __init
> +isp1301_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
>  {
>  	int			status;
>  	struct isp1301		*isp;
> @@ -1647,7 +1676,7 @@ module_init(isp_init);
>  static void __exit isp_exit(void)
>  {
>  	if (the_transceiver)
> -		otg_set_transceiver(0);
> +		otg_set_transceiver(NULL);
>  	i2c_del_driver(&isp1301_driver);
>  }
>  module_exit(isp_exit);

-- 
Jean Delvare

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

* Re: [RESEND patch 2.6.28-rc4] isp1301_omap build fixes
       [not found]     ` <20081117213615.57c3d494-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
@ 2008-11-18  4:07       ` David Brownell
       [not found]         ` <200811172007.11217.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: David Brownell @ 2008-11-18  4:07 UTC (permalink / raw)
  To: Jean Delvare; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA

On Monday 17 November 2008, Jean Delvare wrote:
> Sorry about that, I thought this patch would go through the omap tree.
> But I've picked it and applied it now and will send it to Linus in the
> next i2c batch.

Thanks ... it wouldn't go through the OMAP tree unless it were in
the arch/arm/*omap* directories, as a rule.  And that's for low
level board support; drivers belong somewhere in drivers/* code.


> I think that this kind of issue would probably be avoided if the
> isp1301_omap driver lived somewhere under arch/arm/plat-omap. Where it
> lives now (drivers/i2c/chips) it doesn't get the attention it deserves,
> or when it does, that's not from the right persons. Could you please
> work on this? Directory drivers/i2c/chips will be deleted "soon"
> anyway, so all the drivers it contains will need a new home.

I expect drivers/usb/otg will be a better place for this.  There's
some other code which looks like it'll need to land there "soon".

Once you merge these build fixes I'll probably cons up a patch which
moves this over there.  Unless you'd rather handle it, I'll probably
push that through Greg.

- Dave

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

* Re: [RESEND patch 2.6.28-rc4] isp1301_omap build fixes
       [not found]         ` <200811172007.11217.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
@ 2008-11-18  8:09           ` Jean Delvare
  0 siblings, 0 replies; 4+ messages in thread
From: Jean Delvare @ 2008-11-18  8:09 UTC (permalink / raw)
  To: dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f
  Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA

Hi Dave,

On Mon, 17 Nov 2008 20:07:11 -0800, David Brownell wrote:
> On Monday 17 November 2008, Jean Delvare wrote:
> > I think that this kind of issue would probably be avoided if the
> > isp1301_omap driver lived somewhere under arch/arm/plat-omap. Where it
> > lives now (drivers/i2c/chips) it doesn't get the attention it deserves,
> > or when it does, that's not from the right persons. Could you please
> > work on this? Directory drivers/i2c/chips will be deleted "soon"
> > anyway, so all the drivers it contains will need a new home.
> 
> I expect drivers/usb/otg will be a better place for this.  There's
> some other code which looks like it'll need to land there "soon".

Fine with me.

> Once you merge these build fixes I'll probably cons up a patch which
> moves this over there.  Unless you'd rather handle it, I'll probably
> push that through Greg.

I'm totally OK with it going through Greg.

Thanks,
-- 
Jean Delvare

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

end of thread, other threads:[~2008-11-18  8:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-14 20:28 [RESEND patch 2.6.28-rc4] isp1301_omap build fixes David Brownell
     [not found] ` <200811141228.35262.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-11-17 20:36   ` Jean Delvare
     [not found]     ` <20081117213615.57c3d494-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-11-18  4:07       ` David Brownell
     [not found]         ` <200811172007.11217.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-11-18  8:09           ` Jean Delvare

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.