diff options
author | Trent Piepho <xyzzy@speakeasy.org> | 2009-01-28 19:32:59 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 11:42:46 -0400 |
commit | abb0362f49c361f71b5aa6d244d4847145ed53c1 (patch) | |
tree | d59799fe09af041a4f630d8e4f49e8eb3b32968b /drivers/media/video/bt8xx/bttv-driver.c | |
parent | 72134a6d5199c3f5c8efe914e49072bde95948b3 (diff) |
V4L/DVB (10560): bttv: make tuner card info more consistent
The bttv card database structure had a "tuner" field that was the input
number of the tuner input or UNSET for no tuner. However, the only values
it could ever be are 0 and UNSET. Having a tuner on an input other than 0
didn't work and was never used.
There is also a "tuner_type" field that can be set to TUNER_ABSENT to
indicate no tuner, which makes "tuner = UNSET" redundant. In many cases,
tuner_type was set to UNSET when there was no tuner, which isn't quite
correct. tuner_type == UNSET is supposed to mean the tuner type isn't yet
known.
So, I changed cards where "tuner == UNSET" to always have tuner_type of
TUNER_ABSENT. At this point the tuner field is redundant, so I deleted it.
I have the card setup code set the card's tuner_type (not the card type's
tuner_type!) to TUNER_ABSENT if it hasn't yet been set at the end of the
setup code. Various places that check if the card has a tuner will now
look for this instead of checking the card type's "tuner" field.
Also autoload the tuner module before issuing the TUNER_SET_TYPE_ADDR I2C
client call instead of after issuing it.
Overall, on ia32 this decreases compiled code size by about 24 bytes and
reduces the data size by 640 bytes.
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/bt8xx/bttv-driver.c')
-rw-r--r-- | drivers/media/video/bt8xx/bttv-driver.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index 89e0cd191531..1bb6c2df366a 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c | |||
@@ -1356,8 +1356,8 @@ set_input(struct bttv *btv, unsigned int input, unsigned int norm) | |||
1356 | } else { | 1356 | } else { |
1357 | video_mux(btv,input); | 1357 | video_mux(btv,input); |
1358 | } | 1358 | } |
1359 | audio_input(btv,(input == bttv_tvcards[btv->c.type].tuner ? | 1359 | audio_input(btv, (btv->tuner_type != TUNER_ABSENT && input == 0) ? |
1360 | TVAUDIO_INPUT_TUNER : TVAUDIO_INPUT_EXTERN)); | 1360 | TVAUDIO_INPUT_TUNER : TVAUDIO_INPUT_EXTERN); |
1361 | set_tvnorm(btv, norm); | 1361 | set_tvnorm(btv, norm); |
1362 | } | 1362 | } |
1363 | 1363 | ||
@@ -1907,7 +1907,7 @@ static int bttv_enum_input(struct file *file, void *priv, | |||
1907 | i->type = V4L2_INPUT_TYPE_CAMERA; | 1907 | i->type = V4L2_INPUT_TYPE_CAMERA; |
1908 | i->audioset = 1; | 1908 | i->audioset = 1; |
1909 | 1909 | ||
1910 | if (i->index == bttv_tvcards[btv->c.type].tuner) { | 1910 | if (btv->tuner_type != TUNER_ABSENT && i->index == 0) { |
1911 | sprintf(i->name, "Television"); | 1911 | sprintf(i->name, "Television"); |
1912 | i->type = V4L2_INPUT_TYPE_TUNER; | 1912 | i->type = V4L2_INPUT_TYPE_TUNER; |
1913 | i->tuner = 0; | 1913 | i->tuner = 0; |
@@ -1971,7 +1971,7 @@ static int bttv_s_tuner(struct file *file, void *priv, | |||
1971 | if (0 != err) | 1971 | if (0 != err) |
1972 | return err; | 1972 | return err; |
1973 | 1973 | ||
1974 | if (UNSET == bttv_tvcards[btv->c.type].tuner) | 1974 | if (btv->tuner_type == TUNER_ABSENT) |
1975 | return -EINVAL; | 1975 | return -EINVAL; |
1976 | 1976 | ||
1977 | if (0 != t->index) | 1977 | if (0 != t->index) |
@@ -2665,8 +2665,7 @@ static int bttv_querycap(struct file *file, void *priv, | |||
2665 | if (no_overlay <= 0) | 2665 | if (no_overlay <= 0) |
2666 | cap->capabilities |= V4L2_CAP_VIDEO_OVERLAY; | 2666 | cap->capabilities |= V4L2_CAP_VIDEO_OVERLAY; |
2667 | 2667 | ||
2668 | if (bttv_tvcards[btv->c.type].tuner != UNSET && | 2668 | if (btv->tuner_type != TUNER_ABSENT) |
2669 | bttv_tvcards[btv->c.type].tuner != TUNER_ABSENT) | ||
2670 | cap->capabilities |= V4L2_CAP_TUNER; | 2669 | cap->capabilities |= V4L2_CAP_TUNER; |
2671 | return 0; | 2670 | return 0; |
2672 | } | 2671 | } |
@@ -2949,7 +2948,7 @@ static int bttv_g_tuner(struct file *file, void *priv, | |||
2949 | struct bttv_fh *fh = priv; | 2948 | struct bttv_fh *fh = priv; |
2950 | struct bttv *btv = fh->btv; | 2949 | struct bttv *btv = fh->btv; |
2951 | 2950 | ||
2952 | if (UNSET == bttv_tvcards[btv->c.type].tuner) | 2951 | if (btv->tuner_type == TUNER_ABSENT) |
2953 | return -EINVAL; | 2952 | return -EINVAL; |
2954 | if (0 != t->index) | 2953 | if (0 != t->index) |
2955 | return -EINVAL; | 2954 | return -EINVAL; |
@@ -3509,7 +3508,7 @@ static int radio_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t) | |||
3509 | struct bttv_fh *fh = priv; | 3508 | struct bttv_fh *fh = priv; |
3510 | struct bttv *btv = fh->btv; | 3509 | struct bttv *btv = fh->btv; |
3511 | 3510 | ||
3512 | if (UNSET == bttv_tvcards[btv->c.type].tuner) | 3511 | if (btv->tuner_type == TUNER_ABSENT) |
3513 | return -EINVAL; | 3512 | return -EINVAL; |
3514 | if (0 != t->index) | 3513 | if (0 != t->index) |
3515 | return -EINVAL; | 3514 | return -EINVAL; |