aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/saa7134/saa7134-core.c
diff options
context:
space:
mode:
authorHartmut Hackmann <hartmut.hackmann@t-online.de>2007-04-27 11:31:17 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-04-27 14:43:40 -0400
commitcfeb88398f004a0e85ee011fd89a01f5d3bf3c81 (patch)
treea2df3639bc592b16cdf9a48f8fc39a465f9f9a07 /drivers/media/video/saa7134/saa7134-core.c
parentb8bc76d88fa7a1e4cd679fac3adfc5afeb2b3427 (diff)
V4L/DVB (5323): Updated support for tuner callbacks
This change supplies a more generic version of the tuner callback. The tuner struct now has a function pointer int (*tuner_callback) (void *dev, int command, int arg) additionally to a int config parameter. both can be set through the TUNER_SET_TYPE_ADDR client call. Note that the meaning of the parameters depend on the tuner type. Signed-off-by: Hartmut Hackmann <hartmut.hackmann@t-online.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/saa7134/saa7134-core.c')
-rw-r--r--drivers/media/video/saa7134/saa7134-core.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c
index 8ed03d65a34..5f74ea467d4 100644
--- a/drivers/media/video/saa7134/saa7134-core.c
+++ b/drivers/media/video/saa7134/saa7134-core.c
@@ -120,7 +120,6 @@ void saa7134_track_gpio(struct saa7134_dev *dev, char *msg)
120void saa7134_set_gpio(struct saa7134_dev *dev, int bit_no, int value) 120void saa7134_set_gpio(struct saa7134_dev *dev, int bit_no, int value)
121{ 121{
122 u32 index, bitval; 122 u32 index, bitval;
123 u8 sync_control;
124 123
125 index = 1 << bit_no; 124 index = 1 << bit_no;
126 switch (value) { 125 switch (value) {
@@ -140,22 +139,40 @@ void saa7134_set_gpio(struct saa7134_dev *dev, int bit_no, int value)
140 dprintk("setting GPIO%d to tristate\n", bit_no); 139 dprintk("setting GPIO%d to tristate\n", bit_no);
141 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, index, 0); 140 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, index, 0);
142 break; 141 break;
143 case 4: /* sync output on GPIO 22 for tda8275a, 50Hz*/ 142 }
144 case 5: /* sync output on GPIO 22 for tda8275a, 60Hz*/ 143}
145 if (bit_no == 22) { 144
146 dprintk("setting GPIO22 to vsync %d\n", value - 4); 145int saa7134_tuner_callback(void *ptr, int command, int arg)
146{
147 u8 sync_control;
148 struct saa7134_dev *dev = ptr;
149
150 switch (dev->tuner_type) {
151 case TUNER_PHILIPS_TDA8290:
152 switch (command) {
153 case 0: /* switch LNA gain through GPIO 22*/
154 saa7134_set_gpio(dev, 22, arg) ;
155 break;
156 case 1: /* vsync output at GPIO22. 50 / 60Hz */
157 dprintk("setting GPIO22 to vsync %d\n", arg);
147 saa_andorb(SAA7134_VIDEO_PORT_CTRL3, 0x80, 0x80); 158 saa_andorb(SAA7134_VIDEO_PORT_CTRL3, 0x80, 0x80);
148 saa_andorb(SAA7134_VIDEO_PORT_CTRL6, 0x0f, 0x03); 159 saa_andorb(SAA7134_VIDEO_PORT_CTRL6, 0x0f, 0x03);
149 if (value == 5) 160 if (arg == 1)
150 sync_control = 11; 161 sync_control = 11;
151 else 162 else
152 sync_control = 17; 163 sync_control = 17;
153 saa_writeb(SAA7134_VGATE_START, sync_control); 164 saa_writeb(SAA7134_VGATE_START, sync_control);
154 saa_writeb(SAA7134_VGATE_STOP, sync_control + 1); 165 saa_writeb(SAA7134_VGATE_STOP, sync_control + 1);
155 saa_andorb(SAA7134_MISC_VGATE_MSB, 0x03, 0x00); 166 saa_andorb(SAA7134_MISC_VGATE_MSB, 0x03, 0x00);
167 break;
168 default:
169 return -EINVAL;
156 } 170 }
157 break; 171 break;
172 default:
173 return -ENODEV;
158 } 174 }
175 return 0;
159} 176}
160 177
161/* ------------------------------------------------------------------ */ 178/* ------------------------------------------------------------------ */