1 From b47705e22313bb8621e66f4596581f671e986225 Mon Sep 17 00:00:00 2001
2 From: Lee Jackson <info@arducam.com>
3 Date: Fri, 27 Aug 2021 13:48:52 +0800
4 Subject: [PATCH] media: i2c: Add driver for IMX519 sensor
6 Adds a driver for the 16MPix IMX519 CSI2 sensor.
7 Whilst the sensor supports 2 or 4 CSI2 data lanes, this driver
8 currently only supports 2 lanes.
10 The following Bayer modes are currently available:
12 4656x3496 10-bit @ 10fps
13 3840x2160 10-bit (cropped) @ 21fps
14 2328x1748 10-bit (binned) @ 30fps
15 1920x1080 10-bit (cropped/binned) @ 60fps
16 1280x720 10-bit (cropped/binned) @ 120fps
18 Signed-off-by: Lee Jackson <info@arducam.com>
20 drivers/media/i2c/Kconfig | 11 +
21 drivers/media/i2c/Makefile | 1 +
22 drivers/media/i2c/imx519.c | 2024 ++++++++++++++++++++++++++++++++++++
23 3 files changed, 2036 insertions(+)
24 create mode 100644 drivers/media/i2c/imx519.c
26 --- a/drivers/media/i2c/Kconfig
27 +++ b/drivers/media/i2c/Kconfig
28 @@ -894,6 +894,17 @@ config VIDEO_IMX412
29 To compile this driver as a module, choose M here: the
30 module will be called imx412.
33 + tristate "Arducam IMX519 sensor support"
34 + depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
35 + depends on MEDIA_CAMERA_SUPPORT
37 + This is a Video4Linux2 sensor driver for the Arducam
40 + To compile this driver as a module, choose M here: the
41 + module will be called IMX519.
44 tristate "OmniVision OV02A10 sensor support"
45 depends on VIDEO_V4L2 && I2C
46 --- a/drivers/media/i2c/Makefile
47 +++ b/drivers/media/i2c/Makefile
48 @@ -131,6 +131,7 @@ obj-$(CONFIG_VIDEO_IMX334) += imx334.o
49 obj-$(CONFIG_VIDEO_IMX335) += imx335.o
50 obj-$(CONFIG_VIDEO_IMX355) += imx355.o
51 obj-$(CONFIG_VIDEO_IMX412) += imx412.o
52 +obj-$(CONFIG_VIDEO_IMX519) += imx519.o
53 obj-$(CONFIG_VIDEO_MAX9286) += max9286.o
54 obj-$(CONFIG_VIDEO_MAX9271_LIB) += max9271.o
55 obj-$(CONFIG_VIDEO_RDACM20) += rdacm20.o
57 +++ b/drivers/media/i2c/imx519.c
59 +// SPDX-License-Identifier: GPL-2.0
61 + * A V4L2 driver for Sony IMX519 cameras.
62 + * Copyright (C) 2021 Arducam Technology co., Ltd.
64 + * Based on Sony IMX477 camera driver
65 + * Copyright (C) 2020 Raspberry Pi (Trading) Ltd
67 +#include <asm/unaligned.h>
68 +#include <linux/clk.h>
69 +#include <linux/delay.h>
70 +#include <linux/gpio/consumer.h>
71 +#include <linux/i2c.h>
72 +#include <linux/module.h>
73 +#include <linux/of_device.h>
74 +#include <linux/pm_runtime.h>
75 +#include <linux/regulator/consumer.h>
76 +#include <media/v4l2-ctrls.h>
77 +#include <media/v4l2-device.h>
78 +#include <media/v4l2-event.h>
79 +#include <media/v4l2-fwnode.h>
80 +#include <media/v4l2-mediabus.h>
82 +#define IMX519_REG_VALUE_08BIT 1
83 +#define IMX519_REG_VALUE_16BIT 2
86 +#define IMX519_REG_CHIP_ID 0x0016
87 +#define IMX519_CHIP_ID 0x0519
89 +#define IMX519_REG_MODE_SELECT 0x0100
90 +#define IMX519_MODE_STANDBY 0x00
91 +#define IMX519_MODE_STREAMING 0x01
93 +#define IMX519_REG_ORIENTATION 0x101
95 +#define IMX519_XCLK_FREQ 24000000
97 +#define IMX519_DEFAULT_LINK_FREQ 493500000
99 +/* Pixel rate is fixed at 686MHz for all the modes */
100 +#define IMX519_PIXEL_RATE 686000000
102 +/* V_TIMING internal */
103 +#define IMX519_REG_FRAME_LENGTH 0x0340
104 +#define IMX519_FRAME_LENGTH_MAX 0xffdc
106 +/* Long exposure multiplier */
107 +#define IMX519_LONG_EXP_SHIFT_MAX 7
108 +#define IMX519_LONG_EXP_SHIFT_REG 0x3100
110 +/* Exposure control */
111 +#define IMX519_REG_EXPOSURE 0x0202
112 +#define IMX519_EXPOSURE_OFFSET 32
113 +#define IMX519_EXPOSURE_MIN 1
114 +#define IMX519_EXPOSURE_STEP 1
115 +#define IMX519_EXPOSURE_DEFAULT 0x3e8
116 +#define IMX519_EXPOSURE_MAX (IMX519_FRAME_LENGTH_MAX - \
117 + IMX519_EXPOSURE_OFFSET)
119 +/* Analog gain control */
120 +#define IMX519_REG_ANALOG_GAIN 0x0204
121 +#define IMX519_ANA_GAIN_MIN 0
122 +#define IMX519_ANA_GAIN_MAX 960
123 +#define IMX519_ANA_GAIN_STEP 1
124 +#define IMX519_ANA_GAIN_DEFAULT 0x0
126 +/* Digital gain control */
127 +#define IMX519_REG_DIGITAL_GAIN 0x020e
128 +#define IMX519_DGTL_GAIN_MIN 0x0100
129 +#define IMX519_DGTL_GAIN_MAX 0xffff
130 +#define IMX519_DGTL_GAIN_DEFAULT 0x0100
131 +#define IMX519_DGTL_GAIN_STEP 1
133 +/* Test Pattern Control */
134 +#define IMX519_REG_TEST_PATTERN 0x0600
135 +#define IMX519_TEST_PATTERN_DISABLE 0
136 +#define IMX519_TEST_PATTERN_SOLID_COLOR 1
137 +#define IMX519_TEST_PATTERN_COLOR_BARS 2
138 +#define IMX519_TEST_PATTERN_GREY_COLOR 3
139 +#define IMX519_TEST_PATTERN_PN9 4
141 +/* Test pattern colour components */
142 +#define IMX519_REG_TEST_PATTERN_R 0x0602
143 +#define IMX519_REG_TEST_PATTERN_GR 0x0604
144 +#define IMX519_REG_TEST_PATTERN_B 0x0606
145 +#define IMX519_REG_TEST_PATTERN_GB 0x0608
146 +#define IMX519_TEST_PATTERN_COLOUR_MIN 0
147 +#define IMX519_TEST_PATTERN_COLOUR_MAX 0x0fff
148 +#define IMX519_TEST_PATTERN_COLOUR_STEP 1
149 +#define IMX519_TEST_PATTERN_R_DEFAULT IMX519_TEST_PATTERN_COLOUR_MAX
150 +#define IMX519_TEST_PATTERN_GR_DEFAULT 0
151 +#define IMX519_TEST_PATTERN_B_DEFAULT 0
152 +#define IMX519_TEST_PATTERN_GB_DEFAULT 0
154 +/* IMX519 native and active pixel array size. */
155 +#define IMX519_NATIVE_WIDTH 4672U
156 +#define IMX519_NATIVE_HEIGHT 3648U
157 +#define IMX519_PIXEL_ARRAY_LEFT 8U
158 +#define IMX519_PIXEL_ARRAY_TOP 48U
159 +#define IMX519_PIXEL_ARRAY_WIDTH 4656U
160 +#define IMX519_PIXEL_ARRAY_HEIGHT 3496U
167 +struct imx519_reg_list {
168 + unsigned int num_of_regs;
169 + const struct imx519_reg *regs;
172 +/* Mode : resolution and related config&values */
173 +struct imx519_mode {
175 + unsigned int width;
178 + unsigned int height;
180 + /* H-timing in pixels */
181 + unsigned int line_length_pix;
183 + /* Analog crop rectangle. */
184 + struct v4l2_rect crop;
186 + /* Highest possible framerate. */
187 + struct v4l2_fract timeperframe_min;
189 + /* Default framerate. */
190 + struct v4l2_fract timeperframe_default;
192 + /* Default register values */
193 + struct imx519_reg_list reg_list;
196 +static const struct imx519_reg mode_common_regs[] = {
472 +static const struct imx519_reg mode_4656x3496_regs[] = {
549 +static const struct imx519_reg mode_3840x2160_regs[] = {
625 +/* 2x2 binned 30fps mode */
626 +static const struct imx519_reg mode_2328x1748_regs[] = {
702 +/* 1080p 60fps mode */
703 +static const struct imx519_reg mode_1920x1080_regs[] = {
779 +/* 720p 120fps mode */
780 +static const struct imx519_reg mode_1280x720_regs[] = {
857 +static const struct imx519_mode supported_modes_10bit[] = {
861 + .line_length_pix = 0x4200,
863 + .left = IMX519_PIXEL_ARRAY_LEFT,
864 + .top = IMX519_PIXEL_ARRAY_TOP,
868 + .timeperframe_min = {
870 + .denominator = 1000
872 + .timeperframe_default = {
874 + .denominator = 1000
877 + .num_of_regs = ARRAY_SIZE(mode_4656x3496_regs),
878 + .regs = mode_4656x3496_regs,
884 + .line_length_pix = 0x3870,
886 + .left = IMX519_PIXEL_ARRAY_LEFT + 408,
887 + .top = IMX519_PIXEL_ARRAY_TOP + 672,
891 + .timeperframe_min = {
893 + .denominator = 2100
895 + .timeperframe_default = {
897 + .denominator = 2100
900 + .num_of_regs = ARRAY_SIZE(mode_3840x2160_regs),
901 + .regs = mode_3840x2160_regs,
907 + .line_length_pix = 0x2412,
909 + .left = IMX519_PIXEL_ARRAY_LEFT,
910 + .top = IMX519_PIXEL_ARRAY_TOP,
914 + .timeperframe_min = {
916 + .denominator = 3000
918 + .timeperframe_default = {
920 + .denominator = 3000
923 + .num_of_regs = ARRAY_SIZE(mode_2328x1748_regs),
924 + .regs = mode_2328x1748_regs,
930 + .line_length_pix = 0x25D9,
932 + .left = IMX519_PIXEL_ARRAY_LEFT + 408,
933 + .top = IMX519_PIXEL_ARRAY_TOP + 674,
937 + .timeperframe_min = {
939 + .denominator = 6000
941 + .timeperframe_default = {
943 + .denominator = 6000
946 + .num_of_regs = ARRAY_SIZE(mode_1920x1080_regs),
947 + .regs = mode_1920x1080_regs,
953 + .line_length_pix = 0x1B3B,
955 + .left = IMX519_PIXEL_ARRAY_LEFT + 1048,
956 + .top = IMX519_PIXEL_ARRAY_TOP + 1042,
960 + .timeperframe_min = {
962 + .denominator = 12000
964 + .timeperframe_default = {
966 + .denominator = 12000
969 + .num_of_regs = ARRAY_SIZE(mode_1280x720_regs),
970 + .regs = mode_1280x720_regs,
976 + * The supported formats.
977 + * This table MUST contain 4 entries per format, to cover the various flip
978 + * combinations in the order
984 +static const u32 codes[] = {
985 + /* 10-bit modes. */
986 + MEDIA_BUS_FMT_SRGGB10_1X10,
987 + MEDIA_BUS_FMT_SGRBG10_1X10,
988 + MEDIA_BUS_FMT_SGBRG10_1X10,
989 + MEDIA_BUS_FMT_SBGGR10_1X10,
992 +static const char * const imx519_test_pattern_menu[] = {
1000 +static const int imx519_test_pattern_val[] = {
1001 + IMX519_TEST_PATTERN_DISABLE,
1002 + IMX519_TEST_PATTERN_COLOR_BARS,
1003 + IMX519_TEST_PATTERN_SOLID_COLOR,
1004 + IMX519_TEST_PATTERN_GREY_COLOR,
1005 + IMX519_TEST_PATTERN_PN9,
1008 +/* regulator supplies */
1009 +static const char * const imx519_supply_name[] = {
1010 + /* Supplies can be enabled in any order */
1011 + "VANA", /* Analog (2.8V) supply */
1012 + "VDIG", /* Digital Core (1.05V) supply */
1013 + "VDDL", /* IF (1.8V) supply */
1016 +#define IMX519_NUM_SUPPLIES ARRAY_SIZE(imx519_supply_name)
1019 + * Initialisation delay between XCLR low->high and the moment when the sensor
1020 + * can start capture (i.e. can leave software standby), given by T7 in the
1021 + * datasheet is 8ms. This does include I2C setup time as well.
1023 + * Note, that delay between XCLR low->high and reading the CCI ID register (T6
1024 + * in the datasheet) is much smaller - 600us.
1026 +#define IMX519_XCLR_MIN_DELAY_US 8000
1027 +#define IMX519_XCLR_DELAY_RANGE_US 1000
1030 + struct v4l2_subdev sd;
1031 + struct media_pad pad;
1033 + unsigned int fmt_code;
1037 + struct gpio_desc *reset_gpio;
1038 + struct regulator_bulk_data supplies[IMX519_NUM_SUPPLIES];
1040 + struct v4l2_ctrl_handler ctrl_handler;
1041 + /* V4L2 Controls */
1042 + struct v4l2_ctrl *pixel_rate;
1043 + struct v4l2_ctrl *exposure;
1044 + struct v4l2_ctrl *vflip;
1045 + struct v4l2_ctrl *hflip;
1046 + struct v4l2_ctrl *vblank;
1047 + struct v4l2_ctrl *hblank;
1049 + /* Current mode */
1050 + const struct imx519_mode *mode;
1053 + * Mutex for serialized access:
1054 + * Protect sensor module set pad format and start/stop streaming safely.
1056 + struct mutex mutex;
1058 + /* Streaming on/off */
1061 + /* Rewrite common registers on stream on? */
1062 + bool common_regs_written;
1064 + /* Current long exposure factor in use. Set through V4L2_CID_VBLANK */
1065 + unsigned int long_exp_shift;
1068 +static inline struct imx519 *to_imx519(struct v4l2_subdev *_sd)
1070 + return container_of(_sd, struct imx519, sd);
1073 +/* Read registers up to 2 at a time */
1074 +static int imx519_read_reg(struct imx519 *imx519, u16 reg, u32 len, u32 *val)
1076 + struct i2c_client *client = v4l2_get_subdevdata(&imx519->sd);
1077 + struct i2c_msg msgs[2];
1078 + u8 addr_buf[2] = { reg >> 8, reg & 0xff };
1079 + u8 data_buf[4] = { 0, };
1085 + /* Write register address */
1086 + msgs[0].addr = client->addr;
1087 + msgs[0].flags = 0;
1088 + msgs[0].len = ARRAY_SIZE(addr_buf);
1089 + msgs[0].buf = addr_buf;
1091 + /* Read data from register */
1092 + msgs[1].addr = client->addr;
1093 + msgs[1].flags = I2C_M_RD;
1094 + msgs[1].len = len;
1095 + msgs[1].buf = &data_buf[4 - len];
1097 + ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs));
1098 + if (ret != ARRAY_SIZE(msgs))
1101 + *val = get_unaligned_be32(data_buf);
1106 +/* Write registers up to 2 at a time */
1107 +static int imx519_write_reg(struct imx519 *imx519, u16 reg, u32 len, u32 val)
1109 + struct i2c_client *client = v4l2_get_subdevdata(&imx519->sd);
1115 + put_unaligned_be16(reg, buf);
1116 + put_unaligned_be32(val << (8 * (4 - len)), buf + 2);
1117 + if (i2c_master_send(client, buf, len + 2) != len + 2)
1123 +/* Write a list of registers */
1124 +static int imx519_write_regs(struct imx519 *imx519,
1125 + const struct imx519_reg *regs, u32 len)
1127 + struct i2c_client *client = v4l2_get_subdevdata(&imx519->sd);
1131 + for (i = 0; i < len; i++) {
1132 + ret = imx519_write_reg(imx519, regs[i].address, 1, regs[i].val);
1134 + dev_err_ratelimited(&client->dev,
1135 + "Failed to write reg 0x%4.4x. error = %d\n",
1136 + regs[i].address, ret);
1145 +/* Get bayer order based on flip setting. */
1146 +static u32 imx519_get_format_code(struct imx519 *imx519)
1150 + lockdep_assert_held(&imx519->mutex);
1152 + i = (imx519->vflip->val ? 2 : 0) |
1153 + (imx519->hflip->val ? 1 : 0);
1158 +static int imx519_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
1160 + struct imx519 *imx519 = to_imx519(sd);
1161 + struct v4l2_mbus_framefmt *try_fmt_img =
1162 + v4l2_subdev_get_try_format(sd, fh->state, 0);
1163 + struct v4l2_rect *try_crop;
1165 + mutex_lock(&imx519->mutex);
1167 + /* Initialize try_fmt for the image pad */
1168 + try_fmt_img->width = supported_modes_10bit[0].width;
1169 + try_fmt_img->height = supported_modes_10bit[0].height;
1170 + try_fmt_img->code = imx519_get_format_code(imx519);
1171 + try_fmt_img->field = V4L2_FIELD_NONE;
1173 + /* Initialize try_crop */
1174 + try_crop = v4l2_subdev_get_try_crop(sd, fh->state, 0);
1175 + try_crop->left = IMX519_PIXEL_ARRAY_LEFT;
1176 + try_crop->top = IMX519_PIXEL_ARRAY_TOP;
1177 + try_crop->width = IMX519_PIXEL_ARRAY_WIDTH;
1178 + try_crop->height = IMX519_PIXEL_ARRAY_HEIGHT;
1180 + mutex_unlock(&imx519->mutex);
1185 +static void imx519_adjust_exposure_range(struct imx519 *imx519)
1187 + int exposure_max, exposure_def;
1189 + /* Honour the VBLANK limits when setting exposure. */
1190 + exposure_max = imx519->mode->height + imx519->vblank->val -
1191 + IMX519_EXPOSURE_OFFSET;
1192 + exposure_def = min(exposure_max, imx519->exposure->val);
1193 + __v4l2_ctrl_modify_range(imx519->exposure, imx519->exposure->minimum,
1194 + exposure_max, imx519->exposure->step,
1198 +static int imx519_set_frame_length(struct imx519 *imx519, unsigned int val)
1202 + imx519->long_exp_shift = 0;
1204 + while (val > IMX519_FRAME_LENGTH_MAX) {
1205 + imx519->long_exp_shift++;
1209 + ret = imx519_write_reg(imx519, IMX519_REG_FRAME_LENGTH,
1210 + IMX519_REG_VALUE_16BIT, val);
1214 + return imx519_write_reg(imx519, IMX519_LONG_EXP_SHIFT_REG,
1215 + IMX519_REG_VALUE_08BIT, imx519->long_exp_shift);
1218 +static int imx519_set_ctrl(struct v4l2_ctrl *ctrl)
1220 + struct imx519 *imx519 =
1221 + container_of(ctrl->handler, struct imx519, ctrl_handler);
1222 + struct i2c_client *client = v4l2_get_subdevdata(&imx519->sd);
1226 + * The VBLANK control may change the limits of usable exposure, so check
1227 + * and adjust if necessary.
1229 + if (ctrl->id == V4L2_CID_VBLANK)
1230 + imx519_adjust_exposure_range(imx519);
1233 + * Applying V4L2 control value only happens
1234 + * when power is up for streaming
1236 + if (pm_runtime_get_if_in_use(&client->dev) == 0)
1239 + switch (ctrl->id) {
1240 + case V4L2_CID_ANALOGUE_GAIN:
1241 + ret = imx519_write_reg(imx519, IMX519_REG_ANALOG_GAIN,
1242 + IMX519_REG_VALUE_16BIT, ctrl->val);
1244 + case V4L2_CID_EXPOSURE:
1245 + ret = imx519_write_reg(imx519, IMX519_REG_EXPOSURE,
1246 + IMX519_REG_VALUE_16BIT, ctrl->val >>
1247 + imx519->long_exp_shift);
1249 + case V4L2_CID_DIGITAL_GAIN:
1250 + ret = imx519_write_reg(imx519, IMX519_REG_DIGITAL_GAIN,
1251 + IMX519_REG_VALUE_16BIT, ctrl->val);
1253 + case V4L2_CID_TEST_PATTERN:
1254 + ret = imx519_write_reg(imx519, IMX519_REG_TEST_PATTERN,
1255 + IMX519_REG_VALUE_16BIT,
1256 + imx519_test_pattern_val[ctrl->val]);
1258 + case V4L2_CID_TEST_PATTERN_RED:
1259 + ret = imx519_write_reg(imx519, IMX519_REG_TEST_PATTERN_R,
1260 + IMX519_REG_VALUE_16BIT, ctrl->val);
1262 + case V4L2_CID_TEST_PATTERN_GREENR:
1263 + ret = imx519_write_reg(imx519, IMX519_REG_TEST_PATTERN_GR,
1264 + IMX519_REG_VALUE_16BIT, ctrl->val);
1266 + case V4L2_CID_TEST_PATTERN_BLUE:
1267 + ret = imx519_write_reg(imx519, IMX519_REG_TEST_PATTERN_B,
1268 + IMX519_REG_VALUE_16BIT, ctrl->val);
1270 + case V4L2_CID_TEST_PATTERN_GREENB:
1271 + ret = imx519_write_reg(imx519, IMX519_REG_TEST_PATTERN_GB,
1272 + IMX519_REG_VALUE_16BIT, ctrl->val);
1274 + case V4L2_CID_HFLIP:
1275 + case V4L2_CID_VFLIP:
1276 + ret = imx519_write_reg(imx519, IMX519_REG_ORIENTATION, 1,
1277 + imx519->hflip->val |
1278 + imx519->vflip->val << 1);
1280 + case V4L2_CID_VBLANK:
1281 + ret = imx519_set_frame_length(imx519,
1282 + imx519->mode->height + ctrl->val);
1285 + dev_info(&client->dev,
1286 + "ctrl(id:0x%x,val:0x%x) is not handled\n",
1287 + ctrl->id, ctrl->val);
1292 + pm_runtime_put(&client->dev);
1297 +static const struct v4l2_ctrl_ops imx519_ctrl_ops = {
1298 + .s_ctrl = imx519_set_ctrl,
1301 +static int imx519_enum_mbus_code(struct v4l2_subdev *sd,
1302 + struct v4l2_subdev_state *sd_state,
1303 + struct v4l2_subdev_mbus_code_enum *code)
1305 + struct imx519 *imx519 = to_imx519(sd);
1307 + if (code->index > 0)
1310 + code->code = imx519_get_format_code(imx519);
1315 +static int imx519_enum_frame_size(struct v4l2_subdev *sd,
1316 + struct v4l2_subdev_state *sd_state,
1317 + struct v4l2_subdev_frame_size_enum *fse)
1319 + struct imx519 *imx519 = to_imx519(sd);
1321 + if (fse->index >= ARRAY_SIZE(supported_modes_10bit))
1324 + if (fse->code != imx519_get_format_code(imx519))
1327 + fse->min_width = supported_modes_10bit[fse->index].width;
1328 + fse->max_width = fse->min_width;
1329 + fse->min_height = supported_modes_10bit[fse->index].height;
1330 + fse->max_height = fse->min_height;
1335 +static void imx519_reset_colorspace(struct v4l2_mbus_framefmt *fmt)
1337 + fmt->colorspace = V4L2_COLORSPACE_SRGB;
1338 + fmt->ycbcr_enc = V4L2_MAP_YCBCR_ENC_DEFAULT(fmt->colorspace);
1339 + fmt->quantization = V4L2_MAP_QUANTIZATION_DEFAULT(true,
1342 + fmt->xfer_func = V4L2_MAP_XFER_FUNC_DEFAULT(fmt->colorspace);
1345 +static void imx519_update_image_pad_format(struct imx519 *imx519,
1346 + const struct imx519_mode *mode,
1347 + struct v4l2_subdev_format *fmt)
1349 + fmt->format.width = mode->width;
1350 + fmt->format.height = mode->height;
1351 + fmt->format.field = V4L2_FIELD_NONE;
1352 + imx519_reset_colorspace(&fmt->format);
1355 +static int imx519_get_pad_format(struct v4l2_subdev *sd,
1356 + struct v4l2_subdev_state *sd_state,
1357 + struct v4l2_subdev_format *fmt)
1359 + struct imx519 *imx519 = to_imx519(sd);
1361 + if (fmt->pad != 0)
1364 + mutex_lock(&imx519->mutex);
1366 + if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) {
1367 + struct v4l2_mbus_framefmt *try_fmt =
1368 + v4l2_subdev_get_try_format(&imx519->sd, sd_state,
1370 + /* update the code which could change due to vflip or hflip: */
1371 + try_fmt->code = imx519_get_format_code(imx519);
1372 + fmt->format = *try_fmt;
1374 + imx519_update_image_pad_format(imx519, imx519->mode,
1376 + fmt->format.code = imx519_get_format_code(imx519);
1379 + mutex_unlock(&imx519->mutex);
1384 +unsigned int imx519_get_frame_length(const struct imx519_mode *mode,
1385 + const struct v4l2_fract *timeperframe)
1389 + frame_length = (u64)timeperframe->numerator * IMX519_PIXEL_RATE;
1390 + do_div(frame_length,
1391 + (u64)timeperframe->denominator * mode->line_length_pix);
1393 + if (WARN_ON(frame_length > IMX519_FRAME_LENGTH_MAX))
1394 + frame_length = IMX519_FRAME_LENGTH_MAX;
1396 + return max_t(unsigned int, frame_length, mode->height);
1399 +static void imx519_set_framing_limits(struct imx519 *imx519)
1401 + unsigned int frm_length_min, frm_length_default, hblank;
1402 + const struct imx519_mode *mode = imx519->mode;
1404 + frm_length_min = imx519_get_frame_length(mode, &mode->timeperframe_min);
1405 + frm_length_default =
1406 + imx519_get_frame_length(mode, &mode->timeperframe_default);
1408 + /* Default to no long exposure multiplier. */
1409 + imx519->long_exp_shift = 0;
1411 + /* Update limits and set FPS to default */
1412 + __v4l2_ctrl_modify_range(imx519->vblank, frm_length_min - mode->height,
1413 + ((1 << IMX519_LONG_EXP_SHIFT_MAX) *
1414 + IMX519_FRAME_LENGTH_MAX) - mode->height,
1415 + 1, frm_length_default - mode->height);
1417 + /* Setting this will adjust the exposure limits as well. */
1418 + __v4l2_ctrl_s_ctrl(imx519->vblank, frm_length_default - mode->height);
1421 + * Currently PPL is fixed to the mode specified value, so hblank
1422 + * depends on mode->width only, and is not changeable in any
1423 + * way other than changing the mode.
1425 + hblank = mode->line_length_pix - mode->width;
1426 + __v4l2_ctrl_modify_range(imx519->hblank, hblank, hblank, 1, hblank);
1429 +static int imx519_set_pad_format(struct v4l2_subdev *sd,
1430 + struct v4l2_subdev_state *sd_state,
1431 + struct v4l2_subdev_format *fmt)
1433 + struct v4l2_mbus_framefmt *framefmt;
1434 + const struct imx519_mode *mode;
1435 + struct imx519 *imx519 = to_imx519(sd);
1437 + if (fmt->pad != 0)
1440 + mutex_lock(&imx519->mutex);
1442 + /* Bayer order varies with flips */
1443 + fmt->format.code = imx519_get_format_code(imx519);
1445 + mode = v4l2_find_nearest_size(supported_modes_10bit,
1446 + ARRAY_SIZE(supported_modes_10bit),
1448 + fmt->format.width,
1449 + fmt->format.height);
1450 + imx519_update_image_pad_format(imx519, mode, fmt);
1451 + if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) {
1452 + framefmt = v4l2_subdev_get_try_format(sd, sd_state,
1454 + *framefmt = fmt->format;
1456 + imx519->mode = mode;
1457 + imx519->fmt_code = fmt->format.code;
1458 + imx519_set_framing_limits(imx519);
1461 + mutex_unlock(&imx519->mutex);
1466 +static const struct v4l2_rect *
1467 +__imx519_get_pad_crop(struct imx519 *imx519, struct v4l2_subdev_state *sd_state,
1468 + unsigned int pad, enum v4l2_subdev_format_whence which)
1471 + case V4L2_SUBDEV_FORMAT_TRY:
1472 + return v4l2_subdev_get_try_crop(&imx519->sd, sd_state, pad);
1473 + case V4L2_SUBDEV_FORMAT_ACTIVE:
1474 + return &imx519->mode->crop;
1480 +static int imx519_get_selection(struct v4l2_subdev *sd,
1481 + struct v4l2_subdev_state *sd_state,
1482 + struct v4l2_subdev_selection *sel)
1484 + switch (sel->target) {
1485 + case V4L2_SEL_TGT_CROP: {
1486 + struct imx519 *imx519 = to_imx519(sd);
1488 + mutex_lock(&imx519->mutex);
1489 + sel->r = *__imx519_get_pad_crop(imx519, sd_state, sel->pad,
1491 + mutex_unlock(&imx519->mutex);
1496 + case V4L2_SEL_TGT_NATIVE_SIZE:
1499 + sel->r.width = IMX519_NATIVE_WIDTH;
1500 + sel->r.height = IMX519_NATIVE_HEIGHT;
1504 + case V4L2_SEL_TGT_CROP_DEFAULT:
1505 + case V4L2_SEL_TGT_CROP_BOUNDS:
1506 + sel->r.left = IMX519_PIXEL_ARRAY_LEFT;
1507 + sel->r.top = IMX519_PIXEL_ARRAY_TOP;
1508 + sel->r.width = IMX519_PIXEL_ARRAY_WIDTH;
1509 + sel->r.height = IMX519_PIXEL_ARRAY_HEIGHT;
1517 +/* Start streaming */
1518 +static int imx519_start_streaming(struct imx519 *imx519)
1520 + struct i2c_client *client = v4l2_get_subdevdata(&imx519->sd);
1521 + const struct imx519_reg_list *reg_list;
1524 + if (!imx519->common_regs_written) {
1525 + ret = imx519_write_regs(imx519, mode_common_regs,
1526 + ARRAY_SIZE(mode_common_regs));
1529 + dev_err(&client->dev, "%s failed to set common settings\n",
1533 + imx519->common_regs_written = true;
1536 + /* Apply default values of current mode */
1537 + reg_list = &imx519->mode->reg_list;
1538 + ret = imx519_write_regs(imx519, reg_list->regs, reg_list->num_of_regs);
1540 + dev_err(&client->dev, "%s failed to set mode\n", __func__);
1544 + /* Apply customized values from user */
1545 + ret = __v4l2_ctrl_handler_setup(imx519->sd.ctrl_handler);
1549 + /* set stream on register */
1550 + return imx519_write_reg(imx519, IMX519_REG_MODE_SELECT,
1551 + IMX519_REG_VALUE_08BIT, IMX519_MODE_STREAMING);
1554 +/* Stop streaming */
1555 +static void imx519_stop_streaming(struct imx519 *imx519)
1557 + struct i2c_client *client = v4l2_get_subdevdata(&imx519->sd);
1560 + /* set stream off register */
1561 + ret = imx519_write_reg(imx519, IMX519_REG_MODE_SELECT,
1562 + IMX519_REG_VALUE_08BIT, IMX519_MODE_STANDBY);
1564 + dev_err(&client->dev, "%s failed to set stream\n", __func__);
1567 +static int imx519_set_stream(struct v4l2_subdev *sd, int enable)
1569 + struct imx519 *imx519 = to_imx519(sd);
1570 + struct i2c_client *client = v4l2_get_subdevdata(sd);
1573 + mutex_lock(&imx519->mutex);
1574 + if (imx519->streaming == enable) {
1575 + mutex_unlock(&imx519->mutex);
1580 + ret = pm_runtime_get_sync(&client->dev);
1582 + pm_runtime_put_noidle(&client->dev);
1587 + * Apply default & customized values
1588 + * and then start streaming.
1590 + ret = imx519_start_streaming(imx519);
1594 + imx519_stop_streaming(imx519);
1595 + pm_runtime_put(&client->dev);
1598 + imx519->streaming = enable;
1600 + /* vflip and hflip cannot change during streaming */
1601 + __v4l2_ctrl_grab(imx519->vflip, enable);
1602 + __v4l2_ctrl_grab(imx519->hflip, enable);
1604 + mutex_unlock(&imx519->mutex);
1609 + pm_runtime_put(&client->dev);
1611 + mutex_unlock(&imx519->mutex);
1616 +/* Power/clock management functions */
1617 +static int imx519_power_on(struct device *dev)
1619 + struct i2c_client *client = to_i2c_client(dev);
1620 + struct v4l2_subdev *sd = i2c_get_clientdata(client);
1621 + struct imx519 *imx519 = to_imx519(sd);
1624 + ret = regulator_bulk_enable(IMX519_NUM_SUPPLIES,
1625 + imx519->supplies);
1627 + dev_err(&client->dev, "%s: failed to enable regulators\n",
1632 + ret = clk_prepare_enable(imx519->xclk);
1634 + dev_err(&client->dev, "%s: failed to enable clock\n",
1639 + gpiod_set_value_cansleep(imx519->reset_gpio, 1);
1640 + usleep_range(IMX519_XCLR_MIN_DELAY_US,
1641 + IMX519_XCLR_MIN_DELAY_US + IMX519_XCLR_DELAY_RANGE_US);
1646 + regulator_bulk_disable(IMX519_NUM_SUPPLIES, imx519->supplies);
1650 +static int imx519_power_off(struct device *dev)
1652 + struct i2c_client *client = to_i2c_client(dev);
1653 + struct v4l2_subdev *sd = i2c_get_clientdata(client);
1654 + struct imx519 *imx519 = to_imx519(sd);
1656 + gpiod_set_value_cansleep(imx519->reset_gpio, 0);
1657 + regulator_bulk_disable(IMX519_NUM_SUPPLIES, imx519->supplies);
1658 + clk_disable_unprepare(imx519->xclk);
1660 + /* Force reprogramming of the common registers when powered up again. */
1661 + imx519->common_regs_written = false;
1666 +static int __maybe_unused imx519_suspend(struct device *dev)
1668 + struct i2c_client *client = to_i2c_client(dev);
1669 + struct v4l2_subdev *sd = i2c_get_clientdata(client);
1670 + struct imx519 *imx519 = to_imx519(sd);
1672 + if (imx519->streaming)
1673 + imx519_stop_streaming(imx519);
1678 +static int __maybe_unused imx519_resume(struct device *dev)
1680 + struct i2c_client *client = to_i2c_client(dev);
1681 + struct v4l2_subdev *sd = i2c_get_clientdata(client);
1682 + struct imx519 *imx519 = to_imx519(sd);
1685 + if (imx519->streaming) {
1686 + ret = imx519_start_streaming(imx519);
1694 + imx519_stop_streaming(imx519);
1695 + imx519->streaming = 0;
1699 +static int imx519_get_regulators(struct imx519 *imx519)
1701 + struct i2c_client *client = v4l2_get_subdevdata(&imx519->sd);
1704 + for (i = 0; i < IMX519_NUM_SUPPLIES; i++)
1705 + imx519->supplies[i].supply = imx519_supply_name[i];
1707 + return devm_regulator_bulk_get(&client->dev,
1708 + IMX519_NUM_SUPPLIES,
1709 + imx519->supplies);
1712 +/* Verify chip ID */
1713 +static int imx519_identify_module(struct imx519 *imx519, u32 expected_id)
1715 + struct i2c_client *client = v4l2_get_subdevdata(&imx519->sd);
1719 + ret = imx519_read_reg(imx519, IMX519_REG_CHIP_ID,
1720 + IMX519_REG_VALUE_16BIT, &val);
1722 + dev_err(&client->dev, "failed to read chip id %x, with error %d\n",
1723 + expected_id, ret);
1727 + if (val != expected_id) {
1728 + dev_err(&client->dev, "chip id mismatch: %x!=%x\n",
1729 + expected_id, val);
1733 + dev_info(&client->dev, "Device found is imx%x\n", val);
1738 +static const struct v4l2_subdev_core_ops imx519_core_ops = {
1739 + .subscribe_event = v4l2_ctrl_subdev_subscribe_event,
1740 + .unsubscribe_event = v4l2_event_subdev_unsubscribe,
1743 +static const struct v4l2_subdev_video_ops imx519_video_ops = {
1744 + .s_stream = imx519_set_stream,
1747 +static const struct v4l2_subdev_pad_ops imx519_pad_ops = {
1748 + .enum_mbus_code = imx519_enum_mbus_code,
1749 + .get_fmt = imx519_get_pad_format,
1750 + .set_fmt = imx519_set_pad_format,
1751 + .get_selection = imx519_get_selection,
1752 + .enum_frame_size = imx519_enum_frame_size,
1755 +static const struct v4l2_subdev_ops imx519_subdev_ops = {
1756 + .core = &imx519_core_ops,
1757 + .video = &imx519_video_ops,
1758 + .pad = &imx519_pad_ops,
1761 +static const struct v4l2_subdev_internal_ops imx519_internal_ops = {
1762 + .open = imx519_open,
1765 +/* Initialize control handlers */
1766 +static int imx519_init_controls(struct imx519 *imx519)
1768 + struct v4l2_ctrl_handler *ctrl_hdlr;
1769 + struct i2c_client *client = v4l2_get_subdevdata(&imx519->sd);
1770 + struct v4l2_fwnode_device_properties props;
1774 + ctrl_hdlr = &imx519->ctrl_handler;
1775 + ret = v4l2_ctrl_handler_init(ctrl_hdlr, 16);
1779 + mutex_init(&imx519->mutex);
1780 + ctrl_hdlr->lock = &imx519->mutex;
1782 + /* By default, PIXEL_RATE is read only */
1783 + imx519->pixel_rate = v4l2_ctrl_new_std(ctrl_hdlr, &imx519_ctrl_ops,
1784 + V4L2_CID_PIXEL_RATE,
1785 + IMX519_PIXEL_RATE,
1786 + IMX519_PIXEL_RATE, 1,
1787 + IMX519_PIXEL_RATE);
1790 + * Create the controls here, but mode specific limits are setup
1791 + * in the imx519_set_framing_limits() call below.
1793 + imx519->vblank = v4l2_ctrl_new_std(ctrl_hdlr, &imx519_ctrl_ops,
1794 + V4L2_CID_VBLANK, 0, 0xffff, 1, 0);
1795 + imx519->hblank = v4l2_ctrl_new_std(ctrl_hdlr, &imx519_ctrl_ops,
1796 + V4L2_CID_HBLANK, 0, 0xffff, 1, 0);
1798 + /* HBLANK is read-only for now, but does change with mode. */
1799 + if (imx519->hblank)
1800 + imx519->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY;
1802 + imx519->exposure = v4l2_ctrl_new_std(ctrl_hdlr, &imx519_ctrl_ops,
1803 + V4L2_CID_EXPOSURE,
1804 + IMX519_EXPOSURE_MIN,
1805 + IMX519_EXPOSURE_MAX,
1806 + IMX519_EXPOSURE_STEP,
1807 + IMX519_EXPOSURE_DEFAULT);
1809 + v4l2_ctrl_new_std(ctrl_hdlr, &imx519_ctrl_ops, V4L2_CID_ANALOGUE_GAIN,
1810 + IMX519_ANA_GAIN_MIN, IMX519_ANA_GAIN_MAX,
1811 + IMX519_ANA_GAIN_STEP, IMX519_ANA_GAIN_DEFAULT);
1813 + v4l2_ctrl_new_std(ctrl_hdlr, &imx519_ctrl_ops, V4L2_CID_DIGITAL_GAIN,
1814 + IMX519_DGTL_GAIN_MIN, IMX519_DGTL_GAIN_MAX,
1815 + IMX519_DGTL_GAIN_STEP, IMX519_DGTL_GAIN_DEFAULT);
1817 + imx519->hflip = v4l2_ctrl_new_std(ctrl_hdlr, &imx519_ctrl_ops,
1818 + V4L2_CID_HFLIP, 0, 1, 1, 0);
1819 + if (imx519->hflip)
1820 + imx519->hflip->flags |= V4L2_CTRL_FLAG_MODIFY_LAYOUT;
1822 + imx519->vflip = v4l2_ctrl_new_std(ctrl_hdlr, &imx519_ctrl_ops,
1823 + V4L2_CID_VFLIP, 0, 1, 1, 0);
1824 + if (imx519->vflip)
1825 + imx519->vflip->flags |= V4L2_CTRL_FLAG_MODIFY_LAYOUT;
1827 + v4l2_ctrl_new_std_menu_items(ctrl_hdlr, &imx519_ctrl_ops,
1828 + V4L2_CID_TEST_PATTERN,
1829 + ARRAY_SIZE(imx519_test_pattern_menu) - 1,
1830 + 0, 0, imx519_test_pattern_menu);
1831 + for (i = 0; i < 4; i++) {
1833 + * The assumption is that
1834 + * V4L2_CID_TEST_PATTERN_GREENR == V4L2_CID_TEST_PATTERN_RED + 1
1835 + * V4L2_CID_TEST_PATTERN_BLUE == V4L2_CID_TEST_PATTERN_RED + 2
1836 + * V4L2_CID_TEST_PATTERN_GREENB == V4L2_CID_TEST_PATTERN_RED + 3
1838 + v4l2_ctrl_new_std(ctrl_hdlr, &imx519_ctrl_ops,
1839 + V4L2_CID_TEST_PATTERN_RED + i,
1840 + IMX519_TEST_PATTERN_COLOUR_MIN,
1841 + IMX519_TEST_PATTERN_COLOUR_MAX,
1842 + IMX519_TEST_PATTERN_COLOUR_STEP,
1843 + IMX519_TEST_PATTERN_COLOUR_MAX);
1844 + /* The "Solid color" pattern is white by default */
1847 + if (ctrl_hdlr->error) {
1848 + ret = ctrl_hdlr->error;
1849 + dev_err(&client->dev, "%s control init failed (%d)\n",
1854 + ret = v4l2_fwnode_device_parse(&client->dev, &props);
1858 + ret = v4l2_ctrl_new_fwnode_properties(ctrl_hdlr, &imx519_ctrl_ops,
1863 + imx519->sd.ctrl_handler = ctrl_hdlr;
1865 + /* Setup exposure and frame/line length limits. */
1866 + imx519_set_framing_limits(imx519);
1871 + v4l2_ctrl_handler_free(ctrl_hdlr);
1872 + mutex_destroy(&imx519->mutex);
1877 +static void imx519_free_controls(struct imx519 *imx519)
1879 + v4l2_ctrl_handler_free(imx519->sd.ctrl_handler);
1880 + mutex_destroy(&imx519->mutex);
1883 +static int imx519_check_hwcfg(struct device *dev)
1885 + struct fwnode_handle *endpoint;
1886 + struct v4l2_fwnode_endpoint ep_cfg = {
1887 + .bus_type = V4L2_MBUS_CSI2_DPHY
1889 + int ret = -EINVAL;
1891 + endpoint = fwnode_graph_get_next_endpoint(dev_fwnode(dev), NULL);
1893 + dev_err(dev, "endpoint node not found\n");
1897 + if (v4l2_fwnode_endpoint_alloc_parse(endpoint, &ep_cfg)) {
1898 + dev_err(dev, "could not parse endpoint\n");
1902 + /* Check the number of MIPI CSI2 data lanes */
1903 + if (ep_cfg.bus.mipi_csi2.num_data_lanes != 2) {
1904 + dev_err(dev, "only 2 data lanes are currently supported\n");
1908 + /* Check the link frequency set in device tree */
1909 + if (!ep_cfg.nr_of_link_frequencies) {
1910 + dev_err(dev, "link-frequency property not found in DT\n");
1914 + if (ep_cfg.nr_of_link_frequencies != 1 ||
1915 + ep_cfg.link_frequencies[0] != IMX519_DEFAULT_LINK_FREQ) {
1916 + dev_err(dev, "Link frequency not supported: %lld\n",
1917 + ep_cfg.link_frequencies[0]);
1924 + v4l2_fwnode_endpoint_free(&ep_cfg);
1925 + fwnode_handle_put(endpoint);
1930 +static const struct of_device_id imx519_dt_ids[] = {
1931 + { .compatible = "sony,imx519"},
1932 + { /* sentinel */ }
1935 +static int imx519_probe(struct i2c_client *client)
1937 + struct device *dev = &client->dev;
1938 + struct imx519 *imx519;
1939 + const struct of_device_id *match;
1943 + imx519 = devm_kzalloc(&client->dev, sizeof(*imx519), GFP_KERNEL);
1947 + v4l2_i2c_subdev_init(&imx519->sd, client, &imx519_subdev_ops);
1949 + match = of_match_device(imx519_dt_ids, dev);
1953 + /* Check the hardware configuration in device tree */
1954 + if (imx519_check_hwcfg(dev))
1957 + /* Get system clock (xclk) */
1958 + imx519->xclk = devm_clk_get(dev, NULL);
1959 + if (IS_ERR(imx519->xclk)) {
1960 + dev_err(dev, "failed to get xclk\n");
1961 + return PTR_ERR(imx519->xclk);
1964 + xclk_freq = clk_get_rate(imx519->xclk);
1965 + if (xclk_freq != IMX519_XCLK_FREQ) {
1966 + dev_err(dev, "xclk frequency not supported: %d Hz\n",
1971 + ret = imx519_get_regulators(imx519);
1973 + dev_err(dev, "failed to get regulators\n");
1977 + /* Request optional enable pin */
1978 + imx519->reset_gpio = devm_gpiod_get_optional(dev, "reset",
1982 + * The sensor must be powered for imx519_identify_module()
1983 + * to be able to read the CHIP_ID register
1985 + ret = imx519_power_on(dev);
1989 + ret = imx519_identify_module(imx519, IMX519_CHIP_ID);
1991 + goto error_power_off;
1993 + /* Set default mode to max resolution */
1994 + imx519->mode = &supported_modes_10bit[0];
1995 + imx519->fmt_code = MEDIA_BUS_FMT_SRGGB10_1X10;
1997 + /* Enable runtime PM and turn off the device */
1998 + pm_runtime_set_active(dev);
1999 + pm_runtime_enable(dev);
2000 + pm_runtime_idle(dev);
2002 + /* This needs the pm runtime to be registered. */
2003 + ret = imx519_init_controls(imx519);
2005 + goto error_power_off;
2007 + /* Initialize subdev */
2008 + imx519->sd.internal_ops = &imx519_internal_ops;
2009 + imx519->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE |
2010 + V4L2_SUBDEV_FL_HAS_EVENTS;
2011 + imx519->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
2013 + /* Initialize source pads */
2014 + imx519->pad.flags = MEDIA_PAD_FL_SOURCE;
2016 + ret = media_entity_pads_init(&imx519->sd.entity, 1, &imx519->pad);
2018 + dev_err(dev, "failed to init entity pads: %d\n", ret);
2019 + goto error_handler_free;
2022 + ret = v4l2_async_register_subdev_sensor(&imx519->sd);
2024 + dev_err(dev, "failed to register sensor sub-device: %d\n", ret);
2025 + goto error_media_entity;
2030 +error_media_entity:
2031 + media_entity_cleanup(&imx519->sd.entity);
2033 +error_handler_free:
2034 + imx519_free_controls(imx519);
2037 + pm_runtime_disable(&client->dev);
2038 + pm_runtime_set_suspended(&client->dev);
2039 + imx519_power_off(&client->dev);
2044 +static int imx519_remove(struct i2c_client *client)
2046 + struct v4l2_subdev *sd = i2c_get_clientdata(client);
2047 + struct imx519 *imx519 = to_imx519(sd);
2049 + v4l2_async_unregister_subdev(sd);
2050 + media_entity_cleanup(&sd->entity);
2051 + imx519_free_controls(imx519);
2053 + pm_runtime_disable(&client->dev);
2054 + if (!pm_runtime_status_suspended(&client->dev))
2055 + imx519_power_off(&client->dev);
2056 + pm_runtime_set_suspended(&client->dev);
2061 +MODULE_DEVICE_TABLE(of, imx519_dt_ids);
2063 +static const struct dev_pm_ops imx519_pm_ops = {
2064 + SET_SYSTEM_SLEEP_PM_OPS(imx519_suspend, imx519_resume)
2065 + SET_RUNTIME_PM_OPS(imx519_power_off, imx519_power_on, NULL)
2068 +static struct i2c_driver imx519_i2c_driver = {
2071 + .of_match_table = imx519_dt_ids,
2072 + .pm = &imx519_pm_ops,
2074 + .probe_new = imx519_probe,
2075 + .remove = imx519_remove,
2078 +module_i2c_driver(imx519_i2c_driver);
2080 +MODULE_AUTHOR("Lee Jackson <info@arducam.com>");
2081 +MODULE_DESCRIPTION("Sony IMX519 sensor driver");
2082 +MODULE_LICENSE("GPL v2");