2 * Samsung Exynos5 SoC series Sensor driver
5 * Copyright (c) 2018 Samsung Electronics Co., Ltd
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
12 #include <linux/i2c.h>
13 #include <linux/slab.h>
14 #include <linux/irq.h>
15 #include <linux/interrupt.h>
16 #include <linux/delay.h>
17 #include <linux/version.h>
18 #include <linux/gpio.h>
19 #include <linux/clk.h>
20 #include <linux/regulator/consumer.h>
21 #include <linux/videodev2.h>
22 #include <linux/videodev2_exynos_camera.h>
23 #include <linux/module.h>
24 #include <linux/moduleparam.h>
25 #include <linux/platform_device.h>
26 #include <linux/of_gpio.h>
27 #include <media/v4l2-ctrls.h>
28 #include <media/v4l2-device.h>
29 #include <media/v4l2-subdev.h>
31 #include <exynos-fimc-is-sensor.h>
32 #include "fimc-is-hw.h"
33 #include "fimc-is-core.h"
34 #include "fimc-is-device-sensor.h"
35 #include "fimc-is-device-sensor-peri.h"
36 #include "fimc-is-resourcemgr.h"
37 #include "fimc-is-dt.h"
39 #include "fimc-is-device-module-base.h"
41 static struct fimc_is_sensor_cfg config_module_2x5sp[] = {
42 /* width, height, fps, settle, mode, lane, speed, interleave, pd_mode */
43 FIMC_IS_SENSOR_CFG(2880, 2160, 30, 0, 0, CSI_DATA_LANES_4, 2100, CSI_MODE_DT_ONLY, PD_NONE,
44 VC_IN(0, HW_FORMAT_RAW10, 2880, 2160), VC_OUT(HW_FORMAT_RAW10, VC_NOTHING, 2880, 2160),
45 VC_IN(1, HW_FORMAT_UNKNOWN, 0, 0), VC_OUT(HW_FORMAT_UNKNOWN, VC_NOTHING, 0, 0),
46 VC_IN(0, HW_FORMAT_EMBEDDED_8BIT, 0, 0), VC_OUT(HW_FORMAT_USER, VC_NOTHING, 0, 0),
47 VC_IN(0, HW_FORMAT_USER, 0, 0), VC_OUT(HW_FORMAT_UNKNOWN, VC_NOTHING, 0, 0)),
48 FIMC_IS_SENSOR_CFG_EX(2880, 2160, 30, 0, 1, CSI_DATA_LANES_4, 1502, CSI_MODE_DT_ONLY, PD_NONE, EX_3DHDR,
49 VC_IN(0, HW_FORMAT_RAW10, 2880, 2160), VC_OUT(HW_FORMAT_RAW10, VC_NOTHING, 2880, 2160),
50 VC_IN(1, HW_FORMAT_UNKNOWN, 0, 0), VC_OUT(HW_FORMAT_UNKNOWN, VC_NOTHING, 0, 0),
51 VC_IN(0, HW_FORMAT_EMBEDDED_8BIT, 0, 0), VC_OUT(HW_FORMAT_UNKNOWN, VC_NOTHING, 0, 0),
52 VC_IN(0, HW_FORMAT_USER, 2880, 34), VC_OUT(HW_FORMAT_USER, VC_EMBEDDED, 2880, 34)),
53 FIMC_IS_SENSOR_CFG(5760, 4320, 24, 0, 2, CSI_DATA_LANES_4, 2100, CSI_MODE_DT_ONLY, PD_NONE,
54 VC_IN(0, HW_FORMAT_RAW10, 5760, 4320), VC_OUT(HW_FORMAT_RAW10, VC_NOTHING, 5760, 4320),
55 VC_IN(1, HW_FORMAT_UNKNOWN, 0, 0), VC_OUT(HW_FORMAT_UNKNOWN, VC_NOTHING, 0, 0),
56 VC_IN(2, HW_FORMAT_USER, 0, 0), VC_OUT(HW_FORMAT_USER, VC_NOTHING, 0, 0),
57 VC_IN(3, HW_FORMAT_EMBEDDED_8BIT, 0, 0), VC_OUT(HW_FORMAT_UNKNOWN, VC_NOTHING, 0, 0)),
58 FIMC_IS_SENSOR_CFG(1920, 1080, 120, 0, 3, CSI_DATA_LANES_4, 1800, CSI_MODE_VC_DT, PD_NONE,
59 VC_IN(0, HW_FORMAT_RAW10, 1920, 1080), VC_OUT(HW_FORMAT_RAW10, VC_NOTHING, 1920, 1080),
60 VC_IN(1, HW_FORMAT_UNKNOWN, 0, 0), VC_OUT(HW_FORMAT_UNKNOWN, VC_NOTHING, 0, 0),
61 VC_IN(2, HW_FORMAT_USER, 0, 0), VC_OUT(HW_FORMAT_USER, VC_NOTHING, 0, 0),
62 VC_IN(0, HW_FORMAT_EMBEDDED_8BIT, 0, 0), VC_OUT(HW_FORMAT_UNKNOWN, VC_NOTHING, 0, 0)),
63 FIMC_IS_SENSOR_CFG(1280, 720, 240, 0, 4, CSI_DATA_LANES_4, 1800, CSI_MODE_VC_DT, PD_NONE,
64 VC_IN(0, HW_FORMAT_RAW10, 1280, 720), VC_OUT(HW_FORMAT_RAW10, VC_NOTHING, 1280, 720),
65 VC_IN(1, HW_FORMAT_UNKNOWN, 0, 0), VC_OUT(HW_FORMAT_UNKNOWN, VC_NOTHING, 0, 0),
66 VC_IN(2, HW_FORMAT_USER, 0, 0), VC_OUT(HW_FORMAT_USER, VC_NOTHING, 0, 0),
67 VC_IN(0, HW_FORMAT_EMBEDDED_8BIT, 0, 0), VC_OUT(HW_FORMAT_UNKNOWN, VC_NOTHING, 0, 0)),
70 static const struct v4l2_subdev_core_ops core_ops = {
71 .init = sensor_module_init,
72 .g_ctrl = sensor_module_g_ctrl,
73 .s_ctrl = sensor_module_s_ctrl,
74 .g_ext_ctrls = sensor_module_g_ext_ctrls,
75 .s_ext_ctrls = sensor_module_s_ext_ctrls,
76 .ioctl = sensor_module_ioctl,
77 .log_status = sensor_module_log_status,
80 static const struct v4l2_subdev_video_ops video_ops = {
81 .s_routing = sensor_module_s_routing,
82 .s_stream = sensor_module_s_stream,
83 .s_parm = sensor_module_s_param
86 static const struct v4l2_subdev_pad_ops pad_ops = {
87 .set_fmt = sensor_module_s_format
90 static const struct v4l2_subdev_ops subdev_ops = {
96 static int sensor_module_2x5sp_power_setpin(struct device *dev,
97 struct exynos_platform_fimc_is_module *pdata)
99 struct device_node *dnode;
103 int gpio_avdd_en = 0;
104 int gpio_dvdd_en = 0;
105 int gpio_iovdd_en = 0;
106 struct fimc_is_core *core;
110 dnode = dev->of_node;
112 core = (struct fimc_is_core *)dev_get_drvdata(fimc_is_dev);
118 dev_info(dev, "%s E v4\n", __func__);
121 gpio_reset = of_get_named_gpio(dnode, "gpio_reset", 0);
122 if (gpio_is_valid(gpio_reset)) {
123 gpio_request_one(gpio_reset, GPIOF_OUT_INIT_LOW, "CAM_GPIO_OUTPUT_LOW");
124 gpio_free(gpio_reset);
126 dev_err(dev, "failed to get PIN_RESET\n");
130 gpio_avdd_en = of_get_named_gpio(dnode, "gpio_avdd_en", 0);
131 if (gpio_is_valid(gpio_avdd_en)) {
132 if (gpio_request_one(gpio_avdd_en, GPIOF_OUT_INIT_LOW, "CAM_AVDD_EN_LOW")) {
133 dev_err(dev, "%s: failed to gpio request avdd_en\n", __func__);
136 gpio_free(gpio_avdd_en);
138 dev_err(dev, "%s: failed to get avdd_en\n", __func__);
142 gpio_dvdd_en = of_get_named_gpio(dnode, "gpio_dvdd_en", 0);
143 if (gpio_is_valid(gpio_dvdd_en)) {
144 if (gpio_request_one(gpio_dvdd_en, GPIOF_OUT_INIT_LOW, "CAM_DVDD_EN_LOW")) {
145 dev_err(dev, "%s: failed to gpio request dvdd_en\n", __func__);
148 gpio_free(gpio_dvdd_en);
150 dev_err(dev, "%s: failed to get dvdd_en\n", __func__);
154 gpio_iovdd_en = of_get_named_gpio(dnode, "gpio_iovdd_en", 0);
155 if (gpio_is_valid(gpio_iovdd_en)) {
156 if (gpio_request_one(gpio_iovdd_en, GPIOF_OUT_INIT_LOW, "CAM_IOVDD_EN_LOW")) {
157 dev_err(dev, "%s: failed to gpio request iovdd_en\n", __func__);
160 gpio_free(gpio_iovdd_en);
162 dev_err(dev, "%s: failed to get iovdd_en\n", __func__);
166 gpio_mclk = of_get_named_gpio(dnode, "gpio_mclk", 0);
167 if (gpio_is_valid(gpio_mclk)) {
168 if (gpio_request_one(gpio_mclk, GPIOF_OUT_INIT_LOW, "CAM_MCLK_OUTPUT_LOW")) {
169 dev_err(dev, "%s: failed to gpio request mclk\n", __func__);
172 gpio_free(gpio_mclk);
174 dev_err(dev, "%s: failed to get mclk\n", __func__);
178 SET_PIN_INIT(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON);
179 SET_PIN_INIT(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF);
180 SET_PIN_INIT(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_ON);
181 SET_PIN_INIT(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_OFF);
182 SET_PIN_INIT(pdata, SENSOR_SCENARIO_FACTORY, GPIO_SCENARIO_ON);
183 SET_PIN_INIT(pdata, SENSOR_SCENARIO_FACTORY, GPIO_SCENARIO_OFF);
185 /* BACK CAEMRA - POWER ON */
186 SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, gpio_reset, "sen_rst low", PIN_OUTPUT, 0, 0);
188 SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, gpio_avdd_en, "avdd_en", PIN_OUTPUT, 1, 0);
189 /* TODO: need to check */
190 /* SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, gpio_none, "VLDO41_PMIC_FCAM_AVDD_2P8", PIN_REGULATOR, 1, 0); */
191 SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, gpio_dvdd_en, "dvdd_en", PIN_OUTPUT, 1, 0);
192 SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, gpio_iovdd_en, "iovdd_en", PIN_OUTPUT, 1, 1000);
193 SET_PIN_SHARED(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, SRT_ACQUIRE,
194 &core->shared_rsc_slock[SHARED_PIN0], &core->shared_rsc_count[SHARED_PIN0], 1);
196 SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, gpio_none, "pin", PIN_FUNCTION, 2, 0);
197 SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, gpio_reset, "sen_rst high", PIN_OUTPUT, 1, 7000);
198 SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, gpio_none, "retry delay", PIN_RETRY, 0, 2000);
200 /* BACK CAEMRA - POWER OFF */
201 SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, gpio_reset, "sen_rst", PIN_RESET, 0, 10);
202 SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, gpio_reset, "sen_rst input", PIN_INPUT, 0, 0);
204 SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, gpio_avdd_en, "avdd_en", PIN_OUTPUT, 0, 0);
205 /* TODO: need to check */
206 /* SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, gpio_none, "VLDO41_PMIC_FCAM_AVDD_2P8", PIN_REGULATOR, 0, 0); */
207 SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, gpio_dvdd_en, "dvdd_en", PIN_OUTPUT, 0, 0);
208 SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, gpio_iovdd_en, "iovdd_en", PIN_OUTPUT, 0, 0);
209 SET_PIN_SHARED(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, SRT_RELEASE,
210 &core->shared_rsc_slock[SHARED_PIN0], &core->shared_rsc_count[SHARED_PIN0], 0);
212 SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, gpio_none, "pin", PIN_FUNCTION, 0, 0);
213 SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, gpio_none, "pin", PIN_FUNCTION, 1, 0);
214 SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, gpio_none, "pin", PIN_FUNCTION, 0, 0);
216 /* REAR VISION CAEMRA - POWER ON */
217 SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_ON, gpio_reset, "sen_rst low", PIN_OUTPUT, 0, 0);
219 SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_ON, gpio_avdd_en, "avdd_en", PIN_OUTPUT, 1, 0);
220 SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_ON, gpio_dvdd_en, "dvdd_en", PIN_OUTPUT, 1, 0);
221 SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_ON, gpio_iovdd_en, "iovdd_en", PIN_OUTPUT, 1, 1000);
223 SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_ON, gpio_none, "pin", PIN_FUNCTION, 2, 0);
224 SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_ON, gpio_reset, "sen_rst high", PIN_OUTPUT, 1, 7000);
225 SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_ON, gpio_none, "retry delay", PIN_RETRY, 0, 2000);
228 /* REAR VISION CAEMRA - POWER OFF */
229 SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_OFF, gpio_reset, "sen_rst", PIN_RESET, 0, 10);
230 SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_OFF, gpio_reset, "sen_rst input", PIN_INPUT, 0, 0);
232 SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_OFF, gpio_avdd_en, "avdd_en", PIN_OUTPUT, 0, 0);
233 SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_OFF, gpio_dvdd_en, "dvdd_en", PIN_OUTPUT, 0, 0);
234 SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_OFF, gpio_iovdd_en, "iovdd_en", PIN_OUTPUT, 0, 0);
236 SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_OFF, gpio_none, "pin", PIN_FUNCTION, 0, 0);
237 SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_OFF, gpio_none, "pin", PIN_FUNCTION, 1, 0);
238 SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_OFF, gpio_none, "pin", PIN_FUNCTION, 0, 0);
240 /* REAR VISION CAEMRA - POWER ON */
241 SET_PIN(pdata, SENSOR_SCENARIO_FACTORY, GPIO_SCENARIO_ON, gpio_reset, "sen_rst low", PIN_OUTPUT, 0, 0);
243 SET_PIN(pdata, SENSOR_SCENARIO_FACTORY, GPIO_SCENARIO_ON, gpio_avdd_en, "avdd_en", PIN_OUTPUT, 1, 0);
244 SET_PIN(pdata, SENSOR_SCENARIO_FACTORY, GPIO_SCENARIO_ON, gpio_dvdd_en, "dvdd_en", PIN_OUTPUT, 1, 0);
245 SET_PIN(pdata, SENSOR_SCENARIO_FACTORY, GPIO_SCENARIO_ON, gpio_iovdd_en, "iovdd_en", PIN_OUTPUT, 1, 1000);
247 SET_PIN(pdata, SENSOR_SCENARIO_FACTORY, GPIO_SCENARIO_ON, gpio_none, "pin", PIN_FUNCTION, 2, 0);
248 SET_PIN(pdata, SENSOR_SCENARIO_FACTORY, GPIO_SCENARIO_ON, gpio_reset, "sen_rst high", PIN_OUTPUT, 1, 7000);
249 SET_PIN(pdata, SENSOR_SCENARIO_FACTORY, GPIO_SCENARIO_ON, gpio_none, "retry delay", PIN_RETRY, 0, 2000);
252 /* REAR VISION CAEMRA - POWER OFF */
253 SET_PIN(pdata, SENSOR_SCENARIO_FACTORY, GPIO_SCENARIO_OFF, gpio_reset, "sen_rst", PIN_RESET, 0, 10);
254 SET_PIN(pdata, SENSOR_SCENARIO_FACTORY, GPIO_SCENARIO_OFF, gpio_reset, "sen_rst input", PIN_INPUT, 0, 0);
256 SET_PIN(pdata, SENSOR_SCENARIO_FACTORY, GPIO_SCENARIO_OFF, gpio_avdd_en, "avdd_en", PIN_OUTPUT, 0, 0);
257 SET_PIN(pdata, SENSOR_SCENARIO_FACTORY, GPIO_SCENARIO_OFF, gpio_dvdd_en, "dvdd_en", PIN_OUTPUT, 0, 0);
258 SET_PIN(pdata, SENSOR_SCENARIO_FACTORY, GPIO_SCENARIO_OFF, gpio_iovdd_en, "iovdd_en", PIN_OUTPUT, 0, 0);
260 SET_PIN(pdata, SENSOR_SCENARIO_FACTORY, GPIO_SCENARIO_OFF, gpio_none, "pin", PIN_FUNCTION, 0, 0);
261 SET_PIN(pdata, SENSOR_SCENARIO_FACTORY, GPIO_SCENARIO_OFF, gpio_none, "pin", PIN_FUNCTION, 1, 0);
262 SET_PIN(pdata, SENSOR_SCENARIO_FACTORY, GPIO_SCENARIO_OFF, gpio_none, "pin", PIN_FUNCTION, 0, 0);
264 dev_info(dev, "%s X v4\n", __func__);
269 static int __init sensor_module_2x5sp_probe(struct platform_device *pdev)
272 struct fimc_is_core *core;
273 struct v4l2_subdev *subdev_module;
274 struct fimc_is_module_enum *module;
275 struct fimc_is_device_sensor *device;
276 struct sensor_open_extended *ext;
277 struct exynos_platform_fimc_is_module *pdata;
280 struct pinctrl_state *s;
282 BUG_ON(!fimc_is_dev);
284 core = (struct fimc_is_core *)dev_get_drvdata(fimc_is_dev);
286 probe_info("core device is not yet probed");
287 return -EPROBE_DEFER;
293 fimc_is_module_parse_dt(dev, sensor_module_2x5sp_power_setpin);
296 pdata = dev_get_platdata(dev);
297 device = &core->sensor[pdata->id];
299 subdev_module = kzalloc(sizeof(struct v4l2_subdev), GFP_KERNEL);
300 if (!subdev_module) {
301 err("subdev_module is NULL");
306 probe_info("%s pdta->id(%d), module_enum id = %d\n", __func__, pdata->id, atomic_read(&device->module_count));
307 module = &device->module_enum[atomic_read(&device->module_count)];
308 atomic_inc(&device->module_count);
309 clear_bit(FIMC_IS_MODULE_GPIO_ON, &module->state);
310 module->pdata = pdata;
312 module->sensor_id = SENSOR_NAME_S5K2X5SP;
313 module->subdev = subdev_module;
314 module->device = pdata->id;
315 module->client = NULL;
316 module->active_width = 5760;
317 module->active_height = 4320;
318 module->margin_left = 0;
319 module->margin_right = 0;
320 module->margin_top = 0;
321 module->margin_bottom = 0;
322 module->pixel_width = module->active_width;
323 module->pixel_height = module->active_height;
324 module->max_framerate = 240;
325 module->position = pdata->position;
326 module->bitwidth = 10;
327 module->sensor_maker = "SLSI";
328 module->sensor_name = "S5K2X5SP";
329 module->setfile_name = "setfile_2x5sp.bin";
330 module->cfgs = ARRAY_SIZE(config_module_2x5sp);
331 module->cfg = config_module_2x5sp;
334 for (ch = 1; ch < CSI_VIRTUAL_CH_MAX; ch++)
335 module->vc_buffer_offset[ch] = pdata->vc_buffer_offset[ch];
337 for (t = VC_BUF_DATA_TYPE_SENSOR_STAT1; t < VC_BUF_DATA_TYPE_MAX; t++) {
338 module->vc_extra_info[t].stat_type = VC_STAT_TYPE_INVALID;
339 module->vc_extra_info[t].sensor_mode = VC_SENSOR_MODE_INVALID;
340 module->vc_extra_info[t].max_width = 0;
341 module->vc_extra_info[t].max_height = 0;
342 module->vc_extra_info[t].max_element = 0;
345 case VC_BUF_DATA_TYPE_SENSOR_STAT2:
346 module->vc_extra_info[t].stat_type
347 = VC_STAT_TYPE_TAIL_FOR_3HDR_LSI;
349 module->vc_extra_info[t].sensor_mode = VC_SENSOR_MODE_3HDR_LSI;
350 module->vc_extra_info[t].max_width = 2880;
351 module->vc_extra_info[t].max_height = 34;
352 module->vc_extra_info[t].max_element = 1;
358 module->private_data = kzalloc(sizeof(struct fimc_is_device_sensor_peri), GFP_KERNEL);
359 if (!module->private_data) {
360 err("fimc_is_device_sensor_peri is NULL");
364 fimc_is_sensor_peri_probe((struct fimc_is_device_sensor_peri *)module->private_data);
365 PERI_SET_MODULE(module);
369 ext->sensor_con.product_name = module->sensor_id;
370 ext->sensor_con.peri_type = SE_I2C;
371 ext->sensor_con.peri_setting.i2c.channel = pdata->sensor_i2c_ch;
372 ext->sensor_con.peri_setting.i2c.slave_address = pdata->sensor_i2c_addr;
373 ext->sensor_con.peri_setting.i2c.speed = 400000;
375 ext->actuator_con.product_name = ACTUATOR_NAME_NOTHING;
376 ext->flash_con.product_name = FLADRV_NAME_NOTHING;
377 ext->from_con.product_name = FROMDRV_NAME_NOTHING;
378 ext->preprocessor_con.product_name = PREPROCESSOR_NAME_NOTHING;
379 ext->ois_con.product_name = OIS_NAME_NOTHING;
381 if (pdata->af_product_name != ACTUATOR_NAME_NOTHING) {
382 ext->actuator_con.product_name = pdata->af_product_name;
383 ext->actuator_con.peri_type = SE_I2C;
384 ext->actuator_con.peri_setting.i2c.channel = pdata->af_i2c_ch;
385 ext->actuator_con.peri_setting.i2c.slave_address = pdata->af_i2c_addr;
386 ext->actuator_con.peri_setting.i2c.speed = 400000;
389 if (pdata->flash_product_name != FLADRV_NAME_NOTHING) {
390 ext->flash_con.product_name = pdata->flash_product_name;
391 ext->flash_con.peri_type = SE_GPIO;
392 ext->flash_con.peri_setting.gpio.first_gpio_port_no = pdata->flash_first_gpio;
393 ext->flash_con.peri_setting.gpio.second_gpio_port_no = pdata->flash_second_gpio;
396 ext->from_con.product_name = FROMDRV_NAME_NOTHING;
398 if (pdata->preprocessor_product_name != PREPROCESSOR_NAME_NOTHING) {
399 ext->preprocessor_con.product_name = pdata->preprocessor_product_name;
400 ext->preprocessor_con.peri_info0.valid = true;
401 ext->preprocessor_con.peri_info0.peri_type = SE_SPI;
402 ext->preprocessor_con.peri_info0.peri_setting.spi.channel = pdata->preprocessor_spi_channel;
403 ext->preprocessor_con.peri_info1.valid = true;
404 ext->preprocessor_con.peri_info1.peri_type = SE_I2C;
405 ext->preprocessor_con.peri_info1.peri_setting.i2c.channel = pdata->preprocessor_i2c_ch;
406 ext->preprocessor_con.peri_info1.peri_setting.i2c.slave_address = pdata->preprocessor_i2c_addr;
407 ext->preprocessor_con.peri_info1.peri_setting.i2c.speed = 400000;
408 ext->preprocessor_con.peri_info2.valid = true;
409 ext->preprocessor_con.peri_info2.peri_type = SE_DMA;
410 if (pdata->preprocessor_dma_channel == DMA_CH_NOT_DEFINED)
411 ext->preprocessor_con.peri_info2.peri_setting.dma.channel = FLITE_ID_D;
413 ext->preprocessor_con.peri_info2.peri_setting.dma.channel = pdata->preprocessor_dma_channel;
416 if (pdata->ois_product_name != OIS_NAME_NOTHING) {
417 ext->ois_con.product_name = pdata->ois_product_name;
418 ext->ois_con.peri_type = SE_I2C;
419 ext->ois_con.peri_setting.i2c.channel = pdata->ois_i2c_ch;
420 ext->ois_con.peri_setting.i2c.slave_address = pdata->ois_i2c_addr;
421 ext->ois_con.peri_setting.i2c.speed = 400000;
423 ext->ois_con.product_name = pdata->ois_product_name;
424 ext->ois_con.peri_type = SE_NULL;
427 v4l2_subdev_init(subdev_module, &subdev_ops);
429 v4l2_set_subdevdata(subdev_module, module);
430 v4l2_set_subdev_hostdata(subdev_module, device);
431 snprintf(subdev_module->name, V4L2_SUBDEV_NAME_SIZE, "sensor-subdev.%d", module->sensor_id);
433 s = pinctrl_lookup_state(pdata->pinctrl, "release");
435 if (pinctrl_select_state(pdata->pinctrl, s) < 0) {
436 probe_err("pinctrl_select_state is fail\n");
440 probe_info("%s done\n", __func__);
446 static const struct of_device_id exynos_fimc_is_sensor_module_2x5sp_match[] = {
448 .compatible = "samsung,sensor-module-2x5sp",
452 MODULE_DEVICE_TABLE(of, exynos_fimc_is_sensor_module_2x5sp_match);
454 static struct platform_driver sensor_module_2x5sp_driver = {
456 .name = "FIMC-IS-SENSOR-MODULE-2X5SP",
457 .owner = THIS_MODULE,
458 .of_match_table = exynos_fimc_is_sensor_module_2x5sp_match,
462 static int __init fimc_is_sensor_module_2x5sp_init(void)
466 ret = platform_driver_probe(&sensor_module_2x5sp_driver,
467 sensor_module_2x5sp_probe);
469 err("failed to probe %s driver: %d\n",
470 sensor_module_2x5sp_driver.driver.name, ret);
474 late_initcall(fimc_is_sensor_module_2x5sp_init);