diff options
author | Devin Heitmueller <dheitmueller@linuxtv.org> | 2009-03-11 02:00:47 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 11:43:25 -0400 |
commit | f1add5b5ec2a6efaa0f5648d0dc2c56d83a3ecf8 (patch) | |
tree | 2d44c29f61576e3b6ac88219a726415d9edd3a3b /drivers/media/video/au0828/au0828-cards.c | |
parent | 4ff5ed44f84aed6727ec226853a1c6b03c36db5e (diff) |
V4L/DVB (11070): au0828: Rework the way the analog video binding occurs
Rework the way boards are managed so that we can change the board description
based on the Hauppauge eeprom (modeled after cx88-cards.c).
Also, make sure that we don't load the analog stack if there are no analog
inputs defined in the board profile.
Thanks to Michael Krufky <mkrufky@linuxtv.org> for providing information on
the various ways different Hauppauge boards can be configured.
Signed-off-by: Devin Heitmueller <dheitmueller@linuxtv.org>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/au0828/au0828-cards.c')
-rw-r--r-- | drivers/media/video/au0828/au0828-cards.c | 45 |
1 files changed, 42 insertions, 3 deletions
diff --git a/drivers/media/video/au0828/au0828-cards.c b/drivers/media/video/au0828/au0828-cards.c index 8b7ad43ed57c..e10b1b9221e0 100644 --- a/drivers/media/video/au0828/au0828-cards.c +++ b/drivers/media/video/au0828/au0828-cards.c | |||
@@ -22,6 +22,8 @@ | |||
22 | #include "au0828.h" | 22 | #include "au0828.h" |
23 | #include "au0828-cards.h" | 23 | #include "au0828-cards.h" |
24 | #include "au8522.h" | 24 | #include "au8522.h" |
25 | #include "media/tuner.h" | ||
26 | #include "media/v4l2-common.h" | ||
25 | 27 | ||
26 | void hvr950q_cs5340_audio(void *priv, int enable) | 28 | void hvr950q_cs5340_audio(void *priv, int enable) |
27 | { | 29 | { |
@@ -37,9 +39,13 @@ void hvr950q_cs5340_audio(void *priv, int enable) | |||
37 | struct au0828_board au0828_boards[] = { | 39 | struct au0828_board au0828_boards[] = { |
38 | [AU0828_BOARD_UNKNOWN] = { | 40 | [AU0828_BOARD_UNKNOWN] = { |
39 | .name = "Unknown board", | 41 | .name = "Unknown board", |
42 | .tuner_type = UNSET, | ||
43 | .tuner_addr = ADDR_UNSET, | ||
40 | }, | 44 | }, |
41 | [AU0828_BOARD_HAUPPAUGE_HVR850] = { | 45 | [AU0828_BOARD_HAUPPAUGE_HVR850] = { |
42 | .name = "Hauppauge HVR850", | 46 | .name = "Hauppauge HVR850", |
47 | .tuner_type = TUNER_XC5000, | ||
48 | .tuner_addr = 0x61, | ||
43 | .input = { | 49 | .input = { |
44 | { | 50 | { |
45 | .type = AU0828_VMUX_TELEVISION, | 51 | .type = AU0828_VMUX_TELEVISION, |
@@ -62,6 +68,8 @@ struct au0828_board au0828_boards[] = { | |||
62 | }, | 68 | }, |
63 | [AU0828_BOARD_HAUPPAUGE_HVR950Q] = { | 69 | [AU0828_BOARD_HAUPPAUGE_HVR950Q] = { |
64 | .name = "Hauppauge HVR950Q", | 70 | .name = "Hauppauge HVR950Q", |
71 | .tuner_type = TUNER_XC5000, | ||
72 | .tuner_addr = 0x61, | ||
65 | .input = { | 73 | .input = { |
66 | { | 74 | { |
67 | .type = AU0828_VMUX_TELEVISION, | 75 | .type = AU0828_VMUX_TELEVISION, |
@@ -84,12 +92,18 @@ struct au0828_board au0828_boards[] = { | |||
84 | }, | 92 | }, |
85 | [AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL] = { | 93 | [AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL] = { |
86 | .name = "Hauppauge HVR950Q rev xxF8", | 94 | .name = "Hauppauge HVR950Q rev xxF8", |
95 | .tuner_type = UNSET, | ||
96 | .tuner_addr = ADDR_UNSET, | ||
87 | }, | 97 | }, |
88 | [AU0828_BOARD_DVICO_FUSIONHDTV7] = { | 98 | [AU0828_BOARD_DVICO_FUSIONHDTV7] = { |
89 | .name = "DViCO FusionHDTV USB", | 99 | .name = "DViCO FusionHDTV USB", |
100 | .tuner_type = UNSET, | ||
101 | .tuner_addr = ADDR_UNSET, | ||
90 | }, | 102 | }, |
91 | [AU0828_BOARD_HAUPPAUGE_WOODBURY] = { | 103 | [AU0828_BOARD_HAUPPAUGE_WOODBURY] = { |
92 | .name = "Hauppauge Woodbury", | 104 | .name = "Hauppauge Woodbury", |
105 | .tuner_type = UNSET, | ||
106 | .tuner_addr = ADDR_UNSET, | ||
93 | }, | 107 | }, |
94 | }; | 108 | }; |
95 | 109 | ||
@@ -102,7 +116,7 @@ int au0828_tuner_callback(void *priv, int component, int command, int arg) | |||
102 | 116 | ||
103 | dprintk(1, "%s()\n", __func__); | 117 | dprintk(1, "%s()\n", __func__); |
104 | 118 | ||
105 | switch (dev->board) { | 119 | switch (dev->boardnr) { |
106 | case AU0828_BOARD_HAUPPAUGE_HVR850: | 120 | case AU0828_BOARD_HAUPPAUGE_HVR850: |
107 | case AU0828_BOARD_HAUPPAUGE_HVR950Q: | 121 | case AU0828_BOARD_HAUPPAUGE_HVR950Q: |
108 | case AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL: | 122 | case AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL: |
@@ -131,6 +145,7 @@ static void hauppauge_eeprom(struct au0828_dev *dev, u8 *eeprom_data) | |||
131 | struct tveeprom tv; | 145 | struct tveeprom tv; |
132 | 146 | ||
133 | tveeprom_hauppauge_analog(&dev->i2c_client, &tv, eeprom_data); | 147 | tveeprom_hauppauge_analog(&dev->i2c_client, &tv, eeprom_data); |
148 | dev->board.tuner_type = tv.tuner_type; | ||
134 | 149 | ||
135 | /* Make sure we support the board model */ | 150 | /* Make sure we support the board model */ |
136 | switch (tv.model) { | 151 | switch (tv.model) { |
@@ -157,15 +172,20 @@ static void hauppauge_eeprom(struct au0828_dev *dev, u8 *eeprom_data) | |||
157 | void au0828_card_setup(struct au0828_dev *dev) | 172 | void au0828_card_setup(struct au0828_dev *dev) |
158 | { | 173 | { |
159 | static u8 eeprom[256]; | 174 | static u8 eeprom[256]; |
175 | struct tuner_setup tun_setup; | ||
176 | unsigned int mode_mask = T_ANALOG_TV | | ||
177 | T_DIGITAL_TV; | ||
160 | 178 | ||
161 | dprintk(1, "%s()\n", __func__); | 179 | dprintk(1, "%s()\n", __func__); |
162 | 180 | ||
181 | memcpy(&dev->board, &au0828_boards[dev->boardnr], sizeof(dev->board)); | ||
182 | |||
163 | if (dev->i2c_rc == 0) { | 183 | if (dev->i2c_rc == 0) { |
164 | dev->i2c_client.addr = 0xa0 >> 1; | 184 | dev->i2c_client.addr = 0xa0 >> 1; |
165 | tveeprom_read(&dev->i2c_client, eeprom, sizeof(eeprom)); | 185 | tveeprom_read(&dev->i2c_client, eeprom, sizeof(eeprom)); |
166 | } | 186 | } |
167 | 187 | ||
168 | switch (dev->board) { | 188 | switch (dev->boardnr) { |
169 | case AU0828_BOARD_HAUPPAUGE_HVR850: | 189 | case AU0828_BOARD_HAUPPAUGE_HVR850: |
170 | case AU0828_BOARD_HAUPPAUGE_HVR950Q: | 190 | case AU0828_BOARD_HAUPPAUGE_HVR950Q: |
171 | case AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL: | 191 | case AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL: |
@@ -174,6 +194,25 @@ void au0828_card_setup(struct au0828_dev *dev) | |||
174 | hauppauge_eeprom(dev, eeprom+0xa0); | 194 | hauppauge_eeprom(dev, eeprom+0xa0); |
175 | break; | 195 | break; |
176 | } | 196 | } |
197 | |||
198 | if (dev->board.input != NULL) { | ||
199 | /* Load the analog demodulator driver (note this would need to | ||
200 | be abstracted out if we ever need to support a different | ||
201 | demod) */ | ||
202 | request_module("au8522"); | ||
203 | } | ||
204 | |||
205 | /* Setup tuners */ | ||
206 | if (dev->board.tuner_type != TUNER_ABSENT) { | ||
207 | /* Load the tuner module, which does the attach */ | ||
208 | request_module("tuner"); | ||
209 | |||
210 | tun_setup.mode_mask = mode_mask; | ||
211 | tun_setup.type = dev->board.tuner_type; | ||
212 | tun_setup.addr = dev->board.tuner_addr; | ||
213 | tun_setup.tuner_callback = au0828_tuner_callback; | ||
214 | au0828_call_i2c_clients(dev, TUNER_SET_TYPE_ADDR, &tun_setup); | ||
215 | } | ||
177 | } | 216 | } |
178 | 217 | ||
179 | /* | 218 | /* |
@@ -185,7 +224,7 @@ void au0828_gpio_setup(struct au0828_dev *dev) | |||
185 | { | 224 | { |
186 | dprintk(1, "%s()\n", __func__); | 225 | dprintk(1, "%s()\n", __func__); |
187 | 226 | ||
188 | switch (dev->board) { | 227 | switch (dev->boardnr) { |
189 | case AU0828_BOARD_HAUPPAUGE_HVR850: | 228 | case AU0828_BOARD_HAUPPAUGE_HVR850: |
190 | case AU0828_BOARD_HAUPPAUGE_HVR950Q: | 229 | case AU0828_BOARD_HAUPPAUGE_HVR950Q: |
191 | case AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL: | 230 | case AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL: |