diff options
author | Patrick Boettcher <pb@linuxtv.org> | 2006-09-19 11:51:33 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-10-03 14:12:27 -0400 |
commit | 136cafbf4a024b52ba0a10627217f03cea9ff9f8 (patch) | |
tree | cf827cb4d792a82a9c7b30bccc0db71547607472 /drivers | |
parent | 6870ab576c86a496869fbd5bb339da7e442ee7f5 (diff) |
V4L/DVB (4646): Misc. changes, DiB3000MC, MT2060
Changed the attach-function of the dib3000mc-driver to return only one
frontend. In case of multiple dib3000-chips on one board, one has to call the
i2c-enumeration manually before.
Added a field to Microtune 2060 config to output the clock to other
tuners/device on a board.
Signed-off-by: Patrick Boettcher <pb@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/dvb/dvb-usb/Makefile | 1 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/dibusb-common.c | 11 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/dibusb-mc.c | 1 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/dvb-usb-firmware.c | 6 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/dvb-usb-ids.h | 6 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/dvb-usb.h | 41 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/usb-urb.c | 2 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/dib3000mc.c | 147 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/dib3000mc.h | 8 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/mt2060.c | 7 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/mt2060.h | 2 |
11 files changed, 100 insertions, 132 deletions
diff --git a/drivers/media/dvb/dvb-usb/Makefile b/drivers/media/dvb/dvb-usb/Makefile index 275cbc2925c4..e239107998e5 100644 --- a/drivers/media/dvb/dvb-usb/Makefile +++ b/drivers/media/dvb/dvb-usb/Makefile | |||
@@ -37,5 +37,6 @@ dvb-usb-cxusb-objs = cxusb.o | |||
37 | obj-$(CONFIG_DVB_USB_CXUSB) += dvb-usb-cxusb.o | 37 | obj-$(CONFIG_DVB_USB_CXUSB) += dvb-usb-cxusb.o |
38 | 38 | ||
39 | dvb-usb-dib0700-objs = dib0700_core.o dib0700_devices.o | 39 | dvb-usb-dib0700-objs = dib0700_core.o dib0700_devices.o |
40 | obj-$(CONFIG_DVB_USB_DIB0700) += dvb-usb-dib0700.o | ||
40 | 41 | ||
41 | EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/ | 42 | EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/ |
diff --git a/drivers/media/dvb/dvb-usb/dibusb-common.c b/drivers/media/dvb/dvb-usb/dibusb-common.c index 5f8afec96a3b..b4d6e539ff5a 100644 --- a/drivers/media/dvb/dvb-usb/dibusb-common.c +++ b/drivers/media/dvb/dvb-usb/dibusb-common.c | |||
@@ -230,8 +230,8 @@ static struct dib3000mc_config mod3000p_dib3000p_config = { | |||
230 | 230 | ||
231 | int dibusb_dib3000mc_frontend_attach(struct dvb_usb_adapter *adap) | 231 | int dibusb_dib3000mc_frontend_attach(struct dvb_usb_adapter *adap) |
232 | { | 232 | { |
233 | if (dib3000mc_attach(&adap->dev->i2c_adap, 1, DEFAULT_DIB3000P_I2C_ADDRESS, 0, &mod3000p_dib3000p_config, &adap->fe) == 0 || | 233 | if ((adap->fe = dvb_attach(dib3000mc_attach, &adap->dev->i2c_adap, DEFAULT_DIB3000P_I2C_ADDRESS, &mod3000p_dib3000p_config)) == NULL || |
234 | dib3000mc_attach(&adap->dev->i2c_adap, 1, DEFAULT_DIB3000MC_I2C_ADDRESS, 0, &mod3000p_dib3000p_config, &adap->fe) == 0) { | 234 | (adap->fe = dvb_attach(dib3000mc_attach, &adap->dev->i2c_adap, DEFAULT_DIB3000MC_I2C_ADDRESS, &mod3000p_dib3000p_config)) == NULL) { |
235 | if (adap->priv != NULL) { | 235 | if (adap->priv != NULL) { |
236 | struct dibusb_state *st = adap->priv; | 236 | struct dibusb_state *st = adap->priv; |
237 | st->ops.pid_parse = dib3000mc_pid_parse; | 237 | st->ops.pid_parse = dib3000mc_pid_parse; |
@@ -247,10 +247,9 @@ static struct mt2060_config stk3000p_mt2060_config = { | |||
247 | 0x60 | 247 | 0x60 |
248 | }; | 248 | }; |
249 | 249 | ||
250 | int dibusb_dib3000mc_tuner_attach (struct dvb_usb_adapter *adap) | 250 | int dibusb_dib3000mc_tuner_attach(struct dvb_usb_adapter *adap) |
251 | { | 251 | { |
252 | struct dibusb_state *st = adap->priv; | 252 | struct dibusb_state *st = adap->priv; |
253 | int ret; | ||
254 | u8 a,b; | 253 | u8 a,b; |
255 | u16 if1 = 1220; | 254 | u16 if1 = 1220; |
256 | struct i2c_adapter *tun_i2c; | 255 | struct i2c_adapter *tun_i2c; |
@@ -287,9 +286,9 @@ int dibusb_dib3000mc_tuner_attach (struct dvb_usb_adapter *adap) | |||
287 | } | 286 | } |
288 | 287 | ||
289 | tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe, 1); | 288 | tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe, 1); |
290 | if ((ret = mt2060_attach(adap->fe, tun_i2c, &stk3000p_mt2060_config, if1)) != 0) { | 289 | if (dvb_attach(mt2060_attach, adap->fe, tun_i2c, &stk3000p_mt2060_config, if1) != NULL) { |
291 | /* not found - use panasonic pll parameters */ | 290 | /* not found - use panasonic pll parameters */ |
292 | if (dvb_pll_attach(adap->fe, 0x60, tun_i2c, &dvb_pll_env57h1xd5) == NULL) | 291 | if (dvb_attach(dvb_pll_attach, adap->fe, 0x60, tun_i2c, &dvb_pll_env57h1xd5) == NULL) |
293 | return -ENOMEM; | 292 | return -ENOMEM; |
294 | } else { | 293 | } else { |
295 | st->mt2060_present = 1; | 294 | st->mt2060_present = 1; |
diff --git a/drivers/media/dvb/dvb-usb/dibusb-mc.c b/drivers/media/dvb/dvb-usb/dibusb-mc.c index d823e7d5b260..a0fd37efc04b 100644 --- a/drivers/media/dvb/dvb-usb/dibusb-mc.c +++ b/drivers/media/dvb/dvb-usb/dibusb-mc.c | |||
@@ -49,7 +49,6 @@ static struct dvb_usb_device_properties dibusb_mc_properties = { | |||
49 | .usb_ctrl = CYPRESS_FX2, | 49 | .usb_ctrl = CYPRESS_FX2, |
50 | .firmware = "dvb-usb-dibusb-6.0.0.8.fw", | 50 | .firmware = "dvb-usb-dibusb-6.0.0.8.fw", |
51 | 51 | ||
52 | |||
53 | .num_adapters = 1, | 52 | .num_adapters = 1, |
54 | .adapter = { | 53 | .adapter = { |
55 | { | 54 | { |
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c b/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c index 122ff8157d18..e1112e39fb63 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c +++ b/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c | |||
@@ -24,9 +24,6 @@ static struct usb_cypress_controller cypress[] = { | |||
24 | { .id = CYPRESS_FX2, .name = "Cypress FX2", .cpu_cs_register = 0xe600 }, | 24 | { .id = CYPRESS_FX2, .name = "Cypress FX2", .cpu_cs_register = 0xe600 }, |
25 | }; | 25 | }; |
26 | 26 | ||
27 | static int dvb_usb_get_hexline(const struct firmware *fw, struct hexline *hx, | ||
28 | int *pos); | ||
29 | |||
30 | /* | 27 | /* |
31 | * load a firmware packet to the device | 28 | * load a firmware packet to the device |
32 | */ | 29 | */ |
@@ -115,7 +112,7 @@ int dvb_usb_download_firmware(struct usb_device *udev, struct dvb_usb_device_pro | |||
115 | return ret; | 112 | return ret; |
116 | } | 113 | } |
117 | 114 | ||
118 | static int dvb_usb_get_hexline(const struct firmware *fw, struct hexline *hx, | 115 | int dvb_usb_get_hexline(const struct firmware *fw, struct hexline *hx, |
119 | int *pos) | 116 | int *pos) |
120 | { | 117 | { |
121 | u8 *b = (u8 *) &fw->data[*pos]; | 118 | u8 *b = (u8 *) &fw->data[*pos]; |
@@ -146,3 +143,4 @@ static int dvb_usb_get_hexline(const struct firmware *fw, struct hexline *hx, | |||
146 | 143 | ||
147 | return *pos; | 144 | return *pos; |
148 | } | 145 | } |
146 | EXPORT_SYMBOL(dvb_usb_get_hexline); | ||
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h index 57a10de1d3dd..feb098727dc3 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h | |||
@@ -52,8 +52,7 @@ | |||
52 | #define USB_PID_DIBCOM_MOD3000_WARM 0x0bb9 | 52 | #define USB_PID_DIBCOM_MOD3000_WARM 0x0bb9 |
53 | #define USB_PID_DIBCOM_MOD3001_COLD 0x0bc6 | 53 | #define USB_PID_DIBCOM_MOD3001_COLD 0x0bc6 |
54 | #define USB_PID_DIBCOM_MOD3001_WARM 0x0bc7 | 54 | #define USB_PID_DIBCOM_MOD3001_WARM 0x0bc7 |
55 | #define USB_PID_DIBCOM_STK7700 0x1e14 | 55 | #define USB_PID_DIBCOM_STK7700P 0x1e14 |
56 | #define USB_PID_DIBCOM_STK7700_REENUM 0x1e15 | ||
57 | #define USB_PID_DIBCOM_ANCHOR_2135_COLD 0x2131 | 56 | #define USB_PID_DIBCOM_ANCHOR_2135_COLD 0x2131 |
58 | #define USB_PID_GRANDTEC_DVBT_USB_COLD 0x0fa0 | 57 | #define USB_PID_GRANDTEC_DVBT_USB_COLD 0x0fa0 |
59 | #define USB_PID_GRANDTEC_DVBT_USB_WARM 0x0fa1 | 58 | #define USB_PID_GRANDTEC_DVBT_USB_WARM 0x0fa1 |
@@ -95,6 +94,9 @@ | |||
95 | #define USB_PID_WT220U_ZL0353_WARM 0x022b | 94 | #define USB_PID_WT220U_ZL0353_WARM 0x022b |
96 | #define USB_PID_WINTV_NOVA_T_USB2_COLD 0x9300 | 95 | #define USB_PID_WINTV_NOVA_T_USB2_COLD 0x9300 |
97 | #define USB_PID_WINTV_NOVA_T_USB2_WARM 0x9301 | 96 | #define USB_PID_WINTV_NOVA_T_USB2_WARM 0x9301 |
97 | #define USB_PID_HAUPPAUGE_NOVA_T_500 0x1234 | ||
98 | #define USB_PID_HAUPPAUGE_NOVA_T_STICK 0x1234 | ||
99 | #define USB_PID_AVERMEDIA_VOLAR 0x1234 | ||
98 | #define USB_PID_NEBULA_DIGITV 0x0201 | 100 | #define USB_PID_NEBULA_DIGITV 0x0201 |
99 | #define USB_PID_DVICO_BLUEBIRD_LGDT 0xd820 | 101 | #define USB_PID_DVICO_BLUEBIRD_LGDT 0xd820 |
100 | #define USB_PID_DVICO_BLUEBIRD_LG064F_COLD 0xd500 | 102 | #define USB_PID_DVICO_BLUEBIRD_LG064F_COLD 0xd500 |
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb.h b/drivers/media/dvb/dvb-usb/dvb-usb.h index 5546554d3876..44b49db4992e 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb.h | |||
@@ -90,8 +90,8 @@ struct dvb_usb_adapter; | |||
90 | struct usb_data_stream; | 90 | struct usb_data_stream; |
91 | 91 | ||
92 | /** | 92 | /** |
93 | * Properties of USB streaming - TODO this structure does not belong here actually | 93 | * Properties of USB streaming - TODO this structure should be somewhere else |
94 | * describes the kind of USB transfer used for MPEG2-TS-streaming. | 94 | * describes the kind of USB transfer used for data-streaming. |
95 | * (BULK or ISOC) | 95 | * (BULK or ISOC) |
96 | */ | 96 | */ |
97 | struct usb_data_stream_properties { | 97 | struct usb_data_stream_properties { |
@@ -193,10 +193,10 @@ struct dvb_usb_device_properties { | |||
193 | #define CYPRESS_AN2135 1 | 193 | #define CYPRESS_AN2135 1 |
194 | #define CYPRESS_AN2235 2 | 194 | #define CYPRESS_AN2235 2 |
195 | #define CYPRESS_FX2 3 | 195 | #define CYPRESS_FX2 3 |
196 | int usb_ctrl; | 196 | int usb_ctrl; |
197 | int (*download_firmware) (struct usb_device *, const struct firmware *); | ||
197 | const char firmware[FIRMWARE_NAME_MAX]; | 198 | const char firmware[FIRMWARE_NAME_MAX]; |
198 | int (*download_firmware) (struct usb_device *, const struct firmware *); | 199 | int no_reconnect; |
199 | int no_reconnect; | ||
200 | 200 | ||
201 | int size_of_priv; | 201 | int size_of_priv; |
202 | 202 | ||
@@ -212,7 +212,7 @@ struct dvb_usb_device_properties { | |||
212 | #define REMOTE_NO_KEY_PRESSED 0x00 | 212 | #define REMOTE_NO_KEY_PRESSED 0x00 |
213 | #define REMOTE_KEY_PRESSED 0x01 | 213 | #define REMOTE_KEY_PRESSED 0x01 |
214 | #define REMOTE_KEY_REPEAT 0x02 | 214 | #define REMOTE_KEY_REPEAT 0x02 |
215 | struct dvb_usb_rc_key *rc_key_map; | 215 | struct dvb_usb_rc_key *rc_key_map; |
216 | int rc_key_map_size; | 216 | int rc_key_map_size; |
217 | int (*rc_query) (struct dvb_usb_device *, u32 *, int *); | 217 | int (*rc_query) (struct dvb_usb_device *, u32 *, int *); |
218 | int rc_interval; | 218 | int rc_interval; |
@@ -234,13 +234,11 @@ struct dvb_usb_device_properties { | |||
234 | * | 234 | * |
235 | * @urbs_initialized: number of URBs initialized. | 235 | * @urbs_initialized: number of URBs initialized. |
236 | * @urbs_submitted: number of URBs submitted. | 236 | * @urbs_submitted: number of URBs submitted. |
237 | * | ||
238 | * TODO put this in the correct place. | ||
239 | */ | 237 | */ |
240 | #define MAX_NO_URBS_FOR_DATA_STREAM 10 | 238 | #define MAX_NO_URBS_FOR_DATA_STREAM 10 |
241 | struct usb_data_stream { | 239 | struct usb_data_stream { |
242 | struct usb_device *udev; | 240 | struct usb_device *udev; |
243 | struct usb_data_stream_properties props; | 241 | struct usb_data_stream_properties props; |
244 | 242 | ||
245 | #define USB_STATE_INIT 0x00 | 243 | #define USB_STATE_INIT 0x00 |
246 | #define USB_STATE_URB_BUF 0x01 | 244 | #define USB_STATE_URB_BUF 0x01 |
@@ -248,12 +246,11 @@ struct usb_data_stream { | |||
248 | 246 | ||
249 | void (*complete) (struct usb_data_stream *, u8 *, size_t); | 247 | void (*complete) (struct usb_data_stream *, u8 *, size_t); |
250 | 248 | ||
251 | struct urb *urb_list[MAX_NO_URBS_FOR_DATA_STREAM]; | 249 | struct urb *urb_list[MAX_NO_URBS_FOR_DATA_STREAM]; |
252 | 250 | int buf_num; | |
253 | int buf_num; | 251 | unsigned long buf_size; |
254 | unsigned long buf_size; | 252 | u8 *buf_list[MAX_NO_URBS_FOR_DATA_STREAM]; |
255 | u8 *buf_list[MAX_NO_URBS_FOR_DATA_STREAM]; | 253 | dma_addr_t dma_addr[MAX_NO_URBS_FOR_DATA_STREAM]; |
256 | dma_addr_t dma_addr[MAX_NO_URBS_FOR_DATA_STREAM]; | ||
257 | 254 | ||
258 | int urbs_initialized; | 255 | int urbs_initialized; |
259 | int urbs_submitted; | 256 | int urbs_submitted; |
@@ -271,8 +268,8 @@ struct usb_data_stream { | |||
271 | * @pll_addr: I2C address of the tuner for programming | 268 | * @pll_addr: I2C address of the tuner for programming |
272 | * @pll_init: array containing the initialization buffer | 269 | * @pll_init: array containing the initialization buffer |
273 | * @pll_desc: pointer to the appropriate struct dvb_pll_desc | 270 | * @pll_desc: pointer to the appropriate struct dvb_pll_desc |
274 | * | ||
275 | * @tuner_pass_ctrl: called to (de)activate tuner passthru of the demod or the board | 271 | * @tuner_pass_ctrl: called to (de)activate tuner passthru of the demod or the board |
272 | * | ||
276 | * @dvb_adap: device's dvb_adapter. | 273 | * @dvb_adap: device's dvb_adapter. |
277 | * @dmxdev: device's dmxdev. | 274 | * @dmxdev: device's dmxdev. |
278 | * @demux: device's software demuxer. | 275 | * @demux: device's software demuxer. |
@@ -280,8 +277,10 @@ struct usb_data_stream { | |||
280 | * @dvb_frontend: device's frontend. | 277 | * @dvb_frontend: device's frontend. |
281 | * @max_feed_count: how many feeds can be handled simultaneously by this | 278 | * @max_feed_count: how many feeds can be handled simultaneously by this |
282 | * device | 279 | * device |
280 | * | ||
281 | * @fe_init: rerouted frontend-init (wakeup) function. | ||
283 | * @fe_sleep: rerouted frontend-sleep function. | 282 | * @fe_sleep: rerouted frontend-sleep function. |
284 | * @fe_init: rerouted frontend-init (wakeup) function. | 283 | * |
285 | * @stream: the usb data stream. | 284 | * @stream: the usb data stream. |
286 | */ | 285 | */ |
287 | struct dvb_usb_adapter { | 286 | struct dvb_usb_adapter { |
@@ -292,7 +291,7 @@ struct dvb_usb_adapter { | |||
292 | #define DVB_USB_ADAP_STATE_DVB 0x001 | 291 | #define DVB_USB_ADAP_STATE_DVB 0x001 |
293 | int state; | 292 | int state; |
294 | 293 | ||
295 | int id; | 294 | u8 id; |
296 | 295 | ||
297 | int feedcount; | 296 | int feedcount; |
298 | int pid_filtering; | 297 | int pid_filtering; |
@@ -311,8 +310,8 @@ struct dvb_usb_adapter { | |||
311 | struct dvb_frontend *fe; | 310 | struct dvb_frontend *fe; |
312 | int max_feed_count; | 311 | int max_feed_count; |
313 | 312 | ||
314 | int (*fe_sleep) (struct dvb_frontend *); | ||
315 | int (*fe_init) (struct dvb_frontend *); | 313 | int (*fe_init) (struct dvb_frontend *); |
314 | int (*fe_sleep) (struct dvb_frontend *); | ||
316 | 315 | ||
317 | struct usb_data_stream stream; | 316 | struct usb_data_stream stream; |
318 | 317 | ||
@@ -400,5 +399,7 @@ struct hexline { | |||
400 | u8 chk; | 399 | u8 chk; |
401 | }; | 400 | }; |
402 | extern int usb_cypress_load_firmware(struct usb_device *udev, const struct firmware *fw, int type); | 401 | extern int usb_cypress_load_firmware(struct usb_device *udev, const struct firmware *fw, int type); |
402 | extern int dvb_usb_get_hexline(const struct firmware *fw, struct hexline *hx, int *pos); | ||
403 | |||
403 | 404 | ||
404 | #endif | 405 | #endif |
diff --git a/drivers/media/dvb/dvb-usb/usb-urb.c b/drivers/media/dvb/dvb-usb/usb-urb.c index f2f3bb6044aa..8728cf347a71 100644 --- a/drivers/media/dvb/dvb-usb/usb-urb.c +++ b/drivers/media/dvb/dvb-usb/usb-urb.c | |||
@@ -122,7 +122,7 @@ static int usb_allocate_stream_buffers(struct usb_data_stream *stream, int num, | |||
122 | usb_free_stream_buffers(stream); | 122 | usb_free_stream_buffers(stream); |
123 | return -ENOMEM; | 123 | return -ENOMEM; |
124 | } | 124 | } |
125 | deb_mem("buffer %d: %p (dma: %ld)\n", | 125 | deb_mem("buffer %d: %p (dma: %u)\n", |
126 | stream->buf_num, stream->buf_list[stream->buf_num], stream->dma_addr[stream->buf_num]); | 126 | stream->buf_num, stream->buf_list[stream->buf_num], stream->dma_addr[stream->buf_num]); |
127 | memset(stream->buf_list[stream->buf_num],0,size); | 127 | memset(stream->buf_list[stream->buf_num],0,size); |
128 | stream->state |= USB_STATE_URB_BUF; | 128 | stream->state |= USB_STATE_URB_BUF; |
diff --git a/drivers/media/dvb/frontends/dib3000mc.c b/drivers/media/dvb/frontends/dib3000mc.c index cc28417fa33a..d7c4a98da125 100644 --- a/drivers/media/dvb/frontends/dib3000mc.c +++ b/drivers/media/dvb/frontends/dib3000mc.c | |||
@@ -584,56 +584,6 @@ static int dib3000mc_tune(struct dvb_frontend *demod, struct dibx000_ofdm_channe | |||
584 | return 0; | 584 | return 0; |
585 | } | 585 | } |
586 | 586 | ||
587 | static int dib3000mc_demod_output_mode(struct dvb_frontend *demod, int mode) | ||
588 | { | ||
589 | struct dib3000mc_state *state = demod->demodulator_priv; | ||
590 | return dib3000mc_set_output_mode(state, mode); | ||
591 | } | ||
592 | |||
593 | static int dib3000mc_i2c_enumeration(struct dvb_frontend *demod[], int no_of_demods, u8 default_addr) | ||
594 | { | ||
595 | struct dib3000mc_state *st; | ||
596 | int k,ret=0; | ||
597 | u8 new_addr; | ||
598 | |||
599 | static u8 DIB3000MC_I2C_ADDRESS[] = {20,22,24,26}; | ||
600 | |||
601 | for (k = no_of_demods-1; k >= 0; k--) { | ||
602 | st = demod[k]->demodulator_priv; | ||
603 | |||
604 | /* designated i2c address */ | ||
605 | new_addr = DIB3000MC_I2C_ADDRESS[k]; | ||
606 | |||
607 | st->i2c_addr = new_addr; | ||
608 | if (dib3000mc_identify(st) != 0) { | ||
609 | st->i2c_addr = default_addr; | ||
610 | if (dib3000mc_identify(st) != 0) { | ||
611 | dprintk("-E- DiB3000P/MC #%d: not identified\n", k); | ||
612 | return -EINVAL; | ||
613 | } | ||
614 | } | ||
615 | |||
616 | /* turn on div_out */ | ||
617 | dib3000mc_demod_output_mode(demod[k], OUTMODE_MPEG2_PAR_CONT_CLK); | ||
618 | |||
619 | // set new i2c address and force divstr (Bit 1) to value 0 (Bit 0) | ||
620 | ret |= dib3000mc_write_word(st, 1024, (new_addr << 3) | 0x1); | ||
621 | st->i2c_addr = new_addr; | ||
622 | } | ||
623 | |||
624 | for (k = 0; k < no_of_demods; k++) { | ||
625 | st = demod[k]->demodulator_priv; | ||
626 | |||
627 | ret |= dib3000mc_write_word(st, 1024, st->i2c_addr << 3); | ||
628 | |||
629 | /* turn off data output */ | ||
630 | dib3000mc_demod_output_mode(demod[k],OUTMODE_HIGH_Z); | ||
631 | dib3000mc_write_word(st, 769, (1 << 7) ); | ||
632 | |||
633 | } | ||
634 | return 0; | ||
635 | } | ||
636 | |||
637 | struct i2c_adapter * dib3000mc_get_tuner_i2c_master(struct dvb_frontend *demod, int gating) | 587 | struct i2c_adapter * dib3000mc_get_tuner_i2c_master(struct dvb_frontend *demod, int gating) |
638 | { | 588 | { |
639 | struct dib3000mc_state *st = demod->demodulator_priv; | 589 | struct dib3000mc_state *st = demod->demodulator_priv; |
@@ -826,61 +776,76 @@ void dib3000mc_set_config(struct dvb_frontend *fe, struct dib3000mc_config *cfg) | |||
826 | } | 776 | } |
827 | EXPORT_SYMBOL(dib3000mc_set_config); | 777 | EXPORT_SYMBOL(dib3000mc_set_config); |
828 | 778 | ||
829 | static struct dvb_frontend_ops dib3000mc_ops; | 779 | int dib3000mc_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 default_addr, struct dib3000mc_config cfg[]) |
830 | |||
831 | int dib3000mc_attach(struct i2c_adapter *i2c_adap, int no_of_demods, u8 default_addr, u8 do_i2c_enum, struct dib3000mc_config cfg[], struct dvb_frontend *demod[]) | ||
832 | { | 780 | { |
833 | struct dib3000mc_state *st; | 781 | struct dib3000mc_state st = { .i2c_adap = i2c }; |
834 | int k, num=0; | 782 | int k; |
835 | 783 | u8 new_addr; | |
836 | if (no_of_demods < 1) | ||
837 | return -EINVAL; | ||
838 | 784 | ||
839 | for (k = 0; k < no_of_demods; k++) { | 785 | static u8 DIB3000MC_I2C_ADDRESS[] = {20,22,24,26}; |
840 | st = kzalloc(sizeof(struct dib3000mc_state), GFP_KERNEL); | ||
841 | if (st == NULL) | ||
842 | goto error; | ||
843 | 786 | ||
844 | num++; | 787 | for (k = no_of_demods-1; k >= 0; k--) { |
788 | st.cfg = &cfg[k]; | ||
845 | 789 | ||
846 | st->cfg = &cfg[k]; | 790 | /* designated i2c address */ |
847 | // st->gpio_val = cfg[k].gpio_val; | 791 | new_addr = DIB3000MC_I2C_ADDRESS[k]; |
848 | // st->gpio_dir = cfg[k].gpio_dir; | 792 | st.i2c_addr = new_addr; |
849 | st->i2c_adap = i2c_adap; | 793 | if (dib3000mc_identify(&st) != 0) { |
794 | st.i2c_addr = default_addr; | ||
795 | if (dib3000mc_identify(&st) != 0) { | ||
796 | dprintk("-E- DiB3000P/MC #%d: not identified\n", k); | ||
797 | return -ENODEV; | ||
798 | } | ||
799 | } | ||
850 | 800 | ||
851 | demod[k] = &st->demod; | 801 | dib3000mc_set_output_mode(&st, OUTMODE_MPEG2_PAR_CONT_CLK); |
852 | demod[k]->demodulator_priv = st; | ||
853 | memcpy(&st->demod.ops, &dib3000mc_ops, sizeof(struct dvb_frontend_ops)); | ||
854 | 802 | ||
855 | // INIT_COMPONENT_REGISTER_ACCESS(&st->register_access, 12, 16, dib7000p_register_read, dib7000p_register_write, st); | 803 | // set new i2c address and force divstr (Bit 1) to value 0 (Bit 0) |
856 | // demod[k]->register_access = &st->register_access; | 804 | dib3000mc_write_word(&st, 1024, (new_addr << 3) | 0x1); |
805 | st.i2c_addr = new_addr; | ||
857 | } | 806 | } |
858 | 807 | ||
859 | if (do_i2c_enum) { | 808 | for (k = 0; k < no_of_demods; k++) { |
860 | if (dib3000mc_i2c_enumeration(demod,no_of_demods,default_addr) != 0) | 809 | st.cfg = &cfg[k]; |
861 | goto error; | 810 | st.i2c_addr = DIB3000MC_I2C_ADDRESS[k]; |
862 | } else { | ||
863 | st = demod[0]->demodulator_priv; | ||
864 | st->i2c_addr = default_addr; | ||
865 | if (dib3000mc_identify(st) != 0) | ||
866 | goto error; | ||
867 | } | ||
868 | 811 | ||
869 | for (k = 0; k < num; k++) { | 812 | dib3000mc_write_word(&st, 1024, st.i2c_addr << 3); |
870 | st = demod[k]->demodulator_priv; | ||
871 | dibx000_init_i2c_master(&st->i2c_master, DIB3000MC, st->i2c_adap, st->i2c_addr); | ||
872 | } | ||
873 | 813 | ||
814 | /* turn off data output */ | ||
815 | dib3000mc_set_output_mode(&st, OUTMODE_HIGH_Z); | ||
816 | } | ||
874 | return 0; | 817 | return 0; |
818 | } | ||
819 | EXPORT_SYMBOL(dib3000mc_i2c_enumeration); | ||
820 | |||
821 | static struct dvb_frontend_ops dib3000mc_ops; | ||
822 | |||
823 | struct dvb_frontend * dib3000mc_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib3000mc_config *cfg) | ||
824 | { | ||
825 | struct dvb_frontend *demod; | ||
826 | struct dib3000mc_state *st; | ||
827 | st = kzalloc(sizeof(struct dib3000mc_state), GFP_KERNEL); | ||
828 | if (st == NULL) | ||
829 | return NULL; | ||
830 | |||
831 | st->cfg = cfg; | ||
832 | st->i2c_adap = i2c_adap; | ||
833 | |||
834 | demod = &st->demod; | ||
835 | demod->demodulator_priv = st; | ||
836 | memcpy(&st->demod.ops, &dib3000mc_ops, sizeof(struct dvb_frontend_ops)); | ||
837 | |||
838 | if (dib3000mc_identify(st) != 0) | ||
839 | goto error; | ||
840 | |||
841 | dibx000_init_i2c_master(&st->i2c_master, DIB3000MC, st->i2c_adap, st->i2c_addr); | ||
842 | |||
843 | return demod; | ||
875 | 844 | ||
876 | error: | 845 | error: |
877 | for (k = 0; k < num; k++) { | 846 | kfree(st); |
878 | kfree(demod[k]->demodulator_priv); | 847 | return NULL; |
879 | demod[k] = NULL; | ||
880 | } | ||
881 | return -EINVAL; | ||
882 | } | 848 | } |
883 | |||
884 | EXPORT_SYMBOL(dib3000mc_attach); | 849 | EXPORT_SYMBOL(dib3000mc_attach); |
885 | 850 | ||
886 | static struct dvb_frontend_ops dib3000mc_ops = { | 851 | static struct dvb_frontend_ops dib3000mc_ops = { |
diff --git a/drivers/media/dvb/frontends/dib3000mc.h b/drivers/media/dvb/frontends/dib3000mc.h index fd0b2e755993..b198cd5b1843 100644 --- a/drivers/media/dvb/frontends/dib3000mc.h +++ b/drivers/media/dvb/frontends/dib3000mc.h | |||
@@ -37,17 +37,17 @@ struct dib3000mc_config { | |||
37 | #define DEFAULT_DIB3000P_I2C_ADDRESS 24 | 37 | #define DEFAULT_DIB3000P_I2C_ADDRESS 24 |
38 | 38 | ||
39 | #if defined(CONFIG_DVB_DIB3000MC) || defined(CONFIG_DVB_DIB3000MC_MODULE) | 39 | #if defined(CONFIG_DVB_DIB3000MC) || defined(CONFIG_DVB_DIB3000MC_MODULE) |
40 | extern int dib3000mc_attach(struct i2c_adapter *i2c_adap, int no_of_demods, u8 default_addr, | 40 | extern struct dvb_frontend * dib3000mc_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib3000mc_config *cfg); |
41 | u8 do_i2c_enum, struct dib3000mc_config cfg[], struct dvb_frontend *demod[]); | ||
42 | #else | 41 | #else |
43 | static inline struct dvb_frontend* dib3000mc_attach(const struct dib3000_config* config, | 42 | static inline struct dvb_frontend * dib3000mc_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib3000mc_config *cfg) |
44 | struct i2c_adapter* i2c, struct dib_fe_xfer_ops *xfer_ops) | ||
45 | { | 43 | { |
46 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 44 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); |
47 | return NULL; | 45 | return NULL; |
48 | } | 46 | } |
49 | #endif // CONFIG_DVB_DIB3000MC | 47 | #endif // CONFIG_DVB_DIB3000MC |
50 | 48 | ||
49 | extern int dib3000mc_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 default_addr, struct dib3000mc_config cfg[]); | ||
50 | |||
51 | extern struct i2c_adapter * dib3000mc_get_tuner_i2c_master(struct dvb_frontend *demod, int gating); | 51 | extern struct i2c_adapter * dib3000mc_get_tuner_i2c_master(struct dvb_frontend *demod, int gating); |
52 | 52 | ||
53 | extern int dib3000mc_pid_control(struct dvb_frontend *fe, int index, int pid,int onoff); | 53 | extern int dib3000mc_pid_control(struct dvb_frontend *fe, int index, int pid,int onoff); |
diff --git a/drivers/media/dvb/frontends/mt2060.c b/drivers/media/dvb/frontends/mt2060.c index 508ec1b6d1fb..19bd66a1816a 100644 --- a/drivers/media/dvb/frontends/mt2060.c +++ b/drivers/media/dvb/frontends/mt2060.c | |||
@@ -247,6 +247,9 @@ static void mt2060_calibrate(struct mt2060_priv *priv) | |||
247 | if (mt2060_writeregs(priv,mt2060_config2,sizeof(mt2060_config2))) | 247 | if (mt2060_writeregs(priv,mt2060_config2,sizeof(mt2060_config2))) |
248 | return; | 248 | return; |
249 | 249 | ||
250 | /* initialize the clock output */ | ||
251 | mt2060_writereg(priv, REG_VGAG, (priv->cfg->clock_out << 6) | 0x30); | ||
252 | |||
250 | do { | 253 | do { |
251 | b |= (1 << 6); // FM1SS; | 254 | b |= (1 << 6); // FM1SS; |
252 | mt2060_writereg(priv, REG_LO2C1,b); | 255 | mt2060_writereg(priv, REG_LO2C1,b); |
@@ -294,13 +297,13 @@ static int mt2060_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth) | |||
294 | static int mt2060_init(struct dvb_frontend *fe) | 297 | static int mt2060_init(struct dvb_frontend *fe) |
295 | { | 298 | { |
296 | struct mt2060_priv *priv = fe->tuner_priv; | 299 | struct mt2060_priv *priv = fe->tuner_priv; |
297 | return mt2060_writereg(priv, REG_VGAG,0x33); | 300 | return mt2060_writereg(priv, REG_VGAG, (priv->cfg->clock_out << 6) | 0x33); |
298 | } | 301 | } |
299 | 302 | ||
300 | static int mt2060_sleep(struct dvb_frontend *fe) | 303 | static int mt2060_sleep(struct dvb_frontend *fe) |
301 | { | 304 | { |
302 | struct mt2060_priv *priv = fe->tuner_priv; | 305 | struct mt2060_priv *priv = fe->tuner_priv; |
303 | return mt2060_writereg(priv, REG_VGAG,0x30); | 306 | return mt2060_writereg(priv, REG_VGAG, (priv->cfg->clock_out << 6) | 0x30); |
304 | } | 307 | } |
305 | 308 | ||
306 | static int mt2060_release(struct dvb_frontend *fe) | 309 | static int mt2060_release(struct dvb_frontend *fe) |
diff --git a/drivers/media/dvb/frontends/mt2060.h b/drivers/media/dvb/frontends/mt2060.h index c58b03e82345..471d3326e29d 100644 --- a/drivers/media/dvb/frontends/mt2060.h +++ b/drivers/media/dvb/frontends/mt2060.h | |||
@@ -27,7 +27,7 @@ struct i2c_adapter; | |||
27 | 27 | ||
28 | struct mt2060_config { | 28 | struct mt2060_config { |
29 | u8 i2c_address; | 29 | u8 i2c_address; |
30 | /* Shall we add settings for the discrete outputs ? */ | 30 | u8 clock_out; /* 0 = off, 1 = CLK/1, 2 = CLK/2, 3 = CLK/4 */ |
31 | }; | 31 | }; |
32 | 32 | ||
33 | extern int mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2060_config *cfg, u16 if1); | 33 | extern int mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2060_config *cfg, u16 if1); |