Hello all ! Continueing to move the frontends code from ttpci/ tp frontends. This patch : - Moves the ALPS BSRV2 tuner code to frontends/bsrv2.h - Adapts accordingly ves1x93.{c,h} so that the pll_set () function accepts the i2c_adapter as an argument. (Copying stv0299 behavior...) - Modify accordingly av7110.c, budget-patch.c, budget.c Could someone please try this patch ? It compiles properly, but I don't have any way to test it, as I don't have a card like that... See you. Perceval.
# HG changeset patch # User corwin@xxxxxxxxxxxxxxxxxxxxx # Node ID 0c3d9dad57bd10a9a431bfa0614035dfc9ab9ac2 # Parent 436e56df57d3d5fe2f073129eb894bf452b9375b Updated ves1x93 frontend code so that pll_set () takes the i2c_adapter as an argument. Moved duplicated code of ALPS BSRV2 tuner to a standalone file. Modified av7110 and budget drivers to include the new file. Signed-off-by: Perceval Anichini <perceval.anichini@xxxxxxxxxxxxxxx> diff -r 436e56df57d3 -r 0c3d9dad57bd linux/drivers/media/dvb/frontends/ves1x93.c --- a/linux/drivers/media/dvb/frontends/ves1x93.c Thu Apr 13 18:50:22 2006 -0300 +++ b/linux/drivers/media/dvb/frontends/ves1x93.c Fri Apr 14 16:34:35 2006 +0200 @@ -396,7 +396,7 @@ static int ves1x93_set_frontend(struct d struct ves1x93_state* state = fe->demodulator_priv; ves1x93_writereg(state, 0x00, 0x11); - state->config->pll_set(fe, p); + state->config->pll_set(fe, state->i2c, p); ves1x93_writereg(state, 0x00, 0x01); ves1x93_set_inversion (state, p->inversion); ves1x93_set_fec (state, p->u.qpsk.fec_inner); diff -r 436e56df57d3 -r 0c3d9dad57bd linux/drivers/media/dvb/frontends/ves1x93.h --- a/linux/drivers/media/dvb/frontends/ves1x93.h Thu Apr 13 18:50:22 2006 -0300 +++ b/linux/drivers/media/dvb/frontends/ves1x93.h Fri Apr 14 16:34:35 2006 +0200 @@ -41,7 +41,7 @@ struct ves1x93_config /* PLL maintenance */ int (*pll_init)(struct dvb_frontend* fe); - int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params); + int (*pll_set)(struct dvb_frontend* fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters* params); }; extern struct dvb_frontend* ves1x93_attach(const struct ves1x93_config* config, diff -r 436e56df57d3 -r 0c3d9dad57bd linux/drivers/media/dvb/ttpci/av7110.c --- a/linux/drivers/media/dvb/ttpci/av7110.c Thu Apr 13 18:50:22 2006 -0300 +++ b/linux/drivers/media/dvb/ttpci/av7110.c Fri Apr 14 16:34:35 2006 +0200 @@ -69,6 +69,7 @@ #include "bsbe1.h" #include "lnbp21.h" #include "bsru6.h" +#include "bsrv2.h" #define TS_WIDTH 376 #define TS_HEIGHT 512 @@ -1550,42 +1551,6 @@ static int get_firmware(struct av7110* a return ret; } #endif - - -static int alps_bsrv2_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) -{ - struct av7110* av7110 = (struct av7110*) fe->dvb->priv; - u8 pwr = 0; - u8 buf[4]; - struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = buf, .len = sizeof(buf) }; - u32 div = (params->frequency + 479500) / 125; - - if (params->frequency > 2000000) pwr = 3; - else if (params->frequency > 1800000) pwr = 2; - else if (params->frequency > 1600000) pwr = 1; - else if (params->frequency > 1200000) pwr = 0; - else if (params->frequency >= 1100000) pwr = 1; - else pwr = 2; - - buf[0] = (div >> 8) & 0x7f; - buf[1] = div & 0xff; - buf[2] = ((div & 0x18000) >> 10) | 0x95; - buf[3] = (pwr << 6) | 0x30; - - // NOTE: since we're using a prescaler of 2, we set the - // divisor frequency to 62.5kHz and divide by 125 above - - if (i2c_transfer (&av7110->i2c_adap, &msg, 1) != 1) - return -EIO; - return 0; -} - -static struct ves1x93_config alps_bsrv2_config = { - .demod_address = 0x08, - .xin = 90100000UL, - .invert_pwm = 0, - .pll_set = alps_bsrv2_pll_set, -}; static int alps_tdbe2_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) { diff -r 436e56df57d3 -r 0c3d9dad57bd linux/drivers/media/dvb/ttpci/budget-patch.c --- a/linux/drivers/media/dvb/ttpci/budget-patch.c Thu Apr 13 18:50:22 2006 -0300 +++ b/linux/drivers/media/dvb/ttpci/budget-patch.c Fri Apr 14 16:34:35 2006 +0200 @@ -38,6 +38,7 @@ #include "tda8083.h" #include "bsru6.h" +#include "bsrv2.h" #define budget_patch budget @@ -257,40 +258,6 @@ static int budget_patch_diseqc_send_burs return 0; } - -static int alps_bsrv2_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) -{ - struct budget_patch* budget = (struct budget_patch*) fe->dvb->priv; - u8 pwr = 0; - u8 buf[4]; - struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = buf, .len = sizeof(buf) }; - u32 div = (params->frequency + 479500) / 125; - - if (params->frequency > 2000000) pwr = 3; - else if (params->frequency > 1800000) pwr = 2; - else if (params->frequency > 1600000) pwr = 1; - else if (params->frequency > 1200000) pwr = 0; - else if (params->frequency >= 1100000) pwr = 1; - else pwr = 2; - - buf[0] = (div >> 8) & 0x7f; - buf[1] = div & 0xff; - buf[2] = ((div & 0x18000) >> 10) | 0x95; - buf[3] = (pwr << 6) | 0x30; - - // NOTE: since we're using a prescaler of 2, we set the - // divisor frequency to 62.5kHz and divide by 125 above - - if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO; - return 0; -} - -static struct ves1x93_config alps_bsrv2_config = { - .demod_address = 0x08, - .xin = 90100000UL, - .invert_pwm = 0, - .pll_set = alps_bsrv2_pll_set, -}; static int grundig_29504_451_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) { diff -r 436e56df57d3 -r 0c3d9dad57bd linux/drivers/media/dvb/ttpci/budget.c --- a/linux/drivers/media/dvb/ttpci/budget.c Thu Apr 13 18:50:22 2006 -0300 +++ b/linux/drivers/media/dvb/ttpci/budget.c Fri Apr 14 16:34:35 2006 +0200 @@ -43,6 +43,7 @@ #include "s5h1420.h" #include "lnbp21.h" #include "bsru6.h" +#include "bsrv2.h" static void Set22K (struct budget *budget, int state) { @@ -185,41 +186,6 @@ static int budget_diseqc_send_burst(stru return 0; } - -static int alps_bsrv2_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) -{ - struct budget* budget = (struct budget*) fe->dvb->priv; - u8 pwr = 0; - u8 buf[4]; - struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = buf, .len = sizeof(buf) }; - u32 div = (params->frequency + 479500) / 125; - - if (params->frequency > 2000000) pwr = 3; - else if (params->frequency > 1800000) pwr = 2; - else if (params->frequency > 1600000) pwr = 1; - else if (params->frequency > 1200000) pwr = 0; - else if (params->frequency >= 1100000) pwr = 1; - else pwr = 2; - - buf[0] = (div >> 8) & 0x7f; - buf[1] = div & 0xff; - buf[2] = ((div & 0x18000) >> 10) | 0x95; - buf[3] = (pwr << 6) | 0x30; - - // NOTE: since we're using a prescaler of 2, we set the - // divisor frequency to 62.5kHz and divide by 125 above - - if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO; - return 0; -} - -static struct ves1x93_config alps_bsrv2_config = -{ - .demod_address = 0x08, - .xin = 90100000UL, - .invert_pwm = 0, - .pll_set = alps_bsrv2_pll_set, -}; static int alps_tdbe2_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) { diff -r 436e56df57d3 -r 0c3d9dad57bd linux/drivers/media/dvb/frontends/bsrv2.h --- /dev/null Thu Jan 1 00:00:00 1970 +0000 +++ b/linux/drivers/media/dvb/frontends/bsrv2.h Fri Apr 14 16:34:35 2006 +0200 @@ -0,0 +1,63 @@ +/* + * bsrv2.h - ALPS BSRV2 tuner support (moved from budget.c) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Or, point your browser to http://www.gnu.org/copyleft/gpl.html + * + * + * the project's page is at http://www.linuxtv.org + */ + +#ifndef BSRV2_H +#define BSRV2_H + +static int alps_bsrv2_pll_set(struct dvb_frontend* fe, struct i2c_adapter* i2c, struct dvb_frontend_parameters* params) +{ + u8 pwr = 0; + u8 buf[4]; + struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = buf, .len = sizeof(buf) }; + u32 div = (params->frequency + 479500) / 125; + + if (params->frequency > 2000000) pwr = 3; + else if (params->frequency > 1800000) pwr = 2; + else if (params->frequency > 1600000) pwr = 1; + else if (params->frequency > 1200000) pwr = 0; + else if (params->frequency >= 1100000) pwr = 1; + else pwr = 2; + + buf[0] = (div >> 8) & 0x7f; + buf[1] = div & 0xff; + buf[2] = ((div & 0x18000) >> 10) | 0x95; + buf[3] = (pwr << 6) | 0x30; + + // NOTE: since we're using a prescaler of 2, we set the + // divisor frequency to 62.5kHz and divide by 125 above + + if (i2c_transfer (i2c, &msg, 1) != 1) return -EIO; + return 0; +} + +static struct ves1x93_config alps_bsrv2_config = +{ + .demod_address = 0x08, + .xin = 90100000UL, + .invert_pwm = 0, + .pll_set = alps_bsrv2_pll_set, +}; + + +#endif
_______________________________________________ linux-dvb@xxxxxxxxxxx http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb