tree cd090616b3a13c130b72238f92390761bda71e39
parent 4ff4ac1beae58a2fea7ec2ad43d6c3b60d90ec61
author Andreas Oberritter <[EMAIL PROTECTED]> Sat, 10 Sep 2005 03:02:30 -0700
committer Linus Torvalds <[EMAIL PROTECTED]> Sat, 10 Sep 2005 03:57:38 -0700

[PATCH] dvb: frontend: stv0299: pass i2c bus to pll callback

Pass a pointer to the i2c bus to the pll callbacks (stv0299 only).

It was not possible to tell which i2c bus should be used if an adapter has
multiple frontends on multiple i2c buses.

Signed-off-by: Andreas Oberritter <[EMAIL PROTECTED]>
Signed-off-by: Johannes Stezenbach <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>

 drivers/media/dvb/b2c2/flexcop-fe-tuner.c         |    5 ++---
 drivers/media/dvb/frontends/stv0299.c             |    6 +++---
 drivers/media/dvb/frontends/stv0299.h             |    4 ++--
 drivers/media/dvb/ttpci/av7110.c                  |   10 ++++------
 drivers/media/dvb/ttpci/budget-av.c               |    4 ++--
 drivers/media/dvb/ttpci/budget-ci.c               |    9 ++++-----
 drivers/media/dvb/ttpci/budget-patch.c            |    5 ++---
 drivers/media/dvb/ttpci/budget.c                  |    5 ++---
 drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c |    4 ++--
 9 files changed, 23 insertions(+), 29 deletions(-)

diff --git a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c 
b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c
--- a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c
+++ b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c
@@ -164,12 +164,11 @@ static int samsung_tbmu24112_set_symbol_
        return 0;
 }
 
-static int samsung_tbmu24112_pll_set(struct dvb_frontend* fe, struct 
dvb_frontend_parameters* params)
+static int samsung_tbmu24112_pll_set(struct dvb_frontend* fe, struct 
i2c_adapter *i2c, struct dvb_frontend_parameters* params)
 {
        u8 buf[4];
        u32 div;
        struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = buf, .len = 
sizeof(buf) };
-       struct flexcop_device *fc = fe->dvb->priv;
 
        div = params->frequency / 125;
 
@@ -180,7 +179,7 @@ static int samsung_tbmu24112_pll_set(str
 
        if (params->frequency < 1500000) buf[3] |= 0x10;
 
-       if (i2c_transfer(&fc->i2c_adap, &msg, 1) != 1)
+       if (i2c_transfer(i2c, &msg, 1) != 1)
                return -EIO;
        return 0;
 }
diff --git a/drivers/media/dvb/frontends/stv0299.c 
b/drivers/media/dvb/frontends/stv0299.c
--- a/drivers/media/dvb/frontends/stv0299.c
+++ b/drivers/media/dvb/frontends/stv0299.c
@@ -481,7 +481,7 @@ static int stv0299_init (struct dvb_fron
 
        if (state->config->pll_init) {
                stv0299_writeregI(state, 0x05, 0xb5);   /*  enable i2c repeater 
on stv0299  */
-               state->config->pll_init(fe);
+               state->config->pll_init(fe, state->i2c);
                stv0299_writeregI(state, 0x05, 0x35);   /*  disable i2c 
repeater on stv0299  */
        }
 
@@ -603,7 +603,7 @@ static int stv0299_set_frontend(struct d
                } else {
                        /* A "normal" tune is requested */
                        stv0299_writeregI(state, 0x05, 0xb5);   /*  enable i2c 
repeater on stv0299  */
-                       state->config->pll_set(fe, p);
+                       state->config->pll_set(fe, state->i2c, p);
                        stv0299_writeregI(state, 0x05, 0x35);   /*  disable i2c 
repeater on stv0299  */
 
                        stv0299_writeregI(state, 0x32, 0x80);
@@ -615,7 +615,7 @@ static int stv0299_set_frontend(struct d
                }
        } else {
                stv0299_writeregI(state, 0x05, 0xb5);   /*  enable i2c repeater 
on stv0299  */
-               state->config->pll_set(fe, p);
+               state->config->pll_set(fe, state->i2c, p);
                stv0299_writeregI(state, 0x05, 0x35);   /*  disable i2c 
repeater on stv0299  */
 
                stv0299_set_FEC (state, p->u.qpsk.fec_inner);
diff --git a/drivers/media/dvb/frontends/stv0299.h 
b/drivers/media/dvb/frontends/stv0299.h
--- a/drivers/media/dvb/frontends/stv0299.h
+++ b/drivers/media/dvb/frontends/stv0299.h
@@ -92,8 +92,8 @@ struct stv0299_config
        int (*set_symbol_rate)(struct dvb_frontend* fe, u32 srate, u32 ratio);
 
        /* PLL maintenance */
-       int (*pll_init)(struct dvb_frontend* fe);
-       int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* 
params);
+       int (*pll_init)(struct dvb_frontend *fe, struct i2c_adapter *i2c);
+       int (*pll_set)(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct 
dvb_frontend_parameters *params);
 };
 
 extern int stv0299_writereg (struct dvb_frontend* fe, u8 reg, u8 data);
diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c
--- a/drivers/media/dvb/ttpci/av7110.c
+++ b/drivers/media/dvb/ttpci/av7110.c
@@ -1668,9 +1668,8 @@ static int alps_bsru6_set_symbol_rate(st
        return 0;
 }
 
-static int alps_bsru6_pll_set(struct dvb_frontend* fe, struct 
dvb_frontend_parameters* params)
+static int alps_bsru6_pll_set(struct dvb_frontend* fe, struct i2c_adapter 
*i2c, struct dvb_frontend_parameters* params)
 {
-       struct av7110* av7110 = (struct av7110*) fe->dvb->priv;
        int ret;
        u8 data[4];
        u32 div;
@@ -1687,7 +1686,7 @@ static int alps_bsru6_pll_set(struct dvb
 
        if (params->frequency > 1530000) data[3] = 0xc0;
 
-       ret = i2c_transfer(&av7110->i2c_adap, &msg, 1);
+       ret = i2c_transfer(i2c, &msg, 1);
        if (ret != 1)
                return -EIO;
        return 0;
@@ -1751,9 +1750,8 @@ static u8 alps_bsbe1_inittab[] = {
        0xff, 0xff
 };
 
-static int alps_bsbe1_pll_set(struct dvb_frontend* fe, struct 
dvb_frontend_parameters* params)
+static int alps_bsbe1_pll_set(struct dvb_frontend* fe, struct i2c_adapter 
*i2c, struct dvb_frontend_parameters* params)
 {
-       struct av7110* av7110 = (struct av7110*) fe->dvb->priv;
        int ret;
        u8 data[4];
        u32 div;
@@ -1768,7 +1766,7 @@ static int alps_bsbe1_pll_set(struct dvb
        data[2] = 0x80 | ((div & 0x18000) >> 10) | 4;
        data[3] = (params->frequency > 1530000) ? 0xE0 : 0xE4;
 
-       ret = i2c_transfer(&av7110->i2c_adap, &msg, 1);
+       ret = i2c_transfer(i2c, &msg, 1);
        return (ret != 1) ? -EIO : 0;
 }
 
diff --git a/drivers/media/dvb/ttpci/budget-av.c 
b/drivers/media/dvb/ttpci/budget-av.c
--- a/drivers/media/dvb/ttpci/budget-av.c
+++ b/drivers/media/dvb/ttpci/budget-av.c
@@ -453,9 +453,9 @@ static int philips_su1278_ty_ci_set_symb
 }
 
 static int philips_su1278_ty_ci_pll_set(struct dvb_frontend *fe,
+                                       struct i2c_adapter *i2c,
                                        struct dvb_frontend_parameters *params)
 {
-       struct budget_av *budget_av = (struct budget_av *) fe->dvb->priv;
        u32 div;
        u8 buf[4];
        struct i2c_msg msg = {.addr = 0x61,.flags = 0,.buf = buf,.len = 
sizeof(buf) };
@@ -481,7 +481,7 @@ static int philips_su1278_ty_ci_pll_set(
        else if (params->frequency < 2150000)
                buf[3] |= 0xC0;
 
-       if (i2c_transfer(&budget_av->budget.i2c_adap, &msg, 1) != 1)
+       if (i2c_transfer(i2c, &msg, 1) != 1)
                return -EIO;
        return 0;
 }
diff --git a/drivers/media/dvb/ttpci/budget-ci.c 
b/drivers/media/dvb/ttpci/budget-ci.c
--- a/drivers/media/dvb/ttpci/budget-ci.c
+++ b/drivers/media/dvb/ttpci/budget-ci.c
@@ -548,9 +548,8 @@ static int alps_bsru6_set_symbol_rate(st
        return 0;
 }
 
-static int alps_bsru6_pll_set(struct dvb_frontend *fe, struct 
dvb_frontend_parameters *params)
+static int alps_bsru6_pll_set(struct dvb_frontend *fe, struct i2c_adapter 
*i2c, struct dvb_frontend_parameters *params)
 {
-       struct budget_ci *budget_ci = (struct budget_ci *) fe->dvb->priv;
        u8 buf[4];
        u32 div;
        struct i2c_msg msg = {.addr = 0x61,.flags = 0,.buf = buf,.len = 
sizeof(buf) };
@@ -567,7 +566,7 @@ static int alps_bsru6_pll_set(struct dvb
        if (params->frequency > 1530000)
                buf[3] = 0xc0;
 
-       if (i2c_transfer(&budget_ci->budget.i2c_adap, &msg, 1) != 1)
+       if (i2c_transfer(i2c, &msg, 1) != 1)
                return -EIO;
        return 0;
 }
@@ -669,9 +668,9 @@ static int philips_su1278_tt_set_symbol_
 }
 
 static int philips_su1278_tt_pll_set(struct dvb_frontend *fe,
+                                    struct i2c_adapter *i2c,
                                     struct dvb_frontend_parameters *params)
 {
-       struct budget_ci *budget_ci = (struct budget_ci *) fe->dvb->priv;
        u32 div;
        u8 buf[4];
        struct i2c_msg msg = {.addr = 0x60,.flags = 0,.buf = buf,.len = 
sizeof(buf) };
@@ -697,7 +696,7 @@ static int philips_su1278_tt_pll_set(str
        else if (params->frequency < 2150000)
                buf[3] |= 0xC0;
 
-       if (i2c_transfer(&budget_ci->budget.i2c_adap, &msg, 1) != 1)
+       if (i2c_transfer(i2c, &msg, 1) != 1)
                return -EIO;
        return 0;
 }
diff --git a/drivers/media/dvb/ttpci/budget-patch.c 
b/drivers/media/dvb/ttpci/budget-patch.c
--- a/drivers/media/dvb/ttpci/budget-patch.c
+++ b/drivers/media/dvb/ttpci/budget-patch.c
@@ -353,9 +353,8 @@ static int alps_bsru6_set_symbol_rate(st
        return 0;
 }
 
-static int alps_bsru6_pll_set(struct dvb_frontend* fe, struct 
dvb_frontend_parameters* params)
+static int alps_bsru6_pll_set(struct dvb_frontend* fe, struct i2c_adapter 
*i2c, struct dvb_frontend_parameters* params)
 {
-       struct budget_patch* budget = (struct budget_patch*) fe->dvb->priv;
        u8 data[4];
        u32 div;
        struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = 
sizeof(data) };
@@ -370,7 +369,7 @@ static int alps_bsru6_pll_set(struct dvb
 
        if (params->frequency > 1530000) data[3] = 0xc0;
 
-       if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO;
+       if (i2c_transfer(i2c, &msg, 1) != 1) return -EIO;
        return 0;
 }
 
diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c
--- a/drivers/media/dvb/ttpci/budget.c
+++ b/drivers/media/dvb/ttpci/budget.c
@@ -332,9 +332,8 @@ static int alps_bsru6_set_symbol_rate(st
        return 0;
 }
 
-static int alps_bsru6_pll_set(struct dvb_frontend* fe, struct 
dvb_frontend_parameters* params)
+static int alps_bsru6_pll_set(struct dvb_frontend* fe, struct i2c_adapter 
*i2c, struct dvb_frontend_parameters* params)
 {
-       struct budget* budget = (struct budget*) fe->dvb->priv;
        u8 data[4];
        u32 div;
        struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = 
sizeof(data) };
@@ -349,7 +348,7 @@ static int alps_bsru6_pll_set(struct dvb
 
        if (params->frequency > 1530000) data[3] = 0xc0;
 
-       if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO;
+       if (i2c_transfer(i2c, &msg, 1) != 1) return -EIO;
        return 0;
 }
 
diff --git a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c 
b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
--- a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
+++ b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
@@ -1299,7 +1299,7 @@ static int alps_stv0299_set_symbol_rate(
        return 0;
 }
 
-static int philips_tsa5059_pll_set(struct dvb_frontend *fe, struct 
dvb_frontend_parameters *params)
+static int philips_tsa5059_pll_set(struct dvb_frontend *fe, struct i2c_adapter 
*i2c, struct dvb_frontend_parameters *params)
 {
        struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv;
        u8 buf[4];
@@ -1322,7 +1322,7 @@ static int philips_tsa5059_pll_set(struc
        if (ttusb->revision == TTUSB_REV_2_2)
                buf[3] |= 0x20;
 
-       if (i2c_transfer(&ttusb->i2c_adap, &msg, 1) != 1)
+       if (i2c_transfer(i2c, &msg, 1) != 1)
                return -EIO;
 
        return 0;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to