summaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c
AgeCommit message (Collapse)AuthorFilesLines
2022-06-20media: adv7604: try all infoframe typesHans Verkuil1-3/+2
When logging the infoframes the adv7604 driver stopped reading infoframes at the first missing infoframe type. Instead it should try all supported infoframe types. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-06-20media: TDA1997x: Fix the error handling in tda1997x_probe()Zheyu Ma1-0/+1
The driver should disable the regulator when failing to probe. Signed-off-by: Zheyu Ma <zheyuma97@gmail.com> Acked-by: Tim Harvey <tharvey@gateworks.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-06-10treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_30.RULE ↵Thomas Gleixner2-18/+2
(part 2) Based on the normalized pattern: this program is free software you can redistribute it and/or modify it under the terms of the gnu general public license as published by the free software foundation version 2 this program is distributed as is without any warranty of any kind whether express or implied without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference. Reviewed-by: Allison Randal <allison@lohutok.net> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-05-17media: ov7251: fix mutex lock unbalanceMauro Carvalho Chehab1-0/+1
As reported by smatch/sparse: drivers/media/i2c/ov7251.c:1381 ov7251_s_stream() warn: inconsistent returns '&ov7251->lock'. Locked on : 1381 Unlocked on: 1377 There's a lock unbalance at this routine, as it keeps the lock on certain errors. Fix it. Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-17media: i2c: Add vblank control to ov7251 driverDaniel Scally1-0/+53
Add a vblank control to the ov7251 driver. Signed-off-by: Daniel Scally <djrscally@gmail.com> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-17media: i2c: Add hblank control to ov7251Daniel Scally1-0/+12
Add a hblank control to the ov7251 driver. This necessitates setting a default mode, for which I am simply picking the first available. Signed-off-by: Daniel Scally <djrscally@gmail.com> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-17media: i2c: add ov7251_init_ctrls()Daniel Scally1-41/+52
V4L2 controls initialisation takes up a sizeable portion of the driver's .probe() function. To keep things neat, move it to a dedicated function. Signed-off-by: Daniel Scally <djrscally@gmail.com> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-17media: i2c: Extend .get_selection() for ov7251Daniel Scally1-6/+29
Extend the .get_selection() callback to support other values for sel->target, primarily to satisfy libcamera's requirements. Signed-off-by: Daniel Scally <djrscally@gmail.com> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-17media: i2c: Remove .s_power() from ov7251Daniel Scally1-43/+10
The .s_power() callback is deprecated, and now that we have pm_runtime functionality in the driver there's no further use for it. Delete the function. Signed-off-by: Daniel Scally <djrscally@gmail.com> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-17media: i2c: Add pm_runtime support to ov7251Daniel Scally1-21/+60
Add pm_runtime support to the ov7251 driver. Signed-off-by: Daniel Scally <djrscally@gmail.com> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-17media: i2c: Add ov7251_detect_chip()Daniel Scally1-27/+35
.probe() is quite busy for this driver; make it cleaner by moving the chip verification to a dedicated function. Signed-off-by: Daniel Scally <djrscally@gmail.com> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-17media: i2c: Add support for new frequencies to ov7251Daniel Scally1-21/+72
The OV7251 sensor is used as the IR camera sensor on the Microsoft Surface line of tablets; this provides a 19.2MHz external clock, and the Windows driver for this sensor configures a 319.2MHz link freq to the CSI-2 receiver. Add the ability to support those rate to the driver by defining a new set of PLL configs. Signed-off-by: Daniel Scally <djrscally@gmail.com> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-17media: i2c: Add ov7251_pll_configure()Daniel Scally1-30/+145
Rather than having the pll settings hidden inside mode blobs, define them in structs and use a dedicated function to set them. This makes it simpler to extend the driver to support other frequencies for both the external clock and desired link frequency. Signed-off-by: Daniel Scally <djrscally@gmail.com> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-17media: i2c: Remove per-mode frequencies from ov7251Daniel Scally1-29/+14
Each of the defined modes in the ov7251 driver uses the same link frequency and pixel rate; just drop those members of the modes and set the controls to read only during initialisation. Add a new table defining the supported pixel rates to substitue for the values hardcoded in the modes. Signed-off-by: Daniel Scally <djrscally@gmail.com> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-17media: i2c: Provide ov7251_check_hwcfg()Daniel Scally1-18/+57
Move the endpoint checking from .probe() to a dedicated function, and additionally check that the firmware provided link frequencies are a match for those supported by the driver. Store the index to the matching link frequency so it can be easily identified later. Signed-off-by: Daniel Scally <djrscally@gmail.com> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-17media: i2c: Add acpi support to ov7251Daniel Scally1-0/+8
Add support for enumeration through ACPI to the ov7251 driver Signed-off-by: Daniel Scally <djrscally@gmail.com> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-17media: i2c: ov5645: Remove unneeded of_match_ptr macroMoses Christopher Bollavarapu1-1/+1
of_match_ptr isn't required as CONFIG_OF is already a dependency in Kconfig Signed-off-by: Moses Christopher Bollavarapu <mosescb.dev@gmail.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-17media: ov8856: apply digital gain by setting global gain control registerBingbu Cao1-17/+6
MWB gain register are used to set gain for each mwb channel mannually. However, it will involve some artifacts if gain cannot be applied to each channel synchronously. Enable global gain control to set digital global gain instead of setting AWB gain separately to fix this issue. Signed-off-by: Bingbu Cao <bingbu.cao@intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-17media: i2c: ov5648: fix wrong pointer passed to IS_ERR() and PTR_ERR()Yang Yingliang1-2/+2
IS_ERR() and PTR_ERR() use wrong pointer, it should be sensor->dovdd, fix it. Fixes: e43ccb0a045f ("media: i2c: Add support for the OV5648 image sensor") Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-17media: i2c: ov2640: Depend on V4L2_ASYNCMike Pagano1-0/+1
Add V4L2_ASYNC as a dependency to match other drivers and prevent failures when compile testing. Fixes: ff3cc65cadb5 ("media: v4l: async, fwnode: Improve module organisation") Signed-off-by: Mike Pagano <mpagano@gentoo.org> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-17media: i2c: video-i2c: Use GENMASK for masking bitsMoses Christopher Bollavarapu1-1/+2
Replace 0x0380 with GENMASK(9, 7) to obtain 0b0000_0011_1000_0000 Signed-off-by: Moses Christopher Bollavarapu <mosescb.dev@gmail.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-17media: i2c: video-i2c: Replace constants with proper namesMoses Christopher Bollavarapu1-2/+8
Acc to MLX90640 datasheet: - 0x0400 represents the start of RAM address - 0x2400 represents the start of EEPROM address Reference: https://www.melexis.com/-/media/files/documents\ /datasheets/mlx90640-datasheet-melexis.pdf Signed-off-by: Moses Christopher Bollavarapu <mosescb.dev@gmail.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-17media: i2c: video-i2c: Move defines to the top of the fileMoses Christopher Bollavarapu1-25/+25
Currently, the defines in this driver are after some structs and functions, it makes more sense to move them up to the top of the file, so that the constants can be named together with other defines. Signed-off-by: Moses Christopher Bollavarapu <mosescb.dev@gmail.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-17media: i2c: adv7180: Add support for the test patternsFabio Estevam1-0/+46
ADV7180 has a built-in mechanism to generate some video patterns, which is very useful for debug/bring-up activities. Add support for it. The test_pattern parameter can be one of the following values: 0: "Single color" 1: "Color bars" 2: "Luma ramp" 3: "Boundary box" 4: "Disable" Tested on a imx6q board with an ADV7280. Signed-off-by: Fabio Estevam <festevam@gmail.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-17media: ov7670: remove ov7670_power_off from ov7670_removeDongliang Mu1-1/+0
In ov7670_probe, it always invokes ov7670_power_off() no matter the execution is successful or failed. So we cannot invoke it agiain in ov7670_remove(). Fix this by removing ov7670_power_off from ov7670_remove. Fixes: 030f9f682e66 ("media: ov7670: control clock along with power") Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-17media: dw9807-vcm: Add "dongwoon,dw9807" compatible stringSakari Ailus1-0/+2
There is firmware out there that uses "dongwoon,dw9807" compatible string that never made it to upstream as-is. Add it to the driver to make it load on such systems. The chip also has an EEPROM part which is AT24 compatible (for reading purposes) on a separate I²C address. Adding possible support for this in the future is not affected by this change. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-17media: i2c: imx412: Add bulk regulator supportBryan O'Donoghue1-0/+31
Depending on the platform we may need to enable and disable three separate regulators for the imx412. - DOVDD Digital I/O power - AVDD Analog power - DVDD Digital core power The addition of these regulators shouldn't affect existing users using fixed-on/firmware-controlled regulators. Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Acked-by: Daniele Alessandrelli <daniele.alessandrelli@intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-17media: i2c: imx412: Fix power_off orderingBryan O'Donoghue1-2/+2
The enable path does - gpio - clock The disable path does - gpio - clock Fix the order on the power-off path so that power-off and power-on have the same ordering for clock and gpio. Fixes: 9214e86c0cc1 ("media: i2c: Add imx412 camera sensor driver") Cc: stable@vger.kernel.org Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Daniele Alessandrelli <daniele.alessandrelli@intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-17media: i2c: imx412: Fix reset GPIO polarityBryan O'Donoghue1-3/+3
The imx412/imx577 sensor has a reset line that is active low not active high. Currently the logic for this is inverted. The right way to define the reset line is to declare it active low in the DTS and invert the logic currently contained in the driver. The DTS should represent the hardware does i.e. reset is active low. So: + reset-gpios = <&tlmm 78 GPIO_ACTIVE_LOW>; not: - reset-gpios = <&tlmm 78 GPIO_ACTIVE_HIGH>; I was a bit reticent about changing this logic since I thought it might negatively impact @intel.com users. Googling a bit though I believe this sensor is used on "Keem Bay" which is clearly a DTS based system and is not upstream yet. Fixes: 9214e86c0cc1 ("media: i2c: Add imx412 camera sensor driver") Cc: stable@vger.kernel.org Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Daniele Alessandrelli <daniele.alessandrelli@intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-13media: s5k6a3: add missing clk_disable_unprepareHans Verkuil1-1/+3
Fix smatch warning: drivers/media/i2c/s5k6a3.c:234 __s5k6a3_power_on() warn: 'sensor->clock' from clk_prepare_enable() not released on lines: 234. Signed-off-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>
2022-05-13media: ccs-core.c: fix failure to call clk_disable_unprepareHans Verkuil1-2/+5
Fixes smatch warning: drivers/media/i2c/ccs/ccs-core.c:1676 ccs_power_on() warn: 'sensor->ext_clk' from clk_prepare_enable() not released on lines: 1606. Signed-off-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>
2022-05-13media: i2c: rdacm20: Fix format definitionJacopo Mondi1-4/+4
The RDACM20 camera supports a single image format which is currently listed as MEDIA_BUS_FMT_UYVY8_2X8. As the video stream is transmitted on the GMSL serial bus, the 2X8 variant does not apply. Fix the format by using MEDIA_BUS_FMT_UYVY8_1X16. This fixes a runtime error which is now triggered as the MAX9286 deserializer implements .link_validate(). Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-13media: i2c: rdacm2x: properly set subdev entity functionLaurentiu Palcu2-2/+2
The subdevice entity function was left unset, which produces a warning when probing the device: mxc-md bus@58000000:camera: Entity type for entity rdacm20 19-0051 was not initialized! This patch will set entity function to MEDIA_ENT_F_CAM_SENSOR and leave flags unset. Fixes: 34009bffc1c6 ("media: i2c: Add RDACM20 driver") Fixes: a59f853b3b4b ("media: i2c: Add driver for RDACM21 camera module") Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com> Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org> Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-04-24media: i2c: dw9714: Return zero in remove callbackUwe Kleine-König1-1/+0
The only effect of returning an error code in an i2c remove callback is that the i2c core emits a generic warning and still removes the device. So even if disabling the regulator fails it's sensible to further cleanup and then return zero to only emit a single error message. This patch is a preparation for making i2c remove callbacks return void. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-04-24media: i2c: dw9714: Disable the regulator when the driver fails to probeZheyu Ma1-0/+1
When the driver fails to probe, we will get the following splat: [ 59.305988] ------------[ cut here ]------------ [ 59.306417] WARNING: CPU: 2 PID: 395 at drivers/regulator/core.c:2257 _regulator_put+0x3ec/0x4e0 [ 59.310345] RIP: 0010:_regulator_put+0x3ec/0x4e0 [ 59.318362] Call Trace: [ 59.318582] <TASK> [ 59.318765] regulator_put+0x1f/0x30 [ 59.319058] devres_release_group+0x319/0x3d0 [ 59.319420] i2c_device_probe+0x766/0x940 Fix this by disabling the regulator in error handling. Signed-off-by: Zheyu Ma <zheyuma97@gmail.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-04-24media: i2c: ov5695: fix typos in commentsJulia Lawall1-1/+1
Various spelling mistakes in comments. Detected with the help of Coccinelle. Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-04-24media: ov7640: Use ARRAY_SIZE instead of manual checkingMoses Christopher Bollavarapu1-14/+19
Currently, the driver ends the reg-val list with a 0xFF as a check to stop the loop. Instead an array of reg-vals can be used to avoid this check, by using the ARRAY_SIZE(arr) macro to obtain the length of the array and iterate over it. Signed-off-by: Moses Christopher Bollavarapu <mosescb.dev@gmail.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-04-24media: Revert "media: dw9768: activate runtime PM and turn off device"Sakari Ailus1-6/+0
This reverts commit c09d776eaa060534a1663e3b89d842db3e1d9076. Revert the commit as it breaks runtime PM support on OF based systems. More fixes to the driver are needed. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Tomasz Figa <tfiga@chromium.org> Reviewed-by: Bingbu Cao <bingbu.cao@intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-04-24media: i2c: ov5645: Fix media bus formatJacopo Mondi1-3/+3
The ov5645 driver reports as its unique supported format MEDIA_BUS_FMT_UYVY8_2X8, which is not correct as the sensor uses the MIPI CSI-2 serial bus. Fix that by using MEDIA_BUS_FMT_UYVY8_1X16 instead. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-04-24media: i2c: max9286: fix kernel oops when removing moduleLaurentiu Palcu1-12/+7
When removing the max9286 module we get a kernel oops: Unable to handle kernel paging request at virtual address 000000aa00000094 Mem abort info: ESR = 0x96000004 EC = 0x25: DABT (current EL), IL = 32 bits SET = 0, FnV = 0 EA = 0, S1PTW = 0 FSC = 0x04: level 0 translation fault Data abort info: ISV = 0, ISS = 0x00000004 CM = 0, WnR = 0 user pgtable: 4k pages, 48-bit VAs, pgdp=0000000880d85000 [000000aa00000094] pgd=0000000000000000, p4d=0000000000000000 Internal error: Oops: 96000004 [#1] PREEMPT SMP Modules linked in: fsl_jr_uio caam_jr rng_core libdes caamkeyblob_desc caamhash_desc caamalg_desc crypto_engine max9271 authenc crct10dif_ce mxc_jpeg_encdec CPU: 2 PID: 713 Comm: rmmod Tainted: G C 5.15.5-00057-gaebcd29c8ed7-dirty #5 Hardware name: Freescale i.MX8QXP MEK (DT) pstate: 80000005 (Nzcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : i2c_mux_del_adapters+0x24/0xf0 lr : max9286_remove+0x28/0xd0 [max9286] sp : ffff800013a9bbf0 x29: ffff800013a9bbf0 x28: ffff00080b6da940 x27: 0000000000000000 x26: 0000000000000000 x25: 0000000000000000 x24: 0000000000000000 x23: ffff000801a5b970 x22: ffff0008048b0890 x21: ffff800009297000 x20: ffff0008048b0f70 x19: 000000aa00000064 x18: 0000000000000000 x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000 x14: 0000000000000014 x13: 0000000000000000 x12: ffff000802da49e8 x11: ffff000802051918 x10: ffff000802da4920 x9 : ffff000800030098 x8 : 0101010101010101 x7 : 7f7f7f7f7f7f7f7f x6 : fefefeff6364626d x5 : 8080808000000000 x4 : 0000000000000000 x3 : 0000000000000000 x2 : ffffffffffffffff x1 : ffff00080b6da940 x0 : 0000000000000000 Call trace: i2c_mux_del_adapters+0x24/0xf0 max9286_remove+0x28/0xd0 [max9286] i2c_device_remove+0x40/0x110 __device_release_driver+0x188/0x234 driver_detach+0xc4/0x150 bus_remove_driver+0x60/0xe0 driver_unregister+0x34/0x64 i2c_del_driver+0x58/0xa0 max9286_i2c_driver_exit+0x1c/0x490 [max9286] __arm64_sys_delete_module+0x194/0x260 invoke_syscall+0x48/0x114 el0_svc_common.constprop.0+0xd4/0xfc do_el0_svc+0x2c/0x94 el0_svc+0x28/0x80 el0t_64_sync_handler+0xa8/0x130 el0t_64_sync+0x1a0/0x1a4 The Oops happens because the I2C client data does not point to max9286_priv anymore but to v4l2_subdev. The change happened in max9286_init() which calls v4l2_i2c_subdev_init() later on... Besides fixing the max9286_remove() function, remove the call to i2c_set_clientdata() in max9286_probe(), to avoid confusion, and make the necessary changes to max9286_init() so that it doesn't have to use i2c_get_clientdata() in order to fetch the pointer to priv. Fixes: 66d8c9d2422d ("media: i2c: Add MAX9286 driver") Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com> Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-04-24media: ccs: Use unsigned int as index to an arraySakari Ailus1-2/+2
Use an unsigned int to index an array instead of a signed one. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-04-24media: ccs: Use %u for printing unsigned values, remove extra debug printSakari Ailus1-17/+15
Use %u for printing unsigned integer or u32 values. In a lot of cases %d was being used instead. Also remove an extra debug print --- the number of lanes is already printed by V4L2 when parsing fwnode endpoints when dynamic debug is enabled. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-03-18media: m5mols/m5mols.h: document new reset fieldHans Verkuil1-0/+1
The new reset field in struct m5mols_info was not documented, add this. This fixes a kerneldoc warning: drivers/media/i2c/m5mols/m5mols.h:244: warning: Function parameter or member 'reset' not described in 'm5mols_info' Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Fixes: aaaf357fa61c (media: m5mols: Convert to use GPIO descriptors) Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-03-18media: i2c: Kconfig: move camera drivers to the topMauro Carvalho Chehab1-713/+713
The camera drivers are the ones that suffer additions/changes on those days. Place them on the top of the I2C drivers. Suggested-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-03-18media: media/*/Kconfig: sort entriesMauro Carvalho Chehab1-309/+313
Currently, the idems inside media Kconfig are out of order. Sort them using the script below: <script> use strict; use warnings; my %config; my @source; my $out; sub flush_config() { if (scalar %config) { for my $c (sort keys %config) { $out .= $config{$c} . "\n"; } %config = (); } return if (!scalar @source); $out .= "\n"; for my $s (sort @source) { $out .= $s; } $out .= "\n"; @source = (); } sub sort_kconfig($) { my $fname = shift; my $cur_config = ""; @source = (); $out = ""; %config = (); open IN, $fname or die; while (<IN>) { if (m/^config\s+(.*)/) { $cur_config = $1; $config{$cur_config} .= $_; } elsif (m/^source\s+(.*)/) { push @source, $_; } elsif (m/^\s+/) { if ($cur_config eq "") { $out .= $_; } else { $config{$cur_config} .= $_; } } else { flush_config(); $cur_config = ""; $out .= $_; } } close IN or die; flush_config(); $out =~ s/\n\n+/\n\n/g; $out =~ s/\n+$/\n/; open OUT, ">$fname"; print OUT $out; close OUT; } for my $fname(@ARGV) { sort_kconfig $fname } </script> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-03-18media: Kconfig: cleanup VIDEO_DEV dependenciesMauro Carvalho Chehab5-129/+129
media Kconfig has two entries associated to V4L API: VIDEO_DEV and VIDEO_V4L2. On Kernel 2.6.x, there were two V4L APIs, each one with its own flag. VIDEO_DEV were meant to: 1) enable Video4Linux and make its Kconfig options to appear; 2) it makes the Kernel build the V4L core. while VIDEO_V4L2 where used to distinguish between drivers that implement the newer API and drivers that implemented the former one. With time, such meaning changed, specially after the removal of all V4L version 1 drivers. At the current implementation, VIDEO_DEV only does (1): it enables the media options related to V4L, that now has: menu "Video4Linux options" visible if VIDEO_DEV source "drivers/media/v4l2-core/Kconfig" endmenu but it doesn't affect anymore the V4L core drivers. The rationale is that the V4L2 core has a "soft" dependency at the I2C bus, and now requires to select a number of other Kconfig options: config VIDEO_V4L2 tristate depends on (I2C || I2C=n) && VIDEO_DEV select RATIONAL select VIDEOBUF2_V4L2 if VIDEOBUF2_CORE default (I2C || I2C=n) && VIDEO_DEV In the past, merging them would be tricky, but it seems that it is now possible to merge those symbols, in order to simplify V4L dependencies. Let's keep VIDEO_DEV, as this one is used on some make *defconfig configurations. Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Neil Armstrong <narmstrong@baylibre.com> # for meson-vdec & meson-ge2d Acked-by: Andrzej Pietrasiewicz <andrzejtp2010@gmail.com> Acked-by: Łukasz Stelmach <l.stelmach@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-03-14media: Makefiles: sort entries where it fitsMauro Carvalho Chehab1-92/+92
Alphabetically sort entries at the Makefiles per group, in ASCII order, e. g., using the output of: $ LC_ALL=C sort Makefile |grep obj-y ... $ LC_ALL=C sort Makefile |grep obj.*CONFIG ... Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-03-12media: Makefiles: remove extra spacesMauro Carvalho Chehab1-46/+46
It is hard to keep all those options aligned as newer config changes get added, and we really don't want to have patches adding new options also touching already existing entries. So, drop the extra spaces. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-03-07media: i2c: max2175: Use rbtree rather than flat register cacheMark Brown1-1/+1
The max2175 uses a flat register cache but supplies only a single default value and has many volatile registers. This is a poor fit for a flat cache since the cache will assume a default of zero for any register not yet written which can lead to bugs for example when regmap_update_bits() suppresses a noop write. A rbtree cache is a much better fit, this will only cache default values and values that have been written to the device with any reads of uncached values going to the hardware. Convert the driver to use a rbtree cache. Since the device is controlled via I2C the cost of manging the rbtree should be immaterial compared to the cost of accessing the device. Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2022-03-07Merge tag 'for-5.18-2.6-signed' of git://linuxtv.org/sailus/media_tree into ↵Mauro Carvalho Chehab16-102/+2870
media_stage Even yet more V4L2 patches for 5.18 * tag 'for-5.18-2.6-signed' of git://linuxtv.org/sailus/media_tree: media: i2c: Fix pixel array positions in ov8865 media: adv7183: Convert to GPIO descriptors media: m5mols: Convert to use GPIO descriptors media: noon010p30: Convert to use GPIO descriptors media: mt9m111: Drop unused include media: adv7511: Drop unused include media: i2c: isl7998x: Add driver for Intersil ISL7998x media: dt-bindings: Add Intersil ISL79987 DT bindings media: media-entity: Clarify media_entity_cleanup() usage media: i2c: imx274: Drop surplus includes media: i2c: ccs: Drop unused include v4l: fwnode: Remove now-redundant loop from v4l2_fwnode_parse_reference() v4l: fwnode: Drop redunant -ENODATA check in property reference parsing media: media-entity: Simplify media_pipeline_start() media: media-entity: Add media_pad_is_streaming() helper function media: Add a driver for the og01a1b camera sensor media: i2c: ov5648: Fix lockdep error media: ov5640: Fix set format, v4l2_mbus_pixelcode not updated Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>