Re: [PATCH 9/9] usb: chipidea: update ci_otg_is_fsm_mode conditions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 28, 2015 at 11:33:14AM +0800, Li Jun wrote:
> On Thu, May 28, 2015 at 09:37:47AM +0800, Peter Chen wrote:
> > On Wed, May 27, 2015 at 07:50:09PM +0800, Li Jun wrote:
> > > After introduce usb otg properties, update ci_otg_is_fsm_mode conditions to be
> > > depending on both usb hardware properties and usb driver config, also resolve
> > > a compile issue after this API change in debug.c.
> > > 
> > > Signed-off-by: Li Jun <jun.li@xxxxxxxxxxxxx>
> > > ---
> > >  drivers/usb/chipidea/ci.h    | 4 ++--
> > >  drivers/usb/chipidea/debug.c | 1 +
> > >  2 files changed, 3 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
> > > index 6d6200e..b2d39b3 100644
> > > --- a/drivers/usb/chipidea/ci.h
> > > +++ b/drivers/usb/chipidea/ci.h
> > > @@ -406,8 +406,8 @@ static inline u32 hw_test_and_write(struct ci_hdrc *ci, enum ci_hw_regs reg,
> > >  static inline bool ci_otg_is_fsm_mode(struct ci_hdrc *ci)
> > >  {
> > >  #ifdef CONFIG_USB_OTG_FSM
> > > -	return ci->is_otg && ci->roles[CI_ROLE_HOST] &&
> > > -					ci->roles[CI_ROLE_GADGET];
> > > +	return ci->is_otg && (ci->platdata->srp_support ||
> > > +			ci->platdata->hnp_support || ci->platdata->adp_support);
> > 
> > The condition of (ci->roles[CI_ROLE_HOST] && ci->roles[CI_ROLE_GADGET])
> > is still in case the user does not define host or device function for
> > chipidea.
> ci->roles[] depends on (dr_mode == USB_DR_MODE_OTG) actually,
> ci->platdata->xx_support will not be set if dr_mode != USB_DR_MODE_OTG,
> then the condition is enough?

No, dr_mode is decided by dts, ci->roles[] is decided by dr_mode
and kernel configuration together. We only works at OTG mode when both
host and device are enabled.

> 
> >Besides, how about using ci->gadget.is_otg to instead of
> > your three conditions according to your 8th patch change?
> I also had thought of it, but seems it looks not reasonable to let core
> depending on gadget's config, right?

Ok, then keep your way.

> 
> Li Jun
> > 
> > 
> > >  #else
> > >  	return false;
> > >  #endif
> > > diff --git a/drivers/usb/chipidea/debug.c b/drivers/usb/chipidea/debug.c
> > > index dfb05ed..d95f842 100644
> > > --- a/drivers/usb/chipidea/debug.c
> > > +++ b/drivers/usb/chipidea/debug.c
> > > @@ -10,6 +10,7 @@
> > >  #include <linux/usb/phy.h>
> > >  #include <linux/usb/otg.h>
> > >  #include <linux/usb/otg-fsm.h>
> > > +#include <linux/usb/chipidea.h>
> > >  
> > >  #include "ci.h"
> > >  #include "udc.h"
> > > -- 
> > > 1.9.1
> > > 
> > 
> > -- 
> > 
> > Best Regards,
> > Peter Chen

-- 

Best Regards,
Peter Chen
--
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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux