Merge branch 'hwmon-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6

* 'hwmon-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6:
  hwmon: Add Asus ATK0110 support
  hwmon: (lm95241) Convert to new-style i2c driver
This commit is contained in:
Linus Torvalds 2009-04-07 08:44:43 -07:00
commit 10a0d91289
6 changed files with 1070 additions and 69 deletions

View File

@ -53,7 +53,6 @@ ACPI_MODULE_NAME("nsxfeval")
/* Local prototypes */
static void acpi_ns_resolve_references(struct acpi_evaluate_info *info);
#ifdef ACPI_FUTURE_USAGE
/*******************************************************************************
*
* FUNCTION: acpi_evaluate_object_typed
@ -147,7 +146,7 @@ acpi_evaluate_object_typed(acpi_handle handle,
}
ACPI_EXPORT_SYMBOL(acpi_evaluate_object_typed)
#endif /* ACPI_FUTURE_USAGE */
/*******************************************************************************
*
* FUNCTION: acpi_evaluate_object

View File

@ -248,6 +248,18 @@ config SENSORS_ASB100
This driver can also be built as a module. If so, the module
will be called asb100.
config SENSORS_ATK0110
tristate "ASUS ATK0110 ACPI hwmon"
depends on X86 && ACPI && EXPERIMENTAL
help
If you say yes here you get support for the ACPI hardware
monitoring interface found in many ASUS motherboards. This
driver will provide readings of fans, voltages and temperatures
through the system firmware.
This driver can also be built as a module. If so, the module
will be called asus_atk0110.
config SENSORS_ATXP1
tristate "Attansic ATXP1 VID controller"
depends on I2C && EXPERIMENTAL

View File

@ -32,6 +32,7 @@ obj-$(CONFIG_SENSORS_ADT7475) += adt7475.o
obj-$(CONFIG_SENSORS_APPLESMC) += applesmc.o
obj-$(CONFIG_SENSORS_AMS) += ams/
obj-$(CONFIG_SENSORS_ATK0110) += asus_atk0110.o
obj-$(CONFIG_SENSORS_ATXP1) += atxp1.o
obj-$(CONFIG_SENSORS_CORETEMP) += coretemp.o
obj-$(CONFIG_SENSORS_DME1737) += dme1737.o

1009
drivers/hwmon/asus_atk0110.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -87,25 +87,11 @@ I2C_CLIENT_INSMOD_1(lm95241);
(val_h)) * 1000 + (val_l) * 1000 / 256)
/* Functions declaration */
static int lm95241_attach_adapter(struct i2c_adapter *adapter);
static int lm95241_detect(struct i2c_adapter *adapter, int address,
int kind);
static void lm95241_init_client(struct i2c_client *client);
static int lm95241_detach_client(struct i2c_client *client);
static struct lm95241_data *lm95241_update_device(struct device *dev);
/* Driver data (common to all clients) */
static struct i2c_driver lm95241_driver = {
.driver = {
.name = "lm95241",
},
.attach_adapter = lm95241_attach_adapter,
.detach_client = lm95241_detach_client,
};
/* Client data (each client gets its own) */
struct lm95241_data {
struct i2c_client client;
struct device *hwmon_dev;
struct mutex update_lock;
unsigned long last_updated, rate; /* in jiffies */
@ -323,42 +309,16 @@ static const struct attribute_group lm95241_group = {
.attrs = lm95241_attributes,
};
/* Init/exit code */
static int lm95241_attach_adapter(struct i2c_adapter *adapter)
/* Return 0 if detection is successful, -ENODEV otherwise */
static int lm95241_detect(struct i2c_client *new_client, int kind,
struct i2c_board_info *info)
{
if (!(adapter->class & I2C_CLASS_HWMON))
return 0;
return i2c_probe(adapter, &addr_data, lm95241_detect);
}
/*
* The following function does more than just detection. If detection
* succeeds, it also registers the new chip.
*/
static int lm95241_detect(struct i2c_adapter *adapter, int address, int kind)
{
struct i2c_client *new_client;
struct lm95241_data *data;
int err = 0;
struct i2c_adapter *adapter = new_client->adapter;
int address = new_client->addr;
const char *name = "";
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
goto exit;
data = kzalloc(sizeof(struct lm95241_data), GFP_KERNEL);
if (!data) {
err = -ENOMEM;
goto exit;
}
/* The common I2C client data is placed right before the
LM95241-specific data. */
new_client = &data->client;
i2c_set_clientdata(new_client, data);
new_client->addr = address;
new_client->adapter = adapter;
new_client->driver = &lm95241_driver;
new_client->flags = 0;
return -ENODEV;
/*
* Now we do the remaining detection. A negative kind means that
@ -378,7 +338,7 @@ static int lm95241_detect(struct i2c_adapter *adapter, int address, int kind)
dev_dbg(&adapter->dev,
"LM95241 detection failed at 0x%02x.\n",
address);
goto exit_free;
return -ENODEV;
}
}
@ -392,31 +352,40 @@ static int lm95241_detect(struct i2c_adapter *adapter, int address, int kind)
if (kind <= 0) { /* identification failed */
dev_info(&adapter->dev, "Unsupported chip\n");
goto exit_free;
return -ENODEV;
}
}
}
/* Fill the i2c board info */
if (kind == lm95241)
name = "lm95241";
strlcpy(info->type, name, I2C_NAME_SIZE);
return 0;
}
/* We can fill in the remaining client fields */
strlcpy(new_client->name, name, I2C_NAME_SIZE);
data->valid = 0;
static int lm95241_probe(struct i2c_client *new_client,
const struct i2c_device_id *id)
{
struct lm95241_data *data;
int err;
data = kzalloc(sizeof(struct lm95241_data), GFP_KERNEL);
if (!data) {
err = -ENOMEM;
goto exit;
}
i2c_set_clientdata(new_client, data);
mutex_init(&data->update_lock);
/* Tell the I2C layer a new client has arrived */
err = i2c_attach_client(new_client);
if (err)
goto exit_free;
/* Initialize the LM95241 chip */
lm95241_init_client(new_client);
/* Register sysfs hooks */
err = sysfs_create_group(&new_client->dev.kobj, &lm95241_group);
if (err)
goto exit_detach;
goto exit_free;
data->hwmon_dev = hwmon_device_register(&new_client->dev);
if (IS_ERR(data->hwmon_dev)) {
@ -428,8 +397,6 @@ static int lm95241_detect(struct i2c_adapter *adapter, int address, int kind)
exit_remove_files:
sysfs_remove_group(&new_client->dev.kobj, &lm95241_group);
exit_detach:
i2c_detach_client(new_client);
exit_free:
kfree(data);
exit:
@ -456,18 +423,14 @@ static void lm95241_init_client(struct i2c_client *client)
data->model);
}
static int lm95241_detach_client(struct i2c_client *client)
static int lm95241_remove(struct i2c_client *client)
{
struct lm95241_data *data = i2c_get_clientdata(client);
int err;
hwmon_device_unregister(data->hwmon_dev);
sysfs_remove_group(&client->dev.kobj, &lm95241_group);
err = i2c_detach_client(client);
if (err)
return err;
i2c_set_clientdata(client, NULL);
kfree(data);
return 0;
}
@ -509,6 +472,25 @@ static struct lm95241_data *lm95241_update_device(struct device *dev)
return data;
}
/* Driver data (common to all clients) */
static const struct i2c_device_id lm95241_id[] = {
{ "lm95241", lm95241 },
{ }
};
MODULE_DEVICE_TABLE(i2c, lm95241_id);
static struct i2c_driver lm95241_driver = {
.class = I2C_CLASS_HWMON,
.driver = {
.name = "lm95241",
},
.probe = lm95241_probe,
.remove = lm95241_remove,
.id_table = lm95241_id,
.detect = lm95241_detect,
.address_data = &addr_data,
};
static int __init sensors_lm95241_init(void)
{
return i2c_add_driver(&lm95241_driver);

View File

@ -191,14 +191,12 @@ acpi_evaluate_object(acpi_handle object,
struct acpi_object_list *parameter_objects,
struct acpi_buffer *return_object_buffer);
#ifdef ACPI_FUTURE_USAGE
acpi_status
acpi_evaluate_object_typed(acpi_handle object,
acpi_string pathname,
struct acpi_object_list *external_params,
struct acpi_buffer *return_buffer,
acpi_object_type return_type);
#endif
acpi_status
acpi_get_object_info(acpi_handle handle, struct acpi_buffer *return_buffer);