861
864
static int dvb_frontend_clear_cache(struct dvb_frontend *fe)
866
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
865
memset(&(fe->dtv_property_cache), 0,
866
sizeof(struct dtv_frontend_properties));
868
fe->dtv_property_cache.state = DTV_CLEAR;
869
fe->dtv_property_cache.delivery_system = SYS_UNDEFINED;
870
fe->dtv_property_cache.inversion = INVERSION_AUTO;
871
fe->dtv_property_cache.fec_inner = FEC_AUTO;
872
fe->dtv_property_cache.transmission_mode = TRANSMISSION_MODE_AUTO;
873
fe->dtv_property_cache.bandwidth_hz = BANDWIDTH_AUTO;
874
fe->dtv_property_cache.guard_interval = GUARD_INTERVAL_AUTO;
875
fe->dtv_property_cache.hierarchy = HIERARCHY_AUTO;
876
fe->dtv_property_cache.symbol_rate = QAM_AUTO;
877
fe->dtv_property_cache.code_rate_HP = FEC_AUTO;
878
fe->dtv_property_cache.code_rate_LP = FEC_AUTO;
880
fe->dtv_property_cache.isdbt_partial_reception = -1;
881
fe->dtv_property_cache.isdbt_sb_mode = -1;
882
fe->dtv_property_cache.isdbt_sb_subchannel = -1;
883
fe->dtv_property_cache.isdbt_sb_segment_idx = -1;
884
fe->dtv_property_cache.isdbt_sb_segment_count = -1;
885
fe->dtv_property_cache.isdbt_layer_enabled = 0x7;
869
memset(c, 0, sizeof(struct dtv_frontend_properties));
871
c->state = DTV_CLEAR;
872
c->delivery_system = SYS_UNDEFINED;
873
c->inversion = INVERSION_AUTO;
874
c->fec_inner = FEC_AUTO;
875
c->transmission_mode = TRANSMISSION_MODE_AUTO;
876
c->bandwidth_hz = BANDWIDTH_AUTO;
877
c->guard_interval = GUARD_INTERVAL_AUTO;
878
c->hierarchy = HIERARCHY_AUTO;
879
c->symbol_rate = QAM_AUTO;
880
c->code_rate_HP = FEC_AUTO;
881
c->code_rate_LP = FEC_AUTO;
883
c->isdbt_partial_reception = -1;
884
c->isdbt_sb_mode = -1;
885
c->isdbt_sb_subchannel = -1;
886
c->isdbt_sb_segment_idx = -1;
887
c->isdbt_sb_segment_count = -1;
888
c->isdbt_layer_enabled = 0x7;
886
889
for (i = 0; i < 3; i++) {
887
fe->dtv_property_cache.layer[i].fec = FEC_AUTO;
888
fe->dtv_property_cache.layer[i].modulation = QAM_AUTO;
889
fe->dtv_property_cache.layer[i].interleaving = -1;
890
fe->dtv_property_cache.layer[i].segment_count = -1;
890
c->layer[i].fec = FEC_AUTO;
891
c->layer[i].modulation = QAM_AUTO;
892
c->layer[i].interleaving = -1;
893
c->layer[i].segment_count = -1;
1204
1198
struct dtv_property *tvp,
1205
1199
struct file *file)
1209
/* Allow the frontend to validate incoming properties */
1210
if (fe->ops.get_property)
1211
r = fe->ops.get_property(fe, tvp);
1201
const struct dtv_frontend_properties *c = &fe->dtv_property_cache;
1202
struct dvb_frontend_private *fepriv = fe->frontend_priv;
1203
struct dtv_frontend_properties cdetected;
1207
* If the driver implements a get_frontend function, then convert
1208
* detected parameters to S2API properties.
1210
if (fe->ops.get_frontend) {
1212
dtv_property_cache_sync(fe, &cdetected, &fepriv->parameters_out);
1216
1216
switch(tvp->cmd) {
1217
1217
case DTV_FREQUENCY:
1218
tvp->u.data = fe->dtv_property_cache.frequency;
1218
tvp->u.data = c->frequency;
1220
1220
case DTV_MODULATION:
1221
tvp->u.data = fe->dtv_property_cache.modulation;
1221
tvp->u.data = c->modulation;
1223
1223
case DTV_BANDWIDTH_HZ:
1224
tvp->u.data = fe->dtv_property_cache.bandwidth_hz;
1224
tvp->u.data = c->bandwidth_hz;
1226
1226
case DTV_INVERSION:
1227
tvp->u.data = fe->dtv_property_cache.inversion;
1227
tvp->u.data = c->inversion;
1229
1229
case DTV_SYMBOL_RATE:
1230
tvp->u.data = fe->dtv_property_cache.symbol_rate;
1230
tvp->u.data = c->symbol_rate;
1232
1232
case DTV_INNER_FEC:
1233
tvp->u.data = fe->dtv_property_cache.fec_inner;
1233
tvp->u.data = c->fec_inner;
1235
1235
case DTV_PILOT:
1236
tvp->u.data = fe->dtv_property_cache.pilot;
1236
tvp->u.data = c->pilot;
1238
1238
case DTV_ROLLOFF:
1239
tvp->u.data = fe->dtv_property_cache.rolloff;
1239
tvp->u.data = c->rolloff;
1241
1241
case DTV_DELIVERY_SYSTEM:
1242
tvp->u.data = fe->dtv_property_cache.delivery_system;
1242
tvp->u.data = c->delivery_system;
1244
1244
case DTV_VOLTAGE:
1245
tvp->u.data = fe->dtv_property_cache.voltage;
1245
tvp->u.data = c->voltage;
1248
tvp->u.data = fe->dtv_property_cache.sectone;
1248
tvp->u.data = c->sectone;
1250
1250
case DTV_API_VERSION:
1251
1251
tvp->u.data = (DVB_API_VERSION << 8) | DVB_API_VERSION_MINOR;
1253
1253
case DTV_CODE_RATE_HP:
1254
tvp->u.data = fe->dtv_property_cache.code_rate_HP;
1254
tvp->u.data = c->code_rate_HP;
1256
1256
case DTV_CODE_RATE_LP:
1257
tvp->u.data = fe->dtv_property_cache.code_rate_LP;
1257
tvp->u.data = c->code_rate_LP;
1259
1259
case DTV_GUARD_INTERVAL:
1260
tvp->u.data = fe->dtv_property_cache.guard_interval;
1260
tvp->u.data = c->guard_interval;
1262
1262
case DTV_TRANSMISSION_MODE:
1263
tvp->u.data = fe->dtv_property_cache.transmission_mode;
1263
tvp->u.data = c->transmission_mode;
1265
1265
case DTV_HIERARCHY:
1266
tvp->u.data = fe->dtv_property_cache.hierarchy;
1266
tvp->u.data = c->hierarchy;
1269
1269
/* ISDB-T Support here */
1270
1270
case DTV_ISDBT_PARTIAL_RECEPTION:
1271
tvp->u.data = fe->dtv_property_cache.isdbt_partial_reception;
1271
tvp->u.data = c->isdbt_partial_reception;
1273
1273
case DTV_ISDBT_SOUND_BROADCASTING:
1274
tvp->u.data = fe->dtv_property_cache.isdbt_sb_mode;
1274
tvp->u.data = c->isdbt_sb_mode;
1276
1276
case DTV_ISDBT_SB_SUBCHANNEL_ID:
1277
tvp->u.data = fe->dtv_property_cache.isdbt_sb_subchannel;
1277
tvp->u.data = c->isdbt_sb_subchannel;
1279
1279
case DTV_ISDBT_SB_SEGMENT_IDX:
1280
tvp->u.data = fe->dtv_property_cache.isdbt_sb_segment_idx;
1280
tvp->u.data = c->isdbt_sb_segment_idx;
1282
1282
case DTV_ISDBT_SB_SEGMENT_COUNT:
1283
tvp->u.data = fe->dtv_property_cache.isdbt_sb_segment_count;
1283
tvp->u.data = c->isdbt_sb_segment_count;
1285
1285
case DTV_ISDBT_LAYER_ENABLED:
1286
tvp->u.data = fe->dtv_property_cache.isdbt_layer_enabled;
1286
tvp->u.data = c->isdbt_layer_enabled;
1288
1288
case DTV_ISDBT_LAYERA_FEC:
1289
tvp->u.data = fe->dtv_property_cache.layer[0].fec;
1289
tvp->u.data = c->layer[0].fec;
1291
1291
case DTV_ISDBT_LAYERA_MODULATION:
1292
tvp->u.data = fe->dtv_property_cache.layer[0].modulation;
1292
tvp->u.data = c->layer[0].modulation;
1294
1294
case DTV_ISDBT_LAYERA_SEGMENT_COUNT:
1295
tvp->u.data = fe->dtv_property_cache.layer[0].segment_count;
1295
tvp->u.data = c->layer[0].segment_count;
1297
1297
case DTV_ISDBT_LAYERA_TIME_INTERLEAVING:
1298
tvp->u.data = fe->dtv_property_cache.layer[0].interleaving;
1298
tvp->u.data = c->layer[0].interleaving;
1300
1300
case DTV_ISDBT_LAYERB_FEC:
1301
tvp->u.data = fe->dtv_property_cache.layer[1].fec;
1301
tvp->u.data = c->layer[1].fec;
1303
1303
case DTV_ISDBT_LAYERB_MODULATION:
1304
tvp->u.data = fe->dtv_property_cache.layer[1].modulation;
1304
tvp->u.data = c->layer[1].modulation;
1306
1306
case DTV_ISDBT_LAYERB_SEGMENT_COUNT:
1307
tvp->u.data = fe->dtv_property_cache.layer[1].segment_count;
1307
tvp->u.data = c->layer[1].segment_count;
1309
1309
case DTV_ISDBT_LAYERB_TIME_INTERLEAVING:
1310
tvp->u.data = fe->dtv_property_cache.layer[1].interleaving;
1310
tvp->u.data = c->layer[1].interleaving;
1312
1312
case DTV_ISDBT_LAYERC_FEC:
1313
tvp->u.data = fe->dtv_property_cache.layer[2].fec;
1313
tvp->u.data = c->layer[2].fec;
1315
1315
case DTV_ISDBT_LAYERC_MODULATION:
1316
tvp->u.data = fe->dtv_property_cache.layer[2].modulation;
1316
tvp->u.data = c->layer[2].modulation;
1318
1318
case DTV_ISDBT_LAYERC_SEGMENT_COUNT:
1319
tvp->u.data = fe->dtv_property_cache.layer[2].segment_count;
1319
tvp->u.data = c->layer[2].segment_count;
1321
1321
case DTV_ISDBT_LAYERC_TIME_INTERLEAVING:
1322
tvp->u.data = fe->dtv_property_cache.layer[2].interleaving;
1322
tvp->u.data = c->layer[2].interleaving;
1324
1324
case DTV_ISDBS_TS_ID:
1325
tvp->u.data = fe->dtv_property_cache.isdbs_ts_id;
1325
tvp->u.data = c->isdbs_ts_id;
1327
case DTV_DVBT2_PLP_ID:
1328
tvp->u.data = c->dvbt2_plp_id;
1334
/* Allow the frontend to override outgoing properties */
1335
if (fe->ops.get_property) {
1336
r = fe->ops.get_property(fe, tvp);
1331
1341
dtv_property_dump(tvp);
1336
1346
static int dtv_property_process_set(struct dvb_frontend *fe,
1361
1372
* tunerequest so we can pass validation in the FE_SET_FRONTEND
1364
fe->dtv_property_cache.state = tvp->cmd;
1375
c->state = tvp->cmd;
1365
1376
dprintk("%s() Finalised property cache\n", __func__);
1366
1377
dtv_property_cache_submit(fe);
1368
r |= dvb_frontend_ioctl_legacy(file, FE_SET_FRONTEND,
1369
&fepriv->parameters);
1379
r = dvb_frontend_ioctl_legacy(file, FE_SET_FRONTEND,
1380
&fepriv->parameters_in);
1371
1382
case DTV_FREQUENCY:
1372
fe->dtv_property_cache.frequency = tvp->u.data;
1383
c->frequency = tvp->u.data;
1374
1385
case DTV_MODULATION:
1375
fe->dtv_property_cache.modulation = tvp->u.data;
1386
c->modulation = tvp->u.data;
1377
1388
case DTV_BANDWIDTH_HZ:
1378
fe->dtv_property_cache.bandwidth_hz = tvp->u.data;
1389
c->bandwidth_hz = tvp->u.data;
1380
1391
case DTV_INVERSION:
1381
fe->dtv_property_cache.inversion = tvp->u.data;
1392
c->inversion = tvp->u.data;
1383
1394
case DTV_SYMBOL_RATE:
1384
fe->dtv_property_cache.symbol_rate = tvp->u.data;
1395
c->symbol_rate = tvp->u.data;
1386
1397
case DTV_INNER_FEC:
1387
fe->dtv_property_cache.fec_inner = tvp->u.data;
1398
c->fec_inner = tvp->u.data;
1389
1400
case DTV_PILOT:
1390
fe->dtv_property_cache.pilot = tvp->u.data;
1401
c->pilot = tvp->u.data;
1392
1403
case DTV_ROLLOFF:
1393
fe->dtv_property_cache.rolloff = tvp->u.data;
1404
c->rolloff = tvp->u.data;
1395
1406
case DTV_DELIVERY_SYSTEM:
1396
fe->dtv_property_cache.delivery_system = tvp->u.data;
1407
c->delivery_system = tvp->u.data;
1398
1409
case DTV_VOLTAGE:
1399
fe->dtv_property_cache.voltage = tvp->u.data;
1410
c->voltage = tvp->u.data;
1400
1411
r = dvb_frontend_ioctl_legacy(file, FE_SET_VOLTAGE,
1401
(void *)fe->dtv_property_cache.voltage);
1412
(void *)c->voltage);
1404
fe->dtv_property_cache.sectone = tvp->u.data;
1415
c->sectone = tvp->u.data;
1405
1416
r = dvb_frontend_ioctl_legacy(file, FE_SET_TONE,
1406
(void *)fe->dtv_property_cache.sectone);
1417
(void *)c->sectone);
1408
1419
case DTV_CODE_RATE_HP:
1409
fe->dtv_property_cache.code_rate_HP = tvp->u.data;
1420
c->code_rate_HP = tvp->u.data;
1411
1422
case DTV_CODE_RATE_LP:
1412
fe->dtv_property_cache.code_rate_LP = tvp->u.data;
1423
c->code_rate_LP = tvp->u.data;
1414
1425
case DTV_GUARD_INTERVAL:
1415
fe->dtv_property_cache.guard_interval = tvp->u.data;
1426
c->guard_interval = tvp->u.data;
1417
1428
case DTV_TRANSMISSION_MODE:
1418
fe->dtv_property_cache.transmission_mode = tvp->u.data;
1429
c->transmission_mode = tvp->u.data;
1420
1431
case DTV_HIERARCHY:
1421
fe->dtv_property_cache.hierarchy = tvp->u.data;
1432
c->hierarchy = tvp->u.data;
1424
1435
/* ISDB-T Support here */
1425
1436
case DTV_ISDBT_PARTIAL_RECEPTION:
1426
fe->dtv_property_cache.isdbt_partial_reception = tvp->u.data;
1437
c->isdbt_partial_reception = tvp->u.data;
1428
1439
case DTV_ISDBT_SOUND_BROADCASTING:
1429
fe->dtv_property_cache.isdbt_sb_mode = tvp->u.data;
1440
c->isdbt_sb_mode = tvp->u.data;
1431
1442
case DTV_ISDBT_SB_SUBCHANNEL_ID:
1432
fe->dtv_property_cache.isdbt_sb_subchannel = tvp->u.data;
1443
c->isdbt_sb_subchannel = tvp->u.data;
1434
1445
case DTV_ISDBT_SB_SEGMENT_IDX:
1435
fe->dtv_property_cache.isdbt_sb_segment_idx = tvp->u.data;
1446
c->isdbt_sb_segment_idx = tvp->u.data;
1437
1448
case DTV_ISDBT_SB_SEGMENT_COUNT:
1438
fe->dtv_property_cache.isdbt_sb_segment_count = tvp->u.data;
1449
c->isdbt_sb_segment_count = tvp->u.data;
1440
1451
case DTV_ISDBT_LAYER_ENABLED:
1441
fe->dtv_property_cache.isdbt_layer_enabled = tvp->u.data;
1452
c->isdbt_layer_enabled = tvp->u.data;
1443
1454
case DTV_ISDBT_LAYERA_FEC:
1444
fe->dtv_property_cache.layer[0].fec = tvp->u.data;
1455
c->layer[0].fec = tvp->u.data;
1446
1457
case DTV_ISDBT_LAYERA_MODULATION:
1447
fe->dtv_property_cache.layer[0].modulation = tvp->u.data;
1458
c->layer[0].modulation = tvp->u.data;
1449
1460
case DTV_ISDBT_LAYERA_SEGMENT_COUNT:
1450
fe->dtv_property_cache.layer[0].segment_count = tvp->u.data;
1461
c->layer[0].segment_count = tvp->u.data;
1452
1463
case DTV_ISDBT_LAYERA_TIME_INTERLEAVING:
1453
fe->dtv_property_cache.layer[0].interleaving = tvp->u.data;
1464
c->layer[0].interleaving = tvp->u.data;
1455
1466
case DTV_ISDBT_LAYERB_FEC:
1456
fe->dtv_property_cache.layer[1].fec = tvp->u.data;
1467
c->layer[1].fec = tvp->u.data;
1458
1469
case DTV_ISDBT_LAYERB_MODULATION:
1459
fe->dtv_property_cache.layer[1].modulation = tvp->u.data;
1470
c->layer[1].modulation = tvp->u.data;
1461
1472
case DTV_ISDBT_LAYERB_SEGMENT_COUNT:
1462
fe->dtv_property_cache.layer[1].segment_count = tvp->u.data;
1473
c->layer[1].segment_count = tvp->u.data;
1464
1475
case DTV_ISDBT_LAYERB_TIME_INTERLEAVING:
1465
fe->dtv_property_cache.layer[1].interleaving = tvp->u.data;
1476
c->layer[1].interleaving = tvp->u.data;
1467
1478
case DTV_ISDBT_LAYERC_FEC:
1468
fe->dtv_property_cache.layer[2].fec = tvp->u.data;
1479
c->layer[2].fec = tvp->u.data;
1470
1481
case DTV_ISDBT_LAYERC_MODULATION:
1471
fe->dtv_property_cache.layer[2].modulation = tvp->u.data;
1482
c->layer[2].modulation = tvp->u.data;
1473
1484
case DTV_ISDBT_LAYERC_SEGMENT_COUNT:
1474
fe->dtv_property_cache.layer[2].segment_count = tvp->u.data;
1485
c->layer[2].segment_count = tvp->u.data;
1476
1487
case DTV_ISDBT_LAYERC_TIME_INTERLEAVING:
1477
fe->dtv_property_cache.layer[2].interleaving = tvp->u.data;
1488
c->layer[2].interleaving = tvp->u.data;
1479
1490
case DTV_ISDBS_TS_ID:
1480
fe->dtv_property_cache.isdbs_ts_id = tvp->u.data;
1491
c->isdbs_ts_id = tvp->u.data;
1493
case DTV_DVBT2_PLP_ID:
1494
c->dvbt2_plp_id = tvp->u.data;