[linux-dvb] [RFC] TUV1236d / dvb-pll: rf input switching via module option

Michael Krufky mkrufky at linuxtv.org
Mon Sep 10 21:04:32 CEST 2007


David Engel wrote:
> On Mon, Sep 10, 2007 at 12:12:01PM -0500, David Engel wrote:
>   
>>> Unfortunately, this does not allow for REVERSING the input selection -- this will only force it to use one or the other in digital mode.  If anybody has some ideas as to how to reverse the default selection in a clean way, I am open to suggestions.
>>>       
>> The attached patch, is completely untested (I didn't even try
>> compiling it), but it should be close.
>>     
>
> Take two, with the patch.
>
>   
David,

This is the same thing I did in my tree, but just didn't push it to the
repository.

This would work, but it doesn't cover all possible cases.  For instance,
what if there was a tuner with three rf inputs?  I don't think that such
a device exists on any supported hardware, but you never know.

This solution is fine with me, for the meanwhile... if you could test
it, would be nice :-)

-Mike

> diff -r b7fa7c4598ac linux/drivers/media/dvb/frontends/dvb-pll.c
> --- a/linux/drivers/media/dvb/frontends/dvb-pll.c	Sun Sep 09 12:00:45 2007 -0400
> +++ b/linux/drivers/media/dvb/frontends/dvb-pll.c	Mon Sep 10 11:58:50 2007 -0500
> @@ -49,9 +49,9 @@ module_param(debug, int, 0644);
>  module_param(debug, int, 0644);
>  MODULE_PARM_DESC(debug, "enable verbose debug messages");
>  
> -static unsigned int input[DVB_PLL_MAX] = { [ 0 ... (DVB_PLL_MAX-1) ] = 0 };
> +static int input[DVB_PLL_MAX] = { [ 0 ... (DVB_PLL_MAX-1) ] = 0 };
>  module_param_array(input, int, NULL, 0644);
> -MODULE_PARM_DESC(input,"specify rf input choice, 0 for autoselect (default)");
> +MODULE_PARM_DESC(input,"specify rf input choice, 0 for autoselect (default), -1 for autoselect reversed");
>  
>  static unsigned int id[DVB_PLL_MAX] =
>  	{ [ 0 ... (DVB_PLL_MAX-1) ] = DVB_PLL_UNDEFINED };
> @@ -399,9 +399,10 @@ static void tuv1236d_rf(struct dvb_front
>  			const struct dvb_frontend_parameters *params)
>  {
>  	struct dvb_pll_priv *priv = fe->tuner_priv;
> -	unsigned int new_rf = input[priv->nr];
> -
> -	if ((new_rf == 0) || (new_rf > 2)) {
> +	int new_rf = input[priv->nr];
> +
> +	if ((new_rf <= 0) || (new_rf > 2)) {
> +		int reverse = (new_rf == -1);
>  		switch (params->u.vsb.modulation) {
>  			case QAM_64:
>  			case QAM_256:
> @@ -411,6 +412,8 @@ static void tuv1236d_rf(struct dvb_front
>  			default:
>  				new_rf = 2;
>  		}
> +		if (reverse)
> +			new_rf = 3 - new_rf;
>  	}
>  
>  	switch (new_rf) {
> @@ -856,6 +859,9 @@ struct dvb_frontend *dvb_pll_attach(stru
>  			printk(" %d-%04x", i2c_adapter_id(i2c), pll_addr);
>  		printk(": tuner rf input will be ");
>  		switch (input[priv->nr]) {
> +		case -1:
> +			printk("autoselected reversed\n");
> +			break;
>  		case 0:
>  			printk("autoselected\n");
>  			break;
>   




More information about the linux-dvb mailing list