platform/kernel/linux-starfive.git
2 years agomedia: marvell-ccic: Use platform_get_irq() to get the interrupt
Lad Prabhakar [Tue, 11 Jan 2022 00:23:09 +0000 (01:23 +0100)]
media: marvell-ccic: Use platform_get_irq() to get the interrupt

platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
allocation of IRQ resources in DT core code, this causes an issue
when using hierarchical interrupt domains using "interrupts" property
in the node as this bypasses the hierarchical setup and messes up the
irq chaining.

In preparation for removal of static setup of IRQ resource from DT core
code use platform_get_irq().

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: exynos-gsc: Use platform_get_irq() to get the interrupt
Lad Prabhakar [Tue, 11 Jan 2022 00:23:08 +0000 (01:23 +0100)]
media: exynos-gsc: Use platform_get_irq() to get the interrupt

platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
allocation of IRQ resources in DT core code, this causes an issue
when using hierarchical interrupt domains using "interrupts" property
in the node as this bypasses the hierarchical setup and messes up the
irq chaining.

In preparation for removal of static setup of IRQ resource from DT core
code use platform_get_irq().

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: stm32-dma2d: Use platform_get_irq() to get the interrupt
Lad Prabhakar [Tue, 11 Jan 2022 00:23:06 +0000 (01:23 +0100)]
media: stm32-dma2d: Use platform_get_irq() to get the interrupt

platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
allocation of IRQ resources in DT core code, this causes an issue
when using hierarchical interrupt domains using "interrupts" property
in the node as this bypasses the hierarchical setup and messes up the
irq chaining.

In preparation for removal of static setup of IRQ resource from DT core
code use platform_get_irq().

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: s5p-mfc: Use platform_get_irq() to get the interrupt
Lad Prabhakar [Tue, 11 Jan 2022 00:23:05 +0000 (01:23 +0100)]
media: s5p-mfc: Use platform_get_irq() to get the interrupt

platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
allocation of IRQ resources in DT core code, this causes an issue
when using hierarchical interrupt domains using "interrupts" property
in the node as this bypasses the hierarchical setup and messes up the
irq chaining.

In preparation for removal of static setup of IRQ resource from DT core
code use platform_get_irq().

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: bdisp: Use platform_get_irq() to get the interrupt
Lad Prabhakar [Tue, 11 Jan 2022 00:23:04 +0000 (01:23 +0100)]
media: bdisp: Use platform_get_irq() to get the interrupt

platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
allocation of IRQ resources in DT core code, this causes an issue
when using hierarchical interrupt domains using "interrupts" property
in the node as this bypasses the hierarchical setup and messes up the
irq chaining.

In preparation for removal of static setup of IRQ resource from DT core
code use platform_get_irq().

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: camss: Use platform_get_irq_byname() to get the interrupt
Lad Prabhakar [Tue, 11 Jan 2022 00:23:03 +0000 (01:23 +0100)]
media: camss: Use platform_get_irq_byname() to get the interrupt

platform_get_resource_byname(pdev, IORESOURCE_IRQ, ..) relies on static
allocation of IRQ resources in DT core code, this causes an issue
when using hierarchical interrupt domains using "interrupts" property
in the node as this bypasses the hierarchical setup and messes up the
irq chaining.

In preparation for removal of static setup of IRQ resource from DT core
code use platform_get_irq_byname().

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: vsp1: Use platform_get_irq() to get the interrupt
Lad Prabhakar [Tue, 11 Jan 2022 00:23:02 +0000 (01:23 +0100)]
media: vsp1: Use platform_get_irq() to get the interrupt

platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
allocation of IRQ resources in DT core code, this causes an issue
when using hierarchical interrupt domains using "interrupts" property
in the node as this bypasses the hierarchical setup and messes up the
irq chaining.

In preparation for removal of static setup of IRQ resource from DT core
code use platform_get_irq().

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.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@kernel.org>
2 years agomedia: i2c: max9286: Use "maxim,gpio-poc" property
Jacopo Mondi [Fri, 17 Dec 2021 14:30:18 +0000 (15:30 +0100)]
media: i2c: max9286: Use "maxim,gpio-poc" property

The 'maxim,gpio-poc' property is used when the remote camera
power-over-coax is controlled by one of the MAX9286 gpio lines,
to instruct the driver about which line to use and what the line
polarity is.

Add to the max9286 driver support for parsing the newly introduced
property and use it if available in place of the usual supply, as it is
not possible to establish one as consumer of the max9286 gpio
controller.

If the new property is present, no gpio controller is registered and
'poc-supply' is ignored.

In order to maximize code re-use, break out the max9286 gpio handling
function so that they can be used by the gpio controller through the
gpio-consumer API, or directly by the driver code.

Wrap the power up and power down routines to their own function to
be able to use either the gpio line directly or the supply. This will
make it easier to control the remote camera power at run time.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: dt-bindings: media: max9286: Define 'maxim,gpio-poc'
Jacopo Mondi [Thu, 16 Dec 2021 16:34:34 +0000 (17:34 +0100)]
media: dt-bindings: media: max9286: Define 'maxim,gpio-poc'

Define a new vendor property in the maxim,max9286 binding schema.

The new property allows to declare that the remote camera
power-over-coax is controlled by one of the MAX9286 gpio lines.

As it is currently not possible to establish a regulator as consumer
of the MAX9286 gpio controller for this purpose, the property allows to
declare that the camera power is controlled by the MAX9286 directly.

The property accepts a gpio-index (0 or 1) and one line polarity
flag as defined by dt-bindings/gpio/gpio.h.

Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: dt-bindings: media: max9286: Re-indent example
Jacopo Mondi [Thu, 16 Dec 2021 16:34:33 +0000 (17:34 +0100)]
media: dt-bindings: media: max9286: Re-indent example

The dt-bindings examples are usually indented with 4 spaces.

The maxim,max9286 schema has the example indented with only
2 spaces, re-indent it.

Cosmetic change only.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: mtk-cir: simplify code
Sean Young [Sat, 15 Jan 2022 10:08:14 +0000 (11:08 +0100)]
media: mtk-cir: simplify code

