[linux-dvb] Any chance of help with v4l-dvb-experimental / Avermedia A16D please?
timf
timf at iinet.net.au
Thu Mar 20 17:28:23 CET 2008
Hi Mauro,
On Thu, 2008-03-20 at 11:55 -0300, Mauro Carvalho Chehab wrote:
> On Wed, 19 Mar 2008 14:23:16 +0900
> timf <timf at iinet.net.au> wrote:
>
> > Hi all,
> >
> > On Tue, 2008-03-18 at 22:31 +0100, hermann pitton wrote:
> > > Hi,
> > >
> > > Am Dienstag, den 18.03.2008, 18:04 -0300 schrieb Mauro Carvalho Chehab:
> > > > On Wed, 19 Mar 2008 05:48:52 +0900
> > > > timf <timf at iinet.net.au> wrote:
> > > >
> >
<snip>
<snip>
>
> > I guess that's back to you experts!
> >
> > Best Regards,
> > Tim
>
> Ok. People, could you please try the enclosed patch? There were some errors at
> the callback codes for cx88 and saa7134. I've already tested this with two different
> cx88-based xc2028 board (one analog only, and a hybrid board).
>
> Unfortunately, I don't have any saa7134 device that requires a callback.
>
> Hopefully, this patch will fix analog mode, on A16D and the LNA issue for
> tda827x, pointed by Hartmut.
>
> Could you please test and give us a feedback?
>
> Cheers,
> Mauro.
>
> --
>
> Fixes callback codes for tuners
>
> This patch fixes several issues with callback tuners:
> - Remove the need of specifiying a video device for tuner-xc3028;
> - tda827x now uses the proper parameter for tuner callback (the private
> data address for i2c, at i2c_adap->algo_data);
> - xc3028 reusage is check via i2c parent device (i2c_adap->dev)
> - checks if callback first argument is NULL
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab at infradead.org>
>
> diff -r f24051885fe9 linux/drivers/media/dvb/dvb-usb/cxusb.c
> --- a/linux/drivers/media/dvb/dvb-usb/cxusb.c Tue Mar 18 18:10:06 2008 -0300
> +++ b/linux/drivers/media/dvb/dvb-usb/cxusb.c Thu Mar 20 11:07:02 2008 -0300
> @@ -509,7 +509,6 @@ static int cxusb_dvico_xc3028_tuner_atta
> struct xc2028_config cfg = {
> .i2c_adap = &adap->dev->i2c_adap,
> .i2c_addr = 0x61,
> - .video_dev = adap->dev,
> .callback = dvico_bluebird_xc2028_callback,
> };
> static struct xc2028_ctrl ctl = {
> diff -r f24051885fe9 linux/drivers/media/dvb/frontends/tda827x.c
> --- a/linux/drivers/media/dvb/frontends/tda827x.c Tue Mar 18 18:10:06 2008 -0300
> +++ b/linux/drivers/media/dvb/frontends/tda827x.c Thu Mar 20 11:07:02 2008 -0300
> @@ -579,7 +579,8 @@ static void tda827xa_lna_gain(struct dvb
> else
> arg = 0;
> if (priv->cfg->tuner_callback)
> - priv->cfg->tuner_callback(priv, 1, arg);
> + priv->cfg->tuner_callback(priv->i2c_adap->algo_data,
> + 1, arg);
> buf[1] = high ? 0 : 1;
> if (*priv->cfg->config == 2)
> buf[1] = high ? 1 : 0;
> @@ -587,7 +588,8 @@ static void tda827xa_lna_gain(struct dvb
> break;
> case 3: /* switch with GPIO of saa713x */
> if (priv->cfg->tuner_callback)
> - priv->cfg->tuner_callback(priv, 0, high);
> + priv->cfg->tuner_callback(priv->i2c_adap->algo_data,
> + 0, high);
> break;
> }
> }
> diff -r f24051885fe9 linux/drivers/media/video/cx23885/cx23885-dvb.c
> --- a/linux/drivers/media/video/cx23885/cx23885-dvb.c Tue Mar 18 18:10:06 2008 -0300
> +++ b/linux/drivers/media/video/cx23885/cx23885-dvb.c Thu Mar 20 11:07:02 2008 -0300
> @@ -298,7 +298,6 @@ static int dvb_register(struct cx23885_t
> struct xc2028_config cfg = {
> .i2c_adap = &i2c_bus->i2c_adap,
> .i2c_addr = 0x61,
> - .video_dev = port,
> .callback = cx23885_hvr1500_xc3028_callback,
> };
> static struct xc2028_ctrl ctl = {
> diff -r f24051885fe9 linux/drivers/media/video/cx88/cx88-cards.c
> --- a/linux/drivers/media/video/cx88/cx88-cards.c Tue Mar 18 18:10:06 2008 -0300
> +++ b/linux/drivers/media/video/cx88/cx88-cards.c Thu Mar 20 11:07:02 2008 -0300
> @@ -2140,11 +2140,9 @@ static void gdi_eeprom(struct cx88_core
>
> /* ------------------------------------------------------------------- */
> /* some Divco specific stuff */
> -static int cx88_dvico_xc2028_callback(void *priv, int command, int arg)
> +static int cx88_dvico_xc2028_callback(struct cx88_core *core,
> + int command, int arg)
> {
> - struct i2c_algo_bit_data *i2c_algo = priv;
> - struct cx88_core *core = i2c_algo->data;
> -
> switch (command) {
> case XC2028_TUNER_RESET:
> cx_write(MO_GP0_IO, 0x101000);
> @@ -2162,11 +2160,9 @@ static int cx88_dvico_xc2028_callback(vo
> /* ----------------------------------------------------------------------- */
> /* some Geniatech specific stuff */
>
> -static int cx88_xc3028_geniatech_tuner_callback(void *priv, int command, int mode)
> +static int cx88_xc3028_geniatech_tuner_callback(struct cx88_core *core,
> + int command, int mode)
> {
> - struct i2c_algo_bit_data *i2c_algo = priv;
> - struct cx88_core *core = i2c_algo->data;
> -
> switch (command) {
> case XC2028_TUNER_RESET:
> switch (INPUT(core->input).type) {
> @@ -2193,11 +2189,9 @@ static int cx88_xc3028_geniatech_tuner_c
>
> /* ------------------------------------------------------------------- */
> /* some Divco specific stuff */
> -static int cx88_pv_8000gt_callback(void *priv, int command, int arg)
> +static int cx88_pv_8000gt_callback(struct cx88_core *core,
> + int command, int arg)
> {
> - struct i2c_algo_bit_data *i2c_algo = priv;
> - struct cx88_core *core = i2c_algo->data;
> -
> switch (command) {
> case XC2028_TUNER_RESET:
> cx_write(MO_GP2_IO, 0xcf7);
> @@ -2248,21 +2242,18 @@ static void dvico_fusionhdtv_hybrid_init
> }
> }
>
> -static int cx88_xc2028_tuner_callback(void *priv, int command, int arg)
> +static int cx88_xc2028_tuner_callback(struct cx88_core *core, int command, int arg)
> {
> - struct i2c_algo_bit_data *i2c_algo = priv;
> - struct cx88_core *core = i2c_algo->data;
> -
> /* Board-specific callbacks */
> switch (core->boardnr) {
> case CX88_BOARD_WINFAST_TV2000_XP_GLOBAL:
> case CX88_BOARD_POWERCOLOR_REAL_ANGEL:
> case CX88_BOARD_GENIATECH_X8000_MT:
> - return cx88_xc3028_geniatech_tuner_callback(priv, command, arg);
> + return cx88_xc3028_geniatech_tuner_callback(core, command, arg);
> case CX88_BOARD_PROLINK_PV_8000GT:
> - return cx88_pv_8000gt_callback(priv, command, arg);
> + return cx88_pv_8000gt_callback(core, command, arg);
> case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PRO:
> - return cx88_dvico_xc2028_callback(priv, command, arg);
> + return cx88_dvico_xc2028_callback(core, command, arg);
> }
>
> switch (command) {
> @@ -2296,11 +2287,9 @@ static int cx88_xc2028_tuner_callback(vo
> * PCTV HD 800i with an xc5000 sillicon tuner. This is used for both *
> * analog tuner attach (tuner-core.c) and dvb tuner attach (cx88-dvb.c) */
>
> -static int cx88_xc5000_tuner_callback(void *priv, int command, int arg)
> +static int cx88_xc5000_tuner_callback(struct cx88_core *core,
> + int command, int arg)
> {
> - struct i2c_algo_bit_data *i2c_algo = priv;
> - struct cx88_core *core = i2c_algo->data;
> -
> switch (core->boardnr) {
> case CX88_BOARD_PINNACLE_PCTV_HD_800i:
> if (command == 0) { /* This is the reset command from xc5000 */
> @@ -2334,15 +2323,27 @@ int cx88_tuner_callback(void *priv, int
> int cx88_tuner_callback(void *priv, int command, int arg)
> {
> struct i2c_algo_bit_data *i2c_algo = priv;
> - struct cx88_core *core = i2c_algo->data;
> + struct cx88_core *core;
> +
> + if (!i2c_algo) {
> + printk(KERN_ERR "cx88: Error - i2c_algo not defined.\n");
> + return -EINVAL;
> + }
> +
> + core = i2c_algo->data;
> +
> + if (!core) {
> + printk(KERN_ERR "cx88: Error - device pointer is NULL!\n");
> + return -EINVAL;
> + }
>
> switch (core->board.tuner_type) {
> case TUNER_XC2028:
> info_printk(core, "Calling XC2028/3028 callback\n");
> - return cx88_xc2028_tuner_callback(priv, command, arg);
> + return cx88_xc2028_tuner_callback(core, command, arg);
> case TUNER_XC5000:
> info_printk(core, "Calling XC5000 callback\n");
> - return cx88_xc5000_tuner_callback(priv, command, arg);
> + return cx88_xc5000_tuner_callback(core, command, arg);
> }
> err_printk(core, "Error: Calling callback for tuner %d\n",
> core->board.tuner_type);
> diff -r f24051885fe9 linux/drivers/media/video/cx88/cx88-dvb.c
> --- a/linux/drivers/media/video/cx88/cx88-dvb.c Tue Mar 18 18:10:06 2008 -0300
> +++ b/linux/drivers/media/video/cx88/cx88-dvb.c Thu Mar 20 11:07:02 2008 -0300
> @@ -465,7 +465,6 @@ static int attach_xc3028(u8 addr, struct
> struct xc2028_config cfg = {
> .i2c_adap = &dev->core->i2c_adap,
> .i2c_addr = addr,
> - .video_dev = dev->core->i2c_adap.algo_data,
> };
>
> if (!dev->dvb.frontend) {
> @@ -787,7 +786,6 @@ static int dvb_register(struct cx8802_de
> struct xc2028_config cfg = {
> .i2c_adap = &dev->core->i2c_adap,
> .i2c_addr = 0x61,
> - .video_dev = dev->core,
> .callback = cx88_pci_nano_callback,
> };
> static struct xc2028_ctrl ctl = {
> diff -r f24051885fe9 linux/drivers/media/video/saa7134/saa7134-cards.c
> --- a/linux/drivers/media/video/saa7134/saa7134-cards.c Tue Mar 18 18:10:06 2008 -0300
> +++ b/linux/drivers/media/video/saa7134/saa7134-cards.c Thu Mar 20 11:07:02 2008 -0300
> @@ -5353,10 +5353,15 @@ static int saa7134_tda8290_callback(stru
> return 0;
> }
>
> +/* priv retuns algo_data - on saa7134, it is equal to dev */
> int saa7134_tuner_callback(void *priv, int command, int arg)
> {
> - struct i2c_algo_bit_data *i2c_algo = priv;
> - struct saa7134_dev *dev = i2c_algo->data;
> + struct saa7134_dev *dev = priv;
> +
> + if (!dev) {
> + printk(KERN_ERR "saa7134: Error: device pointer is NULL!\n");
> + return -EINVAL;
> + }
>
> switch (dev->tuner_type) {
> case TUNER_PHILIPS_TDA8290:
> diff -r f24051885fe9 linux/drivers/media/video/saa7134/saa7134-dvb.c
> --- a/linux/drivers/media/video/saa7134/saa7134-dvb.c Tue Mar 18 18:10:06 2008 -0300
> +++ b/linux/drivers/media/video/saa7134/saa7134-dvb.c Thu Mar 20 11:07:02 2008 -0300
> @@ -1173,7 +1173,6 @@ static int dvb_init(struct saa7134_dev *
> struct xc2028_config cfg = {
> .i2c_adap = &dev->i2c_adap,
> .i2c_addr = 0x61,
> - .video_dev = dev->i2c_adap.algo_data,
> };
> fe = dvb_attach(xc2028_attach, dev->dvb.frontend, &cfg);
> if (!fe) {
> diff -r f24051885fe9 linux/drivers/media/video/tuner-core.c
> --- a/linux/drivers/media/video/tuner-core.c Tue Mar 18 18:10:06 2008 -0300
> +++ b/linux/drivers/media/video/tuner-core.c Thu Mar 20 11:07:02 2008 -0300
> @@ -448,7 +448,6 @@ static void set_type(struct i2c_client *
> struct xc2028_config cfg = {
> .i2c_adap = t->i2c->adapter,
> .i2c_addr = t->i2c->addr,
> - .video_dev = c->adapter->algo_data,
> .callback = t->tuner_callback,
> };
> if (!xc2028_attach(&t->fe, &cfg)) {
> diff -r f24051885fe9 linux/drivers/media/video/tuner-xc2028.c
> --- a/linux/drivers/media/video/tuner-xc2028.c Tue Mar 18 18:10:06 2008 -0300
> +++ b/linux/drivers/media/video/tuner-xc2028.c Thu Mar 20 11:07:02 2008 -0300
> @@ -1174,7 +1174,7 @@ struct dvb_frontend *xc2028_attach(struc
> if (debug)
> printk(KERN_DEBUG "xc2028: Xcv2028/3028 init called!\n");
>
> - if (NULL == cfg || NULL == cfg->video_dev)
> + if (NULL == cfg)
> return NULL;
>
> if (!fe) {
> @@ -1182,13 +1182,19 @@ struct dvb_frontend *xc2028_attach(struc
> return NULL;
> }
>
> - video_dev = cfg->video_dev;
> + video_dev = cfg->i2c_adap->algo_data;
> +
> + if (debug)
> + printk(KERN_DEBUG "xc2028: video_dev =%p\n", video_dev);
>
> mutex_lock(&xc2028_list_mutex);
>
> list_for_each_entry(priv, &xc2028_list, xc2028_list) {
> - if (priv->video_dev == cfg->video_dev) {
> + if (&priv->i2c_props.adap->dev == &cfg->i2c_adap->dev) {
> video_dev = NULL;
> + if (debug)
> + printk(KERN_DEBUG "xc2028: reusing device\n");
> +
> break;
> }
> }
> @@ -1216,6 +1222,9 @@ struct dvb_frontend *xc2028_attach(struc
> fe->tuner_priv = priv;
> priv->count++;
>
> + if (debug)
> + printk(KERN_DEBUG "xc2028: usage count is %i\n", priv->count);
> +
> memcpy(&fe->ops.tuner_ops, &xc2028_dvb_tuner_ops,
> sizeof(xc2028_dvb_tuner_ops));
>
>
>
>
>
>
> Cheers,
> Mauro
Maybe I did something wrong:
timf at ubuntu:~/v4l-dvb$ patch -p1 < mauro_patch1
patching file linux/drivers/media/dvb/dvb-usb/cxusb.c
Hunk #1 FAILED at 509.
1 out of 1 hunk FAILED -- saving rejects to file
linux/drivers/media/dvb/dvb-usb/cxusb.c.rej
patching file linux/drivers/media/dvb/frontends/tda827x.c
Hunk #1 FAILED at 579.
Hunk #2 FAILED at 588.
2 out of 2 hunks FAILED -- saving rejects to file
linux/drivers/media/dvb/frontends/tda827x.c.rej
patching file linux/drivers/media/video/cx23885/cx23885-dvb.c
Hunk #1 FAILED at 298.
1 out of 1 hunk FAILED -- saving rejects to file
linux/drivers/media/video/cx23885/cx23885-dvb.c.rej
patching file linux/drivers/media/video/cx88/cx88-cards.c
Hunk #1 FAILED at 2140.
Hunk #2 FAILED at 2160.
Hunk #3 FAILED at 2189.
Hunk #4 FAILED at 2242.
Hunk #5 FAILED at 2287.
Hunk #6 FAILED at 2323.
6 out of 6 hunks FAILED -- saving rejects to file
linux/drivers/media/video/cx88/cx88-cards.c.rej
patching file linux/drivers/media/video/cx88/cx88-dvb.c
Hunk #1 FAILED at 465.
Hunk #2 FAILED at 786.
2 out of 2 hunks FAILED -- saving rejects to file
linux/drivers/media/video/cx88/cx88-dvb.c.rej
patching file linux/drivers/media/video/saa7134/saa7134-cards.c
Hunk #1 FAILED at 5353.
1 out of 1 hunk FAILED -- saving rejects to file
linux/drivers/media/video/saa7134/saa7134-cards.c.rej
patching file linux/drivers/media/video/saa7134/saa7134-dvb.c
Hunk #1 FAILED at 1173.
1 out of 1 hunk FAILED -- saving rejects to file
linux/drivers/media/video/saa7134/saa7134-dvb.c.rej
patching file linux/drivers/media/video/tuner-core.c
Hunk #1 FAILED at 448.
1 out of 1 hunk FAILED -- saving rejects to file
linux/drivers/media/video/tuner-core.c.rej
patching file linux/drivers/media/video/tuner-xc2028.c
Hunk #1 FAILED at 1174.
Hunk #2 FAILED at 1182.
Hunk #3 FAILED at 1222.
3 out of 3 hunks FAILED -- saving rejects to file
linux/drivers/media/video/tuner-xc2028.c.rej
timf at ubuntu:~/v4l-dvb$
What should I have done?
Regards,
Tim
More information about the linux-dvb
mailing list