V4L/DVB (11610): soc-camera: simplify register access routines in multiple sensor...
[linux-2.6/mini2440.git] / drivers / media / video / mt9m001.c
blob459c04cbf69dd0fb9b23efeb869cda79d7135e15
1 /*
2 * Driver for MT9M001 CMOS Image Sensor from Micron
4 * Copyright (C) 2008, Guennadi Liakhovetski <kernel@pengutronix.de>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
11 #include <linux/videodev2.h>
12 #include <linux/slab.h>
13 #include <linux/i2c.h>
14 #include <linux/log2.h>
16 #include <media/v4l2-common.h>
17 #include <media/v4l2-chip-ident.h>
18 #include <media/soc_camera.h>
20 /* mt9m001 i2c address 0x5d
21 * The platform has to define i2c_board_info
22 * and call i2c_register_board_info() */
24 /* mt9m001 selected register addresses */
25 #define MT9M001_CHIP_VERSION 0x00
26 #define MT9M001_ROW_START 0x01
27 #define MT9M001_COLUMN_START 0x02
28 #define MT9M001_WINDOW_HEIGHT 0x03
29 #define MT9M001_WINDOW_WIDTH 0x04
30 #define MT9M001_HORIZONTAL_BLANKING 0x05
31 #define MT9M001_VERTICAL_BLANKING 0x06
32 #define MT9M001_OUTPUT_CONTROL 0x07
33 #define MT9M001_SHUTTER_WIDTH 0x09
34 #define MT9M001_FRAME_RESTART 0x0b
35 #define MT9M001_SHUTTER_DELAY 0x0c
36 #define MT9M001_RESET 0x0d
37 #define MT9M001_READ_OPTIONS1 0x1e
38 #define MT9M001_READ_OPTIONS2 0x20
39 #define MT9M001_GLOBAL_GAIN 0x35
40 #define MT9M001_CHIP_ENABLE 0xF1
42 static const struct soc_camera_data_format mt9m001_colour_formats[] = {
43 /* Order important: first natively supported,
44 * second supported with a GPIO extender */
46 .name = "Bayer (sRGB) 10 bit",
47 .depth = 10,
48 .fourcc = V4L2_PIX_FMT_SBGGR16,
49 .colorspace = V4L2_COLORSPACE_SRGB,
50 }, {
51 .name = "Bayer (sRGB) 8 bit",
52 .depth = 8,
53 .fourcc = V4L2_PIX_FMT_SBGGR8,
54 .colorspace = V4L2_COLORSPACE_SRGB,
58 static const struct soc_camera_data_format mt9m001_monochrome_formats[] = {
59 /* Order important - see above */
61 .name = "Monochrome 10 bit",
62 .depth = 10,
63 .fourcc = V4L2_PIX_FMT_Y16,
64 }, {
65 .name = "Monochrome 8 bit",
66 .depth = 8,
67 .fourcc = V4L2_PIX_FMT_GREY,
71 struct mt9m001 {
72 struct i2c_client *client;
73 struct soc_camera_device icd;
74 int model; /* V4L2_IDENT_MT9M001* codes from v4l2-chip-ident.h */
75 unsigned char autoexposure;
78 static int reg_read(struct i2c_client *client, const u8 reg)
80 s32 data = i2c_smbus_read_word_data(client, reg);
81 return data < 0 ? data : swab16(data);
84 static int reg_write(struct i2c_client *client, const u8 reg,
85 const u16 data)
87 return i2c_smbus_write_word_data(client, reg, swab16(data));
90 static int reg_set(struct i2c_client *client, const u8 reg,
91 const u16 data)
93 int ret;
95 ret = reg_read(client, reg);
96 if (ret < 0)
97 return ret;
98 return reg_write(client, reg, ret | data);
101 static int reg_clear(struct i2c_client *client, const u8 reg,
102 const u16 data)
104 int ret;
106 ret = reg_read(client, reg);
107 if (ret < 0)
108 return ret;
109 return reg_write(client, reg, ret & ~data);
112 static int mt9m001_init(struct soc_camera_device *icd)
114 struct i2c_client *client = to_i2c_client(icd->control);
115 struct soc_camera_link *icl = client->dev.platform_data;
116 int ret;
118 dev_dbg(icd->vdev->parent, "%s\n", __func__);
120 if (icl->power) {
121 ret = icl->power(&client->dev, 1);
122 if (ret < 0) {
123 dev_err(icd->vdev->parent,
124 "Platform failed to power-on the camera.\n");
125 return ret;
129 /* The camera could have been already on, we reset it additionally */
130 if (icl->reset)
131 ret = icl->reset(&client->dev);
132 else
133 ret = -ENODEV;
135 if (ret < 0) {
136 /* Either no platform reset, or platform reset failed */
137 ret = reg_write(client, MT9M001_RESET, 1);
138 if (!ret)
139 ret = reg_write(client, MT9M001_RESET, 0);
141 /* Disable chip, synchronous option update */
142 if (!ret)
143 ret = reg_write(client, MT9M001_OUTPUT_CONTROL, 0);
145 return ret;
148 static int mt9m001_release(struct soc_camera_device *icd)
150 struct i2c_client *client = to_i2c_client(icd->control);
151 struct soc_camera_link *icl = client->dev.platform_data;
153 /* Disable the chip */
154 reg_write(client, MT9M001_OUTPUT_CONTROL, 0);
156 if (icl->power)
157 icl->power(&client->dev, 0);
159 return 0;
162 static int mt9m001_start_capture(struct soc_camera_device *icd)
164 struct i2c_client *client = to_i2c_client(icd->control);
166 /* Switch to master "normal" mode */
167 if (reg_write(client, MT9M001_OUTPUT_CONTROL, 2) < 0)
168 return -EIO;
169 return 0;
172 static int mt9m001_stop_capture(struct soc_camera_device *icd)
174 struct i2c_client *client = to_i2c_client(icd->control);
176 /* Stop sensor readout */
177 if (reg_write(client, MT9M001_OUTPUT_CONTROL, 0) < 0)
178 return -EIO;
179 return 0;
182 static int mt9m001_set_bus_param(struct soc_camera_device *icd,
183 unsigned long flags)
185 struct mt9m001 *mt9m001 = container_of(icd, struct mt9m001, icd);
186 struct soc_camera_link *icl = mt9m001->client->dev.platform_data;
187 unsigned long width_flag = flags & SOCAM_DATAWIDTH_MASK;
189 /* Only one width bit may be set */
190 if (!is_power_of_2(width_flag))
191 return -EINVAL;
193 if (icl->set_bus_param)
194 return icl->set_bus_param(icl, width_flag);
197 * Without board specific bus width settings we only support the
198 * sensors native bus width
200 if (width_flag == SOCAM_DATAWIDTH_10)
201 return 0;
203 return -EINVAL;
206 static unsigned long mt9m001_query_bus_param(struct soc_camera_device *icd)
208 struct mt9m001 *mt9m001 = container_of(icd, struct mt9m001, icd);
209 struct soc_camera_link *icl = mt9m001->client->dev.platform_data;
210 /* MT9M001 has all capture_format parameters fixed */
211 unsigned long flags = SOCAM_PCLK_SAMPLE_FALLING |
212 SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_HIGH |
213 SOCAM_DATA_ACTIVE_HIGH | SOCAM_MASTER;
215 if (icl->query_bus_param)
216 flags |= icl->query_bus_param(icl) & SOCAM_DATAWIDTH_MASK;
217 else
218 flags |= SOCAM_DATAWIDTH_10;
220 return soc_camera_apply_sensor_flags(icl, flags);
223 static int mt9m001_set_crop(struct soc_camera_device *icd,
224 struct v4l2_rect *rect)
226 struct i2c_client *client = to_i2c_client(icd->control);
227 struct mt9m001 *mt9m001 = container_of(icd, struct mt9m001, icd);
228 int ret;
229 const u16 hblank = 9, vblank = 25;
231 /* Blanking and start values - default... */
232 ret = reg_write(client, MT9M001_HORIZONTAL_BLANKING, hblank);
233 if (!ret)
234 ret = reg_write(client, MT9M001_VERTICAL_BLANKING, vblank);
236 /* The caller provides a supported format, as verified per
237 * call to icd->try_fmt() */
238 if (!ret)
239 ret = reg_write(client, MT9M001_COLUMN_START, rect->left);
240 if (!ret)
241 ret = reg_write(client, MT9M001_ROW_START, rect->top);
242 if (!ret)
243 ret = reg_write(client, MT9M001_WINDOW_WIDTH, rect->width - 1);
244 if (!ret)
245 ret = reg_write(client, MT9M001_WINDOW_HEIGHT,
246 rect->height + icd->y_skip_top - 1);
247 if (!ret && mt9m001->autoexposure) {
248 ret = reg_write(client, MT9M001_SHUTTER_WIDTH,
249 rect->height + icd->y_skip_top + vblank);
250 if (!ret) {
251 const struct v4l2_queryctrl *qctrl =
252 soc_camera_find_qctrl(icd->ops,
253 V4L2_CID_EXPOSURE);
254 icd->exposure = (524 + (rect->height + icd->y_skip_top +
255 vblank - 1) *
256 (qctrl->maximum - qctrl->minimum)) /
257 1048 + qctrl->minimum;
261 return ret;
264 static int mt9m001_set_fmt(struct soc_camera_device *icd,
265 struct v4l2_format *f)
267 struct v4l2_rect rect = {
268 .left = icd->x_current,
269 .top = icd->y_current,
270 .width = f->fmt.pix.width,
271 .height = f->fmt.pix.height,
274 /* No support for scaling so far, just crop. TODO: use skipping */
275 return mt9m001_set_crop(icd, &rect);
278 static int mt9m001_try_fmt(struct soc_camera_device *icd,
279 struct v4l2_format *f)
281 struct v4l2_pix_format *pix = &f->fmt.pix;
283 if (pix->height < 32 + icd->y_skip_top)
284 pix->height = 32 + icd->y_skip_top;
285 if (pix->height > 1024 + icd->y_skip_top)
286 pix->height = 1024 + icd->y_skip_top;
287 if (pix->width < 48)
288 pix->width = 48;
289 if (pix->width > 1280)
290 pix->width = 1280;
291 pix->width &= ~0x01; /* has to be even, unsure why was ~3 */
293 return 0;
296 static int mt9m001_get_chip_id(struct soc_camera_device *icd,
297 struct v4l2_dbg_chip_ident *id)
299 struct mt9m001 *mt9m001 = container_of(icd, struct mt9m001, icd);
301 if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
302 return -EINVAL;
304 if (id->match.addr != mt9m001->client->addr)
305 return -ENODEV;
307 id->ident = mt9m001->model;
308 id->revision = 0;
310 return 0;
313 #ifdef CONFIG_VIDEO_ADV_DEBUG
314 static int mt9m001_get_register(struct soc_camera_device *icd,
315 struct v4l2_dbg_register *reg)
317 struct i2c_client *client = to_i2c_client(icd->control);
319 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff)
320 return -EINVAL;
322 if (reg->match.addr != client->addr)
323 return -ENODEV;
325 reg->size = 2;
326 reg->val = reg_read(client, reg->reg);
328 if (reg->val > 0xffff)
329 return -EIO;
331 return 0;
334 static int mt9m001_set_register(struct soc_camera_device *icd,
335 struct v4l2_dbg_register *reg)
337 struct i2c_client *client = to_i2c_client(icd->control);
339 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff)
340 return -EINVAL;
342 if (reg->match.addr != client->addr)
343 return -ENODEV;
345 if (reg_write(client, reg->reg, reg->val) < 0)
346 return -EIO;
348 return 0;
350 #endif
352 static const struct v4l2_queryctrl mt9m001_controls[] = {
354 .id = V4L2_CID_VFLIP,
355 .type = V4L2_CTRL_TYPE_BOOLEAN,
356 .name = "Flip Vertically",
357 .minimum = 0,
358 .maximum = 1,
359 .step = 1,
360 .default_value = 0,
361 }, {
362 .id = V4L2_CID_GAIN,
363 .type = V4L2_CTRL_TYPE_INTEGER,
364 .name = "Gain",
365 .minimum = 0,
366 .maximum = 127,
367 .step = 1,
368 .default_value = 64,
369 .flags = V4L2_CTRL_FLAG_SLIDER,
370 }, {
371 .id = V4L2_CID_EXPOSURE,
372 .type = V4L2_CTRL_TYPE_INTEGER,
373 .name = "Exposure",
374 .minimum = 1,
375 .maximum = 255,
376 .step = 1,
377 .default_value = 255,
378 .flags = V4L2_CTRL_FLAG_SLIDER,
379 }, {
380 .id = V4L2_CID_EXPOSURE_AUTO,
381 .type = V4L2_CTRL_TYPE_BOOLEAN,
382 .name = "Automatic Exposure",
383 .minimum = 0,
384 .maximum = 1,
385 .step = 1,
386 .default_value = 1,
390 static int mt9m001_video_probe(struct soc_camera_device *);
391 static void mt9m001_video_remove(struct soc_camera_device *);
392 static int mt9m001_get_control(struct soc_camera_device *, struct v4l2_control *);
393 static int mt9m001_set_control(struct soc_camera_device *, struct v4l2_control *);
395 static struct soc_camera_ops mt9m001_ops = {
396 .owner = THIS_MODULE,
397 .probe = mt9m001_video_probe,
398 .remove = mt9m001_video_remove,
399 .init = mt9m001_init,
400 .release = mt9m001_release,
401 .start_capture = mt9m001_start_capture,
402 .stop_capture = mt9m001_stop_capture,
403 .set_crop = mt9m001_set_crop,
404 .set_fmt = mt9m001_set_fmt,
405 .try_fmt = mt9m001_try_fmt,
406 .set_bus_param = mt9m001_set_bus_param,
407 .query_bus_param = mt9m001_query_bus_param,
408 .controls = mt9m001_controls,
409 .num_controls = ARRAY_SIZE(mt9m001_controls),
410 .get_control = mt9m001_get_control,
411 .set_control = mt9m001_set_control,
412 .get_chip_id = mt9m001_get_chip_id,
413 #ifdef CONFIG_VIDEO_ADV_DEBUG
414 .get_register = mt9m001_get_register,
415 .set_register = mt9m001_set_register,
416 #endif
419 static int mt9m001_get_control(struct soc_camera_device *icd, struct v4l2_control *ctrl)
421 struct i2c_client *client = to_i2c_client(icd->control);
422 struct mt9m001 *mt9m001 = container_of(icd, struct mt9m001, icd);
423 int data;
425 switch (ctrl->id) {
426 case V4L2_CID_VFLIP:
427 data = reg_read(client, MT9M001_READ_OPTIONS2);
428 if (data < 0)
429 return -EIO;
430 ctrl->value = !!(data & 0x8000);
431 break;
432 case V4L2_CID_EXPOSURE_AUTO:
433 ctrl->value = mt9m001->autoexposure;
434 break;
436 return 0;
439 static int mt9m001_set_control(struct soc_camera_device *icd, struct v4l2_control *ctrl)
441 struct i2c_client *client = to_i2c_client(icd->control);
442 struct mt9m001 *mt9m001 = container_of(icd, struct mt9m001, icd);
443 const struct v4l2_queryctrl *qctrl;
444 int data;
446 qctrl = soc_camera_find_qctrl(&mt9m001_ops, ctrl->id);
448 if (!qctrl)
449 return -EINVAL;
451 switch (ctrl->id) {
452 case V4L2_CID_VFLIP:
453 if (ctrl->value)
454 data = reg_set(client, MT9M001_READ_OPTIONS2, 0x8000);
455 else
456 data = reg_clear(client, MT9M001_READ_OPTIONS2, 0x8000);
457 if (data < 0)
458 return -EIO;
459 break;
460 case V4L2_CID_GAIN:
461 if (ctrl->value > qctrl->maximum || ctrl->value < qctrl->minimum)
462 return -EINVAL;
463 /* See Datasheet Table 7, Gain settings. */
464 if (ctrl->value <= qctrl->default_value) {
465 /* Pack it into 0..1 step 0.125, register values 0..8 */
466 unsigned long range = qctrl->default_value - qctrl->minimum;
467 data = ((ctrl->value - qctrl->minimum) * 8 + range / 2) / range;
469 dev_dbg(&icd->dev, "Setting gain %d\n", data);
470 data = reg_write(client, MT9M001_GLOBAL_GAIN, data);
471 if (data < 0)
472 return -EIO;
473 } else {
474 /* Pack it into 1.125..15 variable step, register values 9..67 */
475 /* We assume qctrl->maximum - qctrl->default_value - 1 > 0 */
476 unsigned long range = qctrl->maximum - qctrl->default_value - 1;
477 unsigned long gain = ((ctrl->value - qctrl->default_value - 1) *
478 111 + range / 2) / range + 9;
480 if (gain <= 32)
481 data = gain;
482 else if (gain <= 64)
483 data = ((gain - 32) * 16 + 16) / 32 + 80;
484 else
485 data = ((gain - 64) * 7 + 28) / 56 + 96;
487 dev_dbg(&icd->dev, "Setting gain from %d to %d\n",
488 reg_read(client, MT9M001_GLOBAL_GAIN), data);
489 data = reg_write(client, MT9M001_GLOBAL_GAIN, data);
490 if (data < 0)
491 return -EIO;
494 /* Success */
495 icd->gain = ctrl->value;
496 break;
497 case V4L2_CID_EXPOSURE:
498 /* mt9m001 has maximum == default */
499 if (ctrl->value > qctrl->maximum || ctrl->value < qctrl->minimum)
500 return -EINVAL;
501 else {
502 unsigned long range = qctrl->maximum - qctrl->minimum;
503 unsigned long shutter = ((ctrl->value - qctrl->minimum) * 1048 +
504 range / 2) / range + 1;
506 dev_dbg(&icd->dev, "Setting shutter width from %d to %lu\n",
507 reg_read(client, MT9M001_SHUTTER_WIDTH), shutter);
508 if (reg_write(client, MT9M001_SHUTTER_WIDTH, shutter) < 0)
509 return -EIO;
510 icd->exposure = ctrl->value;
511 mt9m001->autoexposure = 0;
513 break;
514 case V4L2_CID_EXPOSURE_AUTO:
515 if (ctrl->value) {
516 const u16 vblank = 25;
517 if (reg_write(client, MT9M001_SHUTTER_WIDTH, icd->height +
518 icd->y_skip_top + vblank) < 0)
519 return -EIO;
520 qctrl = soc_camera_find_qctrl(icd->ops, V4L2_CID_EXPOSURE);
521 icd->exposure = (524 + (icd->height + icd->y_skip_top + vblank - 1) *
522 (qctrl->maximum - qctrl->minimum)) /
523 1048 + qctrl->minimum;
524 mt9m001->autoexposure = 1;
525 } else
526 mt9m001->autoexposure = 0;
527 break;
529 return 0;
532 /* Interface active, can use i2c. If it fails, it can indeed mean, that
533 * this wasn't our capture interface, so, we wait for the right one */
534 static int mt9m001_video_probe(struct soc_camera_device *icd)
536 struct i2c_client *client = to_i2c_client(icd->control);
537 struct mt9m001 *mt9m001 = container_of(icd, struct mt9m001, icd);
538 struct soc_camera_link *icl = client->dev.platform_data;
539 s32 data;
540 int ret;
541 unsigned long flags;
543 /* We must have a parent by now. And it cannot be a wrong one.
544 * So this entire test is completely redundant. */
545 if (!icd->dev.parent ||
546 to_soc_camera_host(icd->dev.parent)->nr != icd->iface)
547 return -ENODEV;
549 /* Enable the chip */
550 data = reg_write(client, MT9M001_CHIP_ENABLE, 1);
551 dev_dbg(&icd->dev, "write: %d\n", data);
553 /* Read out the chip version register */
554 data = reg_read(client, MT9M001_CHIP_VERSION);
556 /* must be 0x8411 or 0x8421 for colour sensor and 8431 for bw */
557 switch (data) {
558 case 0x8411:
559 case 0x8421:
560 mt9m001->model = V4L2_IDENT_MT9M001C12ST;
561 icd->formats = mt9m001_colour_formats;
562 break;
563 case 0x8431:
564 mt9m001->model = V4L2_IDENT_MT9M001C12STM;
565 icd->formats = mt9m001_monochrome_formats;
566 break;
567 default:
568 ret = -ENODEV;
569 dev_err(&icd->dev,
570 "No MT9M001 chip detected, register read %x\n", data);
571 goto ei2c;
574 icd->num_formats = 0;
577 * This is a 10bit sensor, so by default we only allow 10bit.
578 * The platform may support different bus widths due to
579 * different routing of the data lines.
581 if (icl->query_bus_param)
582 flags = icl->query_bus_param(icl);
583 else
584 flags = SOCAM_DATAWIDTH_10;
586 if (flags & SOCAM_DATAWIDTH_10)
587 icd->num_formats++;
588 else
589 icd->formats++;
591 if (flags & SOCAM_DATAWIDTH_8)
592 icd->num_formats++;
594 dev_info(&icd->dev, "Detected a MT9M001 chip ID %x (%s)\n", data,
595 data == 0x8431 ? "C12STM" : "C12ST");
597 /* Now that we know the model, we can start video */
598 ret = soc_camera_video_start(icd);
599 if (ret)
600 goto eisis;
602 return 0;
604 eisis:
605 ei2c:
606 return ret;
609 static void mt9m001_video_remove(struct soc_camera_device *icd)
611 struct mt9m001 *mt9m001 = container_of(icd, struct mt9m001, icd);
612 struct soc_camera_link *icl = mt9m001->client->dev.platform_data;
614 dev_dbg(&icd->dev, "Video %x removed: %p, %p\n", mt9m001->client->addr,
615 icd->dev.parent, icd->vdev);
616 soc_camera_video_stop(icd);
617 if (icl->free_bus)
618 icl->free_bus(icl);
621 static int mt9m001_probe(struct i2c_client *client,
622 const struct i2c_device_id *did)
624 struct mt9m001 *mt9m001;
625 struct soc_camera_device *icd;
626 struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
627 struct soc_camera_link *icl = client->dev.platform_data;
628 int ret;
630 if (!icl) {
631 dev_err(&client->dev, "MT9M001 driver needs platform data\n");
632 return -EINVAL;
635 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WORD_DATA)) {
636 dev_warn(&adapter->dev,
637 "I2C-Adapter doesn't support I2C_FUNC_SMBUS_WORD\n");
638 return -EIO;
641 mt9m001 = kzalloc(sizeof(struct mt9m001), GFP_KERNEL);
642 if (!mt9m001)
643 return -ENOMEM;
645 mt9m001->client = client;
646 i2c_set_clientdata(client, mt9m001);
648 /* Second stage probe - when a capture adapter is there */
649 icd = &mt9m001->icd;
650 icd->ops = &mt9m001_ops;
651 icd->control = &client->dev;
652 icd->x_min = 20;
653 icd->y_min = 12;
654 icd->x_current = 20;
655 icd->y_current = 12;
656 icd->width_min = 48;
657 icd->width_max = 1280;
658 icd->height_min = 32;
659 icd->height_max = 1024;
660 icd->y_skip_top = 1;
661 icd->iface = icl->bus_id;
662 /* Simulated autoexposure. If enabled, we calculate shutter width
663 * ourselves in the driver based on vertical blanking and frame width */
664 mt9m001->autoexposure = 1;
666 ret = soc_camera_device_register(icd);
667 if (ret)
668 goto eisdr;
670 return 0;
672 eisdr:
673 kfree(mt9m001);
674 return ret;
677 static int mt9m001_remove(struct i2c_client *client)
679 struct mt9m001 *mt9m001 = i2c_get_clientdata(client);
681 soc_camera_device_unregister(&mt9m001->icd);
682 kfree(mt9m001);
684 return 0;
687 static const struct i2c_device_id mt9m001_id[] = {
688 { "mt9m001", 0 },
691 MODULE_DEVICE_TABLE(i2c, mt9m001_id);
693 static struct i2c_driver mt9m001_i2c_driver = {
694 .driver = {
695 .name = "mt9m001",
697 .probe = mt9m001_probe,
698 .remove = mt9m001_remove,
699 .id_table = mt9m001_id,
702 static int __init mt9m001_mod_init(void)
704 return i2c_add_driver(&mt9m001_i2c_driver);
707 static void __exit mt9m001_mod_exit(void)
709 i2c_del_driver(&mt9m001_i2c_driver);
712 module_init(mt9m001_mod_init);
713 module_exit(mt9m001_mod_exit);
715 MODULE_DESCRIPTION("Micron MT9M001 Camera driver");
716 MODULE_AUTHOR("Guennadi Liakhovetski <kernel@pengutronix.de>");
717 MODULE_LICENSE("GPL");