Re-write without unnecessary shifts.

Cc: Sean Wang <sean.wang@mediatek.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: mtk-cir: remove superfluous ir_raw_event_reset()
Sean Young [Thu, 13 Jan 2022 20:53:51 +0000 (21:53 +0100)]
media: mtk-cir: remove superfluous ir_raw_event_reset()

This IR receiver has two limitations:

1) Any IR pulse or space longer than 12ms will be truncated to 12ms

2) Any pulses/spaces after the first 68 are lost

ir_raw_event_reset() won't help here. If the IR cannot be decoded, any
decoder should reset itself, and if it does not, this is a bug in the
decoder.

Cc: Sean Wang <sean.wang@mediatek.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: mtk-cir: reduce message end to fix nec repeats
Sean Young [Fri, 14 Jan 2022 14:24:27 +0000 (15:24 +0100)]
media: mtk-cir: reduce message end to fix nec repeats

The ir receiver generates an interrupt with the IR data, once a space of
at least ok_count is has been seen. Currently this is about 110ms; when
holding down a button on a nec remote, no such space is seen until the
button is released. This means nothing happens until you release the
button.

The sample rate is fixed at 46us, so the maximum space that can be
encoded is about 12ms. So, the set ok_count above that at 23ms.

Cc: Sean Wang <sean.wang@mediatek.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: lirc: simplify gap calculation
Sean Young [Thu, 13 Jan 2022 11:29:01 +0000 (12:29 +0100)]
media: lirc: simplify gap calculation

When a driver reports a timeout, no more IR activity will be reported
until the next pulse. A space is inserted between the timeout and the
next pulse, based on ktime.

The timeout reports already a duration, so this duration should not be
added to the gap. Otherwise there is no change to the functionality.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: ir_toy: free before error exiting
Peiwei Hu [Wed, 29 Dec 2021 01:15:18 +0000 (02:15 +0100)]
media: ir_toy: free before error exiting

Fix leak in error path.

Signed-off-by: Peiwei Hu <jlu.hpw@foxmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: mtk-vcodec: Remove mtk_vcodec_release_enc_pm
Yunfei Dong [Thu, 13 Jan 2022 04:10:55 +0000 (05:10 +0100)]
media: mtk-vcodec: Remove mtk_vcodec_release_enc_pm

There are only two lines in mtk_vcodec_release_enc_pm, using
pm_runtime_disable and put_device instead directly.

Move pm_runtime_enable outside mtk_vcodec_release_enc_pm to symmetry with
pm_runtime_disable, after that, rename mtk_vcodec_init_enc_pm to *_clk
since it only has clock operations now.

Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: mtk-vcodec: Remove mtk_vcodec_release_dec_pm
Yunfei Dong [Thu, 13 Jan 2022 04:10:54 +0000 (05:10 +0100)]
media: mtk-vcodec: Remove mtk_vcodec_release_dec_pm

There are only two lines in mtk_vcodec_release_dec_pm, using
pm_runtime_disable and put_device instead directly.

Move pm_runtime_enable outside mtk_vcodec_init_dec_pm to symmetry with
pm_runtime_disable, after that, rename mtk_vcodec_init_dec_pm to *_clk
since it only has clock operations now.

Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: mtk-vcodec: Use codec type to separate different hardware
Yunfei Dong [Thu, 13 Jan 2022 04:10:53 +0000 (05:10 +0100)]
media: mtk-vcodec: Use codec type to separate different hardware

There is just one core thread, in order to separate different
hardware, using codec type to separeate it in scp driver.

Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: mtk-vcodec: Add core dec and dec end ipi msg
Yunfei Dong [Thu, 13 Jan 2022 04:10:52 +0000 (05:10 +0100)]
media: mtk-vcodec: Add core dec and dec end ipi msg

Add core dec and dec end ipi msg:
AP_IPIMSG_DEC_CORE/AP_IPIMSG_DEC_CORE_END.

Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: mtk-vcodec: Support 34bits dma address for vdec
Yunfei Dong [Thu, 13 Jan 2022 04:10:51 +0000 (05:10 +0100)]
media: mtk-vcodec: Support 34bits dma address for vdec

Use the dma_set_mask_and_coherent helper to set vdec
DMA bit mask to support 34bits iova space(16GB) that
the mt8192 iommu HW support.

Whole the iova range separate to 0~4G/4G~8G/8G~12G/12G~16G,
regarding which iova range VDEC actually locate, it
depends on the dma-ranges property of vdec dtsi node.

Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: mtk-vcodec: Add work queue for core hardware decode
Yunfei Dong [Thu, 13 Jan 2022 04:10:50 +0000 (05:10 +0100)]
media: mtk-vcodec: Add work queue for core hardware decode

Add work queue to process core hardware information.
First, get lat_buf from message queue, then call core
hardware of each codec(H264/VP9/AV1) to decode, finally
puts lat_buf back to the message.

Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
Reviewed-by: Steve Cho <stevecho@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: mtk-vcodec: Add new interface to lock different hardware
Yunfei Dong [Thu, 13 Jan 2022 04:10:49 +0000 (05:10 +0100)]
media: mtk-vcodec: Add new interface to lock different hardware

For add new hardware, not only need to lock lat hardware, also
need to lock core hardware in case of different instance start
to decoder at the same time.

Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: mtk-vcodec: Generalize power and clock on/off interfaces
Yunfei Dong [Thu, 13 Jan 2022 04:10:48 +0000 (05:10 +0100)]
media: mtk-vcodec: Generalize power and clock on/off interfaces

Generalizes power and clock on/off interfaces to support different
hardware.

Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: mtk-vcodec: Add msg queue feature for lat and core architecture
Yunfei Dong [Thu, 13 Jan 2022 04:10:47 +0000 (05:10 +0100)]
media: mtk-vcodec: Add msg queue feature for lat and core architecture

For lat and core architecture, lat thread will send message to core
thread when lat decode done. Core hardware will use the message
from lat to decode, then free message to lat thread when decode done.

Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: mtk-vcodec: Add irq interface for multi hardware
Yunfei Dong [Thu, 13 Jan 2022 04:10:46 +0000 (05:10 +0100)]
media: mtk-vcodec: Add irq interface for multi hardware

