Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 75996055 authored by chenchangcheng's avatar chenchangcheng Committed by Greg Kroah-Hartman
Browse files

media: uvcvideo: Fix bandwidth issue for Alcor camera



[ Upstream commit 9764401bf6f8a20eb11c2e78470f20fee91a9ea7 ]

Some broken device return wrong dwMaxPayloadTransferSize fields as
follows:

[  218.632537] uvcvideo: Device requested 2752512 B/frame bandwidth.
[  218.632598] uvcvideo: No fast enough alt setting for requested bandwidth.

When dwMaxPayloadTransferSize is greater than maxpsize, it will prevent
the camera from starting. So use the bandwidth of maxpsize.

Signed-off-by: default avatarchenchangcheng <chenchangcheng@kylinos.cn>
Reviewed-by: default avatarRicardo Ribalda <ribalda@chromium.org>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://lore.kernel.org/r/20250510061803.811433-1-ccc194101@163.com


Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 7a41ecfc
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -228,6 +228,15 @@ static void uvc_fixup_video_ctrl(struct uvc_streaming *stream,

		ctrl->dwMaxPayloadTransferSize = bandwidth;
	}

	if (stream->intf->num_altsetting > 1 &&
	    ctrl->dwMaxPayloadTransferSize > stream->maxpsize) {
		dev_warn_ratelimited(&stream->intf->dev,
				     "UVC non compliance: the max payload transmission size (%u) exceeds the size of the ep max packet (%u). Using the max size.\n",
				     ctrl->dwMaxPayloadTransferSize,
				     stream->maxpsize);
		ctrl->dwMaxPayloadTransferSize = stream->maxpsize;
	}
}

static size_t uvc_video_ctrl_size(struct uvc_streaming *stream)