diff driver/pt1_pci.c @ 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 cfb2da5ee428
line wrap: on
line diff
--- a/driver/pt1_pci.c	Mon Dec 07 15:01:57 2009 +0900
+++ b/driver/pt1_pci.c	Sat Dec 12 22:29:30 2009 +0900
@@ -487,6 +487,8 @@
 	int		signal ;
 	unsigned long	dummy;
 	void		*arg = (void *)arg0;
+	int		lnb_eff, lnb_usr;
+	char *voltage[] = {"0V", "11V", "15V"};
 
 	switch(cmd){
 		case SET_CHANNEL:
@@ -519,14 +521,13 @@
 			dummy = copy_to_user(arg, &signal, sizeof(int));
 			return 0 ;
 		case LNB_ENABLE:
-			if(lnb){
-				settuner_reset(channel->ptr->regs, channel->ptr->cardtype, lnb, TUNER_POWER_ON_RESET_DISABLE);
-			}
+			lnb_usr = (int)arg0;
+			lnb_eff = lnb_usr ? lnb_usr : lnb;
+			settuner_reset(channel->ptr->regs, channel->ptr->cardtype, lnb_eff, TUNER_POWER_ON_RESET_DISABLE);
+			printk(KERN_INFO "PT1:LNB = %s\n", voltage[lnb_eff]);
 			return 0 ;
 		case LNB_DISABLE:
-			if(lnb){
-				settuner_reset(channel->ptr->regs, channel->ptr->cardtype, LNB_OFF, TUNER_POWER_ON_RESET_DISABLE);
-			}
+			settuner_reset(channel->ptr->regs, channel->ptr->cardtype, LNB_OFF, TUNER_POWER_ON_RESET_DISABLE);
 			return 0 ;
 	}
 	return -EINVAL;