media: si2165: Use constellation from property cache instead of hardcoded QAM256
authorMatthias Schwarzott <zzam@gentoo.org>
Sun, 5 Nov 2017 14:25:04 +0000 (09:25 -0500)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Tue, 12 Dec 2017 10:36:10 +0000 (05:36 -0500)
Use constellation from property cache instead of always setting it to
QAM256.

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/dvb-frontends/si2165.c

index 7f22f5b..ea9d23e 100644 (file)
@@ -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 |