diff options
author | Kuninori Morimoto <morimoto.kuninori@renesas.com> | 2009-12-11 09:34:51 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-12-16 06:27:25 -0500 |
commit | 207970838186b2606896b03f590b89b13570a727 (patch) | |
tree | ac595464f71cad220312350343972a8785494674 | |
parent | 607e5ad8d596495341fa0a13e0a23121ee6053b6 (diff) |
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: Kuninori Morimoto <morimoto.kuninori@renesas.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/video/tw9910.c | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/drivers/media/video/tw9910.c b/drivers/media/video/tw9910.c index c21acedcf027..2256ba6e6147 100644 --- a/drivers/media/video/tw9910.c +++ b/drivers/media/video/tw9910.c | |||
@@ -371,6 +371,19 @@ static struct tw9910_priv *to_tw9910(const struct i2c_client *client) | |||
371 | subdev); | 371 | subdev); |
372 | } | 372 | } |
373 | 373 | ||
374 | static int tw9910_mask_set(struct i2c_client *client, u8 command, | ||
375 | u8 mask, u8 set) | ||
376 | { | ||
377 | s32 val = i2c_smbus_read_byte_data(client, command); | ||
378 | if (val < 0) | ||
379 | return val; | ||
380 | |||
381 | val &= ~mask; | ||
382 | val |= set & mask; | ||
383 | |||
384 | return i2c_smbus_write_byte_data(client, command, val); | ||
385 | } | ||
386 | |||
374 | static int tw9910_set_scale(struct i2c_client *client, | 387 | static int tw9910_set_scale(struct i2c_client *client, |
375 | const struct tw9910_scale_ctrl *scale) | 388 | const struct tw9910_scale_ctrl *scale) |
376 | { | 389 | { |
@@ -445,14 +458,9 @@ static int tw9910_set_hsync(struct i2c_client *client, | |||
445 | return ret; | 458 | return ret; |
446 | 459 | ||
447 | /* bit 2 - 0 */ | 460 | /* bit 2 - 0 */ |
448 | ret = i2c_smbus_read_byte_data(client, HSLOWCTL); | 461 | ret = tw9910_mask_set(client, HSLOWCTL, 0x77, |
449 | if (ret < 0) | 462 | (hsync->start & 0x0007) << 4 | |
450 | return ret; | 463 | (hsync->end & 0x0007)); |
451 | |||
452 | ret = i2c_smbus_write_byte_data(client, HSLOWCTL, | ||
453 | (ret & 0x88) | | ||
454 | (hsync->start & 0x0007) << 4 | | ||
455 | (hsync->end & 0x0007)); | ||
456 | 464 | ||
457 | return ret; | 465 | return ret; |
458 | } | 466 | } |
@@ -471,19 +479,6 @@ static int tw9910_write_array(struct i2c_client *client, | |||
471 | return 0; | 479 | return 0; |
472 | } | 480 | } |
473 | 481 | ||
474 | static int tw9910_mask_set(struct i2c_client *client, u8 command, | ||
475 | u8 mask, u8 set) | ||
476 | { | ||
477 | s32 val = i2c_smbus_read_byte_data(client, command); | ||
478 | if (val < 0) | ||
479 | return val; | ||
480 | |||
481 | val &= ~mask; | ||
482 | val |= set & mask; | ||
483 | |||
484 | return i2c_smbus_write_byte_data(client, command, val); | ||
485 | } | ||
486 | |||
487 | static void tw9910_reset(struct i2c_client *client) | 482 | static void tw9910_reset(struct i2c_client *client) |
488 | { | 483 | { |
489 | tw9910_mask_set(client, ACNTL1, SRESET, SRESET); | 484 | tw9910_mask_set(client, ACNTL1, SRESET, SRESET); |