Skip to content

Commit a3f90c7

Browse files
committed
media: dvb: convert tuner_info frequencies to Hz
Right now, satellite tuner drivers specify frequencies in kHz, while terrestrial/cable ones specify in Hz. That's confusing for developers. However, the main problem is that universal tuners capable of handling both satellite and non-satelite delivery systems are appearing. We end by needing to hack the drivers in order to support such hybrid tuners. So, convert everything to specify tuner frequencies in Hz. Plese notice that a similar patch is also needed for frontends. Tested-by: Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com> Acked-by: Michael Büsch <m@bues.ch> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
1 parent 6706fe5 commit a3f90c7

54 files changed

Lines changed: 221 additions & 196 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎drivers/media/dvb-core/dvb_frontend.c‎

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -896,14 +896,31 @@ static int dvb_frontend_start(struct dvb_frontend *fe)
896896
static void dvb_frontend_get_frequency_limits(struct dvb_frontend *fe,
897897
u32 *freq_min, u32 *freq_max)
898898
{
899-
*freq_min = max(fe->ops.info.frequency_min, fe->ops.tuner_ops.info.frequency_min);
899+
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
900+
__u32 tuner_min = fe->ops.tuner_ops.info.frequency_min_hz;
901+
__u32 tuner_max = fe->ops.tuner_ops.info.frequency_max_hz;
902+
903+
/* If the standard is for satellite, convert frequencies to kHz */
904+
switch (c->delivery_system) {
905+
case SYS_DVBS:
906+
case SYS_DVBS2:
907+
case SYS_TURBO:
908+
case SYS_ISDBS:
909+
tuner_max /= kHz;
910+
tuner_min /= kHz;
911+
break;
912+
default:
913+
break;
914+
}
915+
916+
*freq_min = max(fe->ops.info.frequency_min, tuner_min);
900917

901918
if (fe->ops.info.frequency_max == 0)
902-
*freq_max = fe->ops.tuner_ops.info.frequency_max;
903-
else if (fe->ops.tuner_ops.info.frequency_max == 0)
919+
*freq_max = tuner_max;
920+
else if (tuner_max == 0)
904921
*freq_max = fe->ops.info.frequency_max;
905922
else
906-
*freq_max = min(fe->ops.info.frequency_max, fe->ops.tuner_ops.info.frequency_max);
923+
*freq_max = min(fe->ops.info.frequency_max, tuner_max);
907924

908925
if (*freq_min == 0 || *freq_max == 0)
909926
dev_warn(fe->dvb->device,

‎drivers/media/dvb-frontends/ascot2e.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -468,9 +468,9 @@ static int ascot2e_get_frequency(struct dvb_frontend *fe, u32 *frequency)
468468
static const struct dvb_tuner_ops ascot2e_tuner_ops = {
469469
.info = {
470470
.name = "Sony ASCOT2E",
471-
.frequency_min = 1000000,
472-
.frequency_max = 1200000000,
473-
.frequency_step = 25000,
471+
.frequency_min_hz = 1 * MHz,
472+
.frequency_max_hz = 1200 * MHz,
473+
.frequency_step_hz = 25 * kHz,
474474
},
475475
.init = ascot2e_init,
476476
.release = ascot2e_release,

‎drivers/media/dvb-frontends/cx24113.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -533,10 +533,10 @@ static void cx24113_release(struct dvb_frontend *fe)
533533

534534
static const struct dvb_tuner_ops cx24113_tuner_ops = {
535535
.info = {
536-
.name = "Conexant CX24113",
537-
.frequency_min = 950000,
538-
.frequency_max = 2150000,
539-
.frequency_step = 125,
536+
.name = "Conexant CX24113",
537+
.frequency_min_hz = 950 * MHz,
538+
.frequency_max_hz = 2150 * MHz,
539+
.frequency_step_hz = 125 * kHz,
540540
},
541541

542542
.release = cx24113_release,

‎drivers/media/dvb-frontends/dib0070.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -726,10 +726,10 @@ static void dib0070_release(struct dvb_frontend *fe)
726726

727727
static const struct dvb_tuner_ops dib0070_ops = {
728728
.info = {
729-
.name = "DiBcom DiB0070",
730-
.frequency_min = 45000000,
731-
.frequency_max = 860000000,
732-
.frequency_step = 1000,
729+
.name = "DiBcom DiB0070",
730+
.frequency_min_hz = 45 * MHz,
731+
.frequency_max_hz = 860 * MHz,
732+
.frequency_step_hz = 1 * kHz,
733733
},
734734
.release = dib0070_release,
735735

‎drivers/media/dvb-frontends/dib0090.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2578,9 +2578,9 @@ static int dib0090_set_params(struct dvb_frontend *fe)
25782578
static const struct dvb_tuner_ops dib0090_ops = {
25792579
.info = {
25802580
.name = "DiBcom DiB0090",
2581-
.frequency_min = 45000000,
2582-
.frequency_max = 860000000,
2583-
.frequency_step = 1000,
2581+
.frequency_min_hz = 45 * MHz,
2582+
.frequency_max_hz = 860 * MHz,
2583+
.frequency_step_hz = 1 * kHz,
25842584
},
25852585
.release = dib0090_release,
25862586

@@ -2593,9 +2593,9 @@ static const struct dvb_tuner_ops dib0090_ops = {
25932593
static const struct dvb_tuner_ops dib0090_fw_ops = {
25942594
.info = {
25952595
.name = "DiBcom DiB0090",
2596-
.frequency_min = 45000000,
2597-
.frequency_max = 860000000,
2598-
.frequency_step = 1000,
2596+
.frequency_min_hz = 45 * MHz,
2597+
.frequency_max_hz = 860 * MHz,
2598+
.frequency_step_hz = 1 * kHz,
25992599
},
26002600
.release = dib0090_release,
26012601

‎drivers/media/dvb-frontends/dvb-pll.c‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,7 @@ struct dvb_frontend *dvb_pll_attach(struct dvb_frontend *fe, int pll_addr,
799799
struct dvb_pll_priv *priv = NULL;
800800
int ret;
801801
const struct dvb_pll_desc *desc;
802+
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
802803

803804
b1 = kmalloc(1, GFP_KERNEL);
804805
if (!b1)
@@ -844,8 +845,19 @@ struct dvb_frontend *dvb_pll_attach(struct dvb_frontend *fe, int pll_addr,
844845

845846
strncpy(fe->ops.tuner_ops.info.name, desc->name,
846847
sizeof(fe->ops.tuner_ops.info.name));
847-
fe->ops.tuner_ops.info.frequency_min = desc->min;
848-
fe->ops.tuner_ops.info.frequency_max = desc->max;
848+
switch (c->delivery_system) {
849+
case SYS_DVBS:
850+
case SYS_DVBS2:
851+
case SYS_TURBO:
852+
case SYS_ISDBS:
853+
fe->ops.tuner_ops.info.frequency_min_hz = desc->min * kHz;
854+
fe->ops.tuner_ops.info.frequency_max_hz = desc->max * kHz;
855+
break;
856+
default:
857+
fe->ops.tuner_ops.info.frequency_min_hz = desc->min;
858+
fe->ops.tuner_ops.info.frequency_max_hz = desc->max;
859+
}
860+
849861
if (!desc->initdata)
850862
fe->ops.tuner_ops.init = NULL;
851863
if (!desc->sleepdata)

‎drivers/media/dvb-frontends/helene.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -846,9 +846,9 @@ static int helene_get_frequency(struct dvb_frontend *fe, u32 *frequency)
846846
static const struct dvb_tuner_ops helene_tuner_ops = {
847847
.info = {
848848
.name = "Sony HELENE Ter tuner",
849-
.frequency_min = 1000000,
850-
.frequency_max = 1200000000,
851-
.frequency_step = 25000,
849+
.frequency_min_hz = 1 * MHz,
850+
.frequency_max_hz = 1200 * MHz,
851+
.frequency_step_hz = 25 * kHz,
852852
},
853853
.init = helene_init,
854854
.release = helene_release,
@@ -860,9 +860,9 @@ static const struct dvb_tuner_ops helene_tuner_ops = {
860860
static const struct dvb_tuner_ops helene_tuner_ops_s = {
861861
.info = {
862862
.name = "Sony HELENE Sat tuner",
863-
.frequency_min = 500000,
864-
.frequency_max = 2500000,
865-
.frequency_step = 1000,
863+
.frequency_min_hz = 500 * MHz,
864+
.frequency_max_hz = 2500 * MHz,
865+
.frequency_step_hz = 1 * MHz,
866866
},
867867
.init = helene_init,
868868
.release = helene_release,

‎drivers/media/dvb-frontends/horus3a.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,9 +330,9 @@ static int horus3a_get_frequency(struct dvb_frontend *fe, u32 *frequency)
330330
static const struct dvb_tuner_ops horus3a_tuner_ops = {
331331
.info = {
332332
.name = "Sony Horus3a",
333-
.frequency_min = 950000,
334-
.frequency_max = 2150000,
335-
.frequency_step = 1000,
333+
.frequency_min_hz = 950 * MHz,
334+
.frequency_max_hz = 2150 * MHz,
335+
.frequency_step_hz = 1 * MHz,
336336
},
337337
.init = horus3a_init,
338338
.release = horus3a_release,

‎drivers/media/dvb-frontends/itd1000.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -353,10 +353,10 @@ static void itd1000_release(struct dvb_frontend *fe)
353353

354354
static const struct dvb_tuner_ops itd1000_tuner_ops = {
355355
.info = {
356-
.name = "Integrant ITD1000",
357-
.frequency_min = 950000,
358-
.frequency_max = 2150000,
359-
.frequency_step = 125, /* kHz for QPSK frontends */
356+
.name = "Integrant ITD1000",
357+
.frequency_min_hz = 950 * MHz,
358+
.frequency_max_hz = 2150 * MHz,
359+
.frequency_step_hz = 125 * kHz,
360360
},
361361

362362
.release = itd1000_release,

‎drivers/media/dvb-frontends/ix2505v.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,8 @@ static int ix2505v_get_frequency(struct dvb_frontend *fe, u32 *frequency)
256256
static const struct dvb_tuner_ops ix2505v_tuner_ops = {
257257
.info = {
258258
.name = "Sharp IX2505V (B0017)",
259-
.frequency_min = 950000,
260-
.frequency_max = 2175000
259+
.frequency_min_hz = 950 * MHz,
260+
.frequency_max_hz = 2175 * MHz
261261
},
262262
.release = ix2505v_release,
263263
.set_params = ix2505v_set_params,

0 commit comments

Comments
 (0)