aboutsummaryrefslogtreecommitdiff
path: root/drivers/media/i2c/vision.c
diff options
context:
space:
mode:
authorManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>2020-01-06 12:28:35 +0530
committerManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>2020-02-01 15:51:58 +0530
commitb0d2173a603b3b9258ba0dab64df34cc01c1e2c2 (patch)
treedc32b17a62c1b1d559d5317cf055b72893eb668d /drivers/media/i2c/vision.c
parent19a09e5e156a9637e93bece9e458d74984ce02dc (diff)
download96b-common-vision-mez.tar.gz
media: i2c: vision: Change format for Ultra96vision-mez
Ultra96 doesn't support YUV422. Hence, switch to RAW12 output on both ISP and MAX9286. Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Diffstat (limited to 'drivers/media/i2c/vision.c')
-rw-r--r--drivers/media/i2c/vision.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/drivers/media/i2c/vision.c b/drivers/media/i2c/vision.c
index 0a2bb330e143..74820699e83e 100644
--- a/drivers/media/i2c/vision.c
+++ b/drivers/media/i2c/vision.c
@@ -20,7 +20,10 @@
#define MAX96705_WIDTH 1280
#define MAX96705_HEIGHT 800
-#define MAX96705_FORMAT MEDIA_BUS_FMT_UYVY8_2X8
+
+/* Ultra96 cannot handle YUV422:8/10 formats, so using RAW12 */
+//#define MAX96705_FORMAT MEDIA_BUS_FMT_UYVY8_2X8
+#define MAX96705_FORMAT MEDIA_BUS_FMT_SRGGB12_1X12
/* Register 0x00 */
#define MAX9286_MSTLINKSEL_AUTO (1 << 7)
@@ -225,6 +228,25 @@ static int ap0202_write(struct vision_device *dev, u16 reg, u16 val, u8 index)
return 0;
}
+static int ap0202_write8(struct vision_device *dev, u16 reg, u8 val, u8 index)
+{
+ u8 regbuf[4];
+ int ret;
+
+ regbuf[0] = reg >> 8;
+ regbuf[1] = reg & 0xff;
+ regbuf[2] = val;
+
+ ret = i2c_master_send(dev->ap0202[index], regbuf, 3);
+ if (ret < 0) {
+ dev_err(&dev->ap0202[index]->dev, "%s: write reg error %d: reg=%x, val=%x\n",
+ __func__, ret, reg, val);
+ return ret;
+ }
+
+ return 0;
+}
+
static int ap0202_read(struct vision_device *dev, u16 reg, u8 index)
{
u8 regbuf[2];
@@ -462,7 +484,7 @@ static int max9286_configure(struct vision_device *dev)
max9286_write(dev, 0x0b, link_order[0]);
msleep(5);
- ret = max9286_write(dev, 0x12, 0xf3);
+ ret = max9286_write(dev, 0x12, 0xf7);
if (ret < 0) {
dev_err(&dev->client->dev, "Unable to configure MAX9286\n");
return ret;
@@ -654,6 +676,14 @@ static int ap0202_configure(struct vision_device *dev, u8 addr, u8 index)
msleep(100);
+ ret = ap0202_write8(dev, 0xcaea, 0x02, index);
+ if (ret < 0) {
+ dev_err(&dev->ap0202[index]->dev, "Unable to write AP0202\n");
+ return ret;
+ }
+
+ msleep(100);
+
ret = ap0202_write(dev, 0xfc00, 0x2800, index);
if (ret < 0) {
dev_err(&dev->ap0202[index]->dev, "Unable to write AP0202\n");