<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/media/test-drivers/vimc, branch v5.15.208</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v5.15.208</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v5.15.208'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2022-12-31T12:14:12+00:00</updated>
<entry>
<title>media: vimc: Fix wrong function called when vimc_init() fails</title>
<updated>2022-12-31T12:14:12+00:00</updated>
<author>
<name>Chen Zhongjin</name>
<email>chenzhongjin@huawei.com</email>
</author>
<published>2022-11-10T07:26:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=9c9ff35d68691aaea85b2e93763772e23930b3a3'/>
<id>urn:sha1:9c9ff35d68691aaea85b2e93763772e23930b3a3</id>
<content type='text'>
[ Upstream commit f74d3f326d1d5b8951ce263c59a121ecfa65e7c0 ]

In vimc_init(), when platform_driver_register(&amp;vimc_pdrv) fails,
platform_driver_unregister(&amp;vimc_pdrv) is wrongly called rather than
platform_device_unregister(&amp;vimc_pdev), which causes kernel warning:

 Unexpected driver unregister!
 WARNING: CPU: 1 PID: 14517 at drivers/base/driver.c:270 driver_unregister+0x8f/0xb0
 RIP: 0010:driver_unregister+0x8f/0xb0
 Call Trace:
  &lt;TASK&gt;
  vimc_init+0x7d/0x1000 [vimc]
  do_one_initcall+0xd0/0x4e0
  do_init_module+0x1cf/0x6b0
  load_module+0x65c2/0x7820

Fixes: 4a29b7090749 ("[media] vimc: Subdevices as modules")
Signed-off-by: Chen Zhongjin &lt;chenzhongjin@huawei.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@kernel.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>media: v4l2-subdev: add subdev-wide state struct</title>
<updated>2021-06-17T08:01:27+00:00</updated>
<author>
<name>Tomi Valkeinen</name>
<email>tomi.valkeinen@ideasonboard.com</email>
</author>
<published>2021-06-10T14:55:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=0d346d2a6f54f06f36b224fd27cd6eafe8c83be9'/>
<id>urn:sha1:0d346d2a6f54f06f36b224fd27cd6eafe8c83be9</id>
<content type='text'>
We have 'struct v4l2_subdev_pad_config' which contains configuration for
a single pad used for the TRY functionality, and an array of those
structs is passed to various v4l2_subdev_pad_ops.

I was working on subdev internal routing between pads, and realized that
there's no way to add TRY functionality for routes, which is not pad
specific configuration. Adding a separate struct for try-route config
wouldn't work either, as e.g. set-fmt needs to know the try-route
configuration to propagate the settings.

This patch adds a new struct, 'struct v4l2_subdev_state' (which at the
moment only contains the v4l2_subdev_pad_config array) and the new
struct is used in most of the places where v4l2_subdev_pad_config was
used. All v4l2_subdev_pad_ops functions taking v4l2_subdev_pad_config
are changed to instead take v4l2_subdev_state.

The changes to drivers/media/v4l2-core/v4l2-subdev.c and
include/media/v4l2-subdev.h were written by hand, and all the driver
changes were done with the semantic patch below. The spatch needs to be
applied to a select list of directories. I used the following shell
commands to apply the spatch:

dirs="drivers/media/i2c drivers/media/platform drivers/media/usb drivers/media/test-drivers/vimc drivers/media/pci drivers/staging/media"
for dir in $dirs; do spatch -j8 --dir --include-headers --no-show-diff --in-place --sp-file v4l2-subdev-state.cocci $dir; done

Note that Coccinelle chokes on a few drivers (gcc extensions?). With
minor changes we can make Coccinelle run fine, and these changes can be
reverted after spatch. The diff for these changes is:

For drivers/media/i2c/s5k5baf.c:

	@@ -1481,7 +1481,7 @@ static int s5k5baf_set_selection(struct v4l2_subdev *sd,
	 				&amp;s5k5baf_cis_rect,
	 				v4l2_subdev_get_try_crop(sd, cfg, PAD_CIS),
	 				v4l2_subdev_get_try_compose(sd, cfg, PAD_CIS),
	-				v4l2_subdev_get_try_crop(sd, cfg, PAD_OUT)
	+				v4l2_subdev_get_try_crop(sd, cfg, PAD_OUT),
	 			};
	 		s5k5baf_set_rect_and_adjust(rects, rtype, &amp;sel-&gt;r);
	 		return 0;

