diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2007-12-12 05:34:15 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-01-25 16:04:05 -0500 |
commit | 79f998a71b9bca5a16b0b8c30e5c0c849705a5ec (patch) | |
tree | 57a937fb3b1f804178140ba40d28f6b76f31457e /drivers/media/video/upd64031a.c | |
parent | 8c9fc8de546134d021de58c7ade6f025c9d1da1c (diff) |
V4L/DVB (6864): upd64031a: CodingStyle cleanup
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/upd64031a.c')
-rw-r--r-- | drivers/media/video/upd64031a.c | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/drivers/media/video/upd64031a.c b/drivers/media/video/upd64031a.c index bc8db9943b77..bd201397a2ac 100644 --- a/drivers/media/video/upd64031a.c +++ b/drivers/media/video/upd64031a.c | |||
@@ -31,20 +31,20 @@ | |||
31 | #include <media/v4l2-i2c-drv.h> | 31 | #include <media/v4l2-i2c-drv.h> |
32 | #include <media/upd64031a.h> | 32 | #include <media/upd64031a.h> |
33 | 33 | ||
34 | // --------------------- read registers functions define ----------------------- | 34 | /* --------------------- read registers functions define -------------------- */ |
35 | 35 | ||
36 | /* bit masks */ | 36 | /* bit masks */ |
37 | #define GR_MODE_MASK 0xc0 | 37 | #define GR_MODE_MASK 0xc0 |
38 | #define DIRECT_3DYCS_CONNECT_MASK 0xc0 | 38 | #define DIRECT_3DYCS_CONNECT_MASK 0xc0 |
39 | #define SYNC_CIRCUIT_MASK 0xa0 | 39 | #define SYNC_CIRCUIT_MASK 0xa0 |
40 | 40 | ||
41 | // ----------------------------------------------------------------------------- | 41 | /* -------------------------------------------------------------------------- */ |
42 | 42 | ||
43 | MODULE_DESCRIPTION("uPD64031A driver"); | 43 | MODULE_DESCRIPTION("uPD64031A driver"); |
44 | MODULE_AUTHOR("T. Adachi, Takeru KOMORIYA, Hans Verkuil"); | 44 | MODULE_AUTHOR("T. Adachi, Takeru KOMORIYA, Hans Verkuil"); |
45 | MODULE_LICENSE("GPL"); | 45 | MODULE_LICENSE("GPL"); |
46 | 46 | ||
47 | static int debug = 0; | 47 | static int debug; |
48 | module_param(debug, int, 0644); | 48 | module_param(debug, int, 0644); |
49 | 49 | ||
50 | MODULE_PARM_DESC(debug, "Debug level (0-1)"); | 50 | MODULE_PARM_DESC(debug, "Debug level (0-1)"); |
@@ -96,7 +96,7 @@ static void upd64031a_write(struct i2c_client *client, u8 reg, u8 val) | |||
96 | 96 | ||
97 | buf[0] = reg; | 97 | buf[0] = reg; |
98 | buf[1] = val; | 98 | buf[1] = val; |
99 | v4l_dbg(1, debug, client, "writing reg addr: %02X val: %02X\n", reg, val); | 99 | v4l_dbg(1, debug, client, "write reg: %02X val: %02X\n", reg, val); |
100 | if (i2c_master_send(client, buf, 2) != 2) | 100 | if (i2c_master_send(client, buf, 2) != 2) |
101 | v4l_err(client, "I/O error write 0x%02x/0x%02x\n", reg, val); | 101 | v4l_err(client, "I/O error write 0x%02x/0x%02x\n", reg, val); |
102 | } | 102 | } |
@@ -116,7 +116,7 @@ static void upd64031a_change(struct i2c_client *client) | |||
116 | 116 | ||
117 | /* ------------------------------------------------------------------------ */ | 117 | /* ------------------------------------------------------------------------ */ |
118 | 118 | ||
119 | static int upd64031a_command(struct i2c_client *client, unsigned int cmd, void *arg) | 119 | static int upd64031a_command(struct i2c_client *client, unsigned cmd, void *arg) |
120 | { | 120 | { |
121 | struct upd64031a_state *state = i2c_get_clientdata(client); | 121 | struct upd64031a_state *state = i2c_get_clientdata(client); |
122 | struct v4l2_routing *route = arg; | 122 | struct v4l2_routing *route = arg; |
@@ -140,8 +140,10 @@ static int upd64031a_command(struct i2c_client *client, unsigned int cmd, void * | |||
140 | 140 | ||
141 | state->gr_mode = (route->input & 3) << 6; | 141 | state->gr_mode = (route->input & 3) << 6; |
142 | state->direct_3dycs_connect = (route->input & 0xc) << 4; | 142 | state->direct_3dycs_connect = (route->input & 0xc) << 4; |
143 | state->ext_comp_sync = (route->input & UPD64031A_COMPOSITE_EXTERNAL) << 1; | 143 | state->ext_comp_sync = |
144 | state->ext_vert_sync = (route->input & UPD64031A_VERTICAL_EXTERNAL) << 2; | 144 | (route->input & UPD64031A_COMPOSITE_EXTERNAL) << 1; |
145 | state->ext_vert_sync = | ||
146 | (route->input & UPD64031A_VERTICAL_EXTERNAL) << 2; | ||
145 | r00 = (state->regs[R00] & ~GR_MODE_MASK) | state->gr_mode; | 147 | r00 = (state->regs[R00] & ~GR_MODE_MASK) | state->gr_mode; |
146 | r05 = (state->regs[R00] & ~SYNC_CIRCUIT_MASK) | | 148 | r05 = (state->regs[R00] & ~SYNC_CIRCUIT_MASK) | |
147 | state->ext_comp_sync | state->ext_vert_sync; | 149 | state->ext_comp_sync | state->ext_vert_sync; |
@@ -165,20 +167,23 @@ static int upd64031a_command(struct i2c_client *client, unsigned int cmd, void * | |||
165 | { | 167 | { |
166 | struct v4l2_register *reg = arg; | 168 | struct v4l2_register *reg = arg; |
167 | 169 | ||
168 | if (!v4l2_chip_match_i2c_client(client, reg->match_type, reg->match_chip)) | 170 | if (!v4l2_chip_match_i2c_client(client, |
171 | reg->match_type, reg->match_chip)) | ||
169 | return -EINVAL; | 172 | return -EINVAL; |
170 | if (!capable(CAP_SYS_ADMIN)) | 173 | if (!capable(CAP_SYS_ADMIN)) |
171 | return -EPERM; | 174 | return -EPERM; |
172 | if (cmd == VIDIOC_DBG_G_REGISTER) | 175 | if (cmd == VIDIOC_DBG_G_REGISTER) { |
173 | reg->val = upd64031a_read(client, reg->reg & 0xff); | 176 | reg->val = upd64031a_read(client, reg->reg & 0xff); |
174 | else | 177 | break; |
175 | upd64031a_write(client, reg->reg & 0xff, reg->val & 0xff); | 178 | } |
179 | upd64031a_write(client, reg->reg & 0xff, reg->val & 0xff); | ||
176 | break; | 180 | break; |
177 | } | 181 | } |
178 | #endif | 182 | #endif |
179 | 183 | ||
180 | case VIDIOC_G_CHIP_IDENT: | 184 | case VIDIOC_G_CHIP_IDENT: |
181 | return v4l2_chip_ident_i2c_client(client, arg, V4L2_IDENT_UPD64031A, 0); | 185 | return v4l2_chip_ident_i2c_client(client, arg, |
186 | V4L2_IDENT_UPD64031A, 0); | ||
182 | 187 | ||
183 | default: | 188 | default: |
184 | break; | 189 | break; |
@@ -198,20 +203,19 @@ static int upd64031a_probe(struct i2c_client *client) | |||
198 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 203 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
199 | return -EIO; | 204 | return -EIO; |
200 | 205 | ||
201 | v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); | 206 | v4l_info(client, "chip found @ 0x%x (%s)\n", |
207 | client->addr << 1, client->adapter->name); | ||
202 | 208 | ||
203 | state = kmalloc(sizeof(struct upd64031a_state), GFP_KERNEL); | 209 | state = kmalloc(sizeof(struct upd64031a_state), GFP_KERNEL); |
204 | if (state == NULL) { | 210 | if (state == NULL) |
205 | return -ENOMEM; | 211 | return -ENOMEM; |
206 | } | ||
207 | i2c_set_clientdata(client, state); | 212 | i2c_set_clientdata(client, state); |
208 | memcpy(state->regs, upd64031a_init, sizeof(state->regs)); | 213 | memcpy(state->regs, upd64031a_init, sizeof(state->regs)); |
209 | state->gr_mode = UPD64031A_GR_ON << 6; | 214 | state->gr_mode = UPD64031A_GR_ON << 6; |
210 | state->direct_3dycs_connect = UPD64031A_3DYCS_COMPOSITE << 4; | 215 | state->direct_3dycs_connect = UPD64031A_3DYCS_COMPOSITE << 4; |
211 | state->ext_comp_sync = state->ext_vert_sync = 0; | 216 | state->ext_comp_sync = state->ext_vert_sync = 0; |
212 | for (i = 0; i < TOT_REGS; i++) { | 217 | for (i = 0; i < TOT_REGS; i++) |
213 | upd64031a_write(client, i, state->regs[i]); | 218 | upd64031a_write(client, i, state->regs[i]); |
214 | } | ||
215 | return 0; | 219 | return 0; |
216 | } | 220 | } |
217 | 221 | ||