Linux kernel & device driver programming

Cross-Referenced Linux and Device Driver Code

[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ]
Version: [ 2.6.11.8 ] [ 2.6.25 ] [ 2.6.25.8 ] [ 2.6.31.13 ] Architecture: [ i386 ]

Diff markup

Differences between /linux/drivers/input/touchscreen/jornada720_ts.c (Version 2.6.25) and /linux/drivers/input/touchscreen/jornada720_ts.c (Version 2.6.11.8)


  1 /*                                                  1 
  2  * drivers/input/touchscreen/jornada720_ts.c      
  3  *                                                
  4  * Copyright (C) 2007 Kristoffer Ericson <Kris    
  5  *                                                
  6  *  Copyright (C) 2006 Filip Zyzniewski <filip    
  7  *  based on HP Jornada 56x touchscreen driver    
  8  *                                                
  9  * This program is free software; you can redi    
 10  * it under the terms of the GNU General Publi    
 11  * published by the Free Software Foundation.     
 12  *                                                
 13  * HP Jornada 710/720/729 Touchscreen Driver      
 14  */                                               
 15                                                   
 16 #include <linux/platform_device.h>                
 17 #include <linux/init.h>                           
 18 #include <linux/input.h>                          
 19 #include <linux/interrupt.h>                      
 20 #include <linux/module.h>                         
 21                                                   
 22 #include <asm/hardware.h>                         
 23 #include <asm/arch/jornada720.h>                  
 24                                                   
 25 MODULE_AUTHOR("Kristoffer Ericson <kristoffer.    
 26 MODULE_DESCRIPTION("HP Jornada 710/720/728 tou    
 27 MODULE_LICENSE("GPLv2");                          
 28                                                   
 29 struct jornada_ts {                               
 30         struct input_dev *dev;                    
 31         int x_data[4];          /* X sample va    
 32         int y_data[4];          /* Y sample va    
 33 };                                                
 34                                                   
 35 static void jornada720_ts_collect_data(struct     
 36 {                                                 
 37                                                   
 38     /* 3 low word X samples */                    
 39     jornada_ts->x_data[0] = jornada_ssp_byte(T    
 40     jornada_ts->x_data[1] = jornada_ssp_byte(T    
 41     jornada_ts->x_data[2] = jornada_ssp_byte(T    
 42                                                   
 43     /* 3 low word Y samples */                    
 44     jornada_ts->y_data[0] = jornada_ssp_byte(T    
 45     jornada_ts->y_data[1] = jornada_ssp_byte(T    
 46     jornada_ts->y_data[2] = jornada_ssp_byte(T    
 47                                                   
 48     /* combined x samples bits */                 
 49     jornada_ts->x_data[3] = jornada_ssp_byte(T    
 50                                                   
 51     /* combined y samples bits */                 
 52     jornada_ts->y_data[3] = jornada_ssp_byte(T    
 53 }                                                 
 54                                                   
 55 static int jornada720_ts_average(int coords[4]    
 56 {                                                 
 57         int coord, high_bits = coords[3];         
 58                                                   
 59         coord  = coords[0] | ((high_bits & 0x0    
 60         coord += coords[1] | ((high_bits & 0x0    
 61         coord += coords[2] | ((high_bits & 0x3    
 62                                                   
 63         return coord / 3;                         
 64 }                                                 
 65                                                   
 66 static irqreturn_t jornada720_ts_interrupt(int    
 67 {                                                 
 68         struct platform_device *pdev = dev_id;    
 69         struct jornada_ts *jornada_ts = platfo    
 70         struct input_dev *input = jornada_ts->    
 71         int x, y;                                 
 72                                                   
 73         /* If GPIO_GPIO9 is set to high then r    
 74         if (GPLR & GPIO_GPIO(9)) {                
 75                 input_report_key(input, BTN_TO    
 76                 input_sync(input);                
 77         } else {                                  
 78                 jornada_ssp_start();              
 79                                                   
 80                 /* proper reply to request is     
 81                 if (jornada_ssp_inout(GETTOUCH    
 82                         jornada720_ts_collect_    
 83                                                   
 84                         x = jornada720_ts_aver    
 85                         y = jornada720_ts_aver    
 86                                                   
 87                         input_report_key(input    
 88                         input_report_abs(input    
 89                         input_report_abs(input    
 90                         input_sync(input);        
 91                 }                                 
 92                                                   
 93                 jornada_ssp_end();                
 94         }                                         
 95                                                   
 96         return IRQ_HANDLED;                       
 97 }                                                 
 98                                                   
 99 static int __devinit jornada720_ts_probe(struc    
100 {                                                 
101         struct jornada_ts *jornada_ts;            
102         struct input_dev *input_dev;              
103         int error;                                
104                                                   
105         jornada_ts = kzalloc(sizeof(struct jor    
106         input_dev = input_allocate_device();      
107                                                   
108         if (!jornada_ts || !input_dev) {          
109                 error = -ENOMEM;                  
110                 goto fail1;                       
111         }                                         
112                                                   
113         platform_set_drvdata(pdev, jornada_ts)    
114                                                   
115         jornada_ts->dev = input_dev;              
116                                                   
117         input_dev->name = "HP Jornada 7xx Touc    
118         input_dev->phys = "jornadats/input0";     
119         input_dev->id.bustype = BUS_HOST;         
120         input_dev->dev.parent = &pdev->dev;       
121                                                   
122         input_dev->evbit[0] = BIT(EV_KEY) | BI    
123         input_dev->keybit[LONG(BTN_TOUCH)] = B    
124         input_set_abs_params(input_dev, ABS_X,    
125         input_set_abs_params(input_dev, ABS_Y,    
126                                                   
127         error = request_irq(IRQ_GPIO9,            
128                         jornada720_ts_interrup    
129                         IRQF_DISABLED | IRQF_T    
130                         "HP7XX Touchscreen dri    
131         if (error) {                              
132                 printk(KERN_INFO "HP7XX TS : U    
133                 goto fail1;                       
134         }                                         
135                                                   
136         error = input_register_device(jornada_    
137         if (error)                                
138                 goto fail2;                       
139                                                   
140         return 0;                                 
141                                                   
142  fail2:                                           
143         free_irq(IRQ_GPIO9, pdev);                
144  fail1:                                           
145         platform_set_drvdata(pdev, NULL);         
146         input_free_device(input_dev);             
147         kfree(jornada_ts);                        
148         return error;                             
149 }                                                 
150                                                   
151 static int __devexit jornada720_ts_remove(stru    
152 {                                                 
153         struct jornada_ts *jornada_ts = platfo    
154                                                   
155         free_irq(IRQ_GPIO9, pdev);                
156         platform_set_drvdata(pdev, NULL);         
157         input_unregister_device(jornada_ts->de    
158         kfree(jornada_ts);                        
159                                                   
160         return 0;                                 
161 }                                                 
162                                                   
163 static struct platform_driver jornada720_ts_dr    
164         .probe          = jornada720_ts_probe,    
165         .remove         = __devexit_p(jornada7    
166         .driver         = {                       
167                 .name   = "jornada_ts",           
168         },                                        
169 };                                                
170                                                   
171 static int __init jornada720_ts_init(void)        
172 {                                                 
173         return platform_driver_register(&jorna    
174 }                                                 
175                                                   
176 static void __exit jornada720_ts_exit(void)       
177 {                                                 
178         platform_driver_unregister(&jornada720    
179 }                                                 
180                                                   
181 module_init(jornada720_ts_init);                  
182 module_exit(jornada720_ts_exit);                  
183                                                   
  This page was automatically generated by the LXR engine.