linux-2.6-microblaze.git
3 years agomedia: camss: __video_try_fmt(): don't use hardcoded constants
Andrey Konovalov [Fri, 14 Aug 2020 20:54:03 +0000 (22:54 +0200)]
media: camss: __video_try_fmt(): don't use hardcoded constants

Use the definitions introduced by commit "media: camss: add support
for vidioc_enum_framesizes ioctl" instead of the hardcoded values.

Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: camss: add support for vidioc_enum_framesizes ioctl
Andrey Konovalov [Fri, 14 Aug 2020 20:54:02 +0000 (22:54 +0200)]
media: camss: add support for vidioc_enum_framesizes ioctl

VIDIOC_ENUM_FRAMESIZES support in the video capture driver is required by
libcamera. Without this change libcamera errors out with:
"ERROR V4L2 v4l2_videodevice.cpp:1059 /dev/video0[cap]: Unable to enumerate
frame sizes: Inappropriate ioctl for device"

Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: camss: Make use of V4L2_CAP_IO_MC
Andrey Konovalov [Fri, 14 Aug 2020 20:54:01 +0000 (22:54 +0200)]
media: camss: Make use of V4L2_CAP_IO_MC

Implement mbus_code filtering for format enumeration.

Without this patch libcamera errors out with:
"ERROR V4L2 v4l2_videodevice.cpp:982 /dev/video0[cap]: Media bus code
filtering not supported by the device"

Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: rcar-vin: Register media device when all sub-devices bound
Niklas Söderlund [Thu, 13 Aug 2020 21:06:02 +0000 (23:06 +0200)]
media: rcar-vin: Register media device when all sub-devices bound

The media device is not usable by userspace before all devices involved
in capture are present in the system. Move registering of the media
device to the async complete callback.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: rcar-vin: Unconditionally unregister notifier on remove
Niklas Söderlund [Thu, 13 Aug 2020 21:06:01 +0000 (23:06 +0200)]
media: rcar-vin: Unconditionally unregister notifier on remove

If the VIN device is part of a group of VIN devices (all Gen3 boards)
there is no reason to only unregister the group notifier if the VIN that
registers the notifier is removed. The VIN that registers the notifier
is always the last VIN device to be bound, so keeping the notifier
around after any VIN is unbound creates an unbalanced state where no VIN
in the group is operational.

Fix this by unconditionally unregistering the notifier when any VIN
device is unbound. Unregistering the notifier will lead to unbound()
being called and all video devices exposed by any VIN instance to be
removed.

The lock was only needed to protect the check which VIN registers the
notifier and is no longer needed.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: tw5864: check status of tw5864_frameinterval_get
Tom Rix [Mon, 10 Aug 2020 19:25:18 +0000 (21:25 +0200)]
media: tw5864: check status of tw5864_frameinterval_get

clang static analysis reports this problem

tw5864-video.c:773:32: warning: The left expression of the compound
  assignment is an uninitialized value.
  The computed value will also be garbage
        fintv->stepwise.max.numerator *= std_max_fps;
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^

stepwise.max is set with frameinterval, which comes from

ret = tw5864_frameinterval_get(input, &frameinterval);
fintv->stepwise.step = frameinterval;
fintv->stepwise.min = frameinterval;
fintv->stepwise.max = frameinterval;
fintv->stepwise.max.numerator *= std_max_fps;

When tw5864_frameinterval_get() fails, frameinterval is not
set. So check the status and fix another similar problem.

Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: MAINTAINERS: Remove broken bluecherry.net email
Ismael Luceno [Mon, 10 Aug 2020 19:17:55 +0000 (21:17 +0200)]
media: MAINTAINERS: Remove broken bluecherry.net email

Remove broken bluecherry.net email

Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: mc-device.c: change media_device_request_alloc to match media_ioctl_info
Frederic Chen [Thu, 6 Aug 2020 15:58:22 +0000 (17:58 +0200)]
media: mc-device.c: change media_device_request_alloc to match media_ioctl_info

We modified the type of media_device_request_alloc()'s second
parameter from int* to void* so that it can match the interface
defined in struct media_ioctl_info.

[hverkuil: move #ifdef before variable to avoid compile warning]

Signed-off-by: Frederic Chen <frederic.chen@mediatek.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: staging: tegra-vde: Mark tegra_vde_runtime_suspend/resume as __maybe_unused
YueHaibing [Tue, 4 Aug 2020 01:41:37 +0000 (03:41 +0200)]
media: staging: tegra-vde: Mark tegra_vde_runtime_suspend/resume as __maybe_unused

If CONFIG_PM is not set, gcc warns:

drivers/staging/media/tegra-vde/vde.c:916:12:
 warning: 'tegra_vde_runtime_suspend' defined but not used [-Wunused-function]

Make it __maybe_unused to fix this.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: ttusb-dec: convert tasklets to use new tasklet_setup() API
Allen Pais [Mon, 17 Aug 2020 08:31:53 +0000 (10:31 +0200)]
media: ttusb-dec: convert tasklets to use new tasklet_setup() API

In preparation for unconditionally passing the
struct tasklet_struct pointer to all tasklet
callbacks, switch to using the new tasklet_setup()
and from_tasklet() to pass the tasklet pointer explicitly.

Signed-off-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Allen Pais <allen.lkml@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: media/radio: wl128x: convert tasklets to use new tasklet_setup() API
Allen Pais [Mon, 17 Aug 2020 08:31:52 +0000 (10:31 +0200)]
media: media/radio: wl128x: convert tasklets to use new tasklet_setup() API

In preparation for unconditionally passing the
struct tasklet_struct pointer to all tasklet
callbacks, switch to using the new tasklet_setup()
and from_tasklet() to pass the tasklet pointer explicitly.

Signed-off-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Allen Pais <allen.lkml@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: sti: convert tasklets to use new tasklet_setup() API
Allen Pais [Mon, 17 Aug 2020 08:31:51 +0000 (10:31 +0200)]
media: sti: convert tasklets to use new tasklet_setup() API

In preparation for unconditionally passing the
struct tasklet_struct pointer to all tasklet
callbacks, switch to using the new tasklet_setup()
and from_tasklet() to pass the tasklet pointer explicitly.

Signed-off-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Allen Pais <allen.lkml@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: pxa_camera: convert tasklets to use new tasklet_setup() API
Allen Pais [Mon, 17 Aug 2020 08:31:50 +0000 (10:31 +0200)]
media: pxa_camera: convert tasklets to use new tasklet_setup() API

In preparation for unconditionally passing the
struct tasklet_struct pointer to all tasklet
callbacks, switch to using the new tasklet_setup()
and from_tasklet() to pass the tasklet pointer explicitly.

Signed-off-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Allen Pais <allen.lkml@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: marvell-ccic: convert tasklets to use new tasklet_setup() API
Allen Pais [Mon, 17 Aug 2020 08:31:49 +0000 (10:31 +0200)]
media: marvell-ccic: convert tasklets to use new tasklet_setup() API

In preparation for unconditionally passing the
struct tasklet_struct pointer to all tasklet
callbacks, switch to using the new tasklet_setup()
and from_tasklet() to pass the tasklet pointer explicitly.

Signed-off-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Allen Pais <allen.lkml@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: tw5864: convert tasklets to use new tasklet_setup() API
Allen Pais [Mon, 17 Aug 2020 08:31:48 +0000 (10:31 +0200)]
media: tw5864: convert tasklets to use new tasklet_setup() API

In preparation for unconditionally passing the
struct tasklet_struct pointer to all tasklet
callbacks, switch to using the new tasklet_setup()
and from_tasklet() to pass the tasklet pointer explicitly.

Signed-off-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Allen Pais <allen.lkml@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: ttpci: convert tasklets to use new tasklet_setup() API
Allen Pais [Mon, 17 Aug 2020 08:31:47 +0000 (10:31 +0200)]
media: ttpci: convert tasklets to use new tasklet_setup() API

In preparation for unconditionally passing the
struct tasklet_struct pointer to all tasklet
callbacks, switch to using the new tasklet_setup()
and from_tasklet() to pass the tasklet pointer explicitly.

Signed-off-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Allen Pais <allen.lkml@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: smipcie: convert tasklets to use new tasklet_setup() API
Allen Pais [Mon, 17 Aug 2020 08:31:46 +0000 (10:31 +0200)]
media: smipcie: convert tasklets to use new tasklet_setup() API

In preparation for unconditionally passing the
struct tasklet_struct pointer to all tasklet
callbacks, switch to using the new tasklet_setup()
and from_tasklet() to pass the tasklet pointer explicitly.

Signed-off-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Allen Pais <allen.lkml@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: ngene: convert tasklets to use new tasklet_setup() API
Allen Pais [Mon, 17 Aug 2020 08:31:45 +0000 (10:31 +0200)]
media: ngene: convert tasklets to use new tasklet_setup() API

In preparation for unconditionally passing the
struct tasklet_struct pointer to all tasklet
callbacks, switch to using the new tasklet_setup()
and from_tasklet() to pass the tasklet pointer explicitly.

Signed-off-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Allen Pais <allen.lkml@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: mantis: convert tasklets to use new tasklet_setup() API
Allen Pais [Mon, 17 Aug 2020 08:31:44 +0000 (10:31 +0200)]
media: mantis: convert tasklets to use new tasklet_setup() API

In preparation for unconditionally passing the
struct tasklet_struct pointer to all tasklet
callbacks, switch to using the new tasklet_setup()
and from_tasklet() to pass the tasklet pointer explicitly.

Signed-off-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Allen Pais <allen.lkml@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: bt8xx: convert tasklets to use new tasklet_setup() API
Allen Pais [Mon, 17 Aug 2020 08:31:43 +0000 (10:31 +0200)]
media: bt8xx: convert tasklets to use new tasklet_setup() API

In preparation for unconditionally passing the
struct tasklet_struct pointer to all tasklet
callbacks, switch to using the new tasklet_setup()
and from_tasklet() to pass the tasklet pointer explicitly.

Signed-off-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Allen Pais <allen.lkml@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: marvell-ccic: add support for runtime PM
Lubomir Rintel [Mon, 17 Aug 2020 22:08:50 +0000 (00:08 +0200)]
media: marvell-ccic: add support for runtime PM

On MMP3, the camera block lives on a separate power island. We want to
turn it off if the CCIC is not in use to conserve power.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: marvell-ccic: mmp: use generic dev_pm_ops
Lubomir Rintel [Mon, 17 Aug 2020 22:08:49 +0000 (00:08 +0200)]
media: marvell-ccic: mmp: use generic dev_pm_ops

This simplifies things a bit and makes adding runtime PM a bit more
straightforward.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: marvell-ccic: mmp: get rid of mmpcam_devices list
Lubomir Rintel [Mon, 17 Aug 2020 22:08:48 +0000 (00:08 +0200)]
media: marvell-ccic: mmp: get rid of mmpcam_devices list

The sole reason for this was so that it would be possible to get a
mmp_camera from a platform_device in suspend/resume/remove hooks, because
drvdata used to be used by the v4l core.

Since commit 95db3a60e065 ("[media] v4l: Add a media_device pointer to the
v4l2_device structure") it is no longer case and thus we can make things
a great deal simpler.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: cafe-driver: use drvdata instead of back-casting from v4l2_device
Lubomir Rintel [Mon, 17 Aug 2020 22:08:47 +0000 (00:08 +0200)]
media: cafe-driver: use drvdata instead of back-casting from v4l2_device

Since commit 95db3a60e065 ("[media] v4l: Add a media_device pointer
to the v4l2_device structure") the v4l core doesn't insist on using drvdata
itself.  Therefore we can use it ourselves, making things somewhat simpler.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: fsl-viu: Do not redefine out_be32()/in_be32() for CONFIG_M68K
Fabio Estevam [Mon, 17 Aug 2020 20:23:56 +0000 (22:23 +0200)]
media: fsl-viu: Do not redefine out_be32()/in_be32() for CONFIG_M68K

The following W=1 build warning is seen on a m68k:

drivers/media/platform/fsl-viu.c: At top level:
drivers/media/platform/fsl-viu.c:36: warning: "out_be32" redefined
   36 | #define out_be32(v, a) iowrite32be(a, (void __iomem *)v)
      |
In file included from ./arch/m68k/include/asm/io_mm.h:25,
                 from ./arch/m68k/include/asm/io.h:8,
                 from ./include/linux/io.h:13,
                 from ./include/linux/irq.h:20,
                 from ./include/asm-generic/hardirq.h:13,
                 from ./arch/m68k/include/generated/asm/hardirq.h:1,
                 from ./include/linux/hardirq.h:9,
                 from ./include/linux/interrupt.h:11,
                 from drivers/media/platform/fsl-viu.c:17:
./arch/m68k/include/asm/raw_io.h:32: note: this is the location of the previous definition
   32 | #define out_be32(addr,l) (void)((*(__force volatile u32 *) (addr)) = (l))

Avoid the out_be32() and in_be32() redefinitions when building for CONFIG_M68K
in the same way we currently do for CONFIG_PPC and CONFIG_MICROBLAZE.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: mtk-vcodec: vdec_vp9_if.c: fix comparison to bool
Daniel W. S. Almeida [Fri, 7 Aug 2020 08:35:47 +0000 (10:35 +0200)]
media: mtk-vcodec: vdec_vp9_if.c: fix comparison to bool

Fix the following coccinelle report:

drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c:963:6-31:
WARNING: Comparison to bool

Found using - Coccinelle (http://coccinelle.lip6.fr)

Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: pci: cobalt-i2c.c: fix comparison of 0/1 to bool variable
Daniel W. S. Almeida [Fri, 7 Aug 2020 08:35:45 +0000 (10:35 +0200)]
media: pci: cobalt-i2c.c: fix comparison of 0/1 to bool variable

Fix the following coccinelle reports:

drivers/media/pci/cobalt/cobalt-i2c.c:176:16-21: WARNING:
Comparison of 0/1 to bool variable
drivers/media/pci/cobalt/cobalt-i2c.c:180:29-33: WARNING:
Comparison of 0/1 to bool variable
drivers/media/pci/cobalt/cobalt-i2c.c:121:16-21: WARNING:
Comparison of 0/1 to bool variable
drivers/media/pci/cobalt/cobalt-i2c.c:125:29-33: WARNING:
Comparison of 0/1 to bool variable

Found using - Coccinelle (http://coccinelle.lip6.fr)

Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: i2c: tda1997x.c: Fix assignment of 0/1 to bool variable
Daniel W. S. Almeida [Fri, 7 Aug 2020 08:35:44 +0000 (10:35 +0200)]
media: i2c: tda1997x.c: Fix assignment of 0/1 to bool variable

Fix the following coccinelle reports:

drivers/media/i2c/tda1997x.c:911:6-21:
WARNING: Assignment of 0/1 to bool variable

drivers/media/i2c/tda1997x.c:939:2-17:
WARNING: Assignment of 0/1 to bool variable

drivers/media/i2c/tda1997x.c:947:4-19:
WARNING: Assignment of 0/1 to bool variable

Replace assignment to 1 with true and assignment to 0 with false.

Found using - Coccinelle (http://coccinelle.lip6.fr)

Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: i2c: imx219.c: fix assignment of 0/1 to bool variable
Daniel W. S. Almeida [Fri, 7 Aug 2020 08:35:43 +0000 (10:35 +0200)]
media: i2c: imx219.c: fix assignment of 0/1 to bool variable

Fix the following coccinelle report:

drivers/media/i2c/imx219.c:1191:1-18:
WARNING: Assignment of 0/1 to bool variable

Replace the assignment to 0 with false instead.

Found using - Coccinelle (http://coccinelle.lip6.fr)

Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: pci: cx23855-video.c: remove duplicate argument in 'or'
Daniel W. S. Almeida [Fri, 7 Aug 2020 08:35:42 +0000 (10:35 +0200)]
media: pci: cx23855-video.c: remove duplicate argument in 'or'

Fix the following coccinelle report:

drivers/media/pci/cx23885/cx23885-video.c:639:24-44:
duplicated argument to & or |

V4L2_CAP_VBI_CAPTURE appears twice, remove it.

Found using - Coccinelle (http://coccinelle.lip6.fr)

Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: dvb-frontends: mb86a16.c: remove useless if/else
Daniel W. S. Almeida [Fri, 7 Aug 2020 08:35:40 +0000 (10:35 +0200)]
media: dvb-frontends: mb86a16.c: remove useless if/else

Fix the following coccinelle report:

drivers/media/dvb-frontends/mb86a16.c:1455:6-8:
WARNING: possible condition with no effect (if == else)

Both branches are the same, so remove the if/else altogether.

Found using - Coccinelle (http://coccinelle.lip6.fr)

Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: usb: dib0700_devices.c: remove useless if/else
Daniel W. S. Almeida [Fri, 7 Aug 2020 08:35:39 +0000 (10:35 +0200)]
media: usb: dib0700_devices.c: remove useless if/else

Fix the following coccinelle report:

drivers/media/usb/dvb-usb/dib0700_devices.c:1741:1-3:
WARNING: possible condition with no effect (if == else)

Both branches are the same, so remove the if/else altogether.

Found using - Coccinelle (http://coccinelle.lip6.fr)

[hverkuil: fix checkpatch warnings]

Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: pci: saa7164-core.c: replace if (cond) BUG() with BUG_ON()
Daniel W. S. Almeida [Fri, 7 Aug 2020 08:35:38 +0000 (10:35 +0200)]
media: pci: saa7164-core.c: replace if (cond) BUG() with BUG_ON()

Fix the following coccinelle reports:

drivers/media/pci/saa7164/saa7164-core.c:579:2-5:
WARNING: Use BUG_ON instead of if condition followed by BUG.

drivers/media/pci/saa7164/saa7164-core.c:592:3-6:
WARNING: Use BUG_ON instead of if condition followed by BUG.

drivers/media/pci/saa7164/saa7164-core.c:898:2-5:
WARNING: Use BUG_ON instead of if condition followed by BUG.

Found using - Coccinelle (http://coccinelle.lip6.fr)

Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: pci: saa7164-vbi.c: replace if (cond) BUG() with BUG_ON()
Daniel W. S. Almeida [Fri, 7 Aug 2020 08:35:37 +0000 (10:35 +0200)]
media: pci: saa7164-vbi.c: replace if (cond) BUG() with BUG_ON()

Fix the following coccinelle reports:

drivers/media/pci/saa7164/saa7164-vbi.c:707:2-5:
WARNING: Use BUG_ON instead of if condition followed by BUG.

drivers/media/pci/saa7164/saa7164-vbi.c:760:2-5:
WARNING: Use BUG_ON instead of if condition followed by BUG.

Found using - Coccinelle (http://coccinelle.lip6.fr)

Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: pci: saa7164-dvb.c: replace if(cond) BUG() with BUG_ON()
Daniel W. S. Almeida [Fri, 7 Aug 2020 08:35:36 +0000 (10:35 +0200)]
media: pci: saa7164-dvb.c: replace if(cond) BUG() with BUG_ON()

Fix the following coccinelle reports:

drivers/media/pci/saa7164/saa7164-dvb.c:341:2-5:
WARNING: Use BUG_ON instead of if condition followed by BUG

drivers/media/pci/saa7164/saa7164-dvb.c:483:2-5:
WARNING: Use BUG_ON instead of if condition followed by BUG.

Found using - Coccinelle (http://coccinelle.lip6.fr)

Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: pci: saa7164.c: Replace if(cond) BUG with BUG_ON
Daniel W. S. Almeida [Fri, 7 Aug 2020 08:35:35 +0000 (10:35 +0200)]
media: pci: saa7164.c: Replace if(cond) BUG with BUG_ON

Fix the following coccinelle reports:

drivers/media/pci/saa7164/saa7164-buffer.c:254:3-6: WARNING: Use BUG_ON
instead of if condition followed by BUG.

drivers/media/pci/saa7164/saa7164-buffer.c:261:3-6: WARNING: Use BUG_ON
instead of if condition followed by BUG.

Found using - Coccinelle (http://coccinelle.lip6.fr)

Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: vicodec: vicodec-core.c: fix assignment of 0/1 to bool variable
Daniel W. S. Almeida [Fri, 7 Aug 2020 08:35:34 +0000 (10:35 +0200)]
media: vicodec: vicodec-core.c: fix assignment of 0/1 to bool variable

Fix the following coccinelle reports:

drivers/media/test-drivers/vicodec/vicodec-core.c:1674:2-21:
WARNING: Assignment of 0/1 to bool variable

drivers/media/test-drivers/vicodec/vicodec-core.c:1675:2-26:
WARNING: Assignment of 0/1 to bool variable

By replacing the assignment to 0 with 'false' instead.

Found using - Coccinelle (http://coccinelle.lip6.fr)

Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: mtk-vcodec: mtk_vcodec_dec.c: fix comparison to bool
Daniel W. S. Almeida [Fri, 7 Aug 2020 08:35:33 +0000 (10:35 +0200)]
media: mtk-vcodec: mtk_vcodec_dec.c: fix comparison to bool

Fix the following coccinelle reports:

drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c:197:14-35:
WARNING: Comparison to bool

drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c:198:7-29:
WARNING: Comparison to bool

drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c:451:12-19:
WARNING: Comparison to bool

drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c:1159:6-15:
WARNING: Comparison to bool

By replacing (cond == true) with (cond) and (cond == false) with
(!cond)

Found using - Coccinelle (http://coccinelle.lip6.fr)

Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: cobalt: cobalt-omnitek.c: fix comparison to bool
Daniel W. S. Almeida [Fri, 7 Aug 2020 08:35:32 +0000 (10:35 +0200)]
media: cobalt: cobalt-omnitek.c: fix comparison to bool

Fix the following coccinelle report:

drivers/media/pci/cobalt/cobalt-omnitek.c:119:5-19:
WARNING: Comparison to bool

By using "!cond" instead of "cond == false"

Found using - Coccinelle (http://coccinelle.lip6.fr)

Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: sunxi: sun8i-rotate.c: remove useless error message
Daniel W. S. Almeida [Fri, 7 Aug 2020 08:35:28 +0000 (10:35 +0200)]
media: sunxi: sun8i-rotate.c: remove useless error message

This fixes the following coccinelle report:

drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c:751:2-9:
line 751 is redundant because platform_get_irq() already prints an error

By removing the useless call to dev_err()

Found using - Coccinelle (http://coccinelle.lip6.fr)

Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: platform: Add jpeg enc feature
Xia Jiang [Fri, 14 Aug 2020 07:12:02 +0000 (09:12 +0200)]
media: platform: Add jpeg enc feature

Add mtk jpeg encode v4l2 driver based on jpeg decode, because that jpeg
decode and encode have great similarities with function operation.

Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Xia Jiang <xia.jiang@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: platform: Using the variant structure to contain the varability between dec...
Xia Jiang [Fri, 14 Aug 2020 07:12:01 +0000 (09:12 +0200)]
media: platform: Using the variant structure to contain the varability between dec and enc

Add varability which would be used between jpeg dec and enc to a match
data structure, it will make the code linear.

Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Xia Jiang <xia.jiang@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: platform: Rename existing functions/defines/variables
Xia Jiang [Fri, 14 Aug 2020 07:12:00 +0000 (09:12 +0200)]
media: platform: Rename existing functions/defines/variables

Rename existing functions/defines/variables with a  _dec prefix and
without dec_ prefix to prepare for the addition of the jpeg encoder
feature.

Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Xia Jiang <xia.jiang@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: platform: Rename jpeg dec file name
Xia Jiang [Fri, 14 Aug 2020 07:11:59 +0000 (09:11 +0200)]
media: platform: Rename jpeg dec file name

Rename the files which are for decode feature. This is preparing
path since the jpeg enc patch will be added later.

Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Xia Jiang <xia.jiang@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: dt-bindings: Add jpeg enc device tree node document
Xia Jiang [Fri, 14 Aug 2020 07:11:57 +0000 (09:11 +0200)]
media: dt-bindings: Add jpeg enc device tree node document

Add jpeg enc device tree node document.

Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Xia Jiang <xia.jiang@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: platform: Change the call functions of getting/enable/disable the jpeg's clock
Xia Jiang [Fri, 14 Aug 2020 07:11:56 +0000 (09:11 +0200)]
media: platform: Change the call functions of getting/enable/disable the jpeg's clock

Use the generic clk_bulk_* helpers to enable and disable clocks.

Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Xia Jiang <xia.jiang@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: platform: Refactor mtk_jpeg_set_default_params()
Xia Jiang [Fri, 14 Aug 2020 07:11:55 +0000 (09:11 +0200)]
media: platform: Refactor mtk_jpeg_set_default_params()

Call mtk_jpeg_try_fmt_mplane() to replace the original computation of
sizeimage and bytesperline, because that mtk_jpeg_try_fmt_mplane()
already did it.

Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Xia Jiang <xia.jiang@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: platform: Change the colorspace of jpeg to the fixed value
Xia Jiang [Fri, 14 Aug 2020 07:11:54 +0000 (09:11 +0200)]
media: platform: Change the colorspace of jpeg to the fixed value

Jpeg doesn't support colorspace conversion, so it shouldn't accept any
other colorspace in S_FMT.
Change the colorspace of jpeg to the fixed value.

Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Xia Jiang <xia.jiang@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: platform: Redefinition of mtk_jpeg_q_data structure
Xia Jiang [Fri, 14 Aug 2020 07:11:53 +0000 (09:11 +0200)]
media: platform: Redefinition of mtk_jpeg_q_data structure

The standard v4l2_pix_format_mplane structure contains width/height/
sizeimage/bytesperline, so use v4l2_pix_format_mplane to replace them.

Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Xia Jiang <xia.jiang@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: platform: Refactor mtk_jpeg_find_format()
Xia Jiang [Fri, 14 Aug 2020 07:11:52 +0000 (09:11 +0200)]
media: platform: Refactor mtk_jpeg_find_format()

Delete the unused ctx parameter.
Using mtk_jpeg_formats and num_formats parameters is more generic,
because that jpeg enc will also use it.
Delete the macro definition of MTK_JPEG_FMT_TYPE_OUTPUT and
MTK_JPEG_FMT_TYPE_CAPTURE, because that MTK_JPEG_FMT_FLAG_DEC_OUTPUT
and MTK_JPEG_FMT_FLAG_DEC_CAPTURE are enough.

Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Xia Jiang <xia.jiang@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: platform: Refactor mtk_jpeg_try_fmt_mplane()
Xia Jiang [Fri, 14 Aug 2020 07:11:51 +0000 (09:11 +0200)]
media: platform: Refactor mtk_jpeg_try_fmt_mplane()

The function of mtk_jpeg_adjust_fmt_mplane() equals
mtk_jpeg_g_fmt_vid_mplane(), so use mtk_jpeg_g_fmt_vid_mplane() to
replace it .
Delete the unused ctx parameter.
Using fourcc to distinguish between different formats is more generic,
because that jpeg enc will also use it.

Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Xia Jiang <xia.jiang@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: platform: Change the maximum width and height supported by JPEG dec
Xia Jiang [Fri, 14 Aug 2020 07:11:50 +0000 (09:11 +0200)]
media: platform: Change the maximum width and height supported by JPEG dec

The maximum width and height supported by JPEG dec is 65535, so change
them from 8192 to 65535.

Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Xia Jiang <xia.jiang@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: platform: Delete vidioc_s_selection ioctl of jpeg dec
Xia Jiang [Fri, 14 Aug 2020 07:11:49 +0000 (09:11 +0200)]
media: platform: Delete vidioc_s_selection ioctl of jpeg dec

JPEG dec does't support setting a compose rectangle, so remove
mtk_jpeg_dec_s_selection().

Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Xia Jiang <xia.jiang@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: platform: Delete redundant code and add annotation for an enum
Xia Jiang [Fri, 14 Aug 2020 07:11:48 +0000 (09:11 +0200)]
media: platform: Delete redundant code and add annotation for an enum

Delete unused member variables annotation.
Delete unused variable definition.
Delete redundant log print, because V4L2 debug logs already print it.
Add annotation for enum mtk_jpeg_ctx_state.

Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Xia Jiang <xia.jiang@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: platform: Change MTK_JPEG_COMP_MAX macro definition location
Xia Jiang [Fri, 14 Aug 2020 07:11:47 +0000 (09:11 +0200)]
media: platform: Change MTK_JPEG_COMP_MAX macro definition location

Move MTK_JPEG_COMP_MAX definition to mtk_jpeg_core.h file, because it
is used by mtk_jpeg_core.c file.

Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Xia Jiang <xia.jiang@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: platform: Use generic rounding helpers
Xia Jiang [Fri, 14 Aug 2020 07:11:46 +0000 (09:11 +0200)]
media: platform: Use generic rounding helpers

Use clamp() to replace mtk_jpeg_bound_align_image() and round() to
replace mtk_jpeg_align().

Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Xia Jiang <xia.jiang@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: platform: Stylistic changes for improving code quality
Xia Jiang [Fri, 14 Aug 2020 07:11:45 +0000 (09:11 +0200)]
media: platform: Stylistic changes for improving code quality

Change register offset hex numerals from uppercase to lowercase.
Change data type of max/min width/height from integer to unsigned
integer.

Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Xia Jiang <xia.jiang@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: platform: Delete zeroing the reserved fields
Xia Jiang [Fri, 14 Aug 2020 07:11:44 +0000 (09:11 +0200)]
media: platform: Delete zeroing the reserved fields

Delete zeroing the reserved fields because that the core already
does it.

Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Xia Jiang <xia.jiang@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: platform: Cancel the last frame handling flow
Xia Jiang [Fri, 14 Aug 2020 07:11:43 +0000 (09:11 +0200)]
media: platform: Cancel the last frame handling flow

There is no need to queue an empty buffer for signaling a last frame,
because all frames are separate from each other in JPEG.

Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Xia Jiang <xia.jiang@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: platform: Add mechanism to handle jpeg hardware's locking up
Xia Jiang [Fri, 14 Aug 2020 07:11:42 +0000 (09:11 +0200)]
media: platform: Add mechanism to handle jpeg hardware's locking up

There is a delayed work scheduled before starting the hardware and
canceled in the interrupt handler. If the delayed work is executed, it
resets the hardware and reports the failure to V4L2, so that the
execution can continue from next frames.

Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Xia Jiang <xia.jiang@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: platform: Improve the implementation of the system PM ops
Xia Jiang [Fri, 14 Aug 2020 07:11:41 +0000 (09:11 +0200)]
media: platform: Improve the implementation of the system PM ops

Add v4l2_m2m_suspend() function call in mtk_jpeg_suspend() to make sure
that the current frame is processed completely before suspend.
Add v4l2_m2m_resume() function call in mtk_jpeg_resume() to unblock the
driver from scheduling next frame.

Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Xia Jiang <xia.jiang@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: v4l2-mem2mem: add v4l2_m2m_suspend, v4l2_m2m_resume
Pi-Hsun Shih [Fri, 14 Aug 2020 07:11:40 +0000 (09:11 +0200)]
media: v4l2-mem2mem: add v4l2_m2m_suspend, v4l2_m2m_resume

Add two functions that can be used to stop new jobs from being queued /
continue running queued job. This can be used while a driver using m2m
helper is going to suspend / wake up from resume, and can ensure that
there's no job running in suspend process.

Signed-off-by: Pi-Hsun Shih <pihsun@chromium.org>
Signed-off-by: Jerry-ch Chen <jerry-ch.chen@mediatek.corp-partner.google.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: platform: Delete the resetting hardware flow in the system PM ops
Xia Jiang [Fri, 14 Aug 2020 07:11:39 +0000 (09:11 +0200)]
media: platform: Delete the resetting hardware flow in the system PM ops

Delete the resetting hardware flow in suspend and resume function
because that resetting operation will be done in device_run().

Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Xia Jiang <xia.jiang@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: platform: Improve power on and power off flow
Xia Jiang [Fri, 14 Aug 2020 07:11:38 +0000 (09:11 +0200)]
media: platform: Improve power on and power off flow

Call pm_runtime_get_sync() before starting a frame and then
pm_runtime_put() after completing it. This can save power for the time
between processing two frames.

Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Xia Jiang <xia.jiang@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: platform: Change the fixed device node number to unfixed value
Xia Jiang [Fri, 14 Aug 2020 07:11:37 +0000 (09:11 +0200)]
media: platform: Change the fixed device node number to unfixed value

The driver can be instantiated multiple times, e.g. for a decoder and
an encoder. Moreover, other drivers could coexist on the same system.
This makes the static video node number assignment pointless, so switch
to automatic assignment instead.

Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Xia Jiang <xia.jiang@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: platform: Improve getting and requesting irq flow for bug fixing
Xia Jiang [Fri, 14 Aug 2020 07:11:36 +0000 (09:11 +0200)]
media: platform: Improve getting and requesting irq flow for bug fixing

Delete platform_get_resource operation for irq.
Return actual value rather than EINVAL when fail to get and request
irq.

Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Xia Jiang <xia.jiang@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: platform: Improve queue set up flow for bug fixing
Xia Jiang [Fri, 14 Aug 2020 07:11:35 +0000 (09:11 +0200)]
media: platform: Improve queue set up flow for bug fixing

Add checking created buffer size follow in mtk_jpeg_queue_setup().

Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Xia Jiang <xia.jiang@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: platform: Improve subscribe event flow for bug fixing
Xia Jiang [Fri, 14 Aug 2020 07:11:34 +0000 (09:11 +0200)]
media: platform: Improve subscribe event flow for bug fixing

Let v4l2_ctrl_subscribe_event() do the job for other types except
V4L2_EVENT_SOURCE_CHANGE.

Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Xia Jiang <xia.jiang@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: tegra-video: Compute settle times based on the clock rate
Sowjanya Komatineni [Wed, 12 Aug 2020 00:27:21 +0000 (02:27 +0200)]
media: tegra-video: Compute settle times based on the clock rate

Settle time determines the number of cil clock cyles to wait after
LP00 when moving from LP to HS.

This patch computes T-CLK-SETTLE and T-HS-SETTLE times based on cil
clock rate and pixel rate from the sensor and programs them during
streaming.

T-CLK-SETTLE time is the interval during which receiver will ignore
any HS transitions on clock lane starting from the beginning of
T-CLK-PREPARE.

T-HS-SETTLE time is the interval during which recevier will ignore
any HS transitions on data lane starting from the beginning of
T-HS-PREPARE.

Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: tegra-video: Add CSI MIPI pads calibration
Sowjanya Komatineni [Wed, 12 Aug 2020 00:27:20 +0000 (02:27 +0200)]
media: tegra-video: Add CSI MIPI pads calibration

CSI MIPI pads need to be enabled and calibrated for capturing from
the external sensor or transmitter.

MIPI CAL unit calibrates MIPI pads pull-up, pull-down and termination
impedances. Calibration is done by co-work of MIPI BIAS pad and MIPI
CAL control unit.

Triggering calibration start can happen any time after MIPI pads are
enabled but calibration results will be latched and applied to MIPI
pads by MIPI CAL unit only when the link is in LP11 state and then
calibration status register gets updated.

This patch enables CSI MIPI pads and calibrates them during streaming.

Tegra CSI receiver is able to catch the very first clock transition.
So, CSI receiver is always enabled prior to sensor streaming and
trigger of calibration start is done during CSI subdev streaming and
status of calibration is verified after sensor stream on.

Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: gpu: host1x: mipi: Keep MIPI clock enabled and mutex locked till calibration...
Sowjanya Komatineni [Wed, 12 Aug 2020 00:27:19 +0000 (02:27 +0200)]
media: gpu: host1x: mipi: Keep MIPI clock enabled and mutex locked till calibration done

With the split of MIPI calibration into tegra_mipi_calibrate() and
tegra_mipi_wait(), MIPI clock is not kept enabled and mutex is not locked
till the calibration is done.

So, this patch keeps MIPI clock enabled and mutex locked after triggering
start of calibration till its done.

To let calibration process go through its finite sequence codes before
calibration logic waiting for pads idle state added wait time of 75usec
to make sure it sees idle state to apply the results.

This patch renames tegra_mipi_calibrate() as tegra_mipi_start_calibration()
and tegra_mipi_wait() as tegra_mipi_finish_calibration() to be inline
with their usage.

Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: tegra-video: Add support for selection ioctl ops
Sowjanya Komatineni [Wed, 12 Aug 2020 00:27:18 +0000 (02:27 +0200)]
media: tegra-video: Add support for selection ioctl ops

This patch adds selection v4l2 ioctl operations to allow configuring
a selection rectangle in the sensor through the Tegra video device
node.

Some sensor drivers supporting crop uses try_crop rectangle from
v4l2_subdev_pad_config during try format for computing binning.

So with selection ops support, this patch also updates try format
to use try crop rectangle either from subdev frame size enumeration
or from subdev crop boundary.

Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: tegra-video: Add support for external sensor capture
Sowjanya Komatineni [Wed, 12 Aug 2020 00:27:17 +0000 (02:27 +0200)]
media: tegra-video: Add support for external sensor capture

This patch adds support to capture from the external sensor
based on device graph in the device tree.

Driver walks through the device graph to create media links
between the entities and registers and unregisters video devices
when the corresponding sub-devices are bound and unbound.

Channel formats are enumerated based on available formats from
the sensor and the corresponding matched formats from the Tegra
supported video formats list.

Each Tegra CSI instance can be configured as 4-lane or 2-lane
based on supported lane configuration from the sensor through
the device tree.

Currently this driver supports V4L2 video node centric only.

[hverkuil: changed video_unregister_device to vb2_video_unregister_device]

Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: tegra-video: Separate CSI stream enable and disable implementations
Sowjanya Komatineni [Wed, 12 Aug 2020 00:27:16 +0000 (02:27 +0200)]
media: tegra-video: Separate CSI stream enable and disable implementations

This patch separates implementation of CSI stream enable and disable
into separate functions for readability.

Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: dt-bindings: tegra: Update VI and CSI bindings with port info
Sowjanya Komatineni [Wed, 12 Aug 2020 00:27:15 +0000 (02:27 +0200)]
media: dt-bindings: tegra: Update VI and CSI bindings with port info

Update VI and CSI bindings to add port and endpoint nodes as per
media video-interfaces DT binding document.

Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: tegra-video: Update format lookup to offset based
Sowjanya Komatineni [Wed, 12 Aug 2020 00:27:14 +0000 (02:27 +0200)]
media: tegra-video: Update format lookup to offset based

Tegra VI supported video formats are more for non TPG and there
can be multiple pixel formats for the same media bus format.

This patch updates the helper function for format lookup based on
mbus code from pre-defined Tegra supported format list to look from
the specified list index offset.

Offset based look up is used with sensor device graph (non TPG)
where format enumeration can list all supported formats for the
specific sensor mbus codes.

Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: tegra-video: Enable TPG based on kernel config
Sowjanya Komatineni [Wed, 12 Aug 2020 00:27:13 +0000 (02:27 +0200)]
media: tegra-video: Enable TPG based on kernel config

Tegra internal TPG mode is only for Tegra vi and csi testing
without a real sensor and driver should default support real
sensor.

So, This patch adds CONFIG_VIDEO_TEGRA_TPG and enables Tegra
internal TPG mode only when this config is selected.

Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: tegra-video: Fix channel format alignment
Sowjanya Komatineni [Wed, 12 Aug 2020 00:27:12 +0000 (02:27 +0200)]
media: tegra-video: Fix channel format alignment

Pixel format width is mistakenly aligned to surface align bytes
and altering width to aligned value may force sensor mode change
other than the requested one and also cause mismatch in width
programmed between sensor and vi which can lead to capture errors.

This patch removes width alignment and clamps width as per Tegra
minimum and maximum limits.

Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: staging/media: drop vb2_queue_release()
Hans Verkuil [Mon, 13 Jul 2020 11:30:48 +0000 (13:30 +0200)]
media: staging/media: drop vb2_queue_release()

This is only needed for drivers that do not use vb2_fop_release().
Note that vb2_queue_release() is *not* the counterpart of vb2_queue_init()
as some drivers here seem to think.

Also use vb2_video_unregister_device() to automatically stop streaming
at unregister time for those drivers that set vdev->queue.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: media/test-drivers: use vb2_video_unregister_device()
Hans Verkuil [Mon, 13 Jul 2020 11:30:47 +0000 (13:30 +0200)]
media: media/test-drivers: use vb2_video_unregister_device()

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->queue.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: media/usb: use vb2_video_unregister_device()
Hans Verkuil [Mon, 13 Jul 2020 11:30:46 +0000 (13:30 +0200)]
media: media/usb: use vb2_video_unregister_device()

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->queue.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: media/platform: drop vb2_queue_release()
Hans Verkuil [Mon, 13 Jul 2020 11:30:45 +0000 (13:30 +0200)]
media: media/platform: drop vb2_queue_release()

This is only needed for drivers that do not use vb2_fop_release().
Note that vb2_queue_release() is *not* the counterpart of vb2_queue_init()
as some drivers here seem to think.

Also use vb2_video_unregister_device() to automatically stop streaming
at unregister time for those drivers that set vdev->queue.

Note that sun4i-csi didn't unregister the video device at all. That's
now fixed.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: media/pci: use vb2_video_unregister_device()
Hans Verkuil [Mon, 13 Jul 2020 11:30:44 +0000 (13:30 +0200)]
media: media/pci: use vb2_video_unregister_device()

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->queue.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: qcom/camss: use vb2_video_unregister_device()
Hans Verkuil [Mon, 13 Jul 2020 11:30:43 +0000 (13:30 +0200)]
media: qcom/camss: use vb2_video_unregister_device()

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->queue.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Tested-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: videobuf2-v4l2.c: add vb2_video_unregister_device helper function
Hans Verkuil [Mon, 13 Jul 2020 11:30:42 +0000 (13:30 +0200)]
media: videobuf2-v4l2.c: add vb2_video_unregister_device helper function

If a driver calls (_)vb2_fop_release(), then such a driver should also
call vb2_video_unregister_device() instead of video_unregister_device().
This helper will call vb2_queue_release() if a filehandle is marked as
owner of the queue. This ensures that at unregister time any streaming
is cancelled and all buffers are returned to userspace.

This is very useful for complex drivers since this stops all streaming
in all subdevs in the pipeline controlled by this video device. Otherwise
this would be delayed until the owner filehandle is closed, which can be
quite some time later.

Bonus points for ordering the includes :-)

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: MAINTAINERS: Fix sort order for RDACM20
Kieran Bingham [Thu, 16 Jul 2020 10:25:52 +0000 (12:25 +0200)]
media: MAINTAINERS: Fix sort order for RDACM20

The files maintained as part of the RDACM20 were incorrectly sorted
while they were added.

Correct the sort-order.

Fixes: 34009bffc1c6 ("media: i2c: Add RDACM20 driver")
Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Acked-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: MAINTAINERS: add Dafna Hirschfeld for rkisp1
Helen Koike [Tue, 25 Aug 2020 13:22:09 +0000 (15:22 +0200)]
media: MAINTAINERS: add Dafna Hirschfeld for rkisp1

Add Dafna Hirschfeld to rkisp1 maintainers list

Signed-off-by: Helen Koike <helen.koike@collabora.com>
Acked-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: Implements support for the MyGica iGrabber
Christopher Snowhill [Tue, 25 Aug 2020 03:51:08 +0000 (05:51 +0200)]
media: Implements support for the MyGica iGrabber

This small change adds the device identifier for the MyGica iGrabber,
which features an Empia EM2860, a Philips SAA7113, Empia EMP202, and
no tuner. Verified that both the composite and S-Video inputs work
with NTSC source. It does not appear to need any port twiddling on
pre-init.

Signed-off-by: Christopher Snowhill <chris@kode54.net>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: tuner-simple: fix regression in simple_set_radio_freq
Tom Rix [Sat, 22 Aug 2020 21:15:47 +0000 (23:15 +0200)]
media: tuner-simple: fix regression in simple_set_radio_freq

clang static analysis reports this problem

tuner-simple.c:714:13: warning: Assigned value is
  garbage or undefined
        buffer[1] = buffer[3];
                  ^ ~~~~~~~~~
In simple_set_radio_freq buffer[3] used to be done
in-function with a switch of tuner type, now done
by a call to simple_radio_bandswitch which has this case

case TUNER_TENA_9533_DI:
case TUNER_YMEC_TVF_5533MF:
tuner_dbg("This tuner doesn't ...
return 0;

which does not set buffer[3].  In the old logic, this case
would have returned 0 from simple_set_radio_freq.

Recover this old behavior by returning an error for this
codition. Since the old simple_set_radio_freq behavior
returned a 0, do the same.

Fixes: c7a9f3aa1e1b ("V4L/DVB (7129): tuner-simple: move device-specific code into three separate functions")
Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: v4l2-tpg: Clamp hue in tpg_s_hue()
Peilin Ye [Fri, 21 Aug 2020 15:13:43 +0000 (17:13 +0200)]
media: v4l2-tpg: Clamp hue in tpg_s_hue()

Setting `hue` by calling tpg_s_hue() directly is risky, since it does not
perform range check. Clamp `hue` to the valid range in tpg_s_hue().

Suggested-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Peilin Ye <yepeilin.cs@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: vivid: Fix global-out-of-bounds read in precalculate_color()
Peilin Ye [Fri, 21 Aug 2020 12:46:45 +0000 (14:46 +0200)]
media: vivid: Fix global-out-of-bounds read in precalculate_color()

vivid_meta_out_process() is setting `brightness`, `contrast`, `saturation`
and `hue` using tpg_s_*(). This is wrong, since tpg_s_*() do not provide
range checks. Using tpg_s_*() here also makes the control framework
out-of-sync with the actual values. Use v4l2_ctrl_s_ctrl() instead.

This issue has been reported by syzbot as an out-of-bounds read bug in
precalculate_color().

Reported-and-tested-by: syzbot+02d9172bf4c43104cd70@syzkaller.appspotmail.com
Link: https://syzkaller.appspot.com/bug?extid=02d9172bf4c43104cd70
Fixes: 746facd39370 ("media: vivid: Add metadata output support")
Suggested-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Peilin Ye <yepeilin.cs@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: mtk-vcodec: fix Kconfig help text
Alexandre Courbot [Fri, 21 Aug 2020 10:43:05 +0000 (12:43 +0200)]
media: mtk-vcodec: fix Kconfig help text

The Kconfig help text for VIDEO_MEDIATEK_VCODEC was referring to a
single module named mtk-vcodec, while this driver produces two modules
named mtk-vcodec-dec and mtk-vcodec-enc. Fix that.

Reported-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: mtk-vcodec: set dma max segment size
Hsin-Yi Wang [Fri, 21 Aug 2020 04:14:14 +0000 (06:14 +0200)]
media: mtk-vcodec: set dma max segment size

Set dma max segment size for encoder and decoder driver.

Fix following warning with CONFIG_DMA_API_DEBUG_SG=y

[   75.147825] ------------[ cut here ]------------
[   75.147844] mtk-vcodec-enc 19002000.vcodec: DMA-API: mapping sg segment longer than device claims to support [len=983040] [max=65536]
[   75.147876] WARNING: CPU: 2 PID: 4069 at kernel/dma/debug.c:1302 debug_dma_map_sg+0x1a8/0x2c4
...
[   75.148139] Call trace:
[   75.148149]  debug_dma_map_sg+0x1a8/0x2c4
[   75.148165]  vb2_dc_get_userptr+0x228/0x364 [videobuf2_dma_contig]
[   75.148178]  __buf_prepare+0x3ac/0x8c0 [videobuf2_common]
[   75.148188]  vb2_core_qbuf+0xa4/0x58c [videobuf2_common]
[   75.148199]  vb2_qbuf+0x88/0xe4 [videobuf2_v4l2]
[   75.148211]  v4l2_m2m_qbuf+0x80/0xf8 [v4l2_mem2mem]
[   75.148221]  vidioc_venc_qbuf+0x3c/0x70 [mtk_vcodec_enc]
[   75.148234]  v4l_qbuf+0x48/0x58
[   75.148242]  __video_do_ioctl+0x200/0x37c
[   75.148250]  video_usercopy+0x360/0x834
[   75.148259]  video_ioctl2+0x38/0x48
[   75.148267]  v4l2_ioctl+0x6c/0x80
[   75.148276]  do_video_ioctl+0xefc/0x4b70
[   75.148284]  v4l2_compat_ioctl32+0x5c/0xcc
[   75.148294]  __arm64_compat_sys_ioctl+0xf4/0x240
[   75.148304]  el0_svc_common+0xac/0x198
[   75.148312]  el0_svc_compat_handler+0x2c/0x40
[   75.148321]  el0_svc_compat+0x8/0x18
[   75.148328] irq event stamp: 0
[   75.148337] hardirqs last  enabled at (0): [<0000000000000000>]           (null)
[   75.148347] hardirqs last disabled at (0): [<ffffff90080e65c0>] copy_process+0x380/0x115c
[   75.148356] softirqs last  enabled at (0): [<ffffff90080e65d8>] copy_process+0x398/0x115c
[   75.148364] softirqs last disabled at (0): [<0000000000000000>]           (null)
[   75.148372] ---[ end trace 588bf529451e3531 ]---

Reported-by: Anand K Mistry <amistry@chromium.org>
Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: pvrusb2: fix parsing error
Tong Zhang [Thu, 20 Aug 2020 16:52:40 +0000 (18:52 +0200)]
media: pvrusb2: fix parsing error

pvr2_std_str_to_id() returns 0 on failure and 1 on success,
however the caller is checking failure case using <0

Acked-by: Mike Isely <isely@pobox.com>
Co-developed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Tong Zhang <ztong0001@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: MAINTAINERS: Remove Pawel from the maintainers list of videobuf2
Tomasz Figa [Thu, 20 Aug 2020 12:58:25 +0000 (14:58 +0200)]
media: MAINTAINERS: Remove Pawel from the maintainers list of videobuf2

According to [1], there has been no email related to videobuf2 posted
from him to the linux-media mailing list since Apr 2015.

Note: The linked archive seems to lack messages newer than the middle of
2019, but it is the only archive that offers search by name. A manual
look through the messages after that time confirms the observation.

[1] https://www.mail-archive.com/search?a=1&l=linux-media%40vger.kernel.org&haswords=&x=0&y=0&from=Pawel+Osciak&subject=&datewithin=1d&date=&notwords=&o=newest

Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: MAINTAINERS: Remove Kyungmin from the maintainers list of videobuf2
Tomasz Figa [Thu, 20 Aug 2020 12:58:24 +0000 (14:58 +0200)]
media: MAINTAINERS: Remove Kyungmin from the maintainers list of videobuf2

According to [1], there has been no email posted from him to the
linux-media mailing list since Feb 2013.

Note: The linked archive seems to lack messages newer than the middle of
2019, but it is the only archive that offers search by name. A manual
look through the messages after that time confirms the observation.

[1] https://www.mail-archive.com/search?a=1&l=linux-media%40vger.kernel.org&haswords=&x=7&y=20&from=Kyungmin+Park&subject=&datewithin=1d&date=&notwords=&o=newest

Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: MAINTAINERS: Make Tomasz the main maintainer of videobuf2
Tomasz Figa [Thu, 20 Aug 2020 12:58:23 +0000 (14:58 +0200)]
media: MAINTAINERS: Make Tomasz the main maintainer of videobuf2

Tomasz is the most active member from the people listed currently in the
MAINTAINERS file, but is currently listed as a reviewer. Change the
entry into a maintainer and move to the top of the list.

Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: videodev2.h: RGB BT2020 and HSV are always full range
Hans Verkuil [Thu, 20 Aug 2020 10:47:16 +0000 (12:47 +0200)]
media: videodev2.h: RGB BT2020 and HSV are always full range

The default RGB quantization range for BT.2020 is full range (just as for
all the other RGB pixel encodings), not limited range.

Update the V4L2_MAP_QUANTIZATION_DEFAULT macro and documentation
accordingly.

Also mention that HSV is always full range and cannot be limited range.

When RGB BT2020 was introduced in V4L2 it was not clear whether it should
be limited or full range, but full range is the right (and consistent)
choice.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: dev-sliced-vbi.rst: fix wrong type
Hans Verkuil [Tue, 18 Aug 2020 13:19:20 +0000 (15:19 +0200)]
media: dev-sliced-vbi.rst: fix wrong type

The documentation reported service_set as a __u32, but according to
videodev2.h it is a __u16. Correct the documentation.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: venus: core: Add support for opp tables/perf voting
Rajendra Nayak [Wed, 29 Jul 2020 07:16:43 +0000 (09:16 +0200)]
media: venus: core: Add support for opp tables/perf voting

Add support to add OPP tables and perf voting on the OPP powerdomain.
This is needed so venus votes on the corresponding performance state
for the OPP powerdomain along with setting the core clock rate.

Signed-off-by: Rajendra Nayak <rnayak@codeaurora.org>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>