All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Oberritter <obi@linuxtv.org>
To: Manu Abraham <abraham.manu@gmail.com>
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>,
	Mauro Carvalho Chehab <mchehab@redhat.com>
Subject: Re: PATCH: Query DVB frontend capabilities
Date: Thu, 10 Nov 2011 15:44:06 +0100	[thread overview]
Message-ID: <4EBBE336.8050501@linuxtv.org> (raw)
In-Reply-To: <CAHFNz9Lf8CXb2pqmO0669VV2HAqxCpM9mmL9kU=jM19oNp0dbg@mail.gmail.com>

Hello Manu,

please see my comments below:

On 10.11.2011 15:18, Manu Abraham wrote:
> Hi,
> 
> Currently, for a multi standard frontend it is assumed that it just
> has a single standard capability. This is fine in some cases, but
> makes things hard when there are incompatible standards in conjuction.
> Eg: DVB-S can be seen as a subset of DVB-S2, but the same doesn't hold
> the same for DSS. This is not specific to any driver as it is, but a
> generic issue. This was handled correctly in the multiproto tree,
> while such functionality is missing from the v5 API update.
> 
> http://www.linuxtv.org/pipermail/vdr/2008-November/018417.html
> 
> Later on a FE_CAN_2G_MODULATION was added as a hack to workaround this
> issue in the v5 API, but that hack is incapable of addressing the
> issue, as it can be used to simply distinguish between DVB-S and
> DVB-S2 alone, or another x vs X2 modulation. If there are more
> systems, then you have a potential issue.
> 
> In addition to the patch, for illustrative purposes the stb0899 driver
> is depicted providing the said capability information.
> 
> An application needs to query the device capabilities before
> requesting an operation from the device.
> 
> If people don't have any objections, Probably other drivers can be
> adapted similarly. In fact the change is quite simple.
> 
> Comments ?
> 
> Regards,
> Manu
> 
> 
> query_frontend_capabilities.diff
> 
> 
> diff -r b6eb04718aa9 linux/drivers/media/dvb/dvb-core/dvb_frontend.c
> --- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c	Wed Nov 09 19:52:36 2011 +0530
> +++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c	Thu Nov 10 13:51:35 2011 +0530
> @@ -973,6 +973,8 @@
>  	_DTV_CMD(DTV_GUARD_INTERVAL, 0, 0),
>  	_DTV_CMD(DTV_TRANSMISSION_MODE, 0, 0),
>  	_DTV_CMD(DTV_HIERARCHY, 0, 0),
> +
> +	_DTV_CMD(DTV_DELIVERY_CAPS, 0, 0),
>  };
>  
>  static void dtv_property_dump(struct dtv_property *tvp)
> @@ -1226,7 +1228,18 @@
>  		c = &cdetected;
>  	}
>  
> +	dprintk("%s\n", __func__);
> +
>  	switch(tvp->cmd) {
> +	case DTV_DELIVERY_CAPS:
> +		if (fe->ops.delivery_caps) {
> +			r = fe->ops.delivery_caps(fe, tvp);
> +			if (r < 0)
> +				return r;
> +			else
> +				goto done;

What's the reason for introducing that label and goto?

> +		}
> +		break;
>  	case DTV_FREQUENCY:
>  		tvp->u.data = c->frequency;
>  		break;
> @@ -1350,7 +1363,7 @@
>  		if (r < 0)
>  			return r;
>  	}
> -
> +done:
>  	dtv_property_dump(tvp);
>  
>  	return 0;
> diff -r b6eb04718aa9 linux/drivers/media/dvb/dvb-core/dvb_frontend.h
> --- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.h	Wed Nov 09 19:52:36 2011 +0530
> +++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.h	Thu Nov 10 13:51:35 2011 +0530
> @@ -305,6 +305,8 @@
>  
>  	int (*set_property)(struct dvb_frontend* fe, struct dtv_property* tvp);
>  	int (*get_property)(struct dvb_frontend* fe, struct dtv_property* tvp);
> +
> +	int (*delivery_caps)(struct dvb_frontend *fe, struct dtv_property *tvp);
>  };

I don't think that another function pointer is required. Drivers can
implement this in their get_property callback. The core could provide a
default implementation, returning values derived from fe->ops.info.type
and the 2G flag.

>  #define MAX_EVENT 8
> @@ -362,6 +364,8 @@
>  
>  	/* DVB-T2 specifics */
>  	u32                     dvbt2_plp_id;
> +
> +	fe_delivery_system_t	delivery_caps[32];
>  };

This array seems to be unused.

Regards,
Andreas

