[PATCH] Fujitsu application panel led value

2007-12-12 Thread Stephen Hemminger
Use proper encoding for LED values.

Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]

---
Note: earlier code worked because hardware only checks for zero.

--- a/drivers/input/misc/apanel.c   2007-12-12 13:07:03.0 -0700
+++ b/drivers/input/misc/apanel.c   2007-12-12 14:42:09.0 -0700
@@ -132,11 +132,11 @@ static void mail_led_set(struct led_clas
 enum led_brightness value)
 {
struct apanel *ap = container_of(led, struct apanel, mail_led);
-   if (value)
+
+   if (value != LED_OFF)
ap-led_bits |= 0x8000;
else
ap-led_bits = ~0x8000;
-   ap-led_bits = value;
schedule_work(ap-led_work);
 }
 


Re: [BUG] New Kernel Bugs

2007-11-13 Thread Stephen Hemminger
On Tue, 13 Nov 2007 19:52:17 -0500
Chuck Ebbert [EMAIL PROTECTED] wrote:

 On 11/13/2007 04:12 PM, Alan Cox wrote:
  Bug fixing is not about finding someone to blame, it's about getting the 
  bug fixed.
  
  Partly - its also about understanding why the bug occurred and making it
  not happen again.
 
 Very few people think about that part.

Why does the kernel have very few useful tests?
 Lack of interest? resources? expertise?
Ideally each new feature would just be a small add on to an existing test.

Unlike developing new features which seems to grow well with more developers.
Bug fixing also seems to be a scarcity process. There often seems to be
a very few people that understand the problem well enough or have the necessary
hardware to reproduce and fix the problem.

Recent changes like tickless and scheduler rework were well thought out and 
caused
very little impact to 90% of the users. The problem is the 10% who do have 
problems.
Worse, the developers often only hear about the a small sample of those.

-- 
Stephen Hemminger [EMAIL PROTECTED]


[PATCH] apanel: space savings.

2007-10-25 Thread Stephen Hemminger
Eliminate the device_names they are only used for debug
messages. Add paren's for one expression.

Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]

--- a/drivers/input/misc/apanel.c   2007-10-25 09:20:23.0 -0700
+++ b/drivers/input/misc/apanel.c   2007-10-25 12:07:00.0 -0700
@@ -27,7 +27,7 @@
 #include linux/leds.h
 
 #define APANEL_NAMEFujitsu Application Panel
-#define APANEL_VERSION 1.3
+#define APANEL_VERSION 1.3.1
 #define APANEL apanel
 
 /* How often we poll keys - msecs */
@@ -40,6 +40,7 @@ enum apanel_devid {
APANEL_DEV_CDBTN  = 2,
APANEL_DEV_LCD= 3,
APANEL_DEV_LED= 4,
+
APANEL_DEV_MAX,
 };
 
