From 45e394a4669fa60e5e0837f68148907af7b757eb Mon Sep 17 00:00:00 2001 From: Vladimir Barinov 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 --- 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