summaryrefslogtreecommitdiffstats
path: root/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0423-media-i2c-ap0101_ar014x-add-AP0102-chip.patch
blob: 9928e87963e4b51b6db0723d7cc42229542beeb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
From 45e394a4669fa60e5e0837f68148907af7b757eb Mon Sep 17 00:00:00 2001
From: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
Date: Fri, 1 Nov 2019 21:46:47 +0300
Subject: [PATCH] media: i2c: ap0101_ar014x: add AP0102 chip

This add AP0102 ISP support

Signed-off-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
---
 drivers/media/i2c/soc_camera/ap0101_ar014x.c | 31 ++++++++++++++++------------
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/drivers/media/i2c/soc_camera/ap0101_ar014x.c b/drivers/media/i2c/soc_camera/ap0101_ar014x.c
index c35e5a0..4df5793 100644
--- a/drivers/media/i2c/soc_camera/ap0101_ar014x.c
+++ b/drivers/media/i2c/soc_camera/ap0101_ar014x.c
@@ -1,7 +1,7 @@
 /*
- * ON Semiconductor AP0101-AR014X sensor camera driver
+ * ON Semiconductor AP010X-AR014X sensor camera driver
  *
- * Copyright (C) 2018 Cogent Embedded, Inc.
+ * Copyright (C) 2018-2019 Cogent Embedded, Inc.
  *
  * This program is free software; you can redistribute  it and/or modify it
  * under  the terms of  the GNU General  Public License as published by the
@@ -26,6 +26,7 @@ static const int ap0101_i2c_addr[] = {0x5d, 0x48};
 
 #define AP0101_PID		0x0000
 #define AP0101_VERSION_REG	0x0160
+#define AP0102_VERSION_REG	0x0064
 
 #define AP0101_MEDIA_BUS_FMT	MEDIA_BUS_FMT_YUYV8_2X8
 
@@ -432,24 +433,28 @@ static int ap0101_initialize(struct i2c_client *client)
 		/* check model ID */
 		reg16_read16(client, AP0101_PID, &pid);
 
-		if (pid == AP0101_VERSION_REG)
+		if (pid == AP0101_VERSION_REG || pid == AP0102_VERSION_REG)
 			break;
 	}
 
-	/* check and show model ID */
-	reg16_read16(client, AP0101_PID, &pid);
-
-	if (pid != AP0101_VERSION_REG) {
-		dev_dbg(&client->dev, "Product ID error %x\n", pid);
+	if (pid != AP0101_VERSION_REG && pid != AP0102_VERSION_REG) {
+		dev_err(&client->dev, "Product ID error %x\n", pid);
 		ret = -ENODEV;
 		goto err;
 	}
 #if 1
-	/* read resolution used by current firmware */
-	reg16_read16(client, 0xca90, &val);
-	priv->max_width = val;
-	reg16_read16(client, 0xca92, &val);
-	priv->max_height = val;
+	if (pid == AP0101_VERSION_REG) {
+		/* read resolution used by current firmware */
+		reg16_read16(client, 0xca90, &val);
+		priv->max_width = val;
+		reg16_read16(client, 0xca92, &val);
+		priv->max_height = val;
+	} else if (pid == AP0102_VERSION_REG) {
+		reg16_read16(client, 0xcae4, &val);
+		priv->max_width = val;
+		reg16_read16(client, 0xcae6, &val);
+		priv->max_height = val;
+	}
 #else
 	priv->max_width = AP0101_MAX_WIDTH;
 	priv->max_height = AP0101_MAX_HEIGHT;
-- 
2.7.4