diff options
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/Kconfig | 24 | ||||
-rw-r--r-- | drivers/misc/Makefile | 2 | ||||
-rw-r--r-- | drivers/misc/asus-laptop.c | 6 | ||||
-rw-r--r-- | drivers/misc/blink.c | 27 | ||||
-rw-r--r-- | drivers/misc/eeprom_93cx6.c | 241 | ||||
-rw-r--r-- | drivers/misc/ibmasm/command.c | 20 | ||||
-rw-r--r-- | drivers/misc/ibmasm/dot_command.c | 10 | ||||
-rw-r--r-- | drivers/misc/ibmasm/dot_command.h | 2 | ||||
-rw-r--r-- | drivers/misc/ibmasm/event.c | 8 | ||||
-rw-r--r-- | drivers/misc/ibmasm/heartbeat.c | 2 | ||||
-rw-r--r-- | drivers/misc/ibmasm/i2o.h | 10 | ||||
-rw-r--r-- | drivers/misc/ibmasm/ibmasm.h | 70 | ||||
-rw-r--r-- | drivers/misc/ibmasm/ibmasmfs.c | 27 | ||||
-rw-r--r-- | drivers/misc/ibmasm/lowlevel.c | 2 | ||||
-rw-r--r-- | drivers/misc/ibmasm/lowlevel.h | 16 | ||||
-rw-r--r-- | drivers/misc/ibmasm/module.c | 13 | ||||
-rw-r--r-- | drivers/misc/ibmasm/r_heartbeat.c | 10 | ||||
-rw-r--r-- | drivers/misc/ibmasm/remote.c | 37 | ||||
-rw-r--r-- | drivers/misc/ibmasm/remote.h | 8 | ||||
-rw-r--r-- | drivers/misc/ibmasm/uart.c | 2 | ||||
-rw-r--r-- | drivers/misc/msi-laptop.c | 44 | ||||
-rw-r--r-- | drivers/misc/sony-laptop.c | 3 |
22 files changed, 415 insertions, 169 deletions
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 2f2fbffafbe..1d516f24ba5 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -2,11 +2,15 @@ # Misc strange devices # -menu "Misc devices" +menuconfig MISC_DEVICES + bool "Misc devices" + default y + +if MISC_DEVICES config IBM_ASM tristate "Device driver for IBM RSA service processor" - depends on X86 && PCI && EXPERIMENTAL + depends on X86 && PCI && INPUT && EXPERIMENTAL ---help--- This option enables device driver support for in-band access to the IBM RSA (Condor) service processor in eServer xSeries systems. @@ -34,6 +38,11 @@ config PHANTOM If you choose to build module, its name will be phantom. If unsure, say N here. +config EEPROM_93CX6 + tristate "EEPROM 93CX6 support" + ---help--- + This is a driver for the EEPROM chipsets 93c46 and 93c66. + The driver supports both read as well as write commands. If unsure, say N. @@ -187,13 +196,4 @@ config THINKPAD_ACPI_BAY If you are not sure, say Y here. -config BLINK - tristate "Keyboard blink driver" - help - Driver that when loaded will blink the keyboard LEDs continuously. - This is useful for debugging and for kernels that cannot necessarily - output something to the screen like kexec kernels to give the user - a visual indication that the kernel is doing something. - - -endmenu +endif # MISC_DEVICES diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index 5b6d46de005..b5ce0e3dba8 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -7,7 +7,6 @@ obj-$(CONFIG_IBM_ASM) += ibmasm/ obj-$(CONFIG_HDPU_FEATURES) += hdpuftrs/ obj-$(CONFIG_MSI_LAPTOP) += msi-laptop.o obj-$(CONFIG_ASUS_LAPTOP) += asus-laptop.o -obj-$(CONFIG_BLINK) += blink.o obj-$(CONFIG_LKDTM) += lkdtm.o obj-$(CONFIG_TIFM_CORE) += tifm_core.o obj-$(CONFIG_TIFM_7XX1) += tifm_7xx1.o @@ -15,3 +14,4 @@ obj-$(CONFIG_PHANTOM) += phantom.o obj-$(CONFIG_SGI_IOC4) += ioc4.o obj-$(CONFIG_SONY_LAPTOP) += sony-laptop.o obj-$(CONFIG_THINKPAD_ACPI) += thinkpad_acpi.o +obj-$(CONFIG_EEPROM_93CX6) += eeprom_93cx6.o diff --git a/drivers/misc/asus-laptop.c b/drivers/misc/asus-laptop.c index 4f9060a2a2f..f7530605997 100644 --- a/drivers/misc/asus-laptop.c +++ b/drivers/misc/asus-laptop.c @@ -737,8 +737,7 @@ static void asus_hotk_notify(acpi_handle handle, u32 event, void *data) struct device_attribute dev_attr_##_name = { \ .attr = { \ .name = __stringify(_name), \ - .mode = 0, \ - .owner = THIS_MODULE }, \ + .mode = 0 }, \ .show = NULL, \ .store = NULL, \ } @@ -980,10 +979,9 @@ static int asus_hotk_add(struct acpi_device *device) printk(ASUS_NOTICE "Asus Laptop Support version %s\n", ASUS_LAPTOP_VERSION); - hotk = kmalloc(sizeof(struct asus_hotk), GFP_KERNEL); + hotk = kzalloc(sizeof(struct asus_hotk), GFP_KERNEL); if (!hotk) return -ENOMEM; - memset(hotk, 0, sizeof(struct asus_hotk)); hotk->handle = device->handle; strcpy(acpi_device_name(device), ASUS_HOTK_DEVICE_NAME); diff --git a/drivers/misc/blink.c b/drivers/misc/blink.c deleted file mode 100644 index 634431ce118..00000000000 --- a/drivers/misc/blink.c +++ /dev/null @@ -1,27 +0,0 @@ -#include <linux/kernel.h> -#include <linux/module.h> -#include <linux/timer.h> -#include <linux/jiffies.h> - -static void do_blink(unsigned long data); - -static DEFINE_TIMER(blink_timer, do_blink, 0 ,0); - -static void do_blink(unsigned long data) -{ - static long count; - if (panic_blink) - panic_blink(count++); - blink_timer.expires = jiffies + msecs_to_jiffies(1); - add_timer(&blink_timer); -} - -static int blink_init(void) -{ - printk(KERN_INFO "Enabling keyboard blinking\n"); - do_blink(0); - return 0; -} - -module_init(blink_init); - diff --git a/drivers/misc/eeprom_93cx6.c b/drivers/misc/eeprom_93cx6.c new file mode 100644 index 00000000000..ea55654e594 --- /dev/null +++ b/drivers/misc/eeprom_93cx6.c @@ -0,0 +1,241 @@ +/* + Copyright (C) 2004 - 2006 rt2x00 SourceForge Project + <http://rt2x00.serialmonkey.com> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the + Free Software Foundation, Inc., + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* + Module: eeprom_93cx6 + Abstract: EEPROM reader routines for 93cx6 chipsets. + Supported chipsets: 93c46 & 93c66. + */ + +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/version.h> +#include <linux/delay.h> +#include <linux/eeprom_93cx6.h> + +MODULE_AUTHOR("http://rt2x00.serialmonkey.com"); +MODULE_VERSION("1.0"); +MODULE_DESCRIPTION("EEPROM 93cx6 chip driver"); +MODULE_LICENSE("GPL"); + +static inline void eeprom_93cx6_pulse_high(struct eeprom_93cx6 *eeprom) +{ + eeprom->reg_data_clock = 1; + eeprom->register_write(eeprom); + + /* + * Add a short delay for the pulse to work. + * According to the specifications the "maximum minimum" + * time should be 450ns. + */ + ndelay(450); +} + +static inline void eeprom_93cx6_pulse_low(struct eeprom_93cx6 *eeprom) +{ + eeprom->reg_data_clock = 0; + eeprom->register_write(eeprom); + + /* + * Add a short delay for the pulse to work. + * According to the specifications the "maximum minimum" + * time should be 450ns. + */ + ndelay(450); +} + +static void eeprom_93cx6_startup(struct eeprom_93cx6 *eeprom) +{ + /* + * Clear all flags, and enable chip select. + */ + eeprom->register_read(eeprom); + eeprom->reg_data_in = 0; + eeprom->reg_data_out = 0; + eeprom->reg_data_clock = 0; + eeprom->reg_chip_select = 1; + eeprom->register_write(eeprom); + + /* + * kick a pulse. + */ + eeprom_93cx6_pulse_high(eeprom); + eeprom_93cx6_pulse_low(eeprom); +} + +static void eeprom_93cx6_cleanup(struct eeprom_93cx6 *eeprom) +{ + /* + * Clear chip_select and data_in flags. + */ + eeprom->register_read(eeprom); + eeprom->reg_data_in = 0; + eeprom->reg_chip_select = 0; + eeprom->register_write(eeprom); + + /* + * kick a pulse. + */ + eeprom_93cx6_pulse_high(eeprom); + eeprom_93cx6_pulse_low(eeprom); +} + +static void eeprom_93cx6_write_bits(struct eeprom_93cx6 *eeprom, + const u16 data, const u16 count) +{ + unsigned int i; + + eeprom->register_read(eeprom); + + /* + * Clear data flags. + */ + eeprom->reg_data_in = 0; + eeprom->reg_data_out = 0; + + /* + * Start writing all bits. + */ + for (i = count; i > 0; i--) { + /* + * Check if this bit needs to be set. + */ + eeprom->reg_data_in = !!(data & (1 << (i - 1))); + + /* + * Write the bit to the eeprom register. + */ + eeprom->register_write(eeprom); + + /* + * Kick a pulse. + */ + eeprom_93cx6_pulse_high(eeprom); + eeprom_93cx6_pulse_low(eeprom); + } + + eeprom->reg_data_in = 0; + eeprom->register_write(eeprom); +} + +static void eeprom_93cx6_read_bits(struct eeprom_93cx6 *eeprom, + u16 *data, const u16 count) +{ + unsigned int i; + u16 buf = 0; + + eeprom->register_read(eeprom); + + /* + * Clear data flags. + */ + eeprom->reg_data_in = 0; + eeprom->reg_data_out = 0; + + /* + * Start reading all bits. + */ + for (i = count; i > 0; i--) { + eeprom_93cx6_pulse_high(eeprom); + + eeprom->register_read(eeprom); + + /* + * Clear data_in flag. + */ + eeprom->reg_data_in = 0; + + /* + * Read if the bit has been set. + */ + if (eeprom->reg_data_out) + buf |= (1 << (i - 1)); + + eeprom_93cx6_pulse_low(eeprom); + } + + *data = buf; +} + +/** + * eeprom_93cx6_read - Read multiple words from eeprom + * @eeprom: Pointer to eeprom structure + * @word: Word index from where we should start reading + * @data: target pointer where the information will have to be stored + * + * This function will read the eeprom data as host-endian word + * into the given data pointer. + */ +void eeprom_93cx6_read(struct eeprom_93cx6 *eeprom, const u8 word, + u16 *data) +{ + u16 command; + + /* + * Initialize the eeprom register + */ + eeprom_93cx6_startup(eeprom); + + /* + * Select the read opcode and the word to be read. + */ + command = (PCI_EEPROM_READ_OPCODE << eeprom->width) | word; + eeprom_93cx6_write_bits(eeprom, command, + PCI_EEPROM_WIDTH_OPCODE + eeprom->width); + + /* + * Read the requested 16 bits. + */ + eeprom_93cx6_read_bits(eeprom, data, 16); + + /* + * Cleanup eeprom register. + */ + eeprom_93cx6_cleanup(eeprom); +} +EXPORT_SYMBOL_GPL(eeprom_93cx6_read); + +/** + * eeprom_93cx6_multiread - Read multiple words from eeprom + * @eeprom: Pointer to eeprom structure + * @word: Word index from where we should start reading + * @data: target pointer where the information will have to be stored + * @words: Number of words that should be read. + * + * This function will read all requested words from the eeprom, + * this is done by calling eeprom_93cx6_read() multiple times. + * But with the additional change that while the eeprom_93cx6_read + * will return host ordered bytes, this method will return little + * endian words. + */ +void eeprom_93cx6_multiread(struct eeprom_93cx6 *eeprom, const u8 word, + __le16 *data, const u16 words) +{ + unsigned int i; + u16 tmp; + + for (i = 0; i < words; i++) { + tmp = 0; + eeprom_93cx6_read(eeprom, word + i, &tmp); + data[i] = cpu_to_le16(tmp); + } +} +EXPORT_SYMBOL_GPL(eeprom_93cx6_multiread); + diff --git a/drivers/misc/ibmasm/command.c b/drivers/misc/ibmasm/command.c index 07a085ccbd5..6497872df52 100644 --- a/drivers/misc/ibmasm/command.c +++ b/drivers/misc/ibmasm/command.c @@ -18,7 +18,7 @@ * * Copyright (C) IBM Corporation, 2004 * - * Author: Max Asböck <amax@us.ibm.com> + * Author: Max Asböck <amax@us.ibm.com> * */ @@ -41,18 +41,16 @@ struct command *ibmasm_new_command(struct service_processor *sp, size_t buffer_s if (buffer_size > IBMASM_CMD_MAX_BUFFER_SIZE) return NULL; - cmd = kmalloc(sizeof(struct command), GFP_KERNEL); + cmd = kzalloc(sizeof(struct command), GFP_KERNEL); if (cmd == NULL) return NULL; - memset(cmd, 0, sizeof(*cmd)); - cmd->buffer = kmalloc(buffer_size, GFP_KERNEL); + cmd->buffer = kzalloc(buffer_size, GFP_KERNEL); if (cmd->buffer == NULL) { kfree(cmd); return NULL; } - memset(cmd->buffer, 0, buffer_size); cmd->buffer_size = buffer_size; kobject_init(&cmd->kobj); @@ -72,7 +70,7 @@ struct command *ibmasm_new_command(struct service_processor *sp, size_t buffer_s static void free_command(struct kobject *kobj) { struct command *cmd = to_command(kobj); - + list_del(&cmd->queue_node); atomic_dec(&command_count); dbg("command count: %d\n", atomic_read(&command_count)); @@ -113,14 +111,14 @@ static inline void do_exec_command(struct service_processor *sp) exec_next_command(sp); } } - + /** * exec_command * send a command to a service processor * Commands are executed sequentially. One command (sp->current_command) * is sent to the service processor. Once the interrupt handler gets a * message of type command_response, the message is copied into - * the current commands buffer, + * the current commands buffer, */ void ibmasm_exec_command(struct service_processor *sp, struct command *cmd) { @@ -160,7 +158,7 @@ static void exec_next_command(struct service_processor *sp) } } -/** +/** * Sleep until a command has failed or a response has been received * and the command status been updated by the interrupt handler. * (see receive_response). @@ -182,8 +180,8 @@ void ibmasm_receive_command_response(struct service_processor *sp, void *respons { struct command *cmd = sp->current_command; - if (!sp->current_command) - return; + if (!sp->current_command) + return; memcpy_fromio(cmd->buffer, response, min(size, cmd->buffer_size)); cmd->status = IBMASM_CMD_COMPLETE; diff --git a/drivers/misc/ibmasm/dot_command.c b/drivers/misc/ibmasm/dot_command.c index 13c52f866e2..3dd2dfb8da1 100644 --- a/drivers/misc/ibmasm/dot_command.c +++ b/drivers/misc/ibmasm/dot_command.c @@ -17,7 +17,7 @@ * * Copyright (C) IBM Corporation, 2004 * - * Author: Max Asböck <amax@us.ibm.com> + * Author: Max Asböck <amax@us.ibm.com> * */ @@ -44,11 +44,11 @@ void ibmasm_receive_message(struct service_processor *sp, void *message, int mes size = message_size; switch (header->type) { - case sp_event: + case sp_event: ibmasm_receive_event(sp, message, size); break; case sp_command_response: - ibmasm_receive_command_response(sp, message, size); + ibmasm_receive_command_response(sp, message, size); break; case sp_heartbeat: ibmasm_receive_heartbeat(sp, message, size); @@ -95,7 +95,7 @@ int ibmasm_send_driver_vpd(struct service_processor *sp) strcat(vpd_data, IBMASM_DRIVER_VPD); vpd_data[10] = 0; vpd_data[15] = 0; - + ibmasm_exec_command(sp, command); ibmasm_wait_for_response(command, IBMASM_CMD_TIMEOUT_NORMAL); @@ -118,7 +118,7 @@ struct os_state_command { * During driver init this function is called with os state "up". * This causes the service processor to start sending heartbeats the * driver. - * During driver exit the function is called with os state "down", + * During driver exit the function is called with os state "down", * causing the service processor to stop the heartbeats. */ int ibmasm_send_os_state(struct service_processor *sp, int os_state) diff --git a/drivers/misc/ibmasm/dot_command.h b/drivers/misc/ibmasm/dot_command.h index 2d21c2741b6..6cbba1afef3 100644 --- a/drivers/misc/ibmasm/dot_command.h +++ b/drivers/misc/ibmasm/dot_command.h @@ -17,7 +17,7 @@ * * Copyright (C) IBM Corporation, 2004 * - * Author: Max Asböck <amax@us.ibm.com> + * Author: Max Asböck <amax@us.ibm.com> * */ diff --git a/drivers/misc/ibmasm/event.c b/drivers/misc/ibmasm/event.c index fe1e819235a..fda6a4d3bf2 100644 --- a/drivers/misc/ibmasm/event.c +++ b/drivers/misc/ibmasm/event.c @@ -18,7 +18,7 @@ * * Copyright (C) IBM Corporation, 2004 * - * Author: Max Asböck <amax@us.ibm.com> + * Author: Max Asböck <amax@us.ibm.com> * */ @@ -51,7 +51,7 @@ static void wake_up_event_readers(struct service_processor *sp) * event readers. * There is no reader marker in the buffer, therefore readers are * responsible for keeping up with the writer, or they will loose events. - */ + */ void ibmasm_receive_event(struct service_processor *sp, void *data, unsigned int data_size) { struct event_buffer *buffer = sp->event_buffer; @@ -77,13 +77,13 @@ void ibmasm_receive_event(struct service_processor *sp, void *data, unsigned int static inline int event_available(struct event_buffer *b, struct event_reader *r) { - return (r->next_serial_number < b->next_serial_number); + return (r->next_serial_number < b->next_serial_number); } /** * get_next_event * Called by event readers (initiated from user space through the file - * system). + * system). * Sleeps until a new event is available. */ int ibmasm_get_next_event(struct service_processor *sp, struct event_reader *reader) diff --git a/drivers/misc/ibmasm/heartbeat.c b/drivers/misc/ibmasm/heartbeat.c index 7fd7a43e38d..3036e785b3e 100644 --- a/drivers/misc/ibmasm/heartbeat.c +++ b/drivers/misc/ibmasm/heartbeat.c @@ -18,7 +18,7 @@ * * Copyright (C) IBM Corporation, 2004 * - * Author: Max Asböck <amax@us.ibm.com> + * Author: Max Asböck <amax@us.ibm.com> * */ diff --git a/drivers/misc/ibmasm/i2o.h b/drivers/misc/ibmasm/i2o.h index 958c957a5e7..bf2c738d2b7 100644 --- a/drivers/misc/ibmasm/i2o.h +++ b/drivers/misc/ibmasm/i2o.h @@ -17,7 +17,7 @@ * * Copyright (C) IBM Corporation, 2004 * - * Author: Max Asböck <amax@us.ibm.com> + * Author: Max Asböck <amax@us.ibm.com> * */ @@ -26,9 +26,9 @@ struct i2o_header { u8 version; u8 message_flags; u16 message_size; - u8 target; + u8 target; u8 initiator_and_target; - u8 initiator; + u8 initiator; u8 function; u32 initiator_context; }; @@ -64,12 +64,12 @@ static inline unsigned short outgoing_message_size(unsigned int data_size) size = sizeof(struct i2o_header) + data_size; i2o_size = size / sizeof(u32); - + if (size % sizeof(u32)) i2o_size++; return i2o_size; -} +} static inline u32 incoming_data_size(struct i2o_message *i2o_message) { diff --git a/drivers/misc/ibmasm/ibmasm.h b/drivers/misc/ibmasm/ibmasm.h index 48d5abebfc3..de860bc6d3f 100644 --- a/drivers/misc/ibmasm/ibmasm.h +++ b/drivers/misc/ibmasm/ibmasm.h @@ -18,7 +18,7 @@ * * Copyright (C) IBM Corporation, 2004 * - * Author: Max Asböck <amax@us.ibm.com> + * Author: Max Asböck <amax@us.ibm.com> * */ @@ -58,8 +58,8 @@ static inline char *get_timestamp(char *buf) return buf; } -#define IBMASM_CMD_PENDING 0 -#define IBMASM_CMD_COMPLETE 1 +#define IBMASM_CMD_PENDING 0 +#define IBMASM_CMD_COMPLETE 1 #define IBMASM_CMD_FAILED 2 #define IBMASM_CMD_TIMEOUT_NORMAL 45 @@ -163,55 +163,55 @@ struct service_processor { }; /* command processing */ -extern struct command *ibmasm_new_command(struct service_processor *sp, size_t buffer_size); -extern void ibmasm_exec_command(struct service_processor *sp, struct command *cmd); -extern void ibmasm_wait_for_response(struct command *cmd, int timeout); -extern void ibmasm_receive_command_response(struct service_processor *sp, void *response, size_t size); +struct command *ibmasm_new_command(struct service_processor *sp, size_t buffer_size); +void ibmasm_exec_command(struct service_processor *sp, struct command *cmd); +void ibmasm_wait_for_response(struct command *cmd, int timeout); +void ibmasm_receive_command_response(struct service_processor *sp, void *response, size_t size); /* event processing */ -extern int ibmasm_event_buffer_init(struct service_processor *sp); -extern void ibmasm_event_buffer_exit(struct service_processor *sp); -extern void ibmasm_receive_event(struct service_processor *sp, void *data, unsigned int data_size); -extern void ibmasm_event_reader_register(struct service_processor *sp, struct event_reader *reader); -extern void ibmasm_event_reader_unregister(struct service_processor *sp, struct event_reader *reader); -extern int ibmasm_get_next_event(struct service_processor *sp, struct event_reader *reader); -extern void ibmasm_cancel_next_event(struct event_reader *reader); +int ibmasm_event_buffer_init(struct service_processor *sp); +void ibmasm_event_buffer_exit(struct service_processor *sp); +void ibmasm_receive_event(struct service_processor *sp, void *data, unsigned int data_size); +void ibmasm_event_reader_register(struct service_processor *sp, struct event_reader *reader); +void ibmasm_event_reader_unregister(struct service_processor *sp, struct event_reader *reader); +int ibmasm_get_next_event(struct service_processor *sp, struct event_reader *reader); +void ibmasm_cancel_next_event(struct event_reader *reader); /* heartbeat - from SP to OS */ -extern void ibmasm_register_panic_notifier(void); -extern void ibmasm_unregister_panic_notifier(void); -extern int ibmasm_heartbeat_init(struct service_processor *sp); -extern void ibmasm_heartbeat_exit(struct service_processor *sp); -extern void ibmasm_receive_heartbeat(struct service_processor *sp, void *message, size_t size); +void ibmasm_register_panic_notifier(void); +void ibmasm_unregister_panic_notifier(void); +int ibmasm_heartbeat_init(struct service_processor *sp); +void ibmasm_heartbeat_exit(struct service_processor *sp); +void ibmasm_receive_heartbeat(struct service_processor *sp, void *message, size_t size); /* reverse heartbeat - from OS to SP */ -extern void ibmasm_init_reverse_heartbeat(struct service_processor *sp, struct reverse_heartbeat *rhb); -extern int ibmasm_start_reverse_heartbeat(struct service_processor *sp, struct reverse_heartbeat *rhb); -extern void ibmasm_stop_reverse_heartbeat(struct reverse_heartbeat *rhb); +void ibmasm_init_reverse_heartbeat(struct service_processor *sp, struct reverse_heartbeat *rhb); +int ibmasm_start_reverse_heartbeat(struct service_processor *sp, struct reverse_heartbeat *rhb); +void ibmasm_stop_reverse_heartbeat(struct reverse_heartbeat *rhb); /* dot commands */ -extern void ibmasm_receive_message(struct service_processor *sp, void *data, int data_size); -extern int ibmasm_send_driver_vpd(struct service_processor *sp); -extern int ibmasm_send_os_state(struct service_processor *sp, int os_state); +void ibmasm_receive_message(struct service_processor *sp, void *data, int data_size); +int ibmasm_send_driver_vpd(struct service_processor *sp); +int ibmasm_send_os_state(struct service_processor *sp, int os_state); /* low level message processing */ -extern int ibmasm_send_i2o_message(struct service_processor *sp); -extern irqreturn_t ibmasm_interrupt_handler(int irq, void * dev_id); +int ibmasm_send_i2o_message(struct service_processor *sp); +irqreturn_t ibmasm_interrupt_handler(int irq, void * dev_id); /* remote console */ -extern void ibmasm_handle_mouse_interrupt(struct service_processor *sp); -extern int ibmasm_init_remote_input_dev(struct service_processor *sp); -extern void ibmasm_free_remote_input_dev(struct service_processor *sp); +void ibmasm_handle_mouse_interrupt(struct service_processor *sp); +int ibmasm_init_remote_input_dev(struct service_processor *sp); +void ibmasm_free_remote_input_dev(struct service_processor *sp); /* file system */ -extern int ibmasmfs_register(void); -extern void ibmasmfs_unregister(void); -extern void ibmasmfs_add_sp(struct service_processor *sp); +int ibmasmfs_register(void); +void ibmasmfs_unregister(void); +void ibmasmfs_add_sp(struct service_processor *sp); /* uart */ #ifdef CONFIG_SERIAL_8250 -extern void ibmasm_register_uart(struct service_processor *sp); -extern void ibmasm_unregister_uart(struct service_processor *sp); +void ibmasm_register_uart(struct service_processor *sp); +void ibmasm_unregister_uart(struct service_processor *sp); #else #define ibmasm_register_uart(sp) do { } while(0) #define ibmasm_unregister_uart(sp) do { } while(0) diff --git a/drivers/misc/ibmasm/ibmasmfs.c b/drivers/misc/ibmasm/ibmasmfs.c index c436d3de8b8..22a7e8ba211 100644 --- a/drivers/misc/ibmasm/ibmasmfs.c +++ b/drivers/misc/ibmasm/ibmasmfs.c @@ -17,12 +17,12 @@ * * Copyright (C) IBM Corporation, 2004 * - * Author: Max Asböck <amax@us.ibm.com> + * Author: Max Asböck <amax@us.ibm.com> * */ /* - * Parts of this code are based on an article by Jonathan Corbet + * Parts of this code are based on an article by Jonathan Corbet * that appeared in Linux Weekly News. */ @@ -55,22 +55,22 @@ * For each service processor the following files are created: * * command: execute dot commands - * write: execute a dot command on the service processor - * read: return the result of a previously executed dot command + * write: execute a dot command on the service processor + * read: return the result of a previously executed dot command * * events: listen for service processor events - * read: sleep (interruptible) until an event occurs + * read: sleep (interruptible) until an event occurs * write: wakeup sleeping event listener * * reverse_heartbeat: send a heartbeat to the service processor - * read: sleep (interruptible) until the reverse heartbeat fails + * read: sleep (interruptible) until the reverse heartbeat fails * write: wakeup sleeping heartbeat listener * * remote_video/width * remote_video/height * remote_video/width: control remote display settings - * write: set value - * read: read value + * write: set value + * read: read value */ #include <linux/fs.h> @@ -155,7 +155,7 @@ static struct inode *ibmasmfs_make_inode(struct super_block *sb, int mode) static struct dentry *ibmasmfs_create_file (struct super_block *sb, struct dentry *parent, - const char *name, + const char *name, const struct file_operations *fops, void *data, int mode) @@ -261,7 +261,7 @@ static int command_file_close(struct inode *inode, struct file *file) struct ibmasmfs_command_data *command_data = file->private_data; if (command_data->command) - command_put(command_data->command); + command_put(command_data->command); kfree(command_data); return 0; @@ -348,7 +348,7 @@ static ssize_t command_file_write(struct file *file, const char __user *ubuff, s static int event_file_open(struct inode *inode, struct file *file) { struct ibmasmfs_event_data *event_data; - struct service_processor *sp; + struct service_processor *sp; if (!inode->i_private) return -ENODEV; @@ -563,17 +563,16 @@ static ssize_t remote_settings_file_write(struct file *file, const char __user * if (*offset != 0) return 0; - buff = kmalloc (count + 1, GFP_KERNEL); + buff = kzalloc (count + 1, GFP_KERNEL); if (!buff) return -ENOMEM; - memset(buff, 0x0, count + 1); if (copy_from_user(buff, ubuff, count)) { kfree(buff); return -EFAULT; } - + value = simple_strtoul(buff, NULL, 10); writel(value, address); kfree(buff); diff --git a/drivers/misc/ibmasm/lowlevel.c b/drivers/misc/ibmasm/lowlevel.c index a3c589b7cbf..4b2398e27fd 100644 --- a/drivers/misc/ibmasm/lowlevel.c +++ b/drivers/misc/ibmasm/lowlevel.c @@ -17,7 +17,7 @@ * * Copyright (C) IBM Corporation, 2004 * - * Author: Max Asböck <amax@us.ibm.com> + * Author: Max Asböck <amax@us.ibm.com> * */ diff --git a/drivers/misc/ibmasm/lowlevel.h b/drivers/misc/ibmasm/lowlevel.h index e5ed59c589a..766766523a6 100644 --- a/drivers/misc/ibmasm/lowlevel.h +++ b/drivers/misc/ibmasm/lowlevel.h @@ -17,7 +17,7 @@ * * Copyright (C) IBM Corporation, 2004 * - * Author: Max Asböck <amax@us.ibm.com> + * Author: Max Asböck <amax@us.ibm.com> * */ @@ -48,9 +48,9 @@ #define INTR_CONTROL_REGISTER 0x13A4 #define SCOUT_COM_A_BASE 0x0000 -#define SCOUT_COM_B_BASE 0x0100 -#define SCOUT_COM_C_BASE 0x0200 -#define SCOUT_COM_D_BASE 0x0300 +#define SCOUT_COM_B_BASE 0x0100 +#define SCOUT_COM_C_BASE 0x0200 +#define SCOUT_COM_D_BASE 0x0300 static inline int sp_interrupt_pending(void __iomem *base_address) { @@ -86,12 +86,12 @@ static inline void disable_sp_interrupts(void __iomem *base_address) static inline void enable_uart_interrupts(void __iomem *base_address) { - ibmasm_enable_interrupts(base_address, UART_INTR_MASK); + ibmasm_enable_interrupts(base_address, UART_INTR_MASK); } static inline void disable_uart_interrupts(void __iomem *base_address) { - ibmasm_disable_interrupts(base_address, UART_INTR_MASK); + ibmasm_disable_interrupts(base_address, UART_INTR_MASK); } #define valid_mfa(mfa) ( (mfa) != NO_MFAS_AVAILABLE ) @@ -111,7 +111,7 @@ static inline u32 get_mfa_outbound(void __iomem *base_address) static inline void set_mfa_outbound(void __iomem *base_address, u32 mfa) { - writel(mfa, base_address + OUTBOUND_QUEUE_PORT); + writel(mfa, base_address + OUTBOUND_QUEUE_PORT); } static inline u32 get_mfa_inbound(void __iomem *base_address) @@ -126,7 +126,7 @@ static inline u32 get_mfa_inbound(void __iomem *base_address) static inline void set_mfa_inbound(void __iomem *base_address, u32 mfa) { - writel(mfa, base_address + INBOUND_QUEUE_PORT); + writel(mfa, base_address + INBOUND_QUEUE_PORT); } static inline struct i2o_message *get_i2o_message(void __iomem *base_address, u32 mfa) diff --git a/drivers/misc/ibmasm/module.c b/drivers/misc/ibmasm/module.c index 2f3bddfab93..4f9d4a9da98 100644 --- a/drivers/misc/ibmasm/module.c +++ b/drivers/misc/ibmasm/module.c @@ -18,9 +18,9 @@ * * Copyright (C) IBM Corporation, 2004 * - * Author: Max Asböck <amax@us.ibm.com> + * Author: Max Asböck <amax@us.ibm.com> * - * This driver is based on code originally written by Pete Reynolds + * This driver is based on code originally written by Pete Reynolds * and others. * */ @@ -30,13 +30,13 @@ * * 1) When loaded it sends a message to the service processor, * indicating that an OS is * running. This causes the service processor - * to send periodic heartbeats to the OS. + * to send periodic heartbeats to the OS. * * 2) Answers the periodic heartbeats sent by the service processor. * Failure to do so would result in system reboot. * * 3) Acts as a pass through for dot commands sent from user applications. - * The interface for this is the ibmasmfs file system. + * The interface for this is the ibmasmfs file system. * * 4) Allows user applications to register for event notification. Events * are sent to the driver through interrupts. They can be read from user @@ -77,13 +77,12 @@ static int __devinit ibmasm_init_one(struct pci_dev *pdev, const struct pci_devi /* vnc client won't work without bus-mastering */ pci_set_master(pdev); - sp = kmalloc(sizeof(struct service_processor), GFP_KERNEL); + sp = kzalloc(sizeof(struct service_processor), GFP_KERNEL); if (sp == NULL) { dev_err(&pdev->dev, "Failed to allocate memory\n"); result = -ENOMEM; goto error_kmalloc; } - memset(sp, 0, sizeof(struct service_processor)); spin_lock_init(&sp->lock); INIT_LIST_HEAD(&sp->command_queue); @@ -105,7 +104,7 @@ static int __devinit ibmasm_init_one(struct pci_dev *pdev, const struct pci_devi } sp->irq = pdev->irq; - sp->base_address = ioremap(pci_resource_start(pdev, 0), + sp->base_address = ioremap(pci_resource_start(pdev, 0), pci_resource_len(pdev, 0)); if (sp->base_address == 0) { dev_err(sp->dev, "Failed to ioremap pci memory\n"); diff --git a/drivers/misc/ibmasm/r_heartbeat.c b/drivers/misc/ibmasm/r_heartbeat.c index f8fdb2d5417..bec9e2c44be 100644 --- a/drivers/misc/ibmasm/r_heartbeat.c +++ b/drivers/misc/ibmasm/r_heartbeat.c @@ -16,7 +16,7 @@ * * Copyright (C) IBM Corporation, 2004 * - * Author: Max Asböck <amax@us.ibm.com> + * Author: Max Asböck <amax@us.ibm.com> * */ @@ -36,10 +36,10 @@ static struct { unsigned char command[3]; } rhb_dot_cmd = { .header = { - .type = sp_read, + .type = sp_read, .command_size = 3, .data_size = 0, - .status = 0 + .status = 0 }, .command = { 4, 3, 6 } }; @@ -76,9 +76,9 @@ int ibmasm_start_reverse_heartbeat(struct service_processor *sp, struct reverse_ if (cmd->status != IBMASM_CMD_COMPLETE) times_failed++; - wait_event_interruptible_timeout(rhb->wait, + wait_event_interruptible_timeout(rhb->wait, rhb->stopped, - REVERSE_HEARTBEAT_TIMEOUT * HZ); + REVERSE_HEARTBEAT_TIMEOUT * HZ); if (signal_pending(current) || rhb->stopped) { result = -EINTR; diff --git a/drivers/misc/ibmasm/remote.c b/drivers/misc/ibmasm/remote.c index a40fda6c402..0550ce075fc 100644 --- a/drivers/misc/ibmasm/remote.c +++ b/drivers/misc/ibmasm/remote.c @@ -28,11 +28,10 @@ #include "ibmasm.h" #include "remote.h" -static int xmax = 1600; -static int ymax = 1200; +#define MOUSE_X_MAX 1600 +#define MOUSE_Y_MAX 1200 - -static unsigned short xlate_high[XLATE_SIZE] = { +static const unsigned short xlate_high[XLATE_SIZE] = { [KEY_SYM_ENTER & 0xff] = KEY_ENTER, [KEY_SYM_KPSLASH & 0xff] = KEY_KPSLASH, [KEY_SYM_KPSTAR & 0xff] = KEY_KPASTERISK, @@ -81,7 +80,8 @@ static unsigned short xlate_high[XLATE_SIZE] = { [KEY_SYM_NUM_LOCK & 0xff] = KEY_NUMLOCK, [KEY_SYM_SCR_LOCK & 0xff] = KEY_SCROLLLOCK, }; -static unsigned short xlate[XLATE_SIZE] = { + +static const unsigned short xlate[XLATE_SIZE] = { [NO_KEYCODE] = KEY_RESERVED, [KEY_SYM_SPACE] = KEY_SPACE, [KEY_SYM_TILDE] = KEY_GRAVE, [KEY_SYM_BKTIC] = KEY_GRAVE, @@ -133,19 +133,16 @@ static unsigned short xlate[XLATE_SIZE] = { [KEY_SYM_Z] = KEY_Z, [KEY_SYM_z] = KEY_Z, }; -static char remote_mouse_name[] = "ibmasm RSA I remote mouse"; -static char remote_keybd_name[] = "ibmasm RSA I remote keyboard"; - static void print_input(struct remote_input *input) { if (input->type == INPUT_TYPE_MOUSE) { unsigned char buttons = input->mouse_buttons; dbg("remote mouse movement: (x,y)=(%d,%d)%s%s%s%s\n", input->data.mouse.x, input->data.mouse.y, - (buttons)?" -- buttons:":"", - (buttons & REMOTE_BUTTON_LEFT)?"left ":"", - (buttons & REMOTE_BUTTON_MIDDLE)?"middle ":"", - (buttons & REMOTE_BUTTON_RIGHT)?"right":"" + (buttons) ? " -- buttons:" : "", + (buttons & REMOTE_BUTTON_LEFT) ? "left " : "", + (buttons & REMOTE_BUTTON_MIDDLE) ? "middle " : "", + (buttons & REMOTE_BUTTON_RIGHT) ? "right" : "" ); } else { dbg("remote keypress (code, flag, down):" @@ -180,7 +177,7 @@ static void send_keyboard_event(struct input_dev *dev, key = xlate_high[code & 0xff]; else key = xlate[code]; - input_report_key(dev, key, (input->data.keyboard.key_down) ? 1 : 0); + input_report_key(dev, key, input->data.keyboard.key_down); input_sync(dev); } @@ -228,20 +225,22 @@ int ibmasm_init_remote_input_dev(struct service_processor *sp) mouse_dev->id.vendor = pdev->vendor; mouse_dev->id.product = pdev->device; mouse_dev->id.version = 1; + mouse_dev->dev.parent = sp->dev; mouse_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); mouse_dev->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_RIGHT) | BIT(BTN_MIDDLE); set_bit(BTN_TOUCH, mouse_dev->keybit); - mouse_dev->name = remote_mouse_name; - input_set_abs_params(mouse_dev, ABS_X, 0, xmax, 0, 0); - input_set_abs_params(mouse_dev, ABS_Y, 0, ymax, 0, 0); + mouse_dev->name = "ibmasm RSA I remote mouse"; + input_set_abs_params(mouse_dev, ABS_X, 0, MOUSE_X_MAX, 0, 0); + input_set_abs_params(mouse_dev, ABS_Y, 0, MOUSE_Y_MAX, 0, 0); - mouse_dev->id.bustype = BUS_PCI; + keybd_dev->id.bustype = BUS_PCI; keybd_dev->id.vendor = pdev->vendor; keybd_dev->id.product = pdev->device; - mouse_dev->id.version = 2; + keybd_dev->id.version = 2; + keybd_dev->dev.parent = sp->dev; keybd_dev->evbit[0] = BIT(EV_KEY); - keybd_dev->name = remote_keybd_name; + keybd_dev->name = "ibmasm RSA I remote keyboard"; for (i = 0; i < XLATE_SIZE; i++) { if (xlate_high[i]) diff --git a/drivers/misc/ibmasm/remote.h b/drivers/misc/ibmasm/remote.h index b7076a8442d..72acf5af7a2 100644 --- a/drivers/misc/ibmasm/remote.h +++ b/drivers/misc/ibmasm/remote.h @@ -18,7 +18,7 @@ * * Copyright (C) IBM Corporation, 2004 * - * Author: Max Asböck <amax@us.ibm.com> + * Author: Max Asböck <amax@us.ibm.com> * * Orignally written by Pete Reynolds */ @@ -73,7 +73,7 @@ struct keyboard_input { -struct remote_input { +struct remote_input { union { struct mouse_input mouse; struct keyboard_input keyboard; @@ -85,7 +85,7 @@ struct remote_input { unsigned char pad3; }; -#define mouse_addr(sp) (sp->base_address + CONDOR_MOUSE_DATA) +#define mouse_addr(sp) (sp->base_address + CONDOR_MOUSE_DATA) #define display_width(sp) (mouse_addr(sp) + CONDOR_INPUT_DISPLAY_RESX) #define display_height(sp) (mouse_addr(sp) + CONDOR_INPUT_DISPLAY_RESY) #define display_depth(sp) (mouse_addr(sp) + CONDOR_INPUT_DISPLAY_BITS) @@ -93,7 +93,7 @@ struct remote_input { #define vnc_status(sp) (mouse_addr(sp) + CONDOR_OUTPUT_VNC_STATUS) #define isr_control(sp) (mouse_addr(sp) + CONDOR_MOUSE_ISR_CONTROL) -#define mouse_interrupt_pending(sp) readl(mouse_addr(sp) + CONDOR_MOUSE_ISR_STATUS) +#define mouse_interrupt_pending(sp) readl(mouse_addr(sp) + CONDOR_MOUSE_ISR_STATUS) #define clear_mouse_interrupt(sp) writel(0, mouse_addr(sp) + CONDOR_MOUSE_ISR_STATUS) #define enable_mouse_interrupts(sp) writel(1, mouse_addr(sp) + CONDOR_MOUSE_ISR_CONTROL) #define disable_mouse_interrupts(sp) writel(0, mouse_addr(sp) + CONDOR_MOUSE_ISR_CONTROL) diff --git a/drivers/misc/ibmasm/uart.c b/drivers/misc/ibmasm/uart.c index 9783caf4969..93baa350d69 100644 --- a/drivers/misc/ibmasm/uart.c +++ b/drivers/misc/ibmasm/uart.c @@ -18,7 +18,7 @@ * * Copyright (C) IBM Corporation, 2004 * - * Author: Max Asböck <amax@us.ibm.com> + * Author: Max Asböck <amax@us.ibm.com> * */ diff --git a/drivers/misc/msi-laptop.c b/drivers/misc/msi-laptop.c index 41e901f53e7..932a415197b 100644 --- a/drivers/misc/msi-laptop.c +++ b/drivers/misc/msi-laptop.c @@ -23,6 +23,8 @@ * msi-laptop.c - MSI S270 laptop support. This laptop is sold under * various brands, including "Cytron/TCM/Medion/Tchibo MD96100". * + * Driver also supports S271, S420 models. + * * This driver exports a few files in /sys/devices/platform/msi-laptop-pf/: * * lcd_level - Screen brightness: contains a single integer in the @@ -281,25 +283,56 @@ static struct platform_device *msipf_device; /* Initialization */ +static int dmi_check_cb(struct dmi_system_id *id) +{ + printk("msi-laptop: Identified laptop model '%s'.\n", id->ident); + return 0; +} + static struct dmi_system_id __initdata msi_dmi_table[] = { { .ident = "MSI S270", .matches = { DMI_MATCH(DMI_SYS_VENDOR, "MICRO-STAR INT'L CO.,LTD"), DMI_MATCH(DMI_PRODUCT_NAME, "MS-1013"), - } + DMI_MATCH(DMI_PRODUCT_VERSION, "0131"), + DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-STAR INT'L CO.,LTD") + }, + .callback = dmi_check_cb + }, + { + .ident = "MSI S271", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International"), + DMI_MATCH(DMI_PRODUCT_NAME, "MS-1058"), + DMI_MATCH(DMI_PRODUCT_VERSION, "0581"), + DMI_MATCH(DMI_BOARD_NAME, "MS-1058") + }, + .callback = dmi_check_cb + }, + { + .ident = "MSI S420", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International"), + DMI_MATCH(DMI_PRODUCT_NAME, "MS-1412"), + DMI_MATCH(DMI_BOARD_VENDOR, "MSI"), + DMI_MATCH(DMI_BOARD_NAME, "MS-1412") + }, + .callback = dmi_check_cb }, { .ident = "Medion MD96100", .matches = { DMI_MATCH(DMI_SYS_VENDOR, "NOTEBOOK"), DMI_MATCH(DMI_PRODUCT_NAME, "SAM2000"), - } + DMI_MATCH(DMI_PRODUCT_VERSION, "0131"), + DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-STAR INT'L CO.,LTD") + }, + .callback = dmi_check_cb }, { } }; - static int __init msi_init(void) { int ret; @@ -394,3 +427,8 @@ MODULE_AUTHOR("Lennart Poettering"); MODULE_DESCRIPTION("MSI Laptop Support"); MODULE_VERSION(MSI_DRIVER_VERSION); MODULE_LICENSE("GPL"); + +MODULE_ALIAS("dmi:*:svnMICRO-STARINT'LCO.,LTD:pnMS-1013:pvr0131*:cvnMICRO-STARINT'LCO.,LTD:ct10:*"); +MODULE_ALIAS("dmi:*:svnMicro-StarInternational:pnMS-1058:pvr0581:rvnMSI:rnMS-1058:*:ct10:*"); +MODULE_ALIAS("dmi:*:svnMicro-StarInternational:pnMS-1412:*:rvnMSI:rnMS-1412:*:cvnMICRO-STARINT'LCO.,LTD:ct10:*"); +MODULE_ALIAS("dmi:*:svnNOTEBOOK:pnSAM2000:pvr0131*:cvnMICRO-STARINT'LCO.,LTD:ct10:*"); diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c index 8ee0321ef1c..9623eaf4f89 100644 --- a/drivers/misc/sony-laptop.c +++ b/drivers/misc/sony-laptop.c @@ -1917,7 +1917,8 @@ end: */ static int sony_pic_disable(struct acpi_device *device) { - if (ACPI_FAILURE(acpi_evaluate_object(device->handle, "_DIS", 0, NULL))) + if (ACPI_FAILURE(acpi_evaluate_object(device->handle, + "_DIS", NULL, NULL))) return -ENXIO; dprintk("Device disabled\n"); |