aboutsummaryrefslogtreecommitdiffstats
path: root/meta-rcar-gen3-adas
diff options
context:
space:
mode:
authorVladimir Barinov <vladimir.barinov@cogentembedded.com>2018-01-20 01:51:35 +0300
committerVladimir Barinov <vladimir.barinov@cogentembedded.com>2018-01-20 02:00:02 +0300
commit938b82740abe5ab897e7e0c943e5f4edac93732c (patch)
tree24a86d8b1aa287dd9ddd839d91281bfd810c17b5 /meta-rcar-gen3-adas
parent4aac256bd4d106b976766ce7b6faa271eef8ecd6 (diff)
AP0101-AR014x: add OTP IDs
This adds reading fused from AR014x sensors
Diffstat (limited to 'meta-rcar-gen3-adas')
-rw-r--r--meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0030-Gen3-LVDS-cameras.patch53
1 files changed, 49 insertions, 4 deletions
diff --git a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0030-Gen3-LVDS-cameras.patch b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0030-Gen3-LVDS-cameras.patch
index 9ddbe27..6eb40f3 100644
--- a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0030-Gen3-LVDS-cameras.patch
+++ b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0030-Gen3-LVDS-cameras.patch
@@ -11,7 +11,7 @@ Signed-off-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
---
drivers/media/i2c/soc_camera/Kconfig | 47 +
drivers/media/i2c/soc_camera/Makefile | 7 +
- drivers/media/i2c/soc_camera/ap0101_ar014x.c | 536 ++++++++++
+ drivers/media/i2c/soc_camera/ap0101_ar014x.c | 581 +++++++++++
drivers/media/i2c/soc_camera/ap0101_ar014x.h | 28 +
drivers/media/i2c/soc_camera/ar0132.c | 581 +++++++++++
drivers/media/i2c/soc_camera/ar0132.h | 213 ++++
@@ -34,7 +34,7 @@ Signed-off-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
drivers/media/platform/soc_camera/soc_mediabus.c | 16 +
include/media/drv-intf/soc_mediabus.h | 3 +
include/media/soc_camera.h | 1 +
- 25 files changed, 7771 insertions(+), 109 deletions(-)
+ 25 files changed, 7816 insertions(+), 109 deletions(-)
create mode 100644 drivers/media/i2c/soc_camera/ap0101_ar014x.c
create mode 100644 drivers/media/i2c/soc_camera/ap0101_ar014x.h
create mode 100644 drivers/media/i2c/soc_camera/ar0132.c
@@ -133,10 +133,10 @@ index 6f994f9..e88f6a9 100644
obj-$(CONFIG_SOC_CAMERA_OV6650) += ov6650.o
diff --git a/drivers/media/i2c/soc_camera/ap0101_ar014x.c b/drivers/media/i2c/soc_camera/ap0101_ar014x.c
new file mode 100644
-index 0000000..4757657
+index 0000000..3ba2a5a
--- /dev/null
+++ b/drivers/media/i2c/soc_camera/ap0101_ar014x.c
-@@ -0,0 +1,536 @@
+@@ -0,0 +1,581 @@
+/*
+ * ON Semiconductor AP0101-AR014X sensor camera driver
+ *
@@ -222,6 +222,38 @@ index 0000000..4757657
+ return 0;
+}
+
++static u16 ap0101_ar014x_read(struct i2c_client *client, u16 addr)
++{
++ u16 reg_val = 0;
++
++ reg16_write16(client, 0x0040, 0x8d00);
++ usleep_range(100, 150); /* wait 100 us */
++ reg16_write16(client, 0xfc00, addr);
++ reg16_write16(client, 0xfc02, 0x0200); /* 2 bytes */
++ reg16_write16(client, 0x0040, 0x8d05);
++ usleep_range(100, 150); /* wait 100 us */
++ reg16_write16(client, 0x0040, 0x8d08);
++ usleep_range(100, 150); /* wait 100 us */
++ reg16_read16(client, 0xfc00, &reg_val);
++ reg16_write16(client, 0x0040, 0x8d02);
++
++ return reg_val;
++}
++
++static void ap0101_ar014x_write(struct i2c_client *client, u16 addr, u16 val)
++{
++ reg16_write16(client, 0x0040, 0x8d00);
++ usleep_range(100, 150); /* wait 100 us */
++ reg16_write16(client, 0xfc00, addr);
++ reg16_write16(client, 0xfc02, 0x0200 | (val >> 8)); /* 2 bytes */
++ reg16_write16(client, 0xfc04, (val & 0xff) << 8);
++ reg16_write16(client, 0x0040, 0x8d06);
++ usleep_range(100, 150); /* wait 100 us */
++ reg16_write16(client, 0x0040, 0x8d08);
++ usleep_range(100, 150); /* wait 100 us */
++ reg16_write16(client, 0x0040, 0x8d02);
++}
++
+static int ap0101_s_stream(struct v4l2_subdev *sd, int enable)
+{
+ return 0;
@@ -448,6 +480,19 @@ index 0000000..4757657
+
+static void ap0101_otp_id_read(struct i2c_client *client)
+{
++ struct ap0101_priv *priv = to_ap0101(client);
++ int i;
++
++ /* read camera id from ar014x OTP memory */
++ ap0101_ar014x_write(client, 0x3054, 0x400);
++ ap0101_ar014x_write(client, 0x304a, 0x110);
++ usleep_range(25000, 25500); /* wait 25 ms */
++
++ for (i = 0; i < 6; i += 2) {
++ /* first 4 bytes are equal on all ar014x */
++ priv->id[i] = ap0101_ar014x_read(client, 0x3800 + i + 4) >> 8;
++ priv->id[i + 1] = ap0101_ar014x_read(client, 0x3800 + i + 4) & 0xff;
++ }
+}
+
+static ssize_t ap0101_otp_id_show(struct device *dev,