media: add V4L2 sensor driver for IMX219
Frank Chen [Fri, 13 Nov 2015 22:17:31 +0000 (14:17 -0800)]
Based on changes from Bryan Wu <pengw@nvidia.com>.

Bug 1654140

Change-Id: Ib045310f86eba6bc48cb0f2315077dfc31bc2fbd
Signed-off-by: Frank Chen <frankc@nvidia.com>
Reviewed-on: http://git-master/r/932996
Reviewed-by: Jihoon Bang <jbang@nvidia.com>
Reviewed-by: Bryan Wu <pengw@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Hayden Du <haydend@nvidia.com>

drivers/media/i2c/Kconfig
drivers/media/i2c/Makefile
drivers/media/i2c/imx219.c [new file with mode: 0644]
drivers/media/i2c/imx219_mode_tbls.h [new file with mode: 0644]
drivers/media/platform/tegra/Kconfig
drivers/media/platform/tegra/Makefile
include/media/imx219.h
include/media/v4l2-chip-ident.h

index fac5f24..4a0c1bb 100644 (file)
@@ -499,6 +499,15 @@ config VIDEO_OV23850
          To compile this driver as a module, choose M here: the module
          will be called ov23850.
 
+config VIDEO_IMX219
+        tristate "IMX219 camera sensor support"
+       depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
+       ---help---
+         This driver supports IMX219 camera sensor from Sony
+
+         To compile this driver as a module, choose M here: the module
+         will be called imx219.
+
 config VIDEO_VS6624
        tristate "ST VS6624 sensor support"
        depends on VIDEO_V4L2 && I2C
index 8e6d16c..daf2ce7 100644 (file)
@@ -56,6 +56,7 @@ obj-$(CONFIG_VIDEO_I2C_OV5693) += ov5693.o
 obj-$(CONFIG_VIDEO_OV7640) += ov7640.o
 obj-$(CONFIG_VIDEO_OV7670) += ov7670.o
 obj-$(CONFIG_VIDEO_OV9650) += ov9650.o
+obj-$(CONFIG_VIDEO_IMX219) += imx219.o
 obj-$(CONFIG_VIDEO_TCM825X) += tcm825x.o
 obj-$(CONFIG_VIDEO_OV23850) += ov23850.o
 obj-$(CONFIG_VIDEO_LC898212) += lc898212.o
diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c
new file mode 100644 (file)
index 0000000..e6c44ef
--- /dev/null
@@ -0,0 +1,839 @@
+/*
+ * imx219.c - imx219 sensor driver
+ *
+ * Copyright (c) 2015-2016, NVIDIA CORPORATION.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <dt-bindings/gpio/tegra-gpio.h>
+#include <linux/slab.h>
+#include <linux/uaccess.h>
+#include <linux/gpio.h>
+#include <linux/module.h>
+
+#include <linux/seq_file.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/of_gpio.h>
+
+#include <media/v4l2-chip-ident.h>
+#include <media/camera_common.h>
+#include <media/soc_camera.h>
+#include <media/imx219.h>
+
+#include "imx219_mode_tbls.h"
+
+#define IMX219_MAX_COARSE_DIFF         4
+
+#define IMX219_GAIN_SHIFT              8
+#define IMX219_MIN_GAIN                (1 << IMX219_GAIN_SHIFT)
+#define IMX219_MAX_GAIN                (16 << IMX219_GAIN_SHIFT)
+#define IMX219_MIN_FRAME_LENGTH        (0x9C3)
+#define IMX219_MAX_FRAME_LENGTH        (0xFFFF)
+#define IMX219_MIN_EXPOSURE_COARSE     (0x0001)
+#define IMX219_MAX_EXPOSURE_COARSE     \
+       (IMX219_MAX_FRAME_LENGTH-IMX219_MAX_COARSE_DIFF)
+
+#define IMX219_DEFAULT_GAIN            IMX219_MIN_GAIN
+#define IMX219_DEFAULT_FRAME_LENGTH    (0x09C3)
+#define IMX219_DEFAULT_EXPOSURE_COARSE \
+       (IMX219_DEFAULT_FRAME_LENGTH-IMX219_MAX_COARSE_DIFF)
+
+#define IMX219_DEFAULT_MODE    IMX219_MODE_3280x2464
+#define IMX219_DEFAULT_WIDTH   3280
+#define IMX219_DEFAULT_HEIGHT  2464
+#define IMX219_DEFAULT_DATAFMT V4L2_MBUS_FMT_SRGGB10_1X10
+#define IMX219_DEFAULT_CLK_FREQ        12000000
+
+struct imx219 {
+       struct mutex                    imx219_camera_lock;
+       struct camera_common_power_rail power;
+       int                             num_ctrls;
+       struct v4l2_ctrl_handler        ctrl_handler;
+       struct i2c_client               *i2c_client;
+       struct v4l2_subdev              *subdev;
+       struct media_pad                pad;
+       struct regmap                   *regmap;
+       struct camera_common_data       *s_data;
+       struct camera_common_pdata      *pdata;
+       struct v4l2_ctrl                *ctrls[];
+};
+
+static const struct regmap_config sensor_regmap_config = {
+       .reg_bits = 16,
+       .val_bits = 8,
+       .cache_type = REGCACHE_RBTREE,
+};
+
+static int imx219_g_volatile_ctrl(struct v4l2_ctrl *ctrl);
+static int imx219_s_ctrl(struct v4l2_ctrl *ctrl);
+
+static const struct v4l2_ctrl_ops imx219_ctrl_ops = {
+       .g_volatile_ctrl = imx219_g_volatile_ctrl,
+       .s_ctrl = imx219_s_ctrl,
+};
+
+static struct v4l2_ctrl_config ctrl_config_list[] = {
+/* Do not change the name field for the controls! */
+       {
+               .ops = &imx219_ctrl_ops,
+               .id = V4L2_CID_GAIN,
+               .name = "Gain",
+               .type = V4L2_CTRL_TYPE_INTEGER,
+               .flags = V4L2_CTRL_FLAG_SLIDER,
+               .min = IMX219_MIN_GAIN,
+               .max = IMX219_MAX_GAIN,
+               .def = IMX219_DEFAULT_GAIN,
+               .step = 1,
+       },
+       {
+               .ops = &imx219_ctrl_ops,
+               .id = V4L2_CID_FRAME_LENGTH,
+               .name = "Frame Length",
+               .type = V4L2_CTRL_TYPE_INTEGER,
+               .flags = V4L2_CTRL_FLAG_SLIDER,
+               .min = IMX219_MIN_FRAME_LENGTH,
+               .max = IMX219_MAX_FRAME_LENGTH,
+               .def = IMX219_DEFAULT_FRAME_LENGTH,
+               .step = 1,
+       },
+       {
+               .ops = &imx219_ctrl_ops,
+               .id = V4L2_CID_COARSE_TIME,
+               .name = "Coarse Time",
+               .type = V4L2_CTRL_TYPE_INTEGER,
+               .flags = V4L2_CTRL_FLAG_SLIDER,
+               .min = IMX219_MIN_EXPOSURE_COARSE,
+               .max = IMX219_MAX_EXPOSURE_COARSE,
+               .def = IMX219_DEFAULT_EXPOSURE_COARSE,
+               .step = 1,
+       },
+       {
+               .ops = &imx219_ctrl_ops,
+               .id = V4L2_CID_GROUP_HOLD,
+               .name = "Group Hold",
+               .type = V4L2_CTRL_TYPE_INTEGER_MENU,
+               .min = 0,
+               .max = ARRAY_SIZE(switch_ctrl_qmenu) - 1,
+               .menu_skip_mask = 0,
+               .def = 0,
+               .qmenu_int = switch_ctrl_qmenu,
+       },
+       {
+               .ops = &imx219_ctrl_ops,
+               .id = V4L2_CID_HDR_EN,
+               .name = "HDR enable",
+               .type = V4L2_CTRL_TYPE_INTEGER_MENU,
+               .min = 0,
+               .max = ARRAY_SIZE(switch_ctrl_qmenu) - 1,
+               .menu_skip_mask = 0,
+               .def = 0,
+               .qmenu_int = switch_ctrl_qmenu,
+       },
+       {
+               .ops = &imx219_ctrl_ops,
+               .id = V4L2_CID_FUSE_ID,
+               .name = "Fuse ID",
+               .type = V4L2_CTRL_TYPE_STRING,
+               .flags = V4L2_CTRL_FLAG_READ_ONLY,
+               .min = 0,
+               .max = IMX219_FUSE_ID_STR_SIZE,
+               .step = 2,
+       },
+};
+
+static inline void imx219_get_frame_length_regs(struct reg_8 *regs,
+                               u16 frame_length)
+{
+       regs->addr = IMX219_FRAME_LENGTH_ADDR_MSB;
+       regs->val = (frame_length >> 8) & 0xff;
+       (regs + 1)->addr = IMX219_FRAME_LENGTH_ADDR_LSB;
+       (regs + 1)->val = (frame_length) & 0xff;
+}
+
+static inline void imx219_get_coarse_time_regs(struct reg_8 *regs,
+                               u16 coarse_time)
+{
+       regs->addr = IMX219_COARSE_TIME_ADDR_MSB;
+       regs->val = (coarse_time >> 8) & 0xff;
+       (regs + 1)->addr = IMX219_COARSE_TIME_ADDR_LSB;
+       (regs + 1)->val = (coarse_time) & 0xff;
+}
+
+static inline void imx219_get_gain_reg(struct reg_8 *regs,
+                               u16 gain)
+{
+       regs->addr = IMX219_GAIN_ADDR;
+       regs->val = gain & 0xff;
+}
+
+static int test_mode;
+module_param(test_mode, int, 0644);
+
+static inline int imx219_read_reg(struct camera_common_data *s_data,
+                               u16 addr, u8 *val)
+{
+       struct imx219 *priv = (struct imx219 *)s_data->priv;
+       return regmap_read(priv->regmap, addr, (unsigned int *) val);
+}
+
+static int imx219_write_reg(struct camera_common_data *s_data, u16 addr, u8 val)
+{
+       int err;
+       struct imx219 *priv = (struct imx219 *)s_data->priv;
+
+       err = regmap_write(priv->regmap, addr, val);
+       if (err)
+               pr_err("%s:i2c write failed, %x = %x\n",
+                       __func__, addr, val);
+
+       return err;
+}
+
+static int imx219_write_table(struct imx219 *priv,
+                             const struct reg_8 table[])
+{
+       return regmap_util_write_table_8(priv->regmap,
+                                        table,
+                                        NULL, 0,
+                                        IMX219_TABLE_WAIT_MS,
+                                        IMX219_TABLE_END);
+}
+
+static void imx219_mclk_disable(struct camera_common_power_rail *pw)
+{
+       clk_disable_unprepare(pw->mclk);
+}
+
+static void imx219_mclk_enable(struct camera_common_power_rail *pw)
+{
+       clk_set_rate(pw->mclk, IMX219_DEFAULT_CLK_FREQ);
+       clk_prepare_enable(pw->mclk);
+}
+
+static int imx219_power_on(struct camera_common_data *s_data)
+{
+       int err = 0;
+       struct imx219 *priv = (struct imx219 *)s_data->priv;
+       struct camera_common_power_rail *pw = &priv->power;
+
+       dev_dbg(&priv->i2c_client->dev, "%s: power on\n", __func__);
+
+       imx219_mclk_enable(pw);
+
+       if (gpio_cansleep(pw->reset_gpio))
+               gpio_set_value_cansleep(pw->reset_gpio, 0);
+       else
+               gpio_set_value(pw->reset_gpio, 0);
+       usleep_range(10, 20);
+
+       if (pw->avdd)
+               err = regulator_enable(pw->avdd);
+       if (err)
+               goto imx219_avdd_fail;
+
+       if (pw->iovdd)
+               err = regulator_enable(pw->iovdd);
+       if (err)
+               goto imx219_iovdd_fail;
+
+       if (pw->dvdd)
+               err = regulator_enable(pw->dvdd);
+       if (err)
+               goto imx219_dvdd_fail;
+
+       usleep_range(1, 2);
+       if (gpio_cansleep(pw->reset_gpio))
+               gpio_set_value_cansleep(pw->reset_gpio, 1);
+       else
+               gpio_set_value(pw->reset_gpio, 1);
+       usleep_range(300, 310);
+
+       pw->state = SWITCH_ON;
+       return 0;
+
+imx219_dvdd_fail:
+       regulator_disable(pw->iovdd);
+
+imx219_iovdd_fail:
+       regulator_disable(pw->avdd);
+
+imx219_avdd_fail:
+       imx219_mclk_disable(pw);
+       return -ENODEV;
+}
+
+static int imx219_power_off(struct camera_common_data *s_data)
+{
+       struct imx219 *priv = (struct imx219 *)s_data->priv;
+       struct camera_common_power_rail *pw = &priv->power;
+
+       dev_dbg(&priv->i2c_client->dev, "%s: power off\n", __func__);
+
+       usleep_range(1, 2);
+       if (gpio_cansleep(pw->reset_gpio))
+               gpio_set_value_cansleep(pw->reset_gpio, 0);
+       else
+               gpio_set_value(pw->reset_gpio, 0);
+       usleep_range(1, 2);
+
+       if (pw->dvdd)
+               regulator_disable(pw->dvdd);
+       if (pw->iovdd)
+               regulator_disable(pw->iovdd);
+       if (pw->avdd)
+               regulator_disable(pw->avdd);
+
+       imx219_mclk_disable(pw);
+       pw->state = SWITCH_OFF;
+       return 0;
+}
+
+static int imx219_power_put(struct imx219 *priv)
+{
+       struct camera_common_power_rail *pw = &priv->power;
+       if (unlikely(!pw))
+               return -EFAULT;
+
+       if (likely(pw->avdd))
+               regulator_put(pw->avdd);
+
+       if (likely(pw->iovdd))
+               regulator_put(pw->iovdd);
+
+       if (likely(pw->dvdd))
+               regulator_put(pw->dvdd);
+
+       pw->avdd = NULL;
+       pw->iovdd = NULL;
+       pw->dvdd = NULL;
+
+       return 0;
+}
+
+static int imx219_power_get(struct imx219 *priv)
+{
+       struct camera_common_power_rail *pw = &priv->power;
+       struct camera_common_pdata *pdata = priv->pdata;
+       const char *mclk_name;
+       int err = 0;
+
+       mclk_name = priv->pdata->mclk_name ?
+                   priv->pdata->mclk_name : "cam_mclk1";
+       pw->mclk = devm_clk_get(&priv->i2c_client->dev, mclk_name);
+       if (IS_ERR(pw->mclk)) {
+               dev_err(&priv->i2c_client->dev,
+                       "unable to get clock %s\n", mclk_name);
+               return PTR_ERR(pw->mclk);
+       }
+
+       /* ananlog 2.7v */
+       err |= camera_common_regulator_get(priv->i2c_client,
+                       &pw->avdd, pdata->regulators.avdd);
+       /* digital 1.2v */
+       err |= camera_common_regulator_get(priv->i2c_client,
+                       &pw->dvdd, pdata->regulators.dvdd);
+       /* IO 1.8v */
+       err |= camera_common_regulator_get(priv->i2c_client,
+                       &pw->iovdd, pdata->regulators.iovdd);
+
+       if (!err)
+               pw->reset_gpio = pdata->reset_gpio;
+
+       pw->state = SWITCH_OFF;
+       return err;
+}
+
+static int imx219_set_gain(struct imx219 *priv, s32 val);
+static int imx219_set_frame_length(struct imx219 *priv, s32 val);
+static int imx219_set_coarse_time(struct imx219 *priv, s32 val);
+
+static int imx219_s_stream(struct v4l2_subdev *sd, int enable)
+{
+       struct i2c_client *client = v4l2_get_subdevdata(sd);
+       struct camera_common_data *s_data = to_camera_common_data(client);
+       struct imx219 *priv = (struct imx219 *)s_data->priv;
+       int err;
+
+       dev_dbg(&client->dev, "%s\n", __func__);
+
+       if (!enable)
+               return 0;
+
+       err = imx219_write_table(priv, mode_table[s_data->mode]);
+       if (err)
+               goto exit;
+
+       return 0;
+exit:
+       dev_dbg(&client->dev, "%s: error setting stream\n", __func__);
+       return err;
+}
+
+static struct v4l2_subdev_video_ops imx219_subdev_video_ops = {
+       .s_stream       = imx219_s_stream,
+       .s_mbus_fmt     = camera_common_s_fmt,
+       .g_mbus_fmt     = camera_common_g_fmt,
+       .try_mbus_fmt   = camera_common_try_fmt,
+       .enum_mbus_fmt  = camera_common_enum_fmt,
+       .g_mbus_config  = camera_common_g_mbus_config,
+};
+
+static struct v4l2_subdev_core_ops imx219_subdev_core_ops = {
+       .s_power        = camera_common_s_power,
+};
+
+static struct v4l2_subdev_ops imx219_subdev_ops = {
+       .core   = &imx219_subdev_core_ops,
+       .video  = &imx219_subdev_video_ops,
+};
+
+static struct of_device_id imx219_of_match[] = {
+       { .compatible = "nvidia,imx219", },
+       { },
+};
+
+static struct camera_common_sensor_ops imx219_common_ops = {
+       .power_on = imx219_power_on,
+       .power_off = imx219_power_off,
+       .write_reg = imx219_write_reg,
+       .read_reg = imx219_read_reg,
+};
+
+static int imx219_set_group_hold(struct imx219 *priv, s32 val)
+{
+       return 0;
+}
+
+static int imx219_set_gain(struct imx219 *priv, s32 val)
+{
+       struct reg_8 reg_list[2];
+       int err;
+       u32 gain;
+       int i = 0;
+
+       /* translate value */
+       gain = 256 - (u32) (256 * (1 << IMX219_GAIN_SHIFT) / val);
+       dev_dbg(&priv->i2c_client->dev,
+                "%s: val: %d\n", __func__, gain);
+
+       imx219_get_gain_reg(reg_list, gain);
+
+       err = imx219_write_reg(priv->s_data, reg_list[i].addr,
+                reg_list[i].val);
+       if (err)
+               goto fail;
+
+       return 0;
+
+fail:
+       dev_dbg(&priv->i2c_client->dev,
+                "%s: GAIN control error\n", __func__);
+       return err;
+}
+
+static int imx219_set_frame_length(struct imx219 *priv, s32 val)
+{
+       struct reg_8 reg_list[2];
+       int err;
+       u16 frame_length = (u16) val;
+       int i = 0;
+
+       frame_length = val;
+
+       dev_dbg(&priv->i2c_client->dev,
+                "%s: val: %d\n", __func__, frame_length);
+
+       imx219_get_frame_length_regs(reg_list, frame_length);
+
+       for (i = 0; i < 2; i++) {
+               err = imx219_write_reg(priv->s_data, reg_list[i].addr,
+                        reg_list[i].val);
+               if (err)
+                       goto fail;
+       }
+
+       return 0;
+
+fail:
+       dev_dbg(&priv->i2c_client->dev,
+                "%s: FRAME_LENGTH control error\n", __func__);
+       return err;
+}
+
+static int imx219_set_coarse_time(struct imx219 *priv, s32 val)
+{
+       struct reg_8 reg_list[2];
+       int err;
+       u16 coarse_time = (u16) val;
+       int i = 0;
+
+       coarse_time = val;
+
+       dev_dbg(&priv->i2c_client->dev,
+                "%s: val: %d\n", __func__, coarse_time);
+
+       imx219_get_coarse_time_regs(reg_list, coarse_time);
+
+       for (i = 0; i < 2; i++) {
+               err = imx219_write_reg(priv->s_data, reg_list[i].addr,
+                        reg_list[i].val);
+               if (err)
+                       goto fail;
+       }
+
+       return 0;
+
+fail:
+       dev_dbg(&priv->i2c_client->dev,
+                "%s: COARSE_TIME control error\n", __func__);
+       return err;
+}
+
+static int imx219_g_volatile_ctrl(struct v4l2_ctrl *ctrl)
+{
+       struct imx219 *priv =
+               container_of(ctrl->handler, struct imx219, ctrl_handler);
+       int err = 0;
+
+       if (priv->power.state == SWITCH_OFF)
+               return 0;
+
+       switch (ctrl->id) {
+       default:
+               pr_err("%s: unknown ctrl id.\n", __func__);
+               return -EINVAL;
+       }
+
+       return err;
+}
+
+static int imx219_s_ctrl(struct v4l2_ctrl *ctrl)
+{
+       struct imx219 *priv =
+               container_of(ctrl->handler, struct imx219, ctrl_handler);
+       int err = 0;
+
+       if (priv->power.state == SWITCH_OFF)
+               return 0;
+
+       switch (ctrl->id) {
+       case V4L2_CID_GAIN:
+               err = imx219_set_gain(priv, ctrl->val);
+               break;
+       case V4L2_CID_FRAME_LENGTH:
+               err = imx219_set_frame_length(priv, ctrl->val);
+               break;
+       case V4L2_CID_COARSE_TIME:
+               err = imx219_set_coarse_time(priv, ctrl->val);
+               break;
+       case V4L2_CID_GROUP_HOLD:
+               err = imx219_set_group_hold(priv, ctrl->val);
+               break;
+       case V4L2_CID_HDR_EN:
+               break;
+       case V4L2_CID_FUSE_ID:
+               break;
+       default:
+               pr_err("%s: unknown ctrl id.\n", __func__);
+               return -EINVAL;
+       }
+
+       return err;
+}
+
+static int imx219_ctrls_init(struct imx219 *priv)
+{
+       struct i2c_client *client = priv->i2c_client;
+       struct v4l2_ctrl *ctrl;
+       int num_ctrls;
+       int err;
+       int i;
+
+       dev_info(&client->dev, "%s++\n", __func__);
+
+       num_ctrls = ARRAY_SIZE(ctrl_config_list);
+       v4l2_ctrl_handler_init(&priv->ctrl_handler, num_ctrls);
+
+       for (i = 0; i < num_ctrls; i++) {
+               ctrl = v4l2_ctrl_new_custom(&priv->ctrl_handler,
+                       &ctrl_config_list[i], NULL);
+               if (ctrl == NULL) {
+                       dev_err(&client->dev, "Failed to init %s ctrl\n",
+                               ctrl_config_list[i].name);
+                       continue;
+               }
+
+               if (ctrl_config_list[i].type == V4L2_CTRL_TYPE_STRING &&
+                       ctrl_config_list[i].flags & V4L2_CTRL_FLAG_READ_ONLY) {
+                       ctrl->string = devm_kzalloc(&client->dev,
+                               ctrl_config_list[i].max + 1, GFP_KERNEL);
+                       if (!ctrl->string) {
+                               dev_err(&client->dev,
+                                       "Failed to allocate otp data\n");
+                               return -ENOMEM;
+                       }
+               }
+               priv->ctrls[i] = ctrl;
+       }
+
+       priv->num_ctrls = num_ctrls;
+       priv->subdev->ctrl_handler = &priv->ctrl_handler;
+       if (priv->ctrl_handler.error) {
+               dev_err(&client->dev, "Error %d adding controls\n",
+                       priv->ctrl_handler.error);
+               err = priv->ctrl_handler.error;
+               goto error;
+       }
+
+       err = v4l2_ctrl_handler_setup(&priv->ctrl_handler);
+       if (err) {
+               dev_err(&client->dev,
+                       "Error %d setting default controls\n", err);
+               goto error;
+       }
+
+       return 0;
+
+error:
+       v4l2_ctrl_handler_free(&priv->ctrl_handler);
+       return err;
+}
+
+MODULE_DEVICE_TABLE(of, imx219_of_match);
+
+static struct camera_common_pdata *imx219_parse_dt(struct i2c_client *client)
+{
+       struct device_node *np = client->dev.of_node;
+       struct camera_common_pdata *board_priv_pdata;
+       const struct of_device_id *match;
+       int gpio, err;
+
+       match = of_match_device(imx219_of_match, &client->dev);
+       if (!match) {
+               dev_err(&client->dev, "Failed to find matching dt id\n");
+               return NULL;
+       }
+
+       board_priv_pdata = devm_kzalloc(&client->dev,
+                          sizeof(*board_priv_pdata), GFP_KERNEL);
+       if (!board_priv_pdata) {
+               dev_err(&client->dev, "Failed to allocate pdata\n");
+               return NULL;
+       }
+
+       err = of_property_read_string(np, "mclk", &board_priv_pdata->mclk_name);
+       if (err) {
+               dev_err(&client->dev, "mclk not in DT\n");
+               goto error;
+       }
+
+       gpio = of_get_named_gpio(np, "reset-gpios", 0);
+       if (gpio < 0) {
+               dev_err(&client->dev, "reset gpios not in DT\n");
+               goto error;
+       }
+       board_priv_pdata->reset_gpio = (unsigned int)gpio;
+
+       err = of_property_read_string(np, "avdd-reg",
+                       &board_priv_pdata->regulators.avdd);
+       if (err) {
+               dev_err(&client->dev, "avdd-reg not in DT\n");
+               goto error;
+       }
+       err = of_property_read_string(np, "dvdd-reg",
+                       &board_priv_pdata->regulators.dvdd);
+       if (err) {
+               dev_err(&client->dev, "dvdd-reg not in DT\n");
+               goto error;
+       }
+       err = of_property_read_string(np, "iovdd-reg",
+                       &board_priv_pdata->regulators.iovdd);
+       if (err) {
+               dev_err(&client->dev, "iovdd-reg not in DT\n");
+               goto error;
+       }
+
+       return board_priv_pdata;
+
+error:
+       devm_kfree(&client->dev, board_priv_pdata);
+       return NULL;
+}
+
+static int imx219_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
+{
+       struct i2c_client *client = v4l2_get_subdevdata(sd);
+       dev_dbg(&client->dev, "%s:\n", __func__);
+
+       return 0;
+}
+
+static const struct v4l2_subdev_internal_ops imx219_subdev_internal_ops = {
+       .open = imx219_open,
+};
+
+static const struct media_entity_operations imx219_media_ops = {
+       .link_validate = v4l2_subdev_link_validate,
+};
+
+static int imx219_probe(struct i2c_client *client,
+                       const struct i2c_device_id *id)
+{
+       struct camera_common_data *common_data;
+       struct device_node *node = client->dev.of_node;
+       struct soc_camera_link *imx219_iclink;
+       struct imx219 *priv;
+       char node_name[10];
+       int err;
+
+       if (!IS_ENABLED(CONFIG_OF) || !node)
+               return -EINVAL;
+
+       common_data = devm_kzalloc(&client->dev,
+                           sizeof(struct camera_common_data), GFP_KERNEL);
+       if (!common_data) {
+               dev_err(&client->dev, "unable to allocate memory!\n");
+               return -ENOMEM;
+       }
+
+       priv = devm_kzalloc(&client->dev,
+                           sizeof(struct imx219) + sizeof(struct v4l2_ctrl *) *
+                           ARRAY_SIZE(ctrl_config_list),
+                           GFP_KERNEL);
+       if (!priv) {
+               dev_err(&client->dev, "unable to allocate memory!\n");
+               return -ENOMEM;
+       }
+
+       priv->regmap = devm_regmap_init_i2c(client, &sensor_regmap_config);
+       if (IS_ERR(priv->regmap)) {
+               dev_err(&client->dev,
+                       "regmap init failed: %ld\n", PTR_ERR(priv->regmap));
+               return -ENODEV;
+       }
+
+       /* HACK: use DT for parsing platform data when we are using */
+       sprintf(node_name, "imx219_%c", 'a' + client->adapter->nr - 30);
+       client->dev.of_node = of_find_node_by_name(NULL, node_name);
+
+       if (client->dev.of_node)
+               priv->pdata = imx219_parse_dt(client);
+       else {
+               imx219_iclink = client->dev.platform_data;
+               priv->pdata = imx219_iclink->dev_priv;
+       }
+
+       if (!priv->pdata) {
+               dev_err(&client->dev, "unable to get platform data\n");
+               return -EFAULT;
+       }
+
+       common_data->ops                = &imx219_common_ops;
+       common_data->ctrl_handler       = &priv->ctrl_handler;
+       common_data->i2c_client         = client;
+       common_data->frmfmt             = &imx219_frmfmt[0];
+       common_data->colorfmt           = camera_common_find_datafmt(
+                                         IMX219_DEFAULT_DATAFMT);
+       common_data->power              = &priv->power;
+       common_data->priv               = (void *)priv;
+       common_data->ident              = V4L2_IDENT_IMX219;
+       common_data->numfmts            = ARRAY_SIZE(imx219_frmfmt);
+       common_data->def_mode           = IMX219_DEFAULT_MODE;
+       common_data->def_width          = IMX219_DEFAULT_WIDTH;
+       common_data->def_height         = IMX219_DEFAULT_HEIGHT;
+       common_data->def_clk_freq       = IMX219_DEFAULT_CLK_FREQ;
+
+       priv->i2c_client                = client;
+       priv->s_data                    = common_data;
+       priv->subdev                    = &common_data->subdev;
+       priv->subdev->dev               = &client->dev;
+
+       err = imx219_power_get(priv);
+       if (err)
+               return err;
+
+       camera_common_create_debugfs(common_data, "imx219");
+
+       v4l2_i2c_subdev_init(&common_data->subdev, client, &imx219_subdev_ops);
+
+       err = imx219_ctrls_init(priv);
+       if (err)
+               return err;
+
+       priv->subdev->internal_ops = &imx219_subdev_internal_ops;
+       priv->subdev->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE |
+                    V4L2_SUBDEV_FL_HAS_EVENTS;
+
+#if defined(CONFIG_MEDIA_CONTROLLER)
+       priv->pad.flags = MEDIA_PAD_FL_SOURCE;
+       priv->subdev->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
+       priv->subdev->entity.ops = &imx219_media_ops;
+       err = media_entity_init(&priv->subdev->entity, 1, &priv->pad, 0);
+       if (err < 0) {
+               dev_err(&client->dev, "unable to init media entity\n");
+               return err;
+       }
+#endif
+
+       err = v4l2_async_register_subdev(priv->subdev);
+       if (err)
+               return err;
+
+       dev_dbg(&client->dev, "Detected IMX219 sensor\n");
+
+       return 0;
+}
+
+static int
+imx219_remove(struct i2c_client *client)
+{
+       struct camera_common_data *s_data = to_camera_common_data(client);
+       struct imx219 *priv = (struct imx219 *)s_data->priv;
+
+       v4l2_async_unregister_subdev(priv->subdev);
+#if defined(CONFIG_MEDIA_CONTROLLER)
+       media_entity_cleanup(&priv->subdev->entity);
+#endif
+
+       v4l2_ctrl_handler_free(&priv->ctrl_handler);
+       imx219_power_put(priv);
+       camera_common_remove_debugfs(s_data);
+
+       return 0;
+}
+
+static const struct i2c_device_id imx219_id[] = {
+       { "imx219", 0 },
+       { }
+};
+
+MODULE_DEVICE_TABLE(i2c, imx219_id);
+
+static struct i2c_driver imx219_i2c_driver = {
+       .driver = {
+               .name = "imx219",
+               .owner = THIS_MODULE,
+               .of_match_table = of_match_ptr(imx219_of_match),
+       },
+       .probe = imx219_probe,
+       .remove = imx219_remove,
+       .id_table = imx219_id,
+};
+
+module_i2c_driver(imx219_i2c_driver);
+
+MODULE_DESCRIPTION("SoC Camera driver for Sony IMX219");
+MODULE_AUTHOR("Bryan Wu <pengw@nvidia.com>");
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/i2c/imx219_mode_tbls.h b/drivers/media/i2c/imx219_mode_tbls.h
new file mode 100644 (file)
index 0000000..45ccdbe
--- /dev/null
@@ -0,0 +1,388 @@
+/*
+ * imx219_tables.h - sensor mode tables for imx219 HDR sensor.
+ *
+ * Copyright (c) 2015-2016, NVIDIA CORPORATION, All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef IMX219_I2C_TABLES
+#define IMX219_I2C_TABLES
+
+#define IMX219_TABLE_WAIT_MS 0
+#define IMX219_TABLE_END 1
+#define IMX219_MAX_RETRIES 3
+#define IMX219_WAIT_MS 3
+
+static struct reg_8 mode_3280x2464[] = {
+       {IMX219_TABLE_WAIT_MS, 10},
+       /* software reset */
+       {0x0103, 0x01},
+       /* global settings */
+       {0x30EB, 0x05},
+       {0x30EB, 0x0C},
+       {0x300A, 0xFF},
+       {0x300B, 0xFF},
+       {0x30EB, 0x05},
+       {0x30EB, 0x09},
+       {0x0114, 0x01},
+       {0x0128, 0x00},
+       {0x012A, 0x0C},
+       {0x012B, 0x00},
+       {0x0160, 0x09},
+       {0x0161, 0xC3},
+       {0x0162, 0x0D},
+       {0x0163, 0x78},
+       {0x0164, 0x00},
+       {0x0165, 0x00},
+       {0x0166, 0x0C},
+       {0x0167, 0xCF},
+       {0x0168, 0x00},
+       {0x0169, 0x00},
+       {0x016A, 0x09},
+       {0x016B, 0x9F},
+       {0x016C, 0x0C},
+       {0x016D, 0xD0},
+       {0x016E, 0x09},
+       {0x016F, 0xA0},
+       {0x0170, 0x01},
+       {0x0171, 0x01},
+       {0x0174, 0x00},
+       {0x0175, 0x00},
+       {0x018C, 0x0A},
+       {0x018D, 0x0A},
+       {0x0301, 0x05},
+       {0x0303, 0x01},
+       {0x0304, 0x02},
+       {0x0305, 0x02},
+       {0x0306, 0x00},
+       {0x0307, 0x4C},
+       {0x0309, 0x0A},
+       {0x030B, 0x01},
+       {0x030C, 0x00},
+       {0x030D, 0x98},
+       {0x4767, 0x0F},
+       {0x4750, 0x14},
+       {0x47B4, 0x14},
+       {0x5041, 0x00},
+       /* stream on */
+       {0x0100, 0x01},
+       {IMX219_TABLE_WAIT_MS, IMX219_WAIT_MS},
+       {IMX219_TABLE_END, 0x00}
+};
+
+static struct reg_8 mode_3280x2460[] = {
+       {IMX219_TABLE_WAIT_MS, 10},
+       /* software reset */
+       {0x0103, 0x01},
+       /* global settings */
+       {0x30EB, 0x05},
+       {0x30EB, 0x0C},
+       {0x300A, 0xFF},
+       {0x300B, 0xFF},
+       {0x30EB, 0x05},
+       {0x30EB, 0x09},
+       {0x0114, 0x03},
+       {0x0128, 0x00},
+       {0x012A, 0x18},
+       {0x012B, 0x00},
+       /* Bank A Settings */
+       {0x0157, 0x00},
+       {0x015A, 0x08},
+       {0x015B, 0x8F},
+       {0x0160, 0x0A},
+       {0x0161, 0x83},
+       {0x0162, 0x0D},
+       {0x0163, 0x78},
+       {0x0164, 0x00},
+       {0x0165, 0x00},
+       {0x0166, 0x0C},
+       {0x0167, 0xCF},
+       {0x0168, 0x00},
+       {0x0169, 0x00},
+       {0x016A, 0x09},
+       {0x016B, 0x9F},
+       {0x016C, 0x0C},
+       {0x016D, 0xD0},
+       {0x016E, 0x09},
+       {0x016F, 0x9C},
+       {0x0170, 0x01},
+       {0x0171, 0x01},
+       {0x0174, 0x00},
+       {0x0175, 0x00},
+       {0x018C, 0x0A},
+       {0x018D, 0x0A},
+       /* Bank B Settings */
+       {0x0257, 0x00},
+       {0x025A, 0x08},
+       {0x025B, 0x8F},
+       {0x0260, 0x0A},
+       {0x0261, 0x83},
+       {0x0262, 0x0D},
+       {0x0263, 0x78},
+       {0x0264, 0x00},
+       {0x0265, 0x00},
+       {0x0266, 0x0C},
+       {0x0267, 0xCF},
+       {0x0268, 0x00},
+       {0x0269, 0x00},
+       {0x026A, 0x09},
+       {0x026B, 0x9F},
+       {0x026C, 0x0C},
+       {0x026D, 0xD0},
+       {0x026E, 0x09},
+       {0x026F, 0x9C},
+       {0x0270, 0x01},
+       {0x0271, 0x01},
+       {0x0274, 0x00},
+       {0x0275, 0x00},
+       {0x028C, 0x0A},
+       {0x028D, 0x0A},
+       /* clock setting */
+       {0x0301, 0x05},
+       {0x0303, 0x01},
+       {0x0304, 0x03},
+       {0x0305, 0x03},
+       {0x0306, 0x00},
+       {0x0307, 0x57},
+       {0x0309, 0x0A},
+       {0x030B, 0x01},
+       {0x030C, 0x00},
+       {0x030D, 0x5A},
+       {0x455E, 0x00},
+       {0x471E, 0x4B},
+       {0x4767, 0x0F},
+       {0x4750, 0x14},
+       {0x4540, 0x00},
+       {0x47B4, 0x14},
+       {0x4713, 0x30},
+       {0x478B, 0x10},
+       {0x478F, 0x10},
+       {0x4793, 0x10},
+       {0x4797, 0x0E},
+       {0x479B, 0x0E},
+       {0x5041, 0x00},
+       /* stream on */
+       {0x0100, 0x01},
+       {IMX219_TABLE_WAIT_MS, IMX219_WAIT_MS},
+       {IMX219_TABLE_END, 0x00}
+};
+static struct reg_8 mode_3280x1846[] = {
+       {IMX219_TABLE_WAIT_MS, 10},
+       /* software reset */
+       {0x0103, 0x01},
+       /* global settings */
+       {0x30EB, 0x05},
+       {0x30EB, 0x0C},
+       {0x300A, 0xFF},
+       {0x300B, 0xFF},
+       {0x30EB, 0x05},
+       {0x30EB, 0x09},
+       {0x0114, 0x03},
+       {0x0128, 0x00},
+       {0x012A, 0x18},
+       {0x012B, 0x00},
+       /* Bank A Settings */
+       {0x0157, 0x00},
+       {0x015A, 0x08},
+       {0x015B, 0x8F},
+       {0x0160, 0x07},
+       {0x0161, 0x5E},
+       {0x0162, 0x0D},
+       {0x0163, 0x78},
+       {0x0164, 0x00},
+       {0x0165, 0x00},
+       {0x0166, 0x0C},
+       {0x0167, 0xCF},
+       {0x0168, 0x01},
+       {0x0169, 0x36},
+       {0x016A, 0x08},
+       {0x016B, 0x6B},
+       {0x016C, 0x0C},
+       {0x016D, 0xD0},
+       {0x016E, 0x07},
+       {0x016F, 0x36},
+       {0x0170, 0x01},
+       {0x0171, 0x01},
+       {0x0174, 0x00},
+       {0x0175, 0x00},
+       {0x018C, 0x0A},
+       {0x018D, 0x0A},
+       /* Bank B Settings */
+       {0x0257, 0x00},
+       {0x025A, 0x08},
+       {0x025B, 0x8F},
+       {0x0260, 0x07},
+       {0x0261, 0x5E},
+       {0x0262, 0x0D},
+       {0x0263, 0x78},
+       {0x0264, 0x00},
+       {0x0265, 0x00},
+       {0x0266, 0x0C},
+       {0x0267, 0xCF},
+       {0x0268, 0x01},
+       {0x0269, 0x36},
+       {0x026A, 0x08},
+       {0x026B, 0x6B},
+       {0x026C, 0x0C},
+       {0x026D, 0xD0},
+       {0x026E, 0x07},
+       {0x026F, 0x36},
+       {0x0270, 0x01},
+       {0x0271, 0x01},
+       {0x0274, 0x00},
+       {0x0275, 0x00},
+       {0x028C, 0x0A},
+       {0x028D, 0x0A},
+       /* clock setting */
+       {0x0301, 0x05},
+       {0x0303, 0x01},
+       {0x0304, 0x03},
+       {0x0305, 0x03},
+       {0x0306, 0x00},
+       {0x0307, 0x57},
+       {0x0309, 0x0A},
+       {0x030B, 0x01},
+       {0x030C, 0x00},
+       {0x030D, 0x5A},
+       {0x455E, 0x00},
+       {0x471E, 0x4B},
+       {0x4767, 0x0F},
+       {0x4750, 0x14},
+       {0x4540, 0x00},
+       {0x47B4, 0x14},
+       {0x4713, 0x30},
+       {0x478B, 0x10},
+       {0x478F, 0x10},
+       {0x4793, 0x10},
+       {0x4797, 0x0E},
+       {0x479B, 0x0E},
+       {0x5041, 0x00},
+       /* stream on */
+       {0x0100, 0x01},
+       {IMX219_TABLE_WAIT_MS, IMX219_WAIT_MS},
+       {IMX219_TABLE_END, 0x00}
+};
+
+static struct reg_8 mode_1280x720[] = {
+       {IMX219_TABLE_WAIT_MS, 10},
+       /* software reset */
+       {0x0103, 0x01},
+       /* global settings */
+       {0x30EB, 0x05},
+       {0x30EB, 0x0C},
+       {0x300A, 0xFF},
+       {0x300B, 0xFF},
+       {0x30EB, 0x05},
+       {0x30EB, 0x09},
+       {0x0114, 0x03},
+       {0x0128, 0x00},
+       {0x012A, 0x18},
+       {0x012B, 0x00},
+       /* Bank A Settings */
+       {0x0160, 0x02},
+       {0x0161, 0x8C},
+       {0x0162, 0x0D},
+       {0x0163, 0xE8},
+       {0x0164, 0x01},
+       {0x0165, 0x68},
+       {0x0166, 0x0B},
+       {0x0167, 0x67},
+       {0x0168, 0x02},
+       {0x0169, 0x00},
+       {0x016A, 0x07},
+       {0x016B, 0x9F},
+       {0x016C, 0x05},
+       {0x016D, 0x00},
+       {0x016E, 0x02},
+       {0x016F, 0xD0},
+       {0x0170, 0x01},
+       {0x0171, 0x01},
+       {0x0174, 0x03},
+       {0x0175, 0x03},
+       {0x018C, 0x0A},
+       {0x018D, 0x0A},
+       /* Bank B Settings */
+       {0x0260, 0x02},
+       {0x0261, 0x8C},
+       {0x0262, 0x0D},
+       {0x0263, 0xE8},
+       {0x0264, 0x01},
+       {0x0265, 0x68},
+       {0x0266, 0x0B},
+       {0x0267, 0x67},
+       {0x0268, 0x02},
+       {0x0269, 0x00},
+       {0x026A, 0x07},
+       {0x026B, 0x9F},
+       {0x026C, 0x05},
+       {0x026D, 0x00},
+       {0x026E, 0x02},
+       {0x026F, 0xD0},
+       {0x0270, 0x01},
+       {0x0271, 0x01},
+       {0x0274, 0x03},
+       {0x0275, 0x03},
+       {0x028C, 0x0A},
+       {0x028D, 0x0A},
+       /* clock setting */
+       {0x0301, 0x05},
+       {0x0303, 0x01},
+       {0x0304, 0x03},
+       {0x0305, 0x03},
+       {0x0306, 0x00},
+       {0x0307, 0x57},
+       {0x0309, 0x0A},
+       {0x030B, 0x01},
+       {0x030C, 0x00},
+       {0x030D, 0x5A},
+       {0x455E, 0x00},
+       {0x471E, 0x4B},
+       {0x4767, 0x0F},
+       {0x4750, 0x14},
+       {0x4540, 0x00},
+       {0x47B4, 0x14},
+       {0x4713, 0x30},
+       {0x478B, 0x10},
+       {0x478F, 0x10},
+       {0x4793, 0x10},
+       {0x4797, 0x0E},
+       {0x479B, 0x0E},
+       {0x5041, 0x00},
+       /* stream on */
+       {0x0100, 0x01},
+       {IMX219_TABLE_WAIT_MS, IMX219_WAIT_MS},
+       {IMX219_TABLE_END, 0x00}
+};
+enum {
+       IMX219_MODE_3280x2464,
+       IMX219_MODE_3280x2460,
+       IMX219_MODE_3280x1846,
+       IMX219_MODE_1280x720,
+};
+
+static struct reg_8 *mode_table[] = {
+       [IMX219_MODE_3280x2464] = mode_3280x2464,
+       [IMX219_MODE_3280x2460] = mode_3280x2460,
+       [IMX219_MODE_3280x1846] = mode_3280x1846,
+       [IMX219_MODE_1280x720]  = mode_1280x720,
+};
+
+static const struct camera_common_frmfmt imx219_frmfmt[] = {
+       {{3280, 2464},  0, IMX219_MODE_3280x2464},
+       {{3280, 2460},  0, IMX219_MODE_3280x2460},
+       {{3280, 1846},  0, IMX219_MODE_3280x1846},
+       {{1280, 720},   0, IMX219_MODE_1280x720},
+};
+
+#endif
index b7bb103..0a695c8 100644 (file)
@@ -243,15 +243,6 @@ config VIDEO_IMX219
          The sensor has a maximum of 8MP
          resolution.
 
