* [PATCH v3 0/3] media: uvcvideo: Limit Power Line Control
@ 2023-01-03 11:01 Ricardo Ribalda
2023-01-03 11:01 ` [PATCH v3 1/3] media: uvcvideo: Limit power line control for Acer EasyCamera Ricardo Ribalda
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Ricardo Ribalda @ 2023-01-03 11:01 UTC (permalink / raw)
To: Laurent Pinchart, Mauro Carvalho Chehab
Cc: linux-media, Ricardo Ribalda, linux-kernel, Sergey Senozhatsky
Another set of webcams with invalid PLC controls.
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-media@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
Changes in v3:
- Add patch to refactor uvc_ctrl_power_line_mapping_limited. (Can be ignored)
- Improve commit message. (Thanks Laurent!)
- Reference uvc_ctrl_power_line_mapping_uvc11 from uvc_ctrl.c (Thanks Laurent!)
- Link to v2: https://lore.kernel.org/r/20221101-easycam-v2-0-5956414a608c@chromium.org
Changes in v2:
- Add Lenovo Integrated Camera
- Link to v1: https://lore.kernel.org/r/20221101-easycam-v1-0-71d6409963da@chromium.org
---
Ricardo Ribalda (3):
media: uvcvideo: Limit power line control for Acer EasyCamera
media: uvcvideo: Fix power line control for Lenovo Integrated Camera
media: uvcvideo: Refactor power_line_frequency_controls_limited
drivers/media/usb/uvc/uvc_ctrl.c | 41 ++++++++++++++++++++++++++++----------
drivers/media/usb/uvc/uvc_driver.c | 38 +++++++++++++++++++++--------------
drivers/media/usb/uvc/uvcvideo.h | 2 ++
3 files changed, 55 insertions(+), 26 deletions(-)
---
base-commit: 69b41ac87e4a664de78a395ff97166f0b2943210
change-id: 20221101-easycam-8f1ab598b12f
Best regards,
--
Ricardo Ribalda <ribalda@chromium.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3 1/3] media: uvcvideo: Limit power line control for Acer EasyCamera
2023-01-03 11:01 [PATCH v3 0/3] media: uvcvideo: Limit Power Line Control Ricardo Ribalda
@ 2023-01-03 11:01 ` Ricardo Ribalda
2023-01-03 11:01 ` [PATCH v3 2/3] media: uvcvideo: Fix power line control for Lenovo Integrated Camera Ricardo Ribalda
2023-01-03 11:01 ` [PATCH v3 3/3] media: uvcvideo: Refactor power_line_frequency_controls_limited Ricardo Ribalda
2 siblings, 0 replies; 6+ messages in thread
From: Ricardo Ribalda @ 2023-01-03 11:01 UTC (permalink / raw)
To: Laurent Pinchart, Mauro Carvalho Chehab
Cc: linux-media, Ricardo Ribalda, linux-kernel, Sergey Senozhatsky
The device does not implement the power line control correctly. Add a
corresponding control mapping override.
Bus 003 Device 002: ID 5986:1180 Acer, Inc EasyCamera
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 239 Miscellaneous Device
bDeviceSubClass 2
bDeviceProtocol 1 Interface Association
bMaxPacketSize0 64
idVendor 0x5986 Acer, Inc
idProduct 0x1180
bcdDevice 56.04
iManufacturer 3 Bison
iProduct 1 EasyCamera
iSerial 2
bNumConfigurations 1
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/usb/uvc/uvc_driver.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index e4bcb5011360..f2abd9d0c717 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -2991,6 +2991,15 @@ static const struct usb_device_id uvc_ids[] = {
.bInterfaceSubClass = 1,
.bInterfaceProtocol = 0,
.driver_info = (kernel_ulong_t)&uvc_ctrl_power_line_limited },
+ /* Acer EasyCamera */
+ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
+ | USB_DEVICE_ID_MATCH_INT_INFO,
+ .idVendor = 0x5986,
+ .idProduct = 0x1180,
+ .bInterfaceClass = USB_CLASS_VIDEO,
+ .bInterfaceSubClass = 1,
+ .bInterfaceProtocol = 0,
+ .driver_info = (kernel_ulong_t)&uvc_ctrl_power_line_limited },
/* Intel RealSense D4M */
{ .match_flags = USB_DEVICE_ID_MATCH_DEVICE
| USB_DEVICE_ID_MATCH_INT_INFO,
--
2.39.0.314.g84b9a713c41-goog-b4-0.11.0-dev-696ae
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v3 2/3] media: uvcvideo: Fix power line control for Lenovo Integrated Camera
2023-01-03 11:01 [PATCH v3 0/3] media: uvcvideo: Limit Power Line Control Ricardo Ribalda
2023-01-03 11:01 ` [PATCH v3 1/3] media: uvcvideo: Limit power line control for Acer EasyCamera Ricardo Ribalda
@ 2023-01-03 11:01 ` Ricardo Ribalda
2023-01-03 21:06 ` Laurent Pinchart
2023-01-03 11:01 ` [PATCH v3 3/3] media: uvcvideo: Refactor power_line_frequency_controls_limited Ricardo Ribalda
2 siblings, 1 reply; 6+ messages in thread
From: Ricardo Ribalda @ 2023-01-03 11:01 UTC (permalink / raw)
To: Laurent Pinchart, Mauro Carvalho Chehab
Cc: linux-media, Ricardo Ribalda, linux-kernel, Sergey Senozhatsky
The device does not implement the power line control correctly. It is
a UVC 1.5 device, but implements the PLC control as a UVC 1.1 device.
Add the corresponding control mapping override.
Bus 003 Device 002: ID 30c9:0093 Lenovo Integrated Camera
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.01
bDeviceClass 239 Miscellaneous Device
bDeviceSubClass 2
bDeviceProtocol 1 Interface Association
bMaxPacketSize0 64
idVendor 0x30c9
idProduct 0x0093
bcdDevice 0.07
iManufacturer 3 Lenovo
iProduct 1 Integrated Camera
iSerial 2 8SSC21J75356V1SR2830069
bNumConfigurations 1
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/usb/uvc/uvc_ctrl.c | 24 +++++++++++++-----------
drivers/media/usb/uvc/uvc_driver.c | 16 ++++++++++++++++
drivers/media/usb/uvc/uvcvideo.h | 1 +
3 files changed, 30 insertions(+), 11 deletions(-)
diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
index c95a2229f4fa..d8283d71bc96 100644
--- a/drivers/media/usb/uvc/uvc_ctrl.c
+++ b/drivers/media/usb/uvc/uvc_ctrl.c
@@ -721,18 +721,20 @@ static const struct uvc_control_mapping uvc_ctrl_mappings[] = {
},
};
+const struct uvc_control_mapping uvc_ctrl_power_line_mapping_uvc11 = {
+ .id = V4L2_CID_POWER_LINE_FREQUENCY,
+ .entity = UVC_GUID_UVC_PROCESSING,
+ .selector = UVC_PU_POWER_LINE_FREQUENCY_CONTROL,
+ .size = 2,
+ .offset = 0,
+ .v4l2_type = V4L2_CTRL_TYPE_MENU,
+ .data_type = UVC_CTRL_DATA_TYPE_ENUM,
+ .menu_info = power_line_frequency_controls,
+ .menu_count = ARRAY_SIZE(power_line_frequency_controls) - 1,
+};
+
static const struct uvc_control_mapping uvc_ctrl_mappings_uvc11[] = {
- {
- .id = V4L2_CID_POWER_LINE_FREQUENCY,
- .entity = UVC_GUID_UVC_PROCESSING,
- .selector = UVC_PU_POWER_LINE_FREQUENCY_CONTROL,
- .size = 2,
- .offset = 0,
- .v4l2_type = V4L2_CTRL_TYPE_MENU,
- .data_type = UVC_CTRL_DATA_TYPE_ENUM,
- .menu_info = power_line_frequency_controls,
- .menu_count = ARRAY_SIZE(power_line_frequency_controls) - 1,
- },
+ uvc_ctrl_power_line_mapping_uvc11,
};
static const struct uvc_control_mapping uvc_ctrl_mappings_uvc15[] = {
diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index f2abd9d0c717..9c09bc988278 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -2370,6 +2370,13 @@ MODULE_PARM_DESC(timeout, "Streaming control requests timeout");
* Driver initialization and cleanup
*/
+static const struct uvc_device_info uvc_ctrl_power_line_uvc11 = {
+ .mappings = (const struct uvc_control_mapping *[]) {
+ &uvc_ctrl_power_line_mapping_uvc11,
+ NULL, /* Sentinel */
+ },
+};
+
static const struct uvc_menu_info power_line_frequency_controls_limited[] = {
{ 1, "50 Hz" },
{ 2, "60 Hz" },
@@ -2973,6 +2980,15 @@ static const struct usb_device_id uvc_ids[] = {
.bInterfaceSubClass = 1,
.bInterfaceProtocol = 0,
.driver_info = UVC_INFO_QUIRK(UVC_QUIRK_FORCE_BPP) },
+ /* Lenovo Integrated Camera */
+ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
+ | USB_DEVICE_ID_MATCH_INT_INFO,
+ .idVendor = 0x30c9,
+ .idProduct = 0x0093,
+ .bInterfaceClass = USB_CLASS_VIDEO,
+ .bInterfaceSubClass = 1,
+ .bInterfaceProtocol = UVC_PC_PROTOCOL_15,
+ .driver_info = (kernel_ulong_t)&uvc_ctrl_power_line_uvc11 },
/* Sonix Technology USB 2.0 Camera */
{ .match_flags = USB_DEVICE_ID_MATCH_DEVICE
| USB_DEVICE_ID_MATCH_INT_INFO,
diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h
index df93db259312..bcb0b0c101c8 100644
--- a/drivers/media/usb/uvc/uvcvideo.h
+++ b/drivers/media/usb/uvc/uvcvideo.h
@@ -728,6 +728,7 @@ int uvc_status_start(struct uvc_device *dev, gfp_t flags);
void uvc_status_stop(struct uvc_device *dev);
/* Controls */
+extern const struct uvc_control_mapping uvc_ctrl_power_line_mapping_uvc11;
extern const struct v4l2_subscribed_event_ops uvc_ctrl_sub_ev_ops;
int uvc_query_v4l2_ctrl(struct uvc_video_chain *chain,
--
2.39.0.314.g84b9a713c41-goog-b4-0.11.0-dev-696ae
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v3 3/3] media: uvcvideo: Refactor power_line_frequency_controls_limited
2023-01-03 11:01 [PATCH v3 0/3] media: uvcvideo: Limit Power Line Control Ricardo Ribalda
2023-01-03 11:01 ` [PATCH v3 1/3] media: uvcvideo: Limit power line control for Acer EasyCamera Ricardo Ribalda
2023-01-03 11:01 ` [PATCH v3 2/3] media: uvcvideo: Fix power line control for Lenovo Integrated Camera Ricardo Ribalda
@ 2023-01-03 11:01 ` Ricardo Ribalda
2023-01-03 21:07 ` Laurent Pinchart
2 siblings, 1 reply; 6+ messages in thread
From: Ricardo Ribalda @ 2023-01-03 11:01 UTC (permalink / raw)
To: Laurent Pinchart, Mauro Carvalho Chehab
Cc: linux-media, Ricardo Ribalda, linux-kernel, Sergey Senozhatsky
Move the control mapping to uvc_ctrl.c. This way we do not have
references to uvc controls or v4l2 controls in uvc_driver.c
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/usb/uvc/uvc_ctrl.c | 17 +++++++++++++++++
drivers/media/usb/uvc/uvc_driver.c | 17 -----------------
drivers/media/usb/uvc/uvcvideo.h | 1 +
3 files changed, 18 insertions(+), 17 deletions(-)
diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
index d8283d71bc96..4ff0415d8bf4 100644
--- a/drivers/media/usb/uvc/uvc_ctrl.c
+++ b/drivers/media/usb/uvc/uvc_ctrl.c
@@ -370,6 +370,11 @@ static const struct uvc_menu_info power_line_frequency_controls[] = {
{ 3, "Auto" },
};
+static const struct uvc_menu_info power_line_frequency_controls_limited[] = {
+ { 1, "50 Hz" },
+ { 2, "60 Hz" },
+};
+
static const struct uvc_menu_info exposure_auto_controls[] = {
{ 2, "Auto Mode" },
{ 1, "Manual Mode" },
@@ -751,6 +756,18 @@ static const struct uvc_control_mapping uvc_ctrl_mappings_uvc15[] = {
},
};
+const struct uvc_control_mapping uvc_ctrl_power_line_mapping_limited = {
+ .id = V4L2_CID_POWER_LINE_FREQUENCY,
+ .entity = UVC_GUID_UVC_PROCESSING,
+ .selector = UVC_PU_POWER_LINE_FREQUENCY_CONTROL,
+ .size = 2,
+ .offset = 0,
+ .v4l2_type = V4L2_CTRL_TYPE_MENU,
+ .data_type = UVC_CTRL_DATA_TYPE_ENUM,
+ .menu_info = power_line_frequency_controls_limited,
+ .menu_count = ARRAY_SIZE(power_line_frequency_controls_limited),
+};
+
/* ------------------------------------------------------------------------
* Utility functions
*/
diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index 9c09bc988278..6531aed5d642 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -2377,23 +2377,6 @@ static const struct uvc_device_info uvc_ctrl_power_line_uvc11 = {
},
};
-static const struct uvc_menu_info power_line_frequency_controls_limited[] = {
- { 1, "50 Hz" },
- { 2, "60 Hz" },
-};
-
-static const struct uvc_control_mapping uvc_ctrl_power_line_mapping_limited = {
- .id = V4L2_CID_POWER_LINE_FREQUENCY,
- .entity = UVC_GUID_UVC_PROCESSING,
- .selector = UVC_PU_POWER_LINE_FREQUENCY_CONTROL,
- .size = 2,
- .offset = 0,
- .v4l2_type = V4L2_CTRL_TYPE_MENU,
- .data_type = UVC_CTRL_DATA_TYPE_ENUM,
- .menu_info = power_line_frequency_controls_limited,
- .menu_count = ARRAY_SIZE(power_line_frequency_controls_limited),
-};
-
static const struct uvc_device_info uvc_ctrl_power_line_limited = {
.mappings = (const struct uvc_control_mapping *[]) {
&uvc_ctrl_power_line_mapping_limited,
diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h
index bcb0b0c101c8..818ae7a6f9b9 100644
--- a/drivers/media/usb/uvc/uvcvideo.h
+++ b/drivers/media/usb/uvc/uvcvideo.h
@@ -728,6 +728,7 @@ int uvc_status_start(struct uvc_device *dev, gfp_t flags);
void uvc_status_stop(struct uvc_device *dev);
/* Controls */
+extern const struct uvc_control_mapping uvc_ctrl_power_line_mapping_limited;
extern const struct uvc_control_mapping uvc_ctrl_power_line_mapping_uvc11;
extern const struct v4l2_subscribed_event_ops uvc_ctrl_sub_ev_ops;
--
2.39.0.314.g84b9a713c41-goog-b4-0.11.0-dev-696ae
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v3 2/3] media: uvcvideo: Fix power line control for Lenovo Integrated Camera
2023-01-03 11:01 ` [PATCH v3 2/3] media: uvcvideo: Fix power line control for Lenovo Integrated Camera Ricardo Ribalda
@ 2023-01-03 21:06 ` Laurent Pinchart
0 siblings, 0 replies; 6+ messages in thread
From: Laurent Pinchart @ 2023-01-03 21:06 UTC (permalink / raw)
To: Ricardo Ribalda
Cc: Mauro Carvalho Chehab, linux-media, linux-kernel,
Sergey Senozhatsky
Hi Ricardo,
Thank you for the patch.
On Tue, Jan 03, 2023 at 12:01:22PM +0100, Ricardo Ribalda wrote:
> The device does not implement the power line control correctly. It is
> a UVC 1.5 device, but implements the PLC control as a UVC 1.1 device.
>
> Add the corresponding control mapping override.
>
> Bus 003 Device 002: ID 30c9:0093 Lenovo Integrated Camera
> Device Descriptor:
> bLength 18
> bDescriptorType 1
> bcdUSB 2.01
> bDeviceClass 239 Miscellaneous Device
> bDeviceSubClass 2
> bDeviceProtocol 1 Interface Association
> bMaxPacketSize0 64
> idVendor 0x30c9
> idProduct 0x0093
> bcdDevice 0.07
> iManufacturer 3 Lenovo
> iProduct 1 Integrated Camera
> iSerial 2 8SSC21J75356V1SR2830069
> bNumConfigurations 1
>
> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
> ---
> drivers/media/usb/uvc/uvc_ctrl.c | 24 +++++++++++++-----------
> drivers/media/usb/uvc/uvc_driver.c | 16 ++++++++++++++++
> drivers/media/usb/uvc/uvcvideo.h | 1 +
> 3 files changed, 30 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
> index c95a2229f4fa..d8283d71bc96 100644
> --- a/drivers/media/usb/uvc/uvc_ctrl.c
> +++ b/drivers/media/usb/uvc/uvc_ctrl.c
> @@ -721,18 +721,20 @@ static const struct uvc_control_mapping uvc_ctrl_mappings[] = {
> },
> };
>
> +const struct uvc_control_mapping uvc_ctrl_power_line_mapping_uvc11 = {
> + .id = V4L2_CID_POWER_LINE_FREQUENCY,
> + .entity = UVC_GUID_UVC_PROCESSING,
> + .selector = UVC_PU_POWER_LINE_FREQUENCY_CONTROL,
> + .size = 2,
> + .offset = 0,
> + .v4l2_type = V4L2_CTRL_TYPE_MENU,
> + .data_type = UVC_CTRL_DATA_TYPE_ENUM,
> + .menu_info = power_line_frequency_controls,
> + .menu_count = ARRAY_SIZE(power_line_frequency_controls) - 1,
> +};
> +
> static const struct uvc_control_mapping uvc_ctrl_mappings_uvc11[] = {
> - {
> - .id = V4L2_CID_POWER_LINE_FREQUENCY,
> - .entity = UVC_GUID_UVC_PROCESSING,
> - .selector = UVC_PU_POWER_LINE_FREQUENCY_CONTROL,
> - .size = 2,
> - .offset = 0,
> - .v4l2_type = V4L2_CTRL_TYPE_MENU,
> - .data_type = UVC_CTRL_DATA_TYPE_ENUM,
> - .menu_info = power_line_frequency_controls,
> - .menu_count = ARRAY_SIZE(power_line_frequency_controls) - 1,
> - },
> + uvc_ctrl_power_line_mapping_uvc11,
This conflicts with your v4l2-compliance fixes series that I have
applied to my tree. I have fixed the conflict locally and pushed the
result to
https://git.kernel.org/pub/scm/linux/kernel/git/pinchartl/linux.git/log/?h=next/uvc,
could you check that I got it right ?
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> };
>
> static const struct uvc_control_mapping uvc_ctrl_mappings_uvc15[] = {
> diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
> index f2abd9d0c717..9c09bc988278 100644
> --- a/drivers/media/usb/uvc/uvc_driver.c
> +++ b/drivers/media/usb/uvc/uvc_driver.c
> @@ -2370,6 +2370,13 @@ MODULE_PARM_DESC(timeout, "Streaming control requests timeout");
> * Driver initialization and cleanup
> */
>
> +static const struct uvc_device_info uvc_ctrl_power_line_uvc11 = {
> + .mappings = (const struct uvc_control_mapping *[]) {
> + &uvc_ctrl_power_line_mapping_uvc11,
> + NULL, /* Sentinel */
> + },
> +};
> +
> static const struct uvc_menu_info power_line_frequency_controls_limited[] = {
> { 1, "50 Hz" },
> { 2, "60 Hz" },
> @@ -2973,6 +2980,15 @@ static const struct usb_device_id uvc_ids[] = {
> .bInterfaceSubClass = 1,
> .bInterfaceProtocol = 0,
> .driver_info = UVC_INFO_QUIRK(UVC_QUIRK_FORCE_BPP) },
> + /* Lenovo Integrated Camera */
> + { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
> + | USB_DEVICE_ID_MATCH_INT_INFO,
> + .idVendor = 0x30c9,
> + .idProduct = 0x0093,
> + .bInterfaceClass = USB_CLASS_VIDEO,
> + .bInterfaceSubClass = 1,
> + .bInterfaceProtocol = UVC_PC_PROTOCOL_15,
> + .driver_info = (kernel_ulong_t)&uvc_ctrl_power_line_uvc11 },
> /* Sonix Technology USB 2.0 Camera */
> { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
> | USB_DEVICE_ID_MATCH_INT_INFO,
> diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h
> index df93db259312..bcb0b0c101c8 100644
> --- a/drivers/media/usb/uvc/uvcvideo.h
> +++ b/drivers/media/usb/uvc/uvcvideo.h
> @@ -728,6 +728,7 @@ int uvc_status_start(struct uvc_device *dev, gfp_t flags);
> void uvc_status_stop(struct uvc_device *dev);
>
> /* Controls */
> +extern const struct uvc_control_mapping uvc_ctrl_power_line_mapping_uvc11;
> extern const struct v4l2_subscribed_event_ops uvc_ctrl_sub_ev_ops;
>
> int uvc_query_v4l2_ctrl(struct uvc_video_chain *chain,
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 3/3] media: uvcvideo: Refactor power_line_frequency_controls_limited
2023-01-03 11:01 ` [PATCH v3 3/3] media: uvcvideo: Refactor power_line_frequency_controls_limited Ricardo Ribalda
@ 2023-01-03 21:07 ` Laurent Pinchart
0 siblings, 0 replies; 6+ messages in thread
From: Laurent Pinchart @ 2023-01-03 21:07 UTC (permalink / raw)
To: Ricardo Ribalda
Cc: Mauro Carvalho Chehab, linux-media, linux-kernel,
Sergey Senozhatsky
Hi Ricardo,
Thank you for the patch.
On Tue, Jan 03, 2023 at 12:01:23PM +0100, Ricardo Ribalda wrote:
> Move the control mapping to uvc_ctrl.c. This way we do not have
> references to uvc controls or v4l2 controls in uvc_driver.c
s/uvc/UVC/
s/v4l2/V4L2/
> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
> ---
> drivers/media/usb/uvc/uvc_ctrl.c | 17 +++++++++++++++++
> drivers/media/usb/uvc/uvc_driver.c | 17 -----------------
> drivers/media/usb/uvc/uvcvideo.h | 1 +
This conflicts quite badly with 8/8 from your v4l2-compliance series.
Could you rebase one of top of the other and resend the two patches as
one series, on top of
https://git.kernel.org/pub/scm/linux/kernel/git/pinchartl/linux.git/log/?h=next/uvc
?
> 3 files changed, 18 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
> index d8283d71bc96..4ff0415d8bf4 100644
> --- a/drivers/media/usb/uvc/uvc_ctrl.c
> +++ b/drivers/media/usb/uvc/uvc_ctrl.c
> @@ -370,6 +370,11 @@ static const struct uvc_menu_info power_line_frequency_controls[] = {
> { 3, "Auto" },
> };
>
> +static const struct uvc_menu_info power_line_frequency_controls_limited[] = {
> + { 1, "50 Hz" },
> + { 2, "60 Hz" },
> +};
> +
> static const struct uvc_menu_info exposure_auto_controls[] = {
> { 2, "Auto Mode" },
> { 1, "Manual Mode" },
> @@ -751,6 +756,18 @@ static const struct uvc_control_mapping uvc_ctrl_mappings_uvc15[] = {
> },
> };
>
> +const struct uvc_control_mapping uvc_ctrl_power_line_mapping_limited = {
> + .id = V4L2_CID_POWER_LINE_FREQUENCY,
> + .entity = UVC_GUID_UVC_PROCESSING,
> + .selector = UVC_PU_POWER_LINE_FREQUENCY_CONTROL,
> + .size = 2,
> + .offset = 0,
> + .v4l2_type = V4L2_CTRL_TYPE_MENU,
> + .data_type = UVC_CTRL_DATA_TYPE_ENUM,
> + .menu_info = power_line_frequency_controls_limited,
> + .menu_count = ARRAY_SIZE(power_line_frequency_controls_limited),
> +};
> +
> /* ------------------------------------------------------------------------
> * Utility functions
> */
> diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
> index 9c09bc988278..6531aed5d642 100644
> --- a/drivers/media/usb/uvc/uvc_driver.c
> +++ b/drivers/media/usb/uvc/uvc_driver.c
> @@ -2377,23 +2377,6 @@ static const struct uvc_device_info uvc_ctrl_power_line_uvc11 = {
> },
> };
>
> -static const struct uvc_menu_info power_line_frequency_controls_limited[] = {
> - { 1, "50 Hz" },
> - { 2, "60 Hz" },
> -};
> -
> -static const struct uvc_control_mapping uvc_ctrl_power_line_mapping_limited = {
> - .id = V4L2_CID_POWER_LINE_FREQUENCY,
> - .entity = UVC_GUID_UVC_PROCESSING,
> - .selector = UVC_PU_POWER_LINE_FREQUENCY_CONTROL,
> - .size = 2,
> - .offset = 0,
> - .v4l2_type = V4L2_CTRL_TYPE_MENU,
> - .data_type = UVC_CTRL_DATA_TYPE_ENUM,
> - .menu_info = power_line_frequency_controls_limited,
> - .menu_count = ARRAY_SIZE(power_line_frequency_controls_limited),
> -};
> -
> static const struct uvc_device_info uvc_ctrl_power_line_limited = {
> .mappings = (const struct uvc_control_mapping *[]) {
> &uvc_ctrl_power_line_mapping_limited,
> diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h
> index bcb0b0c101c8..818ae7a6f9b9 100644
> --- a/drivers/media/usb/uvc/uvcvideo.h
> +++ b/drivers/media/usb/uvc/uvcvideo.h
> @@ -728,6 +728,7 @@ int uvc_status_start(struct uvc_device *dev, gfp_t flags);
> void uvc_status_stop(struct uvc_device *dev);
>
> /* Controls */
> +extern const struct uvc_control_mapping uvc_ctrl_power_line_mapping_limited;
> extern const struct uvc_control_mapping uvc_ctrl_power_line_mapping_uvc11;
> extern const struct v4l2_subscribed_event_ops uvc_ctrl_sub_ev_ops;
>
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-01-03 21:07 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-03 11:01 [PATCH v3 0/3] media: uvcvideo: Limit Power Line Control Ricardo Ribalda
2023-01-03 11:01 ` [PATCH v3 1/3] media: uvcvideo: Limit power line control for Acer EasyCamera Ricardo Ribalda
2023-01-03 11:01 ` [PATCH v3 2/3] media: uvcvideo: Fix power line control for Lenovo Integrated Camera Ricardo Ribalda
2023-01-03 21:06 ` Laurent Pinchart
2023-01-03 11:01 ` [PATCH v3 3/3] media: uvcvideo: Refactor power_line_frequency_controls_limited Ricardo Ribalda
2023-01-03 21:07 ` Laurent Pinchart
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox