aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/sony-laptop.c
diff options
context:
space:
mode:
authorMattia Dongili <malattia@linux.it>2007-07-15 13:34:39 -0400
committerLen Brown <len.brown@intel.com>2007-07-22 00:34:58 -0400
commit22a17780584173635dae11bb83884952b00e5181 (patch)
treedc97caf8896aa16a83172fc8a6cb8f18fc82bb53 /drivers/misc/sony-laptop.c
parent89892d153d0d46018241afc7944910912bcd9688 (diff)
sony-laptop: Fix event reading in sony-laptop
The rewritten event reading code from sonypi was absolutely wrong, this patche makes things functional for type2 and type1 models. Cc: Andrei Paskevich <andrei@capet.iut-fbleau.fr> Signed-off-by: Mattia Dongili <malattia@linux.it> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/misc/sony-laptop.c')
-rw-r--r--drivers/misc/sony-laptop.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c
index 85969c85cd89..303e48ca0e8a 100644
--- a/drivers/misc/sony-laptop.c
+++ b/drivers/misc/sony-laptop.c
@@ -1142,7 +1142,9 @@ static struct acpi_driver sony_nc_driver = {
1142#define SONYPI_DEVICE_TYPE2 0x00000002 1142#define SONYPI_DEVICE_TYPE2 0x00000002
1143#define SONYPI_DEVICE_TYPE3 0x00000004 1143#define SONYPI_DEVICE_TYPE3 0x00000004
1144 1144
1145#define SONY_PIC_EV_MASK 0xff 1145#define SONYPI_TYPE1_OFFSET 0x04
1146#define SONYPI_TYPE2_OFFSET 0x12
1147#define SONYPI_TYPE3_OFFSET 0x12
1146 1148
1147struct sony_pic_ioport { 1149struct sony_pic_ioport {
1148 struct acpi_resource_io io; 1150 struct acpi_resource_io io;
@@ -1156,6 +1158,7 @@ struct sony_pic_irq {
1156 1158
1157struct sony_pic_dev { 1159struct sony_pic_dev {
1158 int model; 1160 int model;
1161 u16 evport_offset;
1159 u8 camera_power; 1162 u8 camera_power;
1160 u8 bluetooth_power; 1163 u8 bluetooth_power;
1161 u8 wwan_power; 1164 u8 wwan_power;
@@ -2233,20 +2236,17 @@ end:
2233static irqreturn_t sony_pic_irq(int irq, void *dev_id) 2236static irqreturn_t sony_pic_irq(int irq, void *dev_id)
2234{ 2237{
2235 int i, j; 2238 int i, j;
2236 u32 port_val = 0;
2237 u8 ev = 0; 2239 u8 ev = 0;
2238 u8 data_mask = 0; 2240 u8 data_mask = 0;
2239 u8 device_event = 0; 2241 u8 device_event = 0;
2240 2242
2241 struct sony_pic_dev *dev = (struct sony_pic_dev *) dev_id; 2243 struct sony_pic_dev *dev = (struct sony_pic_dev *) dev_id;
2242 2244
2243 acpi_os_read_port(dev->cur_ioport->io.minimum, &port_val, 2245 ev = inb_p(dev->cur_ioport->io.minimum);
2244 dev->cur_ioport->io.address_length); 2246 data_mask = inb_p(dev->cur_ioport->io.minimum + dev->evport_offset);
2245 ev = port_val & SONY_PIC_EV_MASK;
2246 data_mask = 0xff & (port_val >> (dev->cur_ioport->io.address_length - 8));
2247 2247
2248 dprintk("event (0x%.8x [%.2x] [%.2x]) at port 0x%.4x\n", 2248 dprintk("event ([%.2x] [%.2x]) at port 0x%.4x(+0x%.2x)\n",
2249 port_val, ev, data_mask, dev->cur_ioport->io.minimum); 2249 ev, data_mask, dev->cur_ioport->io.minimum, dev->evport_offset);
2250 2250
2251 if (ev == 0x00 || ev == 0xff) 2251 if (ev == 0x00 || ev == 0xff)
2252 return IRQ_HANDLED; 2252 return IRQ_HANDLED;
@@ -2337,6 +2337,20 @@ static int sony_pic_add(struct acpi_device *device)
2337 spic_dev.model = sony_pic_detect_device_type(); 2337 spic_dev.model = sony_pic_detect_device_type();
2338 mutex_init(&spic_dev.lock); 2338 mutex_init(&spic_dev.lock);
2339 2339
2340 /* model specific characteristics */
2341 switch(spic_dev.model) {
2342 case SONYPI_DEVICE_TYPE1:
2343 spic_dev.evport_offset = SONYPI_TYPE1_OFFSET;
2344 break;
2345 case SONYPI_DEVICE_TYPE3:
2346 spic_dev.evport_offset = SONYPI_TYPE3_OFFSET;
2347 break;
2348 case SONYPI_DEVICE_TYPE2:
2349 default:
2350 spic_dev.evport_offset = SONYPI_TYPE2_OFFSET;
2351 break;
2352 }
2353
2340 /* read _PRS resources */ 2354 /* read _PRS resources */
2341 result = sony_pic_possible_resources(device); 2355 result = sony_pic_possible_resources(device);
2342 if (result) { 2356 if (result) {