summaryrefslogtreecommitdiffstats
path: root/drivers/staging/media/imx
Commit message (Collapse)AuthorAgeFilesLines
* staging: Explicitly include correct DT includesRob Herring2023-07-273-4/+0
| | | | | | | | | | | | | | | | | | | The DT of_device.h and of_platform.h date back to the separate of_platform_bus_type before it as merged into the regular platform bus. As part of that merge prepping Arm DT support 13 years ago, they "temporarily" include each other. They also include platform_device.h and of.h. As a result, there's a pretty much random mix of those include files used throughout the tree. In order to detangle these headers and replace the implicit includes with struct declarations, users need to explicitly include the correct includes. Signed-off-by: Rob Herring <robh@kernel.org> Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> # tegra-video Acked-by: Parthiban Veerasooran <parthiban.veerasooran@microchip.com> Acked-by: Alex Elder <elder@linaro.org> Link: https://lore.kernel.org/r/20230714175002.4064428-1-robh@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* media: staging: media: imx: initialize hs_settle to avoid warningHans Verkuil2023-05-261-1/+1
| | | | | | | | | | | | | | | | | | | Initialize hs_settle to 0 to avoid this compiler warning: imx8mq-mipi-csi2.c: In function 'imx8mq_mipi_csi_start_stream.part.0': imx8mq-mipi-csi2.c:91:55: warning: 'hs_settle' may be used uninitialized [-Wmaybe-uninitialized] 91 | #define GPR_CSI2_1_S_PRG_RXHS_SETTLE(x) (((x) & 0x3f) << 2) | ^~ imx8mq-mipi-csi2.c:357:13: note: 'hs_settle' was declared here 357 | u32 hs_settle; | ^~~~~~~~~ It's a false positive, but it is too complicated for the compiler to detect that. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Reviewed-by: Martin Kepplinger <martink@posteo.de> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: staging: media: imx6-mipi-csi2: Add log_status core callbackAlexander Stein2023-05-251-0/+45
| | | | | | | This prints all register values. Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: imx: utils: Enclose IMX_BUS_FMTS macro in parenthesisAngel Alberto Carretero2023-05-251-1/+1
| | | | | | | | Conform to kernel coding style by wrapping macro in parenthesis. Issue found by checkpatch. Signed-off-by: Angel Alberto Carretero <angelalbertoc.r@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: staging: media: imx8mq-mipi-csi2: Convert to platform remove callback ↵Uwe Kleine-König2023-04-151-4/+2
| | | | | | | | | | | | | | | | | | | | returning void The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: staging: media: imx6-mipi-csi2: Convert to platform remove callback ↵Uwe Kleine-König2023-04-151-4/+2
| | | | | | | | | | | | | | | | | | | | returning void The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: staging: media: imx-media-dev: Convert to platform remove callback ↵Uwe Kleine-König2023-04-151-4/+2
| | | | | | | | | | | | | | | | | | | | returning void The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: staging: media: imx-media-csi: Convert to platform remove callback ↵Uwe Kleine-König2023-04-151-4/+2
| | | | | | | | | | | | | | | | | | | | returning void The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: Prefer designated initializers over memset for subdev pad opsLaurent Pinchart2023-04-122-10/+10
| | | | | | | | | | | | | | | | | | | | | | | Structures passed to subdev pad operations are all zero-initialized, but not always with the same kind of code constructs. While most drivers used designated initializers, which zero all the fields that are not specified, when declaring variables, some use memset(). Those two methods lead to the same end result, and, depending on compiler optimizations, may even be completely equivalent, but they're not consistent. Improve coding style consistency by using designated initializers instead of calling memset(). Where applicable, also move the variables to inner scopes of for loops to ensure correct initialization in all iterations. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Lad Prabhakar <prabhakar.csengg@gmail.com> # For am437x Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: Zero-initialize all structures passed to subdev pad operationsLaurent Pinchart2023-04-121-12/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Several drivers call subdev pad operations, passing structures that are not fully zeroed. While the drivers initialize the fields they care about explicitly, this results in reserved fields having uninitialized values. Future kernel API changes that make use of those fields thus risk breaking proper driver operation in ways that could be hard to detect. To avoid this, make the code more robust by zero-initializing all the structures passed to subdev pad operation. Maintain a consistent coding style by preferring designated initializers (which zero-initialize all the fields that are not specified) over memset() where possible, and make variable declarations local to inner scopes where applicable. One notable exception to this rule is in the ipu3 driver, where a memset() is needed as the structure is not a local variable but a function parameter provided by the caller. Not all fields of those structures can be initialized when declaring the variables, as the values for those fields are computed later in the code. Initialize the 'which' field in all cases, and other fields when the variable declaration is so close to the v4l2_subdev_call() call that it keeps all the context easily visible when reading the code, to avoid hindering readability. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Shuah Khan <skhan@linuxfoundation.org> # For vimc Reviewed-by: Lad Prabhakar <prabhakar.csengg@gmail.com> # For am437x Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> # For drivers/staging/media/imx/ Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* staging: media: imx: Make imx_media_of_add_csi() staticLaurent Pinchart2023-04-112-5/+2
| | | | | | | | | The imx_media_of_add_csi() function is only called in its compilation unit. Make it static and don't export it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* staging: media: imx: Drop unused helper functionsLaurent Pinchart2023-04-112-78/+0
| | | | | | | | | | | The imx_media_find_subdev_by_fwnode(), imx_media_find_subdev_by_devname(), imx_media_pipeline_csi2_channel() and imx_media_pipeline_video_device() helper functions are not used. Drop them. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* staging: media: imx: Drop IMX_MEDIA_GRP_ID_CSILaurent Pinchart2023-04-112-2/+0
| | | | | | | | The IMX_MEDIA_GRP_ID_CSI group ID isn't used anymore. Drop it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* staging: media: imx: Drop imx_media_subdev_bound()Laurent Pinchart2023-04-111-13/+0
| | | | | | | | | The imx_media_subdev_bound() function is a no-op, and the async notifier .bound() operation is optional. Drop it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: imx: imx8mq-mipi-csi2: Remove unneeded state variable and functionMartin Kepplinger2023-04-111-25/+16
| | | | | | | | | | | Clean up the driver a bit by inlining the imx8mq_mipi_csi_system_enable() function to the callsites and removing the hs_settle variable from the driver state. Signed-off-by: Martin Kepplinger <martin.kepplinger@puri.sm> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: imx: imx8mq-mipi-csi2: Use V4L2 subdev active stateMartin Kepplinger2023-04-111-72/+45
| | | | | | | | | | Simplify the driver by using the V4L2 subdev active state API to store the active format. Signed-off-by: Martin Kepplinger <martin.kepplinger@puri.sm> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: imx: imx-media-fim: Replace macro icap_enabled() with functionBrent Pappas2023-02-081-1/+4
| | | | | | | | | | Replace the macro icap_enabled() with a static function to comply with Linux coding style standards. Signed-off-by: Brent Pappas <bpappas@pappasbrent.com> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: staging: media: imx: change imx_media_fim_set_stream() to return voidDeepak R Varma2023-02-083-13/+8
| | | | | | | | | | | At present, the function imx_media_fim_set_stream() always returns 0. So, convert it to be a function returning void instead. Issue identified using the returnvar.cocci Coccinelle semantic patch. Signed-off-by: Deepak R Varma <drv@mailo.com> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: imx: remove code for non-existing config IMX_GPT_ICAPLukas Bulwahn2022-12-071-56/+1
| | | | | | | | | | There never was a config IMX_GPT_ICAP in the repository. So remove the code conditional on this config and simplify the callers that just called empty functions. Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com> Reviewed-by: Tommaso Merciai <tommaso.merciai@amarulasolutions.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: imx: Use get_mbus_config instead of parsing upstream DT endpointsPhilipp Zabel2022-12-074-118/+63
| | | | | | | | | | | | | | Stop parsing upstream neighbors' device-tree endpoints to retrieve the media bus configuration. Instead use the get_mbus_config op and throw an error if the upstream subdevice does not implement it. Also drop the corresponding TODO entry and the now unused imx_media_get_pad_fwnode() function. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Tested-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: imx: Unstage the imx7-media-csi driverLaurent Pinchart2022-11-254-2421/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | The imx7-media-csi driver, currently in staging, is ready for prime-time. The staging TODO file lists a few items specific to that driver, that are already addressed (the "all of the above" part) or can be addressed later: - The frame interval monitoring support is a software mechanism to monitor the device for unexpected stalls, and should be part of the V4L2 core if desired. - Restricting the support media bus formats based on the SoC integration only aims at reducing userspace confusion by not enumerating options that are known not to be possible, it won't cause regressions if handled later. Move the description of the media bus format restriction TODO item to the driver, drop the other TODO items, and move the driver out of staging. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Acked-by: Rui Miguel Silva <rmfrfs@gmail.com> Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: imx: Decouple imx8mq-mipi-csi2 from imx7-media-csiLaurent Pinchart2022-11-252-1/+11
| | | | | | | | | | | The imx8mq-mipi-csi2 driver targets SoCs that also run the imx7-media-csi driver, but they are distinct. Decouple them in Kconfig to prepare for destaging of the imx7-media-csi driver. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: imx: imx7-media-csi: Clear BIT_MIPI_DOUBLE_CMPNT for <16b formatsLaurent Pinchart2022-11-251-3/+3
| | | | | | | | | | | | | | | | | | Commit 9babbbaaeb87 ("media: imx: imx7-media-csi: Use dual sampling for YUV 1X16") set BIT_MIPI_DOUBLE_CMPNT in the CR18 register for 16-bit YUV formats in imx7_csi_configure(). The CR18 register is always updated with read-modify-write cycles, so if a 16-bit YUV format is selected, the bit will stay set forever, even if the format is changed. Fix it by clearing the bit at the beginning of the imx7_csi_configure() function. While at it, swap two of the bits being cleared to match the MSB to LSB order. This doesn't cause any functional change. Fixes: 9babbbaaeb87 ("media: imx: imx7-media-csi: Use dual sampling for YUV 1X16") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Acked-by: Rui Miguel Silva <rmfrfs@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: imx: imx7-media-csi: Rename phys variables to dma_addrLaurent Pinchart2022-11-251-18/+18
| | | | | | | | | | | | All the phys variables and structure fields store a DMA address, not a physical address. Even if the two are effectively identical on all platforms where this driver is used due to the lack of IOMMU, rename the variables to dma_addr to make their usage clearer. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Acked-by: Rui Miguel Silva <rmfrfs@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: imx: imx7-media-csi: Move variable to loop scopeLaurent Pinchart2022-11-251-4/+5
| | | | | | | | | | | | The phys variable is only used as a local loop variable in imx7_csi_setup_vb2_buf(), with each entry in the array being used in the corresponding iteration of the loop only. Move it to loop scope, simplifying the array to a single variable. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Acked-by: Rui Miguel Silva <rmfrfs@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: imx: imx7-media-csi: Add support for fast-tracking queued buffersPaul Elder2022-11-251-0/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The CSI hardware compatible with this driver handles buffers using a ping-pong mechanism with two sets of destination addresses. Normally, when an interrupt comes in to signal the completion of one buffer, say FB1, it assigns the next buffer in the queue to the next FB1, and the hardware starts to capture into FB2 in the meantime. In a buffer underrun situation, in the above example without loss of generality, if a new buffer is queued before the interrupt for FB1 comes in, we can program the buffer into FB2 (which is programmed with a dummy buffer, as there is a buffer underrun). This of course races with the interrupt that signals FB1 completion, as once that interrupt comes in, we are no longer guaranteed that the programming of FB2 was in time and must assume it was too late. This race is resolved partly by locking the programming of FB2. If it came after the interrupt for FB1, then the variable that is used to determine which FB to program would have been swapped by the interrupt handler. This alone isn't sufficient, however, because the interrupt could still be generated (thus the hardware starts capturing into the other fb) while the fast-tracking routine has the irq lock. Thus, after programming the fb register to fast-track the buffer, the isr also must be checked to confirm that an interrupt didn't come in the meantime. If it has, we must assume that programming the register for the fast-tracked buffer was not in time, and queue the buffer normally. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Acked-by: Rui Miguel Silva <rmfrfs@gmail.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: imx: imx7-media-csi: Remove a useless includeChristophe JAILLET2022-11-251-1/+0
| | | | | | | | | <linux/gcd.h> is not needed for this driver. Remove the corresponding #include. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: mc: convert pipeline funcs to take media_padTomi Valkeinen2022-09-241-4/+4
| | | | | | | | | | Now that the pipeline is stored into pads instead of entities, we can change the relevant functions to take pads instead of entities. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: drivers: use video device pipeline start/stopTomi Valkeinen2022-09-241-3/+3
| | | | | | | | | | Convert the media drivers to use video device based pipeline start/stop where possible. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: mc: entity: Add media_entity_pipeline() to access the media pipelineLaurent Pinchart2022-09-241-1/+1
| | | | | | | | | | | Replace direct access to the pipe field in drivers with a new helper function. This will allow easier refactoring of media pipeline handling in the MC core behind the scenes without affecting drivers. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: staging: media: imx: imx7-media-csi: Increase video mem limitPetko Manolov2022-08-301-1/+1
| | | | | | | | | | Some high resolution (like Sony IMX492 47Mpix) sensors requre large amount space for buffering. 64MB is far from sufficient so this patch increases the limit to 512MB. Signed-off-by: Petko Manolov <petko.manolov@konsulko.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: mc-entity: Rename media_entity_remote_pad() to ↵Laurent Pinchart2022-07-173-3/+3
| | | | | | | | | | | | | media_pad_remote_pad_first() The media_entity_remote_pad() is misnamed, as it operates on a pad and not an entity. Rename it to media_pad_remote_pad_first() to clarify its behaviour. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: staging: media: imx: imx7-media-csi: Drop usage of shared helpersLaurent Pinchart2022-07-081-2/+0
| | | | | | | | | | None of the shared helpers are used anymore. Make this official by dropping inclusion of imx-media.h. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Rui Miguel Silva <rmfrfs@gmail.com> Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: staging: media: imx: imx7-media-csi: Drop V4L2 events supportLaurent Pinchart2022-07-081-16/+0
| | | | | | | | | | | The only event that the driver allows subscribing to, V4L2_EVENT_IMX_FRAME_INTERVAL_ERROR, is never generated. Drop events support. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Rui Miguel Silva <rmfrfs@gmail.com> Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: staging: media: imx: imx7-media-csi: Inline imx7_csi_enum_pixel_formats()Laurent Pinchart2022-07-081-50/+34
| | | | | | | | | Inline the imx7_csi_enum_pixel_formats() function in its only caller. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Rui Miguel Silva <rmfrfs@gmail.com> Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: staging: media: imx: imx7-media-csi: Drop unneeded pixel format ↵Laurent Pinchart2022-07-081-33/+0
| | | | | | | | | | | | validation The driver won't accept unsupported pixel formats, there's thus no need to validate it in imx7_csi_pad_link_validate(). Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Rui Miguel Silva <rmfrfs@gmail.com> Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: staging: media: imx: imx7-media-csi: Add V4L2_PIX_FMT_Y14 supportLaurent Pinchart2022-07-081-0/+5
| | | | | | | | | | The device supports 14-bit greyscale formats the same way it supports 14-bit Bayer formats. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Rui Miguel Silva <rmfrfs@gmail.com> Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: staging: media: imx: imx7-media-csi: Fix list of supported formatsLaurent Pinchart2022-07-081-39/+55
| | | | | | | | | | | | | | | | | The list of supported formats comes from helpers shared with the i.MX6 IPUv3 and is incorrect in multiple regards: - 10-, 12- and 14-bit Bayer formats are stored in memory as SBGGR10, SBGGR12 and SBGGR14 respectively (plus components permutations), not SBGGR16. Same thing for greyscale formats. - 16-bit RAW formats are not supported by the hardware. Fix the supported formats table. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Rui Miguel Silva <rmfrfs@gmail.com> Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: staging: media: imx: imx7-media-csi: Simplify default format in try_fmtLaurent Pinchart2022-07-081-3/+5
| | | | | | | | | | When trying a format on the video node, if the requested pixel format isn't supported, fallback to the default with a simpler logic. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Rui Miguel Silva <rmfrfs@gmail.com> Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: staging: media: imx: imx7-media-csi: Inline imx7_csi_init_mbus_fmt()Laurent Pinchart2022-07-081-39/+15
| | | | | | | | | | Inline the imx7_csi_init_mbus_fmt() function in its only caller. This allows simplifying the code. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Rui Miguel Silva <rmfrfs@gmail.com> Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: staging: media: imx: imx7-media-csi: Drop unneeded imx7_csi_pixfmt fieldsLaurent Pinchart2022-07-081-21/+2
| | | | | | | | | | The imx7_csi_pixfmt cycles field is never used nor set, the bayer field is never used, and the planar field is never set. Drop them. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Rui Miguel Silva <rmfrfs@gmail.com> Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: staging: media: imx: imx7-media-csi: Drop YUV/RGB/BAYER format selectorsLaurent Pinchart2022-07-081-83/+22
| | | | | | | | | | All the format lookup functions are called with a ANY selector, drop selector support. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Rui Miguel Silva <rmfrfs@gmail.com> Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: staging: media: imx: imx7-media-csi: Simplify default mbus code in ↵Laurent Pinchart2022-07-081-4/+3
| | | | | | | | | | | | try_fmt When trying a format on the subdev sink pad, if the requested media bus code isn't supported, fallback to the default with a simpler logic. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Rui Miguel Silva <rmfrfs@gmail.com> Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: staging: media: imx: imx7-media-csi: Define macro for default mbus codeLaurent Pinchart2022-07-081-3/+5
| | | | | | | | | | | Define a macro for the default media bus code and use it through the driver to replace a hardcoded value and a dynamic query from the pixel_formats table. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Rui Miguel Silva <rmfrfs@gmail.com> Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: staging: media: imx: imx7-media-csi: Make default formats consistentLaurent Pinchart2022-07-081-7/+10
| | | | | | | | | | Use the same default image width and height for both the CSI subdev and the video node to achieve a consistent default through the driver. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Rui Miguel Silva <rmfrfs@gmail.com> Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: staging: media: imx: imx7-media-csi: Drop unsupported YUV and RGB formatsLaurent Pinchart2022-07-081-55/+0
| | | | | | | | | | | A large number of formats defined in the pixel_formats array are not supported, as shown by the switch-case check in imx7_csi_pad_link_validate(). Drop them. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Rui Miguel Silva <rmfrfs@gmail.com> Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: staging: media: imx: imx7-media-csi: Drop IPU-only formatsLaurent Pinchart2022-07-081-92/+6
| | | | | | | | | | The formats specific to the IPUv3 are not supported by the CSI bridge. Drop them, along with the related code. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Rui Miguel Silva <rmfrfs@gmail.com> Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: staging: media: imx: imx7-media-csi: Drop IC support from ↵Laurent Pinchart2022-07-081-17/+5
| | | | | | | | | | | | imx7_csi_try_colorimetry() The imx7_csi_try_colorimetry() function supports the unrelated image converter hardware as it originates from shared helpers. Drop that. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Rui Miguel Silva <rmfrfs@gmail.com> Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: staging: media: imx: imx7-media-csi: Replace ipu_color_space with ↵Laurent Pinchart2022-07-081-45/+26
| | | | | | | | | | | | | bool yuv field Replace the enum ipu_color_space cs field in struct imx7_csi_pixfmt with a bool yuv field. This decouples the driver from the unrelated IPUv3 headers. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Rui Miguel Silva <rmfrfs@gmail.com> Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: staging: media: imx: imx7-media-csi: Import format helpersLaurent Pinchart2022-07-081-45/+615
| | | | | | | | | | | To prepare for code refactoring, copy the format helpers used by this driver from imx-media-utils.c. Rename structures and functions to avoid name clashes, no functional change intended. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Rui Miguel Silva <rmfrfs@gmail.com> Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>