Adds irq interface for multi hardware.

Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: mtk-vcodec: Use pure single core for MT8183
Yunfei Dong [Thu, 13 Jan 2022 04:10:45 +0000 (05:10 +0100)]
media: mtk-vcodec: Use pure single core for MT8183

Separates different architecture for hardware: pure_sin_core
and lat_sin_core. MT8183 is pure single core. Uses .hw_arch to
distinguish.

Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: mtk-vcodec: Add to support multi hardware decode
Yunfei Dong [Thu, 13 Jan 2022 04:10:44 +0000 (05:10 +0100)]
media: mtk-vcodec: Add to support multi hardware decode

There are more than two hardwares for decoder: LAT0, LAT1 and CORE. In
order to manage these hardwares, register each hardware as independent
platform device for the larbs are different.

Each hardware module controls its own information which includes
interrupt/power/clocks/registers.

Calling of_platform_populate in parent device, and use subdev_bitmap to
record whether the hardwares are registered.

Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
Reviewed-by: Steve Cho <stevecho@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: mtk-vcodec: Support MT8192
Yunfei Dong [Thu, 13 Jan 2022 04:10:43 +0000 (05:10 +0100)]
media: mtk-vcodec: Support MT8192

Adds MT8192's compatible "mediatek,mt8192-vcodec-dec".
Adds MT8192's device private data mtk_lat_sig_core_pdata.

Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: dt-bindings: media: mtk-vcodec: Adds decoder dt-bindings for mt8192
Yunfei Dong [Thu, 13 Jan 2022 04:10:42 +0000 (05:10 +0100)]
media: dt-bindings: media: mtk-vcodec: Adds decoder dt-bindings for mt8192

Adds decoder dt-bindings for mt8192.

Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: dt-bindings: media: mtk-vcodec: Separate video encoder and decoder dt-bindings
Yunfei Dong [Thu, 13 Jan 2022 04:10:41 +0000 (05:10 +0100)]
media: dt-bindings: media: mtk-vcodec: Separate video encoder and decoder dt-bindings

Separate decoder and encoder document for the dts are big difference.

Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: mtk-vcodec: export decoder pm functions
Yunfei Dong [Thu, 13 Jan 2022 04:10:40 +0000 (05:10 +0100)]
media: mtk-vcodec: export decoder pm functions

When mtk vcodec decoder is build as a module, we need to export
mtk-vcodec-dec pm functions to make them visible by the other components.

Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: mtk-vcodec: Refactor vcodec pm interface
Yunfei Dong [Thu, 13 Jan 2022 04:10:39 +0000 (05:10 +0100)]
media: mtk-vcodec: Refactor vcodec pm interface

Using the needed params for pm init/release function and remove unused
param mtkdev in 'struct mtk_vcodec_pm'.

Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
Reviewed-by: Tzung-Bi Shih <tzungbi@google.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Steve Cho <stevecho@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: mtk-vcodec: Align vcodec wake up interrupt interface
Yunfei Dong [Thu, 13 Jan 2022 04:10:38 +0000 (05:10 +0100)]
media: mtk-vcodec: Align vcodec wake up interrupt interface

Vdec and venc can use the same function to wake up interrupt event.

Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
Reviewed-by: Tzung-Bi Shih <tzungbi@google.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Steve Cho <stevecho@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: mtk-vcodec: Get numbers of register bases from DT
Yunfei Dong [Thu, 13 Jan 2022 04:10:37 +0000 (05:10 +0100)]
media: mtk-vcodec: Get numbers of register bases from DT

Different platforms may have different numbers of register bases. Gets the
numbers of register bases from dts (sizeof(u32) * 4 bytes for each).

Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
Reviewed-by: Tzung-Bi Shih <tzungbi@google.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: hevc: Embedded indexes in RPS
Benjamin Gaignard [Fri, 7 Jan 2022 15:54:55 +0000 (16:54 +0100)]
media: hevc: Embedded indexes in RPS

Reference Picture Set lists provide indices of short and long term
reference in DBP array.
Fix Hantro to not do a look up in DBP entries.
Make documentation more clear about it.

[hverkuil: fix typo in commit log]

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: hevc: Remove RPS named flags
Benjamin Gaignard [Fri, 7 Jan 2022 15:54:54 +0000 (16:54 +0100)]
media: hevc: Remove RPS named flags

Marking a picture as long-term reference is valid for DPB but not for RPS.
Change flag name to match with the description in HEVC spec chapter
"8.3.2 Decoding process for reference picture set".

PocStCurrBefore, PocStCurrAfter, PocLtCurr lists could be built by the
kernel from the DPB entries struct v4l2_hevc_dpb_entry, using the
information in the rps field. This way RPS flags becomes useless and are
removed.

This patch breaks the staging HEVC API because it introduces a new flag,
changes a field name in v4l2_hevc_dpb_entry structure and removes
V4L2_HEVC_DPB_ENTRY_RPS_* flags.

[hverkuil: fixed some typos]

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: atmel: atmel-isc: add raw Bayer 8bit 10bit output formats
Eugen Hristev [Mon, 13 Dec 2021 13:49:38 +0000 (14:49 +0100)]
media: atmel: atmel-isc: add raw Bayer 8bit 10bit output formats

The ISC can dump the 8 bit and 10 bit raw bayer formats directly to
the memory.
Thus, add them to the supported output format list.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: atmel: atmel-sama7g5-isc: fix UYVY input format mbus_code typo
Eugen Hristev [Mon, 13 Dec 2021 13:49:37 +0000 (14:49 +0100)]
media: atmel: atmel-sama7g5-isc: fix UYVY input format mbus_code typo

Fix the mbus code for UYVY input format type to the right color rotation.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: atmel: atmel-isc-base: clamp wb gain coefficients
Eugen Hristev [Mon, 13 Dec 2021 13:49:36 +0000 (14:49 +0100)]
media: atmel: atmel-isc-base: clamp wb gain coefficients

