aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/tuners/mt2063.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/tuners/mt2063.c')
-rw-r--r--drivers/media/tuners/mt2063.c44
1 files changed, 20 insertions, 24 deletions
diff --git a/drivers/media/tuners/mt2063.c b/drivers/media/tuners/mt2063.c
index 0ed9091ff48e..2e1a02e360ff 100644
--- a/drivers/media/tuners/mt2063.c
+++ b/drivers/media/tuners/mt2063.c
@@ -245,7 +245,7 @@ struct mt2063_state {
245/* 245/*
246 * mt2063_write - Write data into the I2C bus 246 * mt2063_write - Write data into the I2C bus
247 */ 247 */
248static u32 mt2063_write(struct mt2063_state *state, u8 reg, u8 *data, u32 len) 248static int mt2063_write(struct mt2063_state *state, u8 reg, u8 *data, u32 len)
249{ 249{
250 struct dvb_frontend *fe = state->frontend; 250 struct dvb_frontend *fe = state->frontend;
251 int ret; 251 int ret;
@@ -277,9 +277,9 @@ static u32 mt2063_write(struct mt2063_state *state, u8 reg, u8 *data, u32 len)
277/* 277/*
278 * mt2063_write - Write register data into the I2C bus, caching the value 278 * mt2063_write - Write register data into the I2C bus, caching the value
279 */ 279 */
280static u32 mt2063_setreg(struct mt2063_state *state, u8 reg, u8 val) 280static int mt2063_setreg(struct mt2063_state *state, u8 reg, u8 val)
281{ 281{
282 u32 status; 282 int status;
283 283
284 dprintk(2, "\n"); 284 dprintk(2, "\n");
285 285
@@ -298,10 +298,10 @@ static u32 mt2063_setreg(struct mt2063_state *state, u8 reg, u8 val)
298/* 298/*
299 * mt2063_read - Read data from the I2C bus 299 * mt2063_read - Read data from the I2C bus
300 */ 300 */
301static u32 mt2063_read(struct mt2063_state *state, 301static int mt2063_read(struct mt2063_state *state,
302 u8 subAddress, u8 *pData, u32 cnt) 302 u8 subAddress, u8 *pData, u32 cnt)
303{ 303{
304 u32 status = 0; /* Status to be returned */ 304 int status = 0; /* Status to be returned */
305 struct dvb_frontend *fe = state->frontend; 305 struct dvb_frontend *fe = state->frontend;
306 u32 i = 0; 306 u32 i = 0;
307 307
@@ -816,7 +816,7 @@ static u32 IsSpurInBand(struct MT2063_AvoidSpursData_t *pAS_Info,
816 */ 816 */
817static u32 MT2063_AvoidSpurs(struct MT2063_AvoidSpursData_t *pAS_Info) 817static u32 MT2063_AvoidSpurs(struct MT2063_AvoidSpursData_t *pAS_Info)
818{ 818{
819 u32 status = 0; 819 int status = 0;
820 u32 fm, fp; /* restricted range on LO's */ 820 u32 fm, fp; /* restricted range on LO's */
821 pAS_Info->bSpurAvoided = 0; 821 pAS_Info->bSpurAvoided = 0;
822 pAS_Info->nSpursFound = 0; 822 pAS_Info->nSpursFound = 0;
@@ -935,14 +935,14 @@ static u32 MT2063_AvoidSpurs(struct MT2063_AvoidSpursData_t *pAS_Info)
935 * 935 *
936 * This function returns 0, if no lock, 1 if locked and a value < 1 if error 936 * This function returns 0, if no lock, 1 if locked and a value < 1 if error
937 */ 937 */
938static unsigned int mt2063_lockStatus(struct mt2063_state *state) 938static int mt2063_lockStatus(struct mt2063_state *state)
939{ 939{
940 const u32 nMaxWait = 100; /* wait a maximum of 100 msec */ 940 const u32 nMaxWait = 100; /* wait a maximum of 100 msec */
941 const u32 nPollRate = 2; /* poll status bits every 2 ms */ 941 const u32 nPollRate = 2; /* poll status bits every 2 ms */
942 const u32 nMaxLoops = nMaxWait / nPollRate; 942 const u32 nMaxLoops = nMaxWait / nPollRate;
943 const u8 LO1LK = 0x80; 943 const u8 LO1LK = 0x80;
944 u8 LO2LK = 0x08; 944 u8 LO2LK = 0x08;
945 u32 status; 945 int status;
946 u32 nDelays = 0; 946 u32 nDelays = 0;
947 947
948 dprintk(2, "\n"); 948 dprintk(2, "\n");
@@ -1069,7 +1069,7 @@ static u32 mt2063_get_dnc_output_enable(struct mt2063_state *state,
1069static u32 mt2063_set_dnc_output_enable(struct mt2063_state *state, 1069static u32 mt2063_set_dnc_output_enable(struct mt2063_state *state,
1070 enum MT2063_DNC_Output_Enable nValue) 1070 enum MT2063_DNC_Output_Enable nValue)
1071{ 1071{
1072 u32 status = 0; /* Status to be returned */ 1072 int status = 0; /* Status to be returned */
1073 u8 val = 0; 1073 u8 val = 0;
1074 1074
1075 dprintk(2, "\n"); 1075 dprintk(2, "\n");
@@ -1203,7 +1203,7 @@ static u32 mt2063_set_dnc_output_enable(struct mt2063_state *state,
1203static u32 MT2063_SetReceiverMode(struct mt2063_state *state, 1203static u32 MT2063_SetReceiverMode(struct mt2063_state *state,
1204 enum mt2063_delivery_sys Mode) 1204 enum mt2063_delivery_sys Mode)
1205{ 1205{
1206 u32 status = 0; /* Status to be returned */ 1206 int status = 0; /* Status to be returned */
1207 u8 val; 1207 u8 val;
1208 u32 longval; 1208 u32 longval;
1209 1209
@@ -1345,7 +1345,7 @@ static u32 MT2063_SetReceiverMode(struct mt2063_state *state,
1345static u32 MT2063_ClearPowerMaskBits(struct mt2063_state *state, 1345static u32 MT2063_ClearPowerMaskBits(struct mt2063_state *state,
1346 enum MT2063_Mask_Bits Bits) 1346 enum MT2063_Mask_Bits Bits)
1347{ 1347{
1348 u32 status = 0; 1348 int status = 0;
1349 1349
1350 dprintk(2, "\n"); 1350 dprintk(2, "\n");
1351 Bits = (enum MT2063_Mask_Bits)(Bits & MT2063_ALL_SD); /* Only valid bits for this tuner */ 1351 Bits = (enum MT2063_Mask_Bits)(Bits & MT2063_ALL_SD); /* Only valid bits for this tuner */
@@ -1374,7 +1374,7 @@ static u32 MT2063_ClearPowerMaskBits(struct mt2063_state *state,
1374 */ 1374 */
1375static u32 MT2063_SoftwareShutdown(struct mt2063_state *state, u8 Shutdown) 1375static u32 MT2063_SoftwareShutdown(struct mt2063_state *state, u8 Shutdown)
1376{ 1376{
1377 u32 status; 1377 int status;
1378 1378
1379 dprintk(2, "\n"); 1379 dprintk(2, "\n");
1380 if (Shutdown == 1) 1380 if (Shutdown == 1)
@@ -1540,7 +1540,7 @@ static u32 FindClearTuneFilter(struct mt2063_state *state, u32 f_in)
1540static u32 MT2063_Tune(struct mt2063_state *state, u32 f_in) 1540static u32 MT2063_Tune(struct mt2063_state *state, u32 f_in)
1541{ /* RF input center frequency */ 1541{ /* RF input center frequency */
1542 1542
1543 u32 status = 0; 1543 int status = 0;
1544 u32 LO1; /* 1st LO register value */ 1544 u32 LO1; /* 1st LO register value */
1545 u32 Num1; /* Numerator for LO1 reg. value */ 1545 u32 Num1; /* Numerator for LO1 reg. value */
1546 u32 f_IF1; /* 1st IF requested */ 1546 u32 f_IF1; /* 1st IF requested */
@@ -1803,7 +1803,7 @@ static const u8 MT2063B3_defaults[] = {
1803 1803
1804static int mt2063_init(struct dvb_frontend *fe) 1804static int mt2063_init(struct dvb_frontend *fe)
1805{ 1805{
1806 u32 status; 1806 int status;
1807 struct mt2063_state *state = fe->tuner_priv; 1807 struct mt2063_state *state = fe->tuner_priv;
1808 u8 all_resets = 0xF0; /* reset/load bits */ 1808 u8 all_resets = 0xF0; /* reset/load bits */
1809 const u8 *def = NULL; 1809 const u8 *def = NULL;
@@ -2249,8 +2249,8 @@ struct dvb_frontend *mt2063_attach(struct dvb_frontend *fe,
2249 dprintk(2, "\n"); 2249 dprintk(2, "\n");
2250 2250
2251 state = kzalloc(sizeof(struct mt2063_state), GFP_KERNEL); 2251 state = kzalloc(sizeof(struct mt2063_state), GFP_KERNEL);
2252 if (state == NULL) 2252 if (!state)
2253 goto error; 2253 return NULL;
2254 2254
2255 state->config = config; 2255 state->config = config;
2256 state->i2c = i2c; 2256 state->i2c = i2c;
@@ -2261,18 +2261,15 @@ struct dvb_frontend *mt2063_attach(struct dvb_frontend *fe,
2261 2261
2262 printk(KERN_INFO "%s: Attaching MT2063\n", __func__); 2262 printk(KERN_INFO "%s: Attaching MT2063\n", __func__);
2263 return fe; 2263 return fe;
2264
2265error:
2266 kfree(state);
2267 return NULL;
2268} 2264}
2269EXPORT_SYMBOL_GPL(mt2063_attach); 2265EXPORT_SYMBOL_GPL(mt2063_attach);
2270 2266
2267#if 0
2271/* 2268/*
2272 * Ancillary routines visible outside mt2063 2269 * Ancillary routines visible outside mt2063
2273 * FIXME: Remove them in favor of using standard tuner callbacks 2270 * FIXME: Remove them in favor of using standard tuner callbacks
2274 */ 2271 */
2275unsigned int tuner_MT2063_SoftwareShutdown(struct dvb_frontend *fe) 2272static int tuner_MT2063_SoftwareShutdown(struct dvb_frontend *fe)
2276{ 2273{
2277 struct mt2063_state *state = fe->tuner_priv; 2274 struct mt2063_state *state = fe->tuner_priv;
2278 int err = 0; 2275 int err = 0;
@@ -2285,9 +2282,8 @@ unsigned int tuner_MT2063_SoftwareShutdown(struct dvb_frontend *fe)
2285 2282
2286 return err; 2283 return err;
2287} 2284}
2288EXPORT_SYMBOL_GPL(tuner_MT2063_SoftwareShutdown);
2289 2285
2290unsigned int tuner_MT2063_ClearPowerMaskBits(struct dvb_frontend *fe) 2286static int tuner_MT2063_ClearPowerMaskBits(struct dvb_frontend *fe)
2291{ 2287{
2292 struct mt2063_state *state = fe->tuner_priv; 2288 struct mt2063_state *state = fe->tuner_priv;
2293 int err = 0; 2289 int err = 0;
@@ -2300,7 +2296,7 @@ unsigned int tuner_MT2063_ClearPowerMaskBits(struct dvb_frontend *fe)
2300 2296
2301 return err; 2297 return err;
2302} 2298}
2303EXPORT_SYMBOL_GPL(tuner_MT2063_ClearPowerMaskBits); 2299#endif
2304 2300
2305MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 2301MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
2306MODULE_DESCRIPTION("MT2063 Silicon tuner"); 2302MODULE_DESCRIPTION("MT2063 Silicon tuner");