aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-06-29media: wl128x: fix a clang warningMauro Carvalho Chehab1-4/+2
Clang-16 produces this warning, which is fatal with CONFIG_WERROR: ../drivers/media/radio/wl128x/fmdrv_common.c:1237:19: error: variable 'cmd_cnt' set but not used [-Werror,-Wunused-but-set-variable] int ret, fw_len, cmd_cnt; ^ 1 error generated. What happens is that cmd_cnt tracks the amount of firmware data packets were transfered, which is printed only when debug is used. Switch to use the firmware count, as the message is all about reporting a partial firmware transfer. Link: https://lore.kernel.org/linux-media/6badd27ebfa718d5737f517f18b29a3e0f6e43f8.1687981726.git.mchehab@kernel.org Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-28media: dvb: mb86a20s: get rid of a clang-15 warningMauro Carvalho Chehab1-4/+1
When building with clang-15: this warning is produced: ../drivers/media/dvb-frontends/mb86a20s.c:1572:6: error: variable 'active_layers' set but not used [-Werror,-Wunused-but-set-variable] int active_layers = 0, pre_ber_layers = 0, post_ber_layers = 0; ^ 1 error generated. Link: https://lore.kernel.org/linux-media/[email protected] Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-28media: cec: i2c: ch7322: also select REGMAPRandy Dunlap1-0/+1
Selecting only REGMAP_I2C can leave REGMAP unset, causing build errors, so also select REGMAP to prevent the build errors. ../drivers/media/cec/i2c/ch7322.c:158:21: error: variable 'ch7322_regmap' has initializer but incomplete type 158 | static const struct regmap_config ch7322_regmap = { ../drivers/media/cec/i2c/ch7322.c:159:10: error: 'const struct regmap_config' has no member named 'reg_bits' 159 | .reg_bits = 8, ../drivers/media/cec/i2c/ch7322.c:159:21: warning: excess elements in struct initializer 159 | .reg_bits = 8, ../drivers/media/cec/i2c/ch7322.c:160:10: error: 'const struct regmap_config' has no member named 'val_bits' 160 | .val_bits = 8, ../drivers/media/cec/i2c/ch7322.c:160:21: warning: excess elements in struct initializer 160 | .val_bits = 8, ../drivers/media/cec/i2c/ch7322.c:161:10: error: 'const struct regmap_config' has no member named 'max_register' 161 | .max_register = 0x7f, ../drivers/media/cec/i2c/ch7322.c:161:25: warning: excess elements in struct initializer 161 | .max_register = 0x7f, ../drivers/media/cec/i2c/ch7322.c:162:10: error: 'const struct regmap_config' has no member named 'disable_locking' 162 | .disable_locking = true, ../drivers/media/cec/i2c/ch7322.c:162:28: warning: excess elements in struct initializer 162 | .disable_locking = true, ../drivers/media/cec/i2c/ch7322.c: In function 'ch7322_probe': ../drivers/media/cec/i2c/ch7322.c:468:26: error: implicit declaration of function 'devm_regmap_init_i2c' [-Werror=implicit-function-declaration] 468 | ch7322->regmap = devm_regmap_init_i2c(client, &ch7322_regmap); ../drivers/media/cec/i2c/ch7322.c:468:24: warning: assignment to 'struct regmap *' from 'int' makes pointer from integer without a cast [-Wint-conversion] 468 | ch7322->regmap = devm_regmap_init_i2c(client, &ch7322_regmap); ../drivers/media/cec/i2c/ch7322.c: At top level: ../drivers/media/cec/i2c/ch7322.c:158:35: error: storage size of 'ch7322_regmap' isn't known 158 | static const struct regmap_config ch7322_regmap = { Link: https://lore.kernel.org/linux-media/[email protected] Fixes: 21b9a47e0ec7 ("media: cec: i2c: ch7322: Add ch7322 CEC controller driver") Signed-off-by: Randy Dunlap <[email protected]> Cc: Jeff Chase <[email protected]> Cc: Hans Verkuil <[email protected]> Cc: Joe Tessler <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Mark Brown <[email protected]> Cc: Masahiro Yamada <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-28media: add HAS_IOPORT dependenciesNiklas Schnelle3-2/+20
In a future patch HAS_IOPORT=n will result in inb()/outb() and friends not being declared. We thus need to add HAS_IOPORT as dependency for those drivers using them. Link: https://lore.kernel.org/linux-media/[email protected] Reviewed-by: Sean Young <[email protected]> # media/rc Co-developed-by: Arnd Bergmann <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Niklas Schnelle <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-28media: tc358746: select CONFIG_GENERIC_PHYArnd Bergmann2-0/+2
The tc358746 driver selects CONFIG_GENERIC_PHY_MIPI_DPHY and links to that, but this fails when CONFIG_GENERIC_PHY is disabled, because Kbuild then never enters the drivers/phy directory for building object files: ERROR: modpost: "phy_mipi_dphy_get_default_config_for_hsclk" [drivers/media/i2c/tc358746.ko] undefined! Add an explicit 'select GENERIC_PHY' here to ensure that the directory is entered, and add another dependency on that symbol so make it more obvious what is going on if another driver has the same problem, as this will produce a Kconfig warning. Link: https://lore.kernel.org/linux-media/[email protected] Fixes: 80a21da360516 ("media: tc358746: add Toshiba TC358746 Parallel to CSI-2 bridge driver") Signed-off-by: Arnd Bergmann <[email protected]> Reviewed-by: Marco Felsch <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: mediatek: vcodec: Add dbgfs help functionYunfei Dong1-1/+23
Getting dbgfs help information with command "echo -help > vdec" or "echo > vdec". Signed-off-by: Yunfei Dong <[email protected]> Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: mediatek: vcodec: Add encode to support dbgfsYunfei Dong1-0/+2
Add encode to support dbgfs. Signed-off-by: Yunfei Dong <[email protected]> Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: mediatek: vcodec: Change dbgfs interface to support encodeYunfei Dong3-5/+10
Extend dbgfs init interface to support encode and create encode dbgfs file. Signed-off-by: Yunfei Dong <[email protected]> Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: mediatek: vcodec: Get each instance format typeYunfei Dong2-0/+49
Adding echo command to get capture and output queue format type of each instance:"echo '-format' > vdec", not current hardware supported. Signed-off-by: Yunfei Dong <[email protected]> Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: mediatek: vcodec: Get each context resolution informationYunfei Dong2-0/+50
Will store the string to temp buffer like "echo -picinfo > vdec" when user want to get needed information. Then getting debug information using command 'cat vdec' calling mtk_vdec_dbgfs_read to analysis the temp buffer. Signed-off-by: Yunfei Dong <[email protected]> Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: mediatek: vcodec: Add a debugfs file to get different useful informationYunfei Dong3-0/+98
In oder to get each instance information according to test command, adding one file node "vdec". Can use echo command to set different string value as 'echo -picinfo > vdec'. Signed-off-by: Yunfei Dong <[email protected]> Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> [hverkuil: drop unwanted dbgfs_inst NULL ptr check in mtk_vcodec_dbgfs_remove] Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: mediatek: vcodec: Add debug params to control different log levelYunfei Dong3-3/+33
Add parameter mtk_vcodec_dbg to open each codec log. Add parameter mtk_v4l2_dbg_level to open each instance log according to the parameter value. Signed-off-by: Yunfei Dong <[email protected]> Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> [hverkuil: add () around 'level' in macro] Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: mediatek: vcodec: Add debugfs interface to get debug informationYunfei Dong5-0/+77
This will be useful when debugging specific issues related to kernel in running status. Signed-off-by: Yunfei Dong <[email protected]> Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: mediatek: vcodec: support stateless AV1 decoderXiaoyong Lu8-1/+2291
Add mediatek av1 decoder linux driver which use the stateless API in MT8195. Signed-off-by: Xiaoyong Lu<[email protected]> Tested-by: Nicolas Dufresne <[email protected]> Reviewed-by: Nicolas Dufresne <[email protected]> Tested-by: AngeloGioacchino Del Regno <[email protected]> Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: verisilicon: Conditionally ignore native formatsBenjamin Gaignard5-25/+63
AV1 film grain feature requires to use the postprocessor to produce valid frames. In such case the driver shouldn't propose native pixels format but only post-processed pixels format. Additionally if when setting a control a value could change capture queue pixels formats it is needed to call hantro_reset_raw_fmt(). Signed-off-by: Benjamin Gaignard <[email protected]> Reviewed-by: Nicolas Dufresne <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: verisilicon: Enable AV1 decoder on rk3588Benjamin Gaignard3-0/+137
Add rk3588 AV1 decoder to Hantro variant. The hardware support image from 64x64 up to 7680x4320 by steps of 16 pixels. Signed-off-by: Benjamin Gaignard <[email protected]> Reviewed-by: Nicolas Dufresne <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: verisilicon: Add film grain feature to AV1 driverBenjamin Gaignard5-0/+651
Film grain feature add "old style" grain noise on decoded streams. Grain noise is applied after decoding by the postprocessor. The level of grain is based on gaussian sequence. Signed-off-by: Benjamin Gaignard <[email protected]> Reviewed-by: Nicolas Dufresne <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: verisilicon: Add Rockchip AV1 decoderBenjamin Gaignard4-2/+2566
Implement AV1 stateless decoder for rockchip VPU981. It decode 8 and 10 bits AV1 bitstreams. AV1 scaling feature is done by the postprocessor. Signed-off-by: Benjamin Gaignard <[email protected]> Reviewed-by: Nicolas Dufresne <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: verisilicon: Add AV1 entropy helpersBenjamin Gaignard5-0/+4719
AV1 hardware decoder needs entropy parameters to decode frames. They are computed from various arrays defined in AV1 section "9.4. Default CDF tables". Add helpers functions to init, store and get these parameters. Signed-off-by: Benjamin Gaignard <[email protected]> Reviewed-by: Nicolas Dufresne <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: verisilicon: Compute motion vectors size for AV1 framesBenjamin Gaignard3-0/+21
Compute the additional space required to store motion vectors at the end of the frames buffers. Signed-off-by: Benjamin Gaignard <[email protected]> Reviewed-by: Nicolas Dufresne <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: verisilicon: Check AV1 bitstreams bit depthBenjamin Gaignard2-0/+40
The driver supports 8 and 10 bits bitstreams, make sure to discard other cases. It could happens that userland test if V4L2_CID_STATELESS_AV1_SEQUENCE exists without setting bit_depth field in this case use HANTRO_DEFAULT_BIT_DEPTH value. Signed-off-by: Benjamin Gaignard <[email protected]> Reviewed-by: Nicolas Dufresne <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: verisilicon: Add AV1 decoder mode and controlsBenjamin Gaignard2-0/+24
Add AV1 decoder as new decoder mode to Hantro driver. Register needed AV1 controls for the decoder. Signed-off-by: Benjamin Gaignard <[email protected]> Reviewed-by: Nicolas Dufresne <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: verisilicon: Get bit depth for V4L2_PIX_FMT_NV15_4L4Benjamin Gaignard1-0/+1
Let's the driver knows that V4L2_PIX_FMT_NV15_4L4 is a 10bits pixel format. Signed-off-by: Benjamin Gaignard <[email protected]> Reviewed-by: Nicolas Dufresne <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: Add NV15_4L4 pixel formatBenjamin Gaignard4-0/+20
NV15_4L4 is the 10-bits per component 4x4 tiled format. Signed-off-by: Benjamin Gaignard <[email protected]> Signed-off-by: Nicolas Dufresne <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: v4l2-common: Add support for fractional bppNicolas Dufresne2-80/+82
Fraction bytes-per-pixel exist for some packed format. You will find notably on Rockhip platform that 10bit data is stored fully packed, meaning that there is 1.25 pixels per bytes. This can be represented with the fraction 5/4 and can be used to scale the width into a bytesperline. Signed-off-by: Nicolas Dufresne <[email protected]> Signed-off-by: Benjamin Gaignard <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: AV1: Make sure that bit depth in correctly initializeBenjamin Gaignard1-0/+5
Make sure that bit_depth field of V4L2_CTRL_TYPE_AV1_SEQUENCE is initialized correctly before using it. Signed-off-by: Benjamin Gaignard <[email protected]> Reviewed-by: Nicolas Dufresne <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: dt-bindings: media: rockchip-vpu: Add rk3588 vpu compatibleBenjamin Gaignard1-0/+1
Add compatible for rk3588 AV1 vpu decoder. Signed-off-by: Benjamin Gaignard <[email protected]> Acked-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: Add AV1 uAPIDaniel Almeida12-2/+2335
This patch adds the AOMedia Video 1 (AV1) kernel uAPI. This design is based on currently available AV1 API implementations and aims to support the development of AV1 stateless video codecs on Linux. Signed-off-by: Daniel Almeida <[email protected]> Co-developed-by: Nicolas Dufresne <[email protected]> Signed-off-by: Nicolas Dufresne <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: pci: tw686x: no need to check 'next'Hans Verkuil1-1/+1
If 'done' is not NULL, then next can never be NULL, so just drop the 'next' check. This fixes this smatch warning: drivers/media/pci/tw686x/tw686x-audio.c:62 tw686x_audio_irq() warn: can 'next' even be NULL? Signed-off-by: Hans Verkuil <[email protected]> Cc: Ezequiel Garcia <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: mediatek: vpu: add missing clk_unprepareHans Verkuil1-0/+1
If vpu_clock_enable() fails, then call clk_unprepare(). This fixes this smatch warning: drivers/media/platform/mediatek/vpu/mtk_vpu.c:1031 mtk_vpu_resume() warn: 'vpu->clk' from clk_prepare() not released on lines: 1020. Signed-off-by: Hans Verkuil <[email protected]> Cc: Yunfei Dong <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: platform: mediatek: vpu: fix NULL ptr dereferenceHans Verkuil1-2/+4
If pdev is NULL, then it is still dereferenced. This fixes this smatch warning: drivers/media/platform/mediatek/vpu/mtk_vpu.c:570 vpu_load_firmware() warn: address of NULL pointer 'pdev' Signed-off-by: Hans Verkuil <[email protected]> Cc: Yunfei Dong <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: platform: renesas-ceu: drop buf NULL checkHans Verkuil1-9/+0
Since start_streaming is only called if there are at least two buffers queued, the ceudev->capture list will never be empty, so the check whether there are no buffers can be dropped. Note that the '!buf' check was wrong in any case, if we wanted to check for an empty list it should have used list_empty(). This fixes this smatch warning: drivers/media/platform/renesas/renesas-ceu.c:705 ceu_start_streaming() warn: can 'buf' even be NULL? Signed-off-by: Hans Verkuil <[email protected]> Reviewed-by: Jacopo Mondi <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: usb: as102: drop as102_dev NULL checkHans Verkuil1-4/+2
Fixes this smatch warning: drivers/media/usb/as102/as102_usb_drv.c:306 as102_usb_release() warn: can 'as102_dev' even be NULL? And indeed, as102_dev can never be NULL, so just drop the NULL check. Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: rockchip: rga: fix clock cleanupHans Verkuil1-2/+2
Fix this smatch warning: drivers/media/platform/rockchip/rga/rga.c:734 rga_enable_clocks() warn: 'rga->sclk' from clk_prepare_enable() not released on lines: 734. The reason is that aclk should be disabled/unprepared before sclk, instead of the other way around. Signed-off-by: Hans Verkuil <[email protected]> Cc: Jacob Chen <[email protected]> Cc: Ezequiel Garcia <[email protected]> Reviewed-by: Michael Tretter <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: atomisp: csi2-bridge: Add support for setting "clock-" and ↵Hans de Goede2-6/+19
"link-frequencies" props Some standard v4l2 sensor drivers from drivers/media/i2c expect a "clock-frequency" property on the device indicating the frequency of the extclk for the sensor. Example of such drivers are the ov2680 and ov5693 drivers. The standard ov5693 sensor also expects a "link-frequencies" property. Add support for setting both properties. Note the "clock-frequency" prop is added before the "rotation" prop while the "link-frequencies" are added at the end to match the ipu3 cio2-bridge code from which this is derived. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: atomisp: Add testing instructions to TODO fileHans de Goede1-0/+33
Testing the atomisp can be a bit tricky. The BYT/CHT CPUs are not very powerful so some apps like camorama cannot run at full FPS. Add instructions for how to test with gstreamer which does runs at full FPS without issues. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: atomisp: ov2680: Rename unknown/0x370a to sensor_ctrl_0aHans de Goede2-4/+6
The data sheets say the registers at offset 0x3700 - 0x373f are "sensor control" registers rename the unknown variable in ov2680_set_mode() to sensor_ctrl_0a and add a OV2680_REG_SENSOR_CTRL_0A define. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: atomisp: ov2680: Remove unnecessary registers from ↵Hans de Goede2-62/+59
ov2680_global_setting[] Many of the values in ov2680_global_setting[] match the default/reset register value for the ov2680 sensor (verified with both datasheet and actual hw) so they are no-ops. And there are also a couple of others which are later overwritten by ctrls or by ov2680_set_mode(). Remove all the unnecessary entries and add annotations to the remaining entries documenting what they change (in so far as things are documented in the datasheet). This also removes the double writing of OV2680_REG_SOFT_RESET in ov2680_init_registers() (one direct write, one in ov2680_global_setting[]) instead add a short sleep after the first write to give the sensor time to reset. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: atomisp: ov2680: Stop using half pixelclock for binned modesHans de Goede2-7/+2
Stop using half pixelclock for binned modes this fixes: 1. The exposure being twice as high for binned mods (due to the half clk) 2. The framerate being 15 fps instead of 30 fps The original code with fixed per mode register lists did use half pixel clk, but this should be combined with using half for the VTS value too. Using half VTS fixes the framerate issue, but this has the undesired side-effect of change the exposure ctrl range (half the range, double the amount of exposure per step). Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: atomisp: Stop resetting selected input to 0 between /dev/video# opensHans de Goede1-3/+0
No other V4L2 driver resets the selected input (front cam or back cam selected in case of the atomisp). Stop resetting selected input to 0 between /dev/video# opens. This allows e.g. using v4l2-ctl -i to switch the input before starting another app, which is useful since most apps don't support selecting the input. Note more in general the whole resetting of a bunch of internal state from the open fop needs to be removed there to allow multiple opens of /dev/video# for full v4l2 API compliance. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: atomisp: Fix binning check in atomisp_set_crop()Hans de Goede1-2/+2
The fmt / size passed to atomisp_set_crop() includes padding, so the binning check should be against 1/2 of the native rect. of the sensor, rather then 1/2 of the active rect. This fixes binning not being used when using e.g. 800x600 on a 1600x1200 sensor leading to a very small field of view. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: atomisp: Make atomisp_enum_framesizes_crop() check resolution fits ↵Hans de Goede3-8/+19
with padding Now that atomisp_get_padding() takes minimum padding requirements on BYT/ISP2400 into account, it is possible for a resolution which fits in the active area of the sensor to not fit in the native area once padding is added. For example on the ov2680 which has a native resolution of 1616x1216 the max active resolution of 1600x1200 leaves 16x16 for padding which meets the worst-case minimum padding requirement of 14x14 on BYT. But after binning we are left with an native area of 808x608 and an active area of 800x600. This leaves 8x8 for padding which is not enough. So on BYT 800x600 is not a valid resolution (it could be made by lots of cropping without binning but then the remaining field of view is no good). Modify atomisp_enum_framesizes_crop() to check the resolution + padding fits in the native rectangle, removing 800x600 from the list of valid modes on BYT. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: atomisp: Take minimum padding requirement on BYT/ISP2400 into accountHans de Goede2-0/+37
The main binary for the pipeline on BYT/ISP2400 has its ia_css_binary_info.pipeline.left_cropping and .top_cropping fields set to 12. So a minimum padding of 12 is required. And for certain bayer-orders additional width / height padding is necessary so that the ISP crop rectangle for the raw sensor data can be used to change the bayer-order to the fixed bayer-order supported by the debayer block. Without the minmum required padding ia_css_ifmtr_configure() will fail inside ifmtr_input_start_line() and/or ifmtr_start_column() because it cannot set the ISP crop rectangle for the raw sensor data. Fix this by making atomisp_get_padding() take the minimum padding requirements into account on BYT/ISP2400 (CHT/ISP2401 does not seem to need this). Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: atomisp: csi2-bridge: Set PMC clk-rate for sensors to 19.2 MHzHans de Goede1-8/+60
The ACPI code takes care of enabling/disabling the PMC clk(s) for the sensors as necessary based on the runtime-pm state of the sensor. But the GMIN code this replaces also set the clk-rate of the PMC clk to 19.2 MHz. At least on BYT devices the PMC clks may come up running at 25 MHz instead of the expected 19.2 MHz. Ensure the sensor clk also runs at the expected 19.2 MHz for sensors using v4l2-async probing by explicitly setting it to 19.2 MHz when enumerating sensors in atomisp_csi2_bridge.c. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: atomisp: Add enum_framesizes function for sensors with selection / ↵Hans de Goede2-3/+69
crop support Some sensor drivers with crop support (e.g. the ov5693 driver) only return the current crop rectangle + 1/2 (binning) of the current crop rectangle when calling their enum_frame_sizes op. This causes 2 issues: 1. Atomisp sets to the crop area to include the padding, where as the enum_framesizes ioctl should return values without padding. 2. With cropping a lot more standard resolutions are possible then just these 2 and many apps limit the list given to the end user to the list returned by enum_framesizes. Add an alternative enum_framesizes function for sensors which support cropping to fix both issues. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: atomisp: Set crop before setting fmtHans de Goede1-0/+54
Some drivers which implement selections/crop only allow setting the format with and height to either the crop rectangle width and height or to half the crop rectangle width and height (binning). An example of such a driver is the standard v4l2 ov5693 driver. First set the crop rectangle to match the requested format when trying or setting the sensor format, to match these drivers expectations. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: atomisp: Use selection API info to determine sensor paddingHans de Goede3-26/+48
Using the selection / crop info to determine the padding values to use with a specific resolution on specific sensor. This allows e.g. automatically halving the padding when using the max binned resolution and also ensures the right amount of padding is used on models with 2 sensors with different padding requirements. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: atomisp: Make atomisp_init_sensor() check if the sensor supports binningHans de Goede2-3/+28
Make atomisp_init_sensor() check if the sensor supports binning. This is a preparation patch for using the selection / crop support to determine the padding values to use with a specific sensor. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: atomisp: Pass MEDIA_BUS_FMT_* code when calling enum_frame_size pad-opHans de Goede3-0/+8
A sensor driver's enum_frame_size pad-op may return -EINVAL when v4l2_subdev_frame_size_enum.code is not set to a supported MEDIA_BUS_FMT_* code. Make atomisp_init_sensor() get the sensor's MEDIA_BUS_FMT_* code and pass this when calling the enum_frame_size pad-op. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-06-09media: atomisp: Add support for sensors which implement selection API / croppingHans de Goede3-4/+64
Sensor drivers which implement set_selection V4L2_SEL_TGT_CROP expect v4l2_subdev_state.pads[pad].try_crop to have valid contents when calling set_fmt with which == V4L2_SUBDEV_FORMAT_TRY since the crop-rectangle may influence the available image size. Just passing an uninitalized struct v4l2_subdev_pad_config from the stack to set_fmt with which == V4L2_SUBDEV_FORMAT_TRY will result in wrong results with such drivers. Store a per sensor v4l2_subdev_pad_config and add a new atomisp_init_sensor_crop() function to initialize this before registering /dev/* nodes with userspace. Sensor drivers which implement the selection API will allow the atomisp to properly deal with the extra padding the ISP wants on a per sensor basis instead of hardcoding this. atomisp_init_sensor_crop() stores the native and active rects of the sensor in preparation for using these for this. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>