White balance computed gains can overflow above the 13 bits hardware
coefficient that can be used, in some specific scenarios like a subexposure
from the sensor when the image is mostly black.
In this case the computed gain has to be clamped to the maximum value
allowed by the hardware.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: atmel: atmel-isc-base: add wb debug messages
Eugen Hristev [Mon, 13 Dec 2021 13:49:35 +0000 (14:49 +0100)]
media: atmel: atmel-isc-base: add wb debug messages

Add debug messages that make it easier to debug white balance algorithm.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: atmel: atmel-isc-base: fix bytesperline value for planar formats
Eugen Hristev [Mon, 13 Dec 2021 13:49:28 +0000 (14:49 +0100)]
media: atmel: atmel-isc-base: fix bytesperline value for planar formats

The bytesperline field of the pixfmt should be only for the first plane
in case of planar formats like YUV420 or YUV422.
The bytesperline is used by the driver to compute the framesize.
We have to report a different bpp (bytes per pixel) to v4l2 in bytesperline
than the actual bpp.
For example for YUV420, the real bpp is 12, but the first plane has only
8 bpp. Thus we report a bytesperline 8*width instead of 12*width.
However, for real framezise we have to compute 12*width*height.
Hence added a new variable to hold this information and to correctly
compute the frame size.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: atmel: atmel-isc-base: report frame sizes as full supported range
Eugen Hristev [Mon, 13 Dec 2021 13:49:26 +0000 (14:49 +0100)]
media: atmel: atmel-isc-base: report frame sizes as full supported range

The ISC supports a full broad range of frame sizes.
Until now, the subdevice was queried for possible frame sizes and these
were reported to the user space.
However, the ISC should not care about which frame sizes the subdev
supports, as long as this frame size is supported.
Thus, report a continuous range from smallest frame size up to the max
resolution.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: atmel: atmel-isc-base: remove frameintervals VIDIOC
Eugen Hristev [Mon, 13 Dec 2021 13:49:25 +0000 (14:49 +0100)]
media: atmel: atmel-isc-base: remove frameintervals VIDIOC

VIDIOC_ENUM_FRAMEINTERVALS is not recommended for a top video driver.
The frame rate is defined by the sensor subdevice, thus it can be queried
directly by anyone interested in the frame intervals.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: atmel: atmel-sama7g5-isc: fix ispck leftover
Eugen Hristev [Mon, 13 Dec 2021 13:49:23 +0000 (14:49 +0100)]
media: atmel: atmel-sama7g5-isc: fix ispck leftover

The ispck is not used for sama7g5 variant of the ISC.
Calls to ispck have to be removed also from module insert/removal.

Fixes: d7f26849ed7c ("media: atmel: fix the ispck initialization")
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: atmel: atmel-isc: replace video device name with module name
Eugen Hristev [Mon, 13 Dec 2021 13:49:22 +0000 (14:49 +0100)]
media: atmel: atmel-isc: replace video device name with module name

To have consistency with future media controller development,
replace the video device name with KBUILD_MODNAME.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: atmel: atmel-isc: split the clock code into separate source file
Eugen Hristev [Mon, 13 Dec 2021 13:49:21 +0000 (14:49 +0100)]
media: atmel: atmel-isc: split the clock code into separate source file

The atmel-isc-base is getting crowded. Split the clock functions into
atmel-isc-clk.c.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: atmel: introduce microchip csi2dc driver
Eugen Hristev [Mon, 13 Dec 2021 13:49:20 +0000 (14:49 +0100)]
media: atmel: introduce microchip csi2dc driver

Microchip CSI2DC (CSI2 Demultiplexer Controller) is a misc bridge device
that converts a byte stream in IDI Synopsys format (coming from a CSI2HOST)
to a pixel stream that can be captured by a sensor controller.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: dt-bindings: media: atmel: csi2dc: add bindings for microchip csi2dc
Eugen Hristev [Mon, 13 Dec 2021 13:49:19 +0000 (14:49 +0100)]
media: dt-bindings: media: atmel: csi2dc: add bindings for microchip csi2dc

Add bindings documentation for Microchip CSI2 Demultiplexer controller.

CSI2DC is a demultiplexer from Synopsys IDI interface specification to
parallel interface connection or direct memory access.
CSI2DC can also act as a parallel bypass from a parallel sensor to the
image sensor controller/interface.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: MAINTAINERS: add microchip csi2dc
Eugen Hristev [Mon, 13 Dec 2021 13:49:18 +0000 (14:49 +0100)]
media: MAINTAINERS: add microchip csi2dc

Add Microchip CSI2DC driver in the list.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.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@kernel.org>
2 years agomedia: stm32: dcmi: create a dma scatterlist based on DMA max_sg_burst value
Alain Volmat [Mon, 10 Jan 2022 10:37:39 +0000 (11:37 +0100)]
media: stm32: dcmi: create a dma scatterlist based on DMA max_sg_burst value

Prior to submitting a transfer to the DMA, the client should first check
the capabilities of the DMA channel in term of maximum of each segment.
This is given by the max_sg_burst value reported by dma_get_slave_caps API.
Based on that, if the transfer is larger than what can be handled by the
DMA channel, we split the transfer into several scatterlist elements.

[hverkuil: fix checkpatch parenthesis alignment warning]

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: v4l2-ctrls: make array range static
Colin Ian King [Sun, 9 Jan 2022 21:05:02 +0000 (22:05 +0100)]
media: v4l2-ctrls: make array range static

Don't populate the read-only array range on the stack but
instead it static. Also makes the object code a little smaller.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: media/radio: make array probe_ports static const
Colin Ian King [Sun, 9 Jan 2022 21:00:00 +0000 (22:00 +0100)]
media: media/radio: make array probe_ports static const

Don't populate the read-only array probe_ports on the stack but
instead it static const. Also makes the object code a little smaller.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: gspca: make array regs_to_read static const
Colin Ian King [Sun, 9 Jan 2022 20:45:57 +0000 (21:45 +0100)]
media: gspca: make array regs_to_read static const

Don't populate the read-only array regs_to_read on the stack but
instead it static const. Also makes the object code a little smaller.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: bttv: fix WARNING regression on tunerless devices
Ondrej Zary [Sat, 25 Dec 2021 21:58:44 +0000 (22:58 +0100)]
media: bttv: fix WARNING regression on tunerless devices

