openwrt/target/linux/bcm27xx/patches-5.10/950-0285-media-i2c-ov9281-fix-mclk-issue-when-probe-multiple-.patch
Álvaro Fernández Rojas 8299d1f057 bcm27xx: add kernel 5.10 support
Rebased RPi foundation patches on linux 5.10.59, removed applied and reverted
patches, wireless patches and defconfig patches.

bcm2708: boot tested on RPi B+ v1.2
bcm2709: boot tested on RPi 4B v1.1 4G
bcm2711: boot tested on RPi 4B v1.1 4G

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2021-08-21 19:07:07 +02:00

61 lines
2.0 KiB
Diff

From ecaf713a6535e49f1eb4374f6241421e8e61d407 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Tue, 14 Apr 2020 15:47:09 +0100
Subject: [PATCH] media: i2c: ov9281: fix mclk issue when probe
multiple camera.
Takes the ov9281 part only from the Rockchip's patch.
Change-Id: I30e833baf2c1bb07d6d87ddb3b00759ab45a90e4
Signed-off-by: Zefa Chen <zefa.chen@rock-chips.com>
---
drivers/media/i2c/ov9281.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
--- a/drivers/media/i2c/ov9281.c
+++ b/drivers/media/i2c/ov9281.c
@@ -3,6 +3,7 @@
* ov9281 driver
*
* Copyright (C) 2017 Fuzhou Rockchip Electronics Co., Ltd.
+ * V0.0X01.0X02 fix mclk issue when probe multiple camera.
*/
#include <linux/clk.h>
@@ -22,7 +23,7 @@
#include <media/v4l2-subdev.h>
#include <linux/pinctrl/consumer.h>
-#define DRIVER_VERSION KERNEL_VERSION(0, 0x01, 0x0)
+#define DRIVER_VERSION KERNEL_VERSION(0, 0x01, 0x2)
#ifndef V4L2_CID_DIGITAL_GAIN
#define V4L2_CID_DIGITAL_GAIN V4L2_CID_GAIN
@@ -676,6 +677,12 @@ static int __ov9281_power_on(struct ov92
dev_err(dev, "could not set pins\n");
}
+ ret = clk_set_rate(ov9281->xvclk, OV9281_XVCLK_FREQ);
+ if (ret < 0)
+ dev_warn(dev, "Failed to set xvclk rate (24MHz)\n");
+ if (clk_get_rate(ov9281->xvclk) != OV9281_XVCLK_FREQ)
+ dev_warn(dev, "xvclk mismatched, modes are based on 24MHz\n");
+
ret = clk_prepare_enable(ov9281->xvclk);
if (ret < 0) {
dev_err(dev, "Failed to enable xvclk\n");
@@ -1008,13 +1015,6 @@ static int ov9281_probe(struct i2c_clien
dev_err(dev, "Failed to get xvclk\n");
return -EINVAL;
}
- ret = clk_set_rate(ov9281->xvclk, OV9281_XVCLK_FREQ);
- if (ret < 0) {
- dev_err(dev, "Failed to set xvclk rate (24MHz)\n");
- return ret;
- }
- if (clk_get_rate(ov9281->xvclk) != OV9281_XVCLK_FREQ)
- dev_warn(dev, "xvclk mismatched, modes are based on 24MHz\n");
ov9281->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);
if (IS_ERR(ov9281->reset_gpio))