diff options
Diffstat (limited to 'drivers/media/dvb/pt1/va1j5jf8007s.c')
-rw-r--r-- | drivers/media/dvb/pt1/va1j5jf8007s.c | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/drivers/media/dvb/pt1/va1j5jf8007s.c b/drivers/media/dvb/pt1/va1j5jf8007s.c index fc6594996e79..451641c0c1d2 100644 --- a/drivers/media/dvb/pt1/va1j5jf8007s.c +++ b/drivers/media/dvb/pt1/va1j5jf8007s.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * ISDB-S driver for VA1J5JF8007 | 2 | * ISDB-S driver for VA1J5JF8007/VA1J5JF8011 |
3 | * | 3 | * |
4 | * Copyright (C) 2009 HIRANO Takahito <hiranotaka@zng.info> | 4 | * Copyright (C) 2009 HIRANO Takahito <hiranotaka@zng.info> |
5 | * | 5 | * |
@@ -580,7 +580,7 @@ static void va1j5jf8007s_release(struct dvb_frontend *fe) | |||
580 | 580 | ||
581 | static struct dvb_frontend_ops va1j5jf8007s_ops = { | 581 | static struct dvb_frontend_ops va1j5jf8007s_ops = { |
582 | .info = { | 582 | .info = { |
583 | .name = "VA1J5JF8007 ISDB-S", | 583 | .name = "VA1J5JF8007/VA1J5JF8011 ISDB-S", |
584 | .type = FE_QPSK, | 584 | .type = FE_QPSK, |
585 | .frequency_min = 950000, | 585 | .frequency_min = 950000, |
586 | .frequency_max = 2150000, | 586 | .frequency_max = 2150000, |
@@ -628,28 +628,50 @@ static int va1j5jf8007s_prepare_1(struct va1j5jf8007s_state *state) | |||
628 | return 0; | 628 | return 0; |
629 | } | 629 | } |
630 | 630 | ||
631 | static const u8 va1j5jf8007s_prepare_bufs[][2] = { | 631 | static const u8 va1j5jf8007s_20mhz_prepare_bufs[][2] = { |
632 | {0x04, 0x02}, {0x0d, 0x55}, {0x11, 0x40}, {0x13, 0x80}, {0x17, 0x01}, | 632 | {0x04, 0x02}, {0x0d, 0x55}, {0x11, 0x40}, {0x13, 0x80}, {0x17, 0x01}, |
633 | {0x1c, 0x0a}, {0x1d, 0xaa}, {0x1e, 0x20}, {0x1f, 0x88}, {0x51, 0xb0}, | 633 | {0x1c, 0x0a}, {0x1d, 0xaa}, {0x1e, 0x20}, {0x1f, 0x88}, {0x51, 0xb0}, |
634 | {0x52, 0x89}, {0x53, 0xb3}, {0x5a, 0x2d}, {0x5b, 0xd3}, {0x85, 0x69}, | 634 | {0x52, 0x89}, {0x53, 0xb3}, {0x5a, 0x2d}, {0x5b, 0xd3}, {0x85, 0x69}, |
635 | {0x87, 0x04}, {0x8e, 0x02}, {0xa3, 0xf7}, {0xa5, 0xc0}, | 635 | {0x87, 0x04}, {0x8e, 0x02}, {0xa3, 0xf7}, {0xa5, 0xc0}, |
636 | }; | 636 | }; |
637 | 637 | ||
638 | static const u8 va1j5jf8007s_25mhz_prepare_bufs[][2] = { | ||
639 | {0x04, 0x02}, {0x11, 0x40}, {0x13, 0x80}, {0x17, 0x01}, {0x1c, 0x0a}, | ||
640 | {0x1d, 0xaa}, {0x1e, 0x20}, {0x1f, 0x88}, {0x51, 0xb0}, {0x52, 0x89}, | ||
641 | {0x53, 0xb3}, {0x5a, 0x2d}, {0x5b, 0xd3}, {0x85, 0x69}, {0x87, 0x04}, | ||
642 | {0x8e, 0x26}, {0xa3, 0xf7}, {0xa5, 0xc0}, | ||
643 | }; | ||
644 | |||
638 | static int va1j5jf8007s_prepare_2(struct va1j5jf8007s_state *state) | 645 | static int va1j5jf8007s_prepare_2(struct va1j5jf8007s_state *state) |
639 | { | 646 | { |
647 | const u8 (*bufs)[2]; | ||
648 | int size; | ||
640 | u8 addr; | 649 | u8 addr; |
641 | u8 buf[2]; | 650 | u8 buf[2]; |
642 | struct i2c_msg msg; | 651 | struct i2c_msg msg; |
643 | int i; | 652 | int i; |
644 | 653 | ||
654 | switch (state->config->frequency) { | ||
655 | case VA1J5JF8007S_20MHZ: | ||
656 | bufs = va1j5jf8007s_20mhz_prepare_bufs; | ||
657 | size = ARRAY_SIZE(va1j5jf8007s_20mhz_prepare_bufs); | ||
658 | break; | ||
659 | case VA1J5JF8007S_25MHZ: | ||
660 | bufs = va1j5jf8007s_25mhz_prepare_bufs; | ||
661 | size = ARRAY_SIZE(va1j5jf8007s_25mhz_prepare_bufs); | ||
662 | break; | ||
663 | default: | ||
664 | return -EINVAL; | ||
665 | } | ||
666 | |||
645 | addr = state->config->demod_address; | 667 | addr = state->config->demod_address; |
646 | 668 | ||
647 | msg.addr = addr; | 669 | msg.addr = addr; |
648 | msg.flags = 0; | 670 | msg.flags = 0; |
649 | msg.len = 2; | 671 | msg.len = 2; |
650 | msg.buf = buf; | 672 | msg.buf = buf; |
651 | for (i = 0; i < ARRAY_SIZE(va1j5jf8007s_prepare_bufs); i++) { | 673 | for (i = 0; i < size; i++) { |
652 | memcpy(buf, va1j5jf8007s_prepare_bufs[i], sizeof(buf)); | 674 | memcpy(buf, bufs[i], sizeof(buf)); |
653 | if (i2c_transfer(state->adap, &msg, 1) != 1) | 675 | if (i2c_transfer(state->adap, &msg, 1) != 1) |
654 | return -EREMOTEIO; | 676 | return -EREMOTEIO; |
655 | } | 677 | } |