Ken Lin [Thu, 5 Oct 2023 01:38:40 +0000 (09:38 +0800)]
media: platform: cros-ec: Rename conns array for the match table
Rename conns array to port_**_conns, ** is the ports which support cec.
ex: dibbi_conns support Port D and B will be renamed to port_db_conns.
Make it much cleaner and readable.
Signed-off-by: Ken Lin <ken_lin5@hotmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Wolfram Sang [Fri, 22 Sep 2023 08:04:20 +0000 (10:04 +0200)]
media: dvb-frontends: drop check because i2c_unregister_device() is NULL safe
No need to check the argument of i2c_unregister_device() because the
function itself does it.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Wolfram Sang [Fri, 22 Sep 2023 08:04:19 +0000 (10:04 +0200)]
media: i2c: drop check because i2c_unregister_device() is NULL safe
No need to check the argument of i2c_unregister_device() because the
function itself does it.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Jernej Skrabec [Mon, 11 Sep 2023 18:46:12 +0000 (20:46 +0200)]
media: cedrus: Fix clock/reset sequence
According to H6 user manual, resets should always be de-asserted before
clocks are enabled. This is also consistent with vendor driver.
Fixes:
d5aecd289bab ("media: cedrus: Implement runtime PM")
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Acked-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Ross Zwisler [Tue, 29 Aug 2023 20:46:01 +0000 (14:46 -0600)]
media: visl: use canonical ftrace path
The canonical location for the tracefs filesystem is at
/sys/kernel/tracing.
But, from Documentation/trace/ftrace.rst:
Before 4.1, all ftrace tracing control files were within the debugfs
file system, which is typically located at /sys/kernel/debug/tracing.
For backward compatibility, when mounting the debugfs file system,
the tracefs file system will be automatically mounted at:
/sys/kernel/debug/tracing
Update the visl decoder driver documentation to use this tracefs path.
Signed-off-by: Ross Zwisler <zwisler@google.com>
Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Jiasheng Jiang [Mon, 19 Jun 2023 08:12:02 +0000 (16:12 +0800)]
media: vidtv: mux: Add check and kfree for kstrdup
Add check for the return value of kstrdup() and return the error
if it fails in order to avoid NULL pointer dereference.
Moreover, use kfree() in the later error handling in order to avoid
memory leak.
Fixes:
c2f78f0cb294 ("media: vidtv: psi: add a Network Information Table (NIT)")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Jiasheng Jiang [Mon, 19 Jun 2023 08:12:01 +0000 (16:12 +0800)]
media: vidtv: psi: Add check for kstrdup
Add check for the return value of kstrdup() and return the error
if it fails in order to avoid NULL pointer dereference.
Fixes:
7a7899f6f58e ("media: vidtv: psi: Implement an Event Information Table (EIT)")
Fixes:
c2f78f0cb294 ("media: vidtv: psi: add a Network Information Table (NIT)")
Fixes:
f90cf6079bf6 ("media: vidtv: add a bridge driver")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Dan Carpenter [Wed, 27 Sep 2023 12:39:43 +0000 (15:39 +0300)]
media: nuvoton: npcm-video: Fix IS_ERR() vs NULL bug
The of_parse_phandle() function returns NULL on error. It never returns
error pointers. Update the check accordingly.
Fixes:
70721089985c ("media: nuvoton: Add driver for NPCM video capture and encoding engine")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Chengfeng Ye [Tue, 26 Sep 2023 10:53:30 +0000 (10:53 +0000)]
media: s5p-mfc: Fix potential deadlock on condlock
As &dev->condlock is acquired under irq context along the following
call chain from s5p_mfc_irq(), other acquisition of the same lock
inside process context or softirq context should disable irq avoid double
lock. enc_post_frame_start() seems to be one such function that execute
under process context or softirq context.
<deadlock #1>
enc_post_frame_start()
--> clear_work_bit()
--> spin_loc(&dev->condlock)
<interrupt>
--> s5p_mfc_irq()
--> s5p_mfc_handle_frame()
--> clear_work_bit()
--> spin_lock(&dev->condlock)
This flaw was found by an experimental static analysis tool I am
developing for irq-related deadlock.
To prevent the potential deadlock, the patch change clear_work_bit()
inside enc_post_frame_start() to clear_work_bit_irqsave().
Signed-off-by: Chengfeng Ye <dg573847474@gmail.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Irui Wang [Mon, 25 Sep 2023 04:02:00 +0000 (12:02 +0800)]
media: mediatek: vcodec: add encoder power management helper functions
Remove PM functions at start/stop streaming, add PM helper functions
to get PM before encoding frame start and put PM after encoding frame
done. Meanwhile, remove unnecessary clock operations.
Signed-off-by: Irui Wang <irui.wang@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Biju Das [Sat, 23 Sep 2023 16:36:41 +0000 (17:36 +0100)]
media: tvp541x: Sort header files
Sort header files alphabetically.
Suggested-by: Jacopo Mondi <jacopo.mondi+renesas@ideasonboard.com>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Biju Das [Sat, 23 Sep 2023 16:36:40 +0000 (17:36 +0100)]
media: tvp541x: Drop CONFIG_OF ifdeffery
Drop of_match_ptr() from tvp514x_driver and get rid of ugly CONFIG_OF
if check. This slightly increases the size of tvp514x_driver on non-OF
system and shouldn't be an issue.
Add mod_devicetable.h include.
It also allows, in case if needed, to enumerate this device via ACPI with
PRP0001 magic.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Biju Das [Sat, 23 Sep 2023 16:36:39 +0000 (17:36 +0100)]
media: tvp541x: Extend match support for OF tables
The driver has an OF match table, still, it uses an ID lookup table for
retrieving match data. Currently, the driver is working on the
assumption that an I2C device registered via OF will always match a
legacy I2C device ID. The correct approach is to have an OF device ID
table using i2c_get_match_data() if the devices are registered via OF/ID.
Unify the OF/ID table by using tvp514x_reg as match data for both
these tables and replace the ID lookup table for the match data by
i2c_get_match_data() and simplifly probe().
While at it, remove the trailing comma in the terminator entry for the OF
table making code robust against (theoretical) misrebases or other similar
things where the new entry goes _after_ the termination without the
compiler noticing.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Kees Cook [Fri, 22 Sep 2023 17:49:52 +0000 (10:49 -0700)]
media: v4l2-event: Annotate struct v4l2_subscribed_event with __counted_by
Prepare for the coming implementation by GCC and Clang of the __counted_by
attribute. Flexible array members annotated with __counted_by can have
their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS
(for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family
functions).
As found with Coccinelle[1], add __counted_by for
struct v4l2_subscribed_event.
Additionally, since the element count member must be set before accessing
the annotated flexible array member, move its initialization earlier.
[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
Cc: lijian <lijian@yulong.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Kees Cook [Fri, 22 Sep 2023 17:49:36 +0000 (10:49 -0700)]
media: allegro: Annotate struct mcu_msg_push_buffers_internal with __counted_by
Prepare for the coming implementation by GCC and Clang of the __counted_by
attribute. Flexible array members annotated with __counted_by can have
their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS
(for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family
functions).
As found with Coccinelle[1], add __counted_by for
struct mcu_msg_push_buffers_internal.
[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
Cc: Michael Tretter <m.tretter@pengutronix.de>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Katya Orlova [Fri, 22 Sep 2023 11:55:06 +0000 (14:55 +0300)]
media: s3c-camif: Avoid inappropriate kfree()
s3c_camif_register_video_node() works with video_device structure stored
as a field of camif_vp, so it should not be kfreed.
But there is video_device_release() on error path that do it.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes:
babde1c243b2 ("[media] V4L: Add driver for S3C24XX/S3C64XX SoC series camera interface")
Signed-off-by: Katya Orlova <e.orlova@ispras.ru>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Ilpo Järvinen [Wed, 13 Sep 2023 12:27:40 +0000 (15:27 +0300)]
media: cobalt: Use FIELD_GET() to extract Link Width
Use FIELD_GET() to extract PCIe Negotiated and Maximum Link Width fields
instead of custom masking and shifting.
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Biju Das [Sun, 10 Sep 2023 15:22:00 +0000 (16:22 +0100)]
media: i2c: adv7180: Drop CONFIG_OF ifdeffery
Drop of_match_ptr() from adv7180_driver and get rid of ugly CONFIG_OF
if check. This slightly increases the size of adv7180_driver on non-OF
system and shouldn't be an issue.
Add mod_devicetable.h include.
It also allows, in case if needed, to enumerate this device via ACPI with
PRP0001 magic.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Biju Das [Sun, 10 Sep 2023 15:21:59 +0000 (16:21 +0100)]
media: i2c: adv7180: Extend match support for OF tables
The driver has an OF match table, still, it uses an ID lookup table for
retrieving match data. Currently, the driver is working on the
assumption that an I2C device registered via OF will always match a
legacy I2C device ID. The correct approach is to have an OF device ID
table using i2c_get_match_data() if the devices are registered via OF/ID.
Unify the OF/ID table by using struct adv7180_chip_info as match data for
both these tables and replace the ID lookup table for the match data by
i2c_get_match_data().
While at it, remove the trailing comma in the terminator entry for the OF
table making code robust against (theoretical) misrebases or other similar
things where the new entry goes _after_ the termination without the
compiler noticing.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Fei Shao [Fri, 8 Sep 2023 13:28:04 +0000 (21:28 +0800)]
media: mtk-jpegenc: Fix bug in JPEG encode quality selection
The driver uses the upper-bound approach to decide the target JPEG
encode quality, but there's a logic bug that if the desired quality is
higher than what the driver can support, the driver falls back to using
the worst quality.
Fix the bug by assuming using the best quality in the beginning, and
with trivial refactor to avoid long lines.
Fixes:
45f13a57d813 ("media: platform: Add jpeg enc feature")
Signed-off-by: Fei Shao <fshao@chromium.org>
Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Julia Lawall [Thu, 7 Sep 2023 09:55:21 +0000 (11:55 +0200)]
media: platform: mtk-mdp3: add missing of_node_put
for_each_child_of_node performs an of_node_get on each
iteration, so a break out of the loop requires an
of_node_put.
This was done using the Coccinelle semantic patch
iterators/for_each_child.cocci
Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Hans Verkuil [Thu, 7 Sep 2023 08:54:31 +0000 (10:54 +0200)]
media: Documentation: dv-timings.rst: explain basic approach
Explain how the DV Timings API and the V4L2_EVENT_SOURCE_CHANGE
event work together to handle video source changes.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Ming Qian [Thu, 7 Sep 2023 01:51:00 +0000 (09:51 +0800)]
media: amphion: handle firmware debug message
decoder firmware may notify host some debug message,
it can help analyze the state of the firmware in case of error
Fixes:
9f599f351e86 ("media: amphion: add vpu core driver")
Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Bryan O'Donoghue [Thu, 28 Sep 2023 00:58:25 +0000 (01:58 +0100)]
media: qcom: camss: Comment CSID dt_id field
Digging into the documentation we find that the DT_ID bitfield is used to
map the six bit DT to a two bit ID code. This value is concatenated to the
VC bitfield to create a CID value. DT_ID is the two least significant bits
of CID and VC the most significant bits.
Originally we set dt_id = vc * 4 in and then subsequently set dt_id = vc.
commit
3c4ed72a16bc ("media: camss: sm8250: Virtual channels for CSID")
silently fixed the multiplication by four which would give a better
value for the generated CID without mentioning what was being done or why.
Next up I haplessly changed the value back to "dt_id = vc * 4" since there
didn't appear to be any logic behind it.
Hans asked what the change was for and I honestly couldn't remember the
provenance of it, so I dug in.
Link: https://lore.kernel.org/linux-arm-msm/edd4bf9b-0e1b-883c-1a4d-50f4102c3924@xs4all.nl/
Add a comment so the next hapless programmer doesn't make this same
mistake.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Bryan O'Donoghue [Mon, 25 Sep 2023 15:47:06 +0000 (16:47 +0100)]
media: qcom: camss: Propagate vfe_reset error up the callstack
A previous patch I had removed the returns from vfe_disable() since we
didn't trap any meaningful errors. Konrad pointed out vfe_reset() could
return an error, which is true.
Trap the vfe_reset() error code and throw it up the callstack.
Suggested-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Bryan O'Donoghue [Mon, 25 Sep 2023 15:47:05 +0000 (16:47 +0100)]
media: qcom: camss: Move vfe_disable into a common routine where applicable
We can move vfe_disable() into a common routine in the core VFE file
provided we make wm_stop() a VFE specific callback.
The callback is required to capture the case where VFE 17x currently isn't
VC enabled where as VFE 480 is.
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Bryan O'Donoghue [Mon, 25 Sep 2023 15:47:04 +0000 (16:47 +0100)]
media: qcom: camss: Support RDI3 for VFE 17x
Some VFEs have four RDIs apiece. Right now the ISR code has a hard-coded
value which tops-out at RDI2 meaning only three RDIs can be utilised in
practice.
Extend out the various routines in camss-vfe-17x.c to support the higher
RDI count.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Acked-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Bryan O'Donoghue [Mon, 25 Sep 2023 15:47:03 +0000 (16:47 +0100)]
media: qcom: camss: Fix support for setting CSIPHY clock name csiphyX
Several of our upstream and soon-to-be upstream SoC CAMSS dtsi declare
csiphyX as opposed to the older clock name csiX_phy.
Right now the CAMSS code will fail to set the csiphyX clock even if we have
declared it in our list of clocks. For sdm845 and sm8250 we appear to "get
away" with this error, however on sc8280xp we don't.
The right approach here is to set the clock when it is declared. If a SoC
doesn't require or a SoC driver implementer doesn't think we need, then the
clock ought to simply be omitted from the clock list.
Include csiphyX in the set of permissible strings which will subsequently
lead to the csiphyX clock being set during csiphy_set_clock_rates() phase.
sdm845 and sm8250 will work with the code as-is so I've omitted this from a
suggested Fixes list.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Bryan O'Donoghue [Mon, 25 Sep 2023 15:47:02 +0000 (16:47 +0100)]
media: qcom: camss: Functionally decompose CSIPHY clock lookups
The csiphyX_timer and csiX_phy values need not be hard-coded. We can
functionally decompose the string matching inside of a loop.
Static string values are brittle, difficult to extend and not required
anyway since the camss->res->csiphy_num value informs us of the number
of CSIPHYs and hence the set of potential clocks for a given CSIPHY.
In simple terms if we have five CSIPHYs we can have no more and no less
than five csiphy_timer clocks. Similarly csi_phy core clocks have a 1:1
relationship with the PHY they clock.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Bryan O'Donoghue [Mon, 25 Sep 2023 15:47:01 +0000 (16:47 +0100)]
media: qcom: camss: Allow clocks vfeN vfe_liteN or vfe_lite
The number of Video Front End - VFE or Image Front End - IFE supported
with new SoCs can vary both for the full and lite cases.
For example sdm845 has one vfe_lite and two vfe interfaces with the vfe
clock called simply "vfe_lite" with no integer postfix. sc8280xp has four
vfe and four vfe lite blocks.
At the moment we declare vfe_lite0 and vfe_lite1 for sm8250 but never set
those clocks because we don't match the strings.
We need to support the following clock name formats
- vfeN
- vfe_liteN
- vfe_lite
with N being any reasonably sized integer.
There are two sites in this code which need to do the same thing,
constructing and matching strings with the pattern above, so encapsulate
the logic in one function.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Bryan O'Donoghue [Mon, 25 Sep 2023 15:47:00 +0000 (16:47 +0100)]
media: qcom: camss: Untangle if/else spaghetti in camss
We have a very convoluted if/else legacy here which needs to be
rationalised to make it more sustainable.
Adding in another Soc or two will make some of these if statements into
increasingly large multi-clause behemoths.
Introduce switches in the obvious places to despaghetiify.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Acked-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Bryan O'Donoghue [Mon, 25 Sep 2023 15:46:59 +0000 (16:46 +0100)]
media: qcom: camss: Remove special case for VFE get/put
From sdm845 onwards we need to ensure the VFE is powered on prior to
switching on the CSID.
Currently the code tests for sdm845, sm8250 and then does get/set. This is
not extensible and it turns out is not necessary either since vfe_get and
vfe_set reference count.
Remove the over-conservative SoC version check.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> # rb3 # db410c
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Bryan O'Donoghue [Mon, 25 Sep 2023 15:46:58 +0000 (16:46 +0100)]
media: qcom: camss: Assign the correct number of RDIs per VFE
Each Video Front End - VFE - has a variable number of Raw Data Interfaces -
RDIs associated with it.
The CAMSS code started from a naive implementation where a fixed define was
used as a control in a for(){} loop iterating through RDIs.
That model scales badly. An attempt was made with VFE_LINE_NUM_GEN2 and
VFE_LINE_NUM_GEN1 to differentiate between SoCs but, the problem with that
is "gen1" and "gen2" have no meaning in the silicon. There is no fixed
constraint in the silicon between VFE and RDI, it is entirely up to the SoC
designers how many VFEs are populated and how many RDIs to associate with
each VFE.
As an example sdm845 has VFE version 175 and sm8250 VFE version 480.
sdm845 has 2 VFEs with 4 RDIs and 1 VFE Lite with 4 RDIs.
sm8250 has 2 VFEs with 3 RDIs and 2 VFE Lite with 4 RDIs.
Clearly then we need a more granular model to capture the necessary data.
The defines have gone away to be replaced with per-SoC data but, we haven't
populated the parameter data with the real values.
Let's call those values out now
msm8916:
1 x VFE
3 x RDI per VFE (not 4)
msm8996:
2 x VFE
3 x RDI per VFE (not 4)
sdm660:
2 x VFE
3 x RDI per VFE (not 4)
sdm845:
2 x VFE
4 x RDI per VFE (not 3)
1 x VFE Lite
4 x RDI per VFE Lite (not 3)
sm8250:
2 x VFE
3 x RDI per VFE (not 4)
2 x VFE Lite
4 x RDI per VFE Lite
This more complex and correct mapping was not possible prior to passing
values via driver data. Now that we have that change in place we can
correctly map VFEs to RDIs for each VFE.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Acked-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Bryan O'Donoghue [Mon, 25 Sep 2023 15:46:57 +0000 (16:46 +0100)]
media: qcom: camss: Pass CAMSS subdev callbacks via resource ops pointer
It is possible to pass all of the CAMSS subdevice internal operations
pointers from the controlling resources structure with an additional
pointer added to the resources structure.
This allows for the removal of most of the probe-time control structures.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Bryan O'Donoghue [Mon, 25 Sep 2023 15:46:56 +0000 (16:46 +0100)]
media: qcom: camss: Pass line_num from compat resources
line_num indicates the number of RDI - raw data interface channels which
are associated with a given IFE/VFE - image/video front end.
On several SoCs the RDI number is not static for each VFE - for example
on sm8250 VFE Lite has four RDIs where regular VFE has three.
Assigning line_num statically in the subdev_init() phase initialises
each VFE to the lower number, meaning in practical terms that we are
lobbing off one RDI on some VFEs.
Interrupt handling uses static for (i = RDI0; i < RDI2; i++) {} in some
of our VFE blocks but this can't work for situations where we have a
mixture of VFE @ 3 RDI and VFE-lite @ 4 RDI blocks.
First step to remediate is to pass line_num from a compat string
controlled data-structure and do so on a per-VFE basis.
Later patches will assign the correct number of RDI blocks per VFE.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Bryan O'Donoghue [Mon, 25 Sep 2023 15:46:55 +0000 (16:46 +0100)]
media: qcom: camss: Pass remainder of variables as resources
The following variables are being assigned statically based on
compatible strings in the probe path.
* enum camss_version version;
* unsigned int csiphy_num;
* unsigned int csid_num;
* unsigned int vfe_num;
* unsigned int vfe_lite_num;
* unsigned int vfe_total_num;
Migrate those variables to resource parameters passed in on platform
probe arguments. The one caveat is for VFE it has been necessary to
intoduce a new variable vfe_total_num to capture the aggregate value of
vfe_num + vfe_lite_num.
All the rest of the changes are rote camss->variable to
camss->res->variable with the parameter tables now populating the listed
variables.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Acked-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Bryan O'Donoghue [Mon, 25 Sep 2023 15:46:54 +0000 (16:46 +0100)]
media: qcom: camss: Pass icc bandwidth table as a platform parameter
Pass the bandwidth table as a platform parameter not if/else derived
pointer to the static table.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Acked-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Bryan O'Donoghue [Mon, 25 Sep 2023 15:46:53 +0000 (16:46 +0100)]
media: qcom: camss: Start to move to module compat matched resources
There is a lot of unnecessary if/elsing in this code that arguably
should never have made it upstream when adding a second let alone
subsequent SoC.
I'm guilty of not fixing the mess myself when adding in the sm8250.
Before adding in any new SoCs or resources lets take the time to cleanup
the resource passing.
First step is to pass the generic struct camss_resources as a parameter
per the compatible list.
Subsequent patches will address the other somewhat disparate strutures
which we are also doing if/else on and assigning statically.
Squashed down a commit to drop useless NULL assignment for ispif resources.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Acked-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Bryan O'Donoghue [Mon, 25 Sep 2023 15:46:52 +0000 (16:46 +0100)]
media: qcom: camss: Rename camss struct resources to camss_subdev_resources
Rename non-specific struct resources {} to struct camss_subdev_resources {}
Each logical block in CAMSS has a number of regulators, clocks and resets
associated with it. We represent these blocks as v4l subdevices.
The name "struct camss_subdev_resources" is a more descriptive and accurate
name.
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Bryan O'Donoghue [Mon, 25 Sep 2023 15:46:51 +0000 (16:46 +0100)]
media: qcom: camss: Amalgamate struct resource with struct resource_ispif
There is no good reason to differentiate the two resource structures
here. As part of a general tidyup of the declaration and passing of
resources within in the CAMSS driver it will be advantageous to have
one unified resource structure.
The two structures are very similar anyway thus leading more credence
still to the argument there should be only one.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Acked-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Martin Tůma [Mon, 25 Sep 2023 14:36:05 +0000 (16:36 +0200)]
media: Documentation: Added Digiteq Automotive MGB4 driver documentation
The "admin-guide" documentation for the Digiteq Automotive MGB4 driver.
Signed-off-by: Martin Tůma <martin.tuma@digiteqautomotive.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Martin Tůma [Mon, 25 Sep 2023 14:36:04 +0000 (16:36 +0200)]
media: pci: mgb4: Added Digiteq Automotive MGB4 driver
Digiteq Automotive MGB4 is a modular frame grabber PCIe card for automotive
video interfaces. As for now, two modules - FPD-Link and GMSL - are
available and supported by the driver. The card has two inputs and two
outputs (FPD-Link only).
In addition to the video interfaces it also provides a trigger signal
interface and a MTD interface for FPGA firmware upload.
Signed-off-by: Martin Tůma <martin.tuma@digiteqautomotive.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Hans Verkuil [Sat, 23 Sep 2023 15:21:07 +0000 (17:21 +0200)]
media: radio-si476x: don't fill in bus_info
Let the V4L2 core fill in bus_info.
This fixes this warning:
drivers/media/radio/radio-si476x.c: In function 'si476x_radio_querycap':
drivers/media/radio/radio-si476x.c:333:28: warning: '%s' directive output may be truncated writing up to 35 bytes into a region of size 23 [-Wformat-truncation=]
333 | "platform:%s", radio->v4l2dev.name);
| ^~
drivers/media/radio/radio-si476x.c:332:9: note: 'snprintf' output between 10 and 45 bytes into a destination of size 32
332 | snprintf(capability->bus_info, sizeof(capability->bus_info),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
333 | "platform:%s", radio->v4l2dev.name);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Hans Verkuil [Sat, 23 Sep 2023 15:21:06 +0000 (17:21 +0200)]
media: verisilicon: replace snprintf with strscpy+strlcat
Fixes this warning:
drivers/media/platform/verisilicon/hantro_drv.c: In function 'hantro_add_func':
drivers/media/platform/verisilicon/hantro_drv.c:902:49: warning: '%s' directive output may be truncated writing up to 127 bytes into a region of size 64 [-Wformat-truncation=]
902 | snprintf(vfd->name, sizeof(vfd->name), "%s-%s", match->compatible,
| ^~
drivers/media/platform/verisilicon/hantro_drv.c:902:9: note: 'snprintf' output between 5 and 132 bytes into a destination of size 64
902 | snprintf(vfd->name, sizeof(vfd->name), "%s-%s", match->compatible,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
903 | funcid == MEDIA_ENT_F_PROC_VIDEO_ENCODER ? "enc" : "dec");
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/platform/verisilicon/hantro_drv.c:902:49: warning: '%s' directive output may be truncated writing up to 127 bytes into a region of size 64 [-Wformat-truncation=]
902 | snprintf(vfd->name, sizeof(vfd->name), "%s-%s", match->compatible,
| ^~
drivers/media/platform/verisilicon/hantro_drv.c:902:9: note: 'snprintf' output between 5 and 132 bytes into a destination of size 64
902 | snprintf(vfd->name, sizeof(vfd->name), "%s-%s", match->compatible,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
903 | funcid == MEDIA_ENT_F_PROC_VIDEO_ENCODER ? "enc" : "dec");
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Hans Verkuil [Sat, 23 Sep 2023 15:21:05 +0000 (17:21 +0200)]
media: radio-miropcm20: set bus_info to explicit name
Fill in bus_info with fixed name.
This fixes this compiler warning:
drivers/media/radio/radio-miropcm20.c: In function 'vidioc_querycap':
drivers/media/radio/radio-miropcm20.c:206:57: warning: '%s' directive output may be truncated writing up to 35 bytes into a region of size 28 [-Wformat-truncation=]
206 | snprintf(v->bus_info, sizeof(v->bus_info), "ISA:%s", dev->v4l2_dev.name);
| ^~
drivers/media/radio/radio-miropcm20.c:206:9: note: 'snprintf' output between 5 and 40 bytes into a destination of size 32
206 | snprintf(v->bus_info, sizeof(v->bus_info), "ISA:%s", dev->v4l2_dev.name);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Hans Verkuil [Sat, 23 Sep 2023 15:21:04 +0000 (17:21 +0200)]
media: radio-isa: use dev_name to fill in bus_info
This fixes this warning:
drivers/media/radio/radio-isa.c: In function 'radio_isa_querycap':
drivers/media/radio/radio-isa.c:39:57: warning: '%s' directive output may be truncated writing up to 35 bytes into a region of size 28 [-Wformat-truncation=]
39 | snprintf(v->bus_info, sizeof(v->bus_info), "ISA:%s", isa->v4l2_dev.name);
| ^~
drivers/media/radio/radio-isa.c:39:9: note: 'snprintf' output between 5 and 40 bytes into a destination of size 32
39 | snprintf(v->bus_info, sizeof(v->bus_info), "ISA:%s", isa->v4l2_dev.name);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Hans Verkuil [Sat, 23 Sep 2023 15:21:03 +0000 (17:21 +0200)]
media: atmel: drop bus_info
Let the V4L2 core fill this in.
Fixes this warning:
drivers/staging/media/deprecated/atmel/atmel-isc-base.c: In function 'isc_querycap':
drivers/staging/media/deprecated/atmel/atmel-isc-base.c:496:28: warning: '%s' directive output may be truncated writing up to 35 bytes into a region of size 23 [-Wformat-truncation=]
496 | "platform:%s", isc->v4l2_dev.name);
| ^~
drivers/staging/media/deprecated/atmel/atmel-isc-base.c:495:9: note: 'snprintf' output between 10 and 45 bytes into a destination of size 32
495 | snprintf(cap->bus_info, sizeof(cap->bus_info),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
496 | "platform:%s", isc->v4l2_dev.name);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Hans Verkuil [Sat, 23 Sep 2023 15:21:02 +0000 (17:21 +0200)]
media: am437x: don't fill in bus_info
Let the V4L2 core fill this in.
This fixes this warning:
drivers/media/platform/ti/am437x/am437x-vpfe.c: In function 'vpfe_querycap':
drivers/media/platform/ti/am437x/am437x-vpfe.c:1279:35: warning: '%s' directive output may be truncated writing up to 35 bytes into a region of size 23 [-Wformat-truncation=]
1279 | "platform:%s", vpfe->v4l2_dev.name);
| ^~
drivers/media/platform/ti/am437x/am437x-vpfe.c:1278:9: note: 'snprintf' output between 10 and 45 bytes into a destination of size 32
1278 | snprintf(cap->bus_info, sizeof(cap->bus_info),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1279 | "platform:%s", vpfe->v4l2_dev.name);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: Lad Prabhakar <prabhakar.csengg@gmail.com>
Hans Verkuil [Sat, 23 Sep 2023 15:21:01 +0000 (17:21 +0200)]
media: rcar_drif: use explicit name for bus_info
Fixes this compiler warning:
drivers/media/platform/renesas/rcar_drif.c: In function 'rcar_drif_querycap':
drivers/media/platform/renesas/rcar_drif.c:874:66: warning: '%s' directive output may be truncated writing up to 63 bytes into a region of size 23 [-Wformat-truncation=]
874 | snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
| ^~
drivers/media/platform/renesas/rcar_drif.c:874:9: note: 'snprintf' output between 10 and 73 bytes into a destination of size 32
874 | snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
875 | sdr->vdev->name);
| ~~~~~~~~~~~~~~~~
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Hans Verkuil [Sat, 23 Sep 2023 15:21:00 +0000 (17:21 +0200)]
media: microchip: don't set bus_info
Let the V4L2 core fill this in.
Fixes these compiler warnings:
drivers/media/platform/microchip/microchip-isc-base.c: In function 'isc_querycap':
drivers/media/platform/microchip/microchip-isc-base.c:486:28: warning: '%s' directive output may be truncated writing up to 35 bytes into a region of size 23 [-Wformat-truncation=]
486 | "platform:%s", isc->v4l2_dev.name);
| ^~
drivers/media/platform/microchip/microchip-isc-base.c:485:9: note: 'snprintf' output between 10 and 45 bytes into a destination of size 32
485 | snprintf(cap->bus_info, sizeof(cap->bus_info),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
486 | "platform:%s", isc->v4l2_dev.name);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/platform/microchip/microchip-isc-base.c: In function 'isc_mc_init':
drivers/media/platform/microchip/microchip-isc-base.c:1996:76: warning: '%s' directive output may be truncated writing up to 35 bytes into a region of size 23 [-Wformat-truncation=]
1996 | snprintf(isc->mdev.bus_info, sizeof(isc->mdev.bus_info), "platform:%s",
| ^~
drivers/media/platform/microchip/microchip-isc-base.c:1996:9: note: 'snprintf' output between 10 and 45 bytes into a destination of size 32
1996 | snprintf(isc->mdev.bus_info, sizeof(isc->mdev.bus_info), "platform:%s",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1997 | isc->v4l2_dev.name);
| ~~~~~~~~~~~~~~~~~~~
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Hans Verkuil [Sat, 23 Sep 2023 15:20:59 +0000 (17:20 +0200)]
media: vivid: use VIVID_MODULE_NAME to fill bus_info
Fixes this compiler warning:
drivers/media/test-drivers/vivid/vivid-core.c: In function 'vidioc_querycap':
drivers/media/test-drivers/vivid/vivid-core.c:243:35: warning: '%s' directive output may be truncated writing up to 35 bytes into a region of size 23 [-Wformat-truncation=]
243 | "platform:%s", dev->v4l2_dev.name);
| ^~
drivers/media/test-drivers/vivid/vivid-core.c:242:9: note: 'snprintf' output between 10 and 45 bytes into a destination of size 32
242 | snprintf(cap->bus_info, sizeof(cap->bus_info),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
243 | "platform:%s", dev->v4l2_dev.name);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Hans Verkuil [Sat, 23 Sep 2023 15:20:58 +0000 (17:20 +0200)]
media: v4l2-device.h: drop V4L2_DEVICE_NAME_SIZE
Don't use defines for the size of a name field, everyone
should just use sizeof(). In this case it was never used,
but it is bad practice, so just drop it.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Hans Verkuil [Sat, 23 Sep 2023 15:20:57 +0000 (17:20 +0200)]
media: use sizeof() instead of V4L2_SUBDEV_NAME_SIZE
Don't rely on a define, let the compiler use the actual
field size.
Remove all uses of the V4L2_SUBDEV_NAME_SIZE define and also
drop the define itself.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Tested-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Hans Verkuil [Sat, 23 Sep 2023 15:20:56 +0000 (17:20 +0200)]
media: v4l2-subdev.h: increase struct v4l2_subdev name size
This resolves a lot of the string truncate compiler warnings.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Hans Verkuil [Sat, 23 Sep 2023 15:20:55 +0000 (17:20 +0200)]
media: v4l2-dev.h: increase struct video_device name size
Increase the size of the name field to prevent a lot of
string truncate compiler warnings.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Hans Verkuil [Sat, 23 Sep 2023 15:20:54 +0000 (17:20 +0200)]
media: zoran: increase name size
Fixes this compiler warning:
drivers/media/pci/zoran/zoran_card.c: In function 'zoran_probe':
drivers/media/pci/zoran/zoran_card.c:1316:62: warning: '%u' directive output may be truncated writing between 1 and 5 bytes into a region of size between 0 and 31 [-Wformat-truncation=]
1316 | snprintf(ZR_DEVNAME(zr), sizeof(ZR_DEVNAME(zr)), "%s[%u]",
| ^~
drivers/media/pci/zoran/zoran_card.c:1316:58: note: directive argument in the range [0, 65535]
1316 | snprintf(ZR_DEVNAME(zr), sizeof(ZR_DEVNAME(zr)), "%s[%u]",
| ^~~~~~~~
drivers/media/pci/zoran/zoran_card.c:1316:9: note: 'snprintf' output between 4 and 39 bytes into a destination of size 32
1316 | snprintf(ZR_DEVNAME(zr), sizeof(ZR_DEVNAME(zr)), "%s[%u]",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1317 | zr->card.name, zr->id);
| ~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Hans Verkuil [Sat, 23 Sep 2023 15:20:53 +0000 (17:20 +0200)]
media: renesas-ceu: keep input name simple
Just show the Camera index as input name in VIDIOC_ENUM_INPUT,
no need to show the subdev name as well as that is meaningless for
users anyway.
This fixes this compiler warning:
drivers/media/platform/renesas/renesas-ceu.c: In function 'ceu_enum_input':
drivers/media/platform/renesas/renesas-ceu.c:1195:59: warning: '%s' directive output may be truncated writing up to 47 bytes into a region of size between 14 and 23 [-Wformat-truncation=]
1195 | snprintf(inp->name, sizeof(inp->name), "Camera%u: %s",
| ^~
drivers/media/platform/renesas/renesas-ceu.c:1195:9: note: 'snprintf' output between 10 and 66 bytes into a destination of size 32
1195 | snprintf(inp->name, sizeof(inp->name), "Camera%u: %s",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1196 | inp->index, ceusd->v4l2_sd->name);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Hans Verkuil [Sat, 23 Sep 2023 15:20:52 +0000 (17:20 +0200)]
media: cec.h: increase input_phys buffer
Fixes this compiler warning:
drivers/media/cec/core/cec-core.c: In function 'cec_allocate_adapter':
drivers/media/cec/core/cec-core.c:317:21: warning: '/input0' directive output may be truncated writing 7 bytes into a region of size between 1 and 32 [-Wformat-truncation=]
317 | "%s/input0", adap->name);
| ^~~~~~~
drivers/media/cec/core/cec-core.c:316:9: note: 'snprintf' output between 8 and 39 bytes into a destination of size 32
316 | snprintf(adap->input_phys, sizeof(adap->input_phys),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
317 | "%s/input0", adap->name);
| ~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Hans Verkuil [Sat, 23 Sep 2023 15:20:51 +0000 (17:20 +0200)]
media: rc: ati_remote: increase mouse_name buffer size
Fixes this compiler warning:
drivers/media/rc/ati_remote.c: In function 'ati_remote_probe':
drivers/media/rc/ati_remote.c:876:21: warning: ' mouse' directive output may be truncated writing 6 bytes into a region of size between 1 and 80 [-Wformat-truncation=]
876 | "%s mouse", ati_remote->rc_name);
| ^~~~~~
drivers/media/rc/ati_remote.c:875:9: note: 'snprintf' output between 7 and 86 bytes into a destination of size 80
875 | snprintf(ati_remote->mouse_name, sizeof(ati_remote->mouse_name),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
876 | "%s mouse", ati_remote->rc_name);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: Sean Young <sean@mess.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Hans Verkuil [Sat, 23 Sep 2023 15:20:50 +0000 (17:20 +0200)]
media: cx18: increase in_workq_name size
Fixes this compiler warning:
drivers/media/pci/cx18/cx18-driver.c: In function 'cx18_init_struct1':
drivers/media/pci/cx18/cx18-driver.c:688:65: warning: '%s' directive output may be truncated writing up to 35 bytes into a region of size 11 [-Wformat-truncation=]
688 | snprintf(cx->in_workq_name, sizeof(cx->in_workq_name), "%s-in",
| ^~
In function 'cx18_create_in_workq',
inlined from 'cx18_init_struct1' at drivers/media/pci/cx18/cx18-driver.c:724:8:
drivers/media/pci/cx18/cx18-driver.c:688:9: note: 'snprintf' output between 4 and 39 bytes into a destination of size 11
688 | snprintf(cx->in_workq_name, sizeof(cx->in_workq_name), "%s-in",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
689 | cx->v4l2_dev.name);
| ~~~~~~~~~~~~~~~~~~
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Hans Verkuil [Sat, 23 Sep 2023 15:20:49 +0000 (17:20 +0200)]
media: ipu-bridge: increase sensor_name size
Fixes this compiler warning:
In file included from include/linux/property.h:14,
from include/linux/acpi.h:16,
from drivers/media/pci/intel/ipu-bridge.c:4:
In function 'ipu_bridge_init_swnode_names',
inlined from 'ipu_bridge_create_connection_swnodes' at drivers/media/pci/intel/ipu-bridge.c:445:2,
inlined from 'ipu_bridge_connect_sensor' at drivers/media/pci/intel/ipu-bridge.c:656:3:
include/linux/fwnode.h:81:49: warning: '%u' directive output may be truncated writing between 1 and 3 bytes into a region of size 2 [-Wformat-truncation=]
81 | #define SWNODE_GRAPH_PORT_NAME_FMT "port@%u"
| ^~~~~~~~~
drivers/media/pci/intel/ipu-bridge.c:384:18: note: in expansion of macro 'SWNODE_GRAPH_PORT_NAME_FMT'
384 | SWNODE_GRAPH_PORT_NAME_FMT, sensor->link);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/fwnode.h: In function 'ipu_bridge_connect_sensor':
include/linux/fwnode.h:81:55: note: format string is defined here
81 | #define SWNODE_GRAPH_PORT_NAME_FMT "port@%u"
| ^~
In function 'ipu_bridge_init_swnode_names',
inlined from 'ipu_bridge_create_connection_swnodes' at drivers/media/pci/intel/ipu-bridge.c:445:2,
inlined from 'ipu_bridge_connect_sensor' at drivers/media/pci/intel/ipu-bridge.c:656:3:
include/linux/fwnode.h:81:49: note: directive argument in the range [0, 255]
81 | #define SWNODE_GRAPH_PORT_NAME_FMT "port@%u"
| ^~~~~~~~~
drivers/media/pci/intel/ipu-bridge.c:384:18: note: in expansion of macro 'SWNODE_GRAPH_PORT_NAME_FMT'
384 | SWNODE_GRAPH_PORT_NAME_FMT, sensor->link);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/pci/intel/ipu-bridge.c:382:9: note: 'snprintf' output between 7 and 9 bytes into a destination of size 7
382 | snprintf(sensor->node_names.remote_port,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
383 | sizeof(sensor->node_names.remote_port),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
384 | SWNODE_GRAPH_PORT_NAME_FMT, sensor->link);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Hans Verkuil [Sat, 23 Sep 2023 15:20:48 +0000 (17:20 +0200)]
media: vivid: avoid integer overflow
Fixes these compiler warnings:
drivers/media/test-drivers/vivid/vivid-rds-gen.c: In function 'vivid_rds_gen_fill':
drivers/media/test-drivers/vivid/vivid-rds-gen.c:147:56: warning: '.' directive output may be truncated writing 1 byte into a region of size between 0 and 3 [-Wformat-truncation=]
147 | snprintf(rds->psname, sizeof(rds->psname), "%6d.%1d",
| ^
drivers/media/test-drivers/vivid/vivid-rds-gen.c:147:52: note: directive argument in the range [0, 9]
147 | snprintf(rds->psname, sizeof(rds->psname), "%6d.%1d",
| ^~~~~~~~~
drivers/media/test-drivers/vivid/vivid-rds-gen.c:147:9: note: 'snprintf' output between 9 and 12 bytes into a destination of size 9
147 | snprintf(rds->psname, sizeof(rds->psname), "%6d.%1d",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
148 | freq / 16, ((freq & 0xf) * 10) / 16);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Hans Verkuil [Sat, 23 Sep 2023 15:20:47 +0000 (17:20 +0200)]
media: atomisp: ia_ccs_debug.c: increase enable_info buffer
Fixes these compiler warnings:
drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c: In function 'ia_css_debug_pipe_graph_dump_stage':
drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c:2786:66: warning: '\n' directive output may be truncated writing 2 bytes into a region of size between 0 and 198 [-Wformat-truncation=]
2786 | "%s\\n%s\\n%s",
| ^~~
drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c:2785:49: note: 'snprintf' output between 5 and 302 bytes into a destination of size 200
2785 | snprintf(enable_info, sizeof(enable_info),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2786 | "%s\\n%s\\n%s",
| ~~~~~~~~~~~~~~~
2787 | enable_info1, enable_info2,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
2788 | enable_info3);
| ~~~~~~~~~~~~~
drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c:2772:66: warning: '\n' directive output may be truncated writing 2 bytes into a region of size between 0 and 198 [-Wformat-truncation=]
2772 | "%s\\n%s\\n%s",
| ^~~
drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c:2771:49: note: 'snprintf' output between 5 and 302 bytes into a destination of size 200
2771 | snprintf(enable_info, sizeof(enable_info),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2772 | "%s\\n%s\\n%s",
| ~~~~~~~~~~~~~~~
2773 | enable_info1, enable_info2,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
2774 | enable_info3);
| ~~~~~~~~~~~~~
drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c:2749:92: warning: 'snprintf' output may be truncated before the last format character [-Wformat-truncation=]
2749 | snprintf(enable_info, sizeof(enable_info), "%s\\n%s",
| ^
drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c:2749:41: note: 'snprintf' output between 3 and 201 bytes into a destination of size 200
2749 | snprintf(enable_info, sizeof(enable_info), "%s\\n%s",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2750 | enable_info1, enable_info2);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Hans Verkuil [Sat, 23 Sep 2023 15:20:46 +0000 (17:20 +0200)]
media: cadence: increase buffer size in csi2tx_get_resources()
Fixes this compiler warning:
drivers/media/platform/cadence/cdns-csi2tx.c: In function 'csi2tx_get_resources':
drivers/media/platform/cadence/cdns-csi2tx.c:485:63: warning: '%u' directive output may be truncated writing between 1 and 10 bytes into a region of size 8 [-Wformat-truncation=]
485 | snprintf(clk_name, sizeof(clk_name), "pixel_if%u_clk", i);
| ^~
drivers/media/platform/cadence/cdns-csi2tx.c:485:54: note: directive argument in the range [0,
4294967294]
485 | snprintf(clk_name, sizeof(clk_name), "pixel_if%u_clk", i);
| ^~~~~~~~~~~~~~~~
drivers/media/platform/cadence/cdns-csi2tx.c:485:17: note: 'snprintf' output between 14 and 23 bytes into a destination of size 16
485 | snprintf(clk_name, sizeof(clk_name), "pixel_if%u_clk", i);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: Maxime Ripard <mripard@kernel.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Hans Verkuil [Sat, 23 Sep 2023 15:20:45 +0000 (17:20 +0200)]
media: allegro-dvt: increase buffer size in msg_type_name()
Fixes this compile error
drivers/media/platform/allegro-dvt/allegro-mail.c: In function 'msg_type_name':
drivers/media/platform/allegro-dvt/allegro-mail.c:37:48: warning: '%04x' directive output may be truncated writing between 4 and 8 bytes into a region of size 6 [-Wformat-truncation=]
37 | snprintf(buf, sizeof(buf), "(0x%04x)", type);
| ^~~~
drivers/media/platform/allegro-dvt/allegro-mail.c:37:44: note: directive argument in the range [1,
4294967295]
37 | snprintf(buf, sizeof(buf), "(0x%04x)", type);
| ^~~~~~~~~~
drivers/media/platform/allegro-dvt/allegro-mail.c:37:17: note: 'snprintf' output between 9 and 13 bytes into a destination of size 9
37 | snprintf(buf, sizeof(buf), "(0x%04x)", type);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: Michael Tretter <m.tretter@pengutronix.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Hans Verkuil [Tue, 26 Sep 2023 09:27:09 +0000 (11:27 +0200)]
media: atomisp: fix 'read beyond size of field'
If CONFIG_FORTIFY_SOURCE=y, then this warning is produced:
In file included from ./include/linux/string.h:254,
from ./include/linux/bitmap.h:11,
from ./include/linux/cpumask.h:12,
from ./arch/x86/include/asm/cpumask.h:5,
from ./arch/x86/include/asm/msr.h:11,
from ./arch/x86/include/asm/processor.h:23,
from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:60,
from ./arch/x86/include/asm/preempt.h:9,
from ./include/linux/preempt.h:79,
from ./include/linux/spinlock.h:56,
from ./include/linux/mmzone.h:8,
from ./include/linux/gfp.h:7,
from ./include/linux/slab.h:16,
from ./drivers/staging/media/atomisp//include/hmm/hmm.h:26,
from drivers/staging/media/atomisp/pci/sh_css_params.c:26:
In function ‘fortify_memcpy_chk’,
inlined from ‘sh_css_store_sp_group_to_ddr’ at drivers/staging/media/atomisp/pci/sh_css_params.c:3736:3:
./include/linux/fortify-string.h:592:25: warning: call to ‘__read_overflow2_field’ declared with attribute warning: detected read beyond size of field (2nd parameter); maybe use struct_group()?
[-Wattribute-warning]
592 | __read_overflow2_field(q_size_field, size);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The reason is that the memcpy copies two fields (each a u8), when the source
pointer points to the first field. It's a bit unexpected, so just make this
explicit.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Hans de Goede [Sun, 13 Aug 2023 15:26:45 +0000 (17:26 +0200)]
media: atomisp: Drop atomisp-ov5693 sensor driver
After recent improvements to atomisp driver, the atomisp driver
now works fine with the standard ov5693 driver.
Drop the no longer necessary atomisp specific atomisp-ov5693
sensor driver.
Link: https://lore.kernel.org/r/20230813152645.45834-2-hdegoede@redhat.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Hans de Goede [Sun, 13 Aug 2023 15:26:44 +0000 (17:26 +0200)]
media: atomisp: Disable VCM for OV5693 for now
ov5693 sensor modules have a VCM, but for unknown reasons
the sensor fails to start streaming when instantiating
a VCM i2c-client (and the runtime-pm link between VCM
and sensor).
Disable the VCM for now, until this is resolved.
Link: https://lore.kernel.org/r/20230813152645.45834-1-hdegoede@redhat.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Hans de Goede [Sat, 12 Aug 2023 13:36:28 +0000 (15:36 +0200)]
media: atomisp: gc0310: Stop setting v4l2_subdev.fwnode to the endpoint fwnode
Endpoint matching is now handled by the v4l2-core and drivers no longer
should set v4l2_subdev.fwnode to the endpoint fwnode.
Link: https://lore.kernel.org/r/20230812133628.355812-1-hdegoede@redhat.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Hans de Goede [Sat, 12 Aug 2023 13:35:23 +0000 (15:35 +0200)]
media: atomisp: Drop VIDEO_ATOMISP_ISP2401 Kconfig option
Drop the VIDEO_ATOMISP_ISP2401 Kconfig option and the -DISP2401
cflags.
This is no longer necessary since all ISP2400 vs ISP2401 differences
are now dealt with at runtime.
Many thanks to Kate Hsuan for all her work on this.
Link: https://lore.kernel.org/r/20230812133523.355581-2-hdegoede@redhat.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Hans de Goede [Sat, 12 Aug 2023 13:35:22 +0000 (15:35 +0200)]
media: atomisp: Drop ia_css_debug_dump_debug_info() and functions only used by it
ia_css_debug_dump_debug_info() is defined but never called anywhere,
drop it.
Also drop all the other ia_css_debug_dump_* functions only called by
ia_css_debug_dump_debug_info(), as well as *_get_state() functions only
used by those.
Link: https://lore.kernel.org/r/20230812133523.355581-1-hdegoede@redhat.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Hans de Goede [Sat, 12 Aug 2023 10:46:12 +0000 (12:46 +0200)]
media: atomisp: Simplify some if (IS_ISP2401...) statements
Replace:
if (!IS_ISP2401 || (IS_ISP2401 && xxx))
with:
if (!IS_ISP2401 || xxx)
If the right side of the '||' needs to be evaluated then it is
already known that IS_ISP2401 is true, so no need to check for it.
Link: https://lore.kernel.org/r/20230812104612.38806-1-hdegoede@redhat.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Kate Hsuan [Wed, 2 Aug 2023 09:56:06 +0000 (11:56 +0200)]
media: atomisp: atomisp_v4l2: Removed unnecessary code
Here is the last step of #ifdef ISP2401 removal work. Since the driver
became generic, this part of the code was no longer needed and can
be removed.
Link: https://lore.kernel.org/r/20230802095606.1298152-13-hpa@redhat.com
Signed-off-by: Kate Hsuan <hpa@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Kate Hsuan [Wed, 2 Aug 2023 09:56:05 +0000 (11:56 +0200)]
media: atomisp: sh_css: Removed #ifdef ISP2401 to make the driver generic
Removed #ifdef ISP2401 to make the driver generic.
Link: https://lore.kernel.org/r/20230802095606.1298152-12-hpa@redhat.com
Signed-off-by: Kate Hsuan <hpa@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Kate Hsuan [Wed, 2 Aug 2023 09:56:04 +0000 (11:56 +0200)]
media: atomisp: sh_css: Removed #ifdef ISP2401 to make code generic
Removed #ifdef ISP2401 to allow the destroy function can destroy the
data of both types of ISP.
Link: https://lore.kernel.org/r/20230802095606.1298152-11-hpa@redhat.com
Signed-off-by: Kate Hsuan <hpa@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Kate Hsuan [Wed, 2 Aug 2023 09:56:03 +0000 (11:56 +0200)]
media: atomisp: sh_css: Renamed sh_css_config_input_network()
sh_css_config_input_network() is renamed to
sh_css_config_input_network_2400() and sh_css_config_input_network_2401()
since a generic driver should cover the implementation for both types.
Link: https://lore.kernel.org/r/20230802095606.1298152-10-hpa@redhat.com
Signed-off-by: Kate Hsuan <hpa@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Kate Hsuan [Wed, 2 Aug 2023 09:56:02 +0000 (11:56 +0200)]
media: atomisp: sh_css: Removed #ifdef ISP2401 to make driver generic
Removed #ifdef ISP2401 to expose ia_css_stream_configure_rx() for ISP2400.
Link: https://lore.kernel.org/r/20230802095606.1298152-9-hpa@redhat.com
Signed-off-by: Kate Hsuan <hpa@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Kate Hsuan [Wed, 2 Aug 2023 09:56:01 +0000 (11:56 +0200)]
media: atomisp: sh_css_sp: Remove #ifdef ISP2401 to make driver generic
Removed #ifdef ISP2401 to make the driver generic. The uncessary codes
were removed and the types of the ISP is determines in runtime.
Link: https://lore.kernel.org/r/20230802095606.1298152-8-hpa@redhat.com
Signed-off-by: Kate Hsuan <hpa@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Kate Hsuan [Wed, 2 Aug 2023 09:56:00 +0000 (11:56 +0200)]
media: atomisp: sh_css: Removed #ifdef ISP2401 to make the driver generic
Removed #ifdef ISP2401 to expose the necessary functions for ISP2401 and
also make the driver generic.
Link: https://lore.kernel.org/r/20230802095606.1298152-7-hpa@redhat.com
Signed-off-by: Kate Hsuan <hpa@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Kate Hsuan [Wed, 2 Aug 2023 09:55:59 +0000 (11:55 +0200)]
media: atomisp: sh_css_mipi: Removed unused code ia_css_mipi_frame_enable_check_on_size()
ia_css_mipi_frame_enable_check_on_size() wasn't used by any functions.
So, it can be removed.
Link: https://lore.kernel.org/r/20230802095606.1298152-6-hpa@redhat.com
Signed-off-by: Kate Hsuan <hpa@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Kate Hsuan [Wed, 2 Aug 2023 09:55:58 +0000 (11:55 +0200)]
media: atomisp: atomisp_compat_css20: Removed #ifdef ISP2401 to make driver generic
Removed #ifdef ISP2401 to make code to be generic. The driver flow is
determined in runtime.
Link: https://lore.kernel.org/r/20230802095606.1298152-5-hpa@redhat.com
Signed-off-by: Kate Hsuan <hpa@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Kate Hsuan [Wed, 2 Aug 2023 09:55:57 +0000 (11:55 +0200)]
media: atomisp: hive_isp_css_include: Removed #ifdef ISP2401 to make driver generic
Removed #ifdef ISP2401 to make the driver generic.
Link: https://lore.kernel.org/r/20230802095606.1298152-4-hpa@redhat.com
Signed-off-by: Kate Hsuan <hpa@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Kate Hsuan [Wed, 2 Aug 2023 09:55:56 +0000 (11:55 +0200)]
media: atomisp: binary: Removed #ifdef ISP2401 to make driver generic
Removed #ifdef ISP2401 to make the driver generic. The driver flow is
determined in runtime.
Link: https://lore.kernel.org/r/20230802095606.1298152-3-hpa@redhat.com
Signed-off-by: Kate Hsuan <hpa@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Kate Hsuan [Wed, 2 Aug 2023 09:55:55 +0000 (11:55 +0200)]
media: atomisp: ia_css_raw.host: Remove #ifdef ISP2401 to make the driver generic
Remove #ifdef from the code and made the code generic. The raw image
configuration was determined during runtime.
Link: https://lore.kernel.org/r/20230802095606.1298152-2-hpa@redhat.com
Signed-off-by: Kate Hsuan <hpa@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Hans de Goede [Sat, 15 Jul 2023 17:09:06 +0000 (19:09 +0200)]
media: atomisp: Mark ia_css_isys_240?_init() static
ia_css_isys_240?_init() are only used inside the C file where they are
declared, mark them as static fixing:
drivers/staging/media/atomisp/pci/runtime/isys/src/isys_init.c:24:20:
warning: no previous prototype for 'ia_css_isys_2400_init'
24 | input_system_err_t ia_css_isys_2400_init(void)
| ^~~~~~~~~~~~~~~~~~~~~
drivers/staging/media/atomisp/pci/runtime/isys/src/isys_init.c:87:20:
warning: no previous prototype for 'ia_css_isys_2401_init'
87 | input_system_err_t ia_css_isys_2401_init(void)
| ^~~~~~~~~~~~~~~~~~~~~
Closes: https://lore.kernel.org/oe-kbuild-all/
202307152046.rvhFGrbz-lkp@intel.com/
Link: https://lore.kernel.org/r/20230715170906.3627-3-hdegoede@redhat.com
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Kate Hsuan <hpa@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Hans de Goede [Sat, 15 Jul 2023 17:09:05 +0000 (19:09 +0200)]
media: atomisp: Remove aliases for MIPI_FORMAT_2400_CUSTOM0
isp2400_input_system_local.h defines 2 aliases for MIPI_FORMAT_2400_CUSTOM0
MIPI_FORMAT_JPEG, which is entirely unused and MIPI_FORMAT_BINARY_8 which
is used once in ia_css_isys_2400_set_fmt_type().
Drop these aliases and directly use MIPI_FORMAT_2400_CUSTOM0 in
ia_css_isys_2400_set_fmt_type().
Link: https://lore.kernel.org/r/20230715170906.3627-2-hdegoede@redhat.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Kate Hsuan <hpa@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Hans de Goede [Sat, 15 Jul 2023 17:09:04 +0000 (19:09 +0200)]
media: atomisp: Remove empty isys_public.h
isys_public.h is empty, remove it.
Link: https://lore.kernel.org/r/20230715170906.3627-1-hdegoede@redhat.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Kate Hsuan <hpa@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Kate Hsuan [Thu, 13 Jul 2023 10:02:31 +0000 (12:02 +0200)]
media: atomisp: isys_init: Initiate atomisp in a generic manner
The original implementation distinguishes and initiates atomisp during
compiler time. This commit allows isys_init to initiate isys for both types
of atomisp in a generic manner.
Link: https://lore.kernel.org/r/20230713100231.308923-12-hpa@redhat.com
Signed-off-by: Kate Hsuan <hpa@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Kate Hsuan [Thu, 13 Jul 2023 10:02:30 +0000 (12:02 +0200)]
media: atomisp: rx: Removed #if defined(ISP2401) to make driver generic
The conflicts of variable declarations were resolved through previous
commits so the #if defined(ISP2401) can be removed.
Link: https://lore.kernel.org/r/20230713100231.308923-11-hpa@redhat.com
Signed-off-by: Kate Hsuan <hpa@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Kate Hsuan [Thu, 13 Jul 2023 10:02:29 +0000 (12:02 +0200)]
media: atomisp: Compile the object codes for a generic driver
Since a generic driver should support every type of atomisp, all the
codes need to be compiled. The ISP2401 flag controls the Makefile to build
the binary file for ISP2400 and ISP2401. Therefore, this section of
Makefile should be removed allowing all the necessary codes can be built.
Moreover, some parts of "removing #ifdef ISP2401" works are related to it
so they were also removed here.
Link: https://lore.kernel.org/r/20230713100231.308923-10-hpa@redhat.com
Signed-off-by: Kate Hsuan <hpa@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Kate Hsuan [Thu, 13 Jul 2023 10:02:28 +0000 (12:02 +0200)]
media: atomisp: ifmtr: Removed #if defined(ISP2401) to make driver generic
Removed #if defined(ISP2401) to make driver generic.
Link: https://lore.kernel.org/r/20230713100231.308923-9-hpa@redhat.com
Signed-off-by: Kate Hsuan <hpa@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Kate Hsuan [Thu, 13 Jul 2023 10:02:27 +0000 (12:02 +0200)]
media: atomisp: pipeline: Removed #if defined(ISP2401) to make driver generic
Removed #if defined(ISP2401) to make driver generic.
Link: https://lore.kernel.org/r/20230713100231.308923-8-hpa@redhat.com
Signed-off-by: Kate Hsuan <hpa@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Kate Hsuan [Thu, 13 Jul 2023 10:02:26 +0000 (12:02 +0200)]
media: atomisp: hive_isp_css_common: Removed #if defined(ISP2401) to make driver generic
Removed #if defined(ISP2401) to make code generic.
Link: https://lore.kernel.org/r/20230713100231.308923-7-hpa@redhat.com
Signed-off-by: Kate Hsuan <hpa@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Kate Hsuan [Thu, 13 Jul 2023 10:02:25 +0000 (12:02 +0200)]
media: atomisp: isys: Removed #if defined(ISP2401) to make driver generic
Removed #if defined(ISP2401) to make code generic.
Link: https://lore.kernel.org/r/20230713100231.308923-6-hpa@redhat.com
Signed-off-by: Kate Hsuan <hpa@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Kate Hsuan [Thu, 13 Jul 2023 10:02:24 +0000 (12:02 +0200)]
media: atomisp: css_2401_system: Remove #ifdef ISP2401 to make the driver generic
Removed #if defined(2401) to make the driver generic.
Link: https://lore.kernel.org/r/20230713100231.308923-5-hpa@redhat.com
Signed-off-by: Kate Hsuan <hpa@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Kate Hsuan [Thu, 13 Jul 2023 10:02:23 +0000 (12:02 +0200)]
media: atomisp: Included both input system headers
Included necessary input system header files (local, private, public
scopes) for both types of atomisp. There is also a conflict of
declaration issue so the unused input_system_state_s is removed.
Link: https://lore.kernel.org/r/20230713100231.308923-4-hpa@redhat.com
Signed-off-by: Kate Hsuan <hpa@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Kate Hsuan [Thu, 13 Jul 2023 10:02:22 +0000 (12:02 +0200)]
media: atomisp: Make two individual enum to define the MIPI format
The original mipi_format_t represents the MIPI format settings for both
atomisp with the same name and the enum member was controlled by #if
defined(ISP2401). However, if we want to make this driver generic, this
enum should be individually defined for them.
Since the format type is redefined, the format setting function
ia_css_isys_set_fmt_type() should be reworked for ISP2400 and ISP2401
called ia_css_isys_2400_set_fmt_type() and ia_css_isys_2401_set_fmt_type()
.
Additionally, the function called is_mipi_format_yuv420() isn't used by any
functions so it can be removed.
Link: https://lore.kernel.org/r/20230713100231.308923-3-hpa@redhat.com
Signed-off-by: Kate Hsuan <hpa@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Kate Hsuan [Thu, 13 Jul 2023 10:02:21 +0000 (12:02 +0200)]
media: atomisp: ia_css_debug: Removed debug codes for dumping status
This portion of debug code was based on a structure for both ISP2400 and
2401 with the same name and controlled by #if defined(ISP2401). This
structure was only used to dump the status of atomisp. So, to make the
driver generic, this part of debug codes can be removed.
Link: https://lore.kernel.org/r/20230713100231.308923-2-hpa@redhat.com
Signed-off-by: Kate Hsuan <hpa@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Hans de Goede [Mon, 19 Jun 2023 10:52:12 +0000 (12:52 +0200)]
media: atomisp: Remove v4l2_ctrl_s_ctrl(asd->run_mode) calls from atomisp_open()
The v4l2_ctrl_s_ctrl(asd->run_mode) call in atomisp_subdev_init_struct()
gets immediately overridden by a second call directly after
atomisp_subdev_init_struct() is called.
And the second call in atomisp_open() also is not helpful.
ATOMISP_RUN_MODE_PREVIEW is the default and if changed controls
are supposed to stay changed over an open/close of the /dev/video#
node. So drop both calls.
Link: https://lore.kernel.org/r/20230619105212.303653-7-hdegoede@redhat.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Hans de Goede [Mon, 19 Jun 2023 10:52:11 +0000 (12:52 +0200)]
media: atomisp: Remove support for custom run-mode v4l2-ctrl on sensors
Remove the support to update a V4L2_CID_RUN_MODE run-mode control
on sensors when changing the atomisp run-mode or directly by calling
the custom ATOMISP_IOC_S_SENSOR_RUNMODE IOCTL.
No sensor drivers implement this and having custom controls / IOCTLs
is undesirable.
Even if there was such a control on sensors then userspace should directly
talk to the sensor v4l2-subdev, rather than relying on a custom IOCTLs
on the output /dev/video# node to pass this through to the senor.
Link: https://lore.kernel.org/r/20230619105212.303653-6-hdegoede@redhat.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>