diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2008-05-20 05:24:04 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-07-20 06:06:47 -0400 |
commit | 4451342db5b5b779add112c6b15d676f07c73b33 (patch) | |
tree | 961e438324ed26f4d55030f273d1e6365bd336d1 | |
parent | d56eebfbdc11d1a3809d8bd793a118da5058ffa8 (diff) |
V4L/DVB (7927): ivtv: simplify gpio initialization for XCeive tuners.
Separate gpio_init field and xceive_pin and combine the two when
the gpio is initialized. So there is no longer any need to set the
xceive pin in the gpio_init values, simplifying the creation of a
new card definition.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r-- | drivers/media/video/ivtv/ivtv-cards.c | 6 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-gpio.c | 11 |
2 files changed, 10 insertions, 7 deletions
diff --git a/drivers/media/video/ivtv/ivtv-cards.c b/drivers/media/video/ivtv/ivtv-cards.c index ba2b0cf4531..dc3fbb32068 100644 --- a/drivers/media/video/ivtv/ivtv-cards.c +++ b/drivers/media/video/ivtv/ivtv-cards.c | |||
@@ -923,7 +923,6 @@ static const struct ivtv_card ivtv_card_club3d = { | |||
923 | { IVTV_CARD_INPUT_LINE_IN1, CX25840_AUDIO_SERIAL }, | 923 | { IVTV_CARD_INPUT_LINE_IN1, CX25840_AUDIO_SERIAL }, |
924 | }, | 924 | }, |
925 | .radio_input = { IVTV_CARD_INPUT_AUD_TUNER, CX25840_AUDIO5 }, | 925 | .radio_input = { IVTV_CARD_INPUT_AUD_TUNER, CX25840_AUDIO5 }, |
926 | .gpio_init = { .direction = 0x1000, .initial_value = 0x1000 }, /* tuner reset */ | ||
927 | .xceive_pin = 12, | 926 | .xceive_pin = 12, |
928 | .tuners = { | 927 | .tuners = { |
929 | { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 }, | 928 | { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 }, |
@@ -959,7 +958,7 @@ static const struct ivtv_card ivtv_card_avertv_mce116 = { | |||
959 | { IVTV_CARD_INPUT_LINE_IN1, CX25840_AUDIO_SERIAL, 1 }, | 958 | { IVTV_CARD_INPUT_LINE_IN1, CX25840_AUDIO_SERIAL, 1 }, |
960 | }, | 959 | }, |
961 | /* enable line-in */ | 960 | /* enable line-in */ |
962 | .gpio_init = { .direction = 0xe400, .initial_value = 0x4400 }, | 961 | .gpio_init = { .direction = 0xe000, .initial_value = 0x4000 }, |
963 | .xceive_pin = 10, | 962 | .xceive_pin = 10, |
964 | .tuners = { | 963 | .tuners = { |
965 | { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 }, | 964 | { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 }, |
@@ -1102,7 +1101,7 @@ static const struct ivtv_card ivtv_card_aver_m104 = { | |||
1102 | }, | 1101 | }, |
1103 | .radio_input = { IVTV_CARD_INPUT_AUD_TUNER, CX25840_AUDIO_SERIAL, 2 }, | 1102 | .radio_input = { IVTV_CARD_INPUT_AUD_TUNER, CX25840_AUDIO_SERIAL, 2 }, |
1104 | /* enable line-in + reset tuner */ | 1103 | /* enable line-in + reset tuner */ |
1105 | .gpio_init = { .direction = 0xe400, .initial_value = 0x4000 }, | 1104 | .gpio_init = { .direction = 0xe000, .initial_value = 0x4000 }, |
1106 | .xceive_pin = 10, | 1105 | .xceive_pin = 10, |
1107 | .tuners = { | 1106 | .tuners = { |
1108 | { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 }, | 1107 | { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 }, |
@@ -1138,7 +1137,6 @@ static const struct ivtv_card ivtv_card_buffalo = { | |||
1138 | { IVTV_CARD_INPUT_AUD_TUNER, CX25840_AUDIO5 }, | 1137 | { IVTV_CARD_INPUT_AUD_TUNER, CX25840_AUDIO5 }, |
1139 | { IVTV_CARD_INPUT_LINE_IN1, CX25840_AUDIO_SERIAL }, | 1138 | { IVTV_CARD_INPUT_LINE_IN1, CX25840_AUDIO_SERIAL }, |
1140 | }, | 1139 | }, |
1141 | .gpio_init = { .direction = 0x1000, .initial_value = 0x1000 }, | ||
1142 | .xceive_pin = 12, | 1140 | .xceive_pin = 12, |
1143 | .tuners = { | 1141 | .tuners = { |
1144 | { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 }, | 1142 | { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 }, |
diff --git a/drivers/media/video/ivtv/ivtv-gpio.c b/drivers/media/video/ivtv/ivtv-gpio.c index d8ac09f3cce..bc22905ea20 100644 --- a/drivers/media/video/ivtv/ivtv-gpio.c +++ b/drivers/media/video/ivtv/ivtv-gpio.c | |||
@@ -146,15 +146,20 @@ int ivtv_reset_tuner_gpio(void *dev, int cmd, int value) | |||
146 | 146 | ||
147 | void ivtv_gpio_init(struct ivtv *itv) | 147 | void ivtv_gpio_init(struct ivtv *itv) |
148 | { | 148 | { |
149 | if (itv->card->gpio_init.direction == 0) | 149 | u16 pin = 0; |
150 | |||
151 | if (itv->card->xceive_pin) | ||
152 | pin = 1 << itv->card->xceive_pin; | ||
153 | |||
154 | if ((itv->card->gpio_init.direction | pin) == 0) | ||
150 | return; | 155 | return; |
151 | 156 | ||
152 | IVTV_DEBUG_INFO("GPIO initial dir: %08x out: %08x\n", | 157 | IVTV_DEBUG_INFO("GPIO initial dir: %08x out: %08x\n", |
153 | read_reg(IVTV_REG_GPIO_DIR), read_reg(IVTV_REG_GPIO_OUT)); | 158 | read_reg(IVTV_REG_GPIO_DIR), read_reg(IVTV_REG_GPIO_OUT)); |
154 | 159 | ||
155 | /* init output data then direction */ | 160 | /* init output data then direction */ |
156 | write_reg(itv->card->gpio_init.initial_value, IVTV_REG_GPIO_OUT); | 161 | write_reg(itv->card->gpio_init.initial_value | pin, IVTV_REG_GPIO_OUT); |
157 | write_reg(itv->card->gpio_init.direction, IVTV_REG_GPIO_DIR); | 162 | write_reg(itv->card->gpio_init.direction | pin, IVTV_REG_GPIO_DIR); |
158 | } | 163 | } |
159 | 164 | ||
160 | static struct v4l2_queryctrl gpio_ctrl_mute = { | 165 | static struct v4l2_queryctrl gpio_ctrl_mute = { |