aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <m.chehab@samsung.com>2014-08-12 17:50:20 -0400
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-08-21 16:25:29 -0400
commit1d6207fd2c262deb7006c9269eec33e64c5e514f (patch)
tree01876203b535264321d3332aa499dc4d2eeb3d80
parentb601d9a5d668119219d1db95cbe04fdc38eaf5a4 (diff)
[media] as102: get rid of as102_fe_copy_tune_parameters()
This function just parses the frontend cache and converts to the as102 internal format message. Get rid of it. No functional changes. Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
-rw-r--r--drivers/media/usb/as102/as102_fe.c117
1 files changed, 55 insertions, 62 deletions
diff --git a/drivers/media/usb/as102/as102_fe.c b/drivers/media/usb/as102/as102_fe.c
index 7ec1c67ba119..975ad638ee41 100644
--- a/drivers/media/usb/as102/as102_fe.c
+++ b/drivers/media/usb/as102/as102_fe.c
@@ -156,144 +156,137 @@ static uint8_t as102_fe_get_code_rate(fe_code_rate_t arg)
156 return c; 156 return c;
157} 157}
158 158
159static void as102_fe_copy_tune_parameters(struct as10x_tune_args *tune_args, 159static int as102_fe_set_frontend(struct dvb_frontend *fe)
160 struct dtv_frontend_properties *params)
161{ 160{
161 struct as102_state *state = fe->demodulator_priv;
162 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
163 int ret = 0;
164 struct as10x_tune_args tune_args = { 0 };
162 165
163 /* set frequency */ 166 /* set frequency */
164 tune_args->freq = params->frequency / 1000; 167 tune_args.freq = c->frequency / 1000;
165 168
166 /* fix interleaving_mode */ 169 /* fix interleaving_mode */
167 tune_args->interleaving_mode = INTLV_NATIVE; 170 tune_args.interleaving_mode = INTLV_NATIVE;
168 171
169 switch (params->bandwidth_hz) { 172 switch (c->bandwidth_hz) {
170 case 8000000: 173 case 8000000:
171 tune_args->bandwidth = BW_8_MHZ; 174 tune_args.bandwidth = BW_8_MHZ;
172 break; 175 break;
173 case 7000000: 176 case 7000000:
174 tune_args->bandwidth = BW_7_MHZ; 177 tune_args.bandwidth = BW_7_MHZ;
175 break; 178 break;
176 case 6000000: 179 case 6000000:
177 tune_args->bandwidth = BW_6_MHZ; 180 tune_args.bandwidth = BW_6_MHZ;
178 break; 181 break;
179 default: 182 default:
180 tune_args->bandwidth = BW_8_MHZ; 183 tune_args.bandwidth = BW_8_MHZ;
181 } 184 }
182 185
183 switch (params->guard_interval) { 186 switch (c->guard_interval) {
184 case GUARD_INTERVAL_1_32: 187 case GUARD_INTERVAL_1_32:
185 tune_args->guard_interval = GUARD_INT_1_32; 188 tune_args.guard_interval = GUARD_INT_1_32;
186 break; 189 break;
187 case GUARD_INTERVAL_1_16: 190 case GUARD_INTERVAL_1_16:
188 tune_args->guard_interval = GUARD_INT_1_16; 191 tune_args.guard_interval = GUARD_INT_1_16;
189 break; 192 break;
190 case GUARD_INTERVAL_1_8: 193 case GUARD_INTERVAL_1_8:
191 tune_args->guard_interval = GUARD_INT_1_8; 194 tune_args.guard_interval = GUARD_INT_1_8;
192 break; 195 break;
193 case GUARD_INTERVAL_1_4: 196 case GUARD_INTERVAL_1_4:
194 tune_args->guard_interval = GUARD_INT_1_4; 197 tune_args.guard_interval = GUARD_INT_1_4;
195 break; 198 break;
196 case GUARD_INTERVAL_AUTO: 199 case GUARD_INTERVAL_AUTO:
197 default: 200 default:
198 tune_args->guard_interval = GUARD_UNKNOWN; 201 tune_args.guard_interval = GUARD_UNKNOWN;
199 break; 202 break;
200 } 203 }
201 204
202 switch (params->modulation) { 205 switch (c->modulation) {
203 case QPSK: 206 case QPSK:
204 tune_args->modulation = CONST_QPSK; 207 tune_args.modulation = CONST_QPSK;
205 break; 208 break;
206 case QAM_16: 209 case QAM_16:
207 tune_args->modulation = CONST_QAM16; 210 tune_args.modulation = CONST_QAM16;
208 break; 211 break;
209 case QAM_64: 212 case QAM_64:
210 tune_args->modulation = CONST_QAM64; 213 tune_args.modulation = CONST_QAM64;
211 break; 214 break;
212 default: 215 default:
213 tune_args->modulation = CONST_UNKNOWN; 216 tune_args.modulation = CONST_UNKNOWN;
214 break; 217 break;
215 } 218 }
216 219
217 switch (params->transmission_mode) { 220 switch (c->transmission_mode) {
218 case TRANSMISSION_MODE_2K: 221 case TRANSMISSION_MODE_2K:
219 tune_args->transmission_mode = TRANS_MODE_2K; 222 tune_args.transmission_mode = TRANS_MODE_2K;
220 break; 223 break;
221 case TRANSMISSION_MODE_8K: 224 case TRANSMISSION_MODE_8K:
222 tune_args->transmission_mode = TRANS_MODE_8K; 225 tune_args.transmission_mode = TRANS_MODE_8K;
223 break; 226 break;
224 default: 227 default:
225 tune_args->transmission_mode = TRANS_MODE_UNKNOWN; 228 tune_args.transmission_mode = TRANS_MODE_UNKNOWN;
226 } 229 }
227 230
228 switch (params->hierarchy) { 231 switch (c->hierarchy) {
229 case HIERARCHY_NONE: 232 case HIERARCHY_NONE:
230 tune_args->hierarchy = HIER_NONE; 233 tune_args.hierarchy = HIER_NONE;
231 break; 234 break;
232 case HIERARCHY_1: 235 case HIERARCHY_1:
233 tune_args->hierarchy = HIER_ALPHA_1; 236 tune_args.hierarchy = HIER_ALPHA_1;
234 break; 237 break;
235 case HIERARCHY_2: 238 case HIERARCHY_2:
236 tune_args->hierarchy = HIER_ALPHA_2; 239 tune_args.hierarchy = HIER_ALPHA_2;
237 break; 240 break;
238 case HIERARCHY_4: 241 case HIERARCHY_4:
239 tune_args->hierarchy = HIER_ALPHA_4; 242 tune_args.hierarchy = HIER_ALPHA_4;
240 break; 243 break;
241 case HIERARCHY_AUTO: 244 case HIERARCHY_AUTO:
242 tune_args->hierarchy = HIER_UNKNOWN; 245 tune_args.hierarchy = HIER_UNKNOWN;
243 break; 246 break;
244 } 247 }
245 248
246 pr_debug("as102: tuner parameters: freq: %d bw: 0x%02x gi: 0x%02x\n", 249 pr_debug("as102: tuner parameters: freq: %d bw: 0x%02x gi: 0x%02x\n",
247 params->frequency, 250 c->frequency,
248 tune_args->bandwidth, 251 tune_args.bandwidth,
249 tune_args->guard_interval); 252 tune_args.guard_interval);
250 253
251 /* 254 /*
252 * Detect a hierarchy selection 255 * Detect a hierarchy selection
253 * if HP/LP are both set to FEC_NONE, HP will be selected. 256 * if HP/LP are both set to FEC_NONE, HP will be selected.
254 */ 257 */
255 if ((tune_args->hierarchy != HIER_NONE) && 258 if ((tune_args.hierarchy != HIER_NONE) &&
256 ((params->code_rate_LP == FEC_NONE) || 259 ((c->code_rate_LP == FEC_NONE) ||
257 (params->code_rate_HP == FEC_NONE))) { 260 (c->code_rate_HP == FEC_NONE))) {
258 261
259 if (params->code_rate_LP == FEC_NONE) { 262 if (c->code_rate_LP == FEC_NONE) {
260 tune_args->hier_select = HIER_HIGH_PRIORITY; 263 tune_args.hier_select = HIER_HIGH_PRIORITY;
261 tune_args->code_rate = 264 tune_args.code_rate =
262 as102_fe_get_code_rate(params->code_rate_HP); 265 as102_fe_get_code_rate(c->code_rate_HP);
263 } 266 }
264 267
265 if (params->code_rate_HP == FEC_NONE) { 268 if (c->code_rate_HP == FEC_NONE) {
266 tune_args->hier_select = HIER_LOW_PRIORITY; 269 tune_args.hier_select = HIER_LOW_PRIORITY;
267 tune_args->code_rate = 270 tune_args.code_rate =
268 as102_fe_get_code_rate(params->code_rate_LP); 271 as102_fe_get_code_rate(c->code_rate_LP);
269 } 272 }
270 273
271 pr_debug("as102: \thierarchy: 0x%02x selected: %s code_rate_%s: 0x%02x\n", 274 pr_debug("as102: \thierarchy: 0x%02x selected: %s code_rate_%s: 0x%02x\n",
272 tune_args->hierarchy, 275 tune_args.hierarchy,
273 tune_args->hier_select == HIER_HIGH_PRIORITY ? 276 tune_args.hier_select == HIER_HIGH_PRIORITY ?
274 "HP" : "LP", 277 "HP" : "LP",
275 tune_args->hier_select == HIER_HIGH_PRIORITY ? 278 tune_args.hier_select == HIER_HIGH_PRIORITY ?
276 "HP" : "LP", 279 "HP" : "LP",
277 tune_args->code_rate); 280 tune_args.code_rate);
278 } else { 281 } else {
279 tune_args->code_rate = 282 tune_args.code_rate =
280 as102_fe_get_code_rate(params->code_rate_HP); 283 as102_fe_get_code_rate(c->code_rate_HP);
281 } 284 }
282}
283
284static int as102_fe_set_frontend(struct dvb_frontend *fe)
285{
286 struct as102_state *state = fe->demodulator_priv;
287 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
288 int ret = 0;
289 struct as10x_tune_args tune_args = { 0 };
290 285
286 /* Set frontend arguments */
291 if (mutex_lock_interruptible(&state->bus_adap->lock)) 287 if (mutex_lock_interruptible(&state->bus_adap->lock))
292 return -EBUSY; 288 return -EBUSY;
293 289
294 as102_fe_copy_tune_parameters(&tune_args, p);
295
296 /* send abilis command: SET_TUNE */
297 ret = as10x_cmd_set_tune(state->bus_adap, &tune_args); 290 ret = as10x_cmd_set_tune(state->bus_adap, &tune_args);
298 if (ret != 0) 291 if (ret != 0)
299 dev_dbg(&state->bus_adap->usb_dev->dev, 292 dev_dbg(&state->bus_adap->usb_dev->dev,