Commit 20797083 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mauro Carvalho Chehab

V4L/DVB (13656): tw9910: tw9910_set_hsync clean up

tw9910_set_hsync should use tw9910_mask_set to set bits 2-0
Signed-off-by: default avatarKuninori Morimoto <morimoto.kuninori@renesas.com>
Signed-off-by: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 607e5ad8
...@@ -371,6 +371,19 @@ static struct tw9910_priv *to_tw9910(const struct i2c_client *client) ...@@ -371,6 +371,19 @@ static struct tw9910_priv *to_tw9910(const struct i2c_client *client)
subdev); subdev);
} }
static int tw9910_mask_set(struct i2c_client *client, u8 command,
u8 mask, u8 set)
{
s32 val = i2c_smbus_read_byte_data(client, command);
if (val < 0)
return val;
val &= ~mask;
val |= set & mask;
return i2c_smbus_write_byte_data(client, command, val);
}
static int tw9910_set_scale(struct i2c_client *client, static int tw9910_set_scale(struct i2c_client *client,
const struct tw9910_scale_ctrl *scale) const struct tw9910_scale_ctrl *scale)
{ {
...@@ -445,12 +458,7 @@ static int tw9910_set_hsync(struct i2c_client *client, ...@@ -445,12 +458,7 @@ static int tw9910_set_hsync(struct i2c_client *client,
return ret; return ret;
/* bit 2 - 0 */ /* bit 2 - 0 */
ret = i2c_smbus_read_byte_data(client, HSLOWCTL); ret = tw9910_mask_set(client, HSLOWCTL, 0x77,
if (ret < 0)
return ret;
ret = i2c_smbus_write_byte_data(client, HSLOWCTL,
(ret & 0x88) |
(hsync->start & 0x0007) << 4 | (hsync->start & 0x0007) << 4 |
(hsync->end & 0x0007)); (hsync->end & 0x0007));
...@@ -471,19 +479,6 @@ static int tw9910_write_array(struct i2c_client *client, ...@@ -471,19 +479,6 @@ static int tw9910_write_array(struct i2c_client *client,
return 0; return 0;
} }
static int tw9910_mask_set(struct i2c_client *client, u8 command,
u8 mask, u8 set)
{
s32 val = i2c_smbus_read_byte_data(client, command);
if (val < 0)
return val;
val &= ~mask;
val |= set & mask;
return i2c_smbus_write_byte_data(client, command, val);
}
static void tw9910_reset(struct i2c_client *client) static void tw9910_reset(struct i2c_client *client)
{ {
tw9910_mask_set(client, ACNTL1, SRESET, SRESET); tw9910_mask_set(client, ACNTL1, SRESET, SRESET);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment