aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2018-10-19media: rename soc_camera I2C driversMauro Carvalho Chehab10-9/+9
Those drivers are part of the legacy SoC camera framework. They're being converted to not use it, but sometimes we're keeping both legacy any new driver. This time, for example, we have two drivers on media with the same name: ov772x. That's bad. So, in order to prevent that to happen, let's prepend the SoC legacy drivers with soc_. No functional changes. Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-10-08media: dw9807-vcm: Fix probe error handlingSakari Ailus1-1/+2
v4l2_async_unregister_subdev() may not be called without v4l2_async_register_subdev() being called first. Fix this. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-10-08media: dw9714: Remove useless error messageSakari Ailus1-1/+1
If probe fails, the kernel will print the error code. There's no need to driver to do that. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-10-08media: dw9714: Fix error handling in probe functionRajmohan Mani1-1/+2
Fixed the case where v4l2_async_unregister_subdev() is called unnecessarily in the error handling path in probe function. Signed-off-by: Rajmohan Mani <rajmohan.mani@intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-10-05media: adv7842: when the EDID is cleared, unconfigure CEC as wellHans Verkuil1-1/+3
When there is no EDID the CEC adapter should be unconfigured as well. So call cec_phys_addr_invalidate() when this happens. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Cc: <stable@vger.kernel.org> # for v4.18 and up Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-10-05media: adv7604: when the EDID is cleared, unconfigure CEC as wellHans Verkuil1-1/+3
When there is no EDID the CEC adapter should be unconfigured as well. So call cec_phys_addr_invalidate() when this happens. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Cc: <stable@vger.kernel.org> # for v4.18 and up Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-10-05media: ov5640: fix framerate updateHugues Fruchet1-3/+4
Changing framerate right before streamon had no effect, the new framerate value was taken into account only at next streamon, fix this. Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-10-05media: ov7670: make "xclk" clock optionalLubomir Rintel1-10/+17
When the "xclk" clock was added, it was made mandatory. This broke the driver on an OLPC plaform which doesn't know such clock. Make it optional. Tested on a OLPC XO-1 laptop. Fixes: 0a024d634cee ("[media] ov7670: get xclk") Cc: stable@vger.kernel.org # 4.11+ Signed-off-by: Lubomir Rintel <lkundrak@v3.sk> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-10-05media: ov9650: avoid maybe-uninitialized warningsArnd Bergmann1-0/+2
The regmap change causes multiple warnings like drivers/media/i2c/ov9650.c: In function 'ov965x_g_volatile_ctrl': drivers/media/i2c/ov9650.c:889:29: error: 'reg2' may be used uninitialized in this function [-Werror=maybe-uninitialized] exposure = ((reg2 & 0x3f) << 10) | (reg1 << 2) | ~~~~~~~~~~~~~~~^~~~~~ It is apparently hard for the compiler to see here if ov965x_read() returned successfully or not. Besides, we have a v4l2_dbg() statement that prints an uninitialized value if regmap_read() fails. Adding an 'else' clause avoids the ambiguity. Fixes: 361f3803adfe ("media: ov9650: use SCCB regmap") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-10-05media: imx355: fix a few coding style issuesMauro Carvalho Chehab1-16/+16
Function alignments are off by 1 space, as reported by checkpatch.pl --strict. Fix those. Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-10-05media: add imx355 camera sensor driverBingbu Cao3-0/+1872
Add a v4l2 sub-device driver for the Sony imx355 image sensor. This is a camera sensor using the i2c bus for control and the csi-2 bus for data. This driver supports following features: - manual exposure and analog/digital gain control support - vblank/hblank control support - 4 test patterns control support - vflip/hflip control support (will impact the output bayer order) - support following resolutions: - 3268x2448, 3264x2448, 3280x2464 @ 30fps - 1940x1096, 1936x1096, 1924x1080, 1920x1080 @ 60fps - 1640x1232, 1640x922, 1300x736, 1296x736, 1284x720, 1280x720 820x616 @ 120fps - support 4 bayer orders output (via change v/hflip) - SRGGB10(default), SGRBG10, SGBRG10, SBGGR10 [Sakari Ailus: Use do_div() for dividing 64-bit numbers, fix fwnode if usage] Cc: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Tianshu Qiu <tian.shu.qiu@intel.com> 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+samsung@kernel.org>
2018-10-05media: imx319: fix a few coding style issuesMauro Carvalho Chehab1-16/+16
Function alignments are off by 1 space, as reported by checkpatch.pl --strict. Fix those. Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-10-05media: add imx319 camera sensor driverBingbu Cao3-0/+2572
Add a v4l2 sub-device driver for the Sony imx319 image sensor. This is a camera sensor using the i2c bus for control and the csi-2 bus for data. This driver supports following features: - manual exposure and analog/digital gain control support - vblank/hblank control support - 4 test patterns control support - vflip/hflip control support (will impact the output bayer order) - support following resolutions: - 3264x2448, 3280x2464 @ 30fps - 1936x1096, 1920x1080 @ 60fps - 1640x1232, 1640x922, 1296x736, 1280x720 @ 120fps - support 4 bayer orders output (via change v/hflip) - SRGGB10(default), SGRBG10, SGBRG10, SBGGR10 [Sakari Ailus: Replace 64-bit division by do_div(), fix fwnode if usage] Cc: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Bingbu Cao <bingbu.cao@intel.com> Signed-off-by: Tianshu Qiu <tian.shu.qiu@intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-10-04media: smiapp: Query the V4L2 endpoint for a specific bus typeSakari Ailus1-0/+6
Instead of opportunistically trying to gather some information from the V4L2 endpoint, set the bus type and let the V4L2 fwnode framework figure out the configuration. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Tested-by: Steve Longerbeam <steve_longerbeam@mentor.com> Tested-by: Jacopo Mondi <jacopo+renesas@jmondi.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-10-04media: v4l: fwnode: Initialise the V4L2 fwnode endpoints to zeroSakari Ailus10-10/+10
Initialise the V4L2 fwnode endpoints to zero in all drivers using v4l2_fwnode_endpoint_parse(). This prepares for setting default endpoint flags as well as the bus type. Setting bus type to zero will continue to guess the bus among the guessable set (parallel, Bt.656 and CSI-2 D-PHY). Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Tested-by: Steve Longerbeam <steve_longerbeam@mentor.com> Tested-by: Jacopo Mondi <jacopo+renesas@jmondi.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-10-04media: v4l: fwnode: Let the caller provide V4L2 fwnode endpointSakari Ailus3-31/+35
Instead of allocating the V4L2 fwnode endpoint in v4l2_fwnode_endpoint_alloc_parse, let the caller to do this. This allows setting default parameters for the endpoint which is a very common need for drivers. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Tested-by: Steve Longerbeam <steve_longerbeam@mentor.com> Tested-by: Jacopo Mondi <jacopo+renesas@jmondi.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-10-04media: v4l: mediabus: Recognise CSI-2 D-PHY and C-PHYSakari Ailus10-15/+15
The CSI-2 bus may use either D-PHY or C-PHY. Make this visible in media bus enum. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Tested-by: Steve Longerbeam <steve_longerbeam@mentor.com> Tested-by: Jacopo Mondi <jacopo+renesas@jmondi.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-10-04media: i2c: adv748x: fix typo in comment for TXB CSI-2 transmitter power downNiklas Söderlund1-1/+1
Fix copy-and-paste error in comment for TXB CSI-2 transmitter power down sequence. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-10-04media: i2c: adv748x: Register only enabled inputsJacopo Mondi2-3/+13
The adv748x assumes input endpoints are always enabled, and registers a subdevice for each of them when the corresponding output subdevice is registered. Fix this by conditionally registering the input subdevice only if it is actually described in device tree. Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org> Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-10-04media: i2c: adv748x: Conditionally enable only CSI-2 outputsJacopo Mondi1-7/+1
The ADV748x has two CSI-2 output port and one TTL input/output port for digital video reception/transmission. The TTL digital pad is unconditionally enabled during the device reset even if not used. Same goes for the TXA and TXB CSI-2 outputs, which are enabled by the initial settings blob programmed into the chip. In order to improve power saving, do not enable unused output interfaces: keep TTL output disabled, as it is not used, and drop CSI-2 output enabling from the initial settings list, as they get conditionally enabled later. Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org> Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-10-04media: i2c: adv748x: Handle TX[A|B] power managementJacopo Mondi5-43/+25
As the driver is now allowed to probe with a single output endpoint, power management routines shall now take into account the case a CSI-2 TX is not enabled. Unify the adv748x_tx_power() routine to handle transparently TXA and TXB, and enable the CSI-2 outputs conditionally. Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org> Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-10-04media: i2c: adv748x: Support probing a single outputJacopo Mondi3-15/+30
Currently the adv748x driver will fail to probe unless both of its output endpoints (TXA and TXB) are connected. Make the driver support probing provided that there is at least one input, and one output connected and protect the clean-up function from accessing un-initialized fields. Following patches will fix other uses of un-initialized TXs in the driver, such as power management functions. Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org> Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-10-04media: rc: Remove init_ir_raw_event and DEFINE_IR_RAW_EVENT macrosSean Young1-4/+2
This can be done with c99 initializers, which makes the code cleaner and more transparent. It does require gcc 4.6, because of this bug in earlier versions: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=10676 Since commit cafa0010cd51 ("Raise the minimum required gcc version to 4.6"), this is the case. Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-10-03media: smiapp: Remove unused loopRicardo Ribalda Delgado1-3/+1
The loop seemed to be made to calculate max, but max is not used in that function. Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-10-03media: ov5640: use JPEG mode 3 for 720pHugues Fruchet1-1/+1
Change 720p JPEG mode to mode 3 as per other resolutions. Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-10-03media: v4l: Remove support for crop default target in subdev driversSakari Ailus16-26/+0
The V4L2 sub-device API does not support the crop default target. A number of drivers apparently still did support this, likely as it was needed by the SoC camera framework. Drop support for the default crop rectaingle in sub-device drivers, and use the bounds rectangle in SoC camera instead. Reported-by: Helmut Grohne <h.grohne@intenta.de> Suggested-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-10-03media: v4l: i2c: Add a comment not to use static sub-device names in the futureSakari Ailus5-0/+5
A number of sub-device drivers used a static name for the sub-device, and thus the media entity. As the entity name must be unique within a media device, this makes it impossible to have more than one instance of each device in a media device. This is a rather severe limitation. Instead of fixing these drivers, add a comment to the drivers noting that such static names may not be used in the future. The alternative of fixing the drivers is troublesome as the entity (as well as sub-device) name is part of the uAPI. Changing that is almost certain to break something. As these devices are old but no-one has encountered a problem with the static names, leave it as-is. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-09-24media: hdmi.h: rename ADOBE_RGB to OPRGB and ADOBE_YCC to OPYCCHans Verkuil1-2/+2
These names have been renamed in the CTA-861 standard due to trademark issues. Replace them here as well so they are in sync with the standard. Signed-off-by: Hans Verkuil <hansverk@cisco.com> Cc: stable@vger.kernel.org Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-09-24media: replace ADOBERGB by OPRGBHans Verkuil3-4/+4
The CTA-861 standards have been updated to refer to opRGB instead of AdobeRGB. The official standard is in fact named opRGB, so switch to that. The two old defines referring to ADOBERGB in the public API are put under #ifndef __KERNEL__ and a comment mentions that they are deprecated. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Cc: stable@vger.kernel.org Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-09-24media: cec/v4l2: move V4L2 specific CEC functions to V4L2Hans Verkuil3-5/+5
Several CEC functions are actually specific for use with receivers, i.e. they should be part of the V4L2 subsystem, not CEC. These functions deal with validating and modifying EDIDs for (HDMI) receivers, and they do not actually have anything to do with the CEC subsystem and whether or not CEC is enabled. The problem was that if the CEC_CORE config option was not set, then these functions would become stubs, but that's not right: they should always be valid. So replace the cec_ prefix by v4l2_ and move them to v4l2-dv-timings.c. Update all drivers that call these accordingly. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Reported-by: Lars-Peter Clausen <lars@metafoo.de> Cc: <stable@vger.kernel.org> # for v4.17 and up Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-09-17media: ov5640: fix restore of last mode setHugues Fruchet1-4/+8
Mode setting depends on last mode set, in particular because of exposure calculation when downscale mode change between subsampling and scaling. At stream on the last mode was wrongly set to current mode, so no change was detected and exposure calculation was not made, fix this. Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Tested-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-09-17media: ov5640: fix auto controls values when switching to manual modeHugues Fruchet1-4/+0
When switching from auto to manual mode, V4L2 core is calling g_volatile_ctrl() in manual mode in order to get the manual initial value. Remove the manual mode check/return to not break this behaviour. Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com> Tested-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-09-17media: ov5640: fix wrong binning value in exposure calculationHugues Fruchet1-4/+4
ov5640_set_mode_exposure_calc() is checking binning value but binning value read is buggy, fix this. Rename ov5640_binning_on() to ov5640_get_binning() as per other similar functions. Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-09-17media: ov5640: fix auto gain & exposure when changing modeHugues Fruchet1-42/+54
Ensure that auto gain and auto exposure are well restored when changing mode. Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Tested-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-09-17media: ov5640: fix exposure regressionHugues Fruchet1-6/+12
Symptom was black image when capturing HD or 5Mp picture due to manual exposure set to 1 while it was intended to set autoexposure to "manual", fix this. Fixes: bf4a4b518c20 ("media: ov5640: Don't force the auto exposure state at start time"). Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-09-17media: ov5640: Fix timings setup codeJacopo Mondi1-29/+21
As of: commit 476dec012f4c ("media: ov5640: Add horizontal and vertical totals") the timings parameters gets programmed separately from the static register values array. When changing capture mode, the vertical and horizontal totals gets inspected by the set_mode_exposure_calc() functions, and only later programmed with the new values. This means exposure, light banding filter and shutter gain are calculated using the previous timings, and are thus not correct. Fix this by programming timings right after the static register value table has been sent to the sensor in the ov5640_load_regs() function. Fixes: 476dec012f4c ("media: ov5640: Add horizontal and vertical totals") Tested-by: Steve Longerbeam <slongerbeam@gmail.com> # i.MX6q SabreSD, CSI-2 Tested-by: Loic Poulain <loic.poulain@linaro.org> # Dragonboard-410c, CSI-2 Signed-off-by: Samuel Bobrowicz <sam@elite-embedded.com> Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-09-17media: ov5640: Re-work MIPI startup sequenceJacopo Mondi1-20/+79
Rework the MIPI interface startup sequence with the following changes: - Remove MIPI bus initialization from the initial settings blob - At set_power(1) time power up MIPI Tx/Rx and set data and clock lanes in LP11 during 'sleep' and 'idle' with MIPI clock in non-continuous mode. - At s_stream time enable/disable the MIPI interface output. - Restore default settings at set_power(0) time. Before this commit the sensor MIPI interface was initialized with settings that require a start/stop sequence at power-up time in order to force lanes into LP11 state, as they were initialized in LP00 when in 'sleep mode', which is assumed to be the sensor manual definition for the D-PHY defined stop mode. The stream start/stop was performed by enabling disabling clock gating, and had the side effect to change the lanes sleep mode configuration when stream was stopped. Clock gating/ungating: - ret = ov5640_mod_reg(sensor, OV5640_REG_MIPI_CTRL00, BIT(5), - on ? 0 : BIT(5)); - if (ret) Set lanes in LP11 when in 'sleep mode': - ret = ov5640_write_reg(sensor, OV5640_REG_PAD_OUTPUT00, - on ? 0x00 : 0x70); This commit fixes an issue reported by Jagan Teki on i.MX6 platforms that prevents the host interface from powering up correctly: https://lkml.org/lkml/2018/6/1/38 It also improves MIPI capture operations stability on my testing platform where MIPI capture often failed and returned all-purple frames. Fixes: f22996db44e2 ("media: ov5640: add support of DVP parallel interface") Tested-by: Steve Longerbeam <slongerbeam@gmail.com> (i.MX6q SabreSD, CSI-2) Tested-by: Loic Poulain <loic.poulain@linaro.org> (Dragonboard-410c, CSI-2) Reported-by: Jagan Teki <jagan@amarulasolutions.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-09-17media: ov2680: rename ov2680_v4l2_init() to ov2680_v4l2_register()Javier Martinez Canillas1-2/+2
The function not only does initialization but also registers the subdevice so change its name to make this more clear. Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-09-17media: ov2680: don't register the v4l2 subdevice before checking chip IDJavier Martinez Canillas1-10/+4
The driver registers the v4l2 subdevice before attempting to power on the chip and checking its ID. This means that a media device driver that it's waiting for this subdevice to be bound, will prematurely expose its media device node to userspace because if something goes wrong the media entity will be cleaned up again on the ov2680 probe function. This also simplifies the probe function error path since no initialization is made before attempting to enable the resources or checking the chip ID. Fixes: 3ee47cad3e69 ("media: ov2680: Add Omnivision OV2680 sensor driver") Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-09-17media: sr030pc30: remove NULL in sr030pc30_base_config()Dan Carpenter1-1/+1
This code doesn't check for NULL consistently and it generates a Smatch warning: drivers/media/i2c/sr030pc30.c:575 sr030pc30_base_config() error: we previously assumed 'info->pdata' could be null (see line 572) Fortunately, "info->pdata" can't be NULL to that check can be removed. The other thing is that if "ret" is an error code here, then we don't want to do the next call to cam_i2c_write(), so actually let's flip that test around and return the error. This is more of a theoretical issue than something which is likely to affect real life. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-09-17media: v4l: sr030pc30: Remove redundant setting of sub-device nameSakari Ailus1-1/+0
The sub-device name is set right after in v4l2_i2c_subdev_init(). Remove the redundant strcpy() call. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-09-17media: smiapp: Use v4l2_i2c_subdev_set_nameSakari Ailus1-6/+4
Use v4l2_i2c_subdev_set_name() to set the name of the smiapp driver's sub-devices. There is no functional change. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-09-17media: imx274: switch to SPDX license identifierLuca Ceresoli1-12/+1
Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-09-17media: imx274: add helper to read multibyte registersLuca Ceresoli1-46/+47
Currently 2-bytes and 3-bytes registers are read one byte at a time, doing the needed shift & mask each time. Replace all of this code by a unique helper function that calls regmap_bulk_read(), which has two advantages: - reads all the bytes in a unique I2C transaction - simplifies code to read multibyte registers Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-09-17media: imx274: fix error in function docsLuca Ceresoli1-1/+1
This parameter holds the number of bytes, not bits. Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-09-17media: imx274: rename frmfmt and format to "mode"Luca Ceresoli1-9/+9
A mix of "mode", "format" and "frmfmt" is used to refer to the sensor readout mode. Use the term "mode" for all of them. Now "format" is only used in the V4L2 meaning. Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-09-17media: imx274: don't hard-code the subdev name to DRIVER_NAMELuca Ceresoli1-1/+0
Forcibly setting the subdev name to DRIVER_NAME (i.e. "IMX274") makes it non-unique and less informative. Let the driver use the default name from i2c, e.g. "IMX274 2-001a". Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-09-17media: imx274: rearrange sensor startup register tablesLuca Ceresoli1-23/+13
Rearrange the imx274_start_<N> register tables to better match the datasheet and slightly simplify code: - collapes tables 1 and 2, they are applied one after each other and together they implement the fixed part 1 of the startup procedure in the datasheet - while there, cleanup comments - rename tables 3 and 4 -> 2 and 3, coherently with the datasheet Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-09-17media: imx274: rename IMX274_DEFAULT_MODE to IMX274_DEFAULT_BINNINGLuca Ceresoli1-2/+2
The "mode" has been renamed to "binning" in commit 39dd23dc9d4c ("media: imx274: add cropping support via SELECTION API"), but this define has not been updated. Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-09-17media: dw9807-vcm: Remove redundant pm_runtime_set_suspended in removeSakari Ailus1-1/+0
The device is already suspended when it's the driver's remove function is called. Remove redundant pm_runtime_set_suspended call. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>