pt1

changeset 80:f336fd2dcf28

make LNB voltage can be specified from user application
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Sat, 12 Dec 2009 22:29:30 +0900
parents 3c2123189edf
children 6e3bb2c0c5b6
files driver/pt1_ioctl.h driver/pt1_pci.c
diffstat 2 files changed, 8 insertions(+), 7 deletions(-) [+]
line diff
     1.1 --- a/driver/pt1_ioctl.h	Mon Dec 07 15:01:57 2009 +0900
     1.2 +++ b/driver/pt1_ioctl.h	Sat Dec 12 22:29:30 2009 +0900
     1.3 @@ -15,6 +15,6 @@
     1.4  #define		START_REC	_IO(0x8D, 0x02)
     1.5  #define		STOP_REC	_IO(0x8D, 0x03)
     1.6  #define		GET_SIGNAL_STRENGTH	_IOR(0x8D, 0x04, int *)
     1.7 -#define		LNB_ENABLE	_IO(0x8D, 0x05)
     1.8 +#define		LNB_ENABLE	_IOW(0x8D, 0x05, int)
     1.9  #define		LNB_DISABLE	_IO(0x8D, 0x06)
    1.10  #endif
     2.1 --- a/driver/pt1_pci.c	Mon Dec 07 15:01:57 2009 +0900
     2.2 +++ b/driver/pt1_pci.c	Sat Dec 12 22:29:30 2009 +0900
     2.3 @@ -487,6 +487,8 @@
     2.4  	int		signal ;
     2.5  	unsigned long	dummy;
     2.6  	void		*arg = (void *)arg0;
     2.7 +	int		lnb_eff, lnb_usr;
     2.8 +	char *voltage[] = {"0V", "11V", "15V"};
     2.9  
    2.10  	switch(cmd){
    2.11  		case SET_CHANNEL:
    2.12 @@ -519,14 +521,13 @@
    2.13  			dummy = copy_to_user(arg, &signal, sizeof(int));
    2.14  			return 0 ;
    2.15  		case LNB_ENABLE:
    2.16 -			if(lnb){
    2.17 -				settuner_reset(channel->ptr->regs, channel->ptr->cardtype, lnb, TUNER_POWER_ON_RESET_DISABLE);
    2.18 -			}
    2.19 +			lnb_usr = (int)arg0;
    2.20 +			lnb_eff = lnb_usr ? lnb_usr : lnb;
    2.21 +			settuner_reset(channel->ptr->regs, channel->ptr->cardtype, lnb_eff, TUNER_POWER_ON_RESET_DISABLE);
    2.22 +			printk(KERN_INFO "PT1:LNB = %s\n", voltage[lnb_eff]);
    2.23  			return 0 ;
    2.24  		case LNB_DISABLE:
    2.25 -			if(lnb){
    2.26 -				settuner_reset(channel->ptr->regs, channel->ptr->cardtype, LNB_OFF, TUNER_POWER_ON_RESET_DISABLE);
    2.27 -			}
    2.28 +			settuner_reset(channel->ptr->regs, channel->ptr->cardtype, LNB_OFF, TUNER_POWER_ON_RESET_DISABLE);
    2.29  			return 0 ;
    2.30  	}
    2.31  	return -EINVAL;