From: Greg Kroah-Hartman Date: Mon, 6 May 2019 14:29:05 +0000 (+0200) Subject: 3.18-stable patches X-Git-Tag: v4.9.174~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1e92ac6a51014125fe542c9b36d677293cce2e66;p=thirdparty%2Fkernel%2Fstable-queue.git 3.18-stable patches added patches: media-v4l2-i2c-ov7670-fix-pll-bypass-register-values.patch --- diff --git a/queue-3.18/media-v4l2-i2c-ov7670-fix-pll-bypass-register-values.patch b/queue-3.18/media-v4l2-i2c-ov7670-fix-pll-bypass-register-values.patch new file mode 100644 index 00000000000..25aa8fa004b --- /dev/null +++ b/queue-3.18/media-v4l2-i2c-ov7670-fix-pll-bypass-register-values.patch @@ -0,0 +1,82 @@ +From 61da76beef1e4f0b6ba7be4f8d0cf0dac7ce1f55 Mon Sep 17 00:00:00 2001 +From: Jacopo Mondi +Date: Fri, 29 Dec 2017 07:22:26 -0500 +Subject: media: v4l2: i2c: ov7670: Fix PLL bypass register values + +From: Jacopo Mondi + +commit 61da76beef1e4f0b6ba7be4f8d0cf0dac7ce1f55 upstream. + +The following commits: +commit f6dd927f34d6 ("[media] media: ov7670: calculate framerate properly for ov7675") +commit 04ee6d92047e ("[media] media: ov7670: add possibility to bypass pll for ov7675") +introduced the ability to bypass PLL multiplier and use input clock (xvclk) +as pixel clock output frequency for ov7675 sensor. + +PLL is bypassed using register DBLV[7:6], according to ov7670 and ov7675 +sensor manuals. Macros used to set DBLV register seem wrong in the +driver, as their values do not match what reported in the datasheet. + +Fix by changing DBLV_* macros to use bits [7:6] and set bits [3:0] to +default 0x0a reserved value (according to datasheets). + +While at there, remove a write to DBLV register in +"ov7675_set_framerate()" that over-writes the previous one to the same +register that takes "info->pll_bypass" flag into account instead of setting PLL +multiplier to 4x unconditionally. + +And, while at there, since "info->pll_bypass" is only used in +set/get_framerate() functions used by ov7675 only, it is not necessary +to check for the device id at probe time to make sure that when using +ov7670 "info->pll_bypass" is set to false. + +Fixes: f6dd927f34d6 ("[media] media: ov7670: calculate framerate properly for ov7675") + +Signed-off-by: Jacopo Mondi +Signed-off-by: Sakari Ailus +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/media/i2c/ov7670.c | 16 ++++++---------- + 1 file changed, 6 insertions(+), 10 deletions(-) + +--- a/drivers/media/i2c/ov7670.c ++++ b/drivers/media/i2c/ov7670.c +@@ -155,10 +155,10 @@ MODULE_PARM_DESC(debug, "Debug level (0- + #define REG_GFIX 0x69 /* Fix gain control */ + + #define REG_DBLV 0x6b /* PLL control an debugging */ +-#define DBLV_BYPASS 0x00 /* Bypass PLL */ +-#define DBLV_X4 0x01 /* clock x4 */ +-#define DBLV_X6 0x10 /* clock x6 */ +-#define DBLV_X8 0x11 /* clock x8 */ ++#define DBLV_BYPASS 0x0a /* Bypass PLL */ ++#define DBLV_X4 0x4a /* clock x4 */ ++#define DBLV_X6 0x8a /* clock x6 */ ++#define DBLV_X8 0xca /* clock x8 */ + + #define REG_REG76 0x76 /* OV's name */ + #define R76_BLKPCOR 0x80 /* Black pixel correction enable */ +@@ -833,7 +833,7 @@ static int ov7675_set_framerate(struct v + if (ret < 0) + return ret; + +- return ov7670_write(sd, REG_DBLV, DBLV_X4); ++ return 0; + } + + static void ov7670_get_framerate_legacy(struct v4l2_subdev *sd, +@@ -1540,11 +1540,7 @@ static int ov7670_probe(struct i2c_clien + if (config->clock_speed) + info->clock_speed = config->clock_speed; + +- /* +- * It should be allowed for ov7670 too when it is migrated to +- * the new frame rate formula. +- */ +- if (config->pll_bypass && id->driver_data != MODEL_OV7670) ++ if (config->pll_bypass) + info->pll_bypass = true; + + if (config->pclk_hb_disable) diff --git a/queue-3.18/series b/queue-3.18/series index cc985d682de..b025ccc6668 100644 --- a/queue-3.18/series +++ b/queue-3.18/series @@ -48,3 +48,4 @@ usb-usbip-fix-isoc-packet-num-validation-in-get_pipe.patch staging-iio-adt7316-allow-adt751x-to-use-internal-vref-for-all-dacs.patch staging-iio-adt7316-fix-the-dac-read-calculation.patch staging-iio-adt7316-fix-the-dac-write-calculation.patch +media-v4l2-i2c-ov7670-fix-pll-bypass-register-values.patch