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 wrap: on
line diff
--- a/driver/pt1_ioctl.h	Mon Dec 07 15:01:57 2009 +0900
+++ b/driver/pt1_ioctl.h	Sat Dec 12 22:29:30 2009 +0900
@@ -15,6 +15,6 @@
 #define		START_REC	_IO(0x8D, 0x02)
 #define		STOP_REC	_IO(0x8D, 0x03)
 #define		GET_SIGNAL_STRENGTH	_IOR(0x8D, 0x04, int *)
-#define		LNB_ENABLE	_IO(0x8D, 0x05)
+#define		LNB_ENABLE	_IOW(0x8D, 0x05, int)
 #define		LNB_DISABLE	_IO(0x8D, 0x06)
 #endif
--- 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;