mirror of
https://github.com/armbian/build.git
synced 2025-08-09 20:56:57 +02:00
* sunxi-6.0: initial state: add megous patches to series * sunxi-6.0: Switch to v6.0.1 * wifi: Limit the version 6.0 for Realtek 88x2cs chipsets * Adjust kernel configs * Remove not needed patches * Adjust broken patches Co-authored-by: Igor <igor@armbian.com>
115 lines
2.7 KiB
Diff
115 lines
2.7 KiB
Diff
From 2972a343b846b2c098116aa084ebf263083a48fd Mon Sep 17 00:00:00 2001
|
|
From: Benjamin Schaaf <ben.schaaf@gmail.com>
|
|
Date: Mon, 22 Nov 2021 23:38:26 +1100
|
|
Subject: [PATCH 058/486] media: ov5640: Fix focus commands blocking until
|
|
complete
|
|
|
|
Previously setting the focus controls would block until the sensor
|
|
completed the focus routine.
|
|
---
|
|
drivers/media/i2c/ov5640.c | 67 ++++++++++----------------------------
|
|
1 file changed, 18 insertions(+), 49 deletions(-)
|
|
|
|
diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c
|
|
index dd52be32e..5923dab20 100644
|
|
--- a/drivers/media/i2c/ov5640.c
|
|
+++ b/drivers/media/i2c/ov5640.c
|
|
@@ -2619,6 +2619,19 @@ static int ov5640_copy_fw_to_device(struct ov5640_dev *sensor,
|
|
return -ETIMEDOUT;
|
|
}
|
|
|
|
+static int ov5640_fw_command(struct ov5640_dev *sensor, int command)
|
|
+{
|
|
+ int ret;
|
|
+
|
|
+ ret = ov5640_write_reg(sensor, OV5640_REG_FW_CMD_MAIN, command);
|
|
+ if(ret)
|
|
+ return ret;
|
|
+
|
|
+ msleep(5);
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
static int ov5640_af_init(struct ov5640_dev *sensor)
|
|
{
|
|
struct i2c_client *client = sensor->i2c_client;
|
|
@@ -2656,6 +2669,11 @@ static int ov5640_af_init(struct ov5640_dev *sensor)
|
|
|
|
// Set lens focus driver on
|
|
ret = ov5640_write_reg(sensor, OV5640_REG_VCM_CONTROL4, 0x3f);
|
|
+ if (ret)
|
|
+ return ret;
|
|
+
|
|
+ // Set the default focus zone
|
|
+ ret = ov5640_fw_command(sensor, OV5640_FW_CMD_ZONE_CONFIG);
|
|
if (ret)
|
|
return ret;
|
|
return ret;
|
|
@@ -3302,35 +3320,6 @@ static int ov5640_set_framefmt(struct ov5640_dev *sensor,
|
|
is_jpeg ? (BIT(5) | BIT(3)) : 0);
|
|
}
|
|
|
|
-static int ov5640_fw_command(struct ov5640_dev *sensor, int command)
|
|
-{
|
|
- u8 fw_ack;
|
|
- int i;
|
|
- int ret;
|
|
-
|
|
- ret = ov5640_write_reg(sensor, OV5640_REG_FW_CMD_ACK, 0x01);
|
|
- if(ret)
|
|
- return ret;
|
|
-
|
|
- ret = ov5640_write_reg(sensor, OV5640_REG_FW_CMD_MAIN, command);
|
|
- if(ret)
|
|
- return ret;
|
|
-
|
|
- for (i = 0; i < 100; i++) {
|
|
- ret = ov5640_read_reg(sensor, OV5640_REG_FW_CMD_ACK, &fw_ack);
|
|
- if (ret)
|
|
- return ret;
|
|
-
|
|
- if (fw_ack == 0){
|
|
- return ret;
|
|
- }
|
|
-
|
|
- msleep(50);
|
|
- }
|
|
- return -ETIMEDOUT;
|
|
-}
|
|
-
|
|
-
|
|
/*
|
|
* Sensor Controls.
|
|
*/
|
|
@@ -3466,26 +3455,6 @@ static int ov5640_set_ctrl_focus(struct ov5640_dev *sensor, int command)
|
|
return 0;
|
|
}
|
|
|
|
- if (command == OV5640_FW_CMD_RELEASE_FOCUS) {
|
|
- dev_dbg(&client->dev, "%s: Releasing autofocus\n",
|
|
- __func__);
|
|
- return ov5640_fw_command(sensor, OV5640_FW_CMD_RELEASE_FOCUS);
|
|
- }
|
|
-
|
|
- // Restart zone config
|
|
- ret = ov5640_fw_command(sensor, OV5640_FW_CMD_ZONE_CONFIG);
|
|
- if (ret)
|
|
- return ret;
|
|
-
|
|
- // Set default focus zones
|
|
- ret = ov5640_fw_command(sensor, OV5640_FW_CMD_DEFAULT_ZONES);
|
|
- if (ret)
|
|
- return ret;
|
|
-
|
|
- dev_dbg(&client->dev, "%s: Triggering autofocus\n",
|
|
- __func__);
|
|
-
|
|
- // Start focussing
|
|
return ov5640_fw_command(sensor, command);
|
|
}
|
|
|
|
--
|
|
2.35.3
|
|
|