aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Ringel <stefan.ringel@arcor.de>2010-03-29 12:51:10 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-05-19 11:57:27 -0400
commit32a2232bfd6a5eda4f4d6977ebf68ce9d2408e9b (patch)
treeea4244620cf8abf2933697c863c77f51c68eea66
parent124371e33ce733a81fde8419946adb0d6c14f4c0 (diff)
V4L/DVB: tm6000: switch to gpio strcut
switch to a gpio structure Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/staging/tm6000/tm6000-cards.c68
-rw-r--r--drivers/staging/tm6000/tm6000.h13
2 files changed, 59 insertions, 22 deletions
diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c
index c26cf2f73e19..e43a4c4df236 100644
--- a/drivers/staging/tm6000/tm6000-cards.c
+++ b/drivers/staging/tm6000/tm6000-cards.c
@@ -66,7 +66,8 @@ struct tm6000_board {
66 int tuner_type; /* type of the tuner */ 66 int tuner_type; /* type of the tuner */
67 int tuner_addr; /* tuner address */ 67 int tuner_addr; /* tuner address */
68 int demod_addr; /* demodulator address */ 68 int demod_addr; /* demodulator address */
69 int gpio_addr_tun_reset; /* GPIO used for tuner reset */ 69
70 struct tm6000_gpio gpio;
70}; 71};
71 72
72struct tm6000_board tm6000_boards[] = { 73struct tm6000_board tm6000_boards[] = {
@@ -75,7 +76,9 @@ struct tm6000_board tm6000_boards[] = {
75 .caps = { 76 .caps = {
76 .has_tuner = 1, 77 .has_tuner = 1,
77 }, 78 },
78 .gpio_addr_tun_reset = TM6000_GPIO_1, 79 .gpio = {
80 .tuner_reset = TM6000_GPIO_1,
81 },
79 }, 82 },
80 [TM5600_BOARD_GENERIC] = { 83 [TM5600_BOARD_GENERIC] = {
81 .name = "Generic tm5600 board", 84 .name = "Generic tm5600 board",
@@ -85,7 +88,9 @@ struct tm6000_board tm6000_boards[] = {
85 .caps = { 88 .caps = {
86 .has_tuner = 1, 89 .has_tuner = 1,
87 }, 90 },
88 .gpio_addr_tun_reset = TM6000_GPIO_1, 91 .gpio = {
92 .tuner_reset = TM6000_GPIO_1,
93 },
89 }, 94 },
90 [TM6000_BOARD_GENERIC] = { 95 [TM6000_BOARD_GENERIC] = {
91 .name = "Generic tm6000 board", 96 .name = "Generic tm6000 board",
@@ -95,7 +100,9 @@ struct tm6000_board tm6000_boards[] = {
95 .has_tuner = 1, 100 .has_tuner = 1,
96 .has_dvb = 1, 101 .has_dvb = 1,
97 }, 102 },
98 .gpio_addr_tun_reset = TM6000_GPIO_1, 103 .gpio = {
104 .tuner_reset = TM6000_GPIO_1,
105 },
99 }, 106 },
100 [TM6010_BOARD_GENERIC] = { 107 [TM6010_BOARD_GENERIC] = {
101 .name = "Generic tm6010 board", 108 .name = "Generic tm6010 board",
@@ -106,7 +113,9 @@ struct tm6000_board tm6000_boards[] = {
106 .has_tuner = 1, 113 .has_tuner = 1,
107 .has_dvb = 1, 114 .has_dvb = 1,
108 }, 115 },
109 .gpio_addr_tun_reset = TM6010_GPIO_4, 116 .gpio = {
117 .tuner_reset = TM6010_GPIO_4,
118 },
110 }, 119 },
111 [TM5600_BOARD_10MOONS_UT821] = { 120 [TM5600_BOARD_10MOONS_UT821] = {
112 .name = "10Moons UT 821", 121 .name = "10Moons UT 821",
@@ -117,7 +126,9 @@ struct tm6000_board tm6000_boards[] = {
117 .has_tuner = 1, 126 .has_tuner = 1,
118 .has_eeprom = 1, 127 .has_eeprom = 1,
119 }, 128 },
120 .gpio_addr_tun_reset = TM6000_GPIO_1, 129 .gpio = {
130 .tuner_reset = TM6000_GPIO_1,
131 },
121 }, 132 },
122 [TM5600_BOARD_10MOONS_UT330] = { 133 [TM5600_BOARD_10MOONS_UT330] = {
123 .name = "10Moons UT 330", 134 .name = "10Moons UT 330",
@@ -154,7 +165,9 @@ struct tm6000_board tm6000_boards[] = {
154 .has_eeprom = 0, 165 .has_eeprom = 0,
155 .has_remote = 1, 166 .has_remote = 1,
156 }, 167 },
157 .gpio_addr_tun_reset = TM6000_GPIO_4, 168 .gpio = {
169 .tuner_reset = TM6000_GPIO_4,
170 },
158 }, 171 },
159 [TM6000_BOARD_ADSTECH_MINI_DUAL_TV] = { 172 [TM6000_BOARD_ADSTECH_MINI_DUAL_TV] = {
160 .name = "ADSTECH Mini Dual TV USB", 173 .name = "ADSTECH Mini Dual TV USB",
@@ -167,7 +180,9 @@ struct tm6000_board tm6000_boards[] = {
167 .has_zl10353 = 1, 180 .has_zl10353 = 1,
168 .has_eeprom = 0, 181 .has_eeprom = 0,
169 }, 182 },
170 .gpio_addr_tun_reset = TM6000_GPIO_4, 183 .gpio = {
184 .tuner_reset = TM6000_GPIO_4,
185 },
171 }, 186 },
172 [TM6010_BOARD_HAUPPAUGE_900H] = { 187 [TM6010_BOARD_HAUPPAUGE_900H] = {
173 .name = "Hauppauge WinTV HVR-900H / WinTV USB2-Stick", 188 .name = "Hauppauge WinTV HVR-900H / WinTV USB2-Stick",
@@ -181,7 +196,9 @@ struct tm6000_board tm6000_boards[] = {
181 .has_zl10353 = 1, 196 .has_zl10353 = 1,
182 .has_eeprom = 1, 197 .has_eeprom = 1,
183 }, 198 },
184 .gpio_addr_tun_reset = TM6010_GPIO_2, 199 .gpio = {
200 .tuner_reset = TM6010_GPIO_2,
201 },
185 }, 202 },
186 [TM6010_BOARD_BEHOLD_WANDER] = { 203 [TM6010_BOARD_BEHOLD_WANDER] = {
187 .name = "Beholder Wander DVB-T/TV/FM USB2.0", 204 .name = "Beholder Wander DVB-T/TV/FM USB2.0",
@@ -196,7 +213,9 @@ struct tm6000_board tm6000_boards[] = {
196 .has_eeprom = 1, 213 .has_eeprom = 1,
197 .has_remote = 1, 214 .has_remote = 1,
198 }, 215 },
199 .gpio_addr_tun_reset = TM6000_GPIO_2, 216 .gpio = {
217 .tuner_reset = TM6000_GPIO_2,
218 },
200 }, 219 },
201 [TM6010_BOARD_BEHOLD_VOYAGER] = { 220 [TM6010_BOARD_BEHOLD_VOYAGER] = {
202 .name = "Beholder Voyager TV/FM USB2.0", 221 .name = "Beholder Voyager TV/FM USB2.0",
@@ -210,7 +229,9 @@ struct tm6000_board tm6000_boards[] = {
210 .has_eeprom = 1, 229 .has_eeprom = 1,
211 .has_remote = 1, 230 .has_remote = 1,
212 }, 231 },
213 .gpio_addr_tun_reset = TM6000_GPIO_2, 232 .gpio = {
233 .tuner_reset = TM6000_GPIO_2,
234 },
214 }, 235 },
215 [TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE] = { 236 [TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE] = {
216 .name = "Terratec Cinergy Hybrid XE / Cinergy Hybrid-Stick", 237 .name = "Terratec Cinergy Hybrid XE / Cinergy Hybrid-Stick",
@@ -225,7 +246,9 @@ struct tm6000_board tm6000_boards[] = {
225 .has_eeprom = 1, 246 .has_eeprom = 1,
226 .has_remote = 1, 247 .has_remote = 1,
227 }, 248 },
228 .gpio_addr_tun_reset = TM6010_GPIO_2, 249 .gpio = {
250 .tuner_reset = TM6010_GPIO_2,
251 },
229 }, 252 },
230 [TM6010_BOARD_TWINHAN_TU501] = { 253 [TM6010_BOARD_TWINHAN_TU501] = {
231 .name = "Twinhan TU501(704D1)", 254 .name = "Twinhan TU501(704D1)",
@@ -240,7 +263,9 @@ struct tm6000_board tm6000_boards[] = {
240 .has_eeprom = 1, 263 .has_eeprom = 1,
241 .has_remote = 1, 264 .has_remote = 1,
242 }, 265 },
243 .gpio_addr_tun_reset = TM6010_GPIO_2, 266 .gpio = {
267 .tuner_reset = TM6010_GPIO_2,
268 },
244 } 269 }
245}; 270};
246 271
@@ -299,21 +324,21 @@ int tm6000_tuner_callback(void *ptr, int component, int command, int arg)
299 case TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE: 324 case TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE:
300 case TM6010_BOARD_TWINHAN_TU501: 325 case TM6010_BOARD_TWINHAN_TU501:
301 tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, 326 tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
302 dev->tuner_reset_gpio, 0x01); 327 dev->gpio.tuner_reset, 0x01);
303 msleep(60); 328 msleep(60);
304 tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, 329 tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
305 dev->tuner_reset_gpio, 0x00); 330 dev->gpio.tuner_reset, 0x00);
306 msleep(75); 331 msleep(75);
307 tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, 332 tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
308 dev->tuner_reset_gpio, 0x01); 333 dev->gpio.tuner_reset, 0x01);
309 msleep(60); 334 msleep(60);
310 break; 335 break;
311 default: 336 default:
312 tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, 337 tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
313 dev->tuner_reset_gpio, 0x00); 338 dev->gpio.tuner_reset, 0x00);
314 msleep(130); 339 msleep(130);
315 tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, 340 tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
316 dev->tuner_reset_gpio, 0x01); 341 dev->gpio.tuner_reset, 0x01);
317 msleep(130); 342 msleep(130);
318 break; 343 break;
319 } 344 }
@@ -396,7 +421,7 @@ int tm6000_cards_setup(struct tm6000_core *dev)
396 */ 421 */
397 for (i = 0; i < 2; i++) { 422 for (i = 0; i < 2; i++) {
398 rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, 423 rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
399 dev->tuner_reset_gpio, 0x00); 424 dev->gpio.tuner_reset, 0x00);
400 if (rc < 0) { 425 if (rc < 0) {
401 printk(KERN_ERR "Error %i doing GPIO1 reset\n", rc); 426 printk(KERN_ERR "Error %i doing GPIO1 reset\n", rc);
402 return rc; 427 return rc;
@@ -404,7 +429,7 @@ int tm6000_cards_setup(struct tm6000_core *dev)
404 429
405 msleep(10); /* Just to be conservative */ 430 msleep(10); /* Just to be conservative */
406 rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, 431 rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
407 dev->tuner_reset_gpio, 0x01); 432 dev->gpio.tuner_reset, 0x01);
408 if (rc < 0) { 433 if (rc < 0) {
409 printk(KERN_ERR "Error %i doing GPIO1 reset\n", rc); 434 printk(KERN_ERR "Error %i doing GPIO1 reset\n", rc);
410 return rc; 435 return rc;
@@ -501,7 +526,8 @@ static int tm6000_init_dev(struct tm6000_core *dev)
501 dev->dev_type = tm6000_boards[dev->model].type; 526 dev->dev_type = tm6000_boards[dev->model].type;
502 dev->tuner_type = tm6000_boards[dev->model].tuner_type; 527 dev->tuner_type = tm6000_boards[dev->model].tuner_type;
503 dev->tuner_addr = tm6000_boards[dev->model].tuner_addr; 528 dev->tuner_addr = tm6000_boards[dev->model].tuner_addr;
504 dev->tuner_reset_gpio = tm6000_boards[dev->model].gpio_addr_tun_reset; 529
530 dev->gpio = tm6000_boards[dev->model].gpio;
505 531
506 dev->demod_addr = tm6000_boards[dev->model].demod_addr; 532 dev->demod_addr = tm6000_boards[dev->model].demod_addr;
507 533
diff --git a/drivers/staging/tm6000/tm6000.h b/drivers/staging/tm6000/tm6000.h
index 321e60eb9a83..7fcc7478c69b 100644
--- a/drivers/staging/tm6000/tm6000.h
+++ b/drivers/staging/tm6000/tm6000.h
@@ -103,6 +103,16 @@ enum tm6000_mode {
103 TM6000_MODE_DIGITAL, 103 TM6000_MODE_DIGITAL,
104}; 104};
105 105
106struct tm6000_gpio {
107 int tuner_reset;
108 int tuner_on;
109 int demod_reset;
110 int demod_on;
111 int power_led;
112 int dvb_led;
113 int ir;
114}
115
106struct tm6000_capabilities { 116struct tm6000_capabilities {
107 unsigned int has_tuner:1; 117 unsigned int has_tuner:1;
108 unsigned int has_tda9874:1; 118 unsigned int has_tda9874:1;
@@ -140,7 +150,8 @@ struct tm6000_core {
140 /* Tuner configuration */ 150 /* Tuner configuration */
141 int tuner_type; /* type of the tuner */ 151 int tuner_type; /* type of the tuner */
142 int tuner_addr; /* tuner address */ 152 int tuner_addr; /* tuner address */
143 int tuner_reset_gpio; /* GPIO used for tuner reset */ 153
154 struct tm6000_gpio gpio;
144 155
145 /* Demodulator configuration */ 156 /* Demodulator configuration */
146 int demod_addr; /* demodulator address */ 157 int demod_addr; /* demodulator address */