diff options
author | Antti Palosaari <crope@iki.fi> | 2014-09-30 16:52:03 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2014-11-14 14:24:04 -0500 |
commit | c00a6b9f9f92a6138db8ad4bcc56c3402267695c (patch) | |
tree | f83d3bc27289503d3ed1a054dd9d03e4a43d43af | |
parent | dadb5bb473189ca7e80bf2190b44cf276ea42af2 (diff) |
[media] mn88473: add support for DVB-T2
Add support for DVB-T2.
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r-- | drivers/media/dvb-frontends/mn88473.c | 45 |
1 files changed, 38 insertions, 7 deletions
diff --git a/drivers/media/dvb-frontends/mn88473.c b/drivers/media/dvb-frontends/mn88473.c index afe59f3dfb19..68bfb6560eec 100644 --- a/drivers/media/dvb-frontends/mn88473.c +++ b/drivers/media/dvb-frontends/mn88473.c | |||
@@ -116,19 +116,38 @@ static int mn88473_set_frontend(struct dvb_frontend *fe) | |||
116 | { | 116 | { |
117 | struct mn88473_dev *dev = fe->demodulator_priv; | 117 | struct mn88473_dev *dev = fe->demodulator_priv; |
118 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; | 118 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; |
119 | int ret; | 119 | int ret, i; |
120 | u32 if_frequency = 0; | 120 | u32 if_frequency = 0; |
121 | u8 params[10], delivery_system; | ||
121 | 122 | ||
122 | dev_dbg(&dev->i2c->dev, | 123 | dev_dbg(&dev->i2c->dev, |
123 | "%s: delivery_system=%d modulation=%d frequency=%d symbol_rate=%d inversion=%d\n", | 124 | "%s: delivery_system=%u modulation=%u frequency=%u bandwidth_hz=%u symbol_rate=%u inversion=%d stream_id=%d\n", |
124 | __func__, c->delivery_system, c->modulation, | 125 | __func__, c->delivery_system, c->modulation, |
125 | c->frequency, c->symbol_rate, c->inversion); | 126 | c->frequency, c->bandwidth_hz, c->symbol_rate, |
127 | c->inversion, c->stream_id); | ||
126 | 128 | ||
127 | if (!dev->warm) { | 129 | if (!dev->warm) { |
128 | ret = -EAGAIN; | 130 | ret = -EAGAIN; |
129 | goto err; | 131 | goto err; |
130 | } | 132 | } |
131 | 133 | ||
134 | switch (c->delivery_system) { | ||
135 | case SYS_DVBT2: | ||
136 | delivery_system = 0x03; | ||
137 | if (c->bandwidth_hz <= 7000000) | ||
138 | memcpy(params, "\x2e\xcb\xfb\xc8\x00\x00\x17\x0a\x17\x0a", 10); | ||
139 | else if (c->bandwidth_hz <= 8000000) | ||
140 | memcpy(params, "\x2e\xcb\xfb\xaf\x00\x00\x11\xec\x11\xec", 10); | ||
141 | break; | ||
142 | case SYS_DVBC_ANNEX_A: | ||
143 | delivery_system = 0x04; | ||
144 | memcpy(params, "\x33\xea\xb3\xaf\x00\x00\x11\xec\x11\xec", 10); | ||
145 | break; | ||
146 | default: | ||
147 | ret = -EINVAL; | ||
148 | goto err; | ||
149 | } | ||
150 | |||
132 | /* program tuner */ | 151 | /* program tuner */ |
133 | if (fe->ops.tuner_ops.set_params) { | 152 | if (fe->ops.tuner_ops.set_params) { |
134 | ret = fe->ops.tuner_ops.set_params(fe); | 153 | ret = fe->ops.tuner_ops.set_params(fe); |
@@ -145,7 +164,11 @@ static int mn88473_set_frontend(struct dvb_frontend *fe) | |||
145 | __func__, if_frequency); | 164 | __func__, if_frequency); |
146 | } | 165 | } |
147 | 166 | ||
148 | if (if_frequency != 5070000) { | 167 | switch (if_frequency) { |
168 | case 4570000: | ||
169 | case 5070000: | ||
170 | break; | ||
171 | default: | ||
149 | dev_err(&dev->i2c->dev, "%s: IF frequency %d not supported\n", | 172 | dev_err(&dev->i2c->dev, "%s: IF frequency %d not supported\n", |
150 | KBUILD_MODNAME, if_frequency); | 173 | KBUILD_MODNAME, if_frequency); |
151 | ret = -EINVAL; | 174 | ret = -EINVAL; |
@@ -159,9 +182,15 @@ static int mn88473_set_frontend(struct dvb_frontend *fe) | |||
159 | ret = mn88473_wregs(dev, 0x1c00, "\x18", 1); | 182 | ret = mn88473_wregs(dev, 0x1c00, "\x18", 1); |
160 | ret = mn88473_wregs(dev, 0x1c01, "\x01", 1); | 183 | ret = mn88473_wregs(dev, 0x1c01, "\x01", 1); |
161 | ret = mn88473_wregs(dev, 0x1c02, "\x21", 1); | 184 | ret = mn88473_wregs(dev, 0x1c02, "\x21", 1); |
162 | ret = mn88473_wregs(dev, 0x1c03, "\x04", 1); | 185 | ret = mn88473_wreg(dev, 0x1c03, delivery_system); |
163 | ret = mn88473_wregs(dev, 0x1c0b, "\x00", 1); | 186 | ret = mn88473_wregs(dev, 0x1c0b, "\x00", 1); |
164 | ret = mn88473_wregs(dev, 0x1c10, "\x33\xea\xb3\xaf\x00\x00\x11\xec\x11\xec", 10); | 187 | |
188 | for (i = 0; i < 10; i++) { | ||
189 | ret = mn88473_wreg(dev, 0x1c10 + i, params[i]); | ||
190 | if (ret) | ||
191 | goto err; | ||
192 | } | ||
193 | |||
165 | ret = mn88473_wregs(dev, 0x1c2d, "\x3b", 1); | 194 | ret = mn88473_wregs(dev, 0x1c2d, "\x3b", 1); |
166 | ret = mn88473_wregs(dev, 0x1c2e, "\x00", 1); | 195 | ret = mn88473_wregs(dev, 0x1c2e, "\x00", 1); |
167 | ret = mn88473_wregs(dev, 0x1c56, "\x0d", 1); | 196 | ret = mn88473_wregs(dev, 0x1c56, "\x0d", 1); |
@@ -193,6 +222,8 @@ static int mn88473_set_frontend(struct dvb_frontend *fe) | |||
193 | ret = mn88473_wregs(dev, 0x1c08, "\x1d", 1); | 222 | ret = mn88473_wregs(dev, 0x1c08, "\x1d", 1); |
194 | ret = mn88473_wregs(dev, 0x18b2, "\x37", 1); | 223 | ret = mn88473_wregs(dev, 0x18b2, "\x37", 1); |
195 | ret = mn88473_wregs(dev, 0x18d7, "\x04", 1); | 224 | ret = mn88473_wregs(dev, 0x18d7, "\x04", 1); |
225 | ret = mn88473_wregs(dev, 0x1c32, "\x80", 1); | ||
226 | ret = mn88473_wregs(dev, 0x1c36, "\x00", 1); | ||
196 | ret = mn88473_wregs(dev, 0x1cf8, "\x9f", 1); | 227 | ret = mn88473_wregs(dev, 0x1cf8, "\x9f", 1); |
197 | if (ret) | 228 | if (ret) |
198 | goto err; | 229 | goto err; |
@@ -351,7 +382,7 @@ err: | |||
351 | EXPORT_SYMBOL(mn88473_attach); | 382 | EXPORT_SYMBOL(mn88473_attach); |
352 | 383 | ||
353 | static struct dvb_frontend_ops mn88473_ops = { | 384 | static struct dvb_frontend_ops mn88473_ops = { |
354 | .delsys = {SYS_DVBC_ANNEX_AC}, | 385 | .delsys = {SYS_DVBT2, SYS_DVBC_ANNEX_AC}, |
355 | .info = { | 386 | .info = { |
356 | .name = "Panasonic MN88473", | 387 | .name = "Panasonic MN88473", |
357 | .caps = FE_CAN_FEC_1_2 | | 388 | .caps = FE_CAN_FEC_1_2 | |