usb: r8a66597-udc: add support for set_selfpowered
PATCH 1/1 usb: r8a66597-udc: add support for set_selfpowered
The previous code always set to USB_DEVICE_SELF_POWERED in GET_STATUS. So, this patch adds set_selfpowered().
--- drivers/usb/gadget/r8a66597-udc.c | 16 +++++++++++++++- drivers/usb/gadget/r8a66597-udc.h | 1 + 2 files changed, 16 insertions(+), 1 deletions(-)
drivers/usb/gadget/r8a66597-udc.c +15 -1
@@ -1170,7 +1170,7 @@ __acquires(r8a66597->lock)switch (ctrl->bRequestType &USB_RECIP_MASK ) {case USB_RECIP_DEVICE : - status =1 <<USB_DEVICE_SELF_POWERED ; + status = r8a66597->device_status;break ;case USB_RECIP_INTERFACE : status =0 ;
@@ -1800,11 +1800,25 @@ static int r8a66597_pullup(struct usb_gadget *gadget, int is_on)return 0 ; } +static int r8a66597_set_selfpowered (struct usb_gadget *gadget,int is_self) +{ +struct r8a66597 *r8a66597 =gadget_to_r8a66597 (gadget); +unsigned long flags; + +if (is_self) + r8a66597->device_status |=1 <<USB_DEVICE_SELF_POWERED ; +else + r8a66597->device_status &= ~(1 <<USB_DEVICE_SELF_POWERED ); + +return 0 ; +} +static struct usb_gadget_ops r8a66597_gadget_ops = { .get_frame = r8a66597_get_frame, .udc_start = r8a66597_start, .udc_stop = r8a66597_stop, .pullup = r8a66597_pullup, + .set_selfpowered = r8a66597_set_selfpowered, }; static int __exit r8a66597_remove(struct platform_device *pdev)
drivers/usb/gadget/r8a66597-udc.h +1 -0
@@ -111,6 +111,7 @@ struct r8a66597 {u16 old_vbus;u16 scount;u16 old_dvsq; +u16 device_status;/* for GET_STATUS */ /* pipe config */ unsigned char bulk;
Signature · 1 line
1.7.1
Quoted 23 lines · Yoshihiro
The previous code always set to
USB_DEVICE_SELF_POWEREDinGET_STATUS. So, this patch addsset_selfpowered().Signed-off-by Yoshihiro Shimoda <[email protected]>--- drivers/usb/gadget/r8a66597-udc.c | 16 +++++++++++++++- drivers/usb/gadget/r8a66597-udc.h | 1 + 2 files changed, 16 insertions(+), 1 deletions(-)drivers/usb/gadget/r8a66597-udc.c +1
-1@@ -1170,7 +1170,7 @@ __acquires(r8a66597->lock)switch (ctrl->bRequestType &USB_RECIP_MASK ) {case USB_RECIP_DEVICE : - status =1 <<USB_DEVICE_SELF_POWERED ; + status = r8a66597->device_status;break ;case USB_RECIP_INTERFACE : status =0 ;
drivers/usb/gadget/r8a66597-udc.c static int r8a66597_pullup(struct usb_gadget *gadget, int is_on) · line 1806
Quoted 7 lines
drivers/usb/gadget/r8a66597-udc.c +4
-0@@ -1800,11 +1800,25 @@ static int r8a66597_pullup(struct usb_gadget *gadget, int is_on)return 0 ; } +static int r8a66597_set_selfpowered (struct usb_gadget *gadget,int is_self) +{ +struct r8a66597 *r8a66597 =gadget_to_r8a66597 (gadget); +unsigned long flags;
compile warning here. Did you even test this patch ???
Quoted 32 lines
drivers/usb/gadget/r8a66597-udc.c +10
-0+ +if (is_self) + r8a66597->device_status |=1 <<USB_DEVICE_SELF_POWERED ; +else + r8a66597->device_status &= ~(1 <<USB_DEVICE_SELF_POWERED ); + +return 0 ; +} +static struct usb_gadget_ops r8a66597_gadget_ops = { .get_frame = r8a66597_get_frame, .udc_start = r8a66597_start, .udc_stop = r8a66597_stop, .pullup = r8a66597_pullup, + .set_selfpowered = r8a66597_set_selfpowered, }; static int __exit r8a66597_remove(struct platform_device *pdev)drivers/usb/gadget/r8a66597-udc.h +1
-0@@ -111,6 +111,7 @@ struct r8a66597 {u16 old_vbus;u16 scount;u16 old_dvsq; +u16 device_status;/* for GET_STATUS */ /* pipe config */ unsigned char bulk;Signature · 1 line
1.7.1
Signature · 1 line
balbi
Quoted 27 lines · Felipe Balbi
Quoted 26 lines · Yoshihiro
The previous code always set to
USB_DEVICE_SELF_POWEREDinGET_STATUS. So, this patch addsset_selfpowered().Signed-off-by Yoshihiro Shimoda <[email protected]>--- drivers/usb/gadget/r8a66597-udc.c | 16 +++++++++++++++- drivers/usb/gadget/r8a66597-udc.h | 1 + 2 files changed, 16 insertions(+), 1 deletions(-)drivers/usb/gadget/r8a66597-udc.c +1
-1@@ -1170,7 +1170,7 @@ __acquires(r8a66597->lock)switch (ctrl->bRequestType &USB_RECIP_MASK ) {case USB_RECIP_DEVICE : - status =1 <<USB_DEVICE_SELF_POWERED ; + status = r8a66597->device_status;break ;case USB_RECIP_INTERFACE : status =0 ;@@ -1800,11 +1800,25 @@ static int r8a66597_pullup(struct usb_gadget *gadget, int is_on)return 0 ; }
Quoted 6 lines
drivers/usb/gadget/r8a66597-udc.c static int r8a66597_pullup(struct usb_gadget *gadget, int is_on) · line 1806
Quoted 4 lines
drivers/usb/gadget/r8a66597-udc.c +4
-0+static int r8a66597_set_selfpowered (struct usb_gadget *gadget,int is_self) +{ +struct r8a66597 *r8a66597 =gadget_to_r8a66597 (gadget); +unsigned long flags;compile warning here. Did you even test this patch ???
I'm sorry, I should have checked it carefully.
I will fix and submit soon.
Best regards,
Yoshihiro Shimoda