2 * Driver for SiliconFile NOON010PC30 CIF (1/11") Image Sensor with ISP
4 * Copyright (C) 2010 Samsung Electronics
5 * Contact: Sylwester Nawrocki, <s.nawrocki@samsung.com>
7 * Initial register configuration based on a driver authored by
8 * HeungJun Kim <riverful.kim@samsung.com>.
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later vergsion.
16 #include <linux/delay.h>
17 #include <linux/gpio.h>
18 #include <linux/i2c.h>
19 #include <linux/slab.h>
20 #include <linux/regulator/consumer.h>
21 #include <media/noon010pc30.h>
22 #include <media/v4l2-chip-ident.h>
23 #include <linux/videodev2.h>
24 #include <linux/module.h>
25 #include <media/v4l2-ctrls.h>
26 #include <media/v4l2-device.h>
27 #include <media/v4l2-mediabus.h>
28 #include <media/v4l2-subdev.h>
31 module_param(debug
, int, 0644);
32 MODULE_PARM_DESC(debug
, "Enable module debug trace. Set to 1 to enable.");
34 #define MODULE_NAME "NOON010PC30"
37 * Register offsets within a page
38 * b15..b8 - page id, b7..b0 - register address
40 #define POWER_CTRL_REG 0x0001
41 #define PAGEMODE_REG 0x03
42 #define DEVICE_ID_REG 0x0004
43 #define NOON010PC30_ID 0x86
44 #define VDO_CTL_REG(n) (0x0010 + (n))
45 #define SYNC_CTL_REG 0x0012
46 /* Window size and position */
47 #define WIN_ROWH_REG 0x0013
48 #define WIN_ROWL_REG 0x0014
49 #define WIN_COLH_REG 0x0015
50 #define WIN_COLL_REG 0x0016
51 #define WIN_HEIGHTH_REG 0x0017
52 #define WIN_HEIGHTL_REG 0x0018
53 #define WIN_WIDTHH_REG 0x0019
54 #define WIN_WIDTHL_REG 0x001A
55 #define HBLANKH_REG 0x001B
56 #define HBLANKL_REG 0x001C
57 #define VSYNCH_REG 0x001D
58 #define VSYNCL_REG 0x001E
60 #define VS_CTL_REG(n) (0x00A1 + (n))
62 #define ISP_CTL_REG(n) (0x0110 + (n))
63 #define YOFS_REG 0x0119
64 #define DARK_YOFS_REG 0x011A
65 #define SAT_CTL_REG 0x0120
66 #define BSAT_REG 0x0121
67 #define RSAT_REG 0x0122
68 /* Color correction */
69 #define CMC_CTL_REG 0x0130
70 #define CMC_OFSGH_REG 0x0133
71 #define CMC_OFSGL_REG 0x0135
72 #define CMC_SIGN_REG 0x0136
73 #define CMC_GOFS_REG 0x0137
74 #define CMC_COEF_REG(n) (0x0138 + (n))
75 #define CMC_OFS_REG(n) (0x0141 + (n))
76 /* Gamma correction */
77 #define GMA_CTL_REG 0x0160
78 #define GMA_COEF_REG(n) (0x0161 + (n))
80 #define LENS_CTRL_REG 0x01D0
81 #define LENS_XCEN_REG 0x01D1
82 #define LENS_YCEN_REG 0x01D2
83 #define LENS_RC_REG 0x01D3
84 #define LENS_GC_REG 0x01D4
85 #define LENS_BC_REG 0x01D5
86 #define L_AGON_REG 0x01D6
87 #define L_AGOFF_REG 0x01D7
88 /* Page 3 - Auto Exposure */
89 #define AE_CTL_REG(n) (0x0310 + (n))
90 #define AE_CTL9_REG 0x032C
91 #define AE_CTL10_REG 0x032D
92 #define AE_YLVL_REG 0x031C
93 #define AE_YTH_REG(n) (0x031D + (n))
94 #define AE_WGT_REG 0x0326
95 #define EXP_TIMEH_REG 0x0333
96 #define EXP_TIMEM_REG 0x0334
97 #define EXP_TIMEL_REG 0x0335
98 #define EXP_MMINH_REG 0x0336
99 #define EXP_MMINL_REG 0x0337
100 #define EXP_MMAXH_REG 0x0338
101 #define EXP_MMAXM_REG 0x0339
102 #define EXP_MMAXL_REG 0x033A
103 /* Page 4 - Auto White Balance */
104 #define AWB_CTL_REG(n) (0x0410 + (n))
105 #define AWB_ENABE 0x80
106 #define AWB_WGHT_REG 0x0419
107 #define BGAIN_PAR_REG(n) (0x044F + (n))
108 /* Manual white balance, when AWB_CTL2[0]=1 */
109 #define MWB_RGAIN_REG 0x0466
110 #define MWB_BGAIN_REG 0x0467
112 /* The token to mark an array end */
113 #define REG_TERM 0xFFFF
115 struct noon010_format
{
116 enum v4l2_mbus_pixelcode code
;
117 enum v4l2_colorspace colorspace
;
121 struct noon010_frmsize
{
127 static const char * const noon010_supply_name
[] = {
128 "vdd_core", "vddio", "vdda"
131 #define NOON010_NUM_SUPPLIES ARRAY_SIZE(noon010_supply_name)
133 struct noon010_info
{
134 struct v4l2_subdev sd
;
135 struct v4l2_ctrl_handler hdl
;
136 const struct noon010pc30_platform_data
*pdata
;
137 const struct noon010_format
*curr_fmt
;
138 const struct noon010_frmsize
*curr_win
;
139 unsigned int hflip
:1;
140 unsigned int vflip
:1;
141 unsigned int power
:1;
143 struct regulator_bulk_data supply
[NOON010_NUM_SUPPLIES
];
153 /* Supported resolutions. */
154 static const struct noon010_frmsize noon010_sizes
[] = {
170 /* Supported pixel formats. */
171 static const struct noon010_format noon010_formats
[] = {
173 .code
= V4L2_MBUS_FMT_YUYV8_2X8
,
174 .colorspace
= V4L2_COLORSPACE_JPEG
,
177 .code
= V4L2_MBUS_FMT_YVYU8_2X8
,
178 .colorspace
= V4L2_COLORSPACE_JPEG
,
181 .code
= V4L2_MBUS_FMT_VYUY8_2X8
,
182 .colorspace
= V4L2_COLORSPACE_JPEG
,
185 .code
= V4L2_MBUS_FMT_UYVY8_2X8
,
186 .colorspace
= V4L2_COLORSPACE_JPEG
,
189 .code
= V4L2_MBUS_FMT_RGB565_2X8_BE
,
190 .colorspace
= V4L2_COLORSPACE_JPEG
,
195 static const struct i2c_regval noon010_base_regs
[] = {
196 { WIN_COLL_REG
, 0x06 }, { HBLANKL_REG
, 0x7C },
197 /* Color corection and saturation */
198 { ISP_CTL_REG(0), 0x30 }, { ISP_CTL_REG(2), 0x30 },
199 { YOFS_REG
, 0x80 }, { DARK_YOFS_REG
, 0x04 },
200 { SAT_CTL_REG
, 0x1F }, { BSAT_REG
, 0x90 },
201 { CMC_CTL_REG
, 0x0F }, { CMC_OFSGH_REG
, 0x3C },
202 { CMC_OFSGL_REG
, 0x2C }, { CMC_SIGN_REG
, 0x3F },
203 { CMC_COEF_REG(0), 0x79 }, { CMC_OFS_REG(0), 0x00 },
204 { CMC_COEF_REG(1), 0x39 }, { CMC_OFS_REG(1), 0x00 },
205 { CMC_COEF_REG(2), 0x00 }, { CMC_OFS_REG(2), 0x00 },
206 { CMC_COEF_REG(3), 0x11 }, { CMC_OFS_REG(3), 0x8B },
207 { CMC_COEF_REG(4), 0x65 }, { CMC_OFS_REG(4), 0x07 },
208 { CMC_COEF_REG(5), 0x14 }, { CMC_OFS_REG(5), 0x04 },
209 { CMC_COEF_REG(6), 0x01 }, { CMC_OFS_REG(6), 0x9C },
210 { CMC_COEF_REG(7), 0x33 }, { CMC_OFS_REG(7), 0x89 },
211 { CMC_COEF_REG(8), 0x74 }, { CMC_OFS_REG(8), 0x25 },
212 /* Automatic white balance */
213 { AWB_CTL_REG(0), 0x78 }, { AWB_CTL_REG(1), 0x2E },
214 { AWB_CTL_REG(2), 0x20 }, { AWB_CTL_REG(3), 0x85 },
216 { AE_CTL_REG(0), 0xDC }, { AE_CTL_REG(1), 0x81 },
217 { AE_CTL_REG(2), 0x30 }, { AE_CTL_REG(3), 0xA5 },
218 { AE_CTL_REG(4), 0x40 }, { AE_CTL_REG(5), 0x51 },
219 { AE_CTL_REG(6), 0x33 }, { AE_CTL_REG(7), 0x7E },
220 { AE_CTL9_REG
, 0x00 }, { AE_CTL10_REG
, 0x02 },
221 { AE_YLVL_REG
, 0x44 }, { AE_YTH_REG(0), 0x34 },
222 { AE_YTH_REG(1), 0x30 }, { AE_WGT_REG
, 0xD5 },
223 /* Lens shading compensation */
224 { LENS_CTRL_REG
, 0x01 }, { LENS_XCEN_REG
, 0x80 },
225 { LENS_YCEN_REG
, 0x70 }, { LENS_RC_REG
, 0x53 },
226 { LENS_GC_REG
, 0x40 }, { LENS_BC_REG
, 0x3E },
230 static inline struct noon010_info
*to_noon010(struct v4l2_subdev
*sd
)
232 return container_of(sd
, struct noon010_info
, sd
);
235 static inline struct v4l2_subdev
*to_sd(struct v4l2_ctrl
*ctrl
)
237 return &container_of(ctrl
->handler
, struct noon010_info
, hdl
)->sd
;
240 static inline int set_i2c_page(struct noon010_info
*info
,
241 struct i2c_client
*client
, unsigned int reg
)
243 u32 page
= reg
>> 8 & 0xFF;
246 if (info
->i2c_reg_page
!= page
&& (reg
& 0xFF) != 0x03) {
247 ret
= i2c_smbus_write_byte_data(client
, PAGEMODE_REG
, page
);
249 info
->i2c_reg_page
= page
;
254 static int cam_i2c_read(struct v4l2_subdev
*sd
, u32 reg_addr
)
256 struct i2c_client
*client
= v4l2_get_subdevdata(sd
);
257 struct noon010_info
*info
= to_noon010(sd
);
258 int ret
= set_i2c_page(info
, client
, reg_addr
);
262 return i2c_smbus_read_byte_data(client
, reg_addr
& 0xFF);
265 static int cam_i2c_write(struct v4l2_subdev
*sd
, u32 reg_addr
, u32 val
)
267 struct i2c_client
*client
= v4l2_get_subdevdata(sd
);
268 struct noon010_info
*info
= to_noon010(sd
);
269 int ret
= set_i2c_page(info
, client
, reg_addr
);
273 return i2c_smbus_write_byte_data(client
, reg_addr
& 0xFF, val
);
276 static inline int noon010_bulk_write_reg(struct v4l2_subdev
*sd
,
277 const struct i2c_regval
*msg
)
279 while (msg
->addr
!= REG_TERM
) {
280 int ret
= cam_i2c_write(sd
, msg
->addr
, msg
->val
);
289 /* Device reset and sleep mode control */
290 static int noon010_power_ctrl(struct v4l2_subdev
*sd
, bool reset
, bool sleep
)
292 struct noon010_info
*info
= to_noon010(sd
);
293 u8 reg
= sleep
? 0xF1 : 0xF0;
297 ret
= cam_i2c_write(sd
, POWER_CTRL_REG
, reg
| 0x02);
299 ret
= cam_i2c_write(sd
, POWER_CTRL_REG
, reg
);
301 info
->i2c_reg_page
= -1;
306 /* Automatic white balance control */
307 static int noon010_enable_autowhitebalance(struct v4l2_subdev
*sd
, int on
)
311 ret
= cam_i2c_write(sd
, AWB_CTL_REG(1), on
? 0x2E : 0x2F);
313 ret
= cam_i2c_write(sd
, AWB_CTL_REG(0), on
? 0xFB : 0x7B);
317 static int noon010_set_flip(struct v4l2_subdev
*sd
, int hflip
, int vflip
)
319 struct noon010_info
*info
= to_noon010(sd
);
322 reg
= cam_i2c_read(sd
, VDO_CTL_REG(1));
332 ret
= cam_i2c_write(sd
, VDO_CTL_REG(1), reg
| 0x80);
340 /* Configure resolution and color format */
341 static int noon010_set_params(struct v4l2_subdev
*sd
)
343 struct noon010_info
*info
= to_noon010(sd
);
349 ret
= cam_i2c_write(sd
, VDO_CTL_REG(0), info
->curr_win
->vid_ctl1
);
351 if (!ret
&& info
->curr_fmt
)
352 ret
= cam_i2c_write(sd
, ISP_CTL_REG(0),
353 info
->curr_fmt
->ispctl1_reg
);
357 /* Find nearest matching image pixel size. */
358 static int noon010_try_frame_size(struct v4l2_mbus_framefmt
*mf
)
360 unsigned int min_err
= ~0;
361 int i
= ARRAY_SIZE(noon010_sizes
);
362 const struct noon010_frmsize
*fsize
= &noon010_sizes
[0],
366 int err
= abs(fsize
->width
- mf
->width
)
367 + abs(fsize
->height
- mf
->height
);
376 mf
->width
= match
->width
;
377 mf
->height
= match
->height
;
383 static int power_enable(struct noon010_info
*info
)
388 v4l2_info(&info
->sd
, "%s: sensor is already on\n", __func__
);
392 if (gpio_is_valid(info
->gpio_nstby
))
393 gpio_set_value(info
->gpio_nstby
, 0);
395 if (gpio_is_valid(info
->gpio_nreset
))
396 gpio_set_value(info
->gpio_nreset
, 0);
398 ret
= regulator_bulk_enable(NOON010_NUM_SUPPLIES
, info
->supply
);
402 if (gpio_is_valid(info
->gpio_nreset
)) {
404 gpio_set_value(info
->gpio_nreset
, 1);
406 if (gpio_is_valid(info
->gpio_nstby
)) {
408 gpio_set_value(info
->gpio_nstby
, 1);
410 if (gpio_is_valid(info
->gpio_nreset
)) {
412 gpio_set_value(info
->gpio_nreset
, 0);
414 gpio_set_value(info
->gpio_nreset
, 1);
419 v4l2_dbg(1, debug
, &info
->sd
, "%s: sensor is on\n", __func__
);
423 static int power_disable(struct noon010_info
*info
)
428 v4l2_info(&info
->sd
, "%s: sensor is already off\n", __func__
);
432 ret
= regulator_bulk_disable(NOON010_NUM_SUPPLIES
, info
->supply
);
436 if (gpio_is_valid(info
->gpio_nstby
))
437 gpio_set_value(info
->gpio_nstby
, 0);
439 if (gpio_is_valid(info
->gpio_nreset
))
440 gpio_set_value(info
->gpio_nreset
, 0);
444 v4l2_dbg(1, debug
, &info
->sd
, "%s: sensor is off\n", __func__
);
449 static int noon010_s_ctrl(struct v4l2_ctrl
*ctrl
)
451 struct v4l2_subdev
*sd
= to_sd(ctrl
);
453 v4l2_dbg(1, debug
, sd
, "%s: ctrl_id: %d, value: %d\n",
454 __func__
, ctrl
->id
, ctrl
->val
);
457 case V4L2_CID_AUTO_WHITE_BALANCE
:
458 return noon010_enable_autowhitebalance(sd
, ctrl
->val
);
459 case V4L2_CID_BLUE_BALANCE
:
460 return cam_i2c_write(sd
, MWB_BGAIN_REG
, ctrl
->val
);
461 case V4L2_CID_RED_BALANCE
:
462 return cam_i2c_write(sd
, MWB_RGAIN_REG
, ctrl
->val
);
468 static int noon010_enum_fmt(struct v4l2_subdev
*sd
, unsigned int index
,
469 enum v4l2_mbus_pixelcode
*code
)
471 if (!code
|| index
>= ARRAY_SIZE(noon010_formats
))
474 *code
= noon010_formats
[index
].code
;
478 static int noon010_g_fmt(struct v4l2_subdev
*sd
, struct v4l2_mbus_framefmt
*mf
)
480 struct noon010_info
*info
= to_noon010(sd
);
486 if (!info
->curr_win
|| !info
->curr_fmt
) {
487 ret
= noon010_set_params(sd
);
492 mf
->width
= info
->curr_win
->width
;
493 mf
->height
= info
->curr_win
->height
;
494 mf
->code
= info
->curr_fmt
->code
;
495 mf
->colorspace
= info
->curr_fmt
->colorspace
;
496 mf
->field
= V4L2_FIELD_NONE
;
501 /* Return nearest media bus frame format. */
502 static const struct noon010_format
*try_fmt(struct v4l2_subdev
*sd
,
503 struct v4l2_mbus_framefmt
*mf
)
505 int i
= ARRAY_SIZE(noon010_formats
);
507 noon010_try_frame_size(mf
);
510 if (mf
->code
== noon010_formats
[i
].code
)
513 mf
->code
= noon010_formats
[i
].code
;
515 return &noon010_formats
[i
];
518 static int noon010_try_fmt(struct v4l2_subdev
*sd
,
519 struct v4l2_mbus_framefmt
*mf
)
528 static int noon010_s_fmt(struct v4l2_subdev
*sd
,
529 struct v4l2_mbus_framefmt
*mf
)
531 struct noon010_info
*info
= to_noon010(sd
);
536 info
->curr_fmt
= try_fmt(sd
, mf
);
538 return noon010_set_params(sd
);
541 static int noon010_base_config(struct v4l2_subdev
*sd
)
543 struct noon010_info
*info
= to_noon010(sd
);
546 ret
= noon010_bulk_write_reg(sd
, noon010_base_regs
);
548 info
->curr_fmt
= &noon010_formats
[0];
549 info
->curr_win
= &noon010_sizes
[0];
550 ret
= noon010_set_params(sd
);
553 ret
= noon010_set_flip(sd
, 1, 0);
555 ret
= noon010_power_ctrl(sd
, false, false);
557 /* sync the handler and the registers state */
558 v4l2_ctrl_handler_setup(&to_noon010(sd
)->hdl
);
562 static int noon010_s_power(struct v4l2_subdev
*sd
, int on
)
564 struct noon010_info
*info
= to_noon010(sd
);
565 const struct noon010pc30_platform_data
*pdata
= info
->pdata
;
568 if (WARN(pdata
== NULL
, "No platform data!\n"))
572 ret
= power_enable(info
);
575 ret
= noon010_base_config(sd
);
577 noon010_power_ctrl(sd
, false, true);
578 ret
= power_disable(info
);
579 info
->curr_win
= NULL
;
580 info
->curr_fmt
= NULL
;
586 static int noon010_g_chip_ident(struct v4l2_subdev
*sd
,
587 struct v4l2_dbg_chip_ident
*chip
)
589 struct i2c_client
*client
= v4l2_get_subdevdata(sd
);
591 return v4l2_chip_ident_i2c_client(client
, chip
,
592 V4L2_IDENT_NOON010PC30
, 0);
595 static int noon010_log_status(struct v4l2_subdev
*sd
)
597 struct noon010_info
*info
= to_noon010(sd
);
599 v4l2_ctrl_handler_log_status(&info
->hdl
, sd
->name
);
603 static const struct v4l2_ctrl_ops noon010_ctrl_ops
= {
604 .s_ctrl
= noon010_s_ctrl
,
607 static const struct v4l2_subdev_core_ops noon010_core_ops
= {
608 .g_chip_ident
= noon010_g_chip_ident
,
609 .s_power
= noon010_s_power
,
610 .g_ctrl
= v4l2_subdev_g_ctrl
,
611 .s_ctrl
= v4l2_subdev_s_ctrl
,
612 .queryctrl
= v4l2_subdev_queryctrl
,
613 .querymenu
= v4l2_subdev_querymenu
,
614 .g_ext_ctrls
= v4l2_subdev_g_ext_ctrls
,
615 .try_ext_ctrls
= v4l2_subdev_try_ext_ctrls
,
616 .s_ext_ctrls
= v4l2_subdev_s_ext_ctrls
,
617 .log_status
= noon010_log_status
,
620 static const struct v4l2_subdev_video_ops noon010_video_ops
= {
621 .g_mbus_fmt
= noon010_g_fmt
,
622 .s_mbus_fmt
= noon010_s_fmt
,
623 .try_mbus_fmt
= noon010_try_fmt
,
624 .enum_mbus_fmt
= noon010_enum_fmt
,
627 static const struct v4l2_subdev_ops noon010_ops
= {
628 .core
= &noon010_core_ops
,
629 .video
= &noon010_video_ops
,
632 /* Return 0 if NOON010PC30L sensor type was detected or -ENODEV otherwise. */
633 static int noon010_detect(struct i2c_client
*client
, struct noon010_info
*info
)
637 ret
= power_enable(info
);
641 ret
= i2c_smbus_read_byte_data(client
, DEVICE_ID_REG
);
643 dev_err(&client
->dev
, "I2C read failed: 0x%X\n", ret
);
647 return ret
== NOON010PC30_ID
? 0 : -ENODEV
;
650 static int noon010_probe(struct i2c_client
*client
,
651 const struct i2c_device_id
*id
)
653 struct noon010_info
*info
;
654 struct v4l2_subdev
*sd
;
655 const struct noon010pc30_platform_data
*pdata
656 = client
->dev
.platform_data
;
661 dev_err(&client
->dev
, "No platform data!\n");
665 info
= kzalloc(sizeof(*info
), GFP_KERNEL
);
670 strlcpy(sd
->name
, MODULE_NAME
, sizeof(sd
->name
));
671 v4l2_i2c_subdev_init(sd
, client
, &noon010_ops
);
673 v4l2_ctrl_handler_init(&info
->hdl
, 3);
675 v4l2_ctrl_new_std(&info
->hdl
, &noon010_ctrl_ops
,
676 V4L2_CID_AUTO_WHITE_BALANCE
, 0, 1, 1, 1);
677 v4l2_ctrl_new_std(&info
->hdl
, &noon010_ctrl_ops
,
678 V4L2_CID_RED_BALANCE
, 0, 127, 1, 64);
679 v4l2_ctrl_new_std(&info
->hdl
, &noon010_ctrl_ops
,
680 V4L2_CID_BLUE_BALANCE
, 0, 127, 1, 64);
682 sd
->ctrl_handler
= &info
->hdl
;
684 ret
= info
->hdl
.error
;
688 info
->pdata
= client
->dev
.platform_data
;
689 info
->i2c_reg_page
= -1;
690 info
->gpio_nreset
= -EINVAL
;
691 info
->gpio_nstby
= -EINVAL
;
693 if (gpio_is_valid(pdata
->gpio_nreset
)) {
694 ret
= gpio_request(pdata
->gpio_nreset
, "NOON010PC30 NRST");
696 dev_err(&client
->dev
, "GPIO request error: %d\n", ret
);
699 info
->gpio_nreset
= pdata
->gpio_nreset
;
700 gpio_direction_output(info
->gpio_nreset
, 0);
701 gpio_export(info
->gpio_nreset
, 0);
704 if (gpio_is_valid(pdata
->gpio_nstby
)) {
705 ret
= gpio_request(pdata
->gpio_nstby
, "NOON010PC30 NSTBY");
707 dev_err(&client
->dev
, "GPIO request error: %d\n", ret
);
710 info
->gpio_nstby
= pdata
->gpio_nstby
;
711 gpio_direction_output(info
->gpio_nstby
, 0);
712 gpio_export(info
->gpio_nstby
, 0);
715 for (i
= 0; i
< NOON010_NUM_SUPPLIES
; i
++)
716 info
->supply
[i
].supply
= noon010_supply_name
[i
];
718 ret
= regulator_bulk_get(&client
->dev
, NOON010_NUM_SUPPLIES
,
723 ret
= noon010_detect(client
, info
);
727 /* the sensor detection failed */
728 regulator_bulk_free(NOON010_NUM_SUPPLIES
, info
->supply
);
730 if (gpio_is_valid(info
->gpio_nstby
))
731 gpio_free(info
->gpio_nstby
);
733 if (gpio_is_valid(info
->gpio_nreset
))
734 gpio_free(info
->gpio_nreset
);
736 v4l2_ctrl_handler_free(&info
->hdl
);
737 v4l2_device_unregister_subdev(sd
);
742 static int noon010_remove(struct i2c_client
*client
)
744 struct v4l2_subdev
*sd
= i2c_get_clientdata(client
);
745 struct noon010_info
*info
= to_noon010(sd
);
747 v4l2_device_unregister_subdev(sd
);
748 v4l2_ctrl_handler_free(&info
->hdl
);
750 regulator_bulk_free(NOON010_NUM_SUPPLIES
, info
->supply
);
752 if (gpio_is_valid(info
->gpio_nreset
))
753 gpio_free(info
->gpio_nreset
);
755 if (gpio_is_valid(info
->gpio_nstby
))
756 gpio_free(info
->gpio_nstby
);
762 static const struct i2c_device_id noon010_id
[] = {
766 MODULE_DEVICE_TABLE(i2c
, noon010_id
);
769 static struct i2c_driver noon010_i2c_driver
= {
773 .probe
= noon010_probe
,
774 .remove
= noon010_remove
,
775 .id_table
= noon010_id
,
778 static int __init
noon010_init(void)
780 return i2c_add_driver(&noon010_i2c_driver
);
783 static void __exit
noon010_exit(void)
785 i2c_del_driver(&noon010_i2c_driver
);
788 module_init(noon010_init
);
789 module_exit(noon010_exit
);
791 MODULE_DESCRIPTION("Siliconfile NOON010PC30 camera driver");
792 MODULE_AUTHOR("Sylwester Nawrocki <s.nawrocki@samsung.com>");
793 MODULE_LICENSE("GPL");