Snap for 11100687 from f7e88b37a9 to android14-6.1-keystone-qcom-release
Change-Id: Ia72a69c73aa702a3036362e90b058cfbc88bb958
This commit is contained in:
commit
7b83c4d11d
8 changed files with 81 additions and 83 deletions
|
|
@ -446,7 +446,7 @@ int ufshcd_mcq_init(struct ufs_hba *hba)
|
|||
|
||||
for (i = 0; i < hba->nr_hw_queues; i++) {
|
||||
hwq = &hba->uhq[i];
|
||||
hwq->max_entries = hba->nutrs;
|
||||
hwq->max_entries = hba->nutrs + 1;
|
||||
spin_lock_init(&hwq->sq_lock);
|
||||
spin_lock_init(&hwq->cq_lock);
|
||||
mutex_init(&hwq->sq_mutex);
|
||||
|
|
@ -593,7 +593,6 @@ static bool ufshcd_mcq_sqe_search(struct ufs_hba *hba,
|
|||
{
|
||||
struct ufshcd_lrb *lrbp = &hba->lrb[task_tag];
|
||||
struct utp_transfer_req_desc *utrd;
|
||||
u32 mask = hwq->max_entries - 1;
|
||||
__le64 cmd_desc_base_addr;
|
||||
bool ret = false;
|
||||
u64 addr, match;
|
||||
|
|
@ -621,7 +620,10 @@ static bool ufshcd_mcq_sqe_search(struct ufs_hba *hba,
|
|||
ret = true;
|
||||
goto out;
|
||||
}
|
||||
sq_head_slot = (sq_head_slot + 1) & mask;
|
||||
|
||||
sq_head_slot++;
|
||||
if (sq_head_slot == hwq->max_entries)
|
||||
sq_head_slot = 0;
|
||||
}
|
||||
|
||||
out:
|
||||
|
|
|
|||
|
|
@ -370,10 +370,11 @@ static inline bool ufs_is_valid_unit_desc_lun(struct ufs_dev_info *dev_info, u8
|
|||
|
||||
static inline void ufshcd_inc_sq_tail(struct ufs_hw_queue *q)
|
||||
{
|
||||
u32 mask = q->max_entries - 1;
|
||||
u32 val;
|
||||
|
||||
q->sq_tail_slot = (q->sq_tail_slot + 1) & mask;
|
||||
q->sq_tail_slot++;
|
||||
if (q->sq_tail_slot == q->max_entries)
|
||||
q->sq_tail_slot = 0;
|
||||
val = q->sq_tail_slot * sizeof(struct utp_transfer_req_desc);
|
||||
writel(val, q->mcq_sq_tail);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1023,40 +1023,30 @@ static int f_midi_bind(struct usb_configuration *c, struct usb_function *f)
|
|||
if (!f->fs_descriptors)
|
||||
goto fail_f_midi;
|
||||
|
||||
if (gadget_is_dualspeed(c->cdev->gadget)) {
|
||||
bulk_in_desc.wMaxPacketSize = cpu_to_le16(512);
|
||||
bulk_out_desc.wMaxPacketSize = cpu_to_le16(512);
|
||||
f->hs_descriptors = usb_copy_descriptors(midi_function);
|
||||
if (!f->hs_descriptors)
|
||||
goto fail_f_midi;
|
||||
}
|
||||
bulk_in_desc.wMaxPacketSize = cpu_to_le16(512);
|
||||
bulk_out_desc.wMaxPacketSize = cpu_to_le16(512);
|
||||
f->hs_descriptors = usb_copy_descriptors(midi_function);
|
||||
if (!f->hs_descriptors)
|
||||
goto fail_f_midi;
|
||||
|
||||
if (gadget_is_superspeed(c->cdev->gadget)) {
|
||||
bulk_in_desc.wMaxPacketSize = cpu_to_le16(1024);
|
||||
bulk_out_desc.wMaxPacketSize = cpu_to_le16(1024);
|
||||
i = endpoint_descriptor_index;
|
||||
midi_function[i++] = (struct usb_descriptor_header *)
|
||||
&bulk_out_desc;
|
||||
midi_function[i++] = (struct usb_descriptor_header *)
|
||||
&bulk_out_ss_comp_desc;
|
||||
midi_function[i++] = (struct usb_descriptor_header *)
|
||||
&ms_out_desc;
|
||||
midi_function[i++] = (struct usb_descriptor_header *)
|
||||
&bulk_in_desc;
|
||||
midi_function[i++] = (struct usb_descriptor_header *)
|
||||
&bulk_in_ss_comp_desc;
|
||||
midi_function[i++] = (struct usb_descriptor_header *)
|
||||
&ms_in_desc;
|
||||
f->ss_descriptors = usb_copy_descriptors(midi_function);
|
||||
if (!f->ss_descriptors)
|
||||
goto fail_f_midi;
|
||||
|
||||
if (gadget_is_superspeed_plus(c->cdev->gadget)) {
|
||||
f->ssp_descriptors = usb_copy_descriptors(midi_function);
|
||||
if (!f->ssp_descriptors)
|
||||
goto fail_f_midi;
|
||||
}
|
||||
}
|
||||
bulk_in_desc.wMaxPacketSize = cpu_to_le16(1024);
|
||||
bulk_out_desc.wMaxPacketSize = cpu_to_le16(1024);
|
||||
i = endpoint_descriptor_index;
|
||||
midi_function[i++] = (struct usb_descriptor_header *)
|
||||
&bulk_out_desc;
|
||||
midi_function[i++] = (struct usb_descriptor_header *)
|
||||
&bulk_out_ss_comp_desc;
|
||||
midi_function[i++] = (struct usb_descriptor_header *)
|
||||
&ms_out_desc;
|
||||
midi_function[i++] = (struct usb_descriptor_header *)
|
||||
&bulk_in_desc;
|
||||
midi_function[i++] = (struct usb_descriptor_header *)
|
||||
&bulk_in_ss_comp_desc;
|
||||
midi_function[i++] = (struct usb_descriptor_header *)
|
||||
&ms_in_desc;
|
||||
f->ss_descriptors = usb_copy_descriptors(midi_function);
|
||||
if (!f->ss_descriptors)
|
||||
goto fail_f_midi;
|
||||
|
||||
kfree(midi_function);
|
||||
|
||||
|
|
|
|||
|
|
@ -492,6 +492,7 @@ uvc_copy_descriptors(struct uvc_device *uvc, enum usb_device_speed speed)
|
|||
void *mem;
|
||||
|
||||
switch (speed) {
|
||||
case USB_SPEED_SUPER_PLUS:
|
||||
case USB_SPEED_SUPER:
|
||||
uvc_control_desc = uvc->desc.ss_control;
|
||||
uvc_streaming_cls = uvc->desc.ss_streaming;
|
||||
|
|
@ -536,7 +537,8 @@ uvc_copy_descriptors(struct uvc_device *uvc, enum usb_device_speed speed)
|
|||
+ uvc_control_ep.bLength + uvc_control_cs_ep.bLength
|
||||
+ uvc_streaming_intf_alt0.bLength;
|
||||
|
||||
if (speed == USB_SPEED_SUPER) {
|
||||
if (speed == USB_SPEED_SUPER ||
|
||||
speed == USB_SPEED_SUPER_PLUS) {
|
||||
bytes += uvc_ss_control_comp.bLength;
|
||||
n_desc = 6;
|
||||
} else {
|
||||
|
|
@ -580,7 +582,8 @@ uvc_copy_descriptors(struct uvc_device *uvc, enum usb_device_speed speed)
|
|||
uvc_control_header->baInterfaceNr[0] = uvc->streaming_intf;
|
||||
|
||||
UVC_COPY_DESCRIPTOR(mem, dst, &uvc_control_ep);
|
||||
if (speed == USB_SPEED_SUPER)
|
||||
if (speed == USB_SPEED_SUPER
|
||||
|| speed == USB_SPEED_SUPER_PLUS)
|
||||
UVC_COPY_DESCRIPTOR(mem, dst, &uvc_ss_control_comp);
|
||||
|
||||
UVC_COPY_DESCRIPTOR(mem, dst, &uvc_control_cs_ep);
|
||||
|
|
@ -673,21 +676,13 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f)
|
|||
}
|
||||
uvc->control_ep = ep;
|
||||
|
||||
if (gadget_is_superspeed(c->cdev->gadget))
|
||||
ep = usb_ep_autoconfig_ss(cdev->gadget, &uvc_ss_streaming_ep,
|
||||
&uvc_ss_streaming_comp);
|
||||
else if (gadget_is_dualspeed(cdev->gadget))
|
||||
ep = usb_ep_autoconfig(cdev->gadget, &uvc_hs_streaming_ep);
|
||||
else
|
||||
ep = usb_ep_autoconfig(cdev->gadget, &uvc_fs_streaming_ep);
|
||||
|
||||
ep = usb_ep_autoconfig(cdev->gadget, &uvc_fs_streaming_ep);
|
||||
if (!ep) {
|
||||
uvcg_info(f, "Unable to allocate streaming EP\n");
|
||||
goto error;
|
||||
}
|
||||
uvc->video.ep = ep;
|
||||
|
||||
uvc_fs_streaming_ep.bEndpointAddress = uvc->video.ep->address;
|
||||
uvc_hs_streaming_ep.bEndpointAddress = uvc->video.ep->address;
|
||||
uvc_ss_streaming_ep.bEndpointAddress = uvc->video.ep->address;
|
||||
|
||||
|
|
@ -726,21 +721,26 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f)
|
|||
f->fs_descriptors = NULL;
|
||||
goto error;
|
||||
}
|
||||
if (gadget_is_dualspeed(cdev->gadget)) {
|
||||
f->hs_descriptors = uvc_copy_descriptors(uvc, USB_SPEED_HIGH);
|
||||
if (IS_ERR(f->hs_descriptors)) {
|
||||
ret = PTR_ERR(f->hs_descriptors);
|
||||
f->hs_descriptors = NULL;
|
||||
goto error;
|
||||
}
|
||||
|
||||
f->hs_descriptors = uvc_copy_descriptors(uvc, USB_SPEED_HIGH);
|
||||
if (IS_ERR(f->hs_descriptors)) {
|
||||
ret = PTR_ERR(f->hs_descriptors);
|
||||
f->hs_descriptors = NULL;
|
||||
goto error;
|
||||
}
|
||||
if (gadget_is_superspeed(c->cdev->gadget)) {
|
||||
f->ss_descriptors = uvc_copy_descriptors(uvc, USB_SPEED_SUPER);
|
||||
if (IS_ERR(f->ss_descriptors)) {
|
||||
ret = PTR_ERR(f->ss_descriptors);
|
||||
f->ss_descriptors = NULL;
|
||||
goto error;
|
||||
}
|
||||
|
||||
f->ss_descriptors = uvc_copy_descriptors(uvc, USB_SPEED_SUPER);
|
||||
if (IS_ERR(f->ss_descriptors)) {
|
||||
ret = PTR_ERR(f->ss_descriptors);
|
||||
f->ss_descriptors = NULL;
|
||||
goto error;
|
||||
}
|
||||
|
||||
f->ssp_descriptors = uvc_copy_descriptors(uvc, USB_SPEED_SUPER_PLUS);
|
||||
if (IS_ERR(f->ssp_descriptors)) {
|
||||
ret = PTR_ERR(f->ssp_descriptors);
|
||||
f->ssp_descriptors = NULL;
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Preallocate control endpoint request. */
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ struct f_phonet_opts {
|
|||
struct net_device *gphonet_setup_default(void);
|
||||
void gphonet_set_gadget(struct net_device *net, struct usb_gadget *g);
|
||||
int gphonet_register_netdev(struct net_device *net);
|
||||
int phonet_bind_config(struct usb_configuration *c, struct net_device *dev);
|
||||
void gphonet_cleanup(struct net_device *dev);
|
||||
|
||||
#endif /* __U_PHONET_H */
|
||||
|
|
|
|||
|
|
@ -71,8 +71,4 @@ void gserial_disconnect(struct gserial *);
|
|||
void gserial_suspend(struct gserial *p);
|
||||
void gserial_resume(struct gserial *p);
|
||||
|
||||
/* functions are bound to configurations by a config or gadget driver */
|
||||
int gser_bind_config(struct usb_configuration *c, u8 port_num);
|
||||
int obex_bind_config(struct usb_configuration *c, u8 port_num);
|
||||
|
||||
#endif /* __U_SERIAL_H */
|
||||
|
|
|
|||
|
|
@ -176,8 +176,6 @@ struct uvc_file_handle {
|
|||
*/
|
||||
|
||||
extern void uvc_function_setup_continue(struct uvc_device *uvc);
|
||||
extern void uvc_endpoint_stream(struct uvc_device *dev);
|
||||
|
||||
extern void uvc_function_connect(struct uvc_device *uvc);
|
||||
extern void uvc_function_disconnect(struct uvc_device *uvc);
|
||||
|
||||
|
|
|
|||
|
|
@ -382,13 +382,13 @@ static void uvcg_video_pump(struct work_struct *work)
|
|||
{
|
||||
struct uvc_video *video = container_of(work, struct uvc_video, pump);
|
||||
struct uvc_video_queue *queue = &video->queue;
|
||||
/* video->max_payload_size is only set when using bulk transfer */
|
||||
bool is_bulk = video->max_payload_size;
|
||||
struct usb_request *req = NULL;
|
||||
struct uvc_buffer *buf;
|
||||
unsigned long flags;
|
||||
bool buf_done;
|
||||
int ret;
|
||||
bool buf_int;
|
||||
/* video->max_payload_size is only set when using bulk transfer */
|
||||
bool is_bulk = video->max_payload_size;
|
||||
|
||||
while (video->ep->enabled) {
|
||||
/*
|
||||
|
|
@ -414,20 +414,19 @@ static void uvcg_video_pump(struct work_struct *work)
|
|||
|
||||
if (buf != NULL) {
|
||||
video->encode(req, video, buf);
|
||||
/* Always interrupt for the last request of a video buffer */
|
||||
buf_int = buf->state == UVC_BUF_STATE_DONE;
|
||||
buf_done = buf->state == UVC_BUF_STATE_DONE;
|
||||
} else if (!(queue->flags & UVC_QUEUE_DISCONNECTED) && !is_bulk) {
|
||||
/*
|
||||
* No video buffer available; the queue is still connected and
|
||||
* we're traferring over ISOC. Queue a 0 length request to
|
||||
* we're transferring over ISOC. Queue a 0 length request to
|
||||
* prevent missed ISOC transfers.
|
||||
*/
|
||||
req->length = 0;
|
||||
buf_int = false;
|
||||
buf_done = false;
|
||||
} else {
|
||||
/*
|
||||
* Either queue has been disconnected or no video buffer
|
||||
* available to bulk transfer. Either way, stop processing
|
||||
* Either the queue has been disconnected or no video buffer
|
||||
* available for bulk transfer. Either way, stop processing
|
||||
* further.
|
||||
*/
|
||||
spin_unlock_irqrestore(&queue->irqlock, flags);
|
||||
|
|
@ -435,11 +434,24 @@ static void uvcg_video_pump(struct work_struct *work)
|
|||
}
|
||||
|
||||
/*
|
||||
* With usb3 we have more requests. This will decrease the
|
||||
* interrupt load to a quarter but also catches the corner
|
||||
* cases, which needs to be handled.
|
||||
* With USB3 handling more requests at a higher speed, we can't
|
||||
* afford to generate an interrupt for every request. Decide to
|
||||
* interrupt:
|
||||
*
|
||||
* - When no more requests are available in the free queue, as
|
||||
* this may be our last chance to refill the endpoint's
|
||||
* request queue.
|
||||
*
|
||||
* - When this is request is the last request for the video
|
||||
* buffer, as we want to start sending the next video buffer
|
||||
* ASAP in case it doesn't get started already in the next
|
||||
* iteration of this loop.
|
||||
*
|
||||
* - Four times over the length of the requests queue (as
|
||||
* indicated by video->uvc_num_requests), as a trade-off
|
||||
* between latency and interrupt load.
|
||||
*/
|
||||
if (list_empty(&video->req_free) || buf_int ||
|
||||
if (list_empty(&video->req_free) || buf_done ||
|
||||
!(video->req_int_count %
|
||||
DIV_ROUND_UP(video->uvc_num_requests, 4))) {
|
||||
video->req_int_count = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue