19 #include <linux/kernel.h>
20 #include <linux/module.h>
24 #include <linux/i2c.h>
28 #define APANEL_NAME "Fujitsu Application Panel"
29 #define APANEL_VERSION "1.3.1"
30 #define APANEL "apanel"
33 #define POLL_INTERVAL_DEFAULT 1000
56 #define MAX_PANEL_KEYS 12
71 static void report_key(
struct input_dev *
input,
unsigned keycode)
74 input_report_key(input, keycode, 1);
77 input_report_key(input, keycode, 0);
89 static void apanel_poll(
struct input_polled_dev *ipdev)
91 struct apanel *ap = ipdev->private;
92 struct input_dev *
idev = ipdev->input;
108 for (i = 0; i < idev->keycodemax; i++)
109 if ((1
u << i) & data)
110 report_key(idev, ap->
keymap[i]);
136 struct apanel *ap = i2c_get_clientdata(client);
147 static void apanel_shutdown(
struct i2c_client *client)
149 apanel_remove(client);
153 {
"fujitsu_apanel", 0 },
162 .probe = &apanel_probe,
163 .remove = &apanel_remove,
164 .shutdown = &apanel_shutdown,
165 .id_table = apanel_id,
183 .brightness_set = mail_led_set,
188 static int apanel_probe(
struct i2c_client *client,
192 struct input_polled_dev *ipdev;
193 struct input_dev *
idev;
206 i2c_set_clientdata(client, ap);
215 ipdev->poll = apanel_poll;
221 idev->phys =
"apanel/input0";
223 idev->dev.parent = &client->
dev;
227 idev->keycode = ap->
keymap;
228 idev->keycodesize =
sizeof(ap->
keymap[0]);
231 for (i = 0; i < idev->keycodemax; i++)
259 const unsigned char signature[] =
"FJKEYINF";
261 for (offset = 0; offset < 0x10000; offset += 0x10) {
263 sizeof(signature)-1))
271 static int __init apanel_init(
void)
276 unsigned char i2c_addr;
279 bios =
ioremap(0xF0000, 0x10000);
281 p = bios_signature(bios);
289 i2c_addr =
readb(p + 3) >> 1;
291 for ( ; (devno =
readb(p)) & 0x7f; p += 4) {
294 method =
readb(p + 1);
296 slave =
readb(p + 3) >> 1;
298 if (slave != i2c_addr) {
300 "address supported, skiping device...\n");
316 else if (device_chip[devno] !=
CHIP_NONE)
319 else if (method != 1 && method != 2 && method != 4) {
334 return i2c_add_driver(&apanel_driver);
338 static void __exit apanel_cleanup(
void)
349 MODULE_ALIAS(
"dmi:*:svnFUJITSU:pnLifeBook*:pvr*:rvnFUJITSU:*");
350 MODULE_ALIAS(
"dmi:*:svnFUJITSU:pnLifebook*:pvr*:rvnFUJITSU:*");