-config VIDEO_IMX214
-        tristate "IMX214 camera sensor support"
-        depends on I2C && ARCH_TEGRA
-        ---help---
-        This is a driver for the IMX214 camera sensor
-        for use with the tegra isp.  The sensor has a
-        maximum of 13MP (4208x3120) resolution with HDR
-        capability.
-
 config VIDEO_CAMERA
         tristate "generic camera device support"
         depends on I2C && PLATFORM_TEGRA
index 20a0ace..7a2c060 100644 (file)
@@ -41,7 +41,6 @@ obj-$(CONFIG_VIDEO_IMX091)    += imx091.o nvc_utilities.o
 obj-$(CONFIG_VIDEO_IMX135)     += imx135.o
 obj-$(CONFIG_VIDEO_IMX179)     += imx179.o
 obj-$(CONFIG_VIDEO_IMX132)     += imx132.o
-obj-$(CONFIG_VIDEO_IMX219)     += imx219.o
 obj-$(CONFIG_VIDEO_IMX208)     += imx208.o
 obj-$(CONFIG_VIDEO_AR0261)     += ar0261.o
 obj-$(CONFIG_DEBUG_FS)         += nvc_debugfs.o
index 5f18018..aa8cb68 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2014-2015, NVIDIA Corporation.  All rights reserved.
+ * Copyright (c) 2014-2016, NVIDIA Corporation.  All rights reserved.
  *
  * NVIDIA Corporation and its licensors retain all intellectual property
  * and proprietary rights in and to this software and related documentation
 #define IMX219_IOCTL_GET_FLASH_CAP     _IOR('o', 30, __u32)
 #define IMX219_IOCTL_SET_FLASH_MODE _IOW('o', 31, struct imx219_flash_control)
 
