1
0
Fork 0
alistair23-linux/drivers/media
Jacopo Mondi aa4bb8b883 media: ov5640: Re-work MIPI startup sequence
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: f22996db44 ("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-17 15:21:48 -04:00
..
cec media: cec: move compat_ioctl handling to cec-api.c 2018-09-12 11:00:51 -04:00
common media: replace strcpy() by strscpy() 2018-09-11 13:32:17 -04:00
dvb-core media: dvb: use signal types to discover pads 2018-09-17 13:16:19 -04:00
dvb-frontends media: au8522: declare its own pads 2018-09-17 13:16:19 -04:00
firewire media: replace strcpy() by strscpy() 2018-09-11 13:32:17 -04:00
i2c media: ov5640: Re-work MIPI startup sequence 2018-09-17 15:21:48 -04:00
mmc media: siano: use GFP_DMA only for smssdio 2018-05-15 08:04:42 -04:00
pci media: saa7134: declare its own pads 2018-09-17 13:16:19 -04:00
platform media: vsp1: Document max_width restriction on UDS 2018-09-17 14:54:20 -04:00
radio media: replace strcpy() by strscpy() 2018-09-11 13:32:17 -04:00
rc media: use strscpy() instead of strlcpy() 2018-09-11 13:32:17 -04:00
spi media: cxd2880-spi: Modified how to declare structure 2018-05-05 10:37:12 -04:00
tuners media: si2157: declare its own pads 2018-09-17 13:16:19 -04:00
usb media: mxl111sf: declare its own pads 2018-09-17 13:16:19 -04:00
v4l2-core media: v4l: subdev: Add a function to set an I²C sub-device's name 2018-09-17 15:17:22 -04:00
Kconfig media: cec: Kconfig coding style issue 2018-05-09 16:26:50 -04:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
media-device.c media: use strscpy() instead of strlcpy() 2018-09-11 13:32:17 -04:00
media-devnode.c MAINTAINERS & files: Canonize the e-mails I use at files 2018-05-04 06:21:06 -04:00
media-entity.c media: v4l2-mc: switch it to use the new approach to setup pipelines 2018-09-17 13:16:19 -04:00