18 #include <linux/module.h>
20 #include <linux/i2c.h>
21 #include <linux/videodev2.h>
23 #include <linux/slab.h>
34 static u8 initial_registers[] =
96 for (i = 0; regs[
i] != 0x00; i += 2)
102 static int wis_tw9903_command(
struct i2c_client *client,
103 unsigned int cmd,
void *
arg)
105 struct wis_tw9903 *dec = i2c_get_clientdata(client);
121 int hscale = 256 * 720 / (res->
width - (res->
width > 704 ? 0 : 8));
127 0x0e, ((vscale & 0xf00) >> 4) | ((hscale & 0xf00) >> 8),
147 write_regs(client, regs);
204 if (ctrl->
value > 127)
206 else if (ctrl->
value < -128)
213 if (ctrl->
value > 255)
215 else if (ctrl->
value < 0)
223 if (ctrl->
value > 127)
224 dec->saturation = 127;
225 else if (ctrl->
value < 0)
228 dec->saturation = ctrl->
value;
233 if (ctrl->
value > 127)
235 else if (ctrl->
value < -128)
257 ctrl->
value = dec->saturation;
272 static int wis_tw9903_probe(
struct i2c_client *client,
289 i2c_set_clientdata(client, dec);
292 "wis-tw9903: initializing TW9903 at address %d on %s\n",
295 if (write_regs(client, initial_registers) < 0) {
304 static int wis_tw9903_remove(
struct i2c_client *client)
306 struct wis_tw9903 *dec = i2c_get_clientdata(client);
318 static struct i2c_driver wis_tw9903_driver = {
320 .name =
"WIS TW9903 I2C driver",
322 .probe = wis_tw9903_probe,
323 .remove = wis_tw9903_remove,
324 .command = wis_tw9903_command,
325 .id_table = wis_tw9903_id,
328 static int __init wis_tw9903_init(
void)
330 return i2c_add_driver(&wis_tw9903_driver);
333 static void __exit wis_tw9903_cleanup(
void)