-struct imx219_gain {
-       __u16 again;
-       __u8 dgain_upper;
-       __u8 dgain_lower;
-};
+/* TODO: revisit these values for IMX219 */
+#define IMX219_FRAME_LENGTH_ADDR_MSB            0x0160
+#define IMX219_FRAME_LENGTH_ADDR_LSB            0x0161
+#define IMX219_COARSE_TIME_ADDR_MSB             0x015a
+#define IMX219_COARSE_TIME_ADDR_LSB             0x015b
+#define IMX219_GAIN_ADDR                               0x0157
+
+#define IMX219_FUSE_ID_SIZE            6
+#define IMX219_FUSE_ID_STR_SIZE        (IMX219_FUSE_ID_SIZE * 2)
 
 struct imx219_mode {
        int xres;
        int yres;
        __u32 frame_length;
        __u32 coarse_time;
-       struct imx219_gain gain;
+       __u32 gain;
 };
 
 struct imx219_ae {
@@ -46,7 +50,7 @@ struct imx219_ae {
        __u8  frame_length_enable;
        __u32 coarse_time;
        __u8  coarse_time_enable;
-       struct imx219_gain gain;
+       __u32 gain;
        __u8  gain_enable;
 };
 
index fe126ce..f41d576 100644 (file)
@@ -43,6 +43,7 @@ enum {
        V4L2_IDENT_IMX135 = 75,
        V4L2_IDENT_IMX214 = 76,
        V4L2_IDENT_IMX230 = 77,
+       V4L2_IDENT_IMX219 = 78,
 
        /* module saa7110: just ident 100 */
        V4L2_IDENT_SAA7110 = 100,