aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2015-01-23 10:52:30 -0500
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-02-02 08:48:38 -0500
commitbf7dcb8067ed5c3b40768b071d93bd7676e36620 (patch)
treea12f0dc4e72f1bbc66ef3c7cdb555c33249fe5de /drivers/media/i2c
parentc5ef8f8c5d502a7a918737a05170399ed028f17a (diff)
[media] adv7180: Add support for the adv7280/adv7281/adv7282
This patch adds support for the adv7280/adv7281/adv7282 devices to the adv7180 driver. They are very similar to the adv7182, the main difference from the drivers point of view are some different tuning constants for improved video performance. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Federico Vaga <federico.vaga@gmail.com> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/i2c')
-rw-r--r--drivers/media/i2c/adv7180.c56
1 files changed, 54 insertions, 2 deletions
diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c
index 84d3b782a2a7..f55364ff2582 100644
--- a/drivers/media/i2c/adv7180.c
+++ b/drivers/media/i2c/adv7180.c
@@ -158,6 +158,7 @@
158struct adv7180_state; 158struct adv7180_state;
159 159
160#define ADV7180_FLAG_RESET_POWERED BIT(0) 160#define ADV7180_FLAG_RESET_POWERED BIT(0)
161#define ADV7180_FLAG_V2 BIT(1)
161 162
162struct adv7180_chip_info { 163struct adv7180_chip_info {
163 unsigned int flags; 164 unsigned int flags;
@@ -637,9 +638,18 @@ static int adv7180_select_input(struct adv7180_state *state, unsigned int input)
637 638
638static int adv7182_init(struct adv7180_state *state) 639static int adv7182_init(struct adv7180_state *state)
639{ 640{
641 if (state->chip_info->flags & ADV7180_FLAG_V2) {
642 /* ADI recommended writes for improved video quality */
643 adv7180_write(state, 0x0080, 0x51);
644 adv7180_write(state, 0x0081, 0x51);
645 adv7180_write(state, 0x0082, 0x68);
646 adv7180_write(state, 0x0004, 0x17);
647 } else {
648 adv7180_write(state, 0x0004, 0x07);
649 }
650
640 /* ADI required writes */ 651 /* ADI required writes */
641 adv7180_write(state, 0x0003, 0x0c); 652 adv7180_write(state, 0x0003, 0x0c);
642 adv7180_write(state, 0x0004, 0x07);
643 adv7180_write(state, 0x0013, 0x00); 653 adv7180_write(state, 0x0013, 0x00);
644 adv7180_write(state, 0x001d, 0x40); 654 adv7180_write(state, 0x001d, 0x40);
645 655
@@ -696,6 +706,13 @@ static unsigned int adv7182_lbias_settings[][3] = {
696 [ADV7182_INPUT_TYPE_YPBPR] = { 0x0B, 0x4E, 0xC0 }, 706 [ADV7182_INPUT_TYPE_YPBPR] = { 0x0B, 0x4E, 0xC0 },
697}; 707};
698 708
709static unsigned int adv7280_lbias_settings[][3] = {
710 [ADV7182_INPUT_TYPE_CVBS] = { 0xCD, 0x4E, 0x80 },
711 [ADV7182_INPUT_TYPE_DIFF_CVBS] = { 0xC0, 0x4E, 0x80 },
712 [ADV7182_INPUT_TYPE_SVIDEO] = { 0x0B, 0xCE, 0x80 },
713 [ADV7182_INPUT_TYPE_YPBPR] = { 0x0B, 0x4E, 0xC0 },
714};
715
699static int adv7182_select_input(struct adv7180_state *state, unsigned int input) 716static int adv7182_select_input(struct adv7180_state *state, unsigned int input)
700{ 717{
701 enum adv7182_input_type input_type; 718 enum adv7182_input_type input_type;
@@ -724,7 +741,10 @@ static int adv7182_select_input(struct adv7180_state *state, unsigned int input)
724 break; 741 break;
725 } 742 }
726 743
727 lbias = adv7182_lbias_settings[input_type]; 744 if (state->chip_info->flags & ADV7180_FLAG_V2)
745 lbias = adv7280_lbias_settings[input_type];
746 else
747 lbias = adv7182_lbias_settings[input_type];
728 748
729 for (i = 0; i < ARRAY_SIZE(adv7182_lbias_settings[0]); i++) 749 for (i = 0; i < ARRAY_SIZE(adv7182_lbias_settings[0]); i++)
730 adv7180_write(state, 0x0052 + i, lbias[i]); 750 adv7180_write(state, 0x0052 + i, lbias[i]);
@@ -783,6 +803,35 @@ static const struct adv7180_chip_info adv7182_info = {
783 .select_input = adv7182_select_input, 803 .select_input = adv7182_select_input,
784}; 804};
785 805
806static const struct adv7180_chip_info adv7280_info = {
807 .flags = ADV7180_FLAG_V2,
808 .valid_input_mask = BIT(ADV7182_INPUT_CVBS_AIN1) |
809 BIT(ADV7182_INPUT_CVBS_AIN2) |
810 BIT(ADV7182_INPUT_CVBS_AIN3) |
811 BIT(ADV7182_INPUT_CVBS_AIN4) |
812 BIT(ADV7182_INPUT_SVIDEO_AIN1_AIN2) |
813 BIT(ADV7182_INPUT_SVIDEO_AIN3_AIN4) |
814 BIT(ADV7182_INPUT_YPRPB_AIN1_AIN2_AIN3),
815 .init = adv7182_init,
816 .set_std = adv7182_set_std,
817 .select_input = adv7182_select_input,
818};
819
820static const struct adv7180_chip_info adv7281_info = {
821 .flags = ADV7180_FLAG_V2,
822 .valid_input_mask = BIT(ADV7182_INPUT_CVBS_AIN1) |
823 BIT(ADV7182_INPUT_CVBS_AIN2) |
824 BIT(ADV7182_INPUT_CVBS_AIN7) |
825 BIT(ADV7182_INPUT_CVBS_AIN8) |
826 BIT(ADV7182_INPUT_SVIDEO_AIN1_AIN2) |
827 BIT(ADV7182_INPUT_SVIDEO_AIN7_AIN8) |
828 BIT(ADV7182_INPUT_DIFF_CVBS_AIN1_AIN2) |
829 BIT(ADV7182_INPUT_DIFF_CVBS_AIN7_AIN8),
830 .init = adv7182_init,
831 .set_std = adv7182_set_std,
832 .select_input = adv7182_select_input,
833};
834
786static int init_device(struct adv7180_state *state) 835static int init_device(struct adv7180_state *state)
787{ 836{
788 int ret; 837 int ret;
@@ -926,6 +975,9 @@ static int adv7180_remove(struct i2c_client *client)
926static const struct i2c_device_id adv7180_id[] = { 975static const struct i2c_device_id adv7180_id[] = {
927 { "adv7180", (kernel_ulong_t)&adv7180_info }, 976 { "adv7180", (kernel_ulong_t)&adv7180_info },
928 { "adv7182", (kernel_ulong_t)&adv7182_info }, 977 { "adv7182", (kernel_ulong_t)&adv7182_info },
978 { "adv7280", (kernel_ulong_t)&adv7280_info },
979 { "adv7281", (kernel_ulong_t)&adv7281_info },
980 { "adv7282", (kernel_ulong_t)&adv7281_info },
929 {}, 981 {},
930}; 982};
931MODULE_DEVICE_TABLE(i2c, adv7180_id); 983MODULE_DEVICE_TABLE(i2c, adv7180_id);