>  struct dvb_frontend {
> diff -r b6eb04718aa9 linux/drivers/media/dvb/frontends/stb0899_drv.c
> --- a/linux/drivers/media/dvb/frontends/stb0899_drv.c	Wed Nov 09 19:52:36 2011 +0530
> +++ b/linux/drivers/media/dvb/frontends/stb0899_drv.c	Thu Nov 10 13:51:35 2011 +0530
> @@ -1605,6 +1605,19 @@
>  	return DVBFE_ALGO_CUSTOM;
>  }
>  
> +static int stb0899_delivery_caps(struct dvb_frontend *fe, struct dtv_property *caps)
> +{
> +	struct stb0899_state *state		= fe->demodulator_priv;
> +
> +	dprintk(state->verbose, FE_DEBUG, 1, "Get caps");
> +	caps->u.buffer.data[0] = SYS_DSS;
> +	caps->u.buffer.data[1] = SYS_DVBS;
> +	caps->u.buffer.data[2] = SYS_DVBS2;
> +	caps->u.buffer.len = 3;
> +
> +	return 0;
> +}
> +
>  static struct dvb_frontend_ops stb0899_ops = {
>  
>  	.info = {
> @@ -1647,6 +1660,8 @@
>  	.diseqc_send_master_cmd		= stb0899_send_diseqc_msg,
>  	.diseqc_recv_slave_reply	= stb0899_recv_slave_reply,
>  	.diseqc_send_burst		= stb0899_send_diseqc_burst,
> +
> +	.delivery_caps			= stb0899_delivery_caps,
>  };
>  
>  struct dvb_frontend *stb0899_attach(struct stb0899_config *config, struct i2c_adapter *i2c)
> diff -r b6eb04718aa9 linux/include/linux/dvb/frontend.h
> --- a/linux/include/linux/dvb/frontend.h	Wed Nov 09 19:52:36 2011 +0530
> +++ b/linux/include/linux/dvb/frontend.h	Thu Nov 10 13:51:35 2011 +0530
> @@ -316,7 +316,9 @@
>  
>  #define DTV_DVBT2_PLP_ID	43
>  
> -#define DTV_MAX_COMMAND				DTV_DVBT2_PLP_ID
> +#define DTV_DELIVERY_CAPS	44
> +
> +#define DTV_MAX_COMMAND				DTV_DELIVERY_CAPS
>  
>  typedef enum fe_pilot {
>  	PILOT_ON,
> 


  reply	other threads:[~2011-11-10 14:44 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-10 14:18 PATCH: Query DVB frontend capabilities Manu Abraham
2011-11-10 14:44 ` Andreas Oberritter [this message]
2011-11-10 15:30   ` Manu Abraham
2011-11-10 21:20     ` Mauro Carvalho Chehab
2011-11-11  6:26       ` Manu Abraham
2011-11-11 10:12         ` Mauro Carvalho Chehab
2011-11-11 22:07           ` Manu Abraham
2011-11-11 22:38             ` Mauro Carvalho Chehab
2011-11-12  3:36               ` Andreas Oberritter
2011-11-13 11:39                 ` Mauro Carvalho Chehab
2011-11-11 14:30         ` Andreas Oberritter
2011-11-11 14:43           ` Mauro Carvalho Chehab
2011-11-11 15:06             ` Andreas Oberritter
2011-11-11 17:14               ` Mauro Carvalho Chehab
2011-11-11 20:09                 ` Andreas Oberritter
2011-11-11 22:02                   ` Mauro Carvalho Chehab
2011-11-12  4:02                     ` Andreas Oberritter
2011-11-11 22:12           ` Manu Abraham
2011-11-11  9:55       ` FE_CAN-bits (was: Re: PATCH: Query DVB frontend capabilities) Patrick Boettcher
2011-11-11 10:21         ` FE_CAN-bits Mauro Carvalho Chehab
2011-11-11 11:36         ` FE_CAN-bits Antti Palosaari
2011-11-11 12:44           ` FE_CAN-bits Mauro Carvalho Chehab
2011-11-11 17:43       ` PATCH: Query DVB frontend capabilities BOUWSMA Barry
2011-11-11 18:37         ` Mauro Carvalho Chehab
2011-11-11 22:34           ` Manu Abraham
2011-11-13 13:32             ` Mauro Carvalho Chehab
2011-11-13 15:27               ` Manu Abraham
2011-11-14 11:47                 ` Mauro Carvalho Chehab
2011-11-14 15:02                   ` Manu Abraham
2011-11-14 16:39                     ` Mauro Carvalho Chehab
2011-11-14 17:09                       ` Manu Abraham
2011-11-14 18:08                         ` Mauro Carvalho Chehab
2011-11-14 18:30                           ` Manu Abraham
2011-11-14 18:42                             ` Mauro Carvalho Chehab
2011-11-14 18:59                               ` Manu Abraham
2011-11-14 20:31                                 ` 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=4EBBE336.8050501@linuxtv.org \
    --to=obi@linuxtv.org \
    --cc=abraham.manu@gmail.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.