Commit 2161536516ed ("media: media/pci: set device_caps in struct video_device")
introduced a regression: V4L2_CAP_TUNER is always present in device_caps,
even when the device has no tuner.

This causes a warning:
WARNING: CPU: 0 PID: 249 at drivers/media/v4l2-core/v4l2-ioctl.c:1102 v4l_querycap+0xa0/0xb0 [videodev]

Fixes: 2161536516ed ("media: media/pci: set device_caps in struct video_device")
Signed-off-by: Ondrej Zary <linux@zary.sk>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: imx-jpeg: use NV12M to represent non contiguous NV12
Ming Qian [Fri, 24 Dec 2021 03:02:41 +0000 (04:02 +0100)]
media: imx-jpeg: use NV12M to represent non contiguous NV12

V4L2_PIX_FMT_NV12 requires num_planes equals to 1,
V4L2_PIX_FMT_NV12M requires num_planes equals to 2.
and mxc-jpeg supports 2 planes for nv12,
so we should use 4L2_PIX_FMT_NV12M instead of V4L2_PIX_FMT_NV12,
otherwise it will confuses gstreamer and prevent encoding and decoding.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
Reviewed-by: Mirela Rabulea <mirela.rabulea@oss.nxp.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: davinci: vpif: drop probe printk
Johan Hovold [Wed, 22 Dec 2021 14:20:25 +0000 (15:20 +0100)]
media: davinci: vpif: drop probe printk

Drivers should generally not print anything for a successful probe, and
printing "success" before probe is done makes no sense.

Drop the unnecessary and misleading dev_info() call from probe.

Signed-off-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Lad Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: davinci: vpif: fix use-after-free on driver unbind
Johan Hovold [Wed, 22 Dec 2021 14:20:24 +0000 (15:20 +0100)]
media: davinci: vpif: fix use-after-free on driver unbind

The driver allocates and registers two platform device structures during
probe, but the devices were never deregistered on driver unbind.

This results in a use-after-free on driver unbind as the device
structures were allocated using devres and would be freed by driver
core when remove() returns.

Fix this by adding the missing deregistration calls to the remove()
callback and failing probe on registration errors.

Note that the platform device structures must be freed using a proper
release callback to avoid leaking associated resources like device
names.

Fixes: 479f7a118105 ("[media] davinci: vpif: adaptions for DT support")
Cc: stable@vger.kernel.org # 4.12
Cc: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Lad Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: davinci: vpif: fix unbalanced runtime PM enable
Johan Hovold [Wed, 22 Dec 2021 14:20:23 +0000 (15:20 +0100)]
media: davinci: vpif: fix unbalanced runtime PM enable

Make sure to disable runtime PM before returning on probe errors.

Fixes: 479f7a118105 ("[media] davinci: vpif: adaptions for DT support")
Cc: stable@vger.kernel.org
Cc: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: davinci: vpif: fix unbalanced runtime PM get
Johan Hovold [Wed, 22 Dec 2021 14:20:22 +0000 (15:20 +0100)]
media: davinci: vpif: fix unbalanced runtime PM get

Make sure to balance the runtime PM usage counter on driver unbind.

Fixes: 407ccc65bfd2 ("[media] davinci: vpif: add pm_runtime support")
Cc: stable@vger.kernel.org # 3.9
Cc: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Lad Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: platform: cros-ec: Add brask to the match table
Zhuohao Lee [Tue, 21 Dec 2021 09:53:26 +0000 (10:53 +0100)]
media: platform: cros-ec: Add brask to the match table

The Google Brask device uses the same approach as the Google Fizz
which enables the HDMI CEC via the cros-ec-cec driver.

Signed-off-by: Zhuohao Lee <zhuohao@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: saa7134: use swap() to make code cleaner
Yang Guang [Mon, 20 Dec 2021 07:46:46 +0000 (08:46 +0100)]
media: saa7134: use swap() to make code cleaner

Use the macro 'swap()' defined in 'include/linux/minmax.h' to avoid
opencoding it.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: David Yang <davidcomponentone@gmail.com>
Signed-off-by: Yang Guang <yang.guang5@zte.com.cn>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: imx: imx8mq-mipi_csi2: fix system resume
Martin Kepplinger [Thu, 16 Dec 2021 09:03:36 +0000 (10:03 +0100)]
media: imx: imx8mq-mipi_csi2: fix system resume

during system resume, interconnect bandwidth would currently be requested
even though the device is runtime suspended. This leaves the system in an
unbalanced state.

Fix that by only doing that in runtimem pm and splitting up runtime and
system suspend to be a more readable:
imx8mq_mipi_csi_pm_*() does the generic things called from system- and
runtime functions that each do specific things on top.

Fixes: f33fd8d77dd0 ("media: imx: add a driver for i.MX8MQ mipi csi rx phy and controller")
Signed-off-by: Martin Kepplinger <martin.kepplinger@puri.sm>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: imx: imx8mq-mipi-csi2: remove wrong irq config write operation
Martin Kepplinger [Thu, 16 Dec 2021 09:03:35 +0000 (10:03 +0100)]
media: imx: imx8mq-mipi-csi2: remove wrong irq config write operation

The place where this register writel() that masks one interrupt is placed
does not guarantee that the device is powered so that's not allowed.
Moreover imx8mq_mipi_csi_start_stream() masks the interrupt anyway so the
write is not even needed. Remove it as this is a mistake that slipped in
with the driver.

Fixes: f33fd8d77dd0 ("media: imx: add a driver for i.MX8MQ mipi csi rx phy and controller")
Signed-off-by: Martin Kepplinger <martin.kepplinger@puri.sm>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: mtk-vcodec: potential dereference of null pointer
Jiasheng Jiang [Wed, 15 Dec 2021 05:21:57 +0000 (06:21 +0100)]
media: mtk-vcodec: potential dereference of null pointer

The return value of devm_kzalloc() needs to be checked.
To avoid use of null pointer in case of thefailure of alloc.

