Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mjg59/platform-drivers-x86
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mjg59/platform-drivers-x86: (88 commits) ips driver: make it less chatty intel_scu_ipc: fix size field for intel_scu_ipc_command intel_scu_ipc: return -EIO for error condition in busy_loop intel_scu_ipc: fix data packing of PMIC command on Moorestown Clean up command packing on MRST. zero the stack buffer before giving random garbage to the SCU Fix stack buffer size for IPC writev messages intel_scu_ipc: Use the new cpu identification function intel_scu_ipc: tidy up unused bits Remove indirect read write api support. intel_scu_ipc: Support Medfield processors intel_scu_ipc: detect CPU type automatically x86 plat: limit x86 platform driver menu to X86 acpi ec_sys: Be more cautious about ec write access acpi ec: Fix possible double io port registration hp-wmi: acpi_drivers.h is already included through acpi.h two lines below hp-wmi: Fix mixing up of and/or directive dell-laptop: make dell_laptop_i8042_filter() static asus-laptop: fix asus_input_init error path msi-wmi: make needlessly global symbols static ...
This commit is contained in:
commit
c145307a11
|
@ -0,0 +1,20 @@
|
|||
What: /sys/kernel/debug/ec/*/{gpe,use_global_lock,io}
|
||||
Date: July 2010
|
||||
Contact: Thomas Renninger <trenn@suse.de>
|
||||
Description:
|
||||
|
||||
General information like which GPE is assigned to the EC and whether
|
||||
the global lock should get used.
|
||||
Knowing the EC GPE one can watch the amount of HW events related to
|
||||
the EC here (XY -> GPE number from /sys/kernel/debug/ec/*/gpe):
|
||||
/sys/firmware/acpi/interrupts/gpeXY
|
||||
|
||||
The io file is binary and a userspace tool located here:
|
||||
ftp://ftp.suse.com/pub/people/trenn/sources/ec/
|
||||
should get used to read out the 256 Embedded Controller registers
|
||||
or writing to them.
|
||||
|
||||
CAUTION: Do not write to the Embedded Controller if you don't know
|
||||
what you are doing! Rebooting afterwards also is a good idea.
|
||||
This can influence the way your machine is cooled and fans may
|
||||
not get switched on again after you did a wrong write.
|
|
@ -960,70 +960,21 @@ Sysfs notes:
|
|||
subsystem, and follow all of the hwmon guidelines at
|
||||
Documentation/hwmon.
|
||||
|
||||
EXPERIMENTAL: Embedded controller register dump
|
||||
-----------------------------------------------
|
||||
|
||||
EXPERIMENTAL: Embedded controller register dump -- /proc/acpi/ibm/ecdump
|
||||
------------------------------------------------------------------------
|
||||
This feature is not included in the thinkpad driver anymore.
|
||||
Instead the EC can be accessed through /sys/kernel/debug/ec with
|
||||
a userspace tool which can be found here:
|
||||
ftp://ftp.suse.com/pub/people/trenn/sources/ec
|
||||
|
||||
This feature is marked EXPERIMENTAL because the implementation
|
||||
directly accesses hardware registers and may not work as expected. USE
|
||||
WITH CAUTION! To use this feature, you need to supply the
|
||||
experimental=1 parameter when loading the module.
|
||||
|
||||
This feature dumps the values of 256 embedded controller
|
||||
registers. Values which have changed since the last time the registers
|
||||
were dumped are marked with a star:
|
||||
|
||||
[root@x40 ibm-acpi]# cat /proc/acpi/ibm/ecdump
|
||||
EC +00 +01 +02 +03 +04 +05 +06 +07 +08 +09 +0a +0b +0c +0d +0e +0f
|
||||
EC 0x00: a7 47 87 01 fe 96 00 08 01 00 cb 00 00 00 40 00
|
||||
EC 0x10: 00 00 ff ff f4 3c 87 09 01 ff 42 01 ff ff 0d 00
|
||||
EC 0x20: 00 00 00 00 00 00 00 00 00 00 00 03 43 00 00 80
|
||||
EC 0x30: 01 07 1a 00 30 04 00 00 *85 00 00 10 00 50 00 00
|
||||
EC 0x40: 00 00 00 00 00 00 14 01 00 04 00 00 00 00 00 00
|
||||
EC 0x50: 00 c0 02 0d 00 01 01 02 02 03 03 03 03 *bc *02 *bc
|
||||
EC 0x60: *02 *bc *02 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
EC 0x70: 00 00 00 00 00 12 30 40 *24 *26 *2c *27 *20 80 *1f 80
|
||||
EC 0x80: 00 00 00 06 *37 *0e 03 00 00 00 0e 07 00 00 00 00
|
||||
EC 0x90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
EC 0xa0: *ff 09 ff 09 ff ff *64 00 *00 *00 *a2 41 *ff *ff *e0 00
|
||||
EC 0xb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
EC 0xc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
EC 0xd0: 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
EC 0xe0: 00 00 00 00 00 00 00 00 11 20 49 04 24 06 55 03
|
||||
EC 0xf0: 31 55 48 54 35 38 57 57 08 2f 45 73 07 65 6c 1a
|
||||
|
||||
This feature can be used to determine the register holding the fan
|
||||
Use it to determine the register holding the fan
|
||||
speed on some models. To do that, do the following:
|
||||
|
||||
- make sure the battery is fully charged
|
||||
- make sure the fan is running
|
||||
- run 'cat /proc/acpi/ibm/ecdump' several times, once per second or so
|
||||
- use above mentioned tool to read out the EC
|
||||
|
||||
The first step makes sure various charging-related values don't
|
||||
vary. The second ensures that the fan-related values do vary, since
|
||||
the fan speed fluctuates a bit. The third will (hopefully) mark the
|
||||
fan register with a star:
|
||||
|
||||
[root@x40 ibm-acpi]# cat /proc/acpi/ibm/ecdump
|
||||
EC +00 +01 +02 +03 +04 +05 +06 +07 +08 +09 +0a +0b +0c +0d +0e +0f
|
||||
EC 0x00: a7 47 87 01 fe 96 00 08 01 00 cb 00 00 00 40 00
|
||||
EC 0x10: 00 00 ff ff f4 3c 87 09 01 ff 42 01 ff ff 0d 00
|
||||
EC 0x20: 00 00 00 00 00 00 00 00 00 00 00 03 43 00 00 80
|
||||
EC 0x30: 01 07 1a 00 30 04 00 00 85 00 00 10 00 50 00 00
|
||||
EC 0x40: 00 00 00 00 00 00 14 01 00 04 00 00 00 00 00 00
|
||||
EC 0x50: 00 c0 02 0d 00 01 01 02 02 03 03 03 03 bc 02 bc
|
||||
EC 0x60: 02 bc 02 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
EC 0x70: 00 00 00 00 00 12 30 40 24 27 2c 27 21 80 1f 80
|
||||
EC 0x80: 00 00 00 06 *be 0d 03 00 00 00 0e 07 00 00 00 00
|
||||
EC 0x90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
EC 0xa0: ff 09 ff 09 ff ff 64 00 00 00 a2 41 ff ff e0 00
|
||||
EC 0xb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
EC 0xc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
EC 0xd0: 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
EC 0xe0: 00 00 00 00 00 00 00 00 11 20 49 04 24 06 55 03
|
||||
EC 0xf0: 31 55 48 54 35 38 57 57 08 2f 45 73 07 65 6c 1a
|
||||
|
||||
Another set of values that varies often is the temperature
|
||||
Often fan and temperature values vary between
|
||||
readings. Since temperatures don't change vary fast, you can take
|
||||
several quick dumps to eliminate them.
|
||||
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
#ifndef _ASM_X86_INTEL_SCU_IPC_H_
|
||||
#define _ASM_X86_INTEL_SCU_IPC_H_
|
||||
|
||||
#define IPCMSG_VRTC 0xFA /* Set vRTC device */
|
||||
|
||||
/* Command id associated with message IPCMSG_VRTC */
|
||||
#define IPC_CMD_VRTC_SETTIME 1 /* Set time */
|
||||
#define IPC_CMD_VRTC_SETALARM 2 /* Set alarm */
|
||||
|
||||
/* Read single register */
|
||||
int intel_scu_ipc_ioread8(u16 addr, u8 *data);
|
||||
|
||||
|
@ -28,20 +34,6 @@ int intel_scu_ipc_writev(u16 *addr, u8 *data, int len);
|
|||
/* Update single register based on the mask */
|
||||
int intel_scu_ipc_update_register(u16 addr, u8 data, u8 mask);
|
||||
|
||||
/*
|
||||
* Indirect register read
|
||||
* Can be used when SCCB(System Controller Configuration Block) register
|
||||
* HRIM(Honor Restricted IPC Messages) is set (bit 23)
|
||||
*/
|
||||
int intel_scu_ipc_register_read(u32 addr, u32 *data);
|
||||
|
||||
/*
|
||||
* Indirect register write
|
||||
* Can be used when SCCB(System Controller Configuration Block) register
|
||||
* HRIM(Honor Restricted IPC Messages) is set (bit 23)
|
||||
*/
|
||||
int intel_scu_ipc_register_write(u32 addr, u32 data);
|
||||
|
||||
/* Issue commands to the SCU with or without data */
|
||||
int intel_scu_ipc_simple_command(int cmd, int sub);
|
||||
int intel_scu_ipc_command(int cmd, int sub, u32 *in, int inlen,
|
||||
|
|
|
@ -104,6 +104,24 @@ config ACPI_SYSFS_POWER
|
|||
help
|
||||
Say N to disable power /sys interface
|
||||
|
||||
config ACPI_EC_DEBUGFS
|
||||
tristate "EC read/write access through /sys/kernel/debug/ec"
|
||||
default n
|
||||
help
|
||||
Say N to disable Embedded Controller /sys/kernel/debug interface
|
||||
|
||||
Be aware that using this interface can confuse your Embedded
|
||||
Controller in a way that a normal reboot is not enough. You then
|
||||
have to power of your system, and remove the laptop battery for
|
||||
some seconds.
|
||||
An Embedded Controller typically is available on laptops and reads
|
||||
sensor values like battery state and temperature.
|
||||
The kernel accesses the EC through ACPI parsed code provided by BIOS
|
||||
tables. This option allows to access the EC directly without ACPI
|
||||
code being involved.
|
||||
Thus this option is a debug option that helps to write ACPI drivers
|
||||
and can be used to identify ACPI code or EC firmware bugs.
|
||||
|
||||
config ACPI_PROC_EVENT
|
||||
bool "Deprecated /proc/acpi/event support"
|
||||
depends on PROC_FS
|
||||
|
|
|
@ -60,6 +60,7 @@ obj-$(CONFIG_ACPI_SBS) += sbshc.o
|
|||
obj-$(CONFIG_ACPI_SBS) += sbs.o
|
||||
obj-$(CONFIG_ACPI_POWER_METER) += power_meter.o
|
||||
obj-$(CONFIG_ACPI_HED) += hed.o
|
||||
obj-$(CONFIG_ACPI_EC_DEBUGFS) += ec_sys.o
|
||||
|
||||
# processor has its own "processor." module_param namespace
|
||||
processor-y := processor_driver.o processor_throttling.o
|
||||
|
|
|
@ -34,8 +34,6 @@
|
|||
#include <linux/init.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/spinlock.h>
|
||||
|
@ -45,10 +43,13 @@
|
|||
#include <acpi/acpi_drivers.h>
|
||||
#include <linux/dmi.h>
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
#define ACPI_EC_CLASS "embedded_controller"
|
||||
#define ACPI_EC_DEVICE_NAME "Embedded Controller"
|
||||
#define ACPI_EC_FILE_INFO "info"
|
||||
|
||||
#undef PREFIX
|
||||
#define PREFIX "ACPI: EC: "
|
||||
|
||||
/* EC status register */
|
||||
|
@ -106,19 +107,8 @@ struct transaction {
|
|||
bool done;
|
||||
};
|
||||
|
||||
static struct acpi_ec {
|
||||
acpi_handle handle;
|
||||
unsigned long gpe;
|
||||
unsigned long command_addr;
|
||||
unsigned long data_addr;
|
||||
unsigned long global_lock;
|
||||
unsigned long flags;
|
||||
struct mutex lock;
|
||||
wait_queue_head_t wait;
|
||||
struct list_head list;
|
||||
struct transaction *curr;
|
||||
spinlock_t curr_lock;
|
||||
} *boot_ec, *first_ec;
|
||||
struct acpi_ec *boot_ec, *first_ec;
|
||||
EXPORT_SYMBOL(first_ec);
|
||||
|
||||
static int EC_FLAGS_MSI; /* Out-of-spec MSI controller */
|
||||
static int EC_FLAGS_VALIDATE_ECDT; /* ASUStec ECDTs need to be validated */
|
||||
|
@ -678,72 +668,6 @@ acpi_ec_space_handler(u32 function, acpi_physical_address address,
|
|||
}
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
FS Interface (/proc)
|
||||
-------------------------------------------------------------------------- */
|
||||
|
||||
static struct proc_dir_entry *acpi_ec_dir;
|
||||
|
||||
static int acpi_ec_read_info(struct seq_file *seq, void *offset)
|
||||
{
|
||||
struct acpi_ec *ec = seq->private;
|
||||
|
||||
if (!ec)
|
||||
goto end;
|
||||
|
||||
seq_printf(seq, "gpe:\t\t\t0x%02x\n", (u32) ec->gpe);
|
||||
seq_printf(seq, "ports:\t\t\t0x%02x, 0x%02x\n",
|
||||
(unsigned)ec->command_addr, (unsigned)ec->data_addr);
|
||||
seq_printf(seq, "use global lock:\t%s\n",
|
||||
ec->global_lock ? "yes" : "no");
|
||||
end:
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int acpi_ec_info_open_fs(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, acpi_ec_read_info, PDE(inode)->data);
|
||||
}
|
||||
|
||||
static const struct file_operations acpi_ec_info_ops = {
|
||||
.open = acpi_ec_info_open_fs,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
.owner = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int acpi_ec_add_fs(struct acpi_device *device)
|
||||
{
|
||||
struct proc_dir_entry *entry = NULL;
|
||||
|
||||
if (!acpi_device_dir(device)) {
|
||||
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
|
||||
acpi_ec_dir);
|
||||
if (!acpi_device_dir(device))
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
entry = proc_create_data(ACPI_EC_FILE_INFO, S_IRUGO,
|
||||
acpi_device_dir(device),
|
||||
&acpi_ec_info_ops, acpi_driver_data(device));
|
||||
if (!entry)
|
||||
return -ENODEV;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int acpi_ec_remove_fs(struct acpi_device *device)
|
||||
{
|
||||
|
||||
if (acpi_device_dir(device)) {
|
||||
remove_proc_entry(ACPI_EC_FILE_INFO, acpi_device_dir(device));
|
||||
remove_proc_entry(acpi_device_bid(device), acpi_ec_dir);
|
||||
acpi_device_dir(device) = NULL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
Driver Interface
|
||||
-------------------------------------------------------------------------- */
|
||||
|
@ -894,7 +818,12 @@ static int acpi_ec_add(struct acpi_device *device)
|
|||
if (!first_ec)
|
||||
first_ec = ec;
|
||||
device->driver_data = ec;
|
||||
acpi_ec_add_fs(device);
|
||||
|
||||
WARN(!request_region(ec->data_addr, 1, "EC data"),
|
||||
"Could not request EC data io port 0x%lx", ec->data_addr);
|
||||
WARN(!request_region(ec->command_addr, 1, "EC cmd"),
|
||||
"Could not request EC cmd io port 0x%lx", ec->command_addr);
|
||||
|
||||
pr_info(PREFIX "GPE = 0x%lx, I/O: command/status = 0x%lx, data = 0x%lx\n",
|
||||
ec->gpe, ec->command_addr, ec->data_addr);
|
||||
|
||||
|
@ -921,7 +850,8 @@ static int acpi_ec_remove(struct acpi_device *device, int type)
|
|||
kfree(handler);
|
||||
}
|
||||
mutex_unlock(&ec->lock);
|
||||
acpi_ec_remove_fs(device);
|
||||
release_region(ec->data_addr, 1);
|
||||
release_region(ec->command_addr, 1);
|
||||
device->driver_data = NULL;
|
||||
if (ec == first_ec)
|
||||
first_ec = NULL;
|
||||
|
@ -1120,16 +1050,10 @@ int __init acpi_ec_init(void)
|
|||
{
|
||||
int result = 0;
|
||||
|
||||
acpi_ec_dir = proc_mkdir(ACPI_EC_CLASS, acpi_root_dir);
|
||||
if (!acpi_ec_dir)
|
||||
return -ENODEV;
|
||||
|
||||
/* Now register the driver for the EC */
|
||||
result = acpi_bus_register_driver(&acpi_ec_driver);
|
||||
if (result < 0) {
|
||||
remove_proc_entry(ACPI_EC_CLASS, acpi_root_dir);
|
||||
if (result < 0)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -1140,9 +1064,6 @@ static void __exit acpi_ec_exit(void)
|
|||
{
|
||||
|
||||
acpi_bus_unregister_driver(&acpi_ec_driver);
|
||||
|
||||
remove_proc_entry(ACPI_EC_CLASS, acpi_root_dir);
|
||||
|
||||
return;
|
||||
}
|
||||
#endif /* 0 */
|
||||
|
|
|
@ -0,0 +1,160 @@
|
|||
/*
|
||||
* ec_sys.c
|
||||
*
|
||||
* Copyright (C) 2010 SUSE Products GmbH/Novell
|
||||
* Author:
|
||||
* Thomas Renninger <trenn@suse.de>
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2.
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/debugfs.h>
|
||||
#include "internal.h"
|
||||
|
||||
MODULE_AUTHOR("Thomas Renninger <trenn@suse.de>");
|
||||
MODULE_DESCRIPTION("ACPI EC sysfs access driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
static bool write_support;
|
||||
module_param(write_support, bool, 0644);
|
||||
MODULE_PARM_DESC(write_support, "Dangerous, reboot and removal of battery may "
|
||||
"be needed.");
|
||||
|
||||
#define EC_SPACE_SIZE 256
|
||||
|
||||
struct sysdev_class acpi_ec_sysdev_class = {
|
||||
.name = "ec",
|
||||
};
|
||||
|
||||
static struct dentry *acpi_ec_debugfs_dir;
|
||||
|
||||
static int acpi_ec_open_io(struct inode *i, struct file *f)
|
||||
{
|
||||
f->private_data = i->i_private;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ssize_t acpi_ec_read_io(struct file *f, char __user *buf,
|
||||
size_t count, loff_t *off)
|
||||
{
|
||||
/* Use this if support reading/writing multiple ECs exists in ec.c:
|
||||
* struct acpi_ec *ec = ((struct seq_file *)f->private_data)->private;
|
||||
*/
|
||||
unsigned int size = EC_SPACE_SIZE;
|
||||
u8 *data = (u8 *) buf;
|
||||
loff_t init_off = *off;
|
||||
int err = 0;
|
||||
|
||||
if (*off >= size)
|
||||
return 0;
|
||||
if (*off + count >= size) {
|
||||
size -= *off;
|
||||
count = size;
|
||||
} else
|
||||
size = count;
|
||||
|
||||
while (size) {
|
||||
err = ec_read(*off, &data[*off - init_off]);
|
||||
if (err)
|
||||
return err;
|
||||
*off += 1;
|
||||
size--;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t acpi_ec_write_io(struct file *f, const char __user *buf,
|
||||
size_t count, loff_t *off)
|
||||
{
|
||||
/* Use this if support reading/writing multiple ECs exists in ec.c:
|
||||
* struct acpi_ec *ec = ((struct seq_file *)f->private_data)->private;
|
||||
*/
|
||||
|
||||
unsigned int size = count;
|
||||
loff_t init_off = *off;
|
||||
u8 *data = (u8 *) buf;
|
||||
int err = 0;
|
||||
|
||||
if (*off >= EC_SPACE_SIZE)
|
||||
return 0;
|
||||
if (*off + count >= EC_SPACE_SIZE) {
|
||||
size = EC_SPACE_SIZE - *off;
|
||||
count = size;
|
||||
}
|
||||
|
||||
while (size) {
|
||||
u8 byte_write = data[*off - init_off];
|
||||
err = ec_write(*off, byte_write);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
*off += 1;
|
||||
size--;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
static struct file_operations acpi_ec_io_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = acpi_ec_open_io,
|
||||
.read = acpi_ec_read_io,
|
||||
.write = acpi_ec_write_io,
|
||||
};
|
||||
|
||||
int acpi_ec_add_debugfs(struct acpi_ec *ec, unsigned int ec_device_count)
|
||||
{
|
||||
struct dentry *dev_dir;
|
||||
char name[64];
|
||||
mode_t mode = 0400;
|
||||
|
||||
if (ec_device_count == 0) {
|
||||
acpi_ec_debugfs_dir = debugfs_create_dir("ec", NULL);
|
||||
if (!acpi_ec_debugfs_dir)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
sprintf(name, "ec%u", ec_device_count);
|
||||
dev_dir = debugfs_create_dir(name, acpi_ec_debugfs_dir);
|
||||
if (!dev_dir) {
|
||||
if (ec_device_count != 0)
|
||||
goto error;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
if (!debugfs_create_x32("gpe", 0444, dev_dir, (u32 *)&first_ec->gpe))
|
||||
goto error;
|
||||
if (!debugfs_create_bool("use_global_lock", 0444, dev_dir,
|
||||
(u32 *)&first_ec->global_lock))
|
||||
goto error;
|
||||
|
||||
if (write_support)
|
||||
mode = 0600;
|
||||
if (!debugfs_create_file("io", mode, dev_dir, ec, &acpi_ec_io_ops))
|
||||
goto error;
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
debugfs_remove_recursive(acpi_ec_debugfs_dir);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
static int __init acpi_ec_sys_init(void)
|
||||
{
|
||||
int err = 0;
|
||||
if (first_ec)
|
||||
err = acpi_ec_add_debugfs(first_ec, 0);
|
||||
else
|
||||
err = -ENODEV;
|
||||
return err;
|
||||
}
|
||||
|
||||
static void __exit acpi_ec_sys_exit(void)
|
||||
{
|
||||
debugfs_remove_recursive(acpi_ec_debugfs_dir);
|
||||
}
|
||||
|
||||
module_init(acpi_ec_sys_init);
|
||||
module_exit(acpi_ec_sys_exit);
|
|
@ -18,6 +18,11 @@
|
|||
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef _ACPI_INTERNAL_H_
|
||||
#define _ACPI_INTERNAL_H_
|
||||
|
||||
#include <linux/sysdev.h>
|
||||
|
||||
#define PREFIX "ACPI: "
|
||||
|
||||
int init_acpi_device_notify(void);
|
||||
|
@ -46,6 +51,23 @@ void acpi_early_processor_set_pdc(void);
|
|||
/* --------------------------------------------------------------------------
|
||||
Embedded Controller
|
||||
-------------------------------------------------------------------------- */
|
||||
struct acpi_ec {
|
||||
acpi_handle handle;
|
||||
unsigned long gpe;
|
||||
unsigned long command_addr;
|
||||
unsigned long data_addr;
|
||||
unsigned long global_lock;
|
||||
unsigned long flags;
|
||||
struct mutex lock;
|
||||
wait_queue_head_t wait;
|
||||
struct list_head list;
|
||||
struct transaction *curr;
|
||||
spinlock_t curr_lock;
|
||||
struct sys_device sysdev;
|
||||
};
|
||||
|
||||
extern struct acpi_ec *first_ec;
|
||||
|
||||
int acpi_ec_init(void);
|
||||
int acpi_ec_ecdt_probe(void);
|
||||
int acpi_boot_ec_enable(void);
|
||||
|
@ -63,3 +85,5 @@ int acpi_sleep_proc_init(void);
|
|||
#else
|
||||
static inline int acpi_sleep_proc_init(void) { return 0; }
|
||||
#endif
|
||||
|
||||
#endif /* _ACPI_INTERNAL_H_ */
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
menuconfig X86_PLATFORM_DEVICES
|
||||
bool "X86 Platform Specific Device Drivers"
|
||||
default y
|
||||
depends on X86
|
||||
---help---
|
||||
Say Y here to get to see options for device drivers for various
|
||||
x86 platforms, including vendor-specific laptop extension drivers.
|
||||
|
@ -151,6 +152,7 @@ config MSI_LAPTOP
|
|||
depends on ACPI
|
||||
depends on BACKLIGHT_CLASS_DEVICE
|
||||
depends on RFKILL
|
||||
depends on SERIO_I8042
|
||||
---help---
|
||||
This is a driver for laptops built by MSI (MICRO-STAR
|
||||
INTERNATIONAL):
|
||||
|
@ -181,6 +183,8 @@ config COMPAL_LAPTOP
|
|||
depends on ACPI
|
||||
depends on BACKLIGHT_CLASS_DEVICE
|
||||
depends on RFKILL
|
||||
depends on HWMON
|
||||
depends on POWER_SUPPLY
|
||||
---help---
|
||||
This is a driver for laptops built by Compal:
|
||||
|
||||
|
@ -520,6 +524,7 @@ config TOSHIBA_BT_RFKILL
|
|||
config ACPI_CMPC
|
||||
tristate "CMPC Laptop Extras"
|
||||
depends on X86 && ACPI
|
||||
depends on RFKILL || RFKILL=n
|
||||
select INPUT
|
||||
select BACKLIGHT_CLASS_DEVICE
|
||||
default n
|
||||
|
@ -537,4 +542,43 @@ config INTEL_SCU_IPC
|
|||
some embedded Intel x86 platforms. This is not needed for PC-type
|
||||
machines.
|
||||
|
||||
config GPIO_INTEL_PMIC
|
||||
bool "Intel PMIC GPIO support"
|
||||
depends on INTEL_SCU_IPC && GPIOLIB
|
||||
---help---
|
||||
Say Y here to support GPIO via the SCU IPC interface
|
||||
on Intel MID platforms.
|
||||
|
||||
config RAR_REGISTER
|
||||
bool "Restricted Access Region Register Driver"
|
||||
depends on PCI && X86_MRST
|
||||
default n
|
||||
---help---
|
||||
This driver allows other kernel drivers access to the
|
||||
contents of the restricted access region control registers.
|
||||
|
||||
The restricted access region control registers
|
||||
(rar_registers) are used to pass address and
|
||||
locking information on restricted access regions
|
||||
to other drivers that use restricted access regions.
|
||||
|
||||
The restricted access regions are regions of memory
|
||||
on the Intel MID Platform that are not accessible to
|
||||
the x86 processor, but are accessible to dedicated
|
||||
processors on board peripheral devices.
|
||||
|
||||
The purpose of the restricted access regions is to
|
||||
protect sensitive data from compromise by unauthorized
|
||||
programs running on the x86 processor.
|
||||
|
||||
config INTEL_IPS
|
||||
tristate "Intel Intelligent Power Sharing"
|
||||
depends on ACPI
|
||||
---help---
|
||||
Intel Calpella platforms support dynamic power sharing between the
|
||||
CPU and GPU, maximizing performance in a given TDP. This driver,
|
||||
along with the CPU frequency and i915 drivers, provides that
|
||||
functionality. If in doubt, say Y here; it will only load on
|
||||
supported platforms.
|
||||
|
||||
endif # X86_PLATFORM_DEVICES
|
||||
|
|
|
@ -26,3 +26,7 @@ obj-$(CONFIG_TOPSTAR_LAPTOP) += topstar-laptop.o
|
|||
obj-$(CONFIG_ACPI_TOSHIBA) += toshiba_acpi.o
|
||||
obj-$(CONFIG_TOSHIBA_BT_RFKILL) += toshiba_bluetooth.o
|
||||
obj-$(CONFIG_INTEL_SCU_IPC) += intel_scu_ipc.o
|
||||
obj-$(CONFIG_RAR_REGISTER) += intel_rar_register.o
|
||||
obj-$(CONFIG_INTEL_IPS) += intel_ips.o
|
||||
obj-$(CONFIG_GPIO_INTEL_PMIC) += intel_pmic_gpio.o
|
||||
|
||||
|
|
|
@ -49,17 +49,6 @@ MODULE_LICENSE("GPL");
|
|||
#define ACER_NOTICE KERN_NOTICE ACER_LOGPREFIX
|
||||
#define ACER_INFO KERN_INFO ACER_LOGPREFIX
|
||||
|
||||
/*
|
||||
* The following defines quirks to get some specific functions to work
|
||||
* which are known to not be supported over ACPI-WMI (such as the mail LED
|
||||
* on WMID based Acer's)
|
||||
*/
|
||||
struct acer_quirks {
|
||||
const char *vendor;
|
||||
const char *model;
|
||||
u16 quirks;
|
||||
};
|
||||
|
||||
/*
|
||||
* Magic Number
|
||||
* Meaning is unknown - this number is required for writing to ACPI for AMW0
|
||||
|
@ -200,7 +189,7 @@ static void set_quirks(void)
|
|||
static int dmi_matched(const struct dmi_system_id *dmi)
|
||||
{
|
||||
quirks = dmi->driver_data;
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static struct quirk_entry quirk_unknown = {
|
||||
|
@ -555,6 +544,7 @@ static acpi_status AMW0_find_mailled(void)
|
|||
obj->buffer.length == sizeof(struct wmab_ret)) {
|
||||
ret = *((struct wmab_ret *) obj->buffer.pointer);
|
||||
} else {
|
||||
kfree(out.pointer);
|
||||
return AE_ERROR;
|
||||
}
|
||||
|
||||
|
@ -570,7 +560,7 @@ static acpi_status AMW0_set_capabilities(void)
|
|||
{
|
||||
struct wmab_args args;
|
||||
struct wmab_ret ret;
|
||||
acpi_status status = AE_OK;
|
||||
acpi_status status;
|
||||
struct acpi_buffer out = { ACPI_ALLOCATE_BUFFER, NULL };
|
||||
union acpi_object *obj;
|
||||
|
||||
|
@ -593,12 +583,13 @@ static acpi_status AMW0_set_capabilities(void)
|
|||
if (ACPI_FAILURE(status))
|
||||
return status;
|
||||
|
||||
obj = (union acpi_object *) out.pointer;
|
||||
obj = out.pointer;
|
||||
if (obj && obj->type == ACPI_TYPE_BUFFER &&
|
||||
obj->buffer.length == sizeof(struct wmab_ret)) {
|
||||
ret = *((struct wmab_ret *) obj->buffer.pointer);
|
||||
} else {
|
||||
return AE_ERROR;
|
||||
status = AE_ERROR;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (ret.eax & 0x1)
|
||||
|
@ -607,23 +598,26 @@ static acpi_status AMW0_set_capabilities(void)
|
|||
args.ebx = 2 << 8;
|
||||
args.ebx |= ACER_AMW0_BLUETOOTH_MASK;
|
||||
|
||||
/*
|
||||
* It's ok to use existing buffer for next wmab_execute call.
|
||||
* But we need to kfree(out.pointer) if next wmab_execute fail.
|
||||
*/
|
||||
status = wmab_execute(&args, &out);
|
||||
if (ACPI_FAILURE(status))
|
||||
return status;
|
||||
goto out;
|
||||
|
||||
obj = (union acpi_object *) out.pointer;
|
||||
if (obj && obj->type == ACPI_TYPE_BUFFER
|
||||
&& obj->buffer.length == sizeof(struct wmab_ret)) {
|
||||
ret = *((struct wmab_ret *) obj->buffer.pointer);
|
||||
} else {
|
||||
return AE_ERROR;
|
||||
status = AE_ERROR;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (ret.eax & 0x1)
|
||||
interface->capability |= ACER_CAP_BLUETOOTH;
|
||||
|
||||
kfree(out.pointer);
|
||||
|
||||
/*
|
||||
* This appears to be safe to enable, since all Wistron based laptops
|
||||
* appear to use the same EC register for brightness, even if they
|
||||
|
@ -632,7 +626,10 @@ static acpi_status AMW0_set_capabilities(void)
|
|||
if (quirks->brightness >= 0)
|
||||
interface->capability |= ACER_CAP_BRIGHTNESS;
|
||||
|
||||
return AE_OK;
|
||||
status = AE_OK;
|
||||
out:
|
||||
kfree(out.pointer);
|
||||
return status;
|
||||
}
|
||||
|
||||
static struct wmi_interface AMW0_interface = {
|
||||
|
@ -772,6 +769,7 @@ static acpi_status WMID_set_capabilities(void)
|
|||
obj->buffer.length == sizeof(u32)) {
|
||||
devices = *((u32 *) obj->buffer.pointer);
|
||||
} else {
|
||||
kfree(out.pointer);
|
||||
return AE_ERROR;
|
||||
}
|
||||
|
||||
|
@ -788,6 +786,7 @@ static acpi_status WMID_set_capabilities(void)
|
|||
if (!(devices & 0x20))
|
||||
max_brightness = 0x9;
|
||||
|
||||
kfree(out.pointer);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -1084,8 +1083,7 @@ static ssize_t show_interface(struct device *dev, struct device_attribute *attr,
|
|||
}
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(interface, S_IWUGO | S_IRUGO | S_IWUSR,
|
||||
show_interface, NULL);
|
||||
static DEVICE_ATTR(interface, S_IRUGO, show_interface, NULL);
|
||||
|
||||
/*
|
||||
* debugfs functions
|
||||
|
@ -1095,6 +1093,7 @@ static u32 get_wmid_devices(void)
|
|||
struct acpi_buffer out = {ACPI_ALLOCATE_BUFFER, NULL};
|
||||
union acpi_object *obj;
|
||||
acpi_status status;
|
||||
u32 devices = 0;
|
||||
|
||||
status = wmi_query_block(WMID_GUID2, 1, &out);
|
||||
if (ACPI_FAILURE(status))
|
||||
|
@ -1103,10 +1102,11 @@ static u32 get_wmid_devices(void)
|
|||
obj = (union acpi_object *) out.pointer;
|
||||
if (obj && obj->type == ACPI_TYPE_BUFFER &&
|
||||
obj->buffer.length == sizeof(u32)) {
|
||||
return *((u32 *) obj->buffer.pointer);
|
||||
} else {
|
||||
return 0;
|
||||
devices = *((u32 *) obj->buffer.pointer);
|
||||
}
|
||||
|
||||
kfree(out.pointer);
|
||||
return devices;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1327,22 +1327,31 @@ static int __init acer_wmi_init(void)
|
|||
"generic video driver\n");
|
||||
}
|
||||
|
||||
if (platform_driver_register(&acer_platform_driver)) {
|
||||
err = platform_driver_register(&acer_platform_driver);
|
||||
if (err) {
|
||||
printk(ACER_ERR "Unable to register platform driver.\n");
|
||||
goto error_platform_register;
|
||||
}
|
||||
|
||||
acer_platform_device = platform_device_alloc("acer-wmi", -1);
|
||||
platform_device_add(acer_platform_device);
|
||||
if (!acer_platform_device) {
|
||||
err = -ENOMEM;
|
||||
goto error_device_alloc;
|
||||
}
|
||||
|
||||
err = platform_device_add(acer_platform_device);
|
||||
if (err)
|
||||
goto error_device_add;
|
||||
|
||||
err = create_sysfs();
|
||||
if (err)
|
||||
return err;
|
||||
goto error_create_sys;
|
||||
|
||||
if (wmi_has_guid(WMID_GUID2)) {
|
||||
interface->debug.wmid_devices = get_wmid_devices();
|
||||
err = create_debugfs();
|
||||
if (err)
|
||||
return err;
|
||||
goto error_create_debugfs;
|
||||
}
|
||||
|
||||
/* Override any initial settings with values from the commandline */
|
||||
|
@ -1350,15 +1359,23 @@ static int __init acer_wmi_init(void)
|
|||
|
||||
return 0;
|
||||
|
||||
error_create_debugfs:
|
||||
remove_sysfs(acer_platform_device);
|
||||
error_create_sys:
|
||||
platform_device_del(acer_platform_device);
|
||||
error_device_add:
|
||||
platform_device_put(acer_platform_device);
|
||||
error_device_alloc:
|
||||
platform_driver_unregister(&acer_platform_driver);
|
||||
error_platform_register:
|
||||
return -ENODEV;
|
||||
return err;
|
||||
}
|
||||
|
||||
static void __exit acer_wmi_exit(void)
|
||||
{
|
||||
remove_sysfs(acer_platform_device);
|
||||
remove_debugfs();
|
||||
platform_device_del(acer_platform_device);
|
||||
platform_device_unregister(acer_platform_device);
|
||||
platform_driver_unregister(&acer_platform_driver);
|
||||
|
||||
printk(ACER_INFO "Acer Laptop WMI Extras unloaded\n");
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
*/
|
||||
#undef START_IN_KERNEL_MODE
|
||||
|
||||
#define DRV_VER "0.5.22"
|
||||
#define DRV_VER "0.5.24"
|
||||
|
||||
/*
|
||||
* According to the Atom N270 datasheet,
|
||||
|
@ -92,9 +92,9 @@ static unsigned int fanstate = ACERHDF_FAN_AUTO;
|
|||
static char force_bios[16];
|
||||
static char force_product[16];
|
||||
static unsigned int prev_interval;
|
||||
struct thermal_zone_device *thz_dev;
|
||||
struct thermal_cooling_device *cl_dev;
|
||||
struct platform_device *acerhdf_dev;
|
||||
static struct thermal_zone_device *thz_dev;
|
||||
static struct thermal_cooling_device *cl_dev;
|
||||
static struct platform_device *acerhdf_dev;
|
||||
|
||||
module_param(kernelmode, uint, 0);
|
||||
MODULE_PARM_DESC(kernelmode, "Kernel mode fan control on / off");
|
||||
|
@ -112,14 +112,12 @@ module_param_string(force_product, force_product, 16, 0);
|
|||
MODULE_PARM_DESC(force_product, "Force BIOS product and omit BIOS check");
|
||||
|
||||
/*
|
||||
* cmd_off: to switch the fan completely off
|
||||
* chk_off: to check if the fan is off
|
||||
* cmd_off: to switch the fan completely off and check if the fan is off
|
||||
* cmd_auto: to set the BIOS in control of the fan. The BIOS regulates then
|
||||
* the fan speed depending on the temperature
|
||||
*/
|
||||
struct fancmd {
|
||||
u8 cmd_off;
|
||||
u8 chk_off;
|
||||
u8 cmd_auto;
|
||||
};
|
||||
|
||||
|
@ -136,47 +134,81 @@ struct bios_settings_t {
|
|||
/* Register addresses and values for different BIOS versions */
|
||||
static const struct bios_settings_t bios_tbl[] = {
|
||||
/* AOA110 */
|
||||
{"Acer", "AOA110", "v0.3109", 0x55, 0x58, {0x1f, 0x1f, 0x00} },
|
||||
{"Acer", "AOA110", "v0.3114", 0x55, 0x58, {0x1f, 0x1f, 0x00} },
|
||||
{"Acer", "AOA110", "v0.3301", 0x55, 0x58, {0xaf, 0xaf, 0x00} },
|
||||
{"Acer", "AOA110", "v0.3304", 0x55, 0x58, {0xaf, 0xaf, 0x00} },
|
||||
{"Acer", "AOA110", "v0.3305", 0x55, 0x58, {0xaf, 0xaf, 0x00} },
|
||||
{"Acer", "AOA110", "v0.3307", 0x55, 0x58, {0xaf, 0xaf, 0x00} },
|
||||
{"Acer", "AOA110", "v0.3308", 0x55, 0x58, {0x21, 0x21, 0x00} },
|
||||
{"Acer", "AOA110", "v0.3309", 0x55, 0x58, {0x21, 0x21, 0x00} },
|
||||
{"Acer", "AOA110", "v0.3310", 0x55, 0x58, {0x21, 0x21, 0x00} },
|
||||
{"Acer", "AOA110", "v0.3109", 0x55, 0x58, {0x1f, 0x00} },
|
||||
{"Acer", "AOA110", "v0.3114", 0x55, 0x58, {0x1f, 0x00} },
|
||||
{"Acer", "AOA110", "v0.3301", 0x55, 0x58, {0xaf, 0x00} },
|
||||
{"Acer", "AOA110", "v0.3304", 0x55, 0x58, {0xaf, 0x00} },
|
||||
{"Acer", "AOA110", "v0.3305", 0x55, 0x58, {0xaf, 0x00} },
|
||||
{"Acer", "AOA110", "v0.3307", 0x55, 0x58, {0xaf, 0x00} },
|
||||
{"Acer", "AOA110", "v0.3308", 0x55, 0x58, {0x21, 0x00} },
|
||||
{"Acer", "AOA110", "v0.3309", 0x55, 0x58, {0x21, 0x00} },
|
||||
{"Acer", "AOA110", "v0.3310", 0x55, 0x58, {0x21, 0x00} },
|
||||
/* AOA150 */
|
||||
{"Acer", "AOA150", "v0.3114", 0x55, 0x58, {0x20, 0x20, 0x00} },
|
||||
{"Acer", "AOA150", "v0.3301", 0x55, 0x58, {0x20, 0x20, 0x00} },
|
||||
{"Acer", "AOA150", "v0.3304", 0x55, 0x58, {0x20, 0x20, 0x00} },
|
||||
{"Acer", "AOA150", "v0.3305", 0x55, 0x58, {0x20, 0x20, 0x00} },
|
||||
{"Acer", "AOA150", "v0.3307", 0x55, 0x58, {0x20, 0x20, 0x00} },
|
||||
{"Acer", "AOA150", "v0.3308", 0x55, 0x58, {0x20, 0x20, 0x00} },
|
||||
{"Acer", "AOA150", "v0.3309", 0x55, 0x58, {0x20, 0x20, 0x00} },
|
||||
{"Acer", "AOA150", "v0.3310", 0x55, 0x58, {0x20, 0x20, 0x00} },
|
||||
{"Acer", "AOA150", "v0.3114", 0x55, 0x58, {0x1f, 0x00} },
|
||||
{"Acer", "AOA150", "v0.3301", 0x55, 0x58, {0x20, 0x00} },
|
||||
{"Acer", "AOA150", "v0.3304", 0x55, 0x58, {0x20, 0x00} },
|
||||
{"Acer", "AOA150", "v0.3305", 0x55, 0x58, {0x20, 0x00} },
|
||||
{"Acer", "AOA150", "v0.3307", 0x55, 0x58, {0x20, 0x00} },
|
||||
{"Acer", "AOA150", "v0.3308", 0x55, 0x58, {0x20, 0x00} },
|
||||
{"Acer", "AOA150", "v0.3309", 0x55, 0x58, {0x20, 0x00} },
|
||||
{"Acer", "AOA150", "v0.3310", 0x55, 0x58, {0x20, 0x00} },
|
||||
/* Acer 1410 */
|
||||
{"Acer", "Aspire 1410", "v0.3120", 0x55, 0x58, {0x9e, 0x9e, 0x00} },
|
||||
{"Acer", "Aspire 1410", "v1.3303", 0x55, 0x58, {0x9e, 0x9e, 0x00} },
|
||||
{"Acer", "Aspire 1410", "v0.3108", 0x55, 0x58, {0x9e, 0x00} },
|
||||
{"Acer", "Aspire 1410", "v0.3113", 0x55, 0x58, {0x9e, 0x00} },
|
||||
{"Acer", "Aspire 1410", "v0.3115", 0x55, 0x58, {0x9e, 0x00} },
|
||||
{"Acer", "Aspire 1410", "v0.3117", 0x55, 0x58, {0x9e, 0x00} },
|
||||
{"Acer", "Aspire 1410", "v0.3119", 0x55, 0x58, {0x9e, 0x00} },
|
||||
{"Acer", "Aspire 1410", "v0.3120", 0x55, 0x58, {0x9e, 0x00} },
|
||||
{"Acer", "Aspire 1410", "v1.3204", 0x55, 0x58, {0x9e, 0x00} },
|
||||
{"Acer", "Aspire 1410", "v1.3303", 0x55, 0x58, {0x9e, 0x00} },
|
||||
{"Acer", "Aspire 1410", "v1.3308", 0x55, 0x58, {0x9e, 0x00} },
|
||||
{"Acer", "Aspire 1410", "v1.3310", 0x55, 0x58, {0x9e, 0x00} },
|
||||
/* Acer 1810xx */
|
||||
{"Acer", "Aspire 1810TZ", "v0.3120", 0x55, 0x58, {0x9e, 0x9e, 0x00} },
|
||||
{"Acer", "Aspire 1810T", "v0.3120", 0x55, 0x58, {0x9e, 0x9e, 0x00} },
|
||||
{"Acer", "Aspire 1810T", "v1.3303", 0x55, 0x58, {0x9e, 0x9e, 0x00} },
|
||||
{"Acer", "Aspire 1810TZ", "v1.3303", 0x55, 0x58, {0x9e, 0x9e, 0x00} },
|
||||
{"Acer", "Aspire 1810TZ", "v0.3108", 0x55, 0x58, {0x9e, 0x00} },
|
||||
{"Acer", "Aspire 1810T", "v0.3108", 0x55, 0x58, {0x9e, 0x00} },
|
||||
{"Acer", "Aspire 1810TZ", "v0.3113", 0x55, 0x58, {0x9e, 0x00} },
|
||||
{"Acer", "Aspire 1810T", "v0.3113", 0x55, 0x58, {0x9e, 0x00} },
|
||||
{"Acer", "Aspire 1810TZ", "v0.3115", 0x55, 0x58, {0x9e, 0x00} },
|
||||
{"Acer", "Aspire 1810T", "v0.3115", 0x55, 0x58, {0x9e, 0x00} },
|
||||
{"Acer", "Aspire 1810TZ", "v0.3117", 0x55, 0x58, {0x9e, 0x00} },
|
||||
{"Acer", "Aspire 1810T", "v0.3117", 0x55, 0x58, {0x9e, 0x00} },
|
||||
{"Acer", "Aspire 1810TZ", "v0.3119", 0x55, 0x58, {0x9e, 0x00} },
|
||||
{"Acer", "Aspire 1810T", "v0.3119", 0x55, 0x58, {0x9e, 0x00} },
|
||||
{"Acer", "Aspire 1810TZ", "v0.3120", 0x55, 0x58, {0x9e, 0x00} },
|
||||
{"Acer", "Aspire 1810T", "v0.3120", 0x55, 0x58, {0x9e, 0x00} },
|
||||
{"Acer", "Aspire 1810TZ", "v1.3204", 0x55, 0x58, {0x9e, 0x00} },
|
||||
{"Acer", "Aspire 1810T", "v1.3204", 0x55, 0x58, {0x9e, 0x00} },
|
||||
{"Acer", "Aspire 1810TZ", "v1.3303", 0x55, 0x58, {0x9e, 0x00} },
|
||||
{"Acer", "Aspire 1810T", "v1.3303", 0x55, 0x58, {0x9e, 0x00} },
|
||||
{"Acer", "Aspire 1810TZ", "v1.3308", 0x55, 0x58, {0x9e, 0x00} },
|
||||
{"Acer", "Aspire 1810T", "v1.3308", 0x55, 0x58, {0x9e, 0x00} },
|
||||
{"Acer", "Aspire 1810TZ", "v1.3310", 0x55, 0x58, {0x9e, 0x00} },
|
||||
{"Acer", "Aspire 1810T", "v1.3310", 0x55, 0x58, {0x9e, 0x00} },
|
||||
/* Acer 531 */
|
||||
{"Acer", "AO531h", "v0.3201", 0x55, 0x58, {0x20, 0x00} },
|
||||
/* Gateway */
|
||||
{"Gateway", "AOA110", "v0.3103", 0x55, 0x58, {0x21, 0x21, 0x00} },
|
||||
{"Gateway", "AOA150", "v0.3103", 0x55, 0x58, {0x20, 0x20, 0x00} },
|
||||
{"Gateway", "LT31", "v1.3103", 0x55, 0x58, {0x10, 0x0f, 0x00} },
|
||||
{"Gateway", "LT31", "v1.3201", 0x55, 0x58, {0x10, 0x0f, 0x00} },
|
||||
{"Gateway", "LT31", "v1.3302", 0x55, 0x58, {0x10, 0x0f, 0x00} },
|
||||
{"Gateway", "AOA110", "v0.3103", 0x55, 0x58, {0x21, 0x00} },
|
||||
{"Gateway", "AOA150", "v0.3103", 0x55, 0x58, {0x20, 0x00} },
|
||||
{"Gateway", "LT31", "v1.3103", 0x55, 0x58, {0x9e, 0x00} },
|
||||
{"Gateway", "LT31", "v1.3201", 0x55, 0x58, {0x9e, 0x00} },
|
||||
{"Gateway", "LT31", "v1.3302", 0x55, 0x58, {0x9e, 0x00} },
|
||||
/* Packard Bell */
|
||||
{"Packard Bell", "DOA150", "v0.3104", 0x55, 0x58, {0x21, 0x21, 0x00} },
|
||||
{"Packard Bell", "DOA150", "v0.3105", 0x55, 0x58, {0x20, 0x20, 0x00} },
|
||||
{"Packard Bell", "AOA110", "v0.3105", 0x55, 0x58, {0x21, 0x21, 0x00} },
|
||||
{"Packard Bell", "AOA150", "v0.3105", 0x55, 0x58, {0x20, 0x20, 0x00} },
|
||||
{"Packard Bell", "DOTMU", "v1.3303", 0x55, 0x58, {0x9e, 0x9e, 0x00} },
|
||||
{"Packard Bell", "DOTMU", "v0.3120", 0x55, 0x58, {0x9e, 0x9e, 0x00} },
|
||||
{"Packard Bell", "DOA150", "v0.3104", 0x55, 0x58, {0x21, 0x00} },
|
||||
{"Packard Bell", "DOA150", "v0.3105", 0x55, 0x58, {0x20, 0x00} },
|
||||
{"Packard Bell", "AOA110", "v0.3105", 0x55, 0x58, {0x21, 0x00} },
|
||||
{"Packard Bell", "AOA150", "v0.3105", 0x55, 0x58, {0x20, 0x00} },
|
||||
{"Packard Bell", "DOTMU", "v1.3303", 0x55, 0x58, {0x9e, 0x00} },
|
||||
{"Packard Bell", "DOTMU", "v0.3120", 0x55, 0x58, {0x9e, 0x00} },
|
||||
{"Packard Bell", "DOTMU", "v0.3108", 0x55, 0x58, {0x9e, 0x00} },
|
||||
{"Packard Bell", "DOTMU", "v0.3113", 0x55, 0x58, {0x9e, 0x00} },
|
||||
{"Packard Bell", "DOTMU", "v0.3115", 0x55, 0x58, {0x9e, 0x00} },
|
||||
{"Packard Bell", "DOTMU", "v0.3117", 0x55, 0x58, {0x9e, 0x00} },
|
||||
{"Packard Bell", "DOTMU", "v0.3119", 0x55, 0x58, {0x9e, 0x00} },
|
||||
{"Packard Bell", "DOTMU", "v1.3204", 0x55, 0x58, {0x9e, 0x00} },
|
||||
{"Packard Bell", "DOTMA", "v1.3201", 0x55, 0x58, {0x9e, 0x00} },
|
||||
{"Packard Bell", "DOTMA", "v1.3302", 0x55, 0x58, {0x9e, 0x00} },
|
||||
/* pewpew-terminator */
|
||||
{"", "", "", 0, 0, {0, 0, 0} }
|
||||
{"", "", "", 0, 0, {0, 0} }
|
||||
};
|
||||
|
||||
static const struct bios_settings_t *bios_cfg __read_mostly;
|
||||
|
@ -200,7 +232,7 @@ static int acerhdf_get_fanstate(int *state)
|
|||
if (ec_read(bios_cfg->fanreg, &fan))
|
||||
return -EINVAL;
|
||||
|
||||
if (fan != bios_cfg->cmd.chk_off)
|
||||
if (fan != bios_cfg->cmd.cmd_off)
|
||||
*state = ACERHDF_FAN_AUTO;
|
||||
else
|
||||
*state = ACERHDF_FAN_OFF;
|
||||
|
@ -374,7 +406,7 @@ static int acerhdf_get_crit_temp(struct thermal_zone_device *thermal,
|
|||
}
|
||||
|
||||
/* bind callback functions to thermalzone */
|
||||
struct thermal_zone_device_ops acerhdf_dev_ops = {
|
||||
static struct thermal_zone_device_ops acerhdf_dev_ops = {
|
||||
.bind = acerhdf_bind,
|
||||
.unbind = acerhdf_unbind,
|
||||
.get_temp = acerhdf_get_ec_temp,
|
||||
|
@ -449,7 +481,7 @@ err_out:
|
|||
}
|
||||
|
||||
/* bind fan callbacks to fan device */
|
||||
struct thermal_cooling_device_ops acerhdf_cooling_ops = {
|
||||
static struct thermal_cooling_device_ops acerhdf_cooling_ops = {
|
||||
.get_max_state = acerhdf_get_max_state,
|
||||
.get_cur_state = acerhdf_get_cur_state,
|
||||
.set_cur_state = acerhdf_set_cur_state,
|
||||
|
@ -518,6 +550,10 @@ static int acerhdf_check_hardware(void)
|
|||
version = dmi_get_system_info(DMI_BIOS_VERSION);
|
||||
product = dmi_get_system_info(DMI_PRODUCT_NAME);
|
||||
|
||||
if (!vendor || !version || !product) {
|
||||
pr_err("error getting hardware information\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
pr_info("Acer Aspire One Fan driver, v.%s\n", DRV_VER);
|
||||
|
||||
|
@ -579,17 +615,26 @@ static int acerhdf_register_platform(void)
|
|||
return err;
|
||||
|
||||
acerhdf_dev = platform_device_alloc("acerhdf", -1);
|
||||
platform_device_add(acerhdf_dev);
|
||||
if (!acerhdf_dev) {
|
||||
err = -ENOMEM;
|
||||
goto err_device_alloc;
|
||||
}
|
||||
err = platform_device_add(acerhdf_dev);
|
||||
if (err)
|
||||
goto err_device_add;
|
||||
|
||||
return 0;
|
||||
|
||||
err_device_add:
|
||||
platform_device_put(acerhdf_dev);
|
||||
err_device_alloc:
|
||||
platform_driver_unregister(&acerhdf_driver);
|
||||
return err;
|
||||
}
|
||||
|
||||
static void acerhdf_unregister_platform(void)
|
||||
{
|
||||
if (!acerhdf_dev)
|
||||
return;
|
||||
|
||||
platform_device_del(acerhdf_dev);
|
||||
platform_device_unregister(acerhdf_dev);
|
||||
platform_driver_unregister(&acerhdf_driver);
|
||||
}
|
||||
|
||||
|
@ -633,7 +678,7 @@ static int __init acerhdf_init(void)
|
|||
|
||||
err = acerhdf_register_platform();
|
||||
if (err)
|
||||
goto err_unreg;
|
||||
goto out_err;
|
||||
|
||||
err = acerhdf_register_thermal();
|
||||
if (err)
|
||||
|
@ -646,7 +691,7 @@ err_unreg:
|
|||
acerhdf_unregister_platform();
|
||||
|
||||
out_err:
|
||||
return -ENODEV;
|
||||
return err;
|
||||
}
|
||||
|
||||
static void __exit acerhdf_exit(void)
|
||||
|
@ -662,11 +707,13 @@ MODULE_DESCRIPTION("Aspire One temperature and fan driver");
|
|||
MODULE_ALIAS("dmi:*:*Acer*:pnAOA*:");
|
||||
MODULE_ALIAS("dmi:*:*Acer*:pnAspire 1410*:");
|
||||
MODULE_ALIAS("dmi:*:*Acer*:pnAspire 1810*:");
|
||||
MODULE_ALIAS("dmi:*:*Acer*:pnAO531*:");
|
||||
MODULE_ALIAS("dmi:*:*Gateway*:pnAOA*:");
|
||||
MODULE_ALIAS("dmi:*:*Gateway*:pnLT31*:");
|
||||
MODULE_ALIAS("dmi:*:*Packard Bell*:pnAOA*:");
|
||||
MODULE_ALIAS("dmi:*:*Packard Bell*:pnDOA*:");
|
||||
MODULE_ALIAS("dmi:*:*Packard Bell*:pnDOTMU*:");
|
||||
MODULE_ALIAS("dmi:*:*Packard Bell*:pnDOTMA*:");
|
||||
|
||||
module_init(acerhdf_init);
|
||||
module_exit(acerhdf_exit);
|
||||
|
|
|
@ -76,18 +76,18 @@ MODULE_LICENSE("GPL");
|
|||
* So, if something doesn't work as you want, just try other values =)
|
||||
*/
|
||||
static uint wapf = 1;
|
||||
module_param(wapf, uint, 0644);
|
||||
module_param(wapf, uint, 0444);
|
||||
MODULE_PARM_DESC(wapf, "WAPF value");
|
||||
|
||||
static int wlan_status = 1;
|
||||
static int bluetooth_status = 1;
|
||||
|
||||
module_param(wlan_status, int, 0644);
|
||||
module_param(wlan_status, int, 0444);
|
||||
MODULE_PARM_DESC(wlan_status, "Set the wireless status on boot "
|
||||
"(0 = disabled, 1 = enabled, -1 = don't do anything). "
|
||||
"default is 1");
|
||||
|
||||
module_param(bluetooth_status, int, 0644);
|
||||
module_param(bluetooth_status, int, 0444);
|
||||
MODULE_PARM_DESC(bluetooth_status, "Set the wireless status on boot "
|
||||
"(0 = disabled, 1 = enabled, -1 = don't do anything). "
|
||||
"default is 1");
|
||||
|
@ -297,7 +297,7 @@ static int write_acpi_int_ret(acpi_handle handle, const char *method, int val,
|
|||
acpi_status status;
|
||||
|
||||
if (!handle)
|
||||
return 0;
|
||||
return -1;
|
||||
|
||||
params.count = 1;
|
||||
params.pointer = &in_obj;
|
||||
|
@ -796,10 +796,11 @@ static ssize_t store_ledd(struct device *dev, struct device_attribute *attr,
|
|||
|
||||
rv = parse_arg(buf, count, &value);
|
||||
if (rv > 0) {
|
||||
if (write_acpi_int(asus->handle, METHOD_LEDD, value))
|
||||
if (write_acpi_int(asus->handle, METHOD_LEDD, value)) {
|
||||
pr_warning("LED display write failed\n");
|
||||
else
|
||||
asus->ledd_status = (u32) value;
|
||||
return -ENODEV;
|
||||
}
|
||||
asus->ledd_status = (u32) value;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
@ -1123,7 +1124,7 @@ static int asus_input_init(struct asus_laptop *asus)
|
|||
input = input_allocate_device();
|
||||
if (!input) {
|
||||
pr_info("Unable to allocate input device\n");
|
||||
return 0;
|
||||
return -ENOMEM;
|
||||
}
|
||||
input->name = "Asus Laptop extra buttons";
|
||||
input->phys = ASUS_LAPTOP_FILE "/input0";
|
||||
|
@ -1134,20 +1135,20 @@ static int asus_input_init(struct asus_laptop *asus)
|
|||
error = sparse_keymap_setup(input, asus_keymap, NULL);
|
||||
if (error) {
|
||||
pr_err("Unable to setup input device keymap\n");
|
||||
goto err_keymap;
|
||||
goto err_free_dev;
|
||||
}
|
||||
error = input_register_device(input);
|
||||
if (error) {
|
||||
pr_info("Unable to register input device\n");
|
||||
goto err_device;
|
||||
goto err_free_keymap;
|
||||
}
|
||||
|
||||
asus->inputdev = input;
|
||||
return 0;
|
||||
|
||||
err_keymap:
|
||||
err_free_keymap:
|
||||
sparse_keymap_free(input);
|
||||
err_device:
|
||||
err_free_dev:
|
||||
input_free_device(input);
|
||||
return error;
|
||||
}
|
||||
|
@ -1397,8 +1398,10 @@ static int asus_laptop_get_info(struct asus_laptop *asus)
|
|||
}
|
||||
}
|
||||
asus->name = kstrdup(string, GFP_KERNEL);
|
||||
if (!asus->name)
|
||||
if (!asus->name) {
|
||||
kfree(buffer.pointer);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
if (*string)
|
||||
pr_notice(" %s model detected\n", string);
|
||||
|
|
|
@ -1330,6 +1330,9 @@ static int asus_hotk_get_info(void)
|
|||
hotk->model = P30;
|
||||
printk(KERN_NOTICE
|
||||
" Samsung P30 detected, supported\n");
|
||||
hotk->methods = &model_conf[hotk->model];
|
||||
kfree(model);
|
||||
return 0;
|
||||
} else {
|
||||
hotk->model = M2E;
|
||||
printk(KERN_NOTICE " unsupported model %s, trying "
|
||||
|
@ -1339,8 +1342,6 @@ static int asus_hotk_get_info(void)
|
|||
kfree(model);
|
||||
return -ENODEV;
|
||||
}
|
||||
hotk->methods = &model_conf[hotk->model];
|
||||
return AE_OK;
|
||||
}
|
||||
hotk->methods = &model_conf[hotk->model];
|
||||
printk(KERN_NOTICE " %s model detected, supported\n", string);
|
||||
|
@ -1374,7 +1375,7 @@ static int asus_hotk_get_info(void)
|
|||
|
||||
kfree(model);
|
||||
|
||||
return AE_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int asus_hotk_check(void)
|
||||
|
|
|
@ -208,7 +208,7 @@ static ssize_t cmpc_accel_sensitivity_store(struct device *dev,
|
|||
return strnlen(buf, count);
|
||||
}
|
||||
|
||||
struct device_attribute cmpc_accel_sensitivity_attr = {
|
||||
static struct device_attribute cmpc_accel_sensitivity_attr = {
|
||||
.attr = { .name = "sensitivity", .mode = 0660 },
|
||||
.show = cmpc_accel_sensitivity_show,
|
||||
.store = cmpc_accel_sensitivity_store
|
||||
|
@ -573,16 +573,17 @@ static int cmpc_ipml_add(struct acpi_device *acpi)
|
|||
|
||||
ipml->rf = rfkill_alloc("cmpc_rfkill", &acpi->dev, RFKILL_TYPE_WLAN,
|
||||
&cmpc_rfkill_ops, acpi->handle);
|
||||
/* rfkill_alloc may fail if RFKILL is disabled. We should still work
|
||||
* anyway. */
|
||||
if (!IS_ERR(ipml->rf)) {
|
||||
/*
|
||||
* If RFKILL is disabled, rfkill_alloc will return ERR_PTR(-ENODEV).
|
||||
* This is OK, however, since all other uses of the device will not
|
||||
* derefence it.
|
||||
*/
|
||||
if (ipml->rf) {
|
||||
retval = rfkill_register(ipml->rf);
|
||||
if (retval) {
|
||||
rfkill_destroy(ipml->rf);
|
||||
ipml->rf = NULL;
|
||||
}
|
||||
} else {
|
||||
ipml->rf = NULL;
|
||||
}
|
||||
|
||||
dev_set_drvdata(&acpi->dev, ipml);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -82,6 +82,12 @@ static const struct dmi_system_id __initdata dell_device_table[] = {
|
|||
DMI_MATCH(DMI_CHASSIS_TYPE, "8"),
|
||||
},
|
||||
},
|
||||
{
|
||||
.matches = {
|
||||
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
|
||||
DMI_MATCH(DMI_CHASSIS_TYPE, "9"), /*Laptop*/
|
||||
},
|
||||
},
|
||||
{
|
||||
.ident = "Dell Computer Corporation",
|
||||
.matches = {
|
||||
|
@ -467,7 +473,7 @@ static struct backlight_ops dell_ops = {
|
|||
.update_status = dell_send_intensity,
|
||||
};
|
||||
|
||||
bool dell_laptop_i8042_filter(unsigned char data, unsigned char str,
|
||||
static bool dell_laptop_i8042_filter(unsigned char data, unsigned char str,
|
||||
struct serio *port)
|
||||
{
|
||||
static bool extended;
|
||||
|
@ -621,4 +627,5 @@ MODULE_AUTHOR("Matthew Garrett <mjg@redhat.com>");
|
|||
MODULE_DESCRIPTION("Dell laptop driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_ALIAS("dmi:*svnDellInc.:*:ct8:*");
|
||||
MODULE_ALIAS("dmi:*svnDellInc.:*:ct9:*");
|
||||
MODULE_ALIAS("dmi:*svnDellComputerCorporation.:*:ct8:*");
|
||||
|
|
|
@ -221,7 +221,7 @@ static void dell_wmi_notify(u32 value, void *context)
|
|||
return;
|
||||
}
|
||||
|
||||
if (dell_new_hk_type)
|
||||
if (dell_new_hk_type || buffer_entry[1] == 0x0)
|
||||
reported_key = (int)buffer_entry[2];
|
||||
else
|
||||
reported_key = (int)buffer_entry[1] & 0xffff;
|
||||
|
@ -339,13 +339,18 @@ static int __init dell_wmi_init(void)
|
|||
acpi_video = acpi_video_backlight_support();
|
||||
|
||||
err = dell_wmi_input_setup();
|
||||
if (err)
|
||||
if (err) {
|
||||
if (dell_new_hk_type)
|
||||
kfree(dell_wmi_keymap);
|
||||
return err;
|
||||
}
|
||||
|
||||
status = wmi_install_notify_handler(DELL_EVENT_GUID,
|
||||
dell_wmi_notify, NULL);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
input_unregister_device(dell_wmi_input_dev);
|
||||
if (dell_new_hk_type)
|
||||
kfree(dell_wmi_keymap);
|
||||
printk(KERN_ERR
|
||||
"dell-wmi: Unable to register notify handler - %d\n",
|
||||
status);
|
||||
|
@ -359,6 +364,8 @@ static void __exit dell_wmi_exit(void)
|
|||
{
|
||||
wmi_remove_notify_handler(DELL_EVENT_GUID);
|
||||
input_unregister_device(dell_wmi_input_dev);
|
||||
if (dell_new_hk_type)
|
||||
kfree(dell_wmi_keymap);
|
||||
}
|
||||
|
||||
module_init(dell_wmi_init);
|
||||
|
|
|
@ -53,7 +53,7 @@ MODULE_LICENSE("GPL");
|
|||
|
||||
static bool hotplug_disabled;
|
||||
|
||||
module_param(hotplug_disabled, bool, 0644);
|
||||
module_param(hotplug_disabled, bool, 0444);
|
||||
MODULE_PARM_DESC(hotplug_disabled,
|
||||
"Disable hotplug for wireless device. "
|
||||
"If your laptop need that, please report to "
|
||||
|
|
|
@ -182,7 +182,7 @@ static enum led_brightness logolamp_get(struct led_classdev *cdev);
|
|||
static void logolamp_set(struct led_classdev *cdev,
|
||||
enum led_brightness brightness);
|
||||
|
||||
struct led_classdev logolamp_led = {
|
||||
static struct led_classdev logolamp_led = {
|
||||
.name = "fujitsu::logolamp",
|
||||
.brightness_get = logolamp_get,
|
||||
.brightness_set = logolamp_set
|
||||
|
@ -192,7 +192,7 @@ static enum led_brightness kblamps_get(struct led_classdev *cdev);
|
|||
static void kblamps_set(struct led_classdev *cdev,
|
||||
enum led_brightness brightness);
|
||||
|
||||
struct led_classdev kblamps_led = {
|
||||
static struct led_classdev kblamps_led = {
|
||||
.name = "fujitsu::kblamps",
|
||||
.brightness_get = kblamps_get,
|
||||
.brightness_set = kblamps_set
|
||||
|
@ -603,7 +603,7 @@ static int dmi_check_cb_s6410(const struct dmi_system_id *id)
|
|||
dmi_check_cb_common(id);
|
||||
fujitsu->keycode1 = KEY_SCREENLOCK; /* "Lock" */
|
||||
fujitsu->keycode2 = KEY_HELP; /* "Mobility Center" */
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int dmi_check_cb_s6420(const struct dmi_system_id *id)
|
||||
|
@ -611,7 +611,7 @@ static int dmi_check_cb_s6420(const struct dmi_system_id *id)
|
|||
dmi_check_cb_common(id);
|
||||
fujitsu->keycode1 = KEY_SCREENLOCK; /* "Lock" */
|
||||
fujitsu->keycode2 = KEY_HELP; /* "Mobility Center" */
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int dmi_check_cb_p8010(const struct dmi_system_id *id)
|
||||
|
@ -620,7 +620,7 @@ static int dmi_check_cb_p8010(const struct dmi_system_id *id)
|
|||
fujitsu->keycode1 = KEY_HELP; /* "Support" */
|
||||
fujitsu->keycode3 = KEY_SWITCHVIDEOMODE; /* "Presentation" */
|
||||
fujitsu->keycode4 = KEY_WWW; /* "Internet" */
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static struct dmi_system_id fujitsu_dmi_table[] = {
|
||||
|
@ -725,6 +725,7 @@ static int acpi_fujitsu_add(struct acpi_device *device)
|
|||
|
||||
err_unregister_input_dev:
|
||||
input_unregister_device(input);
|
||||
input = NULL;
|
||||
err_free_input_dev:
|
||||
input_free_device(input);
|
||||
err_stop:
|
||||
|
@ -738,8 +739,6 @@ static int acpi_fujitsu_remove(struct acpi_device *device, int type)
|
|||
|
||||
input_unregister_device(input);
|
||||
|
||||
input_free_device(input);
|
||||
|
||||
fujitsu->acpi_handle = NULL;
|
||||
|
||||
return 0;
|
||||
|
@ -930,6 +929,7 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device)
|
|||
|
||||
err_unregister_input_dev:
|
||||
input_unregister_device(input);
|
||||
input = NULL;
|
||||
err_free_input_dev:
|
||||
input_free_device(input);
|
||||
err_free_fifo:
|
||||
|
@ -953,8 +953,6 @@ static int acpi_fujitsu_hotkey_remove(struct acpi_device *device, int type)
|
|||
|
||||
input_unregister_device(input);
|
||||
|
||||
input_free_device(input);
|
||||
|
||||
kfifo_free(&fujitsu_hotkey->fifo);
|
||||
|
||||
fujitsu_hotkey->acpi_handle = NULL;
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include <linux/slab.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/input.h>
|
||||
#include <acpi/acpi_drivers.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/rfkill.h>
|
||||
|
@ -52,12 +51,25 @@ MODULE_ALIAS("wmi:5FB7F034-2C63-45e9-BE91-3D44E2C707E4");
|
|||
#define HPWMI_WIRELESS_QUERY 0x5
|
||||
#define HPWMI_HOTKEY_QUERY 0xc
|
||||
|
||||
#define PREFIX "HP WMI: "
|
||||
#define UNIMP "Unimplemented "
|
||||
|
||||
enum hp_wmi_radio {
|
||||
HPWMI_WIFI = 0,
|
||||
HPWMI_BLUETOOTH = 1,
|
||||
HPWMI_WWAN = 2,
|
||||
};
|
||||
|
||||
enum hp_wmi_event_ids {
|
||||
HPWMI_DOCK_EVENT = 1,
|
||||
HPWMI_PARK_HDD = 2,
|
||||
HPWMI_SMART_ADAPTER = 3,
|
||||
HPWMI_BEZEL_BUTTON = 4,
|
||||
HPWMI_WIRELESS = 5,
|
||||
HPWMI_CPU_BATTERY_THROTTLE = 6,
|
||||
HPWMI_LOCK_SWITCH = 7,
|
||||
};
|
||||
|
||||
static int __devinit hp_wmi_bios_setup(struct platform_device *device);
|
||||
static int __exit hp_wmi_bios_remove(struct platform_device *device);
|
||||
static int hp_wmi_resume_handler(struct device *device);
|
||||
|
@ -67,13 +79,12 @@ struct bios_args {
|
|||
u32 command;
|
||||
u32 commandtype;
|
||||
u32 datasize;
|
||||
u32 data;
|
||||
char *data;
|
||||
};
|
||||
|
||||
struct bios_return {
|
||||
u32 sigpass;
|
||||
u32 return_code;
|
||||
u32 value;
|
||||
};
|
||||
|
||||
struct key_entry {
|
||||
|
@ -88,6 +99,7 @@ static struct key_entry hp_wmi_keymap[] = {
|
|||
{KE_KEY, 0x02, KEY_BRIGHTNESSUP},
|
||||
{KE_KEY, 0x03, KEY_BRIGHTNESSDOWN},
|
||||
{KE_KEY, 0x20e6, KEY_PROG1},
|
||||
{KE_KEY, 0x20e8, KEY_MEDIA},
|
||||
{KE_KEY, 0x2142, KEY_MEDIA},
|
||||
{KE_KEY, 0x213b, KEY_INFO},
|
||||
{KE_KEY, 0x2169, KEY_DIRECTION},
|
||||
|
@ -117,7 +129,27 @@ static struct platform_driver hp_wmi_driver = {
|
|||
.remove = hp_wmi_bios_remove,
|
||||
};
|
||||
|
||||
static int hp_wmi_perform_query(int query, int write, int value)
|
||||
/*
|
||||
* hp_wmi_perform_query
|
||||
*
|
||||
* query: The commandtype -> What should be queried
|
||||
* write: The command -> 0 read, 1 write, 3 ODM specific
|
||||
* buffer: Buffer used as input and/or output
|
||||
* buffersize: Size of buffer
|
||||
*
|
||||
* returns zero on success
|
||||
* an HP WMI query specific error code (which is positive)
|
||||
* -EINVAL if the query was not successful at all
|
||||
* -EINVAL if the output buffer size exceeds buffersize
|
||||
*
|
||||
* Note: The buffersize must at least be the maximum of the input and output
|
||||
* size. E.g. Battery info query (0x7) is defined to have 1 byte input
|
||||
* and 128 byte output. The caller would do:
|
||||
* buffer = kzalloc(128, GFP_KERNEL);
|
||||
* ret = hp_wmi_perform_query(0x7, 0, buffer, 128)
|
||||
*/
|
||||
static int hp_wmi_perform_query(int query, int write, char *buffer,
|
||||
int buffersize)
|
||||
{
|
||||
struct bios_return bios_return;
|
||||
acpi_status status;
|
||||
|
@ -126,8 +158,8 @@ static int hp_wmi_perform_query(int query, int write, int value)
|
|||
.signature = 0x55434553,
|
||||
.command = write ? 0x2 : 0x1,
|
||||
.commandtype = query,
|
||||
.datasize = write ? 0x4 : 0,
|
||||
.data = value,
|
||||
.datasize = buffersize,
|
||||
.data = buffer,
|
||||
};
|
||||
struct acpi_buffer input = { sizeof(struct bios_args), &args };
|
||||
struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
|
||||
|
@ -144,54 +176,90 @@ static int hp_wmi_perform_query(int query, int write, int value)
|
|||
}
|
||||
|
||||
bios_return = *((struct bios_return *)obj->buffer.pointer);
|
||||
|
||||
if (bios_return.return_code) {
|
||||
printk(KERN_WARNING PREFIX "Query %d returned %d\n", query,
|
||||
bios_return.return_code);
|
||||
kfree(obj);
|
||||
return bios_return.return_code;
|
||||
}
|
||||
if (obj->buffer.length - sizeof(bios_return) > buffersize) {
|
||||
kfree(obj);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
memset(buffer, 0, buffersize);
|
||||
memcpy(buffer,
|
||||
((char *)obj->buffer.pointer) + sizeof(struct bios_return),
|
||||
obj->buffer.length - sizeof(bios_return));
|
||||
kfree(obj);
|
||||
if (bios_return.return_code > 0)
|
||||
return bios_return.return_code * -1;
|
||||
else
|
||||
return bios_return.value;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hp_wmi_display_state(void)
|
||||
{
|
||||
return hp_wmi_perform_query(HPWMI_DISPLAY_QUERY, 0, 0);
|
||||
int state;
|
||||
int ret = hp_wmi_perform_query(HPWMI_DISPLAY_QUERY, 0, (char *)&state,
|
||||
sizeof(state));
|
||||
if (ret)
|
||||
return -EINVAL;
|
||||
return state;
|
||||
}
|
||||
|
||||
static int hp_wmi_hddtemp_state(void)
|
||||
{
|
||||
return hp_wmi_perform_query(HPWMI_HDDTEMP_QUERY, 0, 0);
|
||||
int state;
|
||||
int ret = hp_wmi_perform_query(HPWMI_HDDTEMP_QUERY, 0, (char *)&state,
|
||||
sizeof(state));
|
||||
if (ret)
|
||||
return -EINVAL;
|
||||
return state;
|
||||
}
|
||||
|
||||
static int hp_wmi_als_state(void)
|
||||
{
|
||||
return hp_wmi_perform_query(HPWMI_ALS_QUERY, 0, 0);
|
||||
int state;
|
||||
int ret = hp_wmi_perform_query(HPWMI_ALS_QUERY, 0, (char *)&state,
|
||||
sizeof(state));
|
||||
if (ret)
|
||||
return -EINVAL;
|
||||
return state;
|
||||
}
|
||||
|
||||
static int hp_wmi_dock_state(void)
|
||||
{
|
||||
int ret = hp_wmi_perform_query(HPWMI_HARDWARE_QUERY, 0, 0);
|
||||
int state;
|
||||
int ret = hp_wmi_perform_query(HPWMI_HARDWARE_QUERY, 0, (char *)&state,
|
||||
sizeof(state));
|
||||
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (ret)
|
||||
return -EINVAL;
|
||||
|
||||
return ret & 0x1;
|
||||
return state & 0x1;
|
||||
}
|
||||
|
||||
static int hp_wmi_tablet_state(void)
|
||||
{
|
||||
int ret = hp_wmi_perform_query(HPWMI_HARDWARE_QUERY, 0, 0);
|
||||
|
||||
if (ret < 0)
|
||||
int state;
|
||||
int ret = hp_wmi_perform_query(HPWMI_HARDWARE_QUERY, 0, (char *)&state,
|
||||
sizeof(state));
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return (ret & 0x4) ? 1 : 0;
|
||||
return (state & 0x4) ? 1 : 0;
|
||||
}
|
||||
|
||||
static int hp_wmi_set_block(void *data, bool blocked)
|
||||
{
|
||||
enum hp_wmi_radio r = (enum hp_wmi_radio) data;
|
||||
int query = BIT(r + 8) | ((!blocked) << r);
|
||||
int ret;
|
||||
|
||||
return hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 1, query);
|
||||
ret = hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 1,
|
||||
(char *)&query, sizeof(query));
|
||||
if (ret)
|
||||
return -EINVAL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct rfkill_ops hp_wmi_rfkill_ops = {
|
||||
|
@ -200,8 +268,13 @@ static const struct rfkill_ops hp_wmi_rfkill_ops = {
|
|||
|
||||
static bool hp_wmi_get_sw_state(enum hp_wmi_radio r)
|
||||
{
|
||||
int wireless = hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 0, 0);
|
||||
int mask = 0x200 << (r * 8);
|
||||
int wireless;
|
||||
int mask;
|
||||
hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 0,
|
||||
(char *)&wireless, sizeof(wireless));
|
||||
/* TBD: Pass error */
|
||||
|
||||
mask = 0x200 << (r * 8);
|
||||
|
||||
if (wireless & mask)
|
||||
return false;
|
||||
|
@ -211,8 +284,13 @@ static bool hp_wmi_get_sw_state(enum hp_wmi_radio r)
|
|||
|
||||
static bool hp_wmi_get_hw_state(enum hp_wmi_radio r)
|
||||
{
|
||||
int wireless = hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 0, 0);
|
||||
int mask = 0x800 << (r * 8);
|
||||
int wireless;
|
||||
int mask;
|
||||
hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 0,
|
||||
(char *)&wireless, sizeof(wireless));
|
||||
/* TBD: Pass error */
|
||||
|
||||
mask = 0x800 << (r * 8);
|
||||
|
||||
if (wireless & mask)
|
||||
return false;
|
||||
|
@ -269,7 +347,11 @@ static ssize_t set_als(struct device *dev, struct device_attribute *attr,
|
|||
const char *buf, size_t count)
|
||||
{
|
||||
u32 tmp = simple_strtoul(buf, NULL, 10);
|
||||
hp_wmi_perform_query(HPWMI_ALS_QUERY, 1, tmp);
|
||||
int ret = hp_wmi_perform_query(HPWMI_ALS_QUERY, 1, (char *)&tmp,
|
||||
sizeof(tmp));
|
||||
if (ret)
|
||||
return -EINVAL;
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
@ -338,47 +420,82 @@ static void hp_wmi_notify(u32 value, void *context)
|
|||
struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL };
|
||||
static struct key_entry *key;
|
||||
union acpi_object *obj;
|
||||
int eventcode;
|
||||
u32 event_id, event_data;
|
||||
int key_code, ret;
|
||||
u32 *location;
|
||||
acpi_status status;
|
||||
|
||||
status = wmi_get_event_data(value, &response);
|
||||
if (status != AE_OK) {
|
||||
printk(KERN_INFO "hp-wmi: bad event status 0x%x\n", status);
|
||||
printk(KERN_INFO PREFIX "bad event status 0x%x\n", status);
|
||||
return;
|
||||
}
|
||||
|
||||
obj = (union acpi_object *)response.pointer;
|
||||
|
||||
if (!obj || obj->type != ACPI_TYPE_BUFFER || obj->buffer.length != 8) {
|
||||
printk(KERN_INFO "HP WMI: Unknown response received\n");
|
||||
if (!obj)
|
||||
return;
|
||||
if (obj->type != ACPI_TYPE_BUFFER) {
|
||||
printk(KERN_INFO "hp-wmi: Unknown response received %d\n",
|
||||
obj->type);
|
||||
kfree(obj);
|
||||
return;
|
||||
}
|
||||
|
||||
eventcode = *((u8 *) obj->buffer.pointer);
|
||||
/*
|
||||
* Depending on ACPI version the concatenation of id and event data
|
||||
* inside _WED function will result in a 8 or 16 byte buffer.
|
||||
*/
|
||||
location = (u32 *)obj->buffer.pointer;
|
||||
if (obj->buffer.length == 8) {
|
||||
event_id = *location;
|
||||
event_data = *(location + 1);
|
||||
} else if (obj->buffer.length == 16) {
|
||||
event_id = *location;
|
||||
event_data = *(location + 2);
|
||||
} else {
|
||||
printk(KERN_INFO "hp-wmi: Unknown buffer length %d\n",
|
||||
obj->buffer.length);
|
||||
kfree(obj);
|
||||
return;
|
||||
}
|
||||
kfree(obj);
|
||||
if (eventcode == 0x4)
|
||||
eventcode = hp_wmi_perform_query(HPWMI_HOTKEY_QUERY, 0,
|
||||
0);
|
||||
key = hp_wmi_get_entry_by_scancode(eventcode);
|
||||
if (key) {
|
||||
switch (key->type) {
|
||||
case KE_KEY:
|
||||
input_report_key(hp_wmi_input_dev,
|
||||
key->keycode, 1);
|
||||
input_sync(hp_wmi_input_dev);
|
||||
input_report_key(hp_wmi_input_dev,
|
||||
key->keycode, 0);
|
||||
input_sync(hp_wmi_input_dev);
|
||||
break;
|
||||
}
|
||||
} else if (eventcode == 0x1) {
|
||||
|
||||
switch (event_id) {
|
||||
case HPWMI_DOCK_EVENT:
|
||||
input_report_switch(hp_wmi_input_dev, SW_DOCK,
|
||||
hp_wmi_dock_state());
|
||||
input_report_switch(hp_wmi_input_dev, SW_TABLET_MODE,
|
||||
hp_wmi_tablet_state());
|
||||
input_sync(hp_wmi_input_dev);
|
||||
} else if (eventcode == 0x5) {
|
||||
break;
|
||||
case HPWMI_PARK_HDD:
|
||||
break;
|
||||
case HPWMI_SMART_ADAPTER:
|
||||
break;
|
||||
case HPWMI_BEZEL_BUTTON:
|
||||
ret = hp_wmi_perform_query(HPWMI_HOTKEY_QUERY, 0,
|
||||
(char *)&key_code,
|
||||
sizeof(key_code));
|
||||
if (ret)
|
||||
break;
|
||||
key = hp_wmi_get_entry_by_scancode(key_code);
|
||||
if (key) {
|
||||
switch (key->type) {
|
||||
case KE_KEY:
|
||||
input_report_key(hp_wmi_input_dev,
|
||||
key->keycode, 1);
|
||||
input_sync(hp_wmi_input_dev);
|
||||
input_report_key(hp_wmi_input_dev,
|
||||
key->keycode, 0);
|
||||
input_sync(hp_wmi_input_dev);
|
||||
break;
|
||||
}
|
||||
} else
|
||||
printk(KERN_INFO PREFIX "Unknown key code - 0x%x\n",
|
||||
key_code);
|
||||
break;
|
||||
case HPWMI_WIRELESS:
|
||||
if (wifi_rfkill)
|
||||
rfkill_set_states(wifi_rfkill,
|
||||
hp_wmi_get_sw_state(HPWMI_WIFI),
|
||||
|
@ -391,9 +508,18 @@ static void hp_wmi_notify(u32 value, void *context)
|
|||
rfkill_set_states(wwan_rfkill,
|
||||
hp_wmi_get_sw_state(HPWMI_WWAN),
|
||||
hp_wmi_get_hw_state(HPWMI_WWAN));
|
||||
} else
|
||||
printk(KERN_INFO "HP WMI: Unknown key pressed - %x\n",
|
||||
eventcode);
|
||||
break;
|
||||
case HPWMI_CPU_BATTERY_THROTTLE:
|
||||
printk(KERN_INFO PREFIX UNIMP "CPU throttle because of 3 Cell"
|
||||
" battery event detected\n");
|
||||
break;
|
||||
case HPWMI_LOCK_SWITCH:
|
||||
break;
|
||||
default:
|
||||
printk(KERN_INFO PREFIX "Unknown event_id - %d - 0x%x\n",
|
||||
event_id, event_data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static int __init hp_wmi_input_setup(void)
|
||||
|
@ -402,6 +528,8 @@ static int __init hp_wmi_input_setup(void)
|
|||
int err;
|
||||
|
||||
hp_wmi_input_dev = input_allocate_device();
|
||||
if (!hp_wmi_input_dev)
|
||||
return -ENOMEM;
|
||||
|
||||
hp_wmi_input_dev->name = "HP WMI hotkeys";
|
||||
hp_wmi_input_dev->phys = "wmi/input0";
|
||||
|
@ -450,7 +578,12 @@ static void cleanup_sysfs(struct platform_device *device)
|
|||
static int __devinit hp_wmi_bios_setup(struct platform_device *device)
|
||||
{
|
||||
int err;
|
||||
int wireless = hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 0, 0);
|
||||
int wireless;
|
||||
|
||||
err = hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 0, (char *)&wireless,
|
||||
sizeof(wireless));
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = device_create_file(&device->dev, &dev_attr_display);
|
||||
if (err)
|
||||
|
@ -581,27 +714,51 @@ static int hp_wmi_resume_handler(struct device *device)
|
|||
static int __init hp_wmi_init(void)
|
||||
{
|
||||
int err;
|
||||
int event_capable = wmi_has_guid(HPWMI_EVENT_GUID);
|
||||
int bios_capable = wmi_has_guid(HPWMI_BIOS_GUID);
|
||||
|
||||
if (wmi_has_guid(HPWMI_EVENT_GUID)) {
|
||||
if (event_capable) {
|
||||
err = wmi_install_notify_handler(HPWMI_EVENT_GUID,
|
||||
hp_wmi_notify, NULL);
|
||||
if (ACPI_SUCCESS(err))
|
||||
hp_wmi_input_setup();
|
||||
if (ACPI_FAILURE(err))
|
||||
return -EINVAL;
|
||||
err = hp_wmi_input_setup();
|
||||
if (err) {
|
||||
wmi_remove_notify_handler(HPWMI_EVENT_GUID);
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
if (wmi_has_guid(HPWMI_BIOS_GUID)) {
|
||||
if (bios_capable) {
|
||||
err = platform_driver_register(&hp_wmi_driver);
|
||||
if (err)
|
||||
return 0;
|
||||
goto err_driver_reg;
|
||||
hp_wmi_platform_dev = platform_device_alloc("hp-wmi", -1);
|
||||
if (!hp_wmi_platform_dev) {
|
||||
platform_driver_unregister(&hp_wmi_driver);
|
||||
return 0;
|
||||
err = -ENOMEM;
|
||||
goto err_device_alloc;
|
||||
}
|
||||
platform_device_add(hp_wmi_platform_dev);
|
||||
err = platform_device_add(hp_wmi_platform_dev);
|
||||
if (err)
|
||||
goto err_device_add;
|
||||
}
|
||||
|
||||
if (!bios_capable && !event_capable)
|
||||
return -ENODEV;
|
||||
|
||||
return 0;
|
||||
|
||||
err_device_add:
|
||||
platform_device_put(hp_wmi_platform_dev);
|
||||
err_device_alloc:
|
||||
platform_driver_unregister(&hp_wmi_driver);
|
||||
err_driver_reg:
|
||||
if (wmi_has_guid(HPWMI_EVENT_GUID)) {
|
||||
input_unregister_device(hp_wmi_input_dev);
|
||||
wmi_remove_notify_handler(HPWMI_EVENT_GUID);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static void __exit hp_wmi_exit(void)
|
||||
|
@ -611,7 +768,7 @@ static void __exit hp_wmi_exit(void)
|
|||
input_unregister_device(hp_wmi_input_dev);
|
||||
}
|
||||
if (hp_wmi_platform_dev) {
|
||||
platform_device_del(hp_wmi_platform_dev);
|
||||
platform_device_unregister(hp_wmi_platform_dev);
|
||||
platform_driver_unregister(&hp_wmi_driver);
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -53,6 +53,8 @@ MODULE_LICENSE("GPL");
|
|||
#define MEMORY_ARG_CUR_BANDWIDTH 1
|
||||
#define MEMORY_ARG_MAX_BANDWIDTH 0
|
||||
|
||||
static void intel_menlow_unregister_sensor(void);
|
||||
|
||||
/*
|
||||
* GTHS returning 'n' would mean that [0,n-1] states are supported
|
||||
* In that case max_cstate would be n-1
|
||||
|
@ -406,8 +408,10 @@ static int intel_menlow_add_one_attribute(char *name, int mode, void *show,
|
|||
attr->handle = handle;
|
||||
|
||||
result = device_create_file(dev, &attr->attr);
|
||||
if (result)
|
||||
if (result) {
|
||||
kfree(attr);
|
||||
return result;
|
||||
}
|
||||
|
||||
mutex_lock(&intel_menlow_attr_lock);
|
||||
list_add_tail(&attr->node, &intel_menlow_attr_list);
|
||||
|
@ -431,11 +435,11 @@ static acpi_status intel_menlow_register_sensor(acpi_handle handle, u32 lvl,
|
|||
/* _TZ must have the AUX0/1 methods */
|
||||
status = acpi_get_handle(handle, GET_AUX0, &dummy);
|
||||
if (ACPI_FAILURE(status))
|
||||
goto not_found;
|
||||
return (status == AE_NOT_FOUND) ? AE_OK : status;
|
||||
|
||||
status = acpi_get_handle(handle, SET_AUX0, &dummy);
|
||||
if (ACPI_FAILURE(status))
|
||||
goto not_found;
|
||||
return (status == AE_NOT_FOUND) ? AE_OK : status;
|
||||
|
||||
result = intel_menlow_add_one_attribute("aux0", 0644,
|
||||
aux0_show, aux0_store,
|
||||
|
@ -445,17 +449,19 @@ static acpi_status intel_menlow_register_sensor(acpi_handle handle, u32 lvl,
|
|||
|
||||
status = acpi_get_handle(handle, GET_AUX1, &dummy);
|
||||
if (ACPI_FAILURE(status))
|
||||
goto not_found;
|
||||
goto aux1_not_found;
|
||||
|
||||
status = acpi_get_handle(handle, SET_AUX1, &dummy);
|
||||
if (ACPI_FAILURE(status))
|
||||
goto not_found;
|
||||
goto aux1_not_found;
|
||||
|
||||
result = intel_menlow_add_one_attribute("aux1", 0644,
|
||||
aux1_show, aux1_store,
|
||||
&thermal->device, handle);
|
||||
if (result)
|
||||
if (result) {
|
||||
intel_menlow_unregister_sensor();
|
||||
return AE_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
* create the "dabney_enabled" attribute which means the user app
|
||||
|
@ -465,14 +471,17 @@ static acpi_status intel_menlow_register_sensor(acpi_handle handle, u32 lvl,
|
|||
result = intel_menlow_add_one_attribute("bios_enabled", 0444,
|
||||
bios_enabled_show, NULL,
|
||||
&thermal->device, handle);
|
||||
if (result)
|
||||
if (result) {
|
||||
intel_menlow_unregister_sensor();
|
||||
return AE_ERROR;
|
||||
}
|
||||
|
||||
not_found:
|
||||
aux1_not_found:
|
||||
if (status == AE_NOT_FOUND)
|
||||
return AE_OK;
|
||||
else
|
||||
return status;
|
||||
|
||||
intel_menlow_unregister_sensor();
|
||||
return status;
|
||||
}
|
||||
|
||||
static void intel_menlow_unregister_sensor(void)
|
||||
|
@ -513,8 +522,10 @@ static int __init intel_menlow_module_init(void)
|
|||
status = acpi_walk_namespace(ACPI_TYPE_THERMAL, ACPI_ROOT_OBJECT,
|
||||
ACPI_UINT32_MAX,
|
||||
intel_menlow_register_sensor, NULL, NULL, NULL);
|
||||
if (ACPI_FAILURE(status))
|
||||
if (ACPI_FAILURE(status)) {
|
||||
acpi_bus_unregister_driver(&intel_menlow_memory_driver);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,340 @@
|
|||
/* Moorestown PMIC GPIO (access through IPC) driver
|
||||
* Copyright (c) 2008 - 2009, Intel Corporation.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/* Supports:
|
||||
* Moorestown platform PMIC chip
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/stddef.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <asm/intel_scu_ipc.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/intel_pmic_gpio.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#define DRIVER_NAME "pmic_gpio"
|
||||
|
||||
/* register offset that IPC driver should use
|
||||
* 8 GPIO + 8 GPOSW (6 controllable) + 8GPO
|
||||
*/
|
||||
enum pmic_gpio_register {
|
||||
GPIO0 = 0xE0,
|
||||
GPIO7 = 0xE7,
|
||||
GPIOINT = 0xE8,
|
||||
GPOSWCTL0 = 0xEC,
|
||||
GPOSWCTL5 = 0xF1,
|
||||
GPO = 0xF4,
|
||||
};
|
||||
|
||||
/* bits definition for GPIO & GPOSW */
|
||||
#define GPIO_DRV 0x01
|
||||
#define GPIO_DIR 0x02
|
||||
#define GPIO_DIN 0x04
|
||||
#define GPIO_DOU 0x08
|
||||
#define GPIO_INTCTL 0x30
|
||||
#define GPIO_DBC 0xc0
|
||||
|
||||
#define GPOSW_DRV 0x01
|
||||
#define GPOSW_DOU 0x08
|
||||
#define GPOSW_RDRV 0x30
|
||||
|
||||
|
||||
#define NUM_GPIO 24
|
||||
|
||||
struct pmic_gpio_irq {
|
||||
spinlock_t lock;
|
||||
u32 trigger[NUM_GPIO];
|
||||
u32 dirty;
|
||||
struct work_struct work;
|
||||
};
|
||||
|
||||
|
||||
struct pmic_gpio {
|
||||
struct gpio_chip chip;
|
||||
struct pmic_gpio_irq irqtypes;
|
||||
void *gpiointr;
|
||||
int irq;
|
||||
unsigned irq_base;
|
||||
};
|
||||
|
||||
static void pmic_program_irqtype(int gpio, int type)
|
||||
{
|
||||
if (type & IRQ_TYPE_EDGE_RISING)
|
||||
intel_scu_ipc_update_register(GPIO0 + gpio, 0x20, 0x20);
|
||||
else
|
||||
intel_scu_ipc_update_register(GPIO0 + gpio, 0x00, 0x20);
|
||||
|
||||
if (type & IRQ_TYPE_EDGE_FALLING)
|
||||
intel_scu_ipc_update_register(GPIO0 + gpio, 0x10, 0x10);
|
||||
else
|
||||
intel_scu_ipc_update_register(GPIO0 + gpio, 0x00, 0x10);
|
||||
};
|
||||
|
||||
static void pmic_irqtype_work(struct work_struct *work)
|
||||
{
|
||||
struct pmic_gpio_irq *t =
|
||||
container_of(work, struct pmic_gpio_irq, work);
|
||||
unsigned long flags;
|
||||
int i;
|
||||
u16 type;
|
||||
|
||||
spin_lock_irqsave(&t->lock, flags);
|
||||
/* As we drop the lock, we may need multiple scans if we race the
|
||||
pmic_irq_type function */
|
||||
while (t->dirty) {
|
||||
/*
|
||||
* For each pin that has the dirty bit set send an IPC
|
||||
* message to configure the hardware via the PMIC
|
||||
*/
|
||||
for (i = 0; i < NUM_GPIO; i++) {
|
||||
if (!(t->dirty & (1 << i)))
|
||||
continue;
|
||||
t->dirty &= ~(1 << i);
|
||||
/* We can't trust the array entry or dirty
|
||||
once the lock is dropped */
|
||||
type = t->trigger[i];
|
||||
spin_unlock_irqrestore(&t->lock, flags);
|
||||
pmic_program_irqtype(i, type);
|
||||
spin_lock_irqsave(&t->lock, flags);
|
||||
}
|
||||
}
|
||||
spin_unlock_irqrestore(&t->lock, flags);
|
||||
}
|
||||
|
||||
static int pmic_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
|
||||
{
|
||||
if (offset > 8) {
|
||||
printk(KERN_ERR
|
||||
"%s: only pin 0-7 support input\n", __func__);
|
||||
return -1;/* we only have 8 GPIO can use as input */
|
||||
}
|
||||
return intel_scu_ipc_update_register(GPIO0 + offset,
|
||||
GPIO_DIR, GPIO_DIR);
|
||||
}
|
||||
|
||||
static int pmic_gpio_direction_output(struct gpio_chip *chip,
|
||||
unsigned offset, int value)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
if (offset < 8)/* it is GPIO */
|
||||
rc = intel_scu_ipc_update_register(GPIO0 + offset,
|
||||
GPIO_DRV | GPIO_DOU | GPIO_DIR,
|
||||
GPIO_DRV | (value ? GPIO_DOU : 0));
|
||||
else if (offset < 16)/* it is GPOSW */
|
||||
rc = intel_scu_ipc_update_register(GPOSWCTL0 + offset - 8,
|
||||
GPOSW_DRV | GPOSW_DOU | GPOSW_RDRV,
|
||||
GPOSW_DRV | (value ? GPOSW_DOU : 0));
|
||||
else if (offset > 15 && offset < 24)/* it is GPO */
|
||||
rc = intel_scu_ipc_update_register(GPO,
|
||||
1 << (offset - 16),
|
||||
value ? 1 << (offset - 16) : 0);
|
||||
else {
|
||||
printk(KERN_ERR
|
||||
"%s: invalid PMIC GPIO pin %d!\n", __func__, offset);
|
||||
WARN_ON(1);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int pmic_gpio_get(struct gpio_chip *chip, unsigned offset)
|
||||
{
|
||||
u8 r;
|
||||
int ret;
|
||||
|
||||
/* we only have 8 GPIO pins we can use as input */
|
||||
if (offset > 8)
|
||||
return -EOPNOTSUPP;
|
||||
ret = intel_scu_ipc_ioread8(GPIO0 + offset, &r);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
return r & GPIO_DIN;
|
||||
}
|
||||
|
||||
static void pmic_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
|
||||
{
|
||||
if (offset < 8)/* it is GPIO */
|
||||
intel_scu_ipc_update_register(GPIO0 + offset,
|
||||
GPIO_DRV | GPIO_DOU,
|
||||
GPIO_DRV | (value ? GPIO_DOU : 0));
|
||||
else if (offset < 16)/* it is GPOSW */
|
||||
intel_scu_ipc_update_register(GPOSWCTL0 + offset - 8,
|
||||
GPOSW_DRV | GPOSW_DOU | GPOSW_RDRV,
|
||||
GPOSW_DRV | (value ? GPOSW_DOU : 0));
|
||||
else if (offset > 15 && offset < 24) /* it is GPO */
|
||||
intel_scu_ipc_update_register(GPO,
|
||||
1 << (offset - 16),
|
||||
value ? 1 << (offset - 16) : 0);
|
||||
}
|
||||
|
||||
static int pmic_irq_type(unsigned irq, unsigned type)
|
||||
{
|
||||
struct pmic_gpio *pg = get_irq_chip_data(irq);
|
||||
u32 gpio = irq - pg->irq_base;
|
||||
unsigned long flags;
|
||||
|
||||
if (gpio > pg->chip.ngpio)
|
||||
return -EINVAL;
|
||||
|
||||
spin_lock_irqsave(&pg->irqtypes.lock, flags);
|
||||
pg->irqtypes.trigger[gpio] = type;
|
||||
pg->irqtypes.dirty |= (1 << gpio);
|
||||
spin_unlock_irqrestore(&pg->irqtypes.lock, flags);
|
||||
schedule_work(&pg->irqtypes.work);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int pmic_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
|
||||
{
|
||||
struct pmic_gpio *pg = container_of(chip, struct pmic_gpio, chip);
|
||||
|
||||
return pg->irq_base + offset;
|
||||
}
|
||||
|
||||
/* the gpiointr register is read-clear, so just do nothing. */
|
||||
static void pmic_irq_unmask(unsigned irq)
|
||||
{
|
||||
};
|
||||
|
||||
static void pmic_irq_mask(unsigned irq)
|
||||
{
|
||||
};
|
||||
|
||||
static struct irq_chip pmic_irqchip = {
|
||||
.name = "PMIC-GPIO",
|
||||
.mask = pmic_irq_mask,
|
||||
.unmask = pmic_irq_unmask,
|
||||
.set_type = pmic_irq_type,
|
||||
};
|
||||
|
||||
static void pmic_irq_handler(unsigned irq, struct irq_desc *desc)
|
||||
{
|
||||
struct pmic_gpio *pg = (struct pmic_gpio *)get_irq_data(irq);
|
||||
u8 intsts = *((u8 *)pg->gpiointr + 4);
|
||||
int gpio;
|
||||
|
||||
for (gpio = 0; gpio < 8; gpio++) {
|
||||
if (intsts & (1 << gpio)) {
|
||||
pr_debug("pmic pin %d triggered\n", gpio);
|
||||
generic_handle_irq(pg->irq_base + gpio);
|
||||
}
|
||||
}
|
||||
desc->chip->eoi(irq);
|
||||
}
|
||||
|
||||
static int __devinit platform_pmic_gpio_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
int irq = platform_get_irq(pdev, 0);
|
||||
struct intel_pmic_gpio_platform_data *pdata = dev->platform_data;
|
||||
|
||||
struct pmic_gpio *pg;
|
||||
int retval;
|
||||
int i;
|
||||
|
||||
if (irq < 0) {
|
||||
dev_dbg(dev, "no IRQ line\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!pdata || !pdata->gpio_base || !pdata->irq_base) {
|
||||
dev_dbg(dev, "incorrect or missing platform data\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
pg = kzalloc(sizeof(*pg), GFP_KERNEL);
|
||||
if (!pg)
|
||||
return -ENOMEM;
|
||||
|
||||
dev_set_drvdata(dev, pg);
|
||||
|
||||
pg->irq = irq;
|
||||
/* setting up SRAM mapping for GPIOINT register */
|
||||
pg->gpiointr = ioremap_nocache(pdata->gpiointr, 8);
|
||||
if (!pg->gpiointr) {
|
||||
printk(KERN_ERR "%s: Can not map GPIOINT.\n", __func__);
|
||||
retval = -EINVAL;
|
||||
goto err2;
|
||||
}
|
||||
pg->irq_base = pdata->irq_base;
|
||||
pg->chip.label = "intel_pmic";
|
||||
pg->chip.direction_input = pmic_gpio_direction_input;
|
||||
pg->chip.direction_output = pmic_gpio_direction_output;
|
||||
pg->chip.get = pmic_gpio_get;
|
||||
pg->chip.set = pmic_gpio_set;
|
||||
pg->chip.to_irq = pmic_gpio_to_irq;
|
||||
pg->chip.base = pdata->gpio_base;
|
||||
pg->chip.ngpio = NUM_GPIO;
|
||||
pg->chip.can_sleep = 1;
|
||||
pg->chip.dev = dev;
|
||||
|
||||
INIT_WORK(&pg->irqtypes.work, pmic_irqtype_work);
|
||||
spin_lock_init(&pg->irqtypes.lock);
|
||||
|
||||
pg->chip.dev = dev;
|
||||
retval = gpiochip_add(&pg->chip);
|
||||
if (retval) {
|
||||
printk(KERN_ERR "%s: Can not add pmic gpio chip.\n", __func__);
|
||||
goto err;
|
||||
}
|
||||
set_irq_data(pg->irq, pg);
|
||||
set_irq_chained_handler(pg->irq, pmic_irq_handler);
|
||||
for (i = 0; i < 8; i++) {
|
||||
set_irq_chip_and_handler_name(i + pg->irq_base, &pmic_irqchip,
|
||||
handle_simple_irq, "demux");
|
||||
set_irq_chip_data(i + pg->irq_base, pg);
|
||||
}
|
||||
return 0;
|
||||
err:
|
||||
iounmap(pg->gpiointr);
|
||||
err2:
|
||||
kfree(pg);
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* at the same time, register a platform driver
|
||||
* this supports the sfi 0.81 fw */
|
||||
static struct platform_driver platform_pmic_gpio_driver = {
|
||||
.driver = {
|
||||
.name = DRIVER_NAME,
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
.probe = platform_pmic_gpio_probe,
|
||||
};
|
||||
|
||||
static int __init platform_pmic_gpio_init(void)
|
||||
{
|
||||
return platform_driver_register(&platform_pmic_gpio_driver);
|
||||
}
|
||||
|
||||
subsys_initcall(platform_pmic_gpio_init);
|
||||
|
||||
MODULE_AUTHOR("Alek Du <alek.du@intel.com>");
|
||||
MODULE_DESCRIPTION("Intel Moorestown PMIC GPIO driver");
|
||||
MODULE_LICENSE("GPL v2");
|
|
@ -40,15 +40,12 @@
|
|||
* Initial publish
|
||||
*/
|
||||
|
||||
#define DEBUG 1
|
||||
|
||||
#include "rar_register.h"
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/rar_register.h>
|
||||
|
||||
/* === Lincroft Message Bus Interface === */
|
||||
#define LNC_MCR_OFFSET 0xD0 /* Message Control Register */
|
||||
|
@ -155,7 +152,6 @@ static struct rar_device *_rar_to_device(int rar, int *off)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* rar_to_device - return the device handling this RAR
|
||||
* @rar: RAR number
|
||||
|
@ -496,7 +492,7 @@ EXPORT_SYMBOL(rar_lock);
|
|||
* a driver that do require a valid RAR address. One of those
|
||||
* steps would be to call rar_get_address()
|
||||
*
|
||||
* This function return 0 on success an error code on failure.
|
||||
* This function return 0 on success or an error code on failure.
|
||||
*/
|
||||
int register_rar(int num, int (*callback)(unsigned long data),
|
||||
unsigned long data)
|
|
@ -23,7 +23,7 @@
|
|||
#include <linux/pm.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <asm/setup.h>
|
||||
#include <asm/mrst.h>
|
||||
#include <asm/intel_scu_ipc.h>
|
||||
|
||||
/* IPC defines the following message types */
|
||||
|
@ -38,10 +38,6 @@
|
|||
#define IPC_CMD_PCNTRL_R 1 /* Register read */
|
||||
#define IPC_CMD_PCNTRL_M 2 /* Register read-modify-write */
|
||||
|
||||
/* Miscelaneous Command ids */
|
||||
#define IPC_CMD_INDIRECT_RD 2 /* 32bit indirect read */
|
||||
#define IPC_CMD_INDIRECT_WR 5 /* 32bit indirect write */
|
||||
|
||||
/*
|
||||
* IPC register summary
|
||||
*
|
||||
|
@ -62,8 +58,8 @@
|
|||
|
||||
#define IPC_BASE_ADDR 0xFF11C000 /* IPC1 base register address */
|
||||
#define IPC_MAX_ADDR 0x100 /* Maximum IPC regisers */
|
||||
#define IPC_WWBUF_SIZE 16 /* IPC Write buffer Size */
|
||||
#define IPC_RWBUF_SIZE 16 /* IPC Read buffer Size */
|
||||
#define IPC_WWBUF_SIZE 20 /* IPC Write buffer Size */
|
||||
#define IPC_RWBUF_SIZE 20 /* IPC Read buffer Size */
|
||||
#define IPC_I2C_BASE 0xFF12B000 /* I2C control register base address */
|
||||
#define IPC_I2C_MAX_ADDR 0x10 /* Maximum I2C regisers */
|
||||
|
||||
|
@ -78,12 +74,7 @@ struct intel_scu_ipc_dev {
|
|||
|
||||
static struct intel_scu_ipc_dev ipcdev; /* Only one for now */
|
||||
|
||||
static int platform = 1;
|
||||
module_param(platform, int, 0);
|
||||
MODULE_PARM_DESC(platform, "1 for moorestown platform");
|
||||
|
||||
|
||||
|
||||
static int platform; /* Platform type */
|
||||
|
||||
/*
|
||||
* IPC Read Buffer (Read Only):
|
||||
|
@ -118,24 +109,6 @@ static inline void ipc_data_writel(u32 data, u32 offset) /* Write ipc data */
|
|||
writel(data, ipcdev.ipc_base + 0x80 + offset);
|
||||
}
|
||||
|
||||
/*
|
||||
* IPC destination Pointer (Write Only):
|
||||
* Use content as pointer for destination write
|
||||
*/
|
||||
static inline void ipc_write_dptr(u32 data) /* Write dptr data */
|
||||
{
|
||||
writel(data, ipcdev.ipc_base + 0x0C);
|
||||
}
|
||||
|
||||
/*
|
||||
* IPC Source Pointer (Write Only):
|
||||
* Use content as pointer for read location
|
||||
*/
|
||||
static inline void ipc_write_sptr(u32 data) /* Write dptr data */
|
||||
{
|
||||
writel(data, ipcdev.ipc_base + 0x08);
|
||||
}
|
||||
|
||||
/*
|
||||
* Status Register (Read Only):
|
||||
* Driver will read this register to get the ready/busy status of the IPC
|
||||
|
@ -154,7 +127,7 @@ static inline u8 ipc_data_readb(u32 offset) /* Read ipc byte data */
|
|||
return readb(ipcdev.ipc_base + IPC_READ_BUFFER + offset);
|
||||
}
|
||||
|
||||
static inline u8 ipc_data_readl(u32 offset) /* Read ipc u32 data */
|
||||
static inline u32 ipc_data_readl(u32 offset) /* Read ipc u32 data */
|
||||
{
|
||||
return readl(ipcdev.ipc_base + IPC_READ_BUFFER + offset);
|
||||
}
|
||||
|
@ -175,62 +148,73 @@ static inline int busy_loop(void) /* Wait till scu status is busy */
|
|||
return -ETIMEDOUT;
|
||||
}
|
||||
}
|
||||
return (status >> 1) & 1;
|
||||
if ((status >> 1) & 1)
|
||||
return -EIO;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Read/Write power control(PMIC in Langwell, MSIC in PenWell) registers */
|
||||
static int pwr_reg_rdwr(u16 *addr, u8 *data, u32 count, u32 op, u32 id)
|
||||
{
|
||||
int nc;
|
||||
int i, nc, bytes, d;
|
||||
u32 offset = 0;
|
||||
u32 err = 0;
|
||||
u8 cbuf[IPC_WWBUF_SIZE] = { '\0' };
|
||||
u8 cbuf[IPC_WWBUF_SIZE] = { };
|
||||
u32 *wbuf = (u32 *)&cbuf;
|
||||
|
||||
mutex_lock(&ipclock);
|
||||
|
||||
memset(cbuf, 0, sizeof(cbuf));
|
||||
|
||||
if (ipcdev.pdev == NULL) {
|
||||
mutex_unlock(&ipclock);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
if (platform == 1) {
|
||||
/* Entry is 4 bytes for read/write, 5 bytes for read modify */
|
||||
for (nc = 0; nc < count; nc++) {
|
||||
if (platform != MRST_CPU_CHIP_PENWELL) {
|
||||
bytes = 0;
|
||||
d = 0;
|
||||
for (i = 0; i < count; i++) {
|
||||
cbuf[bytes++] = addr[i];
|
||||
cbuf[bytes++] = addr[i] >> 8;
|
||||
if (id != IPC_CMD_PCNTRL_R)
|
||||
cbuf[bytes++] = data[d++];
|
||||
if (id == IPC_CMD_PCNTRL_M)
|
||||
cbuf[bytes++] = data[d++];
|
||||
}
|
||||
for (i = 0; i < bytes; i += 4)
|
||||
ipc_data_writel(wbuf[i/4], i);
|
||||
ipc_command(bytes << 16 | id << 12 | 0 << 8 | op);
|
||||
} else {
|
||||
for (nc = 0; nc < count; nc++, offset += 2) {
|
||||
cbuf[offset] = addr[nc];
|
||||
cbuf[offset + 1] = addr[nc] >> 8;
|
||||
if (id != IPC_CMD_PCNTRL_R)
|
||||
cbuf[offset + 2] = data[nc];
|
||||
if (id == IPC_CMD_PCNTRL_M) {
|
||||
cbuf[offset + 3] = data[nc + 1];
|
||||
offset += 1;
|
||||
}
|
||||
offset += 3;
|
||||
}
|
||||
for (nc = 0, offset = 0; nc < count; nc++, offset += 4)
|
||||
ipc_data_writel(wbuf[nc], offset); /* Write wbuff */
|
||||
|
||||
} else {
|
||||
for (nc = 0, offset = 0; nc < count; nc++, offset += 2)
|
||||
ipc_data_writel(addr[nc], offset); /* Write addresses */
|
||||
if (id != IPC_CMD_PCNTRL_R) {
|
||||
for (nc = 0; nc < count; nc++, offset++)
|
||||
ipc_data_writel(data[nc], offset); /* Write data */
|
||||
if (id == IPC_CMD_PCNTRL_M)
|
||||
ipc_data_writel(data[nc + 1], offset); /* Mask value*/
|
||||
if (id == IPC_CMD_PCNTRL_R) {
|
||||
for (nc = 0, offset = 0; nc < count; nc++, offset += 4)
|
||||
ipc_data_writel(wbuf[nc], offset);
|
||||
ipc_command((count*2) << 16 | id << 12 | 0 << 8 | op);
|
||||
} else if (id == IPC_CMD_PCNTRL_W) {
|
||||
for (nc = 0; nc < count; nc++, offset += 1)
|
||||
cbuf[offset] = data[nc];
|
||||
for (nc = 0, offset = 0; nc < count; nc++, offset += 4)
|
||||
ipc_data_writel(wbuf[nc], offset);
|
||||
ipc_command((count*3) << 16 | id << 12 | 0 << 8 | op);
|
||||
} else if (id == IPC_CMD_PCNTRL_M) {
|
||||
cbuf[offset] = data[0];
|
||||
cbuf[offset + 1] = data[1];
|
||||
ipc_data_writel(wbuf[0], 0); /* Write wbuff */
|
||||
ipc_command(4 << 16 | id << 12 | 0 << 8 | op);
|
||||
}
|
||||
}
|
||||
|
||||
if (id != IPC_CMD_PCNTRL_M)
|
||||
ipc_command((count * 3) << 16 | id << 12 | 0 << 8 | op);
|
||||
else
|
||||
ipc_command((count * 4) << 16 | id << 12 | 0 << 8 | op);
|
||||
|
||||
err = busy_loop();
|
||||
|
||||
if (id == IPC_CMD_PCNTRL_R) { /* Read rbuf */
|
||||
/* Workaround: values are read as 0 without memcpy_fromio */
|
||||
memcpy_fromio(cbuf, ipcdev.ipc_base + IPC_READ_BUFFER, 16);
|
||||
if (platform == 1) {
|
||||
memcpy_fromio(cbuf, ipcdev.ipc_base + 0x90, 16);
|
||||
if (platform != MRST_CPU_CHIP_PENWELL) {
|
||||
for (nc = 0, offset = 2; nc < count; nc++, offset += 3)
|
||||
data[nc] = ipc_data_readb(offset);
|
||||
} else {
|
||||
|
@ -404,70 +388,6 @@ int intel_scu_ipc_update_register(u16 addr, u8 bits, u8 mask)
|
|||
}
|
||||
EXPORT_SYMBOL(intel_scu_ipc_update_register);
|
||||
|
||||
/**
|
||||
* intel_scu_ipc_register_read - 32bit indirect read
|
||||
* @addr: register address
|
||||
* @value: 32bit value return
|
||||
*
|
||||
* Performs IA 32 bit indirect read, returns 0 on success, or an
|
||||
* error code.
|
||||
*
|
||||
* Can be used when SCCB(System Controller Configuration Block) register
|
||||
* HRIM(Honor Restricted IPC Messages) is set (bit 23)
|
||||
*
|
||||
* This function may sleep. Locking for SCU accesses is handled for
|
||||
* the caller.
|
||||
*/
|
||||
int intel_scu_ipc_register_read(u32 addr, u32 *value)
|
||||
{
|
||||
u32 err = 0;
|
||||
|
||||
mutex_lock(&ipclock);
|
||||
if (ipcdev.pdev == NULL) {
|
||||
mutex_unlock(&ipclock);
|
||||
return -ENODEV;
|
||||
}
|
||||
ipc_write_sptr(addr);
|
||||
ipc_command(4 << 16 | IPC_CMD_INDIRECT_RD);
|
||||
err = busy_loop();
|
||||
*value = ipc_data_readl(0);
|
||||
mutex_unlock(&ipclock);
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL(intel_scu_ipc_register_read);
|
||||
|
||||
/**
|
||||
* intel_scu_ipc_register_write - 32bit indirect write
|
||||
* @addr: register address
|
||||
* @value: 32bit value to write
|
||||
*
|
||||
* Performs IA 32 bit indirect write, returns 0 on success, or an
|
||||
* error code.
|
||||
*
|
||||
* Can be used when SCCB(System Controller Configuration Block) register
|
||||
* HRIM(Honor Restricted IPC Messages) is set (bit 23)
|
||||
*
|
||||
* This function may sleep. Locking for SCU accesses is handled for
|
||||
* the caller.
|
||||
*/
|
||||
int intel_scu_ipc_register_write(u32 addr, u32 value)
|
||||
{
|
||||
u32 err = 0;
|
||||
|
||||
mutex_lock(&ipclock);
|
||||
if (ipcdev.pdev == NULL) {
|
||||
mutex_unlock(&ipclock);
|
||||
return -ENODEV;
|
||||
}
|
||||
ipc_write_dptr(addr);
|
||||
ipc_data_writel(value, 0);
|
||||
ipc_command(4 << 16 | IPC_CMD_INDIRECT_WR);
|
||||
err = busy_loop();
|
||||
mutex_unlock(&ipclock);
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL(intel_scu_ipc_register_write);
|
||||
|
||||
/**
|
||||
* intel_scu_ipc_simple_command - send a simple command
|
||||
* @cmd: command
|
||||
|
@ -524,7 +444,7 @@ int intel_scu_ipc_command(int cmd, int sub, u32 *in, int inlen,
|
|||
for (i = 0; i < inlen; i++)
|
||||
ipc_data_writel(*in++, 4 * i);
|
||||
|
||||
ipc_command((sub << 12) | cmd | (inlen << 18));
|
||||
ipc_command((inlen << 16) | (sub << 12) | cmd);
|
||||
err = busy_loop();
|
||||
|
||||
for (i = 0; i < outlen; i++)
|
||||
|
@ -803,6 +723,7 @@ static void ipc_remove(struct pci_dev *pdev)
|
|||
|
||||
static const struct pci_device_id pci_ids[] = {
|
||||
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x080e)},
|
||||
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x082a)},
|
||||
{ 0,}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(pci, pci_ids);
|
||||
|
@ -817,6 +738,9 @@ static struct pci_driver ipc_driver = {
|
|||
|
||||
static int __init intel_scu_ipc_init(void)
|
||||
{
|
||||
platform = mrst_identify_cpu();
|
||||
if (platform == 0)
|
||||
return -ENODEV;
|
||||
return pci_register_driver(&ipc_driver);
|
||||
}
|
||||
|
||||
|
|
|
@ -434,7 +434,7 @@ static int dmi_check_cb(const struct dmi_system_id *id)
|
|||
{
|
||||
printk(KERN_INFO "msi-laptop: Identified laptop model '%s'.\n",
|
||||
id->ident);
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static struct dmi_system_id __initdata msi_dmi_table[] = {
|
||||
|
@ -562,15 +562,15 @@ static int rfkill_threeg_set(void *data, bool blocked)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static struct rfkill_ops rfkill_bluetooth_ops = {
|
||||
static const struct rfkill_ops rfkill_bluetooth_ops = {
|
||||
.set_block = rfkill_bluetooth_set
|
||||
};
|
||||
|
||||
static struct rfkill_ops rfkill_wlan_ops = {
|
||||
static const struct rfkill_ops rfkill_wlan_ops = {
|
||||
.set_block = rfkill_wlan_set
|
||||
};
|
||||
|
||||
static struct rfkill_ops rfkill_threeg_ops = {
|
||||
static const struct rfkill_ops rfkill_threeg_ops = {
|
||||
.set_block = rfkill_threeg_set
|
||||
};
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ static struct key_entry msi_wmi_keymap[] = {
|
|||
};
|
||||
static ktime_t last_pressed[ARRAY_SIZE(msi_wmi_keymap) - 1];
|
||||
|
||||
struct backlight_device *backlight;
|
||||
static struct backlight_device *backlight;
|
||||
|
||||
static int backlight_map[] = { 0x00, 0x33, 0x66, 0x99, 0xCC, 0xFF };
|
||||
|
||||
|
|
|
@ -248,7 +248,7 @@ static int acpi_pcc_write_sset(struct pcc_acpi *pcc, int func, int val)
|
|||
status = acpi_evaluate_object(pcc->handle, METHOD_HKEY_SSET,
|
||||
¶ms, NULL);
|
||||
|
||||
return status == AE_OK;
|
||||
return (status == AE_OK) ? 0 : -EIO;
|
||||
}
|
||||
|
||||
static inline int acpi_pcc_get_sqty(struct acpi_device *device)
|
||||
|
@ -586,7 +586,6 @@ static int acpi_pcc_init_input(struct pcc_acpi *pcc)
|
|||
static int acpi_pcc_hotkey_resume(struct acpi_device *device)
|
||||
{
|
||||
struct pcc_acpi *pcc = acpi_driver_data(device);
|
||||
acpi_status status = AE_OK;
|
||||
|
||||
if (device == NULL || pcc == NULL)
|
||||
return -EINVAL;
|
||||
|
@ -594,9 +593,7 @@ static int acpi_pcc_hotkey_resume(struct acpi_device *device)
|
|||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Sticky mode restore: %d\n",
|
||||
pcc->sticky_mode));
|
||||
|
||||
status = acpi_pcc_write_sset(pcc, SINF_STICKY_KEY, pcc->sticky_mode);
|
||||
|
||||
return status == AE_OK ? 0 : -EINVAL;
|
||||
return acpi_pcc_write_sset(pcc, SINF_STICKY_KEY, pcc->sticky_mode);
|
||||
}
|
||||
|
||||
static int acpi_pcc_hotkey_add(struct acpi_device *device)
|
||||
|
|
|
@ -561,8 +561,7 @@ static void sony_pf_remove(void)
|
|||
if (!atomic_dec_and_test(&sony_pf_users))
|
||||
return;
|
||||
|
||||
platform_device_del(sony_pf_device);
|
||||
platform_device_put(sony_pf_device);
|
||||
platform_device_unregister(sony_pf_device);
|
||||
platform_driver_unregister(&sony_pf_driver);
|
||||
}
|
||||
|
||||
|
@ -1196,9 +1195,13 @@ static void sony_nc_rfkill_setup(struct acpi_device *device)
|
|||
}
|
||||
|
||||
device_enum = (union acpi_object *) buffer.pointer;
|
||||
if (!device_enum || device_enum->type != ACPI_TYPE_BUFFER) {
|
||||
printk(KERN_ERR "Invalid SN06 return object 0x%.2x\n",
|
||||
device_enum->type);
|
||||
if (!device_enum) {
|
||||
pr_err("Invalid SN06 return object\n");
|
||||
goto out_no_enum;
|
||||
}
|
||||
if (device_enum->type != ACPI_TYPE_BUFFER) {
|
||||
pr_err("Invalid SN06 return object type 0x%.2x\n",
|
||||
device_enum->type);
|
||||
goto out_no_enum;
|
||||
}
|
||||
|
||||
|
|
|
@ -5837,75 +5837,6 @@ static struct ibm_struct thermal_driver_data = {
|
|||
.exit = thermal_exit,
|
||||
};
|
||||
|
||||
/*************************************************************************
|
||||
* EC Dump subdriver
|
||||
*/
|
||||
|
||||
static u8 ecdump_regs[256];
|
||||
|
||||
static int ecdump_read(struct seq_file *m)
|
||||
{
|
||||
int i, j;
|
||||
u8 v;
|
||||
|
||||
seq_printf(m, "EC "
|
||||
" +00 +01 +02 +03 +04 +05 +06 +07"
|
||||
" +08 +09 +0a +0b +0c +0d +0e +0f\n");
|
||||
for (i = 0; i < 256; i += 16) {
|
||||
seq_printf(m, "EC 0x%02x:", i);
|
||||
for (j = 0; j < 16; j++) {
|
||||
if (!acpi_ec_read(i + j, &v))
|
||||
break;
|
||||
if (v != ecdump_regs[i + j])
|
||||
seq_printf(m, " *%02x", v);
|
||||
else
|
||||
seq_printf(m, " %02x", v);
|
||||
ecdump_regs[i + j] = v;
|
||||
}
|
||||
seq_putc(m, '\n');
|
||||
if (j != 16)
|
||||
break;
|
||||
}
|
||||
|
||||
/* These are way too dangerous to advertise openly... */
|
||||
#if 0
|
||||
seq_printf(m, "commands:\t0x<offset> 0x<value>"
|
||||
" (<offset> is 00-ff, <value> is 00-ff)\n");
|
||||
seq_printf(m, "commands:\t0x<offset> <value> "
|
||||
" (<offset> is 00-ff, <value> is 0-255)\n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ecdump_write(char *buf)
|
||||
{
|
||||
char *cmd;
|
||||
int i, v;
|
||||
|
||||
while ((cmd = next_cmd(&buf))) {
|
||||
if (sscanf(cmd, "0x%x 0x%x", &i, &v) == 2) {
|
||||
/* i and v set */
|
||||
} else if (sscanf(cmd, "0x%x %u", &i, &v) == 2) {
|
||||
/* i and v set */
|
||||
} else
|
||||
return -EINVAL;
|
||||
if (i >= 0 && i < 256 && v >= 0 && v < 256) {
|
||||
if (!acpi_ec_write(i, v))
|
||||
return -EIO;
|
||||
} else
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct ibm_struct ecdump_driver_data = {
|
||||
.name = "ecdump",
|
||||
.read = ecdump_read,
|
||||
.write = ecdump_write,
|
||||
.flags.experimental = 1,
|
||||
};
|
||||
|
||||
/*************************************************************************
|
||||
* Backlight/brightness subdriver
|
||||
*/
|
||||
|
@ -8882,9 +8813,6 @@ static struct ibm_init_struct ibms_init[] __initdata = {
|
|||
.init = thermal_init,
|
||||
.data = &thermal_driver_data,
|
||||
},
|
||||
{
|
||||
.data = &ecdump_driver_data,
|
||||
},
|
||||
{
|
||||
.init = brightness_init,
|
||||
.data = &brightness_driver_data,
|
||||
|
@ -8993,7 +8921,6 @@ TPACPI_PARAM(light);
|
|||
TPACPI_PARAM(cmos);
|
||||
TPACPI_PARAM(led);
|
||||
TPACPI_PARAM(beep);
|
||||
TPACPI_PARAM(ecdump);
|
||||
TPACPI_PARAM(brightness);
|
||||
TPACPI_PARAM(volume);
|
||||
TPACPI_PARAM(fan);
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
*
|
||||
* Copyright (C) 2002-2004 John Belmonte
|
||||
* Copyright (C) 2008 Philip Langdale
|
||||
* Copyright (C) 2010 Pierre Ducroquet
|
||||
*
|
||||
* 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
|
||||
|
@ -47,6 +48,7 @@
|
|||
#include <linux/platform_device.h>
|
||||
#include <linux/rfkill.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/leds.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
|
@ -129,6 +131,8 @@ enum {KE_KEY, KE_END};
|
|||
|
||||
static struct key_entry toshiba_acpi_keymap[] = {
|
||||
{KE_KEY, 0x101, KEY_MUTE},
|
||||
{KE_KEY, 0x102, KEY_ZOOMOUT},
|
||||
{KE_KEY, 0x103, KEY_ZOOMIN},
|
||||
{KE_KEY, 0x13b, KEY_COFFEE},
|
||||
{KE_KEY, 0x13c, KEY_BATTERY},
|
||||
{KE_KEY, 0x13d, KEY_SLEEP},
|
||||
|
@ -285,6 +289,7 @@ struct toshiba_acpi_dev {
|
|||
struct platform_device *p_dev;
|
||||
struct rfkill *bt_rfk;
|
||||
struct input_dev *hotkey_dev;
|
||||
int illumination_installed;
|
||||
acpi_handle handle;
|
||||
|
||||
const char *bt_name;
|
||||
|
@ -292,6 +297,110 @@ struct toshiba_acpi_dev {
|
|||
struct mutex mutex;
|
||||
};
|
||||
|
||||
/* Illumination support */
|
||||
static int toshiba_illumination_available(void)
|
||||
{
|
||||
u32 in[HCI_WORDS] = { 0, 0, 0, 0, 0, 0 };
|
||||
u32 out[HCI_WORDS];
|
||||
acpi_status status;
|
||||
|
||||
in[0] = 0xf100;
|
||||
status = hci_raw(in, out);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
printk(MY_INFO "Illumination device not available\n");
|
||||
return 0;
|
||||
}
|
||||
in[0] = 0xf400;
|
||||
status = hci_raw(in, out);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void toshiba_illumination_set(struct led_classdev *cdev,
|
||||
enum led_brightness brightness)
|
||||
{
|
||||
u32 in[HCI_WORDS] = { 0, 0, 0, 0, 0, 0 };
|
||||
u32 out[HCI_WORDS];
|
||||
acpi_status status;
|
||||
|
||||
/* First request : initialize communication. */
|
||||
in[0] = 0xf100;
|
||||
status = hci_raw(in, out);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
printk(MY_INFO "Illumination device not available\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (brightness) {
|
||||
/* Switch the illumination on */
|
||||
in[0] = 0xf400;
|
||||
in[1] = 0x14e;
|
||||
in[2] = 1;
|
||||
status = hci_raw(in, out);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
printk(MY_INFO "ACPI call for illumination failed.\n");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
/* Switch the illumination off */
|
||||
in[0] = 0xf400;
|
||||
in[1] = 0x14e;
|
||||
in[2] = 0;
|
||||
status = hci_raw(in, out);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
printk(MY_INFO "ACPI call for illumination failed.\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Last request : close communication. */
|
||||
in[0] = 0xf200;
|
||||
in[1] = 0;
|
||||
in[2] = 0;
|
||||
hci_raw(in, out);
|
||||
}
|
||||
|
||||
static enum led_brightness toshiba_illumination_get(struct led_classdev *cdev)
|
||||
{
|
||||
u32 in[HCI_WORDS] = { 0, 0, 0, 0, 0, 0 };
|
||||
u32 out[HCI_WORDS];
|
||||
acpi_status status;
|
||||
enum led_brightness result;
|
||||
|
||||
/* First request : initialize communication. */
|
||||
in[0] = 0xf100;
|
||||
status = hci_raw(in, out);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
printk(MY_INFO "Illumination device not available\n");
|
||||
return LED_OFF;
|
||||
}
|
||||
|
||||
/* Check the illumination */
|
||||
in[0] = 0xf300;
|
||||
in[1] = 0x14e;
|
||||
status = hci_raw(in, out);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
printk(MY_INFO "ACPI call for illumination failed.\n");
|
||||
return LED_OFF;
|
||||
}
|
||||
|
||||
result = out[2] ? LED_FULL : LED_OFF;
|
||||
|
||||
/* Last request : close communication. */
|
||||
in[0] = 0xf200;
|
||||
in[1] = 0;
|
||||
in[2] = 0;
|
||||
hci_raw(in, out);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static struct led_classdev toshiba_led = {
|
||||
.name = "toshiba::illumination",
|
||||
.max_brightness = 1,
|
||||
.brightness_set = toshiba_illumination_set,
|
||||
.brightness_get = toshiba_illumination_get,
|
||||
};
|
||||
|
||||
static struct toshiba_acpi_dev toshiba_acpi = {
|
||||
.bt_name = "Toshiba Bluetooth",
|
||||
};
|
||||
|
@ -720,25 +829,22 @@ static const struct file_operations version_proc_fops = {
|
|||
|
||||
#define PROC_TOSHIBA "toshiba"
|
||||
|
||||
static acpi_status __init add_device(void)
|
||||
static void __init create_toshiba_proc_entries(void)
|
||||
{
|
||||
proc_create("lcd", S_IRUGO | S_IWUSR, toshiba_proc_dir, &lcd_proc_fops);
|
||||
proc_create("video", S_IRUGO | S_IWUSR, toshiba_proc_dir, &video_proc_fops);
|
||||
proc_create("fan", S_IRUGO | S_IWUSR, toshiba_proc_dir, &fan_proc_fops);
|
||||
proc_create("keys", S_IRUGO | S_IWUSR, toshiba_proc_dir, &keys_proc_fops);
|
||||
proc_create("version", S_IRUGO, toshiba_proc_dir, &version_proc_fops);
|
||||
|
||||
return AE_OK;
|
||||
}
|
||||
|
||||
static acpi_status remove_device(void)
|
||||
static void remove_toshiba_proc_entries(void)
|
||||
{
|
||||
remove_proc_entry("lcd", toshiba_proc_dir);
|
||||
remove_proc_entry("video", toshiba_proc_dir);
|
||||
remove_proc_entry("fan", toshiba_proc_dir);
|
||||
remove_proc_entry("keys", toshiba_proc_dir);
|
||||
remove_proc_entry("version", toshiba_proc_dir);
|
||||
return AE_OK;
|
||||
}
|
||||
|
||||
static struct backlight_ops toshiba_backlight_data = {
|
||||
|
@ -906,7 +1012,7 @@ static void toshiba_acpi_exit(void)
|
|||
if (toshiba_backlight_device)
|
||||
backlight_device_unregister(toshiba_backlight_device);
|
||||
|
||||
remove_device();
|
||||
remove_toshiba_proc_entries();
|
||||
|
||||
if (toshiba_proc_dir)
|
||||
remove_proc_entry(PROC_TOSHIBA, acpi_root_dir);
|
||||
|
@ -914,6 +1020,9 @@ static void toshiba_acpi_exit(void)
|
|||
acpi_remove_notify_handler(toshiba_acpi.handle, ACPI_DEVICE_NOTIFY,
|
||||
toshiba_acpi_notify);
|
||||
|
||||
if (toshiba_acpi.illumination_installed)
|
||||
led_classdev_unregister(&toshiba_led);
|
||||
|
||||
platform_device_unregister(toshiba_acpi.p_dev);
|
||||
|
||||
return;
|
||||
|
@ -921,7 +1030,6 @@ static void toshiba_acpi_exit(void)
|
|||
|
||||
static int __init toshiba_acpi_init(void)
|
||||
{
|
||||
acpi_status status = AE_OK;
|
||||
u32 hci_result;
|
||||
bool bt_present;
|
||||
int ret = 0;
|
||||
|
@ -969,11 +1077,7 @@ static int __init toshiba_acpi_init(void)
|
|||
toshiba_acpi_exit();
|
||||
return -ENODEV;
|
||||
} else {
|
||||
status = add_device();
|
||||
if (ACPI_FAILURE(status)) {
|
||||
toshiba_acpi_exit();
|
||||
return -ENODEV;
|
||||
}
|
||||
create_toshiba_proc_entries();
|
||||
}
|
||||
|
||||
props.max_brightness = HCI_LCD_BRIGHTNESS_LEVELS - 1;
|
||||
|
@ -1013,6 +1117,13 @@ static int __init toshiba_acpi_init(void)
|
|||
}
|
||||
}
|
||||
|
||||
toshiba_acpi.illumination_installed = 0;
|
||||
if (toshiba_illumination_available()) {
|
||||
if (!led_classdev_register(&(toshiba_acpi.p_dev->dev),
|
||||
&toshiba_led))
|
||||
toshiba_acpi.illumination_installed = 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -518,8 +518,13 @@ static void wmi_notify_debug(u32 value, void *context)
|
|||
{
|
||||
struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL };
|
||||
union acpi_object *obj;
|
||||
acpi_status status;
|
||||
|
||||
wmi_get_event_data(value, &response);
|
||||
status = wmi_get_event_data(value, &response);
|
||||
if (status != AE_OK) {
|
||||
printk(KERN_INFO "wmi: bad event status 0x%x\n", status);
|
||||
return;
|
||||
}
|
||||
|
||||
obj = (union acpi_object *)response.pointer;
|
||||
|
||||
|
@ -543,6 +548,7 @@ static void wmi_notify_debug(u32 value, void *context)
|
|||
default:
|
||||
printk("object type 0x%X\n", obj->type);
|
||||
}
|
||||
kfree(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -804,7 +810,7 @@ static bool guid_already_parsed(const char *guid_string)
|
|||
/*
|
||||
* Parse the _WDG method for the GUID data blocks
|
||||
*/
|
||||
static __init acpi_status parse_wdg(acpi_handle handle)
|
||||
static acpi_status parse_wdg(acpi_handle handle)
|
||||
{
|
||||
struct acpi_buffer out = {ACPI_ALLOCATE_BUFFER, NULL};
|
||||
union acpi_object *obj;
|
||||
|
@ -827,8 +833,10 @@ static __init acpi_status parse_wdg(acpi_handle handle)
|
|||
total = obj->buffer.length / sizeof(struct guid_block);
|
||||
|
||||
gblock = kmemdup(obj->buffer.pointer, obj->buffer.length, GFP_KERNEL);
|
||||
if (!gblock)
|
||||
return AE_NO_MEMORY;
|
||||
if (!gblock) {
|
||||
status = AE_NO_MEMORY;
|
||||
goto out_free_pointer;
|
||||
}
|
||||
|
||||
for (i = 0; i < total; i++) {
|
||||
/*
|
||||
|
@ -848,8 +856,10 @@ static __init acpi_status parse_wdg(acpi_handle handle)
|
|||
wmi_dump_wdg(&gblock[i]);
|
||||
|
||||
wblock = kzalloc(sizeof(struct wmi_block), GFP_KERNEL);
|
||||
if (!wblock)
|
||||
return AE_NO_MEMORY;
|
||||
if (!wblock) {
|
||||
status = AE_NO_MEMORY;
|
||||
goto out_free_gblock;
|
||||
}
|
||||
|
||||
wblock->gblock = gblock[i];
|
||||
wblock->handle = handle;
|
||||
|
@ -860,8 +870,10 @@ static __init acpi_status parse_wdg(acpi_handle handle)
|
|||
list_add_tail(&wblock->list, &wmi_blocks.list);
|
||||
}
|
||||
|
||||
kfree(out.pointer);
|
||||
out_free_gblock:
|
||||
kfree(gblock);
|
||||
out_free_pointer:
|
||||
kfree(out.pointer);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -947,7 +959,7 @@ static int acpi_wmi_remove(struct acpi_device *device, int type)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int __init acpi_wmi_add(struct acpi_device *device)
|
||||
static int acpi_wmi_add(struct acpi_device *device)
|
||||
{
|
||||
acpi_status status;
|
||||
int result = 0;
|
||||
|
|
|
@ -109,8 +109,6 @@ source "drivers/staging/hv/Kconfig"
|
|||
|
||||
source "drivers/staging/vme/Kconfig"
|
||||
|
||||
source "drivers/staging/rar_register/Kconfig"
|
||||
|
||||
source "drivers/staging/memrar/Kconfig"
|
||||
|
||||
source "drivers/staging/sep/Kconfig"
|
||||
|
|
|
@ -36,7 +36,6 @@ obj-$(CONFIG_VT6656) += vt6656/
|
|||
obj-$(CONFIG_FB_UDL) += udlfb/
|
||||
obj-$(CONFIG_HYPERV) += hv/
|
||||
obj-$(CONFIG_VME_BUS) += vme/
|
||||
obj-$(CONFIG_RAR_REGISTER) += rar_register/
|
||||
obj-$(CONFIG_MRST_RAR_HANDLER) += memrar/
|
||||
obj-$(CONFIG_DX_SEP) += sep/
|
||||
obj-$(CONFIG_IIO) += iio/
|
||||
|
|
|
@ -47,8 +47,7 @@
|
|||
#include <linux/mm.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include "../rar_register/rar_register.h"
|
||||
#include <linux/rar_register.h>
|
||||
|
||||
#include "memrar.h"
|
||||
#include "memrar_allocator.h"
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
#
|
||||
# RAR device configuration
|
||||
#
|
||||
|
||||
menu "RAR Register Driver"
|
||||
#
|
||||
# Restricted Access Register Manager
|
||||
#
|
||||
config RAR_REGISTER
|
||||
tristate "Restricted Access Region Register Driver"
|
||||
depends on PCI
|
||||
default n
|
||||
---help---
|
||||
This driver allows other kernel drivers access to the
|
||||
contents of the restricted access region control registers.
|
||||
|
||||
The restricted access region control registers
|
||||
(rar_registers) are used to pass address and
|
||||
locking information on restricted access regions
|
||||
to other drivers that use restricted access regions.
|
||||
|
||||
The restricted access regions are regions of memory
|
||||
on the Intel MID Platform that are not accessible to
|
||||
the x86 processor, but are accessible to dedicated
|
||||
processors on board peripheral devices.
|
||||
|
||||
The purpose of the restricted access regions is to
|
||||
protect sensitive data from compromise by unauthorized
|
||||
programs running on the x86 processor.
|
||||
endmenu
|
|
@ -1,2 +0,0 @@
|
|||
EXTRA_CFLAGS += -DLITTLE__ENDIAN
|
||||
obj-$(CONFIG_RAR_REGISTER) += rar_register.o
|
|
@ -33,6 +33,15 @@
|
|||
* subject to backwards-compatibility constraints.
|
||||
*/
|
||||
|
||||
#ifdef __KERNEL__
|
||||
/* For use by IPS driver */
|
||||
extern unsigned long i915_read_mch_val(void);
|
||||
extern bool i915_gpu_raise(void);
|
||||
extern bool i915_gpu_lower(void);
|
||||
extern bool i915_gpu_busy(void);
|
||||
extern bool i915_gpu_turbo_disable(void);
|
||||
#endif
|
||||
|
||||
/* Each region is a minimum of 16k, and there are at most 255 of them.
|
||||
*/
|
||||
#define I915_NR_TEX_REGIONS 255 /* table size 2k - maximum due to use
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef LINUX_INTEL_PMIC_H
|
||||
#define LINUX_INTEL_PMIC_H
|
||||
|
||||
struct intel_pmic_gpio_platform_data {
|
||||
/* the first IRQ of the chip */
|
||||
unsigned irq_base;
|
||||
/* number assigned to the first GPIO */
|
||||
unsigned gpio_base;
|
||||
/* sram address for gpiointr register, the langwell chip will map
|
||||
* the PMIC spi GPIO expander's GPIOINTR register in sram.
|
||||
*/
|
||||
unsigned gpiointr;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -100,6 +100,13 @@ void init_timer_deferrable_key(struct timer_list *timer,
|
|||
setup_timer_on_stack_key((timer), #timer, &__key, \
|
||||
(fn), (data)); \
|
||||
} while (0)
|
||||
#define setup_deferrable_timer_on_stack(timer, fn, data) \
|
||||
do { \
|
||||
static struct lock_class_key __key; \
|
||||
setup_deferrable_timer_on_stack_key((timer), #timer, \
|
||||
&__key, (fn), \
|
||||
(data)); \
|
||||
} while (0)
|
||||
#else
|
||||
#define init_timer(timer)\
|
||||
init_timer_key((timer), NULL, NULL)
|
||||
|
@ -111,6 +118,8 @@ void init_timer_deferrable_key(struct timer_list *timer,
|
|||
setup_timer_key((timer), NULL, NULL, (fn), (data))
|
||||
#define setup_timer_on_stack(timer, fn, data)\
|
||||
setup_timer_on_stack_key((timer), NULL, NULL, (fn), (data))
|
||||
#define setup_deferrable_timer_on_stack(timer, fn, data)\
|
||||
setup_deferrable_timer_on_stack_key((timer), NULL, NULL, (fn), (data))
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEBUG_OBJECTS_TIMERS
|
||||
|
@ -150,6 +159,12 @@ static inline void setup_timer_on_stack_key(struct timer_list *timer,
|
|||
init_timer_on_stack_key(timer, name, key);
|
||||
}
|
||||
|
||||
extern void setup_deferrable_timer_on_stack_key(struct timer_list *timer,
|
||||
const char *name,
|
||||
struct lock_class_key *key,
|
||||
void (*function)(unsigned long),
|
||||
unsigned long data);
|
||||
|
||||
/**
|
||||
* timer_pending - is a timer pending?
|
||||
* @timer: the timer in question
|
||||
|
|
|
@ -577,6 +577,19 @@ static void __init_timer(struct timer_list *timer,
|
|||
lockdep_init_map(&timer->lockdep_map, name, key, 0);
|
||||
}
|
||||
|
||||
void setup_deferrable_timer_on_stack_key(struct timer_list *timer,
|
||||
const char *name,
|
||||
struct lock_class_key *key,
|
||||
void (*function)(unsigned long),
|
||||
unsigned long data)
|
||||
{
|
||||
timer->function = function;
|
||||
timer->data = data;
|
||||
init_timer_on_stack_key(timer, name, key);
|
||||
timer_set_deferrable(timer);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(setup_deferrable_timer_on_stack_key);
|
||||
|
||||
/**
|
||||
* init_timer_key - initialize a timer
|
||||
* @timer: the timer to be initialized
|
||||
|
|
Loading…
Reference in New Issue