aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/common/tuners/mt2063.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/media/common/tuners/mt2063.c b/drivers/media/common/tuners/mt2063.c
index 92653a9ff3b0..db347d9e7d45 100644
--- a/drivers/media/common/tuners/mt2063.c
+++ b/drivers/media/common/tuners/mt2063.c
@@ -220,6 +220,8 @@ enum MT2063_Register_Offsets {
220struct mt2063_state { 220struct mt2063_state {
221 struct i2c_adapter *i2c; 221 struct i2c_adapter *i2c;
222 222
223 bool init;
224
223 const struct mt2063_config *config; 225 const struct mt2063_config *config;
224 struct dvb_tuner_ops ops; 226 struct dvb_tuner_ops ops;
225 struct dvb_frontend *frontend; 227 struct dvb_frontend *frontend;
@@ -1974,6 +1976,8 @@ static int mt2063_init(struct dvb_frontend *fe)
1974 if (status < 0) 1976 if (status < 0)
1975 return status; 1977 return status;
1976 1978
1979 state->init = true;
1980
1977 return 0; 1981 return 0;
1978} 1982}
1979 1983
@@ -1984,6 +1988,9 @@ static int mt2063_get_status(struct dvb_frontend *fe, u32 *tuner_status)
1984 1988
1985 dprintk(2, "\n"); 1989 dprintk(2, "\n");
1986 1990
1991 if (!state->init)
1992 return -ENODEV;
1993
1987 *tuner_status = 0; 1994 *tuner_status = 0;
1988 status = mt2063_lockStatus(state); 1995 status = mt2063_lockStatus(state);
1989 if (status < 0) 1996 if (status < 0)
@@ -2019,6 +2026,12 @@ static int mt2063_set_analog_params(struct dvb_frontend *fe,
2019 2026
2020 dprintk(2, "\n"); 2027 dprintk(2, "\n");
2021 2028
2029 if (!state->init) {
2030 status = mt2063_init(fe);
2031 if (status < 0)
2032 return status;
2033 }
2034
2022 switch (params->mode) { 2035 switch (params->mode) {
2023 case V4L2_TUNER_RADIO: 2036 case V4L2_TUNER_RADIO:
2024 pict_car = 38900000; 2037 pict_car = 38900000;
@@ -2082,6 +2095,12 @@ static int mt2063_set_params(struct dvb_frontend *fe)
2082 s32 if_mid; 2095 s32 if_mid;
2083 s32 rcvr_mode; 2096 s32 rcvr_mode;
2084 2097
2098 if (!state->init) {
2099 status = mt2063_init(fe);
2100 if (status < 0)
2101 return status;
2102 }
2103
2085 dprintk(2, "\n"); 2104 dprintk(2, "\n");
2086 2105
2087 if (c->bandwidth_hz == 0) 2106 if (c->bandwidth_hz == 0)
@@ -2132,6 +2151,9 @@ static int mt2063_get_frequency(struct dvb_frontend *fe, u32 *freq)
2132 2151
2133 dprintk(2, "\n"); 2152 dprintk(2, "\n");
2134 2153
2154 if (!state->init)
2155 return -ENODEV;
2156
2135 *freq = state->frequency; 2157 *freq = state->frequency;
2136 return 0; 2158 return 0;
2137} 2159}
@@ -2142,6 +2164,9 @@ static int mt2063_get_bandwidth(struct dvb_frontend *fe, u32 *bw)
2142 2164
2143 dprintk(2, "\n"); 2165 dprintk(2, "\n");
2144 2166
2167 if (!state->init)
2168 return -ENODEV;
2169
2145 *bw = state->AS_Data.f_out_bw - 750000; 2170 *bw = state->AS_Data.f_out_bw - 750000;
2146 return 0; 2171 return 0;
2147} 2172}