Fixes: 46233e91fa24 ("media: mtk-vcodec: move firmware implementations into their own files")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: Tzung-Bi Shih <tzungbi@google.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: v4l2-mem2mem: Apply DST_QUEUE_OFF_BASE on MMAP buffers across ioctls
Chen-Yu Tsai [Thu, 9 Dec 2021 16:38:03 +0000 (17:38 +0100)]
media: v4l2-mem2mem: Apply DST_QUEUE_OFF_BASE on MMAP buffers across ioctls

DST_QUEUE_OFF_BASE is applied to offset/mem_offset on MMAP capture buffers
only for the VIDIOC_QUERYBUF ioctl, while the userspace fields (including
offset/mem_offset) are filled in for VIDIOC_{QUERY,PREPARE,Q,DQ}BUF
ioctls. This leads to differences in the values presented to userspace.
If userspace attempts to mmap the capture buffer directly using values
from DQBUF, it will fail.

Move the code that applies the magic offset into a helper, and call
that helper from all four ioctl entry points.

[hverkuil: drop unnecessary '= 0' in v4l2_m2m_querybuf() for ret]

Fixes: 7f98639def42 ("V4L/DVB: add memory-to-memory device helper framework for videobuf")
Fixes: 908a0d7c588e ("[media] v4l: mem2mem: port to videobuf2")
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: docs: vidioc-dqbuf: State all remaining fields are filled by driver
Chen-Yu Tsai [Thu, 9 Dec 2021 06:29:25 +0000 (07:29 +0100)]
media: docs: vidioc-dqbuf: State all remaining fields are filled by driver

The specification for VIDIOC_DQBUF is slightly ambiguous on what fields
of |struct v4l2_buffer| is filled by the driver.

Reword it so things are clear: the driver fills in all remaining fields
not specified to be filled in by userspace applications.

Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: vivid: fix timestamp and sequence wrapping
Deborah Brouwer [Wed, 8 Dec 2021 00:40:42 +0000 (01:40 +0100)]
media: vivid: fix timestamp and sequence wrapping

The error injection controls that test wrap-around sequence and timestamp
counters were partially broken. Add a menu option for 64 or 32 bit signed
timestamp wrapping. Prevent the timestamp from wrapping around before the
device can be tested.  Remove the sequence count from the timestamp
calculation so that sequence wrapping does not interfere with the
timestamp.  Add consistent time and sequence wrapping to sdr and touch
devices.

Signed-off-by: Deborah Brouwer <deborahbrouwer3563@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: rkisp1: fix grey format iommu page faults
Dafna Hirschfeld [Tue, 7 Dec 2021 11:59:23 +0000 (12:59 +0100)]
media: rkisp1: fix grey format iommu page faults

Currently capturing grey format produces page faults
on both selfpath and mainpath. To support greyscale
we can capture YUV422 planar format and configure the U, V
buffers to the dummy buffer.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: staging: media: imx: imx7-mipi-csis: Make subdev name unique
Laurent Pinchart [Fri, 25 Jun 2021 02:26:35 +0000 (04:26 +0200)]
media: staging: media: imx: imx7-mipi-csis: Make subdev name unique

When multiple CSIS instances are present in a single graph, they are
currently all named "imx7-mipi-csis.0", which breaks the entity name
uniqueness requirement. Fix it by using the device name to create the
subdev name.

Fixes: 7807063b862b ("media: staging/imx7: add MIPI CSI-2 receiver subdev for i.MX7")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Jerome Brunet <jbrunet@baylibre.com>
Tested-by: Jerome Brunet <jbrunet@baylibre.com> # On i.MX8MP
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: staging: media: imx: imx7_mipi_csis: Add timings override through debugfs
Laurent Pinchart [Thu, 24 Jun 2021 16:28:55 +0000 (18:28 +0200)]
media: staging: media: imx: imx7_mipi_csis: Add timings override through debugfs

Add two debugfs files, ths_settle and tclk_settle, to allow overriding
the corresponding timing parameters for test purpose.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Reviewed-by: Jerome Brunet <jbrunet@baylibre.com>
Tested-by: Jerome Brunet <jbrunet@baylibre.com> # On i.MX8MP
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: staging: media: imx: imx7-mipi-csis: Dump MIPI_CSIS_FRAME_COUNTER_CH0 register
Laurent Pinchart [Thu, 8 Apr 2021 01:39:53 +0000 (03:39 +0200)]
media: staging: media: imx: imx7-mipi-csis: Dump MIPI_CSIS_FRAME_COUNTER_CH0 register

The frame counter is useful debugging information, add it to the
register dump printed by mipi_csis_dump_regs().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Reviewed-by: Jerome Brunet <jbrunet@baylibre.com>
Tested-by: Jerome Brunet <jbrunet@baylibre.com> # On i.MX8MP
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: camss: Apply vfe_get/vfe_put fix to SDM845
Bryan O'Donoghue [Wed, 22 Dec 2021 00:37:51 +0000 (01:37 +0100)]
media: camss: Apply vfe_get/vfe_put fix to SDM845

Similar to the SM8250 the CSID relies on the VFE to be clocked prior to
taking the CSID out of reset.

Apply the same fixup to SDM845 as SM8250.

Suggested-by: Robert Foss <robert.foss@linaro.org>
Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: camss: Do vfe_get/vfe_put for csid on sm8250
Bryan O'Donoghue [Wed, 22 Dec 2021 00:37:50 +0000 (01:37 +0100)]
media: camss: Do vfe_get/vfe_put for csid on sm8250

The sm8250 CAMSS CSID depends on the VFE it is attached to being powered on
and clocked prior to taking the CSID out of reset.

It is possible to open just the CSID subdev from libcamera and attempt to
bring the CSID block up.

If we do not first bring up the VFE the CSID will fail to come out of
reset.

Tested-by: Julian Grahsl <jgrahsl@snap.com>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: camss: Add SM8250 bandwdith configuration support
Bryan O'Donoghue [Wed, 22 Dec 2021 00:37:49 +0000 (01:37 +0100)]
media: camss: Add SM8250 bandwdith configuration support

