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 05/21] [media] drxk: Move I2C address into a config structure
Date: Sun, 10 Jul 2011 22:58:52 -0300	[thread overview]
Message-ID: <20110710225852.7f815f7a@pedra> (raw)
In-Reply-To: <cover.1310347962.git.mchehab@redhat.com>

Currently, the only parameter to be configured is the I2C
address. However, Terratec H5 logs shows that it needs a different
setting for some things, and it has its own firmware.

So, move the addr into a config structure, in order to allow adding
the required configuration bits.

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

diff --git a/drivers/media/dvb/ddbridge/ddbridge-core.c b/drivers/media/dvb/ddbridge/ddbridge-core.c
index def03d4..573d540 100644
--- a/drivers/media/dvb/ddbridge/ddbridge-core.c
+++ b/drivers/media/dvb/ddbridge/ddbridge-core.c
@@ -574,10 +574,12 @@ static int demod_attach_drxk(struct ddb_input *input)
 {
 	struct i2c_adapter *i2c = &input->port->i2c->adap;
 	struct dvb_frontend *fe;
+	struct drxk_config config;
 
-	fe = input->fe = dvb_attach(drxk_attach,
-				    i2c, 0x29 + (input->nr&1),
-				    &input->fe2);
+	memset(&config, 0, sizeof(config));
+	config.adr = 0x29 + (input->nr & 1);
+
+	fe = input->fe = dvb_attach(drxk_attach, &config, i2c, &input->fe2);
 	if (!input->fe) {
 		printk(KERN_ERR "No DRXK found!\n");
 		return -ENODEV;
diff --git a/drivers/media/dvb/frontends/drxk.h b/drivers/media/dvb/frontends/drxk.h
index d1c133e..a7b295f 100644
--- a/drivers/media/dvb/frontends/drxk.h
+++ b/drivers/media/dvb/frontends/drxk.h
@@ -4,7 +4,11 @@
 #include <linux/types.h>
 #include <linux/i2c.h>
 
-extern struct dvb_frontend *drxk_attach(struct i2c_adapter *i2c,
-					u8 adr,
+struct drxk_config {
+	u8 adr;
+};
+
+extern struct dvb_frontend *drxk_attach(const struct drxk_config *config,
+					struct i2c_adapter *i2c,
 					struct dvb_frontend **fe_t);
 #endif
diff --git a/drivers/media/dvb/frontends/drxk_hard.c b/drivers/media/dvb/frontends/drxk_hard.c
index 8b2e06e..d351e6a 100644
--- a/drivers/media/dvb/frontends/drxk_hard.c
+++ b/drivers/media/dvb/frontends/drxk_hard.c
@@ -6341,10 +6341,12 @@ static struct dvb_frontend_ops drxk_t_ops = {
 	.read_ucblocks = drxk_read_ucblocks,
 };
 
-struct dvb_frontend *drxk_attach(struct i2c_adapter *i2c, u8 adr,
+struct dvb_frontend *drxk_attach(const struct drxk_config *config,
+				 struct i2c_adapter *i2c,
 				 struct dvb_frontend **fe_t)
 {
 	struct drxk_state *state = NULL;
+	u8 adr = config->adr;
 
 	dprintk(1, "\n");
 	state = kzalloc(sizeof(struct drxk_state), GFP_KERNEL);
diff --git a/drivers/media/dvb/ngene/ngene-cards.c b/drivers/media/dvb/ngene/ngene-cards.c
index 9f72dd8..0564192 100644
--- a/drivers/media/dvb/ngene/ngene-cards.c
+++ b/drivers/media/dvb/ngene/ngene-cards.c
@@ -213,9 +213,12 @@ static int port_has_drxk(struct i2c_adapter *i2c, int port)
 static int demod_attach_drxk(struct ngene_channel *chan,
 			     struct i2c_adapter *i2c)
 {
-	chan->fe = dvb_attach(drxk_attach,
-				   i2c, 0x29 + (chan->number^2),
-				   &chan->fe2);
+	struct drxk_config config;
+
+	memset(&config, 0, sizeof(config));
+	config.adr = 0x29 + (chan->number ^ 2);
+
+	chan->fe = dvb_attach(drxk_attach, &config, i2c, &chan->fe2);
 	if (!chan->fe) {
 		printk(KERN_ERR "No DRXK found!\n");
 		return -ENODEV;
-- 
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 ` Mauro Carvalho Chehab [this message]
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 ` [PATCH 10/21] [media] drxk: Add a parameter for the microcode name Mauro Carvalho Chehab
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 18/21] [media] drxk: Fix driver removal 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 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=20110710225852.7f815f7a@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