linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/5] ov7670 fixes
@ 2019-01-15  8:54 Lubomir Rintel
  2019-01-15  8:54 ` [PATCH v4 1/5] ov7670: Remove useless use of a ret variable Lubomir Rintel
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Lubomir Rintel @ 2019-01-15  8:54 UTC (permalink / raw)
  To: Sakari Ailus; +Cc: linux-media, linux-kernel

Hi,

here are the ov7670 patches originally from the "media: make Marvell camera
work on DT-based OLPC XO-1.75" updated to apply cleanly on top of
<git://linuxtv.org/sailus/media_tree.git> master as requested.

I've also added "ov7670: Remove useless use of a ret variable" with my Ack
slapped on it.

Lubo




^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v4 1/5] ov7670: Remove useless use of a ret variable
  2019-01-15  8:54 [PATCH v4 0/5] ov7670 fixes Lubomir Rintel
@ 2019-01-15  8:54 ` Lubomir Rintel
  2019-01-15  8:54 ` [PATCH v4 2/5] media: ov7670: hook s_power onto v4l2 core Lubomir Rintel
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Lubomir Rintel @ 2019-01-15  8:54 UTC (permalink / raw)
  To: Sakari Ailus; +Cc: linux-media, linux-kernel, Sakari Ailus, Lubomir Rintel

From: Sakari Ailus <sakari.ailus@linux.intel.com>

Instead of assigning the return value to ret and then checking and
returning it, just return the value to the caller directly. The success
value is always 0.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Lubomir Rintel <lkundrak@v3.sk>

---
 drivers/media/i2c/ov7670.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/media/i2c/ov7670.c b/drivers/media/i2c/ov7670.c
index 4939a83b50e4..61c47c61c693 100644
--- a/drivers/media/i2c/ov7670.c
+++ b/drivers/media/i2c/ov7670.c
@@ -859,11 +859,7 @@ static int ov7675_set_framerate(struct v4l2_subdev *sd,
 	/* Recalculate frame rate */
 	ov7675_get_framerate(sd, tpf);
 
-	ret = ov7670_write(sd, REG_CLKRC, info->clkrc);
-	if (ret < 0)
-		return ret;
-
-	return 0;
+	return ov7670_write(sd, REG_CLKRC, info->clkrc);
 }
 
 static void ov7670_get_framerate_legacy(struct v4l2_subdev *sd,
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v4 2/5] media: ov7670: hook s_power onto v4l2 core
  2019-01-15  8:54 [PATCH v4 0/5] ov7670 fixes Lubomir Rintel
  2019-01-15  8:54 ` [PATCH v4 1/5] ov7670: Remove useless use of a ret variable Lubomir Rintel
@ 2019-01-15  8:54 ` Lubomir Rintel
  2019-01-15  8:54 ` [PATCH v4 3/5] media: ov7670: control clock along with power Lubomir Rintel
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Lubomir Rintel @ 2019-01-15  8:54 UTC (permalink / raw)
  To: Sakari Ailus; +Cc: linux-media, linux-kernel, Lubomir Rintel, Sakari Ailus

The commit 71862f63f351 ("media: ov7670: Add the ov7670_s_power function")
added a power control routing. However, it was not good enough to use as
a s_power() callback: it merely flipped on the power GPIOs without
restoring the register settings.

Fix this now and register an actual power callback.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 drivers/media/i2c/ov7670.c | 50 +++++++++++++++++++++++++++++++++-----
 1 file changed, 44 insertions(+), 6 deletions(-)

diff --git a/drivers/media/i2c/ov7670.c b/drivers/media/i2c/ov7670.c
index 61c47c61c693..4679aa9dc430 100644
--- a/drivers/media/i2c/ov7670.c
+++ b/drivers/media/i2c/ov7670.c
@@ -242,6 +242,7 @@ struct ov7670_info {
 	struct v4l2_mbus_framefmt format;
 	struct ov7670_format_struct *fmt;  /* Current format */
 	struct clk *clk;
+	int on;
 	struct gpio_desc *resetb_gpio;
 	struct gpio_desc *pwdn_gpio;
 	unsigned int mbus_config;	/* Media bus configuration flags */
@@ -1603,19 +1604,54 @@ static int ov7670_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_regis
 }
 #endif
 
-static int ov7670_s_power(struct v4l2_subdev *sd, int on)
+static void ov7670_power_on(struct v4l2_subdev *sd)
 {
 	struct ov7670_info *info = to_state(sd);
 
+	if (info->on)
+		return;
+
 	if (info->pwdn_gpio)
-		gpiod_set_value(info->pwdn_gpio, !on);
-	if (on && info->resetb_gpio) {
+		gpiod_set_value(info->pwdn_gpio, 0);
+	if (info->resetb_gpio) {
 		gpiod_set_value(info->resetb_gpio, 1);
 		usleep_range(500, 1000);
 		gpiod_set_value(info->resetb_gpio, 0);
 		usleep_range(3000, 5000);
 	}
 
+	info->on = true;
+}
+
+static void ov7670_power_off(struct v4l2_subdev *sd)
+{
+	struct ov7670_info *info = to_state(sd);
+
+	if (!info->on)
+		return;
+
+	if (info->pwdn_gpio)
+		gpiod_set_value(info->pwdn_gpio, 1);
+
+	info->on = false;
+}
+
+static int ov7670_s_power(struct v4l2_subdev *sd, int on)
+{
+	struct ov7670_info *info = to_state(sd);
+
+	if (info->on == on)
+		return 0;
+
+	if (on) {
+		ov7670_power_on (sd);
+		ov7670_apply_fmt(sd);
+		ov7675_apply_framerate(sd);
+		v4l2_ctrl_handler_setup(&info->hdl);
+	} else {
+		ov7670_power_off (sd);
+	}
+
 	return 0;
 }
 
@@ -1648,6 +1684,7 @@ static int ov7670_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
 static const struct v4l2_subdev_core_ops ov7670_core_ops = {
 	.reset = ov7670_reset,
 	.init = ov7670_init,
+	.s_power = ov7670_s_power,
 	.log_status = v4l2_ctrl_subdev_log_status,
 	.subscribe_event = v4l2_ctrl_subdev_subscribe_event,
 	.unsubscribe_event = v4l2_event_subdev_unsubscribe,
@@ -1812,6 +1849,7 @@ static int ov7670_probe(struct i2c_client *client,
 		else
 			return ret;
 	}
+
 	if (info->clk) {
 		ret = clk_prepare_enable(info->clk);
 		if (ret)
@@ -1828,7 +1866,7 @@ static int ov7670_probe(struct i2c_client *client,
 	if (ret)
 		goto clk_disable;
 
-	ov7670_s_power(sd, 1);
+	ov7670_power_on(sd);
 
 	/* Make sure it's an ov7670 */
 	ret = ov7670_detect(sd);
@@ -1915,7 +1953,7 @@ static int ov7670_probe(struct i2c_client *client,
 hdl_free:
 	v4l2_ctrl_handler_free(&info->hdl);
 power_off:
-	ov7670_s_power(sd, 0);
+	ov7670_power_off(sd);
 clk_disable:
 	clk_disable_unprepare(info->clk);
 	return ret;
@@ -1931,7 +1969,7 @@ static int ov7670_remove(struct i2c_client *client)
 	v4l2_ctrl_handler_free(&info->hdl);
 	clk_disable_unprepare(info->clk);
 	media_entity_cleanup(&info->sd.entity);
-	ov7670_s_power(sd, 0);
+	ov7670_power_off(sd);
 	return 0;
 }
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v4 3/5] media: ov7670: control clock along with power
  2019-01-15  8:54 [PATCH v4 0/5] ov7670 fixes Lubomir Rintel
  2019-01-15  8:54 ` [PATCH v4 1/5] ov7670: Remove useless use of a ret variable Lubomir Rintel
  2019-01-15  8:54 ` [PATCH v4 2/5] media: ov7670: hook s_power onto v4l2 core Lubomir Rintel
@ 2019-01-15  8:54 ` Lubomir Rintel
  2019-01-15  8:54 ` [PATCH v4 4/5] media: ov7670: split register setting from set_fmt() logic Lubomir Rintel
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Lubomir Rintel @ 2019-01-15  8:54 UTC (permalink / raw)
  To: Sakari Ailus; +Cc: linux-media, linux-kernel, Lubomir Rintel, Sakari Ailus

This provides more power saving when the sensor is off.

While at that, do the delay on power/clock enable even if the sensor driver
itself doesn't control the GPIOs. This is required for the OLPC XO-1
platform, that lacks the proper power/reset properties in its DT, but
needs the delay after the sensor is clocked up.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 drivers/media/i2c/ov7670.c | 30 ++++++++++++++----------------
 1 file changed, 14 insertions(+), 16 deletions(-)

diff --git a/drivers/media/i2c/ov7670.c b/drivers/media/i2c/ov7670.c
index 4679aa9dc430..93c055502bb9 100644
--- a/drivers/media/i2c/ov7670.c
+++ b/drivers/media/i2c/ov7670.c
@@ -1611,14 +1611,17 @@ static void ov7670_power_on(struct v4l2_subdev *sd)
 	if (info->on)
 		return;
 
+	clk_prepare_enable(info->clk);
+
 	if (info->pwdn_gpio)
 		gpiod_set_value(info->pwdn_gpio, 0);
 	if (info->resetb_gpio) {
 		gpiod_set_value(info->resetb_gpio, 1);
 		usleep_range(500, 1000);
 		gpiod_set_value(info->resetb_gpio, 0);
-		usleep_range(3000, 5000);
 	}
+	if (info->pwdn_gpio || info->resetb_gpio || info->clk)
+		usleep_range(3000, 5000);
 
 	info->on = true;
 }
@@ -1630,6 +1633,8 @@ static void ov7670_power_off(struct v4l2_subdev *sd)
 	if (!info->on)
 		return;
 
+	clk_disable_unprepare(info->clk);
+
 	if (info->pwdn_gpio)
 		gpiod_set_value(info->pwdn_gpio, 1);
 
@@ -1850,24 +1855,20 @@ static int ov7670_probe(struct i2c_client *client,
 			return ret;
 	}
 
-	if (info->clk) {
-		ret = clk_prepare_enable(info->clk);
-		if (ret)
-			return ret;
+	ret = ov7670_init_gpio(client, info);
+	if (ret)
+		return ret;
 
+	ov7670_power_on(sd);
+
+	if (info->clk) {
 		info->clock_speed = clk_get_rate(info->clk) / 1000000;
 		if (info->clock_speed < 10 || info->clock_speed > 48) {
 			ret = -EINVAL;
-			goto clk_disable;
+			goto power_off;
 		}
 	}
 
-	ret = ov7670_init_gpio(client, info);
-	if (ret)
-		goto clk_disable;
-
-	ov7670_power_on(sd);
-
 	/* Make sure it's an ov7670 */
 	ret = ov7670_detect(sd);
 	if (ret) {
@@ -1946,6 +1947,7 @@ static int ov7670_probe(struct i2c_client *client,
 	if (ret < 0)
 		goto entity_cleanup;
 
+	ov7670_power_off(sd);
 	return 0;
 
 entity_cleanup:
@@ -1954,12 +1956,9 @@ static int ov7670_probe(struct i2c_client *client,
 	v4l2_ctrl_handler_free(&info->hdl);
 power_off:
 	ov7670_power_off(sd);
-clk_disable:
-	clk_disable_unprepare(info->clk);
 	return ret;
 }
 
-
 static int ov7670_remove(struct i2c_client *client)
 {
 	struct v4l2_subdev *sd = i2c_get_clientdata(client);
@@ -1967,7 +1966,6 @@ static int ov7670_remove(struct i2c_client *client)
 
 	v4l2_async_unregister_subdev(sd);
 	v4l2_ctrl_handler_free(&info->hdl);
-	clk_disable_unprepare(info->clk);
 	media_entity_cleanup(&info->sd.entity);
 	ov7670_power_off(sd);
 	return 0;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v4 4/5] media: ov7670: split register setting from set_fmt() logic
  2019-01-15  8:54 [PATCH v4 0/5] ov7670 fixes Lubomir Rintel
                   ` (2 preceding siblings ...)
  2019-01-15  8:54 ` [PATCH v4 3/5] media: ov7670: control clock along with power Lubomir Rintel
@ 2019-01-15  8:54 ` Lubomir Rintel
  2019-01-15  8:54 ` [PATCH v4 5/5] media: ov7670: split register setting from set_framerate() logic Lubomir Rintel
  2019-01-15 10:40 ` [PATCH v4 0/5] ov7670 fixes Sakari Ailus
  5 siblings, 0 replies; 10+ messages in thread
From: Lubomir Rintel @ 2019-01-15  8:54 UTC (permalink / raw)
  To: Sakari Ailus; +Cc: linux-media, linux-kernel, Lubomir Rintel

This will allow us to restore the last set format after the device returns
from a power off.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
 drivers/media/i2c/ov7670.c | 80 ++++++++++++++++++++++----------------
 1 file changed, 46 insertions(+), 34 deletions(-)

diff --git a/drivers/media/i2c/ov7670.c b/drivers/media/i2c/ov7670.c
index 93c055502bb9..d0f40d5f6ca0 100644
--- a/drivers/media/i2c/ov7670.c
+++ b/drivers/media/i2c/ov7670.c
@@ -241,6 +241,7 @@ struct ov7670_info {
 	};
 	struct v4l2_mbus_framefmt format;
 	struct ov7670_format_struct *fmt;  /* Current format */
+	struct ov7670_win_size *wsize;
 	struct clk *clk;
 	int on;
 	struct gpio_desc *resetb_gpio;
@@ -1001,48 +1002,20 @@ static int ov7670_try_fmt_internal(struct v4l2_subdev *sd,
 	return 0;
 }
 
-/*
- * Set a format.
- */
-static int ov7670_set_fmt(struct v4l2_subdev *sd,
-		struct v4l2_subdev_pad_config *cfg,
-		struct v4l2_subdev_format *format)
+static int ov7670_apply_fmt(struct v4l2_subdev *sd)
 {
-	struct ov7670_format_struct *ovfmt;
-	struct ov7670_win_size *wsize;
 	struct ov7670_info *info = to_state(sd);
-#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
-	struct v4l2_mbus_framefmt *mbus_fmt;
-#endif
+	struct ov7670_win_size *wsize = info->wsize;
 	unsigned char com7, com10 = 0;
 	int ret;
 
-	if (format->pad)
-		return -EINVAL;
-
-	if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
-		ret = ov7670_try_fmt_internal(sd, &format->format, NULL, NULL);
-		if (ret)
-			return ret;
-#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
-		mbus_fmt = v4l2_subdev_get_try_format(sd, cfg, format->pad);
-		*mbus_fmt = format->format;
-		return 0;
-#else
-		return -ENOTTY;
-#endif
-	}
-
-	ret = ov7670_try_fmt_internal(sd, &format->format, &ovfmt, &wsize);
-	if (ret)
-		return ret;
 	/*
 	 * COM7 is a pain in the ass, it doesn't like to be read then
 	 * quickly written afterward.  But we have everything we need
 	 * to set it absolutely here, as long as the format-specific
 	 * register sets list it first.
 	 */
-	com7 = ovfmt->regs[0].value;
+	com7 = info->fmt->regs[0].value;
 	com7 |= wsize->com7_bit;
 	ret = ov7670_write(sd, REG_COM7, com7);
 	if (ret)
@@ -1064,7 +1037,7 @@ static int ov7670_set_fmt(struct v4l2_subdev *sd,
 	/*
 	 * Now write the rest of the array.  Also store start/stops
 	 */
-	ret = ov7670_write_array(sd, ovfmt->regs + 1);
+	ret = ov7670_write_array(sd, info->fmt->regs + 1);
 	if (ret)
 		return ret;
 
@@ -1079,8 +1052,6 @@ static int ov7670_set_fmt(struct v4l2_subdev *sd,
 			return ret;
 	}
 
-	info->fmt = ovfmt;
-
 	/*
 	 * If we're running RGB565, we must rewrite clkrc after setting
 	 * the other parameters or the image looks poor.  If we're *not*
@@ -1098,6 +1069,46 @@ static int ov7670_set_fmt(struct v4l2_subdev *sd,
 	return 0;
 }
 
+/*
+ * Set a format.
+ */
+static int ov7670_set_fmt(struct v4l2_subdev *sd,
+		struct v4l2_subdev_pad_config *cfg,
+		struct v4l2_subdev_format *format)
+{
+	struct ov7670_info *info = to_state(sd);
+#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
+	struct v4l2_mbus_framefmt *mbus_fmt;
+#endif
+	int ret;
+
+	if (format->pad)
+		return -EINVAL;
+
+	if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
+		ret = ov7670_try_fmt_internal(sd, &format->format, NULL, NULL);
+		if (ret)
+			return ret;
+#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
+		mbus_fmt = v4l2_subdev_get_try_format(sd, cfg, format->pad);
+		*mbus_fmt = format->format;
+		return 0;
+#else
+		return -ENOTTY;
+#endif
+	}
+
+	ret = ov7670_try_fmt_internal(sd, &format->format, &info->fmt, &info->wsize);
+	if (ret)
+		return ret;
+
+	ret = ov7670_apply_fmt(sd);
+	if (ret)
+		return ret;
+
+	return 0;
+}
+
 static int ov7670_get_fmt(struct v4l2_subdev *sd,
 			  struct v4l2_subdev_pad_config *cfg,
 			  struct v4l2_subdev_format *format)
@@ -1882,6 +1893,7 @@ static int ov7670_probe(struct i2c_client *client,
 
 	info->devtype = &ov7670_devdata[id->driver_data];
 	info->fmt = &ov7670_formats[0];
+	info->wsize = &info->devtype->win_sizes[0];
 
 	ov7670_get_default_format(sd, &info->format);
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v4 5/5] media: ov7670: split register setting from set_framerate() logic
  2019-01-15  8:54 [PATCH v4 0/5] ov7670 fixes Lubomir Rintel
                   ` (3 preceding siblings ...)
  2019-01-15  8:54 ` [PATCH v4 4/5] media: ov7670: split register setting from set_fmt() logic Lubomir Rintel
@ 2019-01-15  8:54 ` Lubomir Rintel
  2019-01-15  9:07   ` Sakari Ailus
  2019-01-15 10:40 ` [PATCH v4 0/5] ov7670 fixes Sakari Ailus
  5 siblings, 1 reply; 10+ messages in thread
From: Lubomir Rintel @ 2019-01-15  8:54 UTC (permalink / raw)
  To: Sakari Ailus; +Cc: linux-media, linux-kernel, Lubomir Rintel

This will allow us to restore the last set frame rate after the device
returns from a power off.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
 drivers/media/i2c/ov7670.c | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/drivers/media/i2c/ov7670.c b/drivers/media/i2c/ov7670.c
index d0f40d5f6ca0..6f9a53d4dcfc 100644
--- a/drivers/media/i2c/ov7670.c
+++ b/drivers/media/i2c/ov7670.c
@@ -812,13 +812,24 @@ static void ov7675_get_framerate(struct v4l2_subdev *sd,
 			(4 * clkrc);
 }
 
+static int ov7675_apply_framerate(struct v4l2_subdev *sd)
+{
+	struct ov7670_info *info = to_state(sd);
+	int ret;
+
+	ret = ov7670_write(sd, REG_CLKRC, info->clkrc);
+	if (ret < 0)
+		return ret;
+
+	return ov7670_write(sd, REG_DBLV, info->pll_bypass ? DBLV_BYPASS : DBLV_X4);
+}
+
 static int ov7675_set_framerate(struct v4l2_subdev *sd,
 				 struct v4l2_fract *tpf)
 {
 	struct ov7670_info *info = to_state(sd);
 	u32 clkrc;
 	int pll_factor;
-	int ret;
 
 	/*
 	 * The formula is fps = 5/4*pixclk for YUV/RGB and
@@ -827,19 +838,10 @@ static int ov7675_set_framerate(struct v4l2_subdev *sd,
 	 * pixclk = clock_speed / (clkrc + 1) * PLLfactor
 	 *
 	 */
-	if (info->pll_bypass) {
-		pll_factor = 1;
-		ret = ov7670_write(sd, REG_DBLV, DBLV_BYPASS);
-	} else {
-		pll_factor = PLL_FACTOR;
-		ret = ov7670_write(sd, REG_DBLV, DBLV_X4);
-	}
-	if (ret < 0)
-		return ret;
-
 	if (tpf->numerator == 0 || tpf->denominator == 0) {
 		clkrc = 0;
 	} else {
+		pll_factor = info->pll_bypass ? 1 : PLL_FACTOR;
 		clkrc = (5 * pll_factor * info->clock_speed * tpf->numerator) /
 			(4 * tpf->denominator);
 		if (info->fmt->mbus_code == MEDIA_BUS_FMT_SBGGR8_1X8)
@@ -861,7 +863,7 @@ static int ov7675_set_framerate(struct v4l2_subdev *sd,
 	/* Recalculate frame rate */
 	ov7675_get_framerate(sd, tpf);
 
-	return ov7670_write(sd, REG_CLKRC, info->clkrc);
+	return ov7675_apply_framerate(sd);
 }
 
 static void ov7670_get_framerate_legacy(struct v4l2_subdev *sd,
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v4 5/5] media: ov7670: split register setting from set_framerate() logic
  2019-01-15  8:54 ` [PATCH v4 5/5] media: ov7670: split register setting from set_framerate() logic Lubomir Rintel
@ 2019-01-15  9:07   ` Sakari Ailus
  0 siblings, 0 replies; 10+ messages in thread
From: Sakari Ailus @ 2019-01-15  9:07 UTC (permalink / raw)
  To: Lubomir Rintel; +Cc: linux-media, linux-kernel

On Tue, Jan 15, 2019 at 09:54:48AM +0100, Lubomir Rintel wrote:
> This will allow us to restore the last set frame rate after the device
> returns from a power off.
> 
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>

Thanks!

I've applied them, and hopefully all is well now.

> ---
>  drivers/media/i2c/ov7670.c | 26 ++++++++++++++------------
>  1 file changed, 14 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/media/i2c/ov7670.c b/drivers/media/i2c/ov7670.c
> index d0f40d5f6ca0..6f9a53d4dcfc 100644
> --- a/drivers/media/i2c/ov7670.c
> +++ b/drivers/media/i2c/ov7670.c
> @@ -812,13 +812,24 @@ static void ov7675_get_framerate(struct v4l2_subdev *sd,
>  			(4 * clkrc);
>  }
>  
> +static int ov7675_apply_framerate(struct v4l2_subdev *sd)
> +{
> +	struct ov7670_info *info = to_state(sd);
> +	int ret;
> +
> +	ret = ov7670_write(sd, REG_CLKRC, info->clkrc);
> +	if (ret < 0)
> +		return ret;
> +
> +	return ov7670_write(sd, REG_DBLV, info->pll_bypass ? DBLV_BYPASS : DBLV_X4);

I wrapped this to avoid it exceeding 80... no other changes.

> +}

-- 
Sakari Ailus

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v4 0/5] ov7670 fixes
  2019-01-15  8:54 [PATCH v4 0/5] ov7670 fixes Lubomir Rintel
                   ` (4 preceding siblings ...)
  2019-01-15  8:54 ` [PATCH v4 5/5] media: ov7670: split register setting from set_framerate() logic Lubomir Rintel
@ 2019-01-15 10:40 ` Sakari Ailus
  2019-01-15 11:12   ` Lubomir Rintel
  5 siblings, 1 reply; 10+ messages in thread
From: Sakari Ailus @ 2019-01-15 10:40 UTC (permalink / raw)
  To: Lubomir Rintel; +Cc: linux-media, linux-kernel

On Tue, Jan 15, 2019 at 09:54:43AM +0100, Lubomir Rintel wrote:
> Hi,
> 
> here are the ov7670 patches originally from the "media: make Marvell camera
> work on DT-based OLPC XO-1.75" updated to apply cleanly on top of
> <git://linuxtv.org/sailus/media_tree.git> master as requested.
> 
> I've also added "ov7670: Remove useless use of a ret variable" with my Ack
> slapped on it.

Hi Lubomir,

It seems the end result compiles but the intermedia patches do not. Could
you resend, please? I'll replace the patches in my tree with a new version
then...

Thanks.

-- 
Sakari Ailus

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v4 0/5] ov7670 fixes
  2019-01-15 10:40 ` [PATCH v4 0/5] ov7670 fixes Sakari Ailus
@ 2019-01-15 11:12   ` Lubomir Rintel
  2019-01-15 11:24     ` Sakari Ailus
  0 siblings, 1 reply; 10+ messages in thread
From: Lubomir Rintel @ 2019-01-15 11:12 UTC (permalink / raw)
  To: Sakari Ailus; +Cc: linux-media, linux-kernel

On Tue, 2019-01-15 at 12:40 +0200, Sakari Ailus wrote:
> On Tue, Jan 15, 2019 at 09:54:43AM +0100, Lubomir Rintel wrote:
> > Hi,
> > 
> > here are the ov7670 patches originally from the "media: make Marvell camera
> > work on DT-based OLPC XO-1.75" updated to apply cleanly on top of
> > <git://linuxtv.org/sailus/media_tree.git> master as requested.
> > 
> > I've also added "ov7670: Remove useless use of a ret variable" with my Ack
> > slapped on it.
> 
> Hi Lubomir,
> 
> It seems the end result compiles but the intermedia patches do not. Could
> you resend, please? I'll replace the patches in my tree with a new version
> then...

Seems like the order got messed up. It should be sufficient to reorder
the patches like this:

pick f42ae764598a ov7670: Remove useless use of a ret variable
pick 5be2efe0e5bb media: ov7670: split register setting from set_fmt() logic
pick 38eed963866e media: ov7670: split register setting from set_framerate() logic
pick 97be3c31de46 media: ov7670: hook s_power onto v4l2 core
pick 56c292d92642 media: ov7670: control clock along with power

(With "git rebase -i 87680151c22eee5b3bb6361fb8d18d765a9d8aff")


> 
> Thanks.

Cheers,
Lubo


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v4 0/5] ov7670 fixes
  2019-01-15 11:12   ` Lubomir Rintel
@ 2019-01-15 11:24     ` Sakari Ailus
  0 siblings, 0 replies; 10+ messages in thread
From: Sakari Ailus @ 2019-01-15 11:24 UTC (permalink / raw)
  To: Lubomir Rintel; +Cc: linux-media, linux-kernel

On Tue, Jan 15, 2019 at 12:12:56PM +0100, Lubomir Rintel wrote:
> On Tue, 2019-01-15 at 12:40 +0200, Sakari Ailus wrote:
> > On Tue, Jan 15, 2019 at 09:54:43AM +0100, Lubomir Rintel wrote:
> > > Hi,
> > > 
> > > here are the ov7670 patches originally from the "media: make Marvell camera
> > > work on DT-based OLPC XO-1.75" updated to apply cleanly on top of
> > > <git://linuxtv.org/sailus/media_tree.git> master as requested.
> > > 
> > > I've also added "ov7670: Remove useless use of a ret variable" with my Ack
> > > slapped on it.
> > 
> > Hi Lubomir,
> > 
> > It seems the end result compiles but the intermedia patches do not. Could
> > you resend, please? I'll replace the patches in my tree with a new version
> > then...
> 
> Seems like the order got messed up. It should be sufficient to reorder
> the patches like this:
> 
> pick f42ae764598a ov7670: Remove useless use of a ret variable
> pick 5be2efe0e5bb media: ov7670: split register setting from set_fmt() logic
> pick 38eed963866e media: ov7670: split register setting from set_framerate() logic
> pick 97be3c31de46 media: ov7670: hook s_power onto v4l2 core
> pick 56c292d92642 media: ov7670: control clock along with power
> 
> (With "git rebase -i 87680151c22eee5b3bb6361fb8d18d765a9d8aff")

Oh well. Done; let's see if that works better...

-- 
Sakari Ailus

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-01-15 11:25 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-15  8:54 [PATCH v4 0/5] ov7670 fixes Lubomir Rintel
2019-01-15  8:54 ` [PATCH v4 1/5] ov7670: Remove useless use of a ret variable Lubomir Rintel
2019-01-15  8:54 ` [PATCH v4 2/5] media: ov7670: hook s_power onto v4l2 core Lubomir Rintel
2019-01-15  8:54 ` [PATCH v4 3/5] media: ov7670: control clock along with power Lubomir Rintel
2019-01-15  8:54 ` [PATCH v4 4/5] media: ov7670: split register setting from set_fmt() logic Lubomir Rintel
2019-01-15  8:54 ` [PATCH v4 5/5] media: ov7670: split register setting from set_framerate() logic Lubomir Rintel
2019-01-15  9:07   ` Sakari Ailus
2019-01-15 10:40 ` [PATCH v4 0/5] ov7670 fixes Sakari Ailus
2019-01-15 11:12   ` Lubomir Rintel
2019-01-15 11:24     ` Sakari Ailus

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).