Am Freitag, 10. Februar 2012, 10:12:20 schrieb Lukasz Majewski: > From: Joonyoung Shim <jy0922.shim@xxxxxxxxxxx> > > The HSOTG hardware block needs two power sources and they can be > controlled using regulator. > > Signed-off-by: Joonyoung Shim <jy0922.shim@xxxxxxxxxxx> > Signed-off-by: Kyungmin Park <kyungmin.park@xxxxxxxxxxx> > Signed-off-by: Lukasz Majewski <l.majewski@xxxxxxxxxxx> > --- > drivers/usb/gadget/s3c-hsotg.c | 64 > ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 64 > insertions(+), 0 deletions(-) > > diff --git a/drivers/usb/gadget/s3c-hsotg.c > b/drivers/usb/gadget/s3c-hsotg.c index 6dab16a..bc87094 100644 > --- a/drivers/usb/gadget/s3c-hsotg.c > +++ b/drivers/usb/gadget/s3c-hsotg.c > @@ -27,6 +27,7 @@ > #include <linux/io.h> > #include <linux/slab.h> > #include <linux/clk.h> > +#include <linux/regulator/consumer.h> > > #include <linux/usb/ch9.h> > #include <linux/usb/gadget.h> > @@ -155,6 +156,11 @@ struct s3c_hsotg { > int irq; > struct clk *clk; > > + struct regulator *reg_vusb_a; > + struct regulator *reg_vusb_d; > + struct mutex mutex_lock; > + bool enabled; > + > unsigned int dedicated_fifos:1; > > struct dentry *debug_root; > @@ -184,6 +190,36 @@ struct s3c_hsotg_req { > unsigned char mapped; > }; > > +static void s3c_hsotg_regulator_enable(struct s3c_hsotg *hsotg) > +{ > + mutex_lock(&hsotg->mutex_lock); > + if (!hsotg->enabled) { > + if (hsotg->reg_vusb_d) > + regulator_enable(hsotg->reg_vusb_d); > + > + if (hsotg->reg_vusb_a) > + regulator_enable(hsotg->reg_vusb_a); > + > + hsotg->enabled = true; > + } > + mutex_unlock(&hsotg->mutex_lock); > +} > + > +static void s3c_hsotg_regulator_disable(struct s3c_hsotg *hsotg) > +{ > + mutex_lock(&hsotg->mutex_lock); > + if (hsotg->enabled) { > + if (hsotg->reg_vusb_a) > + regulator_disable(hsotg->reg_vusb_a); > + > + if (hsotg->reg_vusb_d) > + regulator_disable(hsotg->reg_vusb_d); > + > + hsotg->enabled = false; > + } > + mutex_unlock(&hsotg->mutex_lock); > +} > + how about using regulator_bulk_* functions instead of calling each regulator separately - i.e. like in s3c_hsudc.c As Felipe will probably also mention, please add another patch to the series converting the driver to the newer udc_start / udc_stop callbacks while you're at it (essentially also like s3c-hsudc.c) Heiko -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html