V4L/DVB (8028): Improve error messages for tda1004x attach

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Sunday, June 29, 2008 - 1:03 pm

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=bc36ec...
Commit:     bc36ec746409e4e4719b94a86dc0d8cbeb6f439f
Parent:     b25fed115a8bd8d39d14ce0d03e808272a401d67
Author:     Mauro Carvalho Chehab <mchehab@infradead.org>
AuthorDate: Sat Jun 14 10:44:04 2008 -0300
Committer:  Mauro Carvalho Chehab <mchehab@infradead.org>
CommitDate: Thu Jun 26 15:58:48 2008 -0300

    V4L/DVB (8028): Improve error messages for tda1004x attach
    
    A fresh copy of v.29 firmware, using get_firmware, is leading to an invalid
    firmware:
    
    DVB: registering new adapter (saa7133[0])
    DVB: registering frontend 0 (Philips TDA10046H DVB-T)...
    tda1004x: setting up plls for 48MHz sampling clock
    tda1004x: found firmware revision ff -- invalid
    tda1004x: trying to boot from eeprom
    tda1004x: found firmware revision ff -- invalid
    tda1004x: waiting for firmware upload...
    tda1004x: Error during firmware upload
    tda1004x: found firmware revision ff -- invalid
    tda1004x: firmware upload failed
    
    Sometimes, loading/unloading this firmware makes tda1004x to return an invalid
    ID. However, there were no printk messages to help to identify what were the
    cause for the error.
    
    With this patch, it will now print:
    
    Invalid tda1004x ID = 0xff. Can't proceed
    saa7133[0]/dvb: failed to attach tda10046
    saa7133[0]/dvb: frontend initialization failed
    
    Tested with LifeView FlyDVB-T Hybrid Cardbus/MSI TV @nywhere A/D NB
    
    Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
---
 drivers/media/dvb/frontends/tda1004x.c    |   18 ++++++++++++++----
 drivers/media/video/saa7134/saa7134-dvb.c |    3 ++-
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/drivers/media/dvb/frontends/tda1004x.c b/drivers/media/dvb/frontends/tda1004x.c
index 4997384..3993d1c 100644
--- a/drivers/media/dvb/frontends/tda1004x.c
+++ b/drivers/media/dvb/frontends/tda1004x.c
@@ -1248,11 +1248,14 @@ struct dvb_frontend* tda10045_attach(const struct tda1004x_config* config,
 				     struct i2c_adapter* i2c)
 {
 	struct tda1004x_state *state;
+	u8 id;
 
 	/* allocate memory for the internal state */
 	state = kmalloc(sizeof(struct tda1004x_state), GFP_KERNEL);
-	if (!state)
+	if (!state) {
+		printk(KERN_ERR "Can't alocate memory for tda10045 state\n");
 		return NULL;
+	}
 
 	/* setup the state */
 	state->config = config;
@@ -1260,7 +1263,9 @@ struct dvb_frontend* tda10045_attach(const struct tda1004x_config* config,
 	state->demod_type = TDA1004X_DEMOD_TDA10045;
 
 	/* check if the demod is there */
-	if (tda1004x_read_byte(state, TDA1004X_CHIPID) != 0x25) {
+	id = tda1004x_read_byte(state, TDA1004X_CHIPID);
+	if (id != 0x25) {
+		printk(KERN_ERR "Invalid tda1004x ID = 0x%02x. Can't proceed\n", id);
 		kfree(state);
 		return NULL;
 	}
@@ -1307,11 +1312,14 @@ struct dvb_frontend* tda10046_attach(const struct tda1004x_config* config,
 				     struct i2c_adapter* i2c)
 {
 	struct tda1004x_state *state;
+	u8 id;
 
 	/* allocate memory for the internal state */
 	state = kmalloc(sizeof(struct tda1004x_state), GFP_KERNEL);
-	if (!state)
+	if (!state) {
+		printk(KERN_ERR "Can't alocate memory for tda10046 state\n");
 		return NULL;
+	}
 
 	/* setup the state */
 	state->config = config;
@@ -1319,7 +1327,9 @@ struct dvb_frontend* tda10046_attach(const struct tda1004x_config* config,
 	state->demod_type = TDA1004X_DEMOD_TDA10046;
 
 	/* check if the demod is there */
-	if (tda1004x_read_byte(state, TDA1004X_CHIPID) != 0x46) {
+	id = tda1004x_read_byte(state, TDA1004X_CHIPID);
+	if (id != 0x46) {
+		printk(KERN_ERR "Invalid tda1004x ID = 0x%02x. Can't proceed\n", id);
 		kfree(state);
 		return NULL;
 	}
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c
index 726f01c..653107c 100644
--- a/drivers/media/video/saa7134/saa7134-dvb.c
+++ b/drivers/media/video/saa7134/saa7134-dvb.c
@@ -1091,7 +1091,8 @@ static int dvb_init(struct saa7134_dev *dev)
 					ads_tech_duo_config.tuner_address);
 				goto dettach_frontend;
 			}
-		}
+		} else
+			wprintk("failed to attach tda10046\n");
 		break;
 	case SAA7134_BOARD_TEVION_DVBT_220RF:
 		if (configure_tda827x_fe(dev, &tevion_dvbt220rf_config,
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
V4L/DVB (8028): Improve error messages for tda1004x attach, Linux Kernel Mailing ..., (Sun Jun 29, 1:03 pm)