blob: 055d11ddb0388aa6f3f1b2bb7244427d730c849e [file] [log] [blame]
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -03001/*
2 * V4L2 Driver for i.MXL/i.MXL camera (CSI) host
3 *
4 * Copyright (C) 2008, Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
5 * Copyright (C) 2009, Darius Augulis <augulis.darius@gmail.com>
6 *
7 * Based on PXA SoC camera driver
8 * Copyright (C) 2006, Sascha Hauer, Pengutronix
9 * Copyright (C) 2008, Guennadi Liakhovetski <kernel@pengutronix.de>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 */
15
16#include <linux/clk.h>
17#include <linux/delay.h>
18#include <linux/device.h>
19#include <linux/dma-mapping.h>
20#include <linux/errno.h>
21#include <linux/fs.h>
22#include <linux/init.h>
23#include <linux/interrupt.h>
24#include <linux/io.h>
25#include <linux/kernel.h>
26#include <linux/mm.h>
27#include <linux/module.h>
28#include <linux/moduleparam.h>
29#include <linux/mutex.h>
30#include <linux/platform_device.h>
Guennadi Liakhovetskif39c1ab2009-11-09 16:11:34 -030031#include <linux/sched.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090032#include <linux/slab.h>
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -030033#include <linux/time.h>
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -030034#include <linux/videodev2.h>
35
36#include <media/soc_camera.h>
37#include <media/v4l2-common.h>
38#include <media/v4l2-dev.h>
39#include <media/videobuf-dma-contig.h>
Guennadi Liakhovetski760697b2009-12-11 11:46:49 -030040#include <media/soc_mediabus.h>
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -030041
42#include <asm/dma.h>
43#include <asm/fiq.h>
44#include <mach/dma-mx1-mx2.h>
45#include <mach/hardware.h>
46#include <mach/mx1_camera.h>
47
48/*
49 * CSI registers
50 */
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -030051#define CSICR1 0x00 /* CSI Control Register 1 */
52#define CSISR 0x08 /* CSI Status Register */
53#define CSIRXR 0x10 /* CSI RxFIFO Register */
54
55#define CSICR1_RXFF_LEVEL(x) (((x) & 0x3) << 19)
56#define CSICR1_SOF_POL (1 << 17)
57#define CSICR1_SOF_INTEN (1 << 16)
58#define CSICR1_MCLKDIV(x) (((x) & 0xf) << 12)
59#define CSICR1_MCLKEN (1 << 9)
60#define CSICR1_FCC (1 << 8)
61#define CSICR1_BIG_ENDIAN (1 << 7)
62#define CSICR1_CLR_RXFIFO (1 << 5)
63#define CSICR1_GCLK_MODE (1 << 4)
64#define CSICR1_DATA_POL (1 << 2)
65#define CSICR1_REDGE (1 << 1)
66#define CSICR1_EN (1 << 0)
67
68#define CSISR_SFF_OR_INT (1 << 25)
69#define CSISR_RFF_OR_INT (1 << 24)
70#define CSISR_STATFF_INT (1 << 21)
71#define CSISR_RXFF_INT (1 << 18)
72#define CSISR_SOF_INT (1 << 16)
73#define CSISR_DRDY (1 << 0)
74
Mauro Carvalho Chehab64dc3c12011-06-25 11:28:37 -030075#define DRIVER_VERSION "0.0.2"
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -030076#define DRIVER_NAME "mx1-camera"
77
78#define CSI_IRQ_MASK (CSISR_SFF_OR_INT | CSISR_RFF_OR_INT | \
79 CSISR_STATFF_INT | CSISR_RXFF_INT | CSISR_SOF_INT)
80
Guennadi Liakhovetski8acbfd32011-07-27 12:30:21 -030081#define CSI_BUS_FLAGS (V4L2_MBUS_MASTER | V4L2_MBUS_HSYNC_ACTIVE_HIGH | \
82 V4L2_MBUS_VSYNC_ACTIVE_HIGH | V4L2_MBUS_VSYNC_ACTIVE_LOW | \
83 V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_PCLK_SAMPLE_FALLING | \
84 V4L2_MBUS_DATA_ACTIVE_HIGH | V4L2_MBUS_DATA_ACTIVE_LOW)
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -030085
86#define MAX_VIDEO_MEM 16 /* Video memory limit in megabytes */
87
88/*
89 * Structures
90 */
91
92/* buffer for one video frame */
93struct mx1_buffer {
94 /* common v4l buffer stuff -- must be first */
Guennadi Liakhovetski760697b2009-12-11 11:46:49 -030095 struct videobuf_buffer vb;
96 enum v4l2_mbus_pixelcode code;
97 int inwork;
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -030098};
99
Guennadi Liakhovetski5d28d522009-12-11 11:15:05 -0300100/*
101 * i.MX1/i.MXL is only supposed to handle one camera on its Camera Sensor
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300102 * Interface. If anyone ever builds hardware to enable more than
Guennadi Liakhovetski5d28d522009-12-11 11:15:05 -0300103 * one camera, they will have to modify this driver too
104 */
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300105struct mx1_camera_dev {
Guennadi Liakhovetskieb6c8552009-04-24 12:55:18 -0300106 struct soc_camera_host soc_host;
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300107 struct soc_camera_device *icd;
108 struct mx1_camera_pdata *pdata;
109 struct mx1_buffer *active;
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300110 struct resource *res;
111 struct clk *clk;
112 struct list_head capture;
113
114 void __iomem *base;
115 int dma_chan;
116 unsigned int irq;
117 unsigned long mclk;
118
119 spinlock_t lock;
120};
121
122/*
123 * Videobuf operations
124 */
125static int mx1_videobuf_setup(struct videobuf_queue *vq, unsigned int *count,
126 unsigned int *size)
127{
128 struct soc_camera_device *icd = vq->priv_data;
Guennadi Liakhovetski760697b2009-12-11 11:46:49 -0300129 int bytes_per_line = soc_mbus_bytes_per_line(icd->user_width,
130 icd->current_fmt->host_fmt);
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300131
Guennadi Liakhovetski760697b2009-12-11 11:46:49 -0300132 if (bytes_per_line < 0)
133 return bytes_per_line;
134
135 *size = bytes_per_line * icd->user_height;
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300136
137 if (!*count)
138 *count = 32;
139
Andreas Bombedab7e312010-03-21 16:02:45 -0300140 if (*size * *count > MAX_VIDEO_MEM * 1024 * 1024)
141 *count = (MAX_VIDEO_MEM * 1024 * 1024) / *size;
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300142
Guennadi Liakhovetski7dfff952011-07-15 20:03:38 -0300143 dev_dbg(icd->parent, "count=%d, size=%d\n", *count, *size);
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300144
145 return 0;
146}
147
148static void free_buffer(struct videobuf_queue *vq, struct mx1_buffer *buf)
149{
150 struct soc_camera_device *icd = vq->priv_data;
151 struct videobuf_buffer *vb = &buf->vb;
152
153 BUG_ON(in_interrupt());
154
Guennadi Liakhovetski7dfff952011-07-15 20:03:38 -0300155 dev_dbg(icd->parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__,
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300156 vb, vb->baddr, vb->bsize);
157
Guennadi Liakhovetski5d28d522009-12-11 11:15:05 -0300158 /*
159 * This waits until this buffer is out of danger, i.e., until it is no
160 * longer in STATE_QUEUED or STATE_ACTIVE
161 */
Hans Verkuil0e0809a2010-09-26 09:01:26 -0300162 videobuf_waiton(vq, vb, 0, 0);
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300163 videobuf_dma_contig_free(vq, vb);
164
165 vb->state = VIDEOBUF_NEEDS_INIT;
166}
167
168static int mx1_videobuf_prepare(struct videobuf_queue *vq,
169 struct videobuf_buffer *vb, enum v4l2_field field)
170{
171 struct soc_camera_device *icd = vq->priv_data;
172 struct mx1_buffer *buf = container_of(vb, struct mx1_buffer, vb);
173 int ret;
Guennadi Liakhovetski760697b2009-12-11 11:46:49 -0300174 int bytes_per_line = soc_mbus_bytes_per_line(icd->user_width,
175 icd->current_fmt->host_fmt);
176
177 if (bytes_per_line < 0)
178 return bytes_per_line;
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300179
Guennadi Liakhovetski7dfff952011-07-15 20:03:38 -0300180 dev_dbg(icd->parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__,
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300181 vb, vb->baddr, vb->bsize);
182
183 /* Added list head initialization on alloc */
184 WARN_ON(!list_empty(&vb->queue));
185
186 BUG_ON(NULL == icd->current_fmt);
187
Guennadi Liakhovetski5d28d522009-12-11 11:15:05 -0300188 /*
189 * I think, in buf_prepare you only have to protect global data,
190 * the actual buffer is yours
191 */
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300192 buf->inwork = 1;
193
Guennadi Liakhovetski760697b2009-12-11 11:46:49 -0300194 if (buf->code != icd->current_fmt->code ||
Guennadi Liakhovetski6a6c8782009-08-25 11:50:46 -0300195 vb->width != icd->user_width ||
196 vb->height != icd->user_height ||
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300197 vb->field != field) {
Guennadi Liakhovetski760697b2009-12-11 11:46:49 -0300198 buf->code = icd->current_fmt->code;
Guennadi Liakhovetski6a6c8782009-08-25 11:50:46 -0300199 vb->width = icd->user_width;
200 vb->height = icd->user_height;
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300201 vb->field = field;
202 vb->state = VIDEOBUF_NEEDS_INIT;
203 }
204
Guennadi Liakhovetski760697b2009-12-11 11:46:49 -0300205 vb->size = bytes_per_line * vb->height;
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300206 if (0 != vb->baddr && vb->bsize < vb->size) {
207 ret = -EINVAL;
208 goto out;
209 }
210
211 if (vb->state == VIDEOBUF_NEEDS_INIT) {
212 ret = videobuf_iolock(vq, vb, NULL);
213 if (ret)
214 goto fail;
215
216 vb->state = VIDEOBUF_PREPARED;
217 }
218
219 buf->inwork = 0;
220
221 return 0;
222
223fail:
224 free_buffer(vq, buf);
225out:
226 buf->inwork = 0;
227 return ret;
228}
229
230static int mx1_camera_setup_dma(struct mx1_camera_dev *pcdev)
231{
232 struct videobuf_buffer *vbuf = &pcdev->active->vb;
Guennadi Liakhovetski7dfff952011-07-15 20:03:38 -0300233 struct device *dev = pcdev->icd->parent;
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300234 int ret;
235
236 if (unlikely(!pcdev->active)) {
Guennadi Liakhovetski0166b742009-08-25 11:47:00 -0300237 dev_err(dev, "DMA End IRQ with no active buffer\n");
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300238 return -EFAULT;
239 }
240
241 /* setup sg list for future DMA */
242 ret = imx_dma_setup_single(pcdev->dma_chan,
243 videobuf_to_dma_contig(vbuf),
244 vbuf->size, pcdev->res->start +
245 CSIRXR, DMA_MODE_READ);
246 if (unlikely(ret))
Guennadi Liakhovetski0166b742009-08-25 11:47:00 -0300247 dev_err(dev, "Failed to setup DMA sg list\n");
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300248
249 return ret;
250}
251
Guennadi Liakhovetski2dd54a52009-08-05 20:06:31 -0300252/* Called under spinlock_irqsave(&pcdev->lock, ...) */
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300253static void mx1_videobuf_queue(struct videobuf_queue *vq,
254 struct videobuf_buffer *vb)
255{
256 struct soc_camera_device *icd = vq->priv_data;
Guennadi Liakhovetski7dfff952011-07-15 20:03:38 -0300257 struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300258 struct mx1_camera_dev *pcdev = ici->priv;
259 struct mx1_buffer *buf = container_of(vb, struct mx1_buffer, vb);
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300260
Guennadi Liakhovetski7dfff952011-07-15 20:03:38 -0300261 dev_dbg(icd->parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__,
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300262 vb, vb->baddr, vb->bsize);
263
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300264 list_add_tail(&vb->queue, &pcdev->capture);
265
266 vb->state = VIDEOBUF_ACTIVE;
267
268 if (!pcdev->active) {
269 pcdev->active = buf;
270
271 /* setup sg list for future DMA */
272 if (!mx1_camera_setup_dma(pcdev)) {
273 unsigned int temp;
274 /* enable SOF irq */
275 temp = __raw_readl(pcdev->base + CSICR1) |
276 CSICR1_SOF_INTEN;
277 __raw_writel(temp, pcdev->base + CSICR1);
278 }
279 }
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300280}
281
282static void mx1_videobuf_release(struct videobuf_queue *vq,
283 struct videobuf_buffer *vb)
284{
285 struct mx1_buffer *buf = container_of(vb, struct mx1_buffer, vb);
286#ifdef DEBUG
287 struct soc_camera_device *icd = vq->priv_data;
Guennadi Liakhovetski7dfff952011-07-15 20:03:38 -0300288 struct device *dev = icd->parent;
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300289
Guennadi Liakhovetski0166b742009-08-25 11:47:00 -0300290 dev_dbg(dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__,
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300291 vb, vb->baddr, vb->bsize);
292
293 switch (vb->state) {
294 case VIDEOBUF_ACTIVE:
Guennadi Liakhovetski0166b742009-08-25 11:47:00 -0300295 dev_dbg(dev, "%s (active)\n", __func__);
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300296 break;
297 case VIDEOBUF_QUEUED:
Guennadi Liakhovetski0166b742009-08-25 11:47:00 -0300298 dev_dbg(dev, "%s (queued)\n", __func__);
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300299 break;
300 case VIDEOBUF_PREPARED:
Guennadi Liakhovetski0166b742009-08-25 11:47:00 -0300301 dev_dbg(dev, "%s (prepared)\n", __func__);
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300302 break;
303 default:
Guennadi Liakhovetski0166b742009-08-25 11:47:00 -0300304 dev_dbg(dev, "%s (unknown)\n", __func__);
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300305 break;
306 }
307#endif
308
309 free_buffer(vq, buf);
310}
311
312static void mx1_camera_wakeup(struct mx1_camera_dev *pcdev,
313 struct videobuf_buffer *vb,
314 struct mx1_buffer *buf)
315{
316 /* _init is used to debug races, see comment in mx1_camera_reqbufs() */
317 list_del_init(&vb->queue);
318 vb->state = VIDEOBUF_DONE;
319 do_gettimeofday(&vb->ts);
320 vb->field_count++;
321 wake_up(&vb->done);
322
323 if (list_empty(&pcdev->capture)) {
324 pcdev->active = NULL;
325 return;
326 }
327
328 pcdev->active = list_entry(pcdev->capture.next,
329 struct mx1_buffer, vb.queue);
330
331 /* setup sg list for future DMA */
332 if (likely(!mx1_camera_setup_dma(pcdev))) {
333 unsigned int temp;
334
335 /* enable SOF irq */
336 temp = __raw_readl(pcdev->base + CSICR1) | CSICR1_SOF_INTEN;
337 __raw_writel(temp, pcdev->base + CSICR1);
338 }
339}
340
341static void mx1_camera_dma_irq(int channel, void *data)
342{
343 struct mx1_camera_dev *pcdev = data;
Guennadi Liakhovetski7dfff952011-07-15 20:03:38 -0300344 struct device *dev = pcdev->icd->parent;
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300345 struct mx1_buffer *buf;
346 struct videobuf_buffer *vb;
347 unsigned long flags;
348
349 spin_lock_irqsave(&pcdev->lock, flags);
350
351 imx_dma_disable(channel);
352
353 if (unlikely(!pcdev->active)) {
Guennadi Liakhovetski0166b742009-08-25 11:47:00 -0300354 dev_err(dev, "DMA End IRQ with no active buffer\n");
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300355 goto out;
356 }
357
358 vb = &pcdev->active->vb;
359 buf = container_of(vb, struct mx1_buffer, vb);
360 WARN_ON(buf->inwork || list_empty(&vb->queue));
Guennadi Liakhovetski0166b742009-08-25 11:47:00 -0300361 dev_dbg(dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__,
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300362 vb, vb->baddr, vb->bsize);
363
364 mx1_camera_wakeup(pcdev, vb, buf);
365out:
366 spin_unlock_irqrestore(&pcdev->lock, flags);
367}
368
369static struct videobuf_queue_ops mx1_videobuf_ops = {
370 .buf_setup = mx1_videobuf_setup,
371 .buf_prepare = mx1_videobuf_prepare,
372 .buf_queue = mx1_videobuf_queue,
373 .buf_release = mx1_videobuf_release,
374};
375
376static void mx1_camera_init_videobuf(struct videobuf_queue *q,
377 struct soc_camera_device *icd)
378{
Guennadi Liakhovetski7dfff952011-07-15 20:03:38 -0300379 struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300380 struct mx1_camera_dev *pcdev = ici->priv;
381
Guennadi Liakhovetski7dfff952011-07-15 20:03:38 -0300382 videobuf_queue_dma_contig_init(q, &mx1_videobuf_ops, icd->parent,
Guennadi Liakhovetskib6a633c2010-12-25 17:40:26 -0300383 &pcdev->lock, V4L2_BUF_TYPE_VIDEO_CAPTURE,
384 V4L2_FIELD_NONE,
385 sizeof(struct mx1_buffer), icd, &icd->video_lock);
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300386}
387
388static int mclk_get_divisor(struct mx1_camera_dev *pcdev)
389{
390 unsigned int mclk = pcdev->mclk;
391 unsigned long div;
392 unsigned long lcdclk;
393
394 lcdclk = clk_get_rate(pcdev->clk);
395
Guennadi Liakhovetski5d28d522009-12-11 11:15:05 -0300396 /*
397 * We verify platform_mclk_10khz != 0, so if anyone breaks it, here
398 * they get a nice Oops
399 */
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300400 div = (lcdclk + 2 * mclk - 1) / (2 * mclk) - 1;
401
Guennadi Liakhovetski7dfff952011-07-15 20:03:38 -0300402 dev_dbg(pcdev->icd->parent,
Guennadi Liakhovetski0166b742009-08-25 11:47:00 -0300403 "System clock %lukHz, target freq %dkHz, divisor %lu\n",
404 lcdclk / 1000, mclk / 1000, div);
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300405
406 return div;
407}
408
409static void mx1_camera_activate(struct mx1_camera_dev *pcdev)
410{
411 unsigned int csicr1 = CSICR1_EN;
412
Guennadi Liakhovetski7dfff952011-07-15 20:03:38 -0300413 dev_dbg(pcdev->icd->parent, "Activate device\n");
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300414
415 clk_enable(pcdev->clk);
416
417 /* enable CSI before doing anything else */
418 __raw_writel(csicr1, pcdev->base + CSICR1);
419
420 csicr1 |= CSICR1_MCLKEN | CSICR1_FCC | CSICR1_GCLK_MODE;
421 csicr1 |= CSICR1_MCLKDIV(mclk_get_divisor(pcdev));
422 csicr1 |= CSICR1_RXFF_LEVEL(2); /* 16 words */
423
424 __raw_writel(csicr1, pcdev->base + CSICR1);
425}
426
427static void mx1_camera_deactivate(struct mx1_camera_dev *pcdev)
428{
Guennadi Liakhovetski7dfff952011-07-15 20:03:38 -0300429 dev_dbg(pcdev->icd->parent, "Deactivate device\n");
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300430
431 /* Disable all CSI interface */
432 __raw_writel(0x00, pcdev->base + CSICR1);
433
434 clk_disable(pcdev->clk);
435}
436
Guennadi Liakhovetski5d28d522009-12-11 11:15:05 -0300437/*
438 * The following two functions absolutely depend on the fact, that
439 * there can be only one camera on i.MX1/i.MXL camera sensor interface
440 */
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300441static int mx1_camera_add_device(struct soc_camera_device *icd)
442{
Guennadi Liakhovetski7dfff952011-07-15 20:03:38 -0300443 struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300444 struct mx1_camera_dev *pcdev = ici->priv;
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300445
Andre Bartke258c0562011-06-10 07:57:54 -0300446 if (pcdev->icd)
447 return -EBUSY;
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300448
Guennadi Liakhovetski7dfff952011-07-15 20:03:38 -0300449 dev_info(icd->parent, "MX1 Camera driver attached to camera %d\n",
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300450 icd->devnum);
451
452 mx1_camera_activate(pcdev);
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300453
Guennadi Liakhovetski979ea1d2009-08-25 11:43:33 -0300454 pcdev->icd = icd;
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300455
Andre Bartke258c0562011-06-10 07:57:54 -0300456 return 0;
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300457}
458
459static void mx1_camera_remove_device(struct soc_camera_device *icd)
460{
Guennadi Liakhovetski7dfff952011-07-15 20:03:38 -0300461 struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300462 struct mx1_camera_dev *pcdev = ici->priv;
463 unsigned int csicr1;
464
465 BUG_ON(icd != pcdev->icd);
466
467 /* disable interrupts */
468 csicr1 = __raw_readl(pcdev->base + CSICR1) & ~CSI_IRQ_MASK;
469 __raw_writel(csicr1, pcdev->base + CSICR1);
470
471 /* Stop DMA engine */
472 imx_dma_disable(pcdev->dma_chan);
473
Guennadi Liakhovetski7dfff952011-07-15 20:03:38 -0300474 dev_info(icd->parent, "MX1 Camera driver detached from camera %d\n",
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300475 icd->devnum);
476
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300477 mx1_camera_deactivate(pcdev);
478
479 pcdev->icd = NULL;
480}
481
482static int mx1_camera_set_crop(struct soc_camera_device *icd,
Guennadi Liakhovetski08590b92009-08-25 11:46:54 -0300483 struct v4l2_crop *a)
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300484{
Guennadi Liakhovetskic9c1f1c2009-08-25 11:46:59 -0300485 struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
Guennadi Liakhovetski08590b92009-08-25 11:46:54 -0300486
487 return v4l2_subdev_call(sd, video, s_crop, a);
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300488}
489
Guennadi Liakhovetski8843d112011-09-21 17:52:51 -0300490static int mx1_camera_set_bus_param(struct soc_camera_device *icd)
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300491{
Guennadi Liakhovetski8acbfd32011-07-27 12:30:21 -0300492 struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
Guennadi Liakhovetski7dfff952011-07-15 20:03:38 -0300493 struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300494 struct mx1_camera_dev *pcdev = ici->priv;
Guennadi Liakhovetski8acbfd32011-07-27 12:30:21 -0300495 struct v4l2_mbus_config cfg = {.type = V4L2_MBUS_PARALLEL,};
496 unsigned long common_flags;
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300497 unsigned int csicr1;
498 int ret;
499
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300500 /* MX1 supports only 8bit buswidth */
Guennadi Liakhovetski8acbfd32011-07-27 12:30:21 -0300501 ret = v4l2_subdev_call(sd, video, g_mbus_config, &cfg);
502 if (!ret) {
503 common_flags = soc_mbus_config_compatible(&cfg, CSI_BUS_FLAGS);
504 if (!common_flags) {
505 dev_warn(icd->parent,
506 "Flags incompatible: camera 0x%x, host 0x%x\n",
507 cfg.flags, CSI_BUS_FLAGS);
508 return -EINVAL;
509 }
510 } else if (ret != -ENOIOCTLCMD) {
511 return ret;
512 } else {
513 common_flags = CSI_BUS_FLAGS;
514 }
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300515
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300516 /* Make choises, based on platform choice */
Guennadi Liakhovetski8acbfd32011-07-27 12:30:21 -0300517 if ((common_flags & V4L2_MBUS_VSYNC_ACTIVE_HIGH) &&
518 (common_flags & V4L2_MBUS_VSYNC_ACTIVE_LOW)) {
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300519 if (!pcdev->pdata ||
520 pcdev->pdata->flags & MX1_CAMERA_VSYNC_HIGH)
Guennadi Liakhovetski8acbfd32011-07-27 12:30:21 -0300521 common_flags &= ~V4L2_MBUS_VSYNC_ACTIVE_LOW;
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300522 else
Guennadi Liakhovetski8acbfd32011-07-27 12:30:21 -0300523 common_flags &= ~V4L2_MBUS_VSYNC_ACTIVE_HIGH;
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300524 }
525
Guennadi Liakhovetski8acbfd32011-07-27 12:30:21 -0300526 if ((common_flags & V4L2_MBUS_PCLK_SAMPLE_RISING) &&
527 (common_flags & V4L2_MBUS_PCLK_SAMPLE_FALLING)) {
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300528 if (!pcdev->pdata ||
529 pcdev->pdata->flags & MX1_CAMERA_PCLK_RISING)
Guennadi Liakhovetski8acbfd32011-07-27 12:30:21 -0300530 common_flags &= ~V4L2_MBUS_PCLK_SAMPLE_FALLING;
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300531 else
Guennadi Liakhovetski8acbfd32011-07-27 12:30:21 -0300532 common_flags &= ~V4L2_MBUS_PCLK_SAMPLE_RISING;
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300533 }
534
Guennadi Liakhovetski8acbfd32011-07-27 12:30:21 -0300535 if ((common_flags & V4L2_MBUS_DATA_ACTIVE_HIGH) &&
536 (common_flags & V4L2_MBUS_DATA_ACTIVE_LOW)) {
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300537 if (!pcdev->pdata ||
538 pcdev->pdata->flags & MX1_CAMERA_DATA_HIGH)
Guennadi Liakhovetski8acbfd32011-07-27 12:30:21 -0300539 common_flags &= ~V4L2_MBUS_DATA_ACTIVE_LOW;
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300540 else
Guennadi Liakhovetski8acbfd32011-07-27 12:30:21 -0300541 common_flags &= ~V4L2_MBUS_DATA_ACTIVE_HIGH;
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300542 }
543
Guennadi Liakhovetski8acbfd32011-07-27 12:30:21 -0300544 cfg.flags = common_flags;
545 ret = v4l2_subdev_call(sd, video, s_mbus_config, &cfg);
546 if (ret < 0 && ret != -ENOIOCTLCMD) {
547 dev_dbg(icd->parent, "camera s_mbus_config(0x%lx) returned %d\n",
548 common_flags, ret);
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300549 return ret;
Guennadi Liakhovetski8acbfd32011-07-27 12:30:21 -0300550 }
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300551
552 csicr1 = __raw_readl(pcdev->base + CSICR1);
553
Guennadi Liakhovetski8acbfd32011-07-27 12:30:21 -0300554 if (common_flags & V4L2_MBUS_PCLK_SAMPLE_RISING)
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300555 csicr1 |= CSICR1_REDGE;
Guennadi Liakhovetski8acbfd32011-07-27 12:30:21 -0300556 if (common_flags & V4L2_MBUS_VSYNC_ACTIVE_HIGH)
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300557 csicr1 |= CSICR1_SOF_POL;
Guennadi Liakhovetski8acbfd32011-07-27 12:30:21 -0300558 if (common_flags & V4L2_MBUS_DATA_ACTIVE_LOW)
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300559 csicr1 |= CSICR1_DATA_POL;
560
561 __raw_writel(csicr1, pcdev->base + CSICR1);
562
563 return 0;
564}
565
566static int mx1_camera_set_fmt(struct soc_camera_device *icd,
567 struct v4l2_format *f)
568{
Guennadi Liakhovetskic9c1f1c2009-08-25 11:46:59 -0300569 struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300570 const struct soc_camera_format_xlate *xlate;
571 struct v4l2_pix_format *pix = &f->fmt.pix;
Guennadi Liakhovetski760697b2009-12-11 11:46:49 -0300572 struct v4l2_mbus_framefmt mf;
573 int ret, buswidth;
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300574
575 xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat);
576 if (!xlate) {
Guennadi Liakhovetski7dfff952011-07-15 20:03:38 -0300577 dev_warn(icd->parent, "Format %x not found\n",
Guennadi Liakhovetski96c75392009-08-25 11:53:23 -0300578 pix->pixelformat);
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300579 return -EINVAL;
580 }
581
Guennadi Liakhovetski760697b2009-12-11 11:46:49 -0300582 buswidth = xlate->host_fmt->bits_per_sample;
583 if (buswidth > 8) {
Guennadi Liakhovetski7dfff952011-07-15 20:03:38 -0300584 dev_warn(icd->parent,
Guennadi Liakhovetski760697b2009-12-11 11:46:49 -0300585 "bits-per-sample %d for format %x unsupported\n",
586 buswidth, pix->pixelformat);
587 return -EINVAL;
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300588 }
589
Guennadi Liakhovetski760697b2009-12-11 11:46:49 -0300590 mf.width = pix->width;
591 mf.height = pix->height;
592 mf.field = pix->field;
593 mf.colorspace = pix->colorspace;
594 mf.code = xlate->code;
595
596 ret = v4l2_subdev_call(sd, video, s_mbus_fmt, &mf);
597 if (ret < 0)
598 return ret;
599
600 if (mf.code != xlate->code)
601 return -EINVAL;
602
603 pix->width = mf.width;
604 pix->height = mf.height;
605 pix->field = mf.field;
606 pix->colorspace = mf.colorspace;
607 icd->current_fmt = xlate;
608
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300609 return ret;
610}
611
612static int mx1_camera_try_fmt(struct soc_camera_device *icd,
613 struct v4l2_format *f)
614{
Guennadi Liakhovetskic9c1f1c2009-08-25 11:46:59 -0300615 struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
Guennadi Liakhovetski760697b2009-12-11 11:46:49 -0300616 const struct soc_camera_format_xlate *xlate;
617 struct v4l2_pix_format *pix = &f->fmt.pix;
618 struct v4l2_mbus_framefmt mf;
619 int ret;
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300620 /* TODO: limit to mx1 hardware capabilities */
621
Guennadi Liakhovetski760697b2009-12-11 11:46:49 -0300622 xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat);
623 if (!xlate) {
Guennadi Liakhovetski7dfff952011-07-15 20:03:38 -0300624 dev_warn(icd->parent, "Format %x not found\n",
Guennadi Liakhovetski760697b2009-12-11 11:46:49 -0300625 pix->pixelformat);
626 return -EINVAL;
627 }
628
629 mf.width = pix->width;
630 mf.height = pix->height;
631 mf.field = pix->field;
632 mf.colorspace = pix->colorspace;
633 mf.code = xlate->code;
634
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300635 /* limit to sensor capabilities */
Guennadi Liakhovetski760697b2009-12-11 11:46:49 -0300636 ret = v4l2_subdev_call(sd, video, try_mbus_fmt, &mf);
637 if (ret < 0)
638 return ret;
639
640 pix->width = mf.width;
641 pix->height = mf.height;
642 pix->field = mf.field;
643 pix->colorspace = mf.colorspace;
644
645 return 0;
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300646}
647
Guennadi Liakhovetski57bee292010-08-17 14:29:51 -0300648static int mx1_camera_reqbufs(struct soc_camera_device *icd,
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300649 struct v4l2_requestbuffers *p)
650{
651 int i;
652
Guennadi Liakhovetski5d28d522009-12-11 11:15:05 -0300653 /*
654 * This is for locking debugging only. I removed spinlocks and now I
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300655 * check whether .prepare is ever called on a linked buffer, or whether
656 * a dma IRQ can occur for an in-work or unlinked buffer. Until now
Guennadi Liakhovetski5d28d522009-12-11 11:15:05 -0300657 * it hadn't triggered
658 */
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300659 for (i = 0; i < p->count; i++) {
Guennadi Liakhovetski57bee292010-08-17 14:29:51 -0300660 struct mx1_buffer *buf = container_of(icd->vb_vidq.bufs[i],
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300661 struct mx1_buffer, vb);
662 buf->inwork = 0;
663 INIT_LIST_HEAD(&buf->vb.queue);
664 }
665
666 return 0;
667}
668
669static unsigned int mx1_camera_poll(struct file *file, poll_table *pt)
670{
Guennadi Liakhovetski57bee292010-08-17 14:29:51 -0300671 struct soc_camera_device *icd = file->private_data;
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300672 struct mx1_buffer *buf;
673
Guennadi Liakhovetski57bee292010-08-17 14:29:51 -0300674 buf = list_entry(icd->vb_vidq.stream.next, struct mx1_buffer,
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300675 vb.stream);
676
677 poll_wait(file, &buf->vb.done, pt);
678
679 if (buf->vb.state == VIDEOBUF_DONE ||
680 buf->vb.state == VIDEOBUF_ERROR)
681 return POLLIN | POLLRDNORM;
682
683 return 0;
684}
685
686static int mx1_camera_querycap(struct soc_camera_host *ici,
687 struct v4l2_capability *cap)
688{
689 /* cap->name is set by the friendly caller:-> */
690 strlcpy(cap->card, "i.MX1/i.MXL Camera", sizeof(cap->card));
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300691 cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;
692
693 return 0;
694}
695
696static struct soc_camera_host_ops mx1_soc_camera_host_ops = {
697 .owner = THIS_MODULE,
698 .add = mx1_camera_add_device,
699 .remove = mx1_camera_remove_device,
700 .set_bus_param = mx1_camera_set_bus_param,
701 .set_crop = mx1_camera_set_crop,
702 .set_fmt = mx1_camera_set_fmt,
703 .try_fmt = mx1_camera_try_fmt,
704 .init_videobuf = mx1_camera_init_videobuf,
705 .reqbufs = mx1_camera_reqbufs,
706 .poll = mx1_camera_poll,
707 .querycap = mx1_camera_querycap,
708};
709
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300710static struct fiq_handler fh = {
711 .name = "csi_sof"
712};
713
714static int __init mx1_camera_probe(struct platform_device *pdev)
715{
716 struct mx1_camera_dev *pcdev;
717 struct resource *res;
718 struct pt_regs regs;
719 struct clk *clk;
720 void __iomem *base;
721 unsigned int irq;
722 int err = 0;
723
724 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
725 irq = platform_get_irq(pdev, 0);
Uwe Kleine-König30883ea2010-01-09 20:44:06 -0300726 if (!res || (int)irq <= 0) {
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300727 err = -ENODEV;
728 goto exit;
729 }
730
731 clk = clk_get(&pdev->dev, "csi_clk");
732 if (IS_ERR(clk)) {
733 err = PTR_ERR(clk);
734 goto exit;
735 }
736
737 pcdev = kzalloc(sizeof(*pcdev), GFP_KERNEL);
738 if (!pcdev) {
739 dev_err(&pdev->dev, "Could not allocate pcdev\n");
740 err = -ENOMEM;
741 goto exit_put_clk;
742 }
743
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300744 pcdev->res = res;
745 pcdev->clk = clk;
746
747 pcdev->pdata = pdev->dev.platform_data;
748
749 if (pcdev->pdata)
750 pcdev->mclk = pcdev->pdata->mclk_10khz * 10000;
751
752 if (!pcdev->mclk) {
753 dev_warn(&pdev->dev,
754 "mclk_10khz == 0! Please, fix your platform data. "
755 "Using default 20MHz\n");
756 pcdev->mclk = 20000000;
757 }
758
759 INIT_LIST_HEAD(&pcdev->capture);
760 spin_lock_init(&pcdev->lock);
761
762 /*
763 * Request the regions.
764 */
765 if (!request_mem_region(res->start, resource_size(res), DRIVER_NAME)) {
766 err = -EBUSY;
767 goto exit_kfree;
768 }
769
770 base = ioremap(res->start, resource_size(res));
771 if (!base) {
772 err = -ENOMEM;
773 goto exit_release;
774 }
775 pcdev->irq = irq;
776 pcdev->base = base;
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300777
778 /* request dma */
779 pcdev->dma_chan = imx_dma_request_by_prio(DRIVER_NAME, DMA_PRIO_HIGH);
780 if (pcdev->dma_chan < 0) {
Guennadi Liakhovetskieff505f2009-04-24 12:55:48 -0300781 dev_err(&pdev->dev, "Can't request DMA for MX1 CSI\n");
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300782 err = -EBUSY;
783 goto exit_iounmap;
784 }
Guennadi Liakhovetskieff505f2009-04-24 12:55:48 -0300785 dev_dbg(&pdev->dev, "got DMA channel %d\n", pcdev->dma_chan);
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300786
787 imx_dma_setup_handlers(pcdev->dma_chan, mx1_camera_dma_irq, NULL,
788 pcdev);
789
790 imx_dma_config_channel(pcdev->dma_chan, IMX_DMA_TYPE_FIFO,
Uwe Kleine-Königb7d41d62010-03-27 18:42:13 -0300791 IMX_DMA_MEMSIZE_32, MX1_DMA_REQ_CSI_R, 0);
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300792 /* burst length : 16 words = 64 bytes */
793 imx_dma_config_burstlen(pcdev->dma_chan, 0);
794
795 /* request irq */
796 err = claim_fiq(&fh);
797 if (err) {
Guennadi Liakhovetskieff505f2009-04-24 12:55:48 -0300798 dev_err(&pdev->dev, "Camera interrupt register failed \n");
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300799 goto exit_free_dma;
800 }
801
802 set_fiq_handler(&mx1_camera_sof_fiq_start, &mx1_camera_sof_fiq_end -
803 &mx1_camera_sof_fiq_start);
804
Uwe Kleine-Königb7d41d62010-03-27 18:42:13 -0300805 regs.ARM_r8 = (long)MX1_DMA_DIMR;
806 regs.ARM_r9 = (long)MX1_DMA_CCR(pcdev->dma_chan);
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300807 regs.ARM_r10 = (long)pcdev->base + CSICR1;
808 regs.ARM_fp = (long)pcdev->base + CSISR;
809 regs.ARM_sp = 1 << pcdev->dma_chan;
810 set_fiq_regs(&regs);
811
812 mxc_set_irq_fiq(irq, 1);
813 enable_fiq(irq);
814
Guennadi Liakhovetskieb6c8552009-04-24 12:55:18 -0300815 pcdev->soc_host.drv_name = DRIVER_NAME;
816 pcdev->soc_host.ops = &mx1_soc_camera_host_ops;
817 pcdev->soc_host.priv = pcdev;
Guennadi Liakhovetski979ea1d2009-08-25 11:43:33 -0300818 pcdev->soc_host.v4l2_dev.dev = &pdev->dev;
Guennadi Liakhovetskieb6c8552009-04-24 12:55:18 -0300819 pcdev->soc_host.nr = pdev->id;
820 err = soc_camera_host_register(&pcdev->soc_host);
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300821 if (err)
822 goto exit_free_irq;
823
824 dev_info(&pdev->dev, "MX1 Camera driver loaded\n");
825
826 return 0;
827
828exit_free_irq:
829 disable_fiq(irq);
830 mxc_set_irq_fiq(irq, 0);
831 release_fiq(&fh);
832exit_free_dma:
833 imx_dma_free(pcdev->dma_chan);
834exit_iounmap:
835 iounmap(base);
836exit_release:
837 release_mem_region(res->start, resource_size(res));
838exit_kfree:
839 kfree(pcdev);
840exit_put_clk:
841 clk_put(clk);
842exit:
843 return err;
844}
845
846static int __exit mx1_camera_remove(struct platform_device *pdev)
847{
Guennadi Liakhovetskieff505f2009-04-24 12:55:48 -0300848 struct soc_camera_host *soc_host = to_soc_camera_host(&pdev->dev);
849 struct mx1_camera_dev *pcdev = container_of(soc_host,
850 struct mx1_camera_dev, soc_host);
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300851 struct resource *res;
852
853 imx_dma_free(pcdev->dma_chan);
854 disable_fiq(pcdev->irq);
855 mxc_set_irq_fiq(pcdev->irq, 0);
856 release_fiq(&fh);
857
858 clk_put(pcdev->clk);
859
Guennadi Liakhovetskieff505f2009-04-24 12:55:48 -0300860 soc_camera_host_unregister(soc_host);
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300861
862 iounmap(pcdev->base);
863
864 res = pcdev->res;
865 release_mem_region(res->start, resource_size(res));
866
867 kfree(pcdev);
868
869 dev_info(&pdev->dev, "MX1 Camera driver unloaded\n");
870
871 return 0;
872}
873
874static struct platform_driver mx1_camera_driver = {
875 .driver = {
876 .name = DRIVER_NAME,
877 },
878 .remove = __exit_p(mx1_camera_remove),
879};
880
881static int __init mx1_camera_init(void)
882{
883 return platform_driver_probe(&mx1_camera_driver, mx1_camera_probe);
884}
885
886static void __exit mx1_camera_exit(void)
887{
888 return platform_driver_unregister(&mx1_camera_driver);
889}
890
891module_init(mx1_camera_init);
892module_exit(mx1_camera_exit);
893
894MODULE_DESCRIPTION("i.MX1/i.MXL SoC Camera Host driver");
895MODULE_AUTHOR("Paulius Zaleckas <paulius.zaleckas@teltonika.lt>");
896MODULE_LICENSE("GPL v2");
Mauro Carvalho Chehab64dc3c12011-06-25 11:28:37 -0300897MODULE_VERSION(DRIVER_VERSION);
Paulius Zaleckas6acc81c2009-04-03 10:34:05 -0300898MODULE_ALIAS("platform:" DRIVER_NAME);