From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Ezequiel Garcia <ezequiel@collabora.com>,
Fabio Estevam <festevam@gmail.com>,
Philipp Zabel <p.zabel@pengutronix.de>,
Jacopo Mondi <jacopo@jmondi.org>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Mauro Carvalho Chehab <mchehab+samsung@kernel.org>,
Sasha Levin <sashal@kernel.org>,
linux-media@vger.kernel.org
Subject: [PATCH AUTOSEL 4.14 40/89] media: i2c: ov5645: Fix power sequence
Date: Sun, 22 Sep 2019 14:56:28 -0400 [thread overview]
Message-ID: <20190922185717.3412-40-sashal@kernel.org> (raw)
In-Reply-To: <20190922185717.3412-1-sashal@kernel.org>
From: Ezequiel Garcia <ezequiel@collabora.com>
[ Upstream commit 092e8eb90a7dc7dd210cd4e2ea36075d0a7f96af ]
This is mostly a port of Jacopo's fix:
commit aa4bb8b8838ffcc776a79f49a4d7476b82405349
Author: Jacopo Mondi <jacopo@jmondi.org>
Date: Fri Jul 6 05:51:52 2018 -0400
media: ov5640: Re-work MIPI startup sequence
In the OV5645 case, the changes are:
- 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 set_power(0) time power down MIPI Tx/Rx (in addition to the current
power down of regulators and clock gating).
- At s_stream time enable/disable the MIPI interface output.
With this commit the sensor is able to enter LP-11 mode during power up,
as expected by some CSI-2 controllers.
Many thanks to Fabio Estevam for his help debugging this issue.
Tested-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/media/i2c/ov5645.c | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/drivers/media/i2c/ov5645.c b/drivers/media/i2c/ov5645.c
index 2d96c18497593..de15a13443e47 100644
--- a/drivers/media/i2c/ov5645.c
+++ b/drivers/media/i2c/ov5645.c
@@ -53,6 +53,8 @@
#define OV5645_CHIP_ID_HIGH_BYTE 0x56
#define OV5645_CHIP_ID_LOW 0x300b
#define OV5645_CHIP_ID_LOW_BYTE 0x45
+#define OV5645_IO_MIPI_CTRL00 0x300e
+#define OV5645_PAD_OUTPUT00 0x3019
#define OV5645_AWB_MANUAL_CONTROL 0x3406
#define OV5645_AWB_MANUAL_ENABLE BIT(0)
#define OV5645_AEC_PK_MANUAL 0x3503
@@ -63,6 +65,7 @@
#define OV5645_ISP_VFLIP BIT(2)
#define OV5645_TIMING_TC_REG21 0x3821
#define OV5645_SENSOR_MIRROR BIT(1)
+#define OV5645_MIPI_CTRL00 0x4800
#define OV5645_PRE_ISP_TEST_SETTING_1 0x503d
#define OV5645_TEST_PATTERN_MASK 0x3
#define OV5645_SET_TEST_PATTERN(x) ((x) & OV5645_TEST_PATTERN_MASK)
@@ -129,7 +132,6 @@ static const struct reg_value ov5645_global_init_setting[] = {
{ 0x3503, 0x07 },
{ 0x3002, 0x1c },
{ 0x3006, 0xc3 },
- { 0x300e, 0x45 },
{ 0x3017, 0x00 },
{ 0x3018, 0x00 },
{ 0x302e, 0x0b },
@@ -358,7 +360,10 @@ static const struct reg_value ov5645_global_init_setting[] = {
{ 0x3a1f, 0x14 },
{ 0x0601, 0x02 },
{ 0x3008, 0x42 },
- { 0x3008, 0x02 }
+ { 0x3008, 0x02 },
+ { OV5645_IO_MIPI_CTRL00, 0x40 },
+ { OV5645_MIPI_CTRL00, 0x24 },
+ { OV5645_PAD_OUTPUT00, 0x70 }
};
static const struct reg_value ov5645_setting_sxga[] = {
@@ -743,13 +748,9 @@ static int ov5645_s_power(struct v4l2_subdev *sd, int on)
goto exit;
}
- ret = ov5645_write_reg(ov5645, OV5645_SYSTEM_CTRL0,
- OV5645_SYSTEM_CTRL0_STOP);
- if (ret < 0) {
- ov5645_set_power_off(ov5645);
- goto exit;
- }
+ usleep_range(500, 1000);
} else {
+ ov5645_write_reg(ov5645, OV5645_IO_MIPI_CTRL00, 0x58);
ov5645_set_power_off(ov5645);
}
}
@@ -1069,11 +1070,20 @@ static int ov5645_s_stream(struct v4l2_subdev *subdev, int enable)
dev_err(ov5645->dev, "could not sync v4l2 controls\n");
return ret;
}
+
+ ret = ov5645_write_reg(ov5645, OV5645_IO_MIPI_CTRL00, 0x45);
+ if (ret < 0)
+ return ret;
+
ret = ov5645_write_reg(ov5645, OV5645_SYSTEM_CTRL0,
OV5645_SYSTEM_CTRL0_START);
if (ret < 0)
return ret;
} else {
+ ret = ov5645_write_reg(ov5645, OV5645_IO_MIPI_CTRL00, 0x40);
+ if (ret < 0)
+ return ret;
+
ret = ov5645_write_reg(ov5645, OV5645_SYSTEM_CTRL0,
OV5645_SYSTEM_CTRL0_STOP);
if (ret < 0)
--
2.20.1
next prev parent reply other threads:[~2019-09-22 19:11 UTC|newest]
Thread overview: 89+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-22 18:55 [PATCH AUTOSEL 4.14 01/89] ALSA: hda: Flush interrupts on disabling Sasha Levin
2019-09-22 18:55 ` [PATCH AUTOSEL 4.14 02/89] regulator: lm363x: Fix off-by-one n_voltages for lm3632 ldo_vpos/ldo_vneg Sasha Levin
2019-09-22 18:55 ` [PATCH AUTOSEL 4.14 03/89] ASoC: sgtl5000: Fix charge pump source assignment Sasha Levin
2019-09-22 18:55 ` [PATCH AUTOSEL 4.14 04/89] dmaengine: bcm2835: Print error in case setting DMA mask fails Sasha Levin
2019-09-22 18:55 ` [PATCH AUTOSEL 4.14 05/89] leds: leds-lp5562 allow firmware files up to the maximum length Sasha Levin
2019-09-22 18:55 ` [PATCH AUTOSEL 4.14 06/89] media: dib0700: fix link error for dibx000_i2c_set_speed Sasha Levin
2019-09-22 18:55 ` [PATCH AUTOSEL 4.14 07/89] media: mtk-cir: lower de-glitch counter for rc-mm protocol Sasha Levin
2019-09-22 18:55 ` [PATCH AUTOSEL 4.14 08/89] media: exynos4-is: fix leaked of_node references Sasha Levin
2019-09-22 18:55 ` [PATCH AUTOSEL 4.14 09/89] media: hdpvr: Add device num check and handling Sasha Levin
2019-09-22 18:55 ` [PATCH AUTOSEL 4.14 10/89] media: i2c: ov5640: Check for devm_gpiod_get_optional() error Sasha Levin
2019-09-22 18:55 ` [PATCH AUTOSEL 4.14 11/89] sched/fair: Fix imbalance due to CPU affinity Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 12/89] sched/core: Fix CPU controller for !RT_GROUP_SCHED Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 13/89] x86/reboot: Always use NMI fallback when shutdown via reboot vector IPI fails Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 14/89] x86/apic: Soft disable APIC before initializing it Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 15/89] ALSA: hda - Show the fatal CORB/RIRB error more clearly Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 16/89] ALSA: i2c: ak4xxx-adda: Fix a possible null pointer dereference in build_adc_controls() Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 17/89] EDAC/mc: Fix grain_bits calculation Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 18/89] media: iguanair: add sanity checks Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 19/89] base: soc: Export soc_device_register/unregister APIs Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 20/89] ALSA: usb-audio: Skip bSynchAddress endpoint check if it is invalid Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 21/89] ia64:unwind: fix double free for mod->arch.init_unw_table Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 22/89] EDAC/altera: Use the proper type for the IRQ status bits Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 23/89] ASoC: rsnd: don't call clk_get_rate() under atomic context Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 24/89] md/raid1: end bio when the device faulty Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 25/89] md: don't call spare_active in md_reap_sync_thread if all member devices can't work Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 26/89] md: don't set In_sync if array is frozen Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 27/89] RAS: Fix prototype warnings Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 28/89] ACPI / processor: don't print errors for processorIDs == 0xff Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 29/89] EDAC, pnd2: Fix ioremap() size in dnv_rd_reg() Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 30/89] efi: cper: print AER info of PCIe fatal error Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 31/89] sched/fair: Use rq_lock/unlock in online_fair_sched_group Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 32/89] media: gspca: zero usb_buf on error Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 33/89] perf test vfs_getname: Disable ~/.perfconfig to get default output Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 34/89] media: mtk-mdp: fix reference count on old device tree Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 35/89] media: fdp1: Reduce FCP not found message level to debug Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 36/89] media: rc: imon: Allow iMON RC protocol for ffdc 7e device Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 37/89] dmaengine: iop-adma: use correct printk format strings Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 38/89] perf ftrace: Use CAP_SYS_ADMIN instead of euid==0 Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 39/89] perf record: Support aarch64 random socket_id assignment Sasha Levin
2019-09-22 18:56 ` Sasha Levin [this message]
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 41/89] media: omap3isp: Don't set streaming state on random subdevs Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 42/89] media: imx: mipi csi-2: Don't fail if initial state times-out Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 43/89] net: lpc-enet: fix printk format strings Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 44/89] ARM: dts: imx7d: cl-som-imx7: make ethernet work again Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 45/89] media: radio/si470x: kill urb on error Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 46/89] media: hdpvr: add terminating 0 at end of string Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 47/89] nbd: add missing config put Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 48/89] media: dvb-core: fix a memory leak bug Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 49/89] libperf: Fix alignment trap with xyarray contents in 'perf stat' Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 50/89] EDAC/amd64: Recognize DRAM device type ECC capability Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 51/89] EDAC/amd64: Decode syndrome before translating address Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 52/89] PM / devfreq: passive: Use non-devm notifiers Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 53/89] PM / devfreq: exynos-bus: Correct clock enable sequence Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 54/89] media: cec-notifier: clear cec_adap in cec_notifier_unregister Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 55/89] media: saa7146: add cleanup in hexium_attach() Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 56/89] media: cpia2_usb: fix memory leaks Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 57/89] media: saa7134: fix terminology around saa7134_i2c_eeprom_md7134_gate() Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 58/89] perf trace beauty ioctl: Fix off-by-one error in cmd->string table Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 59/89] media: ov9650: add a sanity check Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 60/89] ASoC: es8316: fix headphone mixer volume table Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 61/89] ACPI / CPPC: do not require the _PSD method Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 62/89] arm64: kpti: ensure patched kernel text is fetched from PoU Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 63/89] nvmet: fix data units read and written counters in SMART log Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 64/89] iommu/amd: Silence warnings under memory pressure Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 65/89] iommu/iova: Avoid false sharing on fq_timer_on Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 66/89] libtraceevent: Change users plugin directory Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 67/89] ARM: dts: exynos: Mark LDO10 as always-on on Peach Pit/Pi Chromebooks Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 68/89] ACPI: custom_method: fix memory leaks Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 69/89] ACPI / PCI: fix acpi_pci_irq_enable() memory leak Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 70/89] hwmon: (acpi_power_meter) Change log level for 'unsafe software power cap' Sasha Levin
2019-09-22 18:56 ` [PATCH AUTOSEL 4.14 71/89] md/raid1: fail run raid1 array when active disk less than one Sasha Levin
2019-09-22 18:57 ` [PATCH AUTOSEL 4.14 72/89] dmaengine: ti: edma: Do not reset reserved paRAM slots Sasha Levin
2019-09-22 18:57 ` [PATCH AUTOSEL 4.14 73/89] kprobes: Prohibit probing on BUG() and WARN() address Sasha Levin
2019-09-22 18:57 ` [PATCH AUTOSEL 4.14 74/89] s390/crypto: xts-aes-s390 fix extra run-time crypto self tests finding Sasha Levin
2019-09-22 18:57 ` [PATCH AUTOSEL 4.14 75/89] irqchip/gic-v3-its: Fix LPI release for Multi-MSI devices Sasha Levin
2019-09-22 18:57 ` [PATCH AUTOSEL 4.14 76/89] x86/platform/uv: Fix kmalloc() NULL check routine Sasha Levin
2019-09-22 18:57 ` [PATCH AUTOSEL 4.14 77/89] ASoC: dmaengine: Make the pcm->name equal to pcm->id if the name is not set Sasha Levin
2019-09-22 18:57 ` [PATCH AUTOSEL 4.14 78/89] raid5: don't set STRIPE_HANDLE to stripe which is in batch list Sasha Levin
2019-09-22 18:57 ` [PATCH AUTOSEL 4.14 79/89] mmc: core: Clarify sdio_irq_pending flag for MMC_CAP2_SDIO_IRQ_NOTHREAD Sasha Levin
2019-09-22 18:57 ` [PATCH AUTOSEL 4.14 80/89] mmc: sdhci: Fix incorrect switch to HS mode Sasha Levin
2019-09-22 18:57 ` [PATCH AUTOSEL 4.14 81/89] raid5: don't increment read_errors on EILSEQ return Sasha Levin
2019-09-22 18:57 ` [PATCH AUTOSEL 4.14 82/89] media: technisat-usb2: break out of loop at end of buffer Sasha Levin
2019-09-22 18:57 ` [PATCH AUTOSEL 4.14 83/89] libertas: Add missing sentinel at end of if_usb.c fw_table Sasha Levin
2019-09-22 18:57 ` [PATCH AUTOSEL 4.14 84/89] e1000e: add workaround for possible stalled packet Sasha Levin
2019-09-22 18:57 ` [PATCH AUTOSEL 4.14 85/89] ALSA: hda - Drop unsol event handler for Intel HDMI codecs Sasha Levin
2019-09-22 18:57 ` [PATCH AUTOSEL 4.14 86/89] drm/amd/powerplay/smu7: enforce minimal VBITimeout (v2) Sasha Levin
2019-09-22 18:57 ` [PATCH AUTOSEL 4.14 87/89] media: ttusb-dec: Fix info-leak in ttusb_dec_send_command() Sasha Levin
2019-09-22 18:57 ` [PATCH AUTOSEL 4.14 88/89] ALSA: hda/realtek - Blacklist PC beep for Lenovo ThinkCentre M73/93 Sasha Levin
2019-09-22 18:57 ` [PATCH AUTOSEL 4.14 89/89] btrfs: extent-tree: Make sure we only allocate extents from block groups with the same type Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190922185717.3412-40-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=ezequiel@collabora.com \
--cc=festevam@gmail.com \
--cc=jacopo@jmondi.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab+samsung@kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=sakari.ailus@linux.intel.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).