Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Media Vision Pro Movie Studio |
| 3 | * or |
| 4 | * "all you need is an I2C bus some RAM and a prayer" |
| 5 | * |
| 6 | * This draws heavily on code |
| 7 | * |
| 8 | * (c) Wolfgang Koehler, wolf@first.gmd.de, Dec. 1994 |
| 9 | * Kiefernring 15 |
| 10 | * 14478 Potsdam, Germany |
| 11 | * |
| 12 | * Most of this code is directly derived from his userspace driver. |
Alan Cox | d9b0144 | 2008-10-27 15:13:47 -0300 | [diff] [blame] | 13 | * His driver works so send any reports to alan@lxorguk.ukuu.org.uk |
| 14 | * unless the userspace driver also doesn't work for you... |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 15 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | * Changes: |
Hans Verkuil | feba2f8 | 2009-11-25 12:47:02 -0300 | [diff] [blame] | 17 | * 25-11-2009 Hans Verkuil <hverkuil@xs4all.nl> |
| 18 | * - converted to version 2 of the V4L API. |
| 19 | * 08/07/2003 Daniele Bellucci <bellucda@tiscali.it> |
| 20 | * - pms_capture: report back -EFAULT |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | */ |
| 22 | |
| 23 | #include <linux/module.h> |
| 24 | #include <linux/delay.h> |
| 25 | #include <linux/errno.h> |
| 26 | #include <linux/fs.h> |
| 27 | #include <linux/kernel.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | #include <linux/mm.h> |
Fengguang Wu | 4d146ad | 2012-06-09 20:00:19 -0300 | [diff] [blame] | 29 | #include <linux/slab.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | #include <linux/ioport.h> |
| 31 | #include <linux/init.h> |
Hans Verkuil | feba2f8 | 2009-11-25 12:47:02 -0300 | [diff] [blame] | 32 | #include <linux/mutex.h> |
Mauro Carvalho Chehab | 262ab9a | 2009-12-14 16:43:13 -0300 | [diff] [blame] | 33 | #include <linux/uaccess.h> |
Hans Verkuil | 4b25524 | 2012-05-06 10:41:54 -0300 | [diff] [blame] | 34 | #include <linux/isa.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | #include <asm/io.h> |
Hans Verkuil | feba2f8 | 2009-11-25 12:47:02 -0300 | [diff] [blame] | 36 | |
| 37 | #include <linux/videodev2.h> |
Mauro Carvalho Chehab | 5e87efa | 2006-06-05 10:26:32 -0300 | [diff] [blame] | 38 | #include <media/v4l2-common.h> |
Hans Verkuil | 35ea11f | 2008-07-20 08:12:02 -0300 | [diff] [blame] | 39 | #include <media/v4l2-ioctl.h> |
Hans Verkuil | 4b25524 | 2012-05-06 10:41:54 -0300 | [diff] [blame] | 40 | #include <media/v4l2-ctrls.h> |
| 41 | #include <media/v4l2-fh.h> |
| 42 | #include <media/v4l2-event.h> |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 43 | #include <media/v4l2-device.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 45 | MODULE_LICENSE("GPL"); |
Hans Verkuil | 4b25524 | 2012-05-06 10:41:54 -0300 | [diff] [blame] | 46 | MODULE_VERSION("0.0.5"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | |
| 48 | #define MOTOROLA 1 |
Hans Verkuil | feba2f8 | 2009-11-25 12:47:02 -0300 | [diff] [blame] | 49 | #define PHILIPS2 2 /* SAA7191 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | #define PHILIPS1 3 |
| 51 | #define MVVMEMORYWIDTH 0x40 /* 512 bytes */ |
| 52 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 53 | struct i2c_info { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | u8 slave; |
| 55 | u8 sub; |
| 56 | u8 data; |
| 57 | u8 hits; |
| 58 | }; |
| 59 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 60 | struct pms { |
| 61 | struct v4l2_device v4l2_dev; |
| 62 | struct video_device vdev; |
Hans Verkuil | 4b25524 | 2012-05-06 10:41:54 -0300 | [diff] [blame] | 63 | struct v4l2_ctrl_handler hdl; |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 64 | int height; |
| 65 | int width; |
Hans Verkuil | feba2f8 | 2009-11-25 12:47:02 -0300 | [diff] [blame] | 66 | int depth; |
| 67 | int input; |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 68 | struct mutex lock; |
| 69 | int i2c_count; |
| 70 | struct i2c_info i2cinfo[64]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 71 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 72 | int decoder; |
| 73 | int standard; /* 0 - auto 1 - ntsc 2 - pal 3 - secam */ |
Hans Verkuil | feba2f8 | 2009-11-25 12:47:02 -0300 | [diff] [blame] | 74 | v4l2_std_id std; |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 75 | int io; |
| 76 | int data; |
| 77 | void __iomem *mem; |
| 78 | }; |
| 79 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 | /* |
| 81 | * I/O ports and Shared Memory |
| 82 | */ |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 83 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 84 | static int io_port = 0x250; |
| 85 | module_param(io_port, int, 0); |
| 86 | |
| 87 | static int mem_base = 0xc8000; |
| 88 | module_param(mem_base, int, 0); |
| 89 | |
| 90 | static int video_nr = -1; |
| 91 | module_param(video_nr, int, 0); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 92 | |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 93 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 94 | static inline void mvv_write(struct pms *dev, u8 index, u8 value) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 95 | { |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 96 | outw(index | (value << 8), dev->io); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 97 | } |
| 98 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 99 | static inline u8 mvv_read(struct pms *dev, u8 index) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 100 | { |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 101 | outb(index, dev->io); |
| 102 | return inb(dev->data); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 103 | } |
| 104 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 105 | static int pms_i2c_stat(struct pms *dev, u8 slave) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 106 | { |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 107 | int counter = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 108 | int i; |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 109 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 110 | outb(0x28, dev->io); |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 111 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 112 | while ((inb(dev->data) & 0x01) == 0) |
| 113 | if (counter++ == 256) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 114 | break; |
| 115 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 116 | while ((inb(dev->data) & 0x01) != 0) |
| 117 | if (counter++ == 256) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 118 | break; |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 119 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 120 | outb(slave, dev->io); |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 121 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 122 | counter = 0; |
| 123 | while ((inb(dev->data) & 0x01) == 0) |
| 124 | if (counter++ == 256) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 125 | break; |
| 126 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 127 | while ((inb(dev->data) & 0x01) != 0) |
| 128 | if (counter++ == 256) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 129 | break; |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 130 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 131 | for (i = 0; i < 12; i++) { |
| 132 | char st = inb(dev->data); |
| 133 | |
| 134 | if ((st & 2) != 0) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 135 | return -1; |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 136 | if ((st & 1) == 0) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 137 | break; |
| 138 | } |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 139 | outb(0x29, dev->io); |
| 140 | return inb(dev->data); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 141 | } |
| 142 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 143 | static int pms_i2c_write(struct pms *dev, u16 slave, u16 sub, u16 data) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 144 | { |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 145 | int skip = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 146 | int count; |
| 147 | int i; |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 148 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 149 | for (i = 0; i < dev->i2c_count; i++) { |
| 150 | if ((dev->i2cinfo[i].slave == slave) && |
| 151 | (dev->i2cinfo[i].sub == sub)) { |
| 152 | if (dev->i2cinfo[i].data == data) |
| 153 | skip = 1; |
| 154 | dev->i2cinfo[i].data = data; |
| 155 | i = dev->i2c_count + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 156 | } |
| 157 | } |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 158 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 159 | if (i == dev->i2c_count && dev->i2c_count < 64) { |
| 160 | dev->i2cinfo[dev->i2c_count].slave = slave; |
| 161 | dev->i2cinfo[dev->i2c_count].sub = sub; |
| 162 | dev->i2cinfo[dev->i2c_count].data = data; |
| 163 | dev->i2c_count++; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 164 | } |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 165 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 166 | if (skip) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 167 | return 0; |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 168 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 169 | mvv_write(dev, 0x29, sub); |
| 170 | mvv_write(dev, 0x2A, data); |
| 171 | mvv_write(dev, 0x28, slave); |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 172 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 173 | outb(0x28, dev->io); |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 174 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 175 | count = 0; |
| 176 | while ((inb(dev->data) & 1) == 0) |
| 177 | if (count > 255) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 178 | break; |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 179 | while ((inb(dev->data) & 1) != 0) |
| 180 | if (count > 255) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 181 | break; |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 182 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 183 | count = inb(dev->data); |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 184 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 185 | if (count & 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 186 | return -1; |
| 187 | return count; |
| 188 | } |
| 189 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 190 | static int pms_i2c_read(struct pms *dev, int slave, int sub) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 191 | { |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 192 | int i; |
| 193 | |
| 194 | for (i = 0; i < dev->i2c_count; i++) { |
| 195 | if (dev->i2cinfo[i].slave == slave && dev->i2cinfo[i].sub == sub) |
| 196 | return dev->i2cinfo[i].data; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 197 | } |
| 198 | return 0; |
| 199 | } |
| 200 | |
| 201 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 202 | static void pms_i2c_andor(struct pms *dev, int slave, int sub, int and, int or) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 203 | { |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 204 | u8 tmp; |
| 205 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 206 | tmp = pms_i2c_read(dev, slave, sub); |
| 207 | tmp = (tmp & and) | or; |
| 208 | pms_i2c_write(dev, slave, sub, tmp); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 209 | } |
| 210 | |
| 211 | /* |
| 212 | * Control functions |
| 213 | */ |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 214 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 215 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 216 | static void pms_videosource(struct pms *dev, short source) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 217 | { |
Hans Verkuil | feba2f8 | 2009-11-25 12:47:02 -0300 | [diff] [blame] | 218 | switch (dev->decoder) { |
| 219 | case MOTOROLA: |
| 220 | break; |
| 221 | case PHILIPS2: |
| 222 | pms_i2c_andor(dev, 0x8a, 0x06, 0x7f, source ? 0x80 : 0); |
| 223 | break; |
| 224 | case PHILIPS1: |
| 225 | break; |
| 226 | } |
| 227 | mvv_write(dev, 0x2E, 0x31); |
| 228 | /* Was: mvv_write(dev, 0x2E, source ? 0x31 : 0x30); |
| 229 | But could not make this work correctly. Only Composite input |
| 230 | worked for me. */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 231 | } |
| 232 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 233 | static void pms_hue(struct pms *dev, short hue) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 234 | { |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 235 | switch (dev->decoder) { |
| 236 | case MOTOROLA: |
| 237 | pms_i2c_write(dev, 0x8a, 0x00, hue); |
| 238 | break; |
| 239 | case PHILIPS2: |
| 240 | pms_i2c_write(dev, 0x8a, 0x07, hue); |
| 241 | break; |
| 242 | case PHILIPS1: |
| 243 | pms_i2c_write(dev, 0x42, 0x07, hue); |
| 244 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 245 | } |
| 246 | } |
| 247 | |
Hans Verkuil | feba2f8 | 2009-11-25 12:47:02 -0300 | [diff] [blame] | 248 | static void pms_saturation(struct pms *dev, short sat) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 249 | { |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 250 | switch (dev->decoder) { |
| 251 | case MOTOROLA: |
Hans Verkuil | feba2f8 | 2009-11-25 12:47:02 -0300 | [diff] [blame] | 252 | pms_i2c_write(dev, 0x8a, 0x00, sat); |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 253 | break; |
| 254 | case PHILIPS1: |
Hans Verkuil | feba2f8 | 2009-11-25 12:47:02 -0300 | [diff] [blame] | 255 | pms_i2c_write(dev, 0x42, 0x12, sat); |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 256 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 257 | } |
| 258 | } |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 259 | |
| 260 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 261 | static void pms_contrast(struct pms *dev, short contrast) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 262 | { |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 263 | switch (dev->decoder) { |
| 264 | case MOTOROLA: |
| 265 | pms_i2c_write(dev, 0x8a, 0x00, contrast); |
| 266 | break; |
| 267 | case PHILIPS1: |
| 268 | pms_i2c_write(dev, 0x42, 0x13, contrast); |
| 269 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 270 | } |
| 271 | } |
| 272 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 273 | static void pms_brightness(struct pms *dev, short brightness) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 274 | { |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 275 | switch (dev->decoder) { |
| 276 | case MOTOROLA: |
| 277 | pms_i2c_write(dev, 0x8a, 0x00, brightness); |
| 278 | pms_i2c_write(dev, 0x8a, 0x00, brightness); |
| 279 | pms_i2c_write(dev, 0x8a, 0x00, brightness); |
| 280 | break; |
| 281 | case PHILIPS1: |
| 282 | pms_i2c_write(dev, 0x42, 0x19, brightness); |
| 283 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 284 | } |
| 285 | } |
| 286 | |
| 287 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 288 | static void pms_format(struct pms *dev, short format) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 289 | { |
| 290 | int target; |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 291 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 292 | dev->standard = format; |
| 293 | |
| 294 | if (dev->decoder == PHILIPS1) |
| 295 | target = 0x42; |
| 296 | else if (dev->decoder == PHILIPS2) |
| 297 | target = 0x8a; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 298 | else |
| 299 | return; |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 300 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 301 | switch (format) { |
| 302 | case 0: /* Auto */ |
| 303 | pms_i2c_andor(dev, target, 0x0d, 0xfe, 0x00); |
| 304 | pms_i2c_andor(dev, target, 0x0f, 0x3f, 0x80); |
| 305 | break; |
| 306 | case 1: /* NTSC */ |
| 307 | pms_i2c_andor(dev, target, 0x0d, 0xfe, 0x00); |
| 308 | pms_i2c_andor(dev, target, 0x0f, 0x3f, 0x40); |
| 309 | break; |
| 310 | case 2: /* PAL */ |
| 311 | pms_i2c_andor(dev, target, 0x0d, 0xfe, 0x00); |
| 312 | pms_i2c_andor(dev, target, 0x0f, 0x3f, 0x00); |
| 313 | break; |
| 314 | case 3: /* SECAM */ |
| 315 | pms_i2c_andor(dev, target, 0x0d, 0xfe, 0x01); |
| 316 | pms_i2c_andor(dev, target, 0x0f, 0x3f, 0x00); |
| 317 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 318 | } |
| 319 | } |
| 320 | |
| 321 | #ifdef FOR_FUTURE_EXPANSION |
| 322 | |
| 323 | /* |
| 324 | * These features of the PMS card are not currently exposes. They |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 325 | * could become a private v4l ioctl for PMSCONFIG or somesuch if |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 326 | * people need it. We also don't yet use the PMS interrupt. |
| 327 | */ |
| 328 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 329 | static void pms_hstart(struct pms *dev, short start) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 330 | { |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 331 | switch (dev->decoder) { |
| 332 | case PHILIPS1: |
| 333 | pms_i2c_write(dev, 0x8a, 0x05, start); |
| 334 | pms_i2c_write(dev, 0x8a, 0x18, start); |
| 335 | break; |
| 336 | case PHILIPS2: |
| 337 | pms_i2c_write(dev, 0x42, 0x05, start); |
| 338 | pms_i2c_write(dev, 0x42, 0x18, start); |
| 339 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 340 | } |
| 341 | } |
| 342 | |
| 343 | /* |
| 344 | * Bandpass filters |
| 345 | */ |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 346 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 347 | static void pms_bandpass(struct pms *dev, short pass) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 348 | { |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 349 | if (dev->decoder == PHILIPS2) |
| 350 | pms_i2c_andor(dev, 0x8a, 0x06, 0xcf, (pass & 0x03) << 4); |
| 351 | else if (dev->decoder == PHILIPS1) |
| 352 | pms_i2c_andor(dev, 0x42, 0x06, 0xcf, (pass & 0x03) << 4); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 353 | } |
| 354 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 355 | static void pms_antisnow(struct pms *dev, short snow) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 356 | { |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 357 | if (dev->decoder == PHILIPS2) |
| 358 | pms_i2c_andor(dev, 0x8a, 0x06, 0xf3, (snow & 0x03) << 2); |
| 359 | else if (dev->decoder == PHILIPS1) |
| 360 | pms_i2c_andor(dev, 0x42, 0x06, 0xf3, (snow & 0x03) << 2); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 361 | } |
| 362 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 363 | static void pms_sharpness(struct pms *dev, short sharp) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 364 | { |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 365 | if (dev->decoder == PHILIPS2) |
| 366 | pms_i2c_andor(dev, 0x8a, 0x06, 0xfc, sharp & 0x03); |
| 367 | else if (dev->decoder == PHILIPS1) |
| 368 | pms_i2c_andor(dev, 0x42, 0x06, 0xfc, sharp & 0x03); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 369 | } |
| 370 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 371 | static void pms_chromaagc(struct pms *dev, short agc) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 372 | { |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 373 | if (dev->decoder == PHILIPS2) |
| 374 | pms_i2c_andor(dev, 0x8a, 0x0c, 0x9f, (agc & 0x03) << 5); |
| 375 | else if (dev->decoder == PHILIPS1) |
| 376 | pms_i2c_andor(dev, 0x42, 0x0c, 0x9f, (agc & 0x03) << 5); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 377 | } |
| 378 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 379 | static void pms_vertnoise(struct pms *dev, short noise) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 380 | { |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 381 | if (dev->decoder == PHILIPS2) |
| 382 | pms_i2c_andor(dev, 0x8a, 0x10, 0xfc, noise & 3); |
| 383 | else if (dev->decoder == PHILIPS1) |
| 384 | pms_i2c_andor(dev, 0x42, 0x10, 0xfc, noise & 3); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 385 | } |
| 386 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 387 | static void pms_forcecolour(struct pms *dev, short colour) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 388 | { |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 389 | if (dev->decoder == PHILIPS2) |
| 390 | pms_i2c_andor(dev, 0x8a, 0x0c, 0x7f, (colour & 1) << 7); |
| 391 | else if (dev->decoder == PHILIPS1) |
| 392 | pms_i2c_andor(dev, 0x42, 0x0c, 0x7, (colour & 1) << 7); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 393 | } |
| 394 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 395 | static void pms_antigamma(struct pms *dev, short gamma) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 396 | { |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 397 | if (dev->decoder == PHILIPS2) |
| 398 | pms_i2c_andor(dev, 0xb8, 0x00, 0x7f, (gamma & 1) << 7); |
| 399 | else if (dev->decoder == PHILIPS1) |
| 400 | pms_i2c_andor(dev, 0x42, 0x20, 0x7, (gamma & 1) << 7); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 401 | } |
| 402 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 403 | static void pms_prefilter(struct pms *dev, short filter) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 404 | { |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 405 | if (dev->decoder == PHILIPS2) |
| 406 | pms_i2c_andor(dev, 0x8a, 0x06, 0xbf, (filter & 1) << 6); |
| 407 | else if (dev->decoder == PHILIPS1) |
| 408 | pms_i2c_andor(dev, 0x42, 0x06, 0xbf, (filter & 1) << 6); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 409 | } |
| 410 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 411 | static void pms_hfilter(struct pms *dev, short filter) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 412 | { |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 413 | if (dev->decoder == PHILIPS2) |
| 414 | pms_i2c_andor(dev, 0xb8, 0x04, 0x1f, (filter & 7) << 5); |
| 415 | else if (dev->decoder == PHILIPS1) |
| 416 | pms_i2c_andor(dev, 0x42, 0x24, 0x1f, (filter & 7) << 5); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 417 | } |
| 418 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 419 | static void pms_vfilter(struct pms *dev, short filter) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 420 | { |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 421 | if (dev->decoder == PHILIPS2) |
| 422 | pms_i2c_andor(dev, 0xb8, 0x08, 0x9f, (filter & 3) << 5); |
| 423 | else if (dev->decoder == PHILIPS1) |
| 424 | pms_i2c_andor(dev, 0x42, 0x28, 0x9f, (filter & 3) << 5); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 425 | } |
| 426 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 427 | static void pms_killcolour(struct pms *dev, short colour) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 428 | { |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 429 | if (dev->decoder == PHILIPS2) { |
| 430 | pms_i2c_andor(dev, 0x8a, 0x08, 0x07, (colour & 0x1f) << 3); |
| 431 | pms_i2c_andor(dev, 0x8a, 0x09, 0x07, (colour & 0x1f) << 3); |
| 432 | } else if (dev->decoder == PHILIPS1) { |
| 433 | pms_i2c_andor(dev, 0x42, 0x08, 0x07, (colour & 0x1f) << 3); |
| 434 | pms_i2c_andor(dev, 0x42, 0x09, 0x07, (colour & 0x1f) << 3); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 435 | } |
| 436 | } |
| 437 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 438 | static void pms_chromagain(struct pms *dev, short chroma) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 439 | { |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 440 | if (dev->decoder == PHILIPS2) |
| 441 | pms_i2c_write(dev, 0x8a, 0x11, chroma); |
| 442 | else if (dev->decoder == PHILIPS1) |
| 443 | pms_i2c_write(dev, 0x42, 0x11, chroma); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 444 | } |
| 445 | |
| 446 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 447 | static void pms_spacialcompl(struct pms *dev, short data) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 448 | { |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 449 | mvv_write(dev, 0x3b, data); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 450 | } |
| 451 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 452 | static void pms_spacialcomph(struct pms *dev, short data) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 453 | { |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 454 | mvv_write(dev, 0x3a, data); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 455 | } |
| 456 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 457 | static void pms_vstart(struct pms *dev, short start) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 458 | { |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 459 | mvv_write(dev, 0x16, start); |
| 460 | mvv_write(dev, 0x17, (start >> 8) & 0x01); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 461 | } |
| 462 | |
| 463 | #endif |
| 464 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 465 | static void pms_secamcross(struct pms *dev, short cross) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 466 | { |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 467 | if (dev->decoder == PHILIPS2) |
| 468 | pms_i2c_andor(dev, 0x8a, 0x0f, 0xdf, (cross & 1) << 5); |
| 469 | else if (dev->decoder == PHILIPS1) |
| 470 | pms_i2c_andor(dev, 0x42, 0x0f, 0xdf, (cross & 1) << 5); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 471 | } |
| 472 | |
| 473 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 474 | static void pms_swsense(struct pms *dev, short sense) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 475 | { |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 476 | if (dev->decoder == PHILIPS2) { |
| 477 | pms_i2c_write(dev, 0x8a, 0x0a, sense); |
| 478 | pms_i2c_write(dev, 0x8a, 0x0b, sense); |
| 479 | } else if (dev->decoder == PHILIPS1) { |
| 480 | pms_i2c_write(dev, 0x42, 0x0a, sense); |
| 481 | pms_i2c_write(dev, 0x42, 0x0b, sense); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 482 | } |
| 483 | } |
| 484 | |
| 485 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 486 | static void pms_framerate(struct pms *dev, short frr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 487 | { |
Hans Verkuil | feba2f8 | 2009-11-25 12:47:02 -0300 | [diff] [blame] | 488 | int fps = (dev->std & V4L2_STD_525_60) ? 30 : 25; |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 489 | |
| 490 | if (frr == 0) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 491 | return; |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 492 | fps = fps/frr; |
| 493 | mvv_write(dev, 0x14, 0x80 | fps); |
| 494 | mvv_write(dev, 0x15, 1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 495 | } |
| 496 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 497 | static void pms_vert(struct pms *dev, u8 deciden, u8 decinum) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 498 | { |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 499 | mvv_write(dev, 0x1c, deciden); /* Denominator */ |
| 500 | mvv_write(dev, 0x1d, decinum); /* Numerator */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 501 | } |
| 502 | |
| 503 | /* |
| 504 | * Turn 16bit ratios into best small ratio the chipset can grok |
| 505 | */ |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 506 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 507 | static void pms_vertdeci(struct pms *dev, unsigned short decinum, unsigned short deciden) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 508 | { |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 509 | /* Knock it down by / 5 once */ |
| 510 | if (decinum % 5 == 0) { |
| 511 | deciden /= 5; |
| 512 | decinum /= 5; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 513 | } |
| 514 | /* |
| 515 | * 3's |
| 516 | */ |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 517 | while (decinum % 3 == 0 && deciden % 3 == 0) { |
| 518 | deciden /= 3; |
| 519 | decinum /= 3; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 520 | } |
| 521 | /* |
| 522 | * 2's |
| 523 | */ |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 524 | while (decinum % 2 == 0 && deciden % 2 == 0) { |
| 525 | decinum /= 2; |
| 526 | deciden /= 2; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 527 | } |
| 528 | /* |
| 529 | * Fudgyify |
| 530 | */ |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 531 | while (deciden > 32) { |
| 532 | deciden /= 2; |
| 533 | decinum = (decinum + 1) / 2; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 534 | } |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 535 | if (deciden == 32) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 536 | deciden--; |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 537 | pms_vert(dev, deciden, decinum); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 538 | } |
| 539 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 540 | static void pms_horzdeci(struct pms *dev, short decinum, short deciden) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 541 | { |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 542 | if (decinum <= 512) { |
| 543 | if (decinum % 5 == 0) { |
| 544 | decinum /= 5; |
| 545 | deciden /= 5; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 546 | } |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 547 | } else { |
| 548 | decinum = 512; |
| 549 | deciden = 640; /* 768 would be ideal */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 550 | } |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 551 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 552 | while (((decinum | deciden) & 1) == 0) { |
| 553 | decinum >>= 1; |
| 554 | deciden >>= 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 555 | } |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 556 | while (deciden > 32) { |
| 557 | deciden >>= 1; |
| 558 | decinum = (decinum + 1) >> 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 559 | } |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 560 | if (deciden == 32) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 561 | deciden--; |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 562 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 563 | mvv_write(dev, 0x24, 0x80 | deciden); |
| 564 | mvv_write(dev, 0x25, decinum); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 565 | } |
| 566 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 567 | static void pms_resolution(struct pms *dev, short width, short height) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 568 | { |
| 569 | int fg_height; |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 570 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 571 | fg_height = height; |
| 572 | if (fg_height > 280) |
| 573 | fg_height = 280; |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 574 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 575 | mvv_write(dev, 0x18, fg_height); |
| 576 | mvv_write(dev, 0x19, fg_height >> 8); |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 577 | |
Hans Verkuil | feba2f8 | 2009-11-25 12:47:02 -0300 | [diff] [blame] | 578 | if (dev->std & V4L2_STD_525_60) { |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 579 | mvv_write(dev, 0x1a, 0xfc); |
| 580 | mvv_write(dev, 0x1b, 0x00); |
| 581 | if (height > fg_height) |
| 582 | pms_vertdeci(dev, 240, 240); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 583 | else |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 584 | pms_vertdeci(dev, fg_height, 240); |
| 585 | } else { |
| 586 | mvv_write(dev, 0x1a, 0x1a); |
| 587 | mvv_write(dev, 0x1b, 0x01); |
| 588 | if (fg_height > 256) |
| 589 | pms_vertdeci(dev, 270, 270); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 590 | else |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 591 | pms_vertdeci(dev, fg_height, 270); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 592 | } |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 593 | mvv_write(dev, 0x12, 0); |
| 594 | mvv_write(dev, 0x13, MVVMEMORYWIDTH); |
| 595 | mvv_write(dev, 0x42, 0x00); |
| 596 | mvv_write(dev, 0x43, 0x00); |
| 597 | mvv_write(dev, 0x44, MVVMEMORYWIDTH); |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 598 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 599 | mvv_write(dev, 0x22, width + 8); |
| 600 | mvv_write(dev, 0x23, (width + 8) >> 8); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 601 | |
Hans Verkuil | feba2f8 | 2009-11-25 12:47:02 -0300 | [diff] [blame] | 602 | if (dev->std & V4L2_STD_525_60) |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 603 | pms_horzdeci(dev, width, 640); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 604 | else |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 605 | pms_horzdeci(dev, width + 8, 768); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 606 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 607 | mvv_write(dev, 0x30, mvv_read(dev, 0x30) & 0xfe); |
| 608 | mvv_write(dev, 0x08, mvv_read(dev, 0x08) | 0x01); |
| 609 | mvv_write(dev, 0x01, mvv_read(dev, 0x01) & 0xfd); |
| 610 | mvv_write(dev, 0x32, 0x00); |
| 611 | mvv_write(dev, 0x33, MVVMEMORYWIDTH); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 612 | } |
| 613 | |
| 614 | |
| 615 | /* |
| 616 | * Set Input |
| 617 | */ |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 618 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 619 | static void pms_vcrinput(struct pms *dev, short input) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 620 | { |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 621 | if (dev->decoder == PHILIPS2) |
| 622 | pms_i2c_andor(dev, 0x8a, 0x0d, 0x7f, (input & 1) << 7); |
| 623 | else if (dev->decoder == PHILIPS1) |
| 624 | pms_i2c_andor(dev, 0x42, 0x0d, 0x7f, (input & 1) << 7); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 625 | } |
| 626 | |
| 627 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 628 | static int pms_capture(struct pms *dev, char __user *buf, int rgb555, int count) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 629 | { |
| 630 | int y; |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 631 | int dw = 2 * dev->width; |
| 632 | char tmp[dw + 32]; /* using a temp buffer is faster than direct */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 633 | int cnt = 0; |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 634 | int len = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 635 | unsigned char r8 = 0x5; /* value for reg8 */ |
| 636 | |
| 637 | if (rgb555) |
| 638 | r8 |= 0x20; /* else use untranslated rgb = 565 */ |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 639 | mvv_write(dev, 0x08, r8); /* capture rgb555/565, init DRAM, PC enable */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 640 | |
| 641 | /* printf("%d %d %d %d %d %x %x\n",width,height,voff,nom,den,mvv_buf); */ |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 642 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 643 | for (y = 0; y < dev->height; y++) { |
| 644 | writeb(0, dev->mem); /* synchronisiert neue Zeile */ |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 645 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 646 | /* |
| 647 | * This is in truth a fifo, be very careful as if you |
| 648 | * forgot this odd things will occur 8) |
| 649 | */ |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 650 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 651 | memcpy_fromio(tmp, dev->mem, dw + 32); /* discard 16 word */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 652 | cnt -= dev->height; |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 653 | while (cnt <= 0) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 654 | /* |
| 655 | * Don't copy too far |
| 656 | */ |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 657 | int dt = dw; |
| 658 | if (dt + len > count) |
| 659 | dt = count - len; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 660 | cnt += dev->height; |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 661 | if (copy_to_user(buf, tmp + 32, dt)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 662 | return len ? len : -EFAULT; |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 663 | buf += dt; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 664 | len += dt; |
| 665 | } |
| 666 | } |
| 667 | return len; |
| 668 | } |
| 669 | |
| 670 | |
| 671 | /* |
| 672 | * Video4linux interfacing |
| 673 | */ |
| 674 | |
Hans Verkuil | feba2f8 | 2009-11-25 12:47:02 -0300 | [diff] [blame] | 675 | static int pms_querycap(struct file *file, void *priv, |
| 676 | struct v4l2_capability *vcap) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 677 | { |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 678 | struct pms *dev = video_drvdata(file); |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 679 | |
Hans Verkuil | feba2f8 | 2009-11-25 12:47:02 -0300 | [diff] [blame] | 680 | strlcpy(vcap->driver, dev->v4l2_dev.name, sizeof(vcap->driver)); |
| 681 | strlcpy(vcap->card, "Mediavision PMS", sizeof(vcap->card)); |
Hans Verkuil | 4b25524 | 2012-05-06 10:41:54 -0300 | [diff] [blame] | 682 | snprintf(vcap->bus_info, sizeof(vcap->bus_info), |
| 683 | "ISA:%s", dev->v4l2_dev.name); |
| 684 | vcap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE; |
| 685 | vcap->capabilities = vcap->device_caps | V4L2_CAP_DEVICE_CAPS; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 686 | return 0; |
| 687 | } |
| 688 | |
Hans Verkuil | feba2f8 | 2009-11-25 12:47:02 -0300 | [diff] [blame] | 689 | static int pms_enum_input(struct file *file, void *fh, struct v4l2_input *vin) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 690 | { |
Hans Verkuil | feba2f8 | 2009-11-25 12:47:02 -0300 | [diff] [blame] | 691 | static const char *inputs[4] = { |
| 692 | "Composite", |
| 693 | "S-Video", |
| 694 | "Composite (VCR)", |
| 695 | "S-Video (VCR)" |
| 696 | }; |
| 697 | |
| 698 | if (vin->index > 3) |
| 699 | return -EINVAL; |
| 700 | strlcpy(vin->name, inputs[vin->index], sizeof(vin->name)); |
| 701 | vin->type = V4L2_INPUT_TYPE_CAMERA; |
| 702 | vin->audioset = 0; |
| 703 | vin->tuner = 0; |
| 704 | vin->std = V4L2_STD_ALL; |
| 705 | vin->status = 0; |
| 706 | return 0; |
| 707 | } |
| 708 | |
| 709 | static int pms_g_input(struct file *file, void *fh, unsigned int *inp) |
| 710 | { |
| 711 | struct pms *dev = video_drvdata(file); |
| 712 | |
| 713 | *inp = dev->input; |
| 714 | return 0; |
| 715 | } |
| 716 | |
| 717 | static int pms_s_input(struct file *file, void *fh, unsigned int inp) |
| 718 | { |
| 719 | struct pms *dev = video_drvdata(file); |
| 720 | |
| 721 | if (inp > 3) |
| 722 | return -EINVAL; |
| 723 | |
Hans Verkuil | feba2f8 | 2009-11-25 12:47:02 -0300 | [diff] [blame] | 724 | dev->input = inp; |
| 725 | pms_videosource(dev, inp & 1); |
| 726 | pms_vcrinput(dev, inp >> 1); |
Hans Verkuil | feba2f8 | 2009-11-25 12:47:02 -0300 | [diff] [blame] | 727 | return 0; |
| 728 | } |
| 729 | |
| 730 | static int pms_g_std(struct file *file, void *fh, v4l2_std_id *std) |
| 731 | { |
| 732 | struct pms *dev = video_drvdata(file); |
| 733 | |
| 734 | *std = dev->std; |
| 735 | return 0; |
| 736 | } |
| 737 | |
Hans Verkuil | 314527a | 2013-03-15 06:10:40 -0300 | [diff] [blame] | 738 | static int pms_s_std(struct file *file, void *fh, v4l2_std_id std) |
Hans Verkuil | feba2f8 | 2009-11-25 12:47:02 -0300 | [diff] [blame] | 739 | { |
| 740 | struct pms *dev = video_drvdata(file); |
| 741 | int ret = 0; |
| 742 | |
Hans Verkuil | 314527a | 2013-03-15 06:10:40 -0300 | [diff] [blame] | 743 | dev->std = std; |
Hans Verkuil | feba2f8 | 2009-11-25 12:47:02 -0300 | [diff] [blame] | 744 | if (dev->std & V4L2_STD_NTSC) { |
| 745 | pms_framerate(dev, 30); |
| 746 | pms_secamcross(dev, 0); |
| 747 | pms_format(dev, 1); |
| 748 | } else if (dev->std & V4L2_STD_PAL) { |
| 749 | pms_framerate(dev, 25); |
| 750 | pms_secamcross(dev, 0); |
| 751 | pms_format(dev, 2); |
| 752 | } else if (dev->std & V4L2_STD_SECAM) { |
| 753 | pms_framerate(dev, 25); |
| 754 | pms_secamcross(dev, 1); |
| 755 | pms_format(dev, 2); |
| 756 | } else { |
| 757 | ret = -EINVAL; |
| 758 | } |
| 759 | /* |
| 760 | switch (v->mode) { |
| 761 | case VIDEO_MODE_AUTO: |
| 762 | pms_framerate(dev, 25); |
| 763 | pms_secamcross(dev, 0); |
| 764 | pms_format(dev, 0); |
| 765 | break; |
| 766 | }*/ |
Hans Verkuil | feba2f8 | 2009-11-25 12:47:02 -0300 | [diff] [blame] | 767 | return ret; |
| 768 | } |
| 769 | |
Hans Verkuil | 4b25524 | 2012-05-06 10:41:54 -0300 | [diff] [blame] | 770 | static int pms_s_ctrl(struct v4l2_ctrl *ctrl) |
Hans Verkuil | feba2f8 | 2009-11-25 12:47:02 -0300 | [diff] [blame] | 771 | { |
Hans Verkuil | 4b25524 | 2012-05-06 10:41:54 -0300 | [diff] [blame] | 772 | struct pms *dev = container_of(ctrl->handler, struct pms, hdl); |
Hans Verkuil | feba2f8 | 2009-11-25 12:47:02 -0300 | [diff] [blame] | 773 | int ret = 0; |
| 774 | |
Hans Verkuil | feba2f8 | 2009-11-25 12:47:02 -0300 | [diff] [blame] | 775 | switch (ctrl->id) { |
| 776 | case V4L2_CID_BRIGHTNESS: |
Hans Verkuil | 4b25524 | 2012-05-06 10:41:54 -0300 | [diff] [blame] | 777 | pms_brightness(dev, ctrl->val); |
Hans Verkuil | feba2f8 | 2009-11-25 12:47:02 -0300 | [diff] [blame] | 778 | break; |
| 779 | case V4L2_CID_CONTRAST: |
Hans Verkuil | 4b25524 | 2012-05-06 10:41:54 -0300 | [diff] [blame] | 780 | pms_contrast(dev, ctrl->val); |
Hans Verkuil | feba2f8 | 2009-11-25 12:47:02 -0300 | [diff] [blame] | 781 | break; |
| 782 | case V4L2_CID_SATURATION: |
Hans Verkuil | 4b25524 | 2012-05-06 10:41:54 -0300 | [diff] [blame] | 783 | pms_saturation(dev, ctrl->val); |
Hans Verkuil | feba2f8 | 2009-11-25 12:47:02 -0300 | [diff] [blame] | 784 | break; |
| 785 | case V4L2_CID_HUE: |
Hans Verkuil | 4b25524 | 2012-05-06 10:41:54 -0300 | [diff] [blame] | 786 | pms_hue(dev, ctrl->val); |
Hans Verkuil | feba2f8 | 2009-11-25 12:47:02 -0300 | [diff] [blame] | 787 | break; |
| 788 | default: |
| 789 | ret = -EINVAL; |
| 790 | break; |
| 791 | } |
Hans Verkuil | feba2f8 | 2009-11-25 12:47:02 -0300 | [diff] [blame] | 792 | return ret; |
| 793 | } |
| 794 | |
| 795 | static int pms_g_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *fmt) |
| 796 | { |
| 797 | struct pms *dev = video_drvdata(file); |
| 798 | struct v4l2_pix_format *pix = &fmt->fmt.pix; |
| 799 | |
| 800 | pix->width = dev->width; |
| 801 | pix->height = dev->height; |
| 802 | pix->pixelformat = dev->width == 15 ? |
| 803 | V4L2_PIX_FMT_RGB555 : V4L2_PIX_FMT_RGB565; |
| 804 | pix->field = V4L2_FIELD_NONE; |
| 805 | pix->bytesperline = 2 * dev->width; |
| 806 | pix->sizeimage = 2 * dev->width * dev->height; |
| 807 | /* Just a guess */ |
| 808 | pix->colorspace = V4L2_COLORSPACE_SRGB; |
| 809 | return 0; |
| 810 | } |
| 811 | |
| 812 | static int pms_try_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *fmt) |
| 813 | { |
| 814 | struct v4l2_pix_format *pix = &fmt->fmt.pix; |
| 815 | |
| 816 | if (pix->height < 16 || pix->height > 480) |
| 817 | return -EINVAL; |
| 818 | if (pix->width < 16 || pix->width > 640) |
| 819 | return -EINVAL; |
| 820 | if (pix->pixelformat != V4L2_PIX_FMT_RGB555 && |
| 821 | pix->pixelformat != V4L2_PIX_FMT_RGB565) |
| 822 | return -EINVAL; |
| 823 | pix->field = V4L2_FIELD_NONE; |
| 824 | pix->bytesperline = 2 * pix->width; |
| 825 | pix->sizeimage = 2 * pix->width * pix->height; |
| 826 | /* Just a guess */ |
| 827 | pix->colorspace = V4L2_COLORSPACE_SRGB; |
| 828 | return 0; |
| 829 | } |
| 830 | |
| 831 | static int pms_s_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *fmt) |
| 832 | { |
| 833 | struct pms *dev = video_drvdata(file); |
| 834 | struct v4l2_pix_format *pix = &fmt->fmt.pix; |
| 835 | int ret = pms_try_fmt_vid_cap(file, fh, fmt); |
| 836 | |
| 837 | if (ret) |
| 838 | return ret; |
Hans Verkuil | feba2f8 | 2009-11-25 12:47:02 -0300 | [diff] [blame] | 839 | dev->width = pix->width; |
| 840 | dev->height = pix->height; |
| 841 | dev->depth = (pix->pixelformat == V4L2_PIX_FMT_RGB555) ? 15 : 16; |
| 842 | pms_resolution(dev, dev->width, dev->height); |
| 843 | /* Ok we figured out what to use from our wide choice */ |
Hans Verkuil | feba2f8 | 2009-11-25 12:47:02 -0300 | [diff] [blame] | 844 | return 0; |
| 845 | } |
| 846 | |
| 847 | static int pms_enum_fmt_vid_cap(struct file *file, void *fh, struct v4l2_fmtdesc *fmt) |
| 848 | { |
| 849 | static struct v4l2_fmtdesc formats[] = { |
| 850 | { 0, 0, 0, |
| 851 | "RGB 5:5:5", V4L2_PIX_FMT_RGB555, |
| 852 | { 0, 0, 0, 0 } |
| 853 | }, |
Hans Verkuil | 4b25524 | 2012-05-06 10:41:54 -0300 | [diff] [blame] | 854 | { 1, 0, 0, |
Hans Verkuil | feba2f8 | 2009-11-25 12:47:02 -0300 | [diff] [blame] | 855 | "RGB 5:6:5", V4L2_PIX_FMT_RGB565, |
| 856 | { 0, 0, 0, 0 } |
| 857 | }, |
| 858 | }; |
| 859 | enum v4l2_buf_type type = fmt->type; |
| 860 | |
| 861 | if (fmt->index > 1) |
| 862 | return -EINVAL; |
| 863 | |
| 864 | *fmt = formats[fmt->index]; |
| 865 | fmt->type = type; |
| 866 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 867 | } |
| 868 | |
| 869 | static ssize_t pms_read(struct file *file, char __user *buf, |
| 870 | size_t count, loff_t *ppos) |
| 871 | { |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 872 | struct pms *dev = video_drvdata(file); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 873 | int len; |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 874 | |
Hans Verkuil | feba2f8 | 2009-11-25 12:47:02 -0300 | [diff] [blame] | 875 | len = pms_capture(dev, buf, (dev->depth == 15), count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 876 | return len; |
| 877 | } |
| 878 | |
Hans Verkuil | 4b25524 | 2012-05-06 10:41:54 -0300 | [diff] [blame] | 879 | static unsigned int pms_poll(struct file *file, struct poll_table_struct *wait) |
| 880 | { |
| 881 | struct v4l2_fh *fh = file->private_data; |
| 882 | unsigned int res = POLLIN | POLLRDNORM; |
| 883 | |
| 884 | if (v4l2_event_pending(fh)) |
| 885 | res |= POLLPRI; |
| 886 | poll_wait(file, &fh->wait, wait); |
| 887 | return res; |
| 888 | } |
| 889 | |
Hans Verkuil | bec4366 | 2008-12-30 06:58:20 -0300 | [diff] [blame] | 890 | static const struct v4l2_file_operations pms_fops = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 891 | .owner = THIS_MODULE, |
Hans Verkuil | 4b25524 | 2012-05-06 10:41:54 -0300 | [diff] [blame] | 892 | .open = v4l2_fh_open, |
| 893 | .release = v4l2_fh_release, |
| 894 | .poll = pms_poll, |
Hans Verkuil | 61df3c9 | 2010-11-14 10:09:38 -0300 | [diff] [blame] | 895 | .unlocked_ioctl = video_ioctl2, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 896 | .read = pms_read, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 897 | }; |
| 898 | |
Hans Verkuil | feba2f8 | 2009-11-25 12:47:02 -0300 | [diff] [blame] | 899 | static const struct v4l2_ioctl_ops pms_ioctl_ops = { |
Hans Verkuil | 4b25524 | 2012-05-06 10:41:54 -0300 | [diff] [blame] | 900 | .vidioc_querycap = pms_querycap, |
| 901 | .vidioc_g_input = pms_g_input, |
| 902 | .vidioc_s_input = pms_s_input, |
| 903 | .vidioc_enum_input = pms_enum_input, |
| 904 | .vidioc_g_std = pms_g_std, |
| 905 | .vidioc_s_std = pms_s_std, |
| 906 | .vidioc_enum_fmt_vid_cap = pms_enum_fmt_vid_cap, |
| 907 | .vidioc_g_fmt_vid_cap = pms_g_fmt_vid_cap, |
| 908 | .vidioc_s_fmt_vid_cap = pms_s_fmt_vid_cap, |
| 909 | .vidioc_try_fmt_vid_cap = pms_try_fmt_vid_cap, |
| 910 | .vidioc_subscribe_event = v4l2_ctrl_subscribe_event, |
| 911 | .vidioc_unsubscribe_event = v4l2_event_unsubscribe, |
Hans Verkuil | feba2f8 | 2009-11-25 12:47:02 -0300 | [diff] [blame] | 912 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 913 | |
| 914 | /* |
| 915 | * Probe for and initialise the Mediavision PMS |
| 916 | */ |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 917 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 918 | static int init_mediavision(struct pms *dev) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 919 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 920 | int idec, decst; |
| 921 | int i; |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 922 | static const unsigned char i2c_defs[] = { |
| 923 | 0x4c, 0x30, 0x00, 0xe8, |
| 924 | 0xb6, 0xe2, 0x00, 0x00, |
| 925 | 0xff, 0xff, 0x00, 0x00, |
| 926 | 0x00, 0x00, 0x78, 0x98, |
| 927 | 0x00, 0x00, 0x00, 0x00, |
| 928 | 0x34, 0x0a, 0xf4, 0xce, |
| 929 | 0xe4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 930 | }; |
| 931 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 932 | dev->mem = ioremap(mem_base, 0x800); |
| 933 | if (!dev->mem) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 934 | return -ENOMEM; |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 935 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 936 | if (!request_region(0x9a01, 1, "Mediavision PMS config")) { |
| 937 | printk(KERN_WARNING "mediavision: unable to detect: 0x9a01 in use.\n"); |
| 938 | iounmap(dev->mem); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 939 | return -EBUSY; |
| 940 | } |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 941 | if (!request_region(dev->io, 3, "Mediavision PMS")) { |
| 942 | printk(KERN_WARNING "mediavision: I/O port %d in use.\n", dev->io); |
| 943 | release_region(0x9a01, 1); |
| 944 | iounmap(dev->mem); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 945 | return -EBUSY; |
| 946 | } |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 947 | outb(0xb8, 0x9a01); /* Unlock */ |
| 948 | outb(dev->io >> 4, 0x9a01); /* Set IO port */ |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 949 | |
| 950 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 951 | decst = pms_i2c_stat(dev, 0x43); |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 952 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 953 | if (decst != -1) |
| 954 | idec = 2; |
| 955 | else if (pms_i2c_stat(dev, 0xb9) != -1) |
| 956 | idec = 3; |
| 957 | else if (pms_i2c_stat(dev, 0x8b) != -1) |
| 958 | idec = 1; |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 959 | else |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 960 | idec = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 961 | |
| 962 | printk(KERN_INFO "PMS type is %d\n", idec); |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 963 | if (idec == 0) { |
| 964 | release_region(dev->io, 3); |
| 965 | release_region(0x9a01, 1); |
| 966 | iounmap(dev->mem); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 967 | return -ENODEV; |
| 968 | } |
| 969 | |
| 970 | /* |
| 971 | * Ok we have a PMS of some sort |
| 972 | */ |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 973 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 974 | mvv_write(dev, 0x04, mem_base >> 12); /* Set the memory area */ |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 975 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 976 | /* Ok now load the defaults */ |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 977 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 978 | for (i = 0; i < 0x19; i++) { |
| 979 | if (i2c_defs[i] == 0xff) |
| 980 | pms_i2c_andor(dev, 0x8a, i, 0x07, 0x00); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 981 | else |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 982 | pms_i2c_write(dev, 0x8a, i, i2c_defs[i]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 983 | } |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 984 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 985 | pms_i2c_write(dev, 0xb8, 0x00, 0x12); |
| 986 | pms_i2c_write(dev, 0xb8, 0x04, 0x00); |
| 987 | pms_i2c_write(dev, 0xb8, 0x07, 0x00); |
| 988 | pms_i2c_write(dev, 0xb8, 0x08, 0x00); |
| 989 | pms_i2c_write(dev, 0xb8, 0x09, 0xff); |
| 990 | pms_i2c_write(dev, 0xb8, 0x0a, 0x00); |
| 991 | pms_i2c_write(dev, 0xb8, 0x0b, 0x10); |
| 992 | pms_i2c_write(dev, 0xb8, 0x10, 0x03); |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 993 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 994 | mvv_write(dev, 0x01, 0x00); |
| 995 | mvv_write(dev, 0x05, 0xa0); |
| 996 | mvv_write(dev, 0x08, 0x25); |
| 997 | mvv_write(dev, 0x09, 0x00); |
| 998 | mvv_write(dev, 0x0a, 0x20 | MVVMEMORYWIDTH); |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 999 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 1000 | mvv_write(dev, 0x10, 0x02); |
| 1001 | mvv_write(dev, 0x1e, 0x0c); |
| 1002 | mvv_write(dev, 0x1f, 0x03); |
| 1003 | mvv_write(dev, 0x26, 0x06); |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 1004 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 1005 | mvv_write(dev, 0x2b, 0x00); |
| 1006 | mvv_write(dev, 0x2c, 0x20); |
| 1007 | mvv_write(dev, 0x2d, 0x00); |
| 1008 | mvv_write(dev, 0x2f, 0x70); |
| 1009 | mvv_write(dev, 0x32, 0x00); |
| 1010 | mvv_write(dev, 0x33, MVVMEMORYWIDTH); |
| 1011 | mvv_write(dev, 0x34, 0x00); |
| 1012 | mvv_write(dev, 0x35, 0x00); |
| 1013 | mvv_write(dev, 0x3a, 0x80); |
| 1014 | mvv_write(dev, 0x3b, 0x10); |
| 1015 | mvv_write(dev, 0x20, 0x00); |
| 1016 | mvv_write(dev, 0x21, 0x00); |
| 1017 | mvv_write(dev, 0x30, 0x22); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1018 | return 0; |
| 1019 | } |
| 1020 | |
| 1021 | /* |
| 1022 | * Initialization and module stuff |
| 1023 | */ |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 1024 | |
Rene Herman | b54ff93 | 2008-09-03 16:48:21 -0300 | [diff] [blame] | 1025 | #ifndef MODULE |
| 1026 | static int enable; |
| 1027 | module_param(enable, int, 0); |
| 1028 | #endif |
| 1029 | |
Hans Verkuil | 4b25524 | 2012-05-06 10:41:54 -0300 | [diff] [blame] | 1030 | static const struct v4l2_ctrl_ops pms_ctrl_ops = { |
| 1031 | .s_ctrl = pms_s_ctrl, |
| 1032 | }; |
| 1033 | |
| 1034 | static int pms_probe(struct device *pdev, unsigned int card) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1035 | { |
Hans Verkuil | 4b25524 | 2012-05-06 10:41:54 -0300 | [diff] [blame] | 1036 | struct pms *dev; |
| 1037 | struct v4l2_device *v4l2_dev; |
| 1038 | struct v4l2_ctrl_handler *hdl; |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 1039 | int res; |
| 1040 | |
Rene Herman | b54ff93 | 2008-09-03 16:48:21 -0300 | [diff] [blame] | 1041 | #ifndef MODULE |
| 1042 | if (!enable) { |
Hans Verkuil | 4b25524 | 2012-05-06 10:41:54 -0300 | [diff] [blame] | 1043 | pr_err("PMS: not enabled, use pms.enable=1 to probe\n"); |
Rene Herman | b54ff93 | 2008-09-03 16:48:21 -0300 | [diff] [blame] | 1044 | return -ENODEV; |
| 1045 | } |
| 1046 | #endif |
| 1047 | |
Hans Verkuil | 4b25524 | 2012-05-06 10:41:54 -0300 | [diff] [blame] | 1048 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
| 1049 | if (dev == NULL) |
| 1050 | return -ENOMEM; |
| 1051 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 1052 | dev->decoder = PHILIPS2; |
| 1053 | dev->io = io_port; |
| 1054 | dev->data = io_port + 1; |
Hans Verkuil | 4b25524 | 2012-05-06 10:41:54 -0300 | [diff] [blame] | 1055 | v4l2_dev = &dev->v4l2_dev; |
| 1056 | hdl = &dev->hdl; |
Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 1057 | |
Hans Verkuil | 4b25524 | 2012-05-06 10:41:54 -0300 | [diff] [blame] | 1058 | res = v4l2_device_register(pdev, v4l2_dev); |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 1059 | if (res < 0) { |
| 1060 | v4l2_err(v4l2_dev, "Could not register v4l2_device\n"); |
Hans Verkuil | 4b25524 | 2012-05-06 10:41:54 -0300 | [diff] [blame] | 1061 | goto free_dev; |
| 1062 | } |
| 1063 | v4l2_info(v4l2_dev, "Mediavision Pro Movie Studio driver 0.05\n"); |
| 1064 | |
| 1065 | res = init_mediavision(dev); |
| 1066 | if (res) { |
| 1067 | v4l2_err(v4l2_dev, "Board not found.\n"); |
| 1068 | goto free_io; |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 1069 | } |
| 1070 | |
Hans Verkuil | 4b25524 | 2012-05-06 10:41:54 -0300 | [diff] [blame] | 1071 | v4l2_ctrl_handler_init(hdl, 4); |
| 1072 | v4l2_ctrl_new_std(hdl, &pms_ctrl_ops, |
| 1073 | V4L2_CID_BRIGHTNESS, 0, 255, 1, 139); |
| 1074 | v4l2_ctrl_new_std(hdl, &pms_ctrl_ops, |
| 1075 | V4L2_CID_CONTRAST, 0, 255, 1, 70); |
| 1076 | v4l2_ctrl_new_std(hdl, &pms_ctrl_ops, |
| 1077 | V4L2_CID_SATURATION, 0, 255, 1, 64); |
| 1078 | v4l2_ctrl_new_std(hdl, &pms_ctrl_ops, |
| 1079 | V4L2_CID_HUE, 0, 255, 1, 0); |
| 1080 | if (hdl->error) { |
| 1081 | res = hdl->error; |
| 1082 | goto free_hdl; |
| 1083 | } |
| 1084 | |
| 1085 | mutex_init(&dev->lock); |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 1086 | strlcpy(dev->vdev.name, v4l2_dev->name, sizeof(dev->vdev.name)); |
| 1087 | dev->vdev.v4l2_dev = v4l2_dev; |
Hans Verkuil | 4b25524 | 2012-05-06 10:41:54 -0300 | [diff] [blame] | 1088 | dev->vdev.ctrl_handler = hdl; |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 1089 | dev->vdev.fops = &pms_fops; |
Hans Verkuil | feba2f8 | 2009-11-25 12:47:02 -0300 | [diff] [blame] | 1090 | dev->vdev.ioctl_ops = &pms_ioctl_ops; |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 1091 | dev->vdev.release = video_device_release_empty; |
Hans Verkuil | 4b25524 | 2012-05-06 10:41:54 -0300 | [diff] [blame] | 1092 | dev->vdev.lock = &dev->lock; |
| 1093 | dev->vdev.tvnorms = V4L2_STD_NTSC | V4L2_STD_PAL | V4L2_STD_SECAM; |
| 1094 | set_bit(V4L2_FL_USE_FH_PRIO, &dev->vdev.flags); |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 1095 | video_set_drvdata(&dev->vdev, dev); |
Hans Verkuil | feba2f8 | 2009-11-25 12:47:02 -0300 | [diff] [blame] | 1096 | dev->std = V4L2_STD_NTSC_M; |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 1097 | dev->height = 240; |
| 1098 | dev->width = 320; |
Hans Verkuil | 4b25524 | 2012-05-06 10:41:54 -0300 | [diff] [blame] | 1099 | dev->depth = 16; |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 1100 | pms_swsense(dev, 75); |
| 1101 | pms_resolution(dev, 320, 240); |
| 1102 | pms_videosource(dev, 0); |
| 1103 | pms_vcrinput(dev, 0); |
Hans Verkuil | 4b25524 | 2012-05-06 10:41:54 -0300 | [diff] [blame] | 1104 | v4l2_ctrl_handler_setup(hdl); |
| 1105 | res = video_register_device(&dev->vdev, VFL_TYPE_GRABBER, video_nr); |
| 1106 | if (res >= 0) |
| 1107 | return 0; |
| 1108 | |
| 1109 | free_hdl: |
| 1110 | v4l2_ctrl_handler_free(hdl); |
| 1111 | v4l2_device_unregister(&dev->v4l2_dev); |
| 1112 | free_io: |
| 1113 | release_region(dev->io, 3); |
| 1114 | release_region(0x9a01, 1); |
| 1115 | iounmap(dev->mem); |
| 1116 | free_dev: |
| 1117 | kfree(dev); |
| 1118 | return res; |
| 1119 | } |
| 1120 | |
| 1121 | static int pms_remove(struct device *pdev, unsigned int card) |
| 1122 | { |
| 1123 | struct pms *dev = dev_get_drvdata(pdev); |
| 1124 | |
| 1125 | video_unregister_device(&dev->vdev); |
| 1126 | v4l2_ctrl_handler_free(&dev->hdl); |
| 1127 | release_region(dev->io, 3); |
| 1128 | release_region(0x9a01, 1); |
| 1129 | iounmap(dev->mem); |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 1130 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1131 | } |
| 1132 | |
Hans Verkuil | 4b25524 | 2012-05-06 10:41:54 -0300 | [diff] [blame] | 1133 | static struct isa_driver pms_driver = { |
| 1134 | .probe = pms_probe, |
| 1135 | .remove = pms_remove, |
| 1136 | .driver = { |
| 1137 | .name = "pms", |
| 1138 | }, |
| 1139 | }; |
| 1140 | |
| 1141 | static int __init pms_init(void) |
| 1142 | { |
| 1143 | return isa_register_driver(&pms_driver, 1); |
| 1144 | } |
| 1145 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 1146 | static void __exit pms_exit(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1147 | { |
Hans Verkuil | 4b25524 | 2012-05-06 10:41:54 -0300 | [diff] [blame] | 1148 | isa_unregister_driver(&pms_driver); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1149 | } |
| 1150 | |
Hans Verkuil | 1ce7981 | 2009-11-25 12:37:00 -0300 | [diff] [blame] | 1151 | module_init(pms_init); |
| 1152 | module_exit(pms_exit); |