diff options
author | Hartmut Birr <e9hack@googlemail.com> | 2007-04-21 18:17:49 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-04-27 14:45:46 -0400 |
commit | fd9c66e269a44bd3c6c615957c79b21f3dde69af (patch) | |
tree | 586a103569630cd0f3ed376ed3af9de03dbde0bb /drivers/media | |
parent | a1314b1ab61027ac803b0899ead1ce1229d46a37 (diff) |
V4L/DVB (5542): Budget-av: Remove polarity switching of the clock for DVB-C
Remove the polarity switching of the clock for the DVB-C cards in
budget-av.c. This hack is no longer necessary because the saa7146 can
do the job to remove the additional FEC bytes from the TS.
Signed-off-by: Hartmut Birr <e9hack@googlemail.com>
Signed-off-by: Oliver Endriss <o.endriss@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/dvb/frontends/tda10021.c | 13 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/tda10021.h | 8 | ||||
-rw-r--r-- | drivers/media/dvb/ttpci/budget-av.c | 40 | ||||
-rw-r--r-- | drivers/media/dvb/ttpci/budget-core.c | 42 |
4 files changed, 36 insertions, 67 deletions
diff --git a/drivers/media/dvb/frontends/tda10021.c b/drivers/media/dvb/frontends/tda10021.c index 9348e76fe2e0..ef9159f8c3fa 100644 --- a/drivers/media/dvb/frontends/tda10021.c +++ b/drivers/media/dvb/frontends/tda10021.c | |||
@@ -64,7 +64,7 @@ static u8 tda10021_inittab[0x40]= | |||
64 | { | 64 | { |
65 | 0x73, 0x6a, 0x23, 0x0a, 0x02, 0x37, 0x77, 0x1a, | 65 | 0x73, 0x6a, 0x23, 0x0a, 0x02, 0x37, 0x77, 0x1a, |
66 | 0x37, 0x6a, 0x17, 0x8a, 0x1e, 0x86, 0x43, 0x40, | 66 | 0x37, 0x6a, 0x17, 0x8a, 0x1e, 0x86, 0x43, 0x40, |
67 | 0xb8, 0x3f, 0xa0, 0x00, 0xcd, 0x01, 0x00, 0xff, | 67 | 0xb8, 0x3f, 0xa1, 0x00, 0xcd, 0x01, 0x00, 0xff, |
68 | 0x11, 0x00, 0x7c, 0x31, 0x30, 0x20, 0x00, 0x00, | 68 | 0x11, 0x00, 0x7c, 0x31, 0x30, 0x20, 0x00, 0x00, |
69 | 0x02, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x00, | 69 | 0x02, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x00, |
70 | 0x07, 0x00, 0x33, 0x11, 0x0d, 0x95, 0x08, 0x58, | 70 | 0x07, 0x00, 0x33, 0x11, 0x0d, 0x95, 0x08, 0x58, |
@@ -201,16 +201,6 @@ static int tda10021_set_symbolrate (struct tda10021_state* state, u32 symbolrate | |||
201 | return 0; | 201 | return 0; |
202 | } | 202 | } |
203 | 203 | ||
204 | static int tda10021_write(struct dvb_frontend* fe, u8 *buf, int len) | ||
205 | { | ||
206 | struct tda10021_state* state = fe->demodulator_priv; | ||
207 | |||
208 | if (len != 2) | ||
209 | return -EINVAL; | ||
210 | |||
211 | return _tda10021_writereg(state, buf[0], buf[1]); | ||
212 | } | ||
213 | |||
214 | static int tda10021_init (struct dvb_frontend *fe) | 204 | static int tda10021_init (struct dvb_frontend *fe) |
215 | { | 205 | { |
216 | struct tda10021_state* state = fe->demodulator_priv; | 206 | struct tda10021_state* state = fe->demodulator_priv; |
@@ -461,7 +451,6 @@ static struct dvb_frontend_ops tda10021_ops = { | |||
461 | 451 | ||
462 | .init = tda10021_init, | 452 | .init = tda10021_init, |
463 | .sleep = tda10021_sleep, | 453 | .sleep = tda10021_sleep, |
464 | .write = tda10021_write, | ||
465 | .i2c_gate_ctrl = tda10021_i2c_gate_ctrl, | 454 | .i2c_gate_ctrl = tda10021_i2c_gate_ctrl, |
466 | 455 | ||
467 | .set_frontend = tda10021_set_parameters, | 456 | .set_frontend = tda10021_set_parameters, |
diff --git a/drivers/media/dvb/frontends/tda10021.h b/drivers/media/dvb/frontends/tda10021.h index e3da780108f6..b8efd498d4bf 100644 --- a/drivers/media/dvb/frontends/tda10021.h +++ b/drivers/media/dvb/frontends/tda10021.h | |||
@@ -44,12 +44,4 @@ static inline struct dvb_frontend* tda10021_attach(const struct tda10021_config* | |||
44 | } | 44 | } |
45 | #endif // CONFIG_DVB_TDA10021 | 45 | #endif // CONFIG_DVB_TDA10021 |
46 | 46 | ||
47 | static inline int tda10021_writereg(struct dvb_frontend *fe, u8 reg, u8 val) { | ||
48 | int r = 0; | ||
49 | u8 buf[] = {reg, val}; | ||
50 | if (fe->ops.write) | ||
51 | r = fe->ops.write(fe, buf, 2); | ||
52 | return r; | ||
53 | } | ||
54 | |||
55 | #endif // TDA10021_H | 47 | #endif // TDA10021_H |
diff --git a/drivers/media/dvb/ttpci/budget-av.c b/drivers/media/dvb/ttpci/budget-av.c index 3035b224c7a3..54ca3a3288e7 100644 --- a/drivers/media/dvb/ttpci/budget-av.c +++ b/drivers/media/dvb/ttpci/budget-av.c | |||
@@ -66,9 +66,6 @@ struct budget_av { | |||
66 | int slot_status; | 66 | int slot_status; |
67 | struct dvb_ca_en50221 ca; | 67 | struct dvb_ca_en50221 ca; |
68 | u8 reinitialise_demod:1; | 68 | u8 reinitialise_demod:1; |
69 | u8 tda10021_poclkp:1; | ||
70 | u8 tda10021_ts_enabled; | ||
71 | int (*tda10021_set_frontend)(struct dvb_frontend *fe, struct dvb_frontend_parameters *p); | ||
72 | }; | 69 | }; |
73 | 70 | ||
74 | static int ciintf_slot_shutdown(struct dvb_ca_en50221 *ca, int slot); | 71 | static int ciintf_slot_shutdown(struct dvb_ca_en50221 *ca, int slot); |
@@ -234,12 +231,6 @@ static int ciintf_slot_reset(struct dvb_ca_en50221 *ca, int slot) | |||
234 | if (budget_av->reinitialise_demod) | 231 | if (budget_av->reinitialise_demod) |
235 | dvb_frontend_reinitialise(budget_av->budget.dvb_frontend); | 232 | dvb_frontend_reinitialise(budget_av->budget.dvb_frontend); |
236 | 233 | ||
237 | /* set tda10021 back to original clock configuration on reset */ | ||
238 | if (budget_av->tda10021_poclkp) { | ||
239 | tda10021_writereg(budget_av->budget.dvb_frontend, 0x12, 0xa0); | ||
240 | budget_av->tda10021_ts_enabled = 0; | ||
241 | } | ||
242 | |||
243 | return 0; | 234 | return 0; |
244 | } | 235 | } |
245 | 236 | ||
@@ -256,11 +247,6 @@ static int ciintf_slot_shutdown(struct dvb_ca_en50221 *ca, int slot) | |||
256 | ttpci_budget_set_video_port(saa, BUDGET_VIDEO_PORTB); | 247 | ttpci_budget_set_video_port(saa, BUDGET_VIDEO_PORTB); |
257 | budget_av->slot_status = SLOTSTATUS_NONE; | 248 | budget_av->slot_status = SLOTSTATUS_NONE; |
258 | 249 | ||
259 | /* set tda10021 back to original clock configuration when cam removed */ | ||
260 | if (budget_av->tda10021_poclkp) { | ||
261 | tda10021_writereg(budget_av->budget.dvb_frontend, 0x12, 0xa0); | ||
262 | budget_av->tda10021_ts_enabled = 0; | ||
263 | } | ||
264 | return 0; | 250 | return 0; |
265 | } | 251 | } |
266 | 252 | ||
@@ -276,12 +262,6 @@ static int ciintf_slot_ts_enable(struct dvb_ca_en50221 *ca, int slot) | |||
276 | 262 | ||
277 | ttpci_budget_set_video_port(saa, BUDGET_VIDEO_PORTA); | 263 | ttpci_budget_set_video_port(saa, BUDGET_VIDEO_PORTA); |
278 | 264 | ||
279 | /* tda10021 seems to need a different TS clock config when data is routed to the CAM */ | ||
280 | if (budget_av->tda10021_poclkp) { | ||
281 | tda10021_writereg(budget_av->budget.dvb_frontend, 0x12, 0xa1); | ||
282 | budget_av->tda10021_ts_enabled = 1; | ||
283 | } | ||
284 | |||
285 | return 0; | 265 | return 0; |
286 | } | 266 | } |
287 | 267 | ||
@@ -927,23 +907,6 @@ static u8 read_pwm(struct budget_av *budget_av) | |||
927 | #define SUBID_DVBT_KNC1 0x0030 | 907 | #define SUBID_DVBT_KNC1 0x0030 |
928 | #define SUBID_DVBT_CINERGY1200 0x1157 | 908 | #define SUBID_DVBT_CINERGY1200 0x1157 |
929 | 909 | ||
930 | |||
931 | static int tda10021_set_frontend(struct dvb_frontend *fe, | ||
932 | struct dvb_frontend_parameters *p) | ||
933 | { | ||
934 | struct budget_av* budget_av = fe->dvb->priv; | ||
935 | int result; | ||
936 | |||
937 | result = budget_av->tda10021_set_frontend(fe, p); | ||
938 | if (budget_av->tda10021_ts_enabled) { | ||
939 | tda10021_writereg(budget_av->budget.dvb_frontend, 0x12, 0xa1); | ||
940 | } else { | ||
941 | tda10021_writereg(budget_av->budget.dvb_frontend, 0x12, 0xa0); | ||
942 | } | ||
943 | |||
944 | return result; | ||
945 | } | ||
946 | |||
947 | static void frontend_init(struct budget_av *budget_av) | 910 | static void frontend_init(struct budget_av *budget_av) |
948 | { | 911 | { |
949 | struct saa7146_dev * saa = budget_av->budget.dev; | 912 | struct saa7146_dev * saa = budget_av->budget.dev; |
@@ -1025,9 +988,6 @@ static void frontend_init(struct budget_av *budget_av) | |||
1025 | &budget_av->budget.i2c_adap, | 988 | &budget_av->budget.i2c_adap, |
1026 | read_pwm(budget_av)); | 989 | read_pwm(budget_av)); |
1027 | if (fe) { | 990 | if (fe) { |
1028 | budget_av->tda10021_poclkp = 1; | ||
1029 | budget_av->tda10021_set_frontend = fe->ops.set_frontend; | ||
1030 | fe->ops.set_frontend = tda10021_set_frontend; | ||
1031 | fe->ops.tuner_ops.set_params = philips_cu1216_tuner_set_params; | 991 | fe->ops.tuner_ops.set_params = philips_cu1216_tuner_set_params; |
1032 | } | 992 | } |
1033 | break; | 993 | break; |
diff --git a/drivers/media/dvb/ttpci/budget-core.c b/drivers/media/dvb/ttpci/budget-core.c index e15562f81664..cef9d8d8a122 100644 --- a/drivers/media/dvb/ttpci/budget-core.c +++ b/drivers/media/dvb/ttpci/budget-core.c | |||
@@ -41,11 +41,14 @@ | |||
41 | 41 | ||
42 | #define TS_WIDTH (2 * TS_SIZE) | 42 | #define TS_WIDTH (2 * TS_SIZE) |
43 | #define TS_WIDTH_ACTIVY TS_SIZE | 43 | #define TS_WIDTH_ACTIVY TS_SIZE |
44 | #define TS_WIDTH_DVBC TS_SIZE | ||
44 | #define TS_HEIGHT_MASK 0xf00 | 45 | #define TS_HEIGHT_MASK 0xf00 |
45 | #define TS_HEIGHT_MASK_ACTIVY 0xc00 | 46 | #define TS_HEIGHT_MASK_ACTIVY 0xc00 |
47 | #define TS_HEIGHT_MASK_DVBC 0xe00 | ||
46 | #define TS_MIN_BUFSIZE_K 188 | 48 | #define TS_MIN_BUFSIZE_K 188 |
47 | #define TS_MAX_BUFSIZE_K 1410 | 49 | #define TS_MAX_BUFSIZE_K 1410 |
48 | #define TS_MAX_BUFSIZE_K_ACTIVY 564 | 50 | #define TS_MAX_BUFSIZE_K_ACTIVY 564 |
51 | #define TS_MAX_BUFSIZE_K_DVBC 1316 | ||
49 | #define BUFFER_WARNING_WAIT (30*HZ) | 52 | #define BUFFER_WARNING_WAIT (30*HZ) |
50 | 53 | ||
51 | int budget_debug; | 54 | int budget_debug; |
@@ -122,7 +125,13 @@ static int start_ts_capture(struct budget *budget) | |||
122 | mdelay(10); | 125 | mdelay(10); |
123 | 126 | ||
124 | saa7146_write(dev, BASE_ODD3, 0); | 127 | saa7146_write(dev, BASE_ODD3, 0); |
125 | saa7146_write(dev, BASE_EVEN3, 0); | 128 | if (budget->buffer_size > budget->buffer_height * budget->buffer_width) { |
129 | // using odd/even buffers | ||
130 | saa7146_write(dev, BASE_EVEN3, budget->buffer_height * budget->buffer_width); | ||
131 | } else { | ||
132 | // using a single buffer | ||
133 | saa7146_write(dev, BASE_EVEN3, 0); | ||
134 | } | ||
126 | saa7146_write(dev, PROT_ADDR3, budget->buffer_size); | 135 | saa7146_write(dev, PROT_ADDR3, budget->buffer_size); |
127 | saa7146_write(dev, BASE_PAGE3, budget->pt.dma | ME1 | 0x90); | 136 | saa7146_write(dev, BASE_PAGE3, budget->pt.dma | ME1 | 0x90); |
128 | 137 | ||
@@ -399,11 +408,22 @@ int ttpci_budget_init(struct budget *budget, struct saa7146_dev *dev, | |||
399 | budget->card = bi; | 408 | budget->card = bi; |
400 | budget->dev = (struct saa7146_dev *) dev; | 409 | budget->dev = (struct saa7146_dev *) dev; |
401 | 410 | ||
402 | if (budget->card->type == BUDGET_FS_ACTIVY) { | 411 | switch(budget->card->type) { |
412 | case BUDGET_FS_ACTIVY: | ||
403 | budget->buffer_width = TS_WIDTH_ACTIVY; | 413 | budget->buffer_width = TS_WIDTH_ACTIVY; |
404 | max_bufsize = TS_MAX_BUFSIZE_K_ACTIVY; | 414 | max_bufsize = TS_MAX_BUFSIZE_K_ACTIVY; |
405 | height_mask = TS_HEIGHT_MASK_ACTIVY; | 415 | height_mask = TS_HEIGHT_MASK_ACTIVY; |
406 | } else { | 416 | break; |
417 | |||
418 | case BUDGET_KNC1C: | ||
419 | case BUDGET_KNC1CP: | ||
420 | case BUDGET_CIN1200C: | ||
421 | budget->buffer_width = TS_WIDTH_DVBC; | ||
422 | max_bufsize = TS_MAX_BUFSIZE_K_DVBC; | ||
423 | height_mask = TS_HEIGHT_MASK_DVBC; | ||
424 | break; | ||
425 | |||
426 | default: | ||
407 | budget->buffer_width = TS_WIDTH; | 427 | budget->buffer_width = TS_WIDTH; |
408 | max_bufsize = TS_MAX_BUFSIZE_K; | 428 | max_bufsize = TS_MAX_BUFSIZE_K; |
409 | height_mask = TS_HEIGHT_MASK; | 429 | height_mask = TS_HEIGHT_MASK; |
@@ -415,14 +435,22 @@ int ttpci_budget_init(struct budget *budget, struct saa7146_dev *dev, | |||
415 | dma_buffer_size = max_bufsize; | 435 | dma_buffer_size = max_bufsize; |
416 | 436 | ||
417 | budget->buffer_height = dma_buffer_size * 1024 / budget->buffer_width; | 437 | budget->buffer_height = dma_buffer_size * 1024 / budget->buffer_width; |
418 | budget->buffer_height &= height_mask; | 438 | if (budget->buffer_height > 0xfff) { |
419 | budget->buffer_size = budget->buffer_height * budget->buffer_width; | 439 | budget->buffer_height /= 2; |
440 | budget->buffer_height &= height_mask; | ||
441 | budget->buffer_size = 2 * budget->buffer_height * budget->buffer_width; | ||
442 | } else { | ||
443 | budget->buffer_height &= height_mask; | ||
444 | budget->buffer_size = budget->buffer_height * budget->buffer_width; | ||
445 | } | ||
420 | budget->buffer_warning_threshold = budget->buffer_size * 80/100; | 446 | budget->buffer_warning_threshold = budget->buffer_size * 80/100; |
421 | budget->buffer_warnings = 0; | 447 | budget->buffer_warnings = 0; |
422 | budget->buffer_warning_time = jiffies; | 448 | budget->buffer_warning_time = jiffies; |
423 | 449 | ||
424 | dprintk(2, "%s: width = %d, height = %d\n", | 450 | dprintk(2, "%s: buffer type = %s, width = %d, height = %d\n", |
425 | budget->dev->name, budget->buffer_width, budget->buffer_height); | 451 | budget->dev->name, |
452 | budget->buffer_size > budget->buffer_width * budget->buffer_height ? "odd/even" : "single", | ||
453 | budget->buffer_width, budget->buffer_height); | ||
426 | printk("%s: dma buffer size %u\n", budget->dev->name, budget->buffer_size); | 454 | printk("%s: dma buffer size %u\n", budget->dev->name, budget->buffer_size); |
427 | 455 | ||
428 | if ((ret = dvb_register_adapter(&budget->dvb_adapter, budget->card->name, owner, &budget->dev->pci->dev)) < 0) { | 456 | if ((ret = dvb_register_adapter(&budget->dvb_adapter, budget->card->name, owner, &budget->dev->pci->dev)) < 0) { |