@@ -53,14 +54,6 @@ enum apanel_chip {
 /* Result of BIOS snooping/probing -- what features are supported */
 static enum apanel_chip device_chip[APANEL_DEV_MAX];
 
-/* names for APANEL_XXX */
-static const char *device_names[APANEL_DEV_MAX] __initdata = {
-   [APANEL_DEV_APPBTN] = Application Buttons,
-   [APANEL_DEV_LCD]= LCD,
-   [APANEL_DEV_LED]= LED,
-   [APANEL_DEV_CDBTN]  = CD Buttons,
-};
-
 #define MAX_PANEL_KEYS 12
 
 struct apanel {
@@ -123,7 +116,7 @@ static void apanel_poll(struct input_pol
 
dev_dbg(ipdev-input-dev, APANEL : data %#x\n, data);
for (i = 0; i  ipdev-input-keycodemax; i++)
-   if (1ul  i  data)
+   if ((1u  i)  data)
report_key(idev, ap-keymap[i]);
 }
 
@@ -366,17 +359,14 @@ static int __init apanel_init(void)
}
 
if (devno = APANEL_DEV_MAX)
-   pr_notice(APANEL : unknown device %d found\n, devno);
+   pr_notice(APANEL : unknown device %u found\n, devno);
else if (device_chip[devno] != CHIP_NONE)
-   pr_warning(APANEL : duplicate entry for %s\n,
-  device_names[devno]);
+   pr_warning(APANEL : duplicate entry for devno %u\n, 
devno);
 
else if (method != 1  method != 2  method != 4) {
-   pr_notice(APANEL : unknown  method %u for %s\n,
- method, device_names[devno]);
+   pr_notice(APANEL : unknown method %u for devno %u\n,
+ method, devno);
} else {
-   pr_debug(APANEL : %s found.\n, device_names[devno]);
-
device_chip[devno] = (enum apanel_chip) chip;
++found;
}


[PATCH] Fujitsu application panel driver

2007-10-23 Thread Stephen Hemminger
This driver supports the application buttons on some Fujitsu Lifebook
laptops. It is based on the earlier apanel driver done by Jochen
Eisenger, but with many changes.  The original driver used ioctl's and
a separate user space program (see http://apanel.sourceforge.net). This
driver hooks into the input subsystem so that the normal keys act as
expected without a daemon. In addition to buttons, the Mail Led is
handled via LEDs class device.

The driver now supports redefinable keymaps and no longer has to
have a DMI table for all Fujitsu laptops.

I thought about mixing this driver should be integrated into the Fujitsu laptop
extras driver that handles backlight, but rejected the idea because
it wasn't clear if all the Fujitsu laptops supported both.

Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]

---

 drivers/input/misc/Kconfig  |   14 +
 drivers/input/misc/Makefile |1 
 drivers/input/misc/apanel.c |  407 
 3 files changed, 422 insertions(+)

--- a/drivers/input/misc/Kconfig2007-10-23 11:19:10.0 -0700
+++ b/drivers/input/misc/Kconfig2007-10-23 11:19:48.0 -0700
@@ -40,6 +40,20 @@ config INPUT_M68K_BEEP
tristate M68k Beeper support
depends on M68K
 
+config INPUT_APANEL
+   tristate Fujitsu Lifebook Application Panel buttons
+   depends on X86
+   select I2C_I801
+   select INPUT_POLLDEV
+   select CHECK_SIGNATURE
+   help
+Say Y here for support of the Application Panel buttons, used on
+Fujitsu Lifebook. These are attached to the mainboard through
+an SMBus interface managed by the I2C Intel ICH (i801) driver.
+
+To compile this driver as a module, choose M here: the module will
+be called apanel.
+
 config INPUT_IXP4XX_BEEPER
tristate IXP4XX Beeper support
depends on ARCH_IXP4XX
--- a/drivers/input/misc/Makefile   2007-10-23 11:19:10.0 -0700
+++ b/drivers/input/misc/Makefile   2007-10-23 11:19:48.0 -0700
@@ -18,3 +18,4 @@ obj-$(CONFIG_INPUT_POWERMATE) += powerm
 obj-$(CONFIG_INPUT_YEALINK)+= yealink.o
 obj-$(CONFIG_HP_SDC_RTC)   += hp_sdc_rtc.o
 obj-$(CONFIG_INPUT_UINPUT) += uinput.o
+obj-$(CONFIG_INPUT_APANEL) += apanel.o
--- /dev/null   1970-01-01 00:00:00.0 +
+++ b/drivers/input/misc/apanel.c   2007-10-23 12:47:55.0 -0700
@@ -0,0 +1,407 @@
+/*
+ *  Fujitsu Lifebook Application Panel button drive
+ *
+ *  Copyright (C) 2007 Stephen Hemminger [EMAIL PROTECTED]
+ *  Copyright (C) 2001-2003 Jochen Eisinger [EMAIL PROTECTED]
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ *
+ * Many Fujitsu Lifebook laptops have a small panel of buttons that are
+ * accessible via the i2c/smbus interface. This driver polls those
+ * buttons and generates input events.
+ *
+ * For more details see:
+ * http://apanel.sourceforge.net/tech.php
+ */
+
+#include linux/kernel.h
+#include linux/module.h
+#include linux/ioport.h
+#include linux/io.h
+#include linux/module.h
+#include linux/input-polldev.h
+#include linux/i2c.h
+#include linux/workqueue.h
+#include linux/leds.h
+
+#define APANEL_NAMEFujitsu Application Panel
+#define APANEL_VERSION 1.3
+#define APANEL apanel
+
+/* How often we poll keys - msecs */
+#define POLL_INTERVAL_DEFAULT  1000
+
+/* Magic constants in BIOS that tell about buttons */
+enum apanel_devid {
+   APANEL_DEV_NONE   = 0,
+   APANEL_DEV_APPBTN = 1,
+   APANEL_DEV_CDBTN  = 2,
+   APANEL_DEV_LCD= 3,
+   APANEL_DEV_LED= 4,
+   APANEL_DEV_MAX,
+};
+
+enum apanel_chip {
+   CHIP_NONE= 0,
+   CHIP_OZ992C  = 1,
+   CHIP_OZ163T  = 2,
+   CHIP_OZ711M3 = 4,
+};
+
+/* Result of BIOS snooping/probing -- what features are supported */
+static enum apanel_chip device_chip[APANEL_DEV_MAX];
+
+/* names for APANEL_XXX */
+static const char *device_names[APANEL_DEV_MAX] __initdata = {
+   [APANEL_DEV_APPBTN] = Application Buttons,
+   [APANEL_DEV_LCD]= LCD,
+   [APANEL_DEV_LED]= LED,
+   [APANEL_DEV_CDBTN]  = CD Buttons,
+};
+
+#define MAX_PANEL_KEYS 12
+
+struct apanel {
+   struct input_polled_dev *ipdev;
+   struct i2c_client client;
+   unsigned keymap[MAX_PANEL_KEYS];
+   u16nkeys;
+   u16led_bits;
+   struct work_struct led_work;
+   struct led_classdev mail_led;
+};
+
+
+static int apanel_probe(struct i2c_adapter *, int, int);
+
+/* for now, we only support one address */
+static unsigned short normal_i2c[] = {0, I2C_CLIENT_END};
+static unsigned short ignore = I2C_CLIENT_END;
+static struct i2c_client_address_data addr_data = {
+   .normal_i2c = normal_i2c,
+   .probe  = ignore,
+   .ignore = ignore,
+};
+
+static void

[PATCH] input: polled device power saving

2007-09-12 Thread Stephen Hemminger
For slow running polling, it saves power to align wakeups on tick boundary.

Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]

--- a/drivers/input/input-polldev.c 2007-06-22 03:36:04.0 +0200
+++ b/drivers/input/input-polldev.c 2007-09-12 13:18:59.0 +0200
@@ -70,6 +70,7 @@ static int input_open_polled_device(stru
 {
struct input_polled_dev *dev = input-private;
int error;
+   unsigned long ticks;
 
error = input_polldev_start_workqueue();
if (error)
@@ -78,8 +79,10 @@ static int input_open_polled_device(stru
if (dev-flush)
dev-flush(dev);
 
-   queue_delayed_work(polldev_wq, dev-work,
-  msecs_to_jiffies(dev-poll_interval));
+   ticks = msecs_to_jiffies(dev-poll_interval);
+   if (ticks = HZ)
+   ticks = round_jiffies(ticks);
+   queue_delayed_work(polldev_wq, dev-work, ticks);
 
return 0;
 }


Re: Getting touchscreen to work on Fujitsu B6210

2007-05-01 Thread Stephen Hemminger
On Tue, 1 May 2007 11:49:38 -0400
Dmitry Torokhov [EMAIL PROTECTED] wrote:

 Hi Stephen,
 
 On 4/5/07, Dmitry Torokhov [EMAIL PROTECTED] wrote:
 
  Could ypou please load evbug module or run evtest utility and
  verify that the driver produces reasonable events?
 
   Do I need an Xorg driver for it?
 
  Mousedev (i.e. /dev/input/{mouseX|mice} will provide crude
  emulation of normal mouse; there is evtouch X driver that
  should work better. You may also try evdev X driver from
  recent releases of x.org; as far as I know they want it to
  supesede evtouch eventually.
 
 
 Did you have any luck with fujitsu_ts module? Is it busted or is it ok for 
 -mm?
 

Yes and no.  I got the touchscreen to function, but the input is all off.
Cursor doesn't line up with stylus etc. Either there is a calibration issue or
maybe the data isn't being interpreted correctly.  


Re: Getting touchscreen to work on Fujitsu B6210

2007-04-05 Thread Stephen Hemminger
On Wed, 4 Apr 2007 01:16:57 -0400
Dmitry Torokhov [EMAIL PROTECTED] wrote:

 Hi Stephen,
 
 On Thursday 22 February 2007 01:16, Stephen Hemminger wrote:
  I did a little investigation and the touchscreen on B6210 is
  attached via the 8250 serial port. I tried enabling it with
  inputattach but seem to get garbage.
  
  I can extract the initialization code from the evtouch driver
  to a usermode program and read information from /dev/ttyS0.
  
  The lifebook psmouse extension won't work because it tries
  to grab the 8042 (touchpad) rather than the touch screen.
  
  Ideas?
  
 
 Please try the patch below. You will need to load 8250_pnp,
 serport and fujitsu_ts modules, then do
 
 inputattach -fjt /dev/ttyS0


inputattach runs (then waits). Data is arriving when I touch
the screen. Now what? Do I need an Xorg driver for it?