public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@redhat.com>
To: unlisted-recipients:; (no To-header on input)@casper.infradead.org
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>
Subject: [PATCH 10/21] [media] drxk: Add a parameter for the microcode name
Date: Sun, 10 Jul 2011 22:58:54 -0300	[thread overview]
Message-ID: <20110710225854.57f9c6a0@pedra> (raw)
In-Reply-To: <cover.1310347962.git.mchehab@redhat.com>

The microcode firmware provided on Terratec H5 seems to be
different. Add a parameter to allow specifying a different
firmware per-device.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

diff --git a/drivers/media/dvb/frontends/drxk.h b/drivers/media/dvb/frontends/drxk.h
index d5b6f9f..dd54512 100644
--- a/drivers/media/dvb/frontends/drxk.h
+++ b/drivers/media/dvb/frontends/drxk.h
@@ -7,6 +7,7 @@
 struct drxk_config {
 	u8 adr;
 	u32 single_master : 1;
+	const char *microcode_name;
 };
 
 extern struct dvb_frontend *drxk_attach(const struct drxk_config *config,
diff --git a/drivers/media/dvb/frontends/drxk_hard.c b/drivers/media/dvb/frontends/drxk_hard.c
index 1452e82..adb454a 100644
--- a/drivers/media/dvb/frontends/drxk_hard.c
+++ b/drivers/media/dvb/frontends/drxk_hard.c
@@ -343,10 +343,11 @@ static int i2c_write(struct i2c_adapter *adap, u8 adr, u8 *data, int len)
 static int i2c_read(struct i2c_adapter *adap,
 		    u8 adr, u8 *msg, int len, u8 *answ, int alen)
 {
-	struct i2c_msg msgs[2] = { {.addr = adr, .flags = 0,
+	struct i2c_msg msgs[2] = {
+		{.addr = adr, .flags = 0,
 				    .buf = msg, .len = len},
-	{.addr = adr, .flags = I2C_M_RD,
-	 .buf = answ, .len = alen}
+		{.addr = adr, .flags = I2C_M_RD,
+		 .buf = answ, .len = alen}
 	};
 	dprintk(3, ":");
 	if (debug > 2) {
@@ -5904,7 +5905,7 @@ static int PowerDownDevice(struct drxk_state *state)
 	return 0;
 }
 
-static int load_microcode(struct drxk_state *state, char *mc_name)
+static int load_microcode(struct drxk_state *state, const char *mc_name)
 {
 	const struct firmware *fw = NULL;
 	int err = 0;
@@ -6010,20 +6011,11 @@ static int init_drxk(struct drxk_state *state)
 			if (status < 0)
 				break;
 
-#if 0
-			if (state->m_DRXK_A3_PATCH_CODE)
-				status = DownloadMicrocode(state, DRXK_A3_microcode, DRXK_A3_microcode_length);
-				if (status < 0)
-					break;
-#else
-			load_microcode(state, "drxk_a3.mc");
-#endif
-#if NOA1ROM
-			if (state->m_DRXK_A2_PATCH_CODE)
-				status = DownloadMicrocode(state, DRXK_A2_microcode, DRXK_A2_microcode_length);
-				if (status < 0)
-					break;
-#endif
+			if (!state->microcode_name)
+				load_microcode(state, "drxk_a3.mc");
+			else
+				load_microcode(state, state->microcode_name);
+
 			/* disable token-ring bus through OFDM block for possible ucode upload */
 			status = write16(state, SIO_OFDM_SH_OFDM_RING_ENABLE__A, SIO_OFDM_SH_OFDM_RING_ENABLE_OFF);
 			if (status < 0)
@@ -6367,6 +6359,7 @@ struct dvb_frontend *drxk_attach(const struct drxk_config *config,
 	state->i2c = i2c;
 	state->demod_address = adr;
 	state->single_master = config->single_master;
+	state->microcode_name = config->microcode_name;
 
 	mutex_init(&state->mutex);
 	mutex_init(&state->ctlock);
diff --git a/drivers/media/dvb/frontends/drxk_hard.h b/drivers/media/dvb/frontends/drxk_hard.h
index b7093e9..8cdadce 100644
--- a/drivers/media/dvb/frontends/drxk_hard.h
+++ b/drivers/media/dvb/frontends/drxk_hard.h
@@ -330,6 +330,7 @@ struct drxk_state {
 	/* Configurable parameters at the driver */
 
 	u32 single_master : 1;		/* Use single master i2c mode */
+	const char *microcode_name;
 
 };
 
diff --git a/drivers/media/video/em28xx/em28xx-dvb.c b/drivers/media/video/em28xx/em28xx-dvb.c
index b8686c1..93f0af5 100644
--- a/drivers/media/video/em28xx/em28xx-dvb.c
+++ b/drivers/media/video/em28xx/em28xx-dvb.c
@@ -301,10 +301,10 @@ static struct drxd_config em28xx_drxd = {
 	.disable_i2c_gate_ctrl = 1,
 };
 
-#define TERRATEC_H5_DRXK_I2C_ADDR	0x29
-
 struct drxk_config terratec_h5_drxk = {
 	.adr = 0x29,
+	.single_master = 1,
+	.microcode_name = "terratec_h5.fw",
 };
 
 static int drxk_gate_ctrl(struct dvb_frontend *fe, int enable)
-- 
1.7.1



  parent reply	other threads:[~2011-07-11  1:59 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1310347962.git.mchehab@redhat.com>
2011-07-11  1:58 ` [PATCH 09/21] [media] Add initial support for Terratec H5 Mauro Carvalho Chehab
2011-07-11  1:58 ` [PATCH 01/21] [media] drxk: add drxk prefix to the errors Mauro Carvalho Chehab
2011-07-11  1:58 ` [PATCH 02/21] [media] tda18271c2dd: add tda18271c2dd " Mauro Carvalho Chehab
2011-07-11  1:58 ` [PATCH 03/21] [media] drxk: Add debug printk's Mauro Carvalho Chehab
2011-07-11  1:58 ` [PATCH 04/21] [media] drxk: remove _0 from read/write routines Mauro Carvalho Chehab
2011-07-11  1:58 ` [PATCH 05/21] [media] drxk: Move I2C address into a config structure Mauro Carvalho Chehab
2011-07-11  1:58 ` [PATCH 06/21] [media] drxk: Convert an #ifdef logic as a new config parameter Mauro Carvalho Chehab
2011-07-11  1:58 ` Mauro Carvalho Chehab [this message]
2011-07-11  1:58 ` [PATCH 07/21] [media] drxk: Avoid OOPSes if firmware is corrupted Mauro Carvalho Chehab
2011-07-11  1:58 ` [PATCH 08/21] [media] drxk: Print an error if firmware is not loaded Mauro Carvalho Chehab
2011-07-11  1:58 ` [PATCH 11/21] [media] em28xx-i2c: Add a read after I2C write Mauro Carvalho Chehab
2011-07-11  1:58 ` [PATCH 12/21] [media] drxk: Allow to disable I2C Bridge control switch Mauro Carvalho Chehab
2011-07-11  1:59 ` [PATCH 13/21] [media] drxk: Proper handle/propagate the error codes Mauro Carvalho Chehab
2011-07-11  1:59 ` [PATCH 15/21] [media] drxk: Fix the antenna switch logic Mauro Carvalho Chehab
2011-07-11  1:59 ` [PATCH 16/21] [media] drxk: Print detected configuration Mauro Carvalho Chehab
2011-07-11  1:59 ` [PATCH 17/21] [media] drxk: Improves the UIO handling Mauro Carvalho Chehab
2011-07-11  1:59 ` [PATCH 18/21] [media] drxk: Fix driver removal Mauro Carvalho Chehab
2011-07-11  1:59 ` [PATCH 14/21] [media] drxk: change mode before calling the set mode routines Mauro Carvalho Chehab
2011-07-11  1:59 ` [PATCH 19/21] [media] drxk: Simplify the DVB-C set mode logic Mauro Carvalho Chehab
2011-07-11  1:59 ` [PATCH 20/21] [media] drxk: Improve the scu_command error message Mauro Carvalho Chehab
2011-07-11  1:59 ` [PATCH 21/21] [media] drxk: Add a fallback method for QAM parameter setting Mauro Carvalho Chehab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110710225854.57f9c6a0@pedra \
    --to=mchehab@redhat.com \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox