diff options
author | Varun Wadekar <vwadekar@nvidia.com> | 2011-01-11 17:49:00 +0530 |
---|---|---|
committer | Bharat Nihalani <bnihalani@nvidia.com> | 2011-01-11 10:07:37 -0800 |
commit | 7c672d40b0470c10a80ef99971ccdd19a832c617 (patch) | |
tree | a1d6ca3481bd21700aac692a5ee1774584235919 /drivers/hwmon | |
parent | 91ae5096b60edb280c1081e687dbca5723f2d488 (diff) |
hwmon: nct1008: delete driver code
nct1008 driver will now reside in drivers/misc
Bug 742230
Change-Id: I774c920cf96ded96ae440a99935f6cb9f1f63323
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
Reviewed-on: http://git-master/r/15496
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/Kconfig | 12 | ||||
-rw-r--r-- | drivers/hwmon/Makefile | 1 | ||||
-rw-r--r-- | drivers/hwmon/nct1008.c | 271 |
3 files changed, 0 insertions, 284 deletions
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index b3005f725a3a..97499d00615a 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig @@ -691,18 +691,6 @@ config SENSORS_MAX6650 This driver can also be built as a module. If so, the module will be called max6650. -config SENSORS_NCT1008_I2C - tristate "OnSemi NCT1008 Temperature Monitor chip" - depends on I2C - help - If you say yes here you get access to the temperature monitoring - functions of the OnSemi NCT1008 temperature monitor chip. - The NCT1008 can be used to measure the ambient temperature and control - the fan accordingly. - - This driver can also be built as a module. If so, the module - will be called nct1008. - config SENSORS_PC87360 tristate "National Semiconductor PC87360 family" select HWMON_VID diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index 7f281e112c7d..e3c2484f6c5f 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile @@ -84,7 +84,6 @@ obj-$(CONFIG_SENSORS_MAX1111) += max1111.o obj-$(CONFIG_SENSORS_MAX1619) += max1619.o obj-$(CONFIG_SENSORS_MAX6650) += max6650.o obj-$(CONFIG_SENSORS_MC13783_ADC)+= mc13783-adc.o -obj-$(CONFIG_SENSORS_NCT1008_I2C)+= nct1008.o obj-$(CONFIG_SENSORS_PC87360) += pc87360.o obj-$(CONFIG_SENSORS_PC87427) += pc87427.o obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o diff --git a/drivers/hwmon/nct1008.c b/drivers/hwmon/nct1008.c deleted file mode 100644 index bc82da400035..000000000000 --- a/drivers/hwmon/nct1008.c +++ /dev/null @@ -1,271 +0,0 @@ -/* - * drivers/hwmon/nct1008.c - * - * Temperature Sensor driver for NCT1008 Temperature Monitor chip - * manufactured by ON Semiconductors (www.onsemi.com). - * - * Copyright (c) 2010, NVIDIA Corporation. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include <linux/module.h> -#include <linux/i2c.h> -#include <linux/i2c/nct1008.h> -#include <linux/hwmon.h> -#include <linux/slab.h> -#include <linux/err.h> -#include <linux/miscdevice.h> -#include <linux/fs.h> -#include <linux/delay.h> - -#define NCT1008_LOCAL_TEMP_RD 0x00 -#define NCT1008_CONFIG_RD 0x03 -#define NCT1008_MFR_ID_RD 0xFE - -#define NCT1008_CONFIG_WR 0x09 -#define NCT1008_CONV_RATE_WR 0x0A -#define NCT1008_OFFSET_WR 0x11 -#define NCT1008_LOCAL_THERM_LIMIT_WR 0x20 - -#define DRIVER_NAME "nct1008" - -struct nct1008_data { - struct device *hwmon_dev; - struct i2c_client *client; - struct nct1008_platform_data plat_data; -}; - -static ssize_t nct1008_show_temp(struct device *dev, - struct device_attribute *attr, char *buf) -{ - struct i2c_client *client = to_i2c_client(dev); - signed int temp_value = 0; - u8 data = 0; - - if (!dev || !buf || !attr) - return -EINVAL; - - data = i2c_smbus_read_byte_data(client, NCT1008_LOCAL_TEMP_RD); - if (data < 0) { - dev_err(&client->dev, "%s: failed to read " - "temperature\n", __func__); - return -EINVAL; - } - - temp_value = (signed int)data; - return sprintf(buf, "%d\n", temp_value); -} - -static DEVICE_ATTR(temperature, S_IRUGO, nct1008_show_temp, NULL); - -static struct attribute *nct1008_attributes[] = { - &dev_attr_temperature.attr, - NULL -}; - -static const struct attribute_group nct1008_attr_group = { - .attrs = nct1008_attributes, -}; - -static int __devinit nct1008_probe(struct i2c_client *client, - const struct i2c_device_id *id) -{ - struct nct1008_data *pdata; - int err; - u8 data = 0; - - if (client->dev.platform_data == NULL) { - dev_err(&client->dev, "platform data is NULL, exiting\n"); - return -ENODEV; - } - - pdata = kzalloc(sizeof(struct nct1008_data), GFP_KERNEL); - if (!pdata) { - dev_err(&client->dev, "%s: failed to allocate " - "device\n", __func__); - return -ENOMEM; - } - - pdata->client = client; - i2c_set_clientdata(client, pdata); - - memcpy(&pdata->plat_data, client->dev.platform_data, - sizeof(struct nct1008_platform_data)); - - data = i2c_smbus_read_byte_data(client, NCT1008_MFR_ID_RD); - if (data < 0) { - dev_err(&client->dev, "%s: failed to read manufacturer " - "id\n", __func__); - err = data; - goto fail_alloc; - } - dev_info(&client->dev, "%s:0x%x chip found\n", client->name, data); - - /* set conversion rate (conv/sec) */ - data = pdata->plat_data.conv_rate; - err = i2c_smbus_write_byte_data(client, NCT1008_CONV_RATE_WR, data); - if (err < 0) { - dev_err(&client->dev, "%s: failed to set conversion " - "rate\n", __func__); - goto fail_alloc; - } - - /* set config params */ - data = pdata->plat_data.config; - err = i2c_smbus_write_byte_data(client, NCT1008_CONFIG_WR, data); - if (err < 0) { - dev_err(&client->dev, "%s: failed to set config\n", __func__); - goto fail_alloc; - } - - /* set offset value */ - data = pdata->plat_data.offset; - err = i2c_smbus_write_byte_data(client, NCT1008_OFFSET_WR, data); - if (err < 0) { - dev_err(&client->dev, - "%s: failed to set offset\n", __func__); - goto fail_alloc; - } - - /* set cpu shutdown threshold */ - data = pdata->plat_data.thermal_threshold; - err = i2c_smbus_write_byte_data(client, NCT1008_LOCAL_THERM_LIMIT_WR, data); - if (err < 0) { - dev_err(&client->dev, - "%s: failed to set THERM# limit\n", __func__); - goto fail_alloc; - } - - pdata->hwmon_dev = hwmon_device_register(&client->dev); - if (IS_ERR(pdata->hwmon_dev)) { - err = PTR_ERR(pdata->hwmon_dev); - dev_err(&client->dev, "%s: hwmon_device_register " - "failed\n", __func__); - goto fail_alloc; - } - - /* register sysfs hooks */ - err = sysfs_create_group(&client->dev.kobj, &nct1008_attr_group); - if (err < 0) - goto fail_sys; - - dev_info(&client->dev, "%s: initialized\n", __func__); - return 0; - -fail_sys: - hwmon_device_unregister(pdata->hwmon_dev); -fail_alloc: - kfree(pdata); - return err; -} - -static int __devexit nct1008_remove(struct i2c_client *client) -{ - struct nct1008_data *pdata = i2c_get_clientdata(client); - - if (!pdata) - return -EINVAL; - - hwmon_device_unregister(pdata->hwmon_dev); - kfree(pdata); - return 0; -} - -#ifdef CONFIG_PM -static int nct1008_suspend(struct i2c_client *client, pm_message_t state) -{ - u8 config; - int err; - - config = i2c_smbus_read_byte_data(client, NCT1008_CONFIG_RD); - if (config < 0) { - dev_err(&client->dev, "%s: failed to read config\n", __func__); - return -EIO; - } - - /* take device to standby state */ - config |= NCT1008_CONFIG_RUN_STANDBY; - - err = i2c_smbus_write_byte_data(client, NCT1008_CONFIG_WR, config); - if (err < 0) { - dev_err(&client->dev, "%s: failed to set config\n", __func__); - return -EIO; - } - - return 0; -} - -static int nct1008_resume(struct i2c_client *client) -{ - u8 config = 0; - int err; - - config = i2c_smbus_read_byte_data(client, NCT1008_CONFIG_RD); - if (config < 0) { - dev_err(&client->dev, "%s: failed to read config\n", __func__); - return -EIO; - } - - /* take device out of standby state */ - config &= ~NCT1008_CONFIG_RUN_STANDBY; - - err = i2c_smbus_write_byte_data(client, NCT1008_CONFIG_WR, config); - if (err < 0) { - dev_err(&client->dev, "%s: failed to set config\n", __func__); - return -EIO; - } - return 0; -} -#endif - -static const struct i2c_device_id nct1008_id[] = { - { DRIVER_NAME, 0 }, - { } -}; -MODULE_DEVICE_TABLE(i2c, nct1008_id); - -static struct i2c_driver nct1008_driver = { - .class = I2C_CLASS_HWMON, - .driver = { - .name = DRIVER_NAME, - }, - .probe = nct1008_probe, - .remove = __devexit_p(nct1008_remove), - .id_table = nct1008_id, -#ifdef CONFIG_PM - .suspend = nct1008_suspend, - .resume = nct1008_resume, -#endif -}; - -static int __init nct1008_init(void) -{ - return i2c_add_driver(&nct1008_driver); -} - -static void __exit nct1008_exit(void) -{ - i2c_del_driver(&nct1008_driver); -} - -module_init (nct1008_init); -module_exit (nct1008_exit); - -#define DRIVER_DESC "NCT1008 temperature sensor driver" -#define DRIVER_LICENSE "GPL" - -MODULE_DESCRIPTION(DRIVER_DESC); -MODULE_LICENSE(DRIVER_LICENSE); |