Use dentry_path() to create full path to inode object
[pohmelfs.git] / drivers / media / video / et61x251 / et61x251_tas5130d1b.c
blobced2e167935d83a3a8410bd371b963320548ca5e
1 /***************************************************************************
2 * Plug-in for TAS5130D1B image sensor connected to the ET61X[12]51 *
3 * PC Camera Controllers *
4 * *
5 * Copyright (C) 2006-2007 by Luca Risolia <luca.risolia@studio.unibo.it> *
6 * *
7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * This program is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU General Public License *
18 * along with this program; if not, write to the Free Software *
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
20 ***************************************************************************/
22 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
24 #include "et61x251_sensor.h"
27 static int tas5130d1b_init(struct et61x251_device* cam)
29 int err = 0;
31 err += et61x251_write_reg(cam, 0x14, 0x01);
32 err += et61x251_write_reg(cam, 0x1b, 0x02);
33 err += et61x251_write_reg(cam, 0x02, 0x12);
34 err += et61x251_write_reg(cam, 0x0e, 0x60);
35 err += et61x251_write_reg(cam, 0x80, 0x61);
36 err += et61x251_write_reg(cam, 0xf0, 0x62);
37 err += et61x251_write_reg(cam, 0x03, 0x63);
38 err += et61x251_write_reg(cam, 0x14, 0x64);
39 err += et61x251_write_reg(cam, 0xf4, 0x65);
40 err += et61x251_write_reg(cam, 0x01, 0x66);
41 err += et61x251_write_reg(cam, 0x05, 0x67);
42 err += et61x251_write_reg(cam, 0x8f, 0x68);
43 err += et61x251_write_reg(cam, 0x0f, 0x8d);
44 err += et61x251_write_reg(cam, 0x08, 0x8e);
46 return err;
50 static int tas5130d1b_set_ctrl(struct et61x251_device* cam,
51 const struct v4l2_control* ctrl)
53 int err = 0;
55 switch (ctrl->id) {
56 case V4L2_CID_GAIN:
57 err += et61x251_i2c_raw_write(cam, 2, 0x20,
58 0xf6-ctrl->value, 0, 0, 0,
59 0, 0, 0, 0);
60 break;
61 case V4L2_CID_EXPOSURE:
62 err += et61x251_i2c_raw_write(cam, 2, 0x40,
63 0x47-ctrl->value, 0, 0, 0,
64 0, 0, 0, 0);
65 break;
66 default:
67 return -EINVAL;
70 return err ? -EIO : 0;
74 static const struct et61x251_sensor tas5130d1b = {
75 .name = "TAS5130D1B",
76 .interface = ET61X251_I2C_3WIRES,
77 .rsta = ET61X251_I2C_RSTA_STOP,
78 .active_pixel = {
79 .left = 106,
80 .top = 13,
82 .init = &tas5130d1b_init,
83 .qctrl = {
85 .id = V4L2_CID_GAIN,
86 .type = V4L2_CTRL_TYPE_INTEGER,
87 .name = "global gain",
88 .minimum = 0x00,
89 .maximum = 0xf6,
90 .step = 0x02,
91 .default_value = 0x0d,
92 .flags = 0,
95 .id = V4L2_CID_EXPOSURE,
96 .type = V4L2_CTRL_TYPE_INTEGER,
97 .name = "exposure",
98 .minimum = 0x00,
99 .maximum = 0x47,
100 .step = 0x01,
101 .default_value = 0x23,
102 .flags = 0,
105 .set_ctrl = &tas5130d1b_set_ctrl,
106 .cropcap = {
107 .bounds = {
108 .left = 0,
109 .top = 0,
110 .width = 640,
111 .height = 480,
113 .defrect = {
114 .left = 0,
115 .top = 0,
116 .width = 640,
117 .height = 480,
120 .pix_format = {
121 .width = 640,
122 .height = 480,
123 .pixelformat = V4L2_PIX_FMT_SBGGR8,
124 .priv = 8,
129 int et61x251_probe_tas5130d1b(struct et61x251_device* cam)
131 const struct usb_device_id tas5130d1b_id_table[] = {
132 { USB_DEVICE(0x102c, 0x6251), },
136 /* Sensor detection is based on USB pid/vid */
137 if (!et61x251_match_id(cam, tas5130d1b_id_table))
138 return -ENODEV;
140 et61x251_attach_sensor(cam, &tas5130d1b);
142 return 0;