Downstream makes some pretty explicit comments about voting for bus
bandwidth prior to camcc_camnoc_axi_clk_src. Working with camx downstream
also shows that the bandwidth vote is required to get that root clock
working.

Add a simple mechanism to declare set and unset named NOCs. Whereas the
objective is to enable the sm8250 specifically the code has been
implemented to allow setting of whatever NOCs different SoCs using this
driver may require.

Tested-by: Julian Grahsl <jgrahsl@snap.com>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: camss: add support for SM8250 camss
Jonathan Marek [Wed, 22 Dec 2021 00:37:48 +0000 (01:37 +0100)]
media: camss: add support for SM8250 camss

The Titan 480 camss found on SM8250 has 6 CSIPHY and 4 VFE/CSID.

CSID is compatible with the Titan 170 CSID, but the Titan 480 CSID are
inside the VFE region (between the "top" and "bus" registers), so a
workaround is added to avoid ioremap failure.

[bod] Fixed setting camnoc_axi_clk_src instead of camcc_camnoc_axi_clk
[jgrahsl, bod] Add slow_ahb_src clock values
[jgrahsl, bod] Add cpa_ahb clock values

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Tested-by: Julian Grahsl <jgrahsl@snap.com>
Co-developed-by: Julian Grahsl <jgrahsl@snap.com>
Signed-off-by: Julian Grahsl <jgrahsl@snap.com>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Co-developed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: camss: add support for V4L2_PIX_FMT_GREY for sdm845 HW
Jonathan Marek [Wed, 22 Dec 2021 00:37:47 +0000 (01:37 +0100)]
media: camss: add support for V4L2_PIX_FMT_GREY for sdm845 HW

Add this common format to the various format lists relevant to sdm845.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: camss: Add initial support for VFE hardware version Titan 480
Jonathan Marek [Wed, 22 Dec 2021 00:37:46 +0000 (01:37 +0100)]
media: camss: Add initial support for VFE hardware version Titan 480

Add support for VFE found on SM8250 (Titan 480). This implementation is
based on the titan 170 implementation. It supports the normal and lite VFE,
and only supports the RDI0 capture path.

[bod: Updates hw_version callback]
[bod: Use static inline for macros reusing parameters checkpatch --strict]

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Tested-by: Julian Grahsl <jgrahsl@snap.com>
Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: camss: vfe-170: fix "VFE halt timeout" error
Jonathan Marek [Wed, 22 Dec 2021 00:37:45 +0000 (01:37 +0100)]
media: camss: vfe-170: fix "VFE halt timeout" error

This function waits for halt_complete but doesn't do anything to cause
it to complete, and always hits the "VFE halt timeout" error. Just delete
this code for now.

Fixes: 7319cdf189bb ("media: camss: Add support for VFE hardware version Titan 170")
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Tested-by: Julian Grahsl <jgrahsl@snap.com>
Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: camss: fix VFE irq name
Jonathan Marek [Wed, 22 Dec 2021 00:37:44 +0000 (01:37 +0100)]
media: camss: fix VFE irq name

vfe->id isn't set yet, so use "id" instead here.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Tested-by: Julian Grahsl <jgrahsl@snap.com>
Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: camss: remove vdda-csiN from sdm845 resources
Jonathan Marek [Wed, 22 Dec 2021 00:37:43 +0000 (01:37 +0100)]
media: camss: remove vdda-csiN from sdm845 resources

This isn't used and only works because devm_regulator_get() returns a dummy
regulator.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Tested-by: Julian Grahsl <jgrahsl@snap.com>
Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: camss: csid: allow csid to work without a regulator
Jonathan Marek [Wed, 22 Dec 2021 00:37:42 +0000 (01:37 +0100)]
media: camss: csid: allow csid to work without a regulator

At least for titan HW, CSID don't have an associated regulator. This change
is necessary to be able to model this in the CSID resources.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Tested-by: Julian Grahsl <jgrahsl@snap.com>
Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: camss: csid-170: set the right HALT_CMD when disabled
Jonathan Marek [Wed, 22 Dec 2021 00:37:41 +0000 (01:37 +0100)]
media: camss: csid-170: set the right HALT_CMD when disabled

Use the "HALT_CMD_RESUME_AT_FRAME_BOUNDARY" define instead of a "1" which
is otherwise confusing, and add a "HALT_CMD_HALT_AT_FRAME_BOUNDARY" which
is set when disabling.

Fixes: eebe6d00e9bf ("media: camss: Add support for CSID hardware version Titan 170")
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Tested-by: Julian Grahsl <jgrahsl@snap.com>
Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: camss: csid-170: support more than one lite vfe
Jonathan Marek [Wed, 22 Dec 2021 00:37:40 +0000 (01:37 +0100)]
media: camss: csid-170: support more than one lite vfe

Change the IS_LITE condition so that it returns true for the second lite
vfe found on titan 480 hardware (8250), which will have id == 3.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Tested-by: Julian Grahsl <jgrahsl@snap.com>
Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: camss: csid-170: remove stray comment
Jonathan Marek [Wed, 22 Dec 2021 00:37:39 +0000 (01:37 +0100)]
media: camss: csid-170: remove stray comment

This is a leftover from my original patches, it doesn't serve any purpose.
(it was a reminder to figure out how downstream sets a particular field in
the register).

Fixes: eebe6d00e9bf ("media: camss: Add support for CSID hardware version Titan 170")
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Tested-by: Julian Grahsl <jgrahsl@snap.com>
Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: camss: csid-170: don't enable unused irqs
Jonathan Marek [Wed, 22 Dec 2021 00:37:38 +0000 (01:37 +0100)]
media: camss: csid-170: don't enable unused irqs

csid_isr() only checks for the reset irq, so enabling any other irqs
doesn't make sense. The "RDI irq" comment is also wrong, the register
should be CSID_CSI2_RDIN_IRQ_MASK. Without this fix there may be an
excessive amount of irqs.

Fixes: eebe6d00e9bf ("media: camss: Add support for CSID hardware version Titan 170")
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Tested-by: Julian Grahsl <jgrahsl@snap.com>
Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: camss: csid-170: fix non-10bit formats
Jonathan Marek [Wed, 22 Dec 2021 00:37:37 +0000 (01:37 +0100)]
media: camss: csid-170: fix non-10bit formats

