From 548b1f94904ae1616f9338a772e89a9f2e705325 Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Sun, 5 Nov 2017 09:25:04 -0500 Subject: [PATCH] media: si2165: Use constellation from property cache instead of hardcoded QAM256 Use constellation from property cache instead of always setting it to QAM256. Signed-off-by: Matthias Schwarzott Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/si2165.c | 29 +++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/drivers/media/dvb-frontends/si2165.c b/drivers/media/dvb-frontends/si2165.c index 7f22f5bdc36a..ea9d23e7e266 100644 --- a/drivers/media/dvb-frontends/si2165.c +++ b/drivers/media/dvb-frontends/si2165.c @@ -805,13 +805,11 @@ static const struct si2165_reg_value_pair dvbc_regs[] = { { REG_KP_LOCK, 0x05 }, { REG_CENTRAL_TAP, 0x09 }, REG16(REG_UNKNOWN_350, 0x3e80), - { REG_REQ_CONSTELLATION, 0x00 }, { REG_AUTO_RESET, 0x01 }, REG16(REG_UNKNOWN_24C, 0x0000), REG16(REG_UNKNOWN_27C, 0x0000), { REG_SWEEP_STEP, 0x03 }, - { REG_REQ_CONSTELLATION, 0x0b }, { REG_AGC_IF_TRI, 0x00 }, }; @@ -821,6 +819,7 @@ static int si2165_set_frontend_dvbc(struct dvb_frontend *fe) int ret; struct dtv_frontend_properties *p = &fe->dtv_property_cache; const u32 dvb_rate = p->symbol_rate; + u8 u8tmp; if (!state->has_dvbc) return -EINVAL; @@ -837,6 +836,31 @@ static int si2165_set_frontend_dvbc(struct dvb_frontend *fe) if (ret < 0) return ret; + switch (p->modulation) { + case QPSK: + u8tmp = 0x3; + break; + case QAM_16: + u8tmp = 0x7; + break; + case QAM_32: + u8tmp = 0x8; + break; + case QAM_64: + u8tmp = 0x9; + break; + case QAM_128: + u8tmp = 0xa; + break; + case QAM_256: + default: + u8tmp = 0xb; + break; + } + ret = si2165_writereg8(state, REG_REQ_CONSTELLATION, u8tmp); + if (ret < 0) + return ret; + ret = si2165_writereg32(state, REG_LOCK_TIMEOUT, 0x007a1200); if (ret < 0) return ret; @@ -952,7 +976,6 @@ static const struct dvb_frontend_ops si2165_ops = { FE_CAN_QAM_64 | FE_CAN_QAM_128 | FE_CAN_QAM_256 | - FE_CAN_QAM_AUTO | FE_CAN_GUARD_INTERVAL_AUTO | FE_CAN_HIERARCHY_AUTO | FE_CAN_MUTE_TS |