Skip to content

Commit

Permalink
usb: dwc2: Add dwc2_gadget_dec_frame_num_by_one() function
Browse files Browse the repository at this point in the history
Added dwc2_gadget_dec_frame_num_by_one() function in gadget.c.
This function will be used to calculate descriptor frame number field
value. For service interval mode frame number in descriptor should point
to last (u)frame in the interval.

Acked-by: Minas Harutyunyan <hminas@synopsys.com>
Signed-off-by: Grigor Tovmasyan <tovmasya@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
  • Loading branch information
Grigor Tovmasyan authored and Felipe Balbi committed Oct 2, 2018
1 parent ca531bc commit 9d630b9
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions drivers/usb/dwc2/gadget.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,24 @@ static inline void dwc2_gadget_incr_frame_num(struct dwc2_hsotg_ep *hs_ep)
}
}

/**
* dwc2_gadget_dec_frame_num_by_one - Decrements the targeted frame number
* by one.
* @hs_ep: The endpoint.
*
* This function used in service interval based scheduling flow to calculate
* descriptor frame number filed value. For service interval mode frame
* number in descriptor should point to last (u)frame in the interval.
*
*/
static inline void dwc2_gadget_dec_frame_num_by_one(struct dwc2_hsotg_ep *hs_ep)
{
if (hs_ep->target_frame)
hs_ep->target_frame -= 1;
else
hs_ep->target_frame = DSTS_SOFFN_LIMIT;
}

/**
* dwc2_hsotg_en_gsint - enable one or more of the general interrupt
* @hsotg: The device state
Expand Down

0 comments on commit 9d630b9

Please sign in to comment.