Use the decode_format/data_type from the "format" struct instead of a
hardcoded 10-bit format.

Fixes: eebe6d00e9bf ("media: camss: Add support for CSID hardware version Titan 170")
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Tested-by: Julian Grahsl <jgrahsl@snap.com>
Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: camss: csiphy-3ph: add support for SM8250 CSI DPHY
Jonathan Marek [Wed, 22 Dec 2021 00:37:36 +0000 (01:37 +0100)]
media: camss: csiphy-3ph: add support for SM8250 CSI DPHY

Add support for CSIPHY (2PH/DPHY mode) found on SM8250 hardware.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Tested-by: Julian Grahsl <jgrahsl@snap.com>
Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: camss: csiphy-3ph: disable interrupts
Jonathan Marek [Wed, 22 Dec 2021 00:37:35 +0000 (01:37 +0100)]
media: camss: csiphy-3ph: disable interrupts

The driver does nothing with the interrupts, so set the irq mask registers
to zero to avoid wasting CPU time for nothing.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Tested-by: Julian Grahsl <jgrahsl@snap.com>
Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: camss: csiphy-3ph: don't print HW version as an error
Jonathan Marek [Wed, 22 Dec 2021 00:37:34 +0000 (01:37 +0100)]
media: camss: csiphy-3ph: don't print HW version as an error

Avoid unnecessary noise in normal usage (it prints every time CSIPHY is
powered on).

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Tested-by: Julian Grahsl <jgrahsl@snap.com>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: dt-bindings: media: camss: Add qcom,sm8250-camss binding
Jonathan Marek [Wed, 22 Dec 2021 00:37:33 +0000 (01:37 +0100)]
media: dt-bindings: media: camss: Add qcom,sm8250-camss binding

Add bindings for qcom,sm8250-camss in order to support the camera
subsystem for SM8250.

Cc: devicetree@vger.kernel.org
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: staging: media: zoran: drop read/write support
Hans Verkuil [Tue, 14 Dec 2021 16:16:36 +0000 (17:16 +0100)]
media: staging: media: zoran: drop read/write support

This makes no sense for MJPEG formats and it is just easier to
drop support for this altogether.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: staging: media: zoran: drop kernel log spam
Hans Verkuil [Tue, 14 Dec 2021 16:16:35 +0000 (17:16 +0100)]
media: staging: media: zoran: drop kernel log spam

Do not spam the kernel log with messages that result from incorrect
userspace input. Those should be either dropped completely (the error
code gives sufficient info) or changed to debug messages.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: staging: media: zoran: fix TRY_FMT handling
Hans Verkuil [Tue, 14 Dec 2021 16:16:34 +0000 (17:16 +0100)]
media: staging: media: zoran: fix TRY_FMT handling

TRY_FMT must not set actual capture values (zr->buffer_size in
this case), since it is a 'try' only.

zoran_try_fmt_vid_cap() also didn't fill in fmt->fmt.pix.bytesperline
and fmt->fmt.pix.sizeimage correctly.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: staging: media: zoran: fix various V4L2 compliance errors
Hans Verkuil [Tue, 14 Dec 2021 16:16:33 +0000 (17:16 +0100)]
media: staging: media: zoran: fix various V4L2 compliance errors

This fixes several issues found with 'v4l2-compliance -s':

1) read()/write() is supported, but not reported in the capabilities
2) S_STD(G_STD()) failed: setting the same standard should just return 0.
3) G_PARM failed to set readbuffers.
4) different field values in the format vs. what v4l2_buffer reported.
5) zero the sequence number when starting streaming.
6) drop VB_USERPTR: makes no sense with dma_contig streaming.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: staging: media: zoran: calculate the right buffer number for zoran_reap_stat_com
Corentin Labbe [Tue, 14 Dec 2021 16:16:32 +0000 (17:16 +0100)]
media: staging: media: zoran: calculate the right buffer number for zoran_reap_stat_com

On the case tmp_dcim=1, the index of buffer is miscalculated.
This generate a NULL pointer dereference later.

So let's fix the calcul and add a check to prevent this to reappear.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: staging: media: zoran: fix counting buffer in reserve
Corentin Labbe [Tue, 14 Dec 2021 16:16:31 +0000 (17:16 +0100)]
media: staging: media: zoran: fix counting buffer in reserve

After each capture, zoran driver complains that it remains some unused
buffer. This is due to a missing count handling.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: staging: media: zoran: clean unused code
Corentin Labbe [Tue, 14 Dec 2021 16:16:30 +0000 (17:16 +0100)]
media: staging: media: zoran: clean unused code

It remains some unused code from old zoran buffer handling.
Let's remove them.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: staging: media: zoran: fix usage of vb2_dma_contig_set_max_seg_size
Corentin Labbe [Tue, 14 Dec 2021 16:16:29 +0000 (17:16 +0100)]
media: staging: media: zoran: fix usage of vb2_dma_contig_set_max_seg_size

vb2_dma_contig_set_max_seg_size need to have a size in parameter and not
a DMA_BIT_MASK().
While fixing this issue, also fix error handling of all DMA size
setting.

Reported-by: kernel test robot <lkp@intel.com>
Fixes: d4ae3689226e5 ("media: zoran: device support only 32bit DMA address")
Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: staging: media: zoran: introduce zoran_i2c_init
Corentin Labbe [Tue, 14 Dec 2021 16:16:28 +0000 (17:16 +0100)]
media: staging: media: zoran: introduce zoran_i2c_init

Reduces the size of the probe function by adding zoran_i2c_init and
zoran_i2c_exit functions.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2 years agomedia: staging: media: zoran: move config select on primary kconfig
Corentin Labbe [Tue, 14 Dec 2021 16:16:27 +0000 (17:16 +0100)]
media: staging: media: zoran: move config select on primary kconfig

Since all kconfigs for card selection are bool, this causes all selected
modules to be always built-in.
Prevent this by moving selects to the main tristate kconfig.

By doing this, remove also all "if MEDIA_SUBDRV_AUTOSELECT" which are
wrong, since zoran always need them to work.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>