You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
95 lines
3.0 KiB
95 lines
3.0 KiB
5 years ago
|
From 4bbe1b749c6f01a7a2648714f195802517e138ed Mon Sep 17 00:00:00 2001
|
||
|
From: Athanasios Oikonomou <athoik@gmail.com>
|
||
|
Date: Sat, 5 Mar 2016 00:32:57 +0200
|
||
|
Subject: [PATCH] STV: Add PLS support
|
||
|
|
||
|
|
||
|
diff --git a/drivers/media/dvb-frontends/stv0900_core.c b/drivers/media/dvb-frontends/stv0900_core.c
|
||
|
index fe31dd5..3a5df06 100644
|
||
|
--- a/drivers/media/dvb-frontends/stv0900_core.c
|
||
|
+++ b/drivers/media/dvb-frontends/stv0900_core.c
|
||
|
@@ -1551,12 +1551,25 @@ static int stv0900_status(struct stv0900_internal *intp,
|
||
|
return locked;
|
||
|
}
|
||
|
|
||
|
+static int stv0900_set_pls(struct stv0900_internal *intp,
|
||
|
+ enum fe_stv0900_demod_num demod, u8 pls_mode, u32 pls_code)
|
||
|
+{
|
||
|
+ enum fe_stv0900_error error = STV0900_NO_ERROR;
|
||
|
+
|
||
|
+ dprintk("Set PLS code %d (mode %d)", pls_code, pls_mode);
|
||
|
+ stv0900_write_reg(intp, PLROOT2, (pls_mode<<2) | (pls_code>>16));
|
||
|
+ stv0900_write_reg(intp, PLROOT1, pls_code>>8);
|
||
|
+ stv0900_write_reg(intp, PLROOT0, pls_code);
|
||
|
+
|
||
|
+ return error;
|
||
|
+}
|
||
|
+
|
||
|
static int stv0900_set_mis(struct stv0900_internal *intp,
|
||
|
enum fe_stv0900_demod_num demod, int mis)
|
||
|
{
|
||
|
dprintk("%s\n", __func__);
|
||
|
|
||
|
- if (mis < 0 || mis > 255) {
|
||
|
+ if (mis == NO_STREAM_ID_FILTER) {
|
||
|
dprintk("Disable MIS filtering\n");
|
||
|
stv0900_write_bits(intp, FILTER_EN, 0);
|
||
|
} else {
|
||
|
@@ -1590,6 +1603,7 @@ static enum dvbfe_search stv0900_search(struct dvb_frontend *fe)
|
||
|
if (state->config->set_ts_params)
|
||
|
state->config->set_ts_params(fe, 0);
|
||
|
|
||
|
+ stv0900_set_pls(intp, demod, (c->stream_id>>26) & 0x3, (c->stream_id>>8) & 0x3FFFF);
|
||
|
stv0900_set_mis(intp, demod, c->stream_id);
|
||
|
|
||
|
p_result.locked = FALSE;
|
||
|
diff --git a/drivers/media/dvb-frontends/stv090x.c b/drivers/media/dvb-frontends/stv090x.c
|
||
|
index ce99b9d..264c4b8 100644
|
||
|
--- a/drivers/media/dvb-frontends/stv090x.c
|
||
|
+++ b/drivers/media/dvb-frontends/stv090x.c
|
||
|
@@ -3435,18 +3435,40 @@ err:
|
||
|
return -1;
|
||
|
}
|
||
|
|
||
|
+static int stv090x_set_pls(struct stv090x_state *state, u8 pls_mode, u32 pls_code)
|
||
|
+{
|
||
|
+ if (pls_mode == 0 && pls_code == 0)
|
||
|
+ pls_code = 1;
|
||
|
+ pls_mode &= 0x03;
|
||
|
+ pls_code &= 0x3FFFF;
|
||
|
+
|
||
|
+ dprintk(FE_DEBUG, 1, "Set PLS code %d (mode %d)", pls_code, pls_mode);
|
||
|
+ if (STV090x_WRITE_DEMOD(state, PLROOT2, (pls_mode<<2) | (pls_code>>16)) < 0)
|
||
|
+ goto err;
|
||
|
+ if (STV090x_WRITE_DEMOD(state, PLROOT1, pls_code>>8) < 0)
|
||
|
+ goto err;
|
||
|
+ if (STV090x_WRITE_DEMOD(state, PLROOT0, pls_code) < 0)
|
||
|
+ goto err;
|
||
|
+ return 0;
|
||
|
+err:
|
||
|
+ dprintk(FE_ERROR, 1, "I/O error");
|
||
|
+ return -1;
|
||
|
+}
|
||
|
+
|
||
|
static int stv090x_set_mis(struct stv090x_state *state, int mis)
|
||
|
{
|
||
|
u32 reg;
|
||
|
|
||
|
- if (mis < 0 || mis > 255) {
|
||
|
+ if (mis == NO_STREAM_ID_FILTER) {
|
||
|
dprintk(FE_DEBUG, 1, "Disable MIS filtering");
|
||
|
+ stv090x_set_pls(state, 0, 0);
|
||
|
reg = STV090x_READ_DEMOD(state, PDELCTRL1);
|
||
|
STV090x_SETFIELD_Px(reg, FILTER_EN_FIELD, 0x00);
|
||
|
if (STV090x_WRITE_DEMOD(state, PDELCTRL1, reg) < 0)
|
||
|
goto err;
|
||
|
} else {
|
||
|
dprintk(FE_DEBUG, 1, "Enable MIS filtering - %d", mis);
|
||
|
+ stv090x_set_pls(state, (mis>>26) & 0x3, (mis>>8) & 0x3FFFF);
|
||
|
reg = STV090x_READ_DEMOD(state, PDELCTRL1);
|
||
|
STV090x_SETFIELD_Px(reg, FILTER_EN_FIELD, 0x01);
|
||
|
if (STV090x_WRITE_DEMOD(state, PDELCTRL1, reg) < 0)
|
||
|
--
|
||
|
2.1.4
|
||
|
|