18 #include <linux/module.h>
20 #include <linux/i2c.h>
21 #include <linux/videodev2.h>
23 #include <linux/slab.h>
35 static u8 initial_registers[] =
194 for (i = 0; regs[
i] != 0x00; i += 2)
200 static int wis_saa7115_command(
struct i2c_client *client,
201 unsigned int cmd,
void *
arg)
203 struct wis_saa7115 *dec = i2c_get_clientdata(client);
212 *input < 6 ? 0x40 : 0xC0);
219 int h_integer_scaler = res->
width < 704 ? 704 / res->
width : 1;
221 int h_scaling_increment = (704 / h_integer_scaler) *
225 240 : 288) * 1024 / res->
height;
228 0x9c, res->
width & 0xff,
229 0x9d, res->
width >> 8,
232 0xa0, h_integer_scaler,
235 0xa8, h_scaling_increment & 0xff,
236 0xa9, h_scaling_increment >> 8,
237 0xac, (h_scaling_increment / 2) & 0xff,
238 0
xad, (h_scaling_increment / 2) >> 8,
239 0xb0, v_scaling_increment & 0xff,
240 0xb1, v_scaling_increment >> 8,
241 0xb2, v_scaling_increment & 0xff,
242 0xb3, v_scaling_increment >> 8,
243 0xcc, res->
width & 0xff,
244 0xcd, res->
width >> 8,
247 0xd0, h_integer_scaler,
250 0xd8, h_scaling_increment & 0xff,
251 0xd9, h_scaling_increment >> 8,
252 0xdc, (h_scaling_increment / 2) & 0xff,
253 0xdd, (h_scaling_increment / 2) >> 8,
254 0xe0, v_scaling_increment & 0xff,
255 0xe1, v_scaling_increment >> 8,
256 0xe2, v_scaling_increment & 0xff,
257 0xe3, v_scaling_increment >> 8,
261 write_regs(client, regs);
280 write_regs(client, regs);
334 if (ctrl->
value > 255)
336 else if (ctrl->
value < 0)
343 if (ctrl->
value > 127)
345 else if (ctrl->
value < 0)
352 if (ctrl->
value > 127)
354 else if (ctrl->
value < 0)
361 if (ctrl->
value > 127)
363 else if (ctrl->
value < -128)
398 static int wis_saa7115_probe(
struct i2c_client *client,
416 i2c_set_clientdata(client, dec);
419 "wis-saa7115: initializing SAA7115 at address %d on %s\n",
422 if (write_regs(client, initial_registers) < 0) {
424 "wis-saa7115: error initializing SAA7115\n");
432 static int wis_saa7115_remove(
struct i2c_client *client)
434 struct wis_saa7115 *dec = i2c_get_clientdata(client);
441 {
"wis_saa7115", 0 },
446 static struct i2c_driver wis_saa7115_driver = {
448 .name =
"WIS SAA7115 I2C driver",
450 .probe = wis_saa7115_probe,
451 .remove = wis_saa7115_remove,
452 .command = wis_saa7115_command,
453 .id_table = wis_saa7115_id,
456 static int __init wis_saa7115_init(
void)
458 return i2c_add_driver(&wis_saa7115_driver);
461 static void __exit wis_saa7115_cleanup(
void)