diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-12-30 20:22:10 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-12-31 06:58:09 -0500 |
commit | f311f68abba633426643bb5e743e4edac4ddf838 (patch) | |
tree | edac6c861be629a22857186579fbc942074a6f0b | |
parent | 2827e1ff8692289a9767ab15be9671bb8df77f79 (diff) |
[media] cxd2820: convert get|set_fontend to use DVBv5 parameters
Instead of using dvb_frontend_parameters struct, that were
designed for a subset of the supported standards, use the DVBv5
cache information.
Also, fill the supported delivery systems at dvb_frontend_ops
struct.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/dvb/frontends/cxd2820r_c.c | 6 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/cxd2820r_core.c | 62 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/cxd2820r_priv.h | 18 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/cxd2820r_t.c | 6 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/cxd2820r_t2.c | 6 |
5 files changed, 34 insertions, 64 deletions
diff --git a/drivers/media/dvb/frontends/cxd2820r_c.c b/drivers/media/dvb/frontends/cxd2820r_c.c index 9d081efcc646..945404991529 100644 --- a/drivers/media/dvb/frontends/cxd2820r_c.c +++ b/drivers/media/dvb/frontends/cxd2820r_c.c | |||
@@ -21,8 +21,7 @@ | |||
21 | 21 | ||
22 | #include "cxd2820r_priv.h" | 22 | #include "cxd2820r_priv.h" |
23 | 23 | ||
24 | int cxd2820r_set_frontend_c(struct dvb_frontend *fe, | 24 | int cxd2820r_set_frontend_c(struct dvb_frontend *fe) |
25 | struct dvb_frontend_parameters *params) | ||
26 | { | 25 | { |
27 | struct cxd2820r_priv *priv = fe->demodulator_priv; | 26 | struct cxd2820r_priv *priv = fe->demodulator_priv; |
28 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; | 27 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; |
@@ -105,8 +104,7 @@ error: | |||
105 | return ret; | 104 | return ret; |
106 | } | 105 | } |
107 | 106 | ||
108 | int cxd2820r_get_frontend_c(struct dvb_frontend *fe, | 107 | int cxd2820r_get_frontend_c(struct dvb_frontend *fe) |
109 | struct dvb_frontend_parameters *p) | ||
110 | { | 108 | { |
111 | struct cxd2820r_priv *priv = fe->demodulator_priv; | 109 | struct cxd2820r_priv *priv = fe->demodulator_priv; |
112 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; | 110 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; |
diff --git a/drivers/media/dvb/frontends/cxd2820r_core.c b/drivers/media/dvb/frontends/cxd2820r_core.c index f4718d562791..56b7c2849179 100644 --- a/drivers/media/dvb/frontends/cxd2820r_core.c +++ b/drivers/media/dvb/frontends/cxd2820r_core.c | |||
@@ -246,8 +246,7 @@ u32 cxd2820r_div_u64_round_closest(u64 dividend, u32 divisor) | |||
246 | return div_u64(dividend + (divisor / 2), divisor); | 246 | return div_u64(dividend + (divisor / 2), divisor); |
247 | } | 247 | } |
248 | 248 | ||
249 | static int cxd2820r_set_frontend(struct dvb_frontend *fe, | 249 | static int cxd2820r_set_frontend(struct dvb_frontend *fe) |
250 | struct dvb_frontend_parameters *p) | ||
251 | { | 250 | { |
252 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; | 251 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; |
253 | int ret; | 252 | int ret; |
@@ -258,7 +257,7 @@ static int cxd2820r_set_frontend(struct dvb_frontend *fe, | |||
258 | ret = cxd2820r_init_t(fe); | 257 | ret = cxd2820r_init_t(fe); |
259 | if (ret < 0) | 258 | if (ret < 0) |
260 | goto err; | 259 | goto err; |
261 | ret = cxd2820r_set_frontend_t(fe, p); | 260 | ret = cxd2820r_set_frontend_t(fe); |
262 | if (ret < 0) | 261 | if (ret < 0) |
263 | goto err; | 262 | goto err; |
264 | break; | 263 | break; |
@@ -266,15 +265,15 @@ static int cxd2820r_set_frontend(struct dvb_frontend *fe, | |||
266 | ret = cxd2820r_init_t(fe); | 265 | ret = cxd2820r_init_t(fe); |
267 | if (ret < 0) | 266 | if (ret < 0) |
268 | goto err; | 267 | goto err; |
269 | ret = cxd2820r_set_frontend_t2(fe, p); | 268 | ret = cxd2820r_set_frontend_t2(fe); |
270 | if (ret < 0) | 269 | if (ret < 0) |
271 | goto err; | 270 | goto err; |
272 | break; | 271 | break; |
273 | case SYS_DVBC_ANNEX_AC: | 272 | case SYS_DVBC_ANNEX_A: |
274 | ret = cxd2820r_init_c(fe); | 273 | ret = cxd2820r_init_c(fe); |
275 | if (ret < 0) | 274 | if (ret < 0) |
276 | goto err; | 275 | goto err; |
277 | ret = cxd2820r_set_frontend_c(fe, p); | 276 | ret = cxd2820r_set_frontend_c(fe); |
278 | if (ret < 0) | 277 | if (ret < 0) |
279 | goto err; | 278 | goto err; |
280 | break; | 279 | break; |
@@ -298,7 +297,7 @@ static int cxd2820r_read_status(struct dvb_frontend *fe, fe_status_t *status) | |||
298 | case SYS_DVBT2: | 297 | case SYS_DVBT2: |
299 | ret = cxd2820r_read_status_t2(fe, status); | 298 | ret = cxd2820r_read_status_t2(fe, status); |
300 | break; | 299 | break; |
301 | case SYS_DVBC_ANNEX_AC: | 300 | case SYS_DVBC_ANNEX_A: |
302 | ret = cxd2820r_read_status_c(fe, status); | 301 | ret = cxd2820r_read_status_c(fe, status); |
303 | break; | 302 | break; |
304 | default: | 303 | default: |
@@ -309,20 +308,20 @@ static int cxd2820r_read_status(struct dvb_frontend *fe, fe_status_t *status) | |||
309 | } | 308 | } |
310 | 309 | ||
311 | static int cxd2820r_get_frontend(struct dvb_frontend *fe, | 310 | static int cxd2820r_get_frontend(struct dvb_frontend *fe, |
312 | struct dvb_frontend_parameters *p) | 311 | struct dtv_frontend_properties *c) |
313 | { | 312 | { |
314 | int ret; | 313 | int ret; |
315 | 314 | ||
316 | dbg("%s: delsys=%d", __func__, fe->dtv_property_cache.delivery_system); | 315 | dbg("%s: delsys=%d", __func__, fe->dtv_property_cache.delivery_system); |
317 | switch (fe->dtv_property_cache.delivery_system) { | 316 | switch (fe->dtv_property_cache.delivery_system) { |
318 | case SYS_DVBT: | 317 | case SYS_DVBT: |
319 | ret = cxd2820r_get_frontend_t(fe, p); | 318 | ret = cxd2820r_get_frontend_t(fe); |
320 | break; | 319 | break; |
321 | case SYS_DVBT2: | 320 | case SYS_DVBT2: |
322 | ret = cxd2820r_get_frontend_t2(fe, p); | 321 | ret = cxd2820r_get_frontend_t2(fe); |
323 | break; | 322 | break; |
324 | case SYS_DVBC_ANNEX_AC: | 323 | case SYS_DVBC_ANNEX_A: |
325 | ret = cxd2820r_get_frontend_c(fe, p); | 324 | ret = cxd2820r_get_frontend_c(fe); |
326 | break; | 325 | break; |
327 | default: | 326 | default: |
328 | ret = -EINVAL; | 327 | ret = -EINVAL; |
@@ -343,7 +342,7 @@ static int cxd2820r_read_ber(struct dvb_frontend *fe, u32 *ber) | |||
343 | case SYS_DVBT2: | 342 | case SYS_DVBT2: |
344 | ret = cxd2820r_read_ber_t2(fe, ber); | 343 | ret = cxd2820r_read_ber_t2(fe, ber); |
345 | break; | 344 | break; |
346 | case SYS_DVBC_ANNEX_AC: | 345 | case SYS_DVBC_ANNEX_A: |
347 | ret = cxd2820r_read_ber_c(fe, ber); | 346 | ret = cxd2820r_read_ber_c(fe, ber); |
348 | break; | 347 | break; |
349 | default: | 348 | default: |
@@ -365,7 +364,7 @@ static int cxd2820r_read_signal_strength(struct dvb_frontend *fe, u16 *strength) | |||
365 | case SYS_DVBT2: | 364 | case SYS_DVBT2: |
366 | ret = cxd2820r_read_signal_strength_t2(fe, strength); | 365 | ret = cxd2820r_read_signal_strength_t2(fe, strength); |
367 | break; | 366 | break; |
368 | case SYS_DVBC_ANNEX_AC: | 367 | case SYS_DVBC_ANNEX_A: |
369 | ret = cxd2820r_read_signal_strength_c(fe, strength); | 368 | ret = cxd2820r_read_signal_strength_c(fe, strength); |
370 | break; | 369 | break; |
371 | default: | 370 | default: |
@@ -387,7 +386,7 @@ static int cxd2820r_read_snr(struct dvb_frontend *fe, u16 *snr) | |||
387 | case SYS_DVBT2: | 386 | case SYS_DVBT2: |
388 | ret = cxd2820r_read_snr_t2(fe, snr); | 387 | ret = cxd2820r_read_snr_t2(fe, snr); |
389 | break; | 388 | break; |
390 | case SYS_DVBC_ANNEX_AC: | 389 | case SYS_DVBC_ANNEX_A: |
391 | ret = cxd2820r_read_snr_c(fe, snr); | 390 | ret = cxd2820r_read_snr_c(fe, snr); |
392 | break; | 391 | break; |
393 | default: | 392 | default: |
@@ -409,7 +408,7 @@ static int cxd2820r_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) | |||
409 | case SYS_DVBT2: | 408 | case SYS_DVBT2: |
410 | ret = cxd2820r_read_ucblocks_t2(fe, ucblocks); | 409 | ret = cxd2820r_read_ucblocks_t2(fe, ucblocks); |
411 | break; | 410 | break; |
412 | case SYS_DVBC_ANNEX_AC: | 411 | case SYS_DVBC_ANNEX_A: |
413 | ret = cxd2820r_read_ucblocks_c(fe, ucblocks); | 412 | ret = cxd2820r_read_ucblocks_c(fe, ucblocks); |
414 | break; | 413 | break; |
415 | default: | 414 | default: |
@@ -436,7 +435,7 @@ static int cxd2820r_sleep(struct dvb_frontend *fe) | |||
436 | case SYS_DVBT2: | 435 | case SYS_DVBT2: |
437 | ret = cxd2820r_sleep_t2(fe); | 436 | ret = cxd2820r_sleep_t2(fe); |
438 | break; | 437 | break; |
439 | case SYS_DVBC_ANNEX_AC: | 438 | case SYS_DVBC_ANNEX_A: |
440 | ret = cxd2820r_sleep_c(fe); | 439 | ret = cxd2820r_sleep_c(fe); |
441 | break; | 440 | break; |
442 | default: | 441 | default: |
@@ -459,7 +458,7 @@ static int cxd2820r_get_tune_settings(struct dvb_frontend *fe, | |||
459 | case SYS_DVBT2: | 458 | case SYS_DVBT2: |
460 | ret = cxd2820r_get_tune_settings_t2(fe, s); | 459 | ret = cxd2820r_get_tune_settings_t2(fe, s); |
461 | break; | 460 | break; |
462 | case SYS_DVBC_ANNEX_AC: | 461 | case SYS_DVBC_ANNEX_A: |
463 | ret = cxd2820r_get_tune_settings_c(fe, s); | 462 | ret = cxd2820r_get_tune_settings_c(fe, s); |
464 | break; | 463 | break; |
465 | default: | 464 | default: |
@@ -479,7 +478,7 @@ static enum dvbfe_search cxd2820r_search(struct dvb_frontend *fe, | |||
479 | dbg("%s: delsys=%d", __func__, fe->dtv_property_cache.delivery_system); | 478 | dbg("%s: delsys=%d", __func__, fe->dtv_property_cache.delivery_system); |
480 | 479 | ||
481 | /* switch between DVB-T and DVB-T2 when tune fails */ | 480 | /* switch between DVB-T and DVB-T2 when tune fails */ |
482 | if (priv->last_tune_failed && (priv->delivery_system != SYS_DVBC_ANNEX_AC)) { | 481 | if (priv->last_tune_failed && (priv->delivery_system != SYS_DVBC_ANNEX_A)) { |
483 | if (priv->delivery_system == SYS_DVBT) | 482 | if (priv->delivery_system == SYS_DVBT) |
484 | c->delivery_system = SYS_DVBT2; | 483 | c->delivery_system = SYS_DVBT2; |
485 | else | 484 | else |
@@ -487,7 +486,7 @@ static enum dvbfe_search cxd2820r_search(struct dvb_frontend *fe, | |||
487 | } | 486 | } |
488 | 487 | ||
489 | /* set frontend */ | 488 | /* set frontend */ |
490 | ret = cxd2820r_set_frontend(fe, p); | 489 | ret = cxd2820r_set_frontend(fe); |
491 | if (ret) | 490 | if (ret) |
492 | goto error; | 491 | goto error; |
493 | 492 | ||
@@ -555,24 +554,9 @@ static int cxd2820r_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) | |||
555 | return cxd2820r_wr_reg_mask(priv, 0xdb, enable ? 1 : 0, 0x1); | 554 | return cxd2820r_wr_reg_mask(priv, 0xdb, enable ? 1 : 0, 0x1); |
556 | } | 555 | } |
557 | 556 | ||
558 | static int cxd2820r_get_property(struct dvb_frontend *fe, struct dtv_property *p) | ||
559 | { | ||
560 | dbg("%s()\n", __func__); | ||
561 | |||
562 | switch (p->cmd) { | ||
563 | case DTV_ENUM_DELSYS: | ||
564 | p->u.buffer.data[0] = SYS_DVBT; | ||
565 | p->u.buffer.data[1] = SYS_DVBT2; | ||
566 | p->u.buffer.data[2] = SYS_DVBC_ANNEX_AC; | ||
567 | p->u.buffer.len = 3; | ||
568 | break; | ||
569 | default: | ||
570 | break; | ||
571 | } | ||
572 | return 0; | ||
573 | } | ||
574 | |||
575 | static const struct dvb_frontend_ops cxd2820r_ops = { | 557 | static const struct dvb_frontend_ops cxd2820r_ops = { |
558 | .delsys = { SYS_DVBT, SYS_DVBT2, SYS_DVBC_ANNEX_A }, | ||
559 | |||
576 | /* default: DVB-T/T2 */ | 560 | /* default: DVB-T/T2 */ |
577 | .info = { | 561 | .info = { |
578 | .name = "Sony CXD2820R (DVB-T/T2)", | 562 | .name = "Sony CXD2820R (DVB-T/T2)", |
@@ -603,7 +587,7 @@ static const struct dvb_frontend_ops cxd2820r_ops = { | |||
603 | .get_tune_settings = cxd2820r_get_tune_settings, | 587 | .get_tune_settings = cxd2820r_get_tune_settings, |
604 | .i2c_gate_ctrl = cxd2820r_i2c_gate_ctrl, | 588 | .i2c_gate_ctrl = cxd2820r_i2c_gate_ctrl, |
605 | 589 | ||
606 | .get_frontend_legacy = cxd2820r_get_frontend, | 590 | .get_frontend = cxd2820r_get_frontend, |
607 | 591 | ||
608 | .get_frontend_algo = cxd2820r_get_frontend_algo, | 592 | .get_frontend_algo = cxd2820r_get_frontend_algo, |
609 | .search = cxd2820r_search, | 593 | .search = cxd2820r_search, |
@@ -613,8 +597,6 @@ static const struct dvb_frontend_ops cxd2820r_ops = { | |||
613 | .read_ber = cxd2820r_read_ber, | 597 | .read_ber = cxd2820r_read_ber, |
614 | .read_ucblocks = cxd2820r_read_ucblocks, | 598 | .read_ucblocks = cxd2820r_read_ucblocks, |
615 | .read_signal_strength = cxd2820r_read_signal_strength, | 599 | .read_signal_strength = cxd2820r_read_signal_strength, |
616 | |||
617 | .get_property = cxd2820r_get_property, | ||
618 | }; | 600 | }; |
619 | 601 | ||
620 | struct dvb_frontend *cxd2820r_attach(const struct cxd2820r_config *cfg, | 602 | struct dvb_frontend *cxd2820r_attach(const struct cxd2820r_config *cfg, |
diff --git a/drivers/media/dvb/frontends/cxd2820r_priv.h b/drivers/media/dvb/frontends/cxd2820r_priv.h index 94dcf7f0dbab..9a9822cad9cd 100644 --- a/drivers/media/dvb/frontends/cxd2820r_priv.h +++ b/drivers/media/dvb/frontends/cxd2820r_priv.h | |||
@@ -86,11 +86,9 @@ int cxd2820r_rd_reg(struct cxd2820r_priv *priv, u32 reg, u8 *val); | |||
86 | 86 | ||
87 | /* cxd2820r_c.c */ | 87 | /* cxd2820r_c.c */ |
88 | 88 | ||
89 | int cxd2820r_get_frontend_c(struct dvb_frontend *fe, | 89 | int cxd2820r_get_frontend_c(struct dvb_frontend *fe); |
90 | struct dvb_frontend_parameters *p); | ||
91 | 90 | ||
92 | int cxd2820r_set_frontend_c(struct dvb_frontend *fe, | 91 | int cxd2820r_set_frontend_c(struct dvb_frontend *fe); |
93 | struct dvb_frontend_parameters *params); | ||
94 | 92 | ||
95 | int cxd2820r_read_status_c(struct dvb_frontend *fe, fe_status_t *status); | 93 | int cxd2820r_read_status_c(struct dvb_frontend *fe, fe_status_t *status); |
96 | 94 | ||
@@ -111,11 +109,9 @@ int cxd2820r_get_tune_settings_c(struct dvb_frontend *fe, | |||
111 | 109 | ||
112 | /* cxd2820r_t.c */ | 110 | /* cxd2820r_t.c */ |
113 | 111 | ||
114 | int cxd2820r_get_frontend_t(struct dvb_frontend *fe, | 112 | int cxd2820r_get_frontend_t(struct dvb_frontend *fe); |
115 | struct dvb_frontend_parameters *p); | ||
116 | 113 | ||
117 | int cxd2820r_set_frontend_t(struct dvb_frontend *fe, | 114 | int cxd2820r_set_frontend_t(struct dvb_frontend *fe); |
118 | struct dvb_frontend_parameters *params); | ||
119 | 115 | ||
120 | int cxd2820r_read_status_t(struct dvb_frontend *fe, fe_status_t *status); | 116 | int cxd2820r_read_status_t(struct dvb_frontend *fe, fe_status_t *status); |
121 | 117 | ||
@@ -136,11 +132,9 @@ int cxd2820r_get_tune_settings_t(struct dvb_frontend *fe, | |||
136 | 132 | ||
137 | /* cxd2820r_t2.c */ | 133 | /* cxd2820r_t2.c */ |
138 | 134 | ||
139 | int cxd2820r_get_frontend_t2(struct dvb_frontend *fe, | 135 | int cxd2820r_get_frontend_t2(struct dvb_frontend *fe); |
140 | struct dvb_frontend_parameters *p); | ||
141 | 136 | ||
142 | int cxd2820r_set_frontend_t2(struct dvb_frontend *fe, | 137 | int cxd2820r_set_frontend_t2(struct dvb_frontend *fe); |
143 | struct dvb_frontend_parameters *params); | ||
144 | 138 | ||
145 | int cxd2820r_read_status_t2(struct dvb_frontend *fe, fe_status_t *status); | 139 | int cxd2820r_read_status_t2(struct dvb_frontend *fe, fe_status_t *status); |
146 | 140 | ||
diff --git a/drivers/media/dvb/frontends/cxd2820r_t.c b/drivers/media/dvb/frontends/cxd2820r_t.c index d0b854a911e6..1a026239cdcc 100644 --- a/drivers/media/dvb/frontends/cxd2820r_t.c +++ b/drivers/media/dvb/frontends/cxd2820r_t.c | |||
@@ -21,8 +21,7 @@ | |||
21 | 21 | ||
22 | #include "cxd2820r_priv.h" | 22 | #include "cxd2820r_priv.h" |
23 | 23 | ||
24 | int cxd2820r_set_frontend_t(struct dvb_frontend *fe, | 24 | int cxd2820r_set_frontend_t(struct dvb_frontend *fe) |
25 | struct dvb_frontend_parameters *p) | ||
26 | { | 25 | { |
27 | struct cxd2820r_priv *priv = fe->demodulator_priv; | 26 | struct cxd2820r_priv *priv = fe->demodulator_priv; |
28 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; | 27 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; |
@@ -142,8 +141,7 @@ error: | |||
142 | return ret; | 141 | return ret; |
143 | } | 142 | } |
144 | 143 | ||
145 | int cxd2820r_get_frontend_t(struct dvb_frontend *fe, | 144 | int cxd2820r_get_frontend_t(struct dvb_frontend *fe) |
146 | struct dvb_frontend_parameters *p) | ||
147 | { | 145 | { |
148 | struct cxd2820r_priv *priv = fe->demodulator_priv; | 146 | struct cxd2820r_priv *priv = fe->demodulator_priv; |
149 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; | 147 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; |
diff --git a/drivers/media/dvb/frontends/cxd2820r_t2.c b/drivers/media/dvb/frontends/cxd2820r_t2.c index c62cf4df1e7d..3a5759e0d235 100644 --- a/drivers/media/dvb/frontends/cxd2820r_t2.c +++ b/drivers/media/dvb/frontends/cxd2820r_t2.c | |||
@@ -21,8 +21,7 @@ | |||
21 | 21 | ||
22 | #include "cxd2820r_priv.h" | 22 | #include "cxd2820r_priv.h" |
23 | 23 | ||
24 | int cxd2820r_set_frontend_t2(struct dvb_frontend *fe, | 24 | int cxd2820r_set_frontend_t2(struct dvb_frontend *fe) |
25 | struct dvb_frontend_parameters *params) | ||
26 | { | 25 | { |
27 | struct cxd2820r_priv *priv = fe->demodulator_priv; | 26 | struct cxd2820r_priv *priv = fe->demodulator_priv; |
28 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; | 27 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; |
@@ -156,8 +155,7 @@ error: | |||
156 | 155 | ||
157 | } | 156 | } |
158 | 157 | ||
159 | int cxd2820r_get_frontend_t2(struct dvb_frontend *fe, | 158 | int cxd2820r_get_frontend_t2(struct dvb_frontend *fe) |
160 | struct dvb_frontend_parameters *p) | ||
161 | { | 159 | { |
162 | struct cxd2820r_priv *priv = fe->demodulator_priv; | 160 | struct cxd2820r_priv *priv = fe->demodulator_priv; |
163 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; | 161 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; |