V4L/DVB (6864): upd64031a: CodingStyle cleanup
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
This commit is contained in:
parent
8c9fc8de54
commit
79f998a71b
1 changed files with 21 additions and 17 deletions
|
@ -31,20 +31,20 @@
|
||||||
#include <media/v4l2-i2c-drv.h>
|
#include <media/v4l2-i2c-drv.h>
|
||||||
#include <media/upd64031a.h>
|
#include <media/upd64031a.h>
|
||||||
|
|
||||||
// --------------------- read registers functions define -----------------------
|
/* --------------------- read registers functions define -------------------- */
|
||||||
|
|
||||||
/* bit masks */
|
/* bit masks */
|
||||||
#define GR_MODE_MASK 0xc0
|
#define GR_MODE_MASK 0xc0
|
||||||
#define DIRECT_3DYCS_CONNECT_MASK 0xc0
|
#define DIRECT_3DYCS_CONNECT_MASK 0xc0
|
||||||
#define SYNC_CIRCUIT_MASK 0xa0
|
#define SYNC_CIRCUIT_MASK 0xa0
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
MODULE_DESCRIPTION("uPD64031A driver");
|
MODULE_DESCRIPTION("uPD64031A driver");
|
||||||
MODULE_AUTHOR("T. Adachi, Takeru KOMORIYA, Hans Verkuil");
|
MODULE_AUTHOR("T. Adachi, Takeru KOMORIYA, Hans Verkuil");
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
|
|
||||||
static int debug = 0;
|
static int debug;
|
||||||
module_param(debug, int, 0644);
|
module_param(debug, int, 0644);
|
||||||
|
|
||||||
MODULE_PARM_DESC(debug, "Debug level (0-1)");
|
MODULE_PARM_DESC(debug, "Debug level (0-1)");
|
||||||
|
@ -96,7 +96,7 @@ static void upd64031a_write(struct i2c_client *client, u8 reg, u8 val)
|
||||||
|
|
||||||
buf[0] = reg;
|
buf[0] = reg;
|
||||||
buf[1] = val;
|
buf[1] = val;
|
||||||
v4l_dbg(1, debug, client, "writing reg addr: %02X val: %02X\n", reg, val);
|
v4l_dbg(1, debug, client, "write reg: %02X val: %02X\n", reg, val);
|
||||||
if (i2c_master_send(client, buf, 2) != 2)
|
if (i2c_master_send(client, buf, 2) != 2)
|
||||||
v4l_err(client, "I/O error write 0x%02x/0x%02x\n", reg, val);
|
v4l_err(client, "I/O error write 0x%02x/0x%02x\n", reg, val);
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,7 @@ static void upd64031a_change(struct i2c_client *client)
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------------ */
|
||||||
|
|
||||||
static int upd64031a_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
static int upd64031a_command(struct i2c_client *client, unsigned cmd, void *arg)
|
||||||
{
|
{
|
||||||
struct upd64031a_state *state = i2c_get_clientdata(client);
|
struct upd64031a_state *state = i2c_get_clientdata(client);
|
||||||
struct v4l2_routing *route = arg;
|
struct v4l2_routing *route = arg;
|
||||||
|
@ -140,8 +140,10 @@ static int upd64031a_command(struct i2c_client *client, unsigned int cmd, void *
|
||||||
|
|
||||||
state->gr_mode = (route->input & 3) << 6;
|
state->gr_mode = (route->input & 3) << 6;
|
||||||
state->direct_3dycs_connect = (route->input & 0xc) << 4;
|
state->direct_3dycs_connect = (route->input & 0xc) << 4;
|
||||||
state->ext_comp_sync = (route->input & UPD64031A_COMPOSITE_EXTERNAL) << 1;
|
state->ext_comp_sync =
|
||||||
state->ext_vert_sync = (route->input & UPD64031A_VERTICAL_EXTERNAL) << 2;
|
(route->input & UPD64031A_COMPOSITE_EXTERNAL) << 1;
|
||||||
|
state->ext_vert_sync =
|
||||||
|
(route->input & UPD64031A_VERTICAL_EXTERNAL) << 2;
|
||||||
r00 = (state->regs[R00] & ~GR_MODE_MASK) | state->gr_mode;
|
r00 = (state->regs[R00] & ~GR_MODE_MASK) | state->gr_mode;
|
||||||
r05 = (state->regs[R00] & ~SYNC_CIRCUIT_MASK) |
|
r05 = (state->regs[R00] & ~SYNC_CIRCUIT_MASK) |
|
||||||
state->ext_comp_sync | state->ext_vert_sync;
|
state->ext_comp_sync | state->ext_vert_sync;
|
||||||
|
@ -165,20 +167,23 @@ static int upd64031a_command(struct i2c_client *client, unsigned int cmd, void *
|
||||||
{
|
{
|
||||||
struct v4l2_register *reg = arg;
|
struct v4l2_register *reg = arg;
|
||||||
|
|
||||||
if (!v4l2_chip_match_i2c_client(client, reg->match_type, reg->match_chip))
|
if (!v4l2_chip_match_i2c_client(client,
|
||||||
|
reg->match_type, reg->match_chip))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (!capable(CAP_SYS_ADMIN))
|
if (!capable(CAP_SYS_ADMIN))
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
if (cmd == VIDIOC_DBG_G_REGISTER)
|
if (cmd == VIDIOC_DBG_G_REGISTER) {
|
||||||
reg->val = upd64031a_read(client, reg->reg & 0xff);
|
reg->val = upd64031a_read(client, reg->reg & 0xff);
|
||||||
else
|
break;
|
||||||
upd64031a_write(client, reg->reg & 0xff, reg->val & 0xff);
|
}
|
||||||
|
upd64031a_write(client, reg->reg & 0xff, reg->val & 0xff);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case VIDIOC_G_CHIP_IDENT:
|
case VIDIOC_G_CHIP_IDENT:
|
||||||
return v4l2_chip_ident_i2c_client(client, arg, V4L2_IDENT_UPD64031A, 0);
|
return v4l2_chip_ident_i2c_client(client, arg,
|
||||||
|
V4L2_IDENT_UPD64031A, 0);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -198,20 +203,19 @@ static int upd64031a_probe(struct i2c_client *client)
|
||||||
if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
|
if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name);
|
v4l_info(client, "chip found @ 0x%x (%s)\n",
|
||||||
|
client->addr << 1, client->adapter->name);
|
||||||
|
|
||||||
state = kmalloc(sizeof(struct upd64031a_state), GFP_KERNEL);
|
state = kmalloc(sizeof(struct upd64031a_state), GFP_KERNEL);
|
||||||
if (state == NULL) {
|
if (state == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
i2c_set_clientdata(client, state);
|
i2c_set_clientdata(client, state);
|
||||||
memcpy(state->regs, upd64031a_init, sizeof(state->regs));
|
memcpy(state->regs, upd64031a_init, sizeof(state->regs));
|
||||||
state->gr_mode = UPD64031A_GR_ON << 6;
|
state->gr_mode = UPD64031A_GR_ON << 6;
|
||||||
state->direct_3dycs_connect = UPD64031A_3DYCS_COMPOSITE << 4;
|
state->direct_3dycs_connect = UPD64031A_3DYCS_COMPOSITE << 4;
|
||||||
state->ext_comp_sync = state->ext_vert_sync = 0;
|
state->ext_comp_sync = state->ext_vert_sync = 0;
|
||||||
for (i = 0; i < TOT_REGS; i++) {
|
for (i = 0; i < TOT_REGS; i++)
|
||||||
upd64031a_write(client, i, state->regs[i]);
|
upd64031a_write(client, i, state->regs[i]);
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue