aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends/cxd2820r_c.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb/frontends/cxd2820r_c.c')
-rw-r--r--drivers/media/dvb/frontends/cxd2820r_c.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/drivers/media/dvb/frontends/cxd2820r_c.c b/drivers/media/dvb/frontends/cxd2820r_c.c
index b85f5011e344..945404991529 100644
--- a/drivers/media/dvb/frontends/cxd2820r_c.c
+++ b/drivers/media/dvb/frontends/cxd2820r_c.c
@@ -21,13 +21,13 @@
21 21
22#include "cxd2820r_priv.h" 22#include "cxd2820r_priv.h"
23 23
24int cxd2820r_set_frontend_c(struct dvb_frontend *fe, 24int 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;
29 int ret, i; 28 int ret, i;
30 u8 buf[2]; 29 u8 buf[2];
30 u32 if_freq;
31 u16 if_ctl; 31 u16 if_ctl;
32 u64 num; 32 u64 num;
33 struct reg_val_mask tab[] = { 33 struct reg_val_mask tab[] = {
@@ -56,9 +56,9 @@ int cxd2820r_set_frontend_c(struct dvb_frontend *fe,
56 56
57 /* program tuner */ 57 /* program tuner */
58 if (fe->ops.tuner_ops.set_params) 58 if (fe->ops.tuner_ops.set_params)
59 fe->ops.tuner_ops.set_params(fe, params); 59 fe->ops.tuner_ops.set_params(fe);
60 60
61 if (priv->delivery_system != SYS_DVBC_ANNEX_AC) { 61 if (priv->delivery_system != SYS_DVBC_ANNEX_A) {
62 for (i = 0; i < ARRAY_SIZE(tab); i++) { 62 for (i = 0; i < ARRAY_SIZE(tab); i++) {
63 ret = cxd2820r_wr_reg_mask(priv, tab[i].reg, 63 ret = cxd2820r_wr_reg_mask(priv, tab[i].reg,
64 tab[i].val, tab[i].mask); 64 tab[i].val, tab[i].mask);
@@ -67,10 +67,20 @@ int cxd2820r_set_frontend_c(struct dvb_frontend *fe,
67 } 67 }
68 } 68 }
69 69
70 priv->delivery_system = SYS_DVBC_ANNEX_AC; 70 priv->delivery_system = SYS_DVBC_ANNEX_A;
71 priv->ber_running = 0; /* tune stops BER counter */ 71 priv->ber_running = 0; /* tune stops BER counter */
72 72
73 num = priv->cfg.if_dvbc; 73 /* program IF frequency */
74 if (fe->ops.tuner_ops.get_if_frequency) {
75 ret = fe->ops.tuner_ops.get_if_frequency(fe, &if_freq);
76 if (ret)
77 goto error;
78 } else
79 if_freq = 0;
80
81 dbg("%s: if_freq=%d", __func__, if_freq);
82
83 num = if_freq / 1000; /* Hz => kHz */
74 num *= 0x4000; 84 num *= 0x4000;
75 if_ctl = cxd2820r_div_u64_round_closest(num, 41000); 85 if_ctl = cxd2820r_div_u64_round_closest(num, 41000);
76 buf[0] = (if_ctl >> 8) & 0x3f; 86 buf[0] = (if_ctl >> 8) & 0x3f;
@@ -94,8 +104,7 @@ error:
94 return ret; 104 return ret;
95} 105}
96 106
97int cxd2820r_get_frontend_c(struct dvb_frontend *fe, 107int cxd2820r_get_frontend_c(struct dvb_frontend *fe)
98 struct dvb_frontend_parameters *p)
99{ 108{
100 struct cxd2820r_priv *priv = fe->demodulator_priv; 109 struct cxd2820r_priv *priv = fe->demodulator_priv;
101 struct dtv_frontend_properties *c = &fe->dtv_property_cache; 110 struct dtv_frontend_properties *c = &fe->dtv_property_cache;