aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/bt8xx
diff options
context:
space:
mode:
authorTrent Piepho <xyzzy@speakeasy.org>2009-01-28 19:32:59 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:42:47 -0400
commit5221e21e5ecd3aebd2e8e3234bd18883ce720945 (patch)
tree28ba523ee7bf7ac90f892958e3fdf6e50dbc5c94 /drivers/media/video/bt8xx
parent4c548d4b28c0c65938914b2790fd2ca2e9c61d63 (diff)
V4L/DVB (10562): bttv: rework the way digital inputs are indicated
The code was using a muxsel value of -1U to indicate a digital input. A couple places in were checking of muxsel < 0 to detect this, which doesn't work of course because muxsel is unsigned and can't be negative. Only a couple cards had digital inputs and it was always the last one, so for the card database create a one bit field that indicates the last input is digital. On init, this is used to set a new field in the bttv struct to the digital input's number or UNSET for none. This makes it easier to check if the current input is digital. Signed-off-by: Trent Piepho <xyzzy@speakeasy.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/bt8xx')
-rw-r--r--drivers/media/video/bt8xx/bttv-cards.c11
-rw-r--r--drivers/media/video/bt8xx/bttv-driver.c2
-rw-r--r--drivers/media/video/bt8xx/bttv-risc.c4
-rw-r--r--drivers/media/video/bt8xx/bttv.h9
-rw-r--r--drivers/media/video/bt8xx/bttvp.h2
5 files changed, 17 insertions, 11 deletions
diff --git a/drivers/media/video/bt8xx/bttv-cards.c b/drivers/media/video/bt8xx/bttv-cards.c
index f49e6e686628..d545d48fac58 100644
--- a/drivers/media/video/bt8xx/bttv-cards.c
+++ b/drivers/media/video/bt8xx/bttv-cards.c
@@ -633,8 +633,9 @@ struct tvcard bttv_tvcards[] = {
633 .video_inputs = 3, 633 .video_inputs = 3,
634 /* .audio_inputs= 1, */ 634 /* .audio_inputs= 1, */
635 .svhs = NO_SVHS, 635 .svhs = NO_SVHS,
636 .has_dig_in = 1,
636 .gpiomask = 7, 637 .gpiomask = 7,
637 .muxsel = { 2, 3, -1 }, 638 .muxsel = { 2, 3, 0 }, /* input 2 is digital */
638 /* .digital_mode= DIGITAL_MODE_CAMERA, */ 639 /* .digital_mode= DIGITAL_MODE_CAMERA, */
639 .gpiomux = { 0, 0, 0, 0 }, 640 .gpiomux = { 0, 0, 0, 0 },
640 .no_msp34xx = 1, 641 .no_msp34xx = 1,
@@ -1069,8 +1070,9 @@ struct tvcard bttv_tvcards[] = {
1069 .video_inputs = 5, 1070 .video_inputs = 5,
1070 /* .audio_inputs= 1, */ 1071 /* .audio_inputs= 1, */
1071 .svhs = 3, 1072 .svhs = 3,
1073 .has_dig_in = 1,
1072 .gpiomask = 0xAA0000, 1074 .gpiomask = 0xAA0000,
1073 .muxsel = { 2, 3, 1, 1, -1 }, 1075 .muxsel = { 2, 3, 1, 1, 0 }, /* input 4 is digital */
1074 /* .digital_mode= DIGITAL_MODE_CAMERA, */ 1076 /* .digital_mode= DIGITAL_MODE_CAMERA, */
1075 .gpiomux = { 0x20000, 0, 0x80000, 0x80000 }, 1077 .gpiomux = { 0x20000, 0, 0x80000, 0x80000 },
1076 .gpiomute = 0xa8000, 1078 .gpiomute = 0xa8000,
@@ -2539,8 +2541,9 @@ struct tvcard bttv_tvcards[] = {
2539 .video_inputs = 5, 2541 .video_inputs = 5,
2540 /* .audio_inputs= 1, */ 2542 /* .audio_inputs= 1, */
2541 .svhs = 3, 2543 .svhs = 3,
2544 .has_dig_in = 1,
2542 .gpiomask = 0x01fe00, 2545 .gpiomask = 0x01fe00,
2543 .muxsel = { 2, 3, 1, 1, -1 }, 2546 .muxsel = { 2, 3, 1, 1, 0 }, /* in 4 is digital */
2544 /* .digital_mode= DIGITAL_MODE_CAMERA, */ 2547 /* .digital_mode= DIGITAL_MODE_CAMERA, */
2545 .gpiomux = { 0x00400, 0x10400, 0x04400, 0x80000 }, 2548 .gpiomux = { 0x00400, 0x10400, 0x04400, 0x80000 },
2546 .gpiomute = 0x12400, 2549 .gpiomute = 0x12400,
@@ -3417,6 +3420,8 @@ void __devinit bttv_init_card2(struct bttv *btv)
3417 bttv_call_i2c_clients(btv, TUNER_SET_CONFIG, &tda9887_cfg); 3420 bttv_call_i2c_clients(btv, TUNER_SET_CONFIG, &tda9887_cfg);
3418 } 3421 }
3419 3422
3423 btv->dig = bttv_tvcards[btv->c.type].has_dig_in ?
3424 bttv_tvcards[btv->c.type].video_inputs - 1 : UNSET;
3420 btv->svhs = bttv_tvcards[btv->c.type].svhs == NO_SVHS ? 3425 btv->svhs = bttv_tvcards[btv->c.type].svhs == NO_SVHS ?
3421 UNSET : bttv_tvcards[btv->c.type].svhs; 3426 UNSET : bttv_tvcards[btv->c.type].svhs;
3422 if (svhs[btv->c.nr] != UNSET) 3427 if (svhs[btv->c.nr] != UNSET)
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
index 1bb6c2df366a..8d9756b9587e 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -1040,7 +1040,7 @@ static void bt848A_set_timing(struct bttv *btv)
1040 int table_idx = bttv_tvnorms[btv->tvnorm].sram; 1040 int table_idx = bttv_tvnorms[btv->tvnorm].sram;
1041 int fsc = bttv_tvnorms[btv->tvnorm].Fsc; 1041 int fsc = bttv_tvnorms[btv->tvnorm].Fsc;
1042 1042
1043 if (UNSET == bttv_tvcards[btv->c.type].muxsel[btv->input]) { 1043 if (btv->input == btv->dig) {
1044 dprintk("bttv%d: load digital timing table (table_idx=%d)\n", 1044 dprintk("bttv%d: load digital timing table (table_idx=%d)\n",
1045 btv->c.nr,table_idx); 1045 btv->c.nr,table_idx);
1046 1046
diff --git a/drivers/media/video/bt8xx/bttv-risc.c b/drivers/media/video/bt8xx/bttv-risc.c
index 5b1b8e4c78ba..d16af2836379 100644
--- a/drivers/media/video/bt8xx/bttv-risc.c
+++ b/drivers/media/video/bt8xx/bttv-risc.c
@@ -341,7 +341,7 @@ bttv_calc_geo_old(struct bttv *btv, struct bttv_geometry *geo,
341 int totalwidth = tvnorm->totalwidth; 341 int totalwidth = tvnorm->totalwidth;
342 int scaledtwidth = tvnorm->scaledtwidth; 342 int scaledtwidth = tvnorm->scaledtwidth;
343 343
344 if (bttv_tvcards[btv->c.type].muxsel[btv->input] < 0) { 344 if (btv->input == btv->dig) {
345 swidth = 720; 345 swidth = 720;
346 totalwidth = 858; 346 totalwidth = 858;
347 scaledtwidth = 858; 347 scaledtwidth = 858;
@@ -391,7 +391,7 @@ bttv_calc_geo (struct bttv * btv,
391 && crop->width == tvnorm->cropcap.defrect.width 391 && crop->width == tvnorm->cropcap.defrect.width
392 && crop->height == tvnorm->cropcap.defrect.height 392 && crop->height == tvnorm->cropcap.defrect.height
393 && width <= tvnorm->swidth /* see PAL-Nc et al */) 393 && width <= tvnorm->swidth /* see PAL-Nc et al */)
394 || bttv_tvcards[btv->c.type].muxsel[btv->input] < 0) { 394 || btv->input == btv->dig) {
395 bttv_calc_geo_old(btv, geo, width, height, 395 bttv_calc_geo_old(btv, geo, width, height,
396 both_fields, tvnorm); 396 both_fields, tvnorm);
397 return; 397 return;
diff --git a/drivers/media/video/bt8xx/bttv.h b/drivers/media/video/bt8xx/bttv.h
index a2e140a25df6..e377e2887a53 100644
--- a/drivers/media/video/bt8xx/bttv.h
+++ b/drivers/media/video/bt8xx/bttv.h
@@ -224,6 +224,10 @@ struct tvcard {
224 u8 video_inputs; /* Number of inputs */ 224 u8 video_inputs; /* Number of inputs */
225 unsigned int svhs:4; /* Which input is s-video */ 225 unsigned int svhs:4; /* Which input is s-video */
226#define NO_SVHS 15 226#define NO_SVHS 15
227 unsigned int pll:2;
228#define PLL_NONE 0
229#define PLL_28 1
230#define PLL_35 2
227 231
228 /* i2c audio flags */ 232 /* i2c audio flags */
229 unsigned int no_msp34xx:1; 233 unsigned int no_msp34xx:1;
@@ -236,11 +240,8 @@ struct tvcard {
236 unsigned int has_dvb:1; 240 unsigned int has_dvb:1;
237 unsigned int has_remote:1; 241 unsigned int has_remote:1;
238 unsigned int has_radio:1; 242 unsigned int has_radio:1;
243 unsigned int has_dig_in:1; /* Has digital input (always last input) */
239 unsigned int no_gpioirq:1; 244 unsigned int no_gpioirq:1;
240 unsigned int pll:2;
241#define PLL_NONE 0
242#define PLL_28 1
243#define PLL_35 2
244}; 245};
245 246
246extern struct tvcard bttv_tvcards[]; 247extern struct tvcard bttv_tvcards[];
diff --git a/drivers/media/video/bt8xx/bttvp.h b/drivers/media/video/bt8xx/bttvp.h
index 230e148e78fe..23ab1c9527e4 100644
--- a/drivers/media/video/bt8xx/bttvp.h
+++ b/drivers/media/video/bt8xx/bttvp.h
@@ -329,7 +329,7 @@ struct bttv {
329 unsigned int cardid; /* pci subsystem id (bt878 based ones) */ 329 unsigned int cardid; /* pci subsystem id (bt878 based ones) */
330 unsigned int tuner_type; /* tuner chip type */ 330 unsigned int tuner_type; /* tuner chip type */
331 unsigned int tda9887_conf; 331 unsigned int tda9887_conf;
332 unsigned int svhs; 332 unsigned int svhs, dig;
333 struct bttv_pll_info pll; 333 struct bttv_pll_info pll;
334 int triton1; 334 int triton1;
335 int gpioirq; 335 int gpioirq;