This series is a continuation of the series that converts the atmel-isc driver
to media controller paradigm:
https://lore.kernel.org/lkml/[email protected]/T/#mccad96a3122f2817bf1ae1db7eddf1a8cecb2749
As discussed on ML, the current Atmel ISC driver is moved to staging to keep the
existing users happy, and readded to platform/microchip under a different
Kconfig symbol and with the new media controller support which was reviewed in
v10.
I kept the original v10 patches on top of the movement of the driver
to make it more clear what the conversion to media controller brings.
Please let me know if this is okay or acceptable to take as it is,
and if it complies with the requirements for the subsystem/ABI breakage, etc.
Thanks to everyone for reviewing and helping in the discussions !
PLEASE NOTE: the series depends on the patch:
vb2: add support for (un)prepare_streaming queue ops
by Hans Verkuil
I have a different patch as the last in the series that uses the new callbacks
(and only that patch is dependant on the
vb2: add support for (un)prepare_streaming queue ops
)
Eugen
Changes in v11:
- moved atmel isc to staging
- created platform/microchip to host the new MICROCHIP_ISC driver
- it was natural to move the MICROCHIP_CSI2DC here
- on top, add the patches that move to media controller
Full series history:
Changes in v10:
-> split the series into this first fixes part.
-> moved IO_MC addition from first patch to the second patch on the driver changes
-> edited commit messages
-> DT nodes now disabled by default.
Changes in v9:
-> kernel robot reported isc_link_validate is not static, changed to static.
Changes in v8:
-> scaler: modified crop bounds to have the exact source size
Changes in v7:
-> scaler: modified crop bounds to have maximum isc size
-> format propagation: did small changes as per Jacopo review
Changes in v6:
-> worked a bit on scaler, added try crop and other changes as per Jacopo review
-> worked on isc-base enum_fmt , reworked as per Jacopo review
Changes in v5:
-> removed patch that removed the 'stop' variable as it was still required
-> added two new trivial patches
-> reworked some parts of the scaler and format propagation after discussions with Jacopo
Changes in v4:
-> as reviewed by Hans, added new patch to remove the 'stop' variable and reworked
one patch that was using it
-> as reviewed by Jacopo, reworked some parts of the media controller implementation
Changes in v3:
- change in bindings, small fixes in csi2dc driver and conversion to mc
for the isc-base.
- removed some MAINTAINERS patches and used patterns in MAINTAINERS
Changes in v2:
- integrated many changes suggested by Jacopo in the review of the v1 series.
- add a few new patches
Eugen Hristev (6):
media: atmel: atmel-isc: move to staging
media: atmel: move microchip_csi2dc to dedicated microchip platform
media: microchip: re-add ISC driver as Microchip ISC
media: microchip: microchip-isc: prepare for media controller support
media: microchip: microchip-isc: implement media controller
media: microchip: microchip-isc: move media_pipeline_* to (un)prepare
cb
MAINTAINERS | 8 +-
drivers/media/platform/Kconfig | 1 +
drivers/media/platform/Makefile | 1 +
drivers/media/platform/atmel/Kconfig | 51 -
drivers/media/platform/atmel/Makefile | 7 -
drivers/media/platform/microchip/Kconfig | 61 +
drivers/media/platform/microchip/Makefile | 9 +
.../{atmel => microchip}/microchip-csi2dc.c | 0
.../platform/microchip/microchip-isc-base.c | 2040 +++++++++++++++++
.../microchip-isc-clk.c} | 4 +-
.../platform/microchip/microchip-isc-regs.h | 413 ++++
.../platform/microchip/microchip-isc-scaler.c | 267 +++
.../media/platform/microchip/microchip-isc.h | 400 ++++
.../microchip/microchip-sama5d2-isc.c | 683 ++++++
.../microchip/microchip-sama7g5-isc.c | 646 ++++++
drivers/staging/media/Kconfig | 2 +
drivers/staging/media/Makefile | 1 +
drivers/staging/media/atmel/Kconfig | 40 +
drivers/staging/media/atmel/Makefile | 8 +
.../media}/atmel/atmel-isc-base.c | 20 +-
drivers/staging/media/atmel/atmel-isc-clk.c | 311 +++
.../media}/atmel/atmel-isc-regs.h | 0
.../media}/atmel/atmel-isc.h | 16 +-
.../media}/atmel/atmel-sama5d2-isc.c | 18 +-
.../media}/atmel/atmel-sama7g5-isc.c | 18 +-
25 files changed, 4926 insertions(+), 99 deletions(-)
create mode 100644 drivers/media/platform/microchip/Kconfig
create mode 100644 drivers/media/platform/microchip/Makefile
rename drivers/media/platform/{atmel => microchip}/microchip-csi2dc.c (100%)
create mode 100644 drivers/media/platform/microchip/microchip-isc-base.c
rename drivers/media/platform/{atmel/atmel-isc-clk.c => microchip/microchip-isc-clk.c} (99%)
create mode 100644 drivers/media/platform/microchip/microchip-isc-regs.h
create mode 100644 drivers/media/platform/microchip/microchip-isc-scaler.c
create mode 100644 drivers/media/platform/microchip/microchip-isc.h
create mode 100644 drivers/media/platform/microchip/microchip-sama5d2-isc.c
create mode 100644 drivers/media/platform/microchip/microchip-sama7g5-isc.c
create mode 100644 drivers/staging/media/atmel/Kconfig
create mode 100644 drivers/staging/media/atmel/Makefile
rename drivers/{media/platform => staging/media}/atmel/atmel-isc-base.c (99%)
create mode 100644 drivers/staging/media/atmel/atmel-isc-clk.c
rename drivers/{media/platform => staging/media}/atmel/atmel-isc-regs.h (100%)
rename drivers/{media/platform => staging/media}/atmel/atmel-isc.h (96%)
rename drivers/{media/platform => staging/media}/atmel/atmel-sama5d2-isc.c (97%)
rename drivers/{media/platform => staging/media}/atmel/atmel-sama7g5-isc.c (97%)
--
2.25.1
Move the media_pipeline_start/stop calls from start/stop streaming to
the new prepare_streaming and unprepare_streaming callbacks.
Signed-off-by: Eugen Hristev <[email protected]>
---
.../platform/microchip/microchip-isc-base.c | 27 ++++++++++++-------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/drivers/media/platform/microchip/microchip-isc-base.c b/drivers/media/platform/microchip/microchip-isc-base.c
index 00651c313e9d..eed96e2a6a00 100644
--- a/drivers/media/platform/microchip/microchip-isc-base.c
+++ b/drivers/media/platform/microchip/microchip-isc-base.c
@@ -328,6 +328,13 @@ static int isc_configure(struct isc_device *isc)
return isc_update_profile(isc);
}
+static int isc_prepare_streaming(struct vb2_queue *vq)
+{
+ struct isc_device *isc = vb2_get_drv_priv(vq);
+
+ return media_pipeline_start(isc->video_dev.entity.pads, &isc->mpipe);
+}
+
static int isc_start_streaming(struct vb2_queue *vq, unsigned int count)
{
struct isc_device *isc = vb2_get_drv_priv(vq);
@@ -336,10 +343,6 @@ static int isc_start_streaming(struct vb2_queue *vq, unsigned int count)
unsigned long flags;
int ret;
- ret = media_pipeline_start(isc->video_dev.entity.pads, &isc->mpipe);
- if (ret)
- goto err_pipeline_start;
-
/* Enable stream on the sub device */
ret = v4l2_subdev_call(isc->current_subdev->sd, video, s_stream, 1);
if (ret && ret != -ENOIOCTLCMD) {
@@ -389,9 +392,6 @@ static int isc_start_streaming(struct vb2_queue *vq, unsigned int count)
v4l2_subdev_call(isc->current_subdev->sd, video, s_stream, 0);
err_start_stream:
- media_pipeline_stop(isc->video_dev.entity.pads);
-
-err_pipeline_start:
spin_lock_irqsave(&isc->dma_queue_lock, flags);
list_for_each_entry(buf, &isc->dma_queue, list)
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_QUEUED);
@@ -401,6 +401,14 @@ static int isc_start_streaming(struct vb2_queue *vq, unsigned int count)
return ret;
}
+static void isc_unprepare_streaming(struct vb2_queue *vq)
+{
+ struct isc_device *isc = vb2_get_drv_priv(vq);
+
+ /* Stop media pipeline */
+ media_pipeline_stop(isc->video_dev.entity.pads);
+}
+
static void isc_stop_streaming(struct vb2_queue *vq)
{
struct isc_device *isc = vb2_get_drv_priv(vq);
@@ -430,9 +438,6 @@ static void isc_stop_streaming(struct vb2_queue *vq)
if (ret && ret != -ENOIOCTLCMD)
v4l2_err(&isc->v4l2_dev, "stream off failed in subdev\n");
- /* Stop media pipeline */
- media_pipeline_stop(isc->video_dev.entity.pads);
-
/* Release all active buffers */
spin_lock_irqsave(&isc->dma_queue_lock, flags);
if (unlikely(isc->cur_frm)) {
@@ -472,6 +477,8 @@ static const struct vb2_ops isc_vb2_ops = {
.start_streaming = isc_start_streaming,
.stop_streaming = isc_stop_streaming,
.buf_queue = isc_buffer_queue,
+ .prepare_streaming = isc_prepare_streaming,
+ .unprepare_streaming = isc_unprepare_streaming,
};
static int isc_querycap(struct file *file, void *priv,
--
2.25.1
Hi Eugen,
I love your patch! Perhaps something to improve:
[auto build test WARNING on media-tree/master]
[also build test WARNING on sailus-media-tree/streams soc/for-next linus/master v6.1-rc3 next-20221102]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Eugen-Hristev/media-atmel-atmel-isc-driver-redesign/20221102-211809
base: git://linuxtv.org/media_tree.git master
patch link: https://lore.kernel.org/r/20221102131500.476024-7-eugen.hristev%40microchip.com
patch subject: [PATCH v11 6/6] media: microchip: microchip-isc: move media_pipeline_* to (un)prepare cb
config: sparc-allyesconfig
compiler: sparc64-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/1a1878d4c57910ecb143eaf6056fbbac80c29027
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Eugen-Hristev/media-atmel-atmel-isc-driver-redesign/20221102-211809
git checkout 1a1878d4c57910ecb143eaf6056fbbac80c29027
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sparc SHELL=/bin/bash drivers/media/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
All warnings (new ones prefixed by >>):
drivers/media/platform/microchip/microchip-isc-base.c:480:10: error: 'const struct vb2_ops' has no member named 'prepare_streaming'; did you mean 'start_streaming'?
480 | .prepare_streaming = isc_prepare_streaming,
| ^~~~~~~~~~~~~~~~~
| start_streaming
drivers/media/platform/microchip/microchip-isc-base.c:480:35: error: initialization of 'void (*)(struct vb2_buffer *)' from incompatible pointer type 'int (*)(struct vb2_queue *)' [-Werror=incompatible-pointer-types]
480 | .prepare_streaming = isc_prepare_streaming,
| ^~~~~~~~~~~~~~~~~~~~~
drivers/media/platform/microchip/microchip-isc-base.c:480:35: note: (near initialization for 'isc_vb2_ops.buf_request_complete')
drivers/media/platform/microchip/microchip-isc-base.c:481:10: error: 'const struct vb2_ops' has no member named 'unprepare_streaming'; did you mean 'start_streaming'?
481 | .unprepare_streaming = isc_unprepare_streaming,
| ^~~~~~~~~~~~~~~~~~~
| start_streaming
>> drivers/media/platform/microchip/microchip-isc-base.c:481:35: warning: excess elements in struct initializer
481 | .unprepare_streaming = isc_unprepare_streaming,
| ^~~~~~~~~~~~~~~~~~~~~~~
drivers/media/platform/microchip/microchip-isc-base.c:481:35: note: (near initialization for 'isc_vb2_ops')
cc1: some warnings being treated as errors
vim +481 drivers/media/platform/microchip/microchip-isc-base.c
471
472 static const struct vb2_ops isc_vb2_ops = {
473 .queue_setup = isc_queue_setup,
474 .wait_prepare = vb2_ops_wait_prepare,
475 .wait_finish = vb2_ops_wait_finish,
476 .buf_prepare = isc_buffer_prepare,
477 .start_streaming = isc_start_streaming,
478 .stop_streaming = isc_stop_streaming,
479 .buf_queue = isc_buffer_queue,
480 .prepare_streaming = isc_prepare_streaming,
> 481 .unprepare_streaming = isc_unprepare_streaming,
482 };
483
--
0-DAY CI Kernel Test Service
https://01.org/lkp
Hi Eugen,
I love your patch! Yet something to improve:
[auto build test ERROR on media-tree/master]
[also build test ERROR on sailus-media-tree/streams soc/for-next linus/master v6.1-rc3 next-20221102]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Eugen-Hristev/media-atmel-atmel-isc-driver-redesign/20221102-211809
base: git://linuxtv.org/media_tree.git master
patch link: https://lore.kernel.org/r/20221102131500.476024-7-eugen.hristev%40microchip.com
patch subject: [PATCH v11 6/6] media: microchip: microchip-isc: move media_pipeline_* to (un)prepare cb
config: s390-allyesconfig
compiler: s390-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/1a1878d4c57910ecb143eaf6056fbbac80c29027
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Eugen-Hristev/media-atmel-atmel-isc-driver-redesign/20221102-211809
git checkout 1a1878d4c57910ecb143eaf6056fbbac80c29027
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=s390 SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
All errors (new ones prefixed by >>):
drivers/media/platform/microchip/microchip-isc-base.c:480:10: error: 'const struct vb2_ops' has no member named 'prepare_streaming'; did you mean 'start_streaming'?
480 | .prepare_streaming = isc_prepare_streaming,
| ^~~~~~~~~~~~~~~~~
| start_streaming
>> drivers/media/platform/microchip/microchip-isc-base.c:480:35: error: positional initialization of field in 'struct' declared with 'designated_init' attribute [-Werror=designated-init]
480 | .prepare_streaming = isc_prepare_streaming,
| ^~~~~~~~~~~~~~~~~~~~~
drivers/media/platform/microchip/microchip-isc-base.c:480:35: note: (near initialization for 'isc_vb2_ops')
drivers/media/platform/microchip/microchip-isc-base.c:480:35: error: initialization of 'void (*)(struct vb2_queue *)' from incompatible pointer type 'int (*)(struct vb2_queue *)' [-Werror=incompatible-pointer-types]
drivers/media/platform/microchip/microchip-isc-base.c:480:35: note: (near initialization for 'isc_vb2_ops.wait_finish')
drivers/media/platform/microchip/microchip-isc-base.c:480:35: warning: initialized field overwritten [-Woverride-init]
drivers/media/platform/microchip/microchip-isc-base.c:480:35: note: (near initialization for 'isc_vb2_ops.wait_finish')
drivers/media/platform/microchip/microchip-isc-base.c:481:10: error: 'const struct vb2_ops' has no member named 'unprepare_streaming'; did you mean 'start_streaming'?
481 | .unprepare_streaming = isc_unprepare_streaming,
| ^~~~~~~~~~~~~~~~~~~
| start_streaming
drivers/media/platform/microchip/microchip-isc-base.c:481:35: error: positional initialization of field in 'struct' declared with 'designated_init' attribute [-Werror=designated-init]
481 | .unprepare_streaming = isc_unprepare_streaming,
| ^~~~~~~~~~~~~~~~~~~~~~~
drivers/media/platform/microchip/microchip-isc-base.c:481:35: note: (near initialization for 'isc_vb2_ops')
drivers/media/platform/microchip/microchip-isc-base.c:481:35: error: initialization of 'int (*)(struct vb2_buffer *)' from incompatible pointer type 'void (*)(struct vb2_queue *)' [-Werror=incompatible-pointer-types]
drivers/media/platform/microchip/microchip-isc-base.c:481:35: note: (near initialization for 'isc_vb2_ops.buf_init')
cc1: some warnings being treated as errors
vim +480 drivers/media/platform/microchip/microchip-isc-base.c
471
472 static const struct vb2_ops isc_vb2_ops = {
473 .queue_setup = isc_queue_setup,
474 .wait_prepare = vb2_ops_wait_prepare,
475 .wait_finish = vb2_ops_wait_finish,
476 .buf_prepare = isc_buffer_prepare,
477 .start_streaming = isc_start_streaming,
478 .stop_streaming = isc_stop_streaming,
479 .buf_queue = isc_buffer_queue,
> 480 .prepare_streaming = isc_prepare_streaming,
481 .unprepare_streaming = isc_unprepare_streaming,
482 };
483
--
0-DAY CI Kernel Test Service
https://01.org/lkp
Hi Eugen,
I love your patch! Yet something to improve:
[auto build test ERROR on media-tree/master]
[also build test ERROR on sailus-media-tree/streams soc/for-next linus/master v6.1-rc3 next-20221102]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Eugen-Hristev/media-atmel-atmel-isc-driver-redesign/20221102-211809
base: git://linuxtv.org/media_tree.git master
patch link: https://lore.kernel.org/r/20221102131500.476024-7-eugen.hristev%40microchip.com
patch subject: [PATCH v11 6/6] media: microchip: microchip-isc: move media_pipeline_* to (un)prepare cb
config: mips-allyesconfig
compiler: mips-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/1a1878d4c57910ecb143eaf6056fbbac80c29027
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Eugen-Hristev/media-atmel-atmel-isc-driver-redesign/20221102-211809
git checkout 1a1878d4c57910ecb143eaf6056fbbac80c29027
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
All errors (new ones prefixed by >>):
drivers/media/platform/microchip/microchip-isc-base.c:480:10: error: 'const struct vb2_ops' has no member named 'prepare_streaming'; did you mean 'start_streaming'?
480 | .prepare_streaming = isc_prepare_streaming,
| ^~~~~~~~~~~~~~~~~
| start_streaming
drivers/media/platform/microchip/microchip-isc-base.c:480:35: error: positional initialization of field in 'struct' declared with 'designated_init' attribute [-Werror=designated-init]
480 | .prepare_streaming = isc_prepare_streaming,
| ^~~~~~~~~~~~~~~~~~~~~
drivers/media/platform/microchip/microchip-isc-base.c:480:35: note: (near initialization for 'isc_vb2_ops')
drivers/media/platform/microchip/microchip-isc-base.c:480:35: error: initialization of 'int (*)(struct vb2_queue *, unsigned int *, unsigned int *, unsigned int *, struct device **)' from incompatible pointer type 'int (*)(struct vb2_queue *)' [-Werror=incompatible-pointer-types]
drivers/media/platform/microchip/microchip-isc-base.c:480:35: note: (near initialization for 'isc_vb2_ops.queue_setup')
drivers/media/platform/microchip/microchip-isc-base.c:480:35: warning: initialized field overwritten [-Woverride-init]
drivers/media/platform/microchip/microchip-isc-base.c:480:35: note: (near initialization for 'isc_vb2_ops.queue_setup')
drivers/media/platform/microchip/microchip-isc-base.c:481:10: error: 'const struct vb2_ops' has no member named 'unprepare_streaming'; did you mean 'start_streaming'?
481 | .unprepare_streaming = isc_unprepare_streaming,
| ^~~~~~~~~~~~~~~~~~~
| start_streaming
drivers/media/platform/microchip/microchip-isc-base.c:481:35: error: positional initialization of field in 'struct' declared with 'designated_init' attribute [-Werror=designated-init]
481 | .unprepare_streaming = isc_unprepare_streaming,
| ^~~~~~~~~~~~~~~~~~~~~~~
drivers/media/platform/microchip/microchip-isc-base.c:481:35: note: (near initialization for 'isc_vb2_ops')
>> drivers/media/platform/microchip/microchip-isc-base.c:481:35: error: initialization of 'int (*)(struct vb2_buffer *)' from incompatible pointer type 'void (*)(struct vb2_queue *)' [-Werror=incompatible-pointer-types]
drivers/media/platform/microchip/microchip-isc-base.c:481:35: note: (near initialization for 'isc_vb2_ops.buf_prepare')
drivers/media/platform/microchip/microchip-isc-base.c:481:35: warning: initialized field overwritten [-Woverride-init]
drivers/media/platform/microchip/microchip-isc-base.c:481:35: note: (near initialization for 'isc_vb2_ops.buf_prepare')
cc1: some warnings being treated as errors
vim +481 drivers/media/platform/microchip/microchip-isc-base.c
471
472 static const struct vb2_ops isc_vb2_ops = {
473 .queue_setup = isc_queue_setup,
474 .wait_prepare = vb2_ops_wait_prepare,
475 .wait_finish = vb2_ops_wait_finish,
476 .buf_prepare = isc_buffer_prepare,
477 .start_streaming = isc_start_streaming,
478 .stop_streaming = isc_stop_streaming,
479 .buf_queue = isc_buffer_queue,
480 .prepare_streaming = isc_prepare_streaming,
> 481 .unprepare_streaming = isc_unprepare_streaming,
482 };
483
--
0-DAY CI Kernel Test Service
https://01.org/lkp