For drivers/media/platform/s3c-camif/camif-capture.c:

	@@ -1230,7 +1230,7 @@ static int s3c_camif_subdev_get_fmt(struct v4l2_subdev *sd,
	 		*mf = camif-&gt;mbus_fmt;
	 		break;

	-	case CAMIF_SD_PAD_SOURCE_C...CAMIF_SD_PAD_SOURCE_P:
	+	case CAMIF_SD_PAD_SOURCE_C:
	 		/* crop rectangle at camera interface input */
	 		mf-&gt;width = camif-&gt;camif_crop.width;
	 		mf-&gt;height = camif-&gt;camif_crop.height;
	@@ -1332,7 +1332,7 @@ static int s3c_camif_subdev_set_fmt(struct v4l2_subdev *sd,
	 		}
	 		break;

	-	case CAMIF_SD_PAD_SOURCE_C...CAMIF_SD_PAD_SOURCE_P:
	+	case CAMIF_SD_PAD_SOURCE_C:
	 		/* Pixel format can be only changed on the sink pad. */
	 		mf-&gt;code = camif-&gt;mbus_fmt.code;
	 		mf-&gt;width = crop-&gt;width;

The semantic patch is:

// &lt;smpl&gt;

// Change function parameter

@@
identifier func;
identifier cfg;
@@

 func(...,
-   struct v4l2_subdev_pad_config *cfg
+   struct v4l2_subdev_state *sd_state
    , ...)
 {
 &lt;...
- cfg
+ sd_state
 ...&gt;
 }

// Change function declaration parameter

@@
identifier func;
identifier cfg;
type T;
@@
T func(...,
-   struct v4l2_subdev_pad_config *cfg
+   struct v4l2_subdev_state *sd_state
    , ...);

// Change function return value

@@
identifier func;
@@
- struct v4l2_subdev_pad_config
+ struct v4l2_subdev_state
 *func(...)
 {
    ...
 }

// Change function declaration return value

@@
identifier func;
@@
- struct v4l2_subdev_pad_config
+ struct v4l2_subdev_state
 *func(...);

// Some drivers pass a local pad_cfg for a single pad to a called function. Wrap it
// inside a pad_state.

@@
identifier func;
identifier pad_cfg;
@@
func(...)
{
    ...
    struct v4l2_subdev_pad_config pad_cfg;
+   struct v4l2_subdev_state pad_state = { .pads = &amp;pad_cfg };

    &lt;+...

(
    v4l2_subdev_call
|
    sensor_call
|
    isi_try_fse
|
    isc_try_fse
|
    saa_call_all
)
    (...,
-   &amp;pad_cfg
+   &amp;pad_state
    ,...)

    ...+&gt;
}

// If the function uses fields from pad_config, access via state-&gt;pads

@@
identifier func;
identifier state;
@@
 func(...,
    struct v4l2_subdev_state *state
    , ...)
 {
    &lt;...
(
-   state-&gt;try_fmt
+   state-&gt;pads-&gt;try_fmt
|
-   state-&gt;try_crop
+   state-&gt;pads-&gt;try_crop
|
-   state-&gt;try_compose
+   state-&gt;pads-&gt;try_compose
)
    ...&gt;
}

// If the function accesses the filehandle, use fh-&gt;state instead

@@
struct v4l2_subdev_fh *fh;
@@
-    fh-&gt;pad
+    fh-&gt;state

@@
struct v4l2_subdev_fh fh;
@@
-    fh.pad
+    fh.state

// Start of vsp1 specific

@@
@@
struct vsp1_entity {
    ...
-    struct v4l2_subdev_pad_config *config;
+    struct v4l2_subdev_state *config;
    ...
};

@@
symbol entity;
@@
vsp1_entity_init(...)
{
    ...
    entity-&gt;config =
-    v4l2_subdev_alloc_pad_config
+    v4l2_subdev_alloc_state
    (&amp;entity-&gt;subdev);
    ...
}

@@
symbol entity;
@@
vsp1_entity_destroy(...)
{
    ...
-   v4l2_subdev_free_pad_config
+   v4l2_subdev_free_state
    (entity-&gt;config);
    ...
}

@exists@
identifier func =~ "(^vsp1.*)|(hsit_set_format)|(sru_enum_frame_size)|(sru_set_format)|(uif_get_selection)|(uif_set_selection)|(uds_enum_frame_size)|(uds_set_format)|(brx_set_format)|(brx_get_selection)|(histo_get_selection)|(histo_set_selection)|(brx_set_selection)";
symbol config;
@@
func(...) {
    ...
-    struct v4l2_subdev_pad_config *config;
+    struct v4l2_subdev_state *config;
    ...
}

// End of vsp1 specific

// Start of rcar specific

@@
identifier sd;
identifier pad_cfg;
@@
 rvin_try_format(...)
 {
    ...
-   struct v4l2_subdev_pad_config *pad_cfg;
+   struct v4l2_subdev_state *sd_state;
    ...
-   pad_cfg = v4l2_subdev_alloc_pad_config(sd);
+   sd_state = v4l2_subdev_alloc_state(sd);
    &lt;...
-   pad_cfg
+   sd_state
    ...&gt;
-   v4l2_subdev_free_pad_config(pad_cfg);
+   v4l2_subdev_free_state(sd_state);
    ...
 }

// End of rcar specific

// Start of rockchip specific

@@
identifier func =~ "(rkisp1_rsz_get_pad_fmt)|(rkisp1_rsz_get_pad_crop)|(rkisp1_rsz_register)";
symbol rsz;
symbol pad_cfg;
@@

 func(...)
 {
+   struct v4l2_subdev_state state = { .pads = rsz-&gt;pad_cfg };
    ...
-   rsz-&gt;pad_cfg
+   &amp;state
    ...
 }

@@
identifier func =~ "(rkisp1_isp_get_pad_fmt)|(rkisp1_isp_get_pad_crop)";
symbol isp;
symbol pad_cfg;
@@

 func(...)
 {
+   struct v4l2_subdev_state state = { .pads = isp-&gt;pad_cfg };
    ...
-   isp-&gt;pad_cfg
+   &amp;state
    ...
 }

@@
symbol rkisp1;
symbol isp;
symbol pad_cfg;
@@

 rkisp1_isp_register(...)
 {
+   struct v4l2_subdev_state state = { .pads = rkisp1-&gt;isp.pad_cfg };
    ...
-   rkisp1-&gt;isp.pad_cfg
+   &amp;state
    ...
 }

// End of rockchip specific

// Start of tegra-video specific

@@
identifier sd;
identifier pad_cfg;
@@
 __tegra_channel_try_format(...)
 {
    ...
-   struct v4l2_subdev_pad_config *pad_cfg;
+   struct v4l2_subdev_state *sd_state;
    ...
-   pad_cfg = v4l2_subdev_alloc_pad_config(sd);
+   sd_state = v4l2_subdev_alloc_state(sd);
    &lt;...
-   pad_cfg
+   sd_state
    ...&gt;
-   v4l2_subdev_free_pad_config(pad_cfg);
+   v4l2_subdev_free_state(sd_state);
    ...
 }

@@
identifier sd_state;
@@
 __tegra_channel_try_format(...)
 {
    ...
    struct v4l2_subdev_state *sd_state;
    &lt;...
-   sd_state-&gt;try_crop
+   sd_state-&gt;pads-&gt;try_crop
    ...&gt;
 }

// End of tegra-video specific

// &lt;/smpl&gt;

Signed-off-by: Tomi Valkeinen &lt;tomi.valkeinen@ideasonboard.com&gt;
Acked-by: Laurent Pinchart &lt;laurent.pinchart@ideasonboard.com&gt;
Acked-by: Sakari Ailus &lt;sakari.ailus@linux.intel.com&gt;
Signed-off-by: Hans Verkuil &lt;hverkuil-cisco@xs4all.nl&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab+huawei@kernel.org&gt;
</content>
</entry>
<entry>
<title>media: media/test-drivers: use vb2_video_unregister_device()</title>
<updated>2020-08-28T13:05:40+00:00</updated>
<author>
<name>Hans Verkuil</name>
<email>hverkuil-cisco@xs4all.nl</email>
</author>
<published>2020-07-13T11:30:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=bda24f433013d698467dea589e0fe37544c44fe0'/>
<id>urn:sha1:bda24f433013d698467dea589e0fe37544c44fe0</id>
<content type='text'>
Use vb2_video_unregister_device() to automatically stop streaming
at unregister time.

This avoids the use of vb2_queue_release() which should not be
called by drivers that set vdev-&gt;queue.

Signed-off-by: Hans Verkuil &lt;hverkuil-cisco@xs4all.nl&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab+huawei@kernel.org&gt;
</content>
</entry>
<entry>
<title>media: vimc: Add a control to display info on test image</title>
<updated>2020-07-19T11:39:22+00:00</updated>
<author>
<name>Kaaira Gupta</name>
<email>kgupta@es.iitr.ac.in</email>
</author>
<published>2020-07-05T13:53:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5f3fb5c54d67670fa6743d2434a5bd43a97c01de'/>
<id>urn:sha1:5f3fb5c54d67670fa6743d2434a5bd43a97c01de</id>
<content type='text'>
Add a control in VIMC to display information such as the correct order of
colors for a given test pattern, counter, brightness, hue, saturation,
contrast, width and height at sensor over test image.

Signed-off-by: Kaaira Gupta &lt;kgupta@es.iitr.ac.in&gt;
Acked-by: Helen Koike &lt;helen.koike@collabora.com&gt;
Reviewed-by: Kieran Bingham &lt;kieran.bingham@ideasonboard.com&gt;
Signed-off-by: Hans Verkuil &lt;hverkuil-cisco@xs4all.nl&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab+huawei@kernel.org&gt;
</content>
</entry>
<entry>
<title>media: vimc: Make use of V4L2_CAP_IO_MC</title>
<updated>2020-05-06T10:10:12+00:00</updated>
<author>
<name>Niklas Söderlund</name>
<email>niklas.soderlund+renesas@ragnatech.se</email>
</author>
<published>2020-04-21T13:57:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c7ff09f6e262c1ed3e0bf3d465d5204042957036'/>
<id>urn:sha1:c7ff09f6e262c1ed3e0bf3d465d5204042957036</id>
<content type='text'>
Set the V4L2_CAP_IO_MC capability flag to report this vimc
inputs/outputs are controlled by the media graph.

Signed-off-by: Niklas Söderlund &lt;niklas.soderlund+renesas@ragnatech.se&gt;
Signed-off-by: Laurent Pinchart &lt;laurent.pinchart@ideasonboard.com&gt;
Acked-by: Sakari Ailus &lt;sakari.ailus@linux.intel.com&gt;
Signed-off-by: Hans Verkuil &lt;hverkuil-cisco@xs4all.nl&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab+huawei@kernel.org&gt;
</content>
</entry>
<entry>
<title>media: vimc: deb: Add support for {RGB,BGR,GBR}888 bus formats on source pad</title>
<updated>2020-05-05T15:26:04+00:00</updated>
<author>
<name>Nícolas F. R. A. Prado</name>
<email>nfraprado@protonmail.com</email>
</author>
<published>2020-05-01T13:11:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f4d12d8009d9e9917859c6a4291d49c6e70e92c1'/>
<id>urn:sha1:f4d12d8009d9e9917859c6a4291d49c6e70e92c1</id>
<content type='text'>
Add support for RGB888_*, BGR888_* and GBR888_* media bus formats on
the source pad of debayer subdevices.

Acked-by: Helen Koike &lt;helen.koike@collabora.com&gt;
Co-developed-by: Vitor Massaru Iha &lt;vitor@massaru.org&gt;
Signed-off-by: Vitor Massaru Iha &lt;vitor@massaru.org&gt;
Signed-off-by: Nícolas F. R. A. Prado &lt;nfraprado@protonmail.com&gt;
Signed-off-by: Hans Verkuil &lt;hverkuil-cisco@xs4all.nl&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab+huawei@kernel.org&gt;
</content>
</entry>
<entry>
<title>media: vimc: Add missing {RGB,BGR,GBR}888 media bus codes</title>
<updated>2020-05-05T15:25:34+00:00</updated>
<author>
<name>Nícolas F. R. A. Prado</name>
<email>nfraprado@protonmail.com</email>
</author>
<published>2020-05-01T13:11:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=772563b27c9f5cb0e19bf6c5fb4383a86e3347e3'/>
<id>urn:sha1:772563b27c9f5cb0e19bf6c5fb4383a86e3347e3</id>
<content type='text'>
Add missing RGB888_*, BGR888_* and GBR888_* media bus codes in the
vimc_pix_map_list. Since there is no GBR24 pixelformat, use the RGB24
pixelformat for MEDIA_BUS_FMT_GBR888_1X24.

Acked-by: Helen Koike &lt;helen.koike@collabora.com&gt;
Co-developed-by: Vitor Massaru Iha &lt;vitor@massaru.org&gt;
Signed-off-by: Vitor Massaru Iha &lt;vitor@massaru.org&gt;
Signed-off-by: Nícolas F. R. A. Prado &lt;nfraprado@protonmail.com&gt;
Signed-off-by: Hans Verkuil &lt;hverkuil-cisco@xs4all.nl&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab+huawei@kernel.org&gt;
</content>
</entry>
<entry>
<title>media: vimc: Support multiple media bus codes for each pixelformat</title>
<updated>2020-05-05T15:25:14+00:00</updated>
<author>
<name>Nícolas F. R. A. Prado</name>
<email>nfraprado@protonmail.com</email>
</author>
<published>2020-05-01T13:11:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b77da87c84f8d3f0290ef96f72edac9a9d2b1d23'/>
<id>urn:sha1:b77da87c84f8d3f0290ef96f72edac9a9d2b1d23</id>
<content type='text'>
Change vimc_pix_map_list to allow multiple media bus codes to map to the
same pixelformat, making it possible to add media bus codes for which
there are no pixelformat.

Acked-by: Helen Koike &lt;helen.koike@collabora.com&gt;
Signed-off-by: Nícolas F. R. A. Prado &lt;nfraprado@protonmail.com&gt;
Signed-off-by: Hans Verkuil &lt;hverkuil-cisco@xs4all.nl&gt;
[hverkuil-cisco@xs4all.nl: fix sparse warning: const u32 -&gt; u32]
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab+huawei@kernel.org&gt;
</content>
</entry>
<entry>
<title>media: vimc: cap: Report a colorspace</title>
<updated>2020-04-29T10:02:30+00:00</updated>
<author>
<name>Niklas Söderlund</name>
<email>niklas.soderlund+renesas@ragnatech.se</email>
</author>
<published>2020-04-17T15:09:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=9a42a5ff3daccc37ae4dbcfb6ce5c5d95419740b'/>
<id>urn:sha1:9a42a5ff3daccc37ae4dbcfb6ce5c5d95419740b</id>
<content type='text'>
The colorspace reported by a video nodes should not be
V4L2_COLORSPACE_DEFAULT. Instead a default colorspace should be picked
by the driver if V4L2_COLORSPACE_DEFAULT is given by userspace to
{G,S,TRY}_FMT.

The colorspace V4L2_COLORSPACE_SRGB is arbitrary chosen as the vimc
default format to report as it's used for most webcams.

Signed-off-by: Niklas Söderlund &lt;niklas.soderlund+renesas@ragnatech.se&gt;
Acked-by: Helen Koike &lt;helen.koike@collabora.com&gt;
Signed-off-by: Hans Verkuil &lt;hverkuil-cisco@xs4all.nl&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab+huawei@kernel.org&gt;
</content>
</entry>
<entry>
<title>media: media/test_drivers: rename to test-drivers</title>
<updated>2020-04-16T08:38:31+00:00</updated>
<author>
<name>Hans Verkuil</name>
<email>hverkuil-cisco@xs4all.nl</email>
</author>
<published>2020-04-16T08:25:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=dacca5f0fa69f04c2e70aad9847e8250b459971c'/>
<id>urn:sha1:dacca5f0fa69f04c2e70aad9847e8250b459971c</id>
<content type='text'>
We never use _ in directory names in the media subsystem, so
rename to test-drivers instead for consistency.

Also update MAINTAINERS with the new path.

Signed-off-by: Hans Verkuil &lt;hverkuil-cisco@xs4all.nl&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab+huawei@kernel.org&gt;
</content>
</entry>
</feed>
