aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen/penmount.c
Commit message (Expand)AuthorAge
* Input: delete non-required instances of include <linux/init.h>Paul Gortmaker2014-01-07
* Input: MT - Add flags to input_mt_init_slots()Henrik Rydberg2012-09-19
* Input: serio - use module_serio_driverAxel Lin2012-04-04
* Input: penmount - simplify unregister procedureDmitry Torokhov2011-09-21
* Input: penmount - rework handling of different protocolsDmitry Torokhov2011-09-21
* Input: penmount - add PenMount 6250 supportJohn Sung2011-09-21
* Input: penmount - add PenMount 3000 supportJohn Sung2011-09-21
* Input: penmount - add PenMount 6000 supportJohn Sung2011-09-21
* Input: penmount - fix the protocolJohn Sung2011-09-21
* get rid of input BIT* duplicate definesJiri Slaby2007-10-19
* Input: touchscreens - switch to using input_dev->dev.parentDmitry Torokhov2007-04-12
* Input: drivers/input/touchscreen - don't access dev->private directlyDmitry Torokhov2007-04-12
* Input: handle serio_register_driver() errorsAkinobu Mita2006-11-23
* IRQ: Maintain regs pointer globally rather than passing to IRQ handlersDavid Howells2006-10-05
* Input: add driver for Penmount serial touchscreensRick Koch2006-08-05
">return DIV_ROUND_CLOSEST(val, 1000); } static ssize_t tmp103_show_temp(struct device *dev, struct device_attribute *attr, char *buf) { struct sensor_device_attribute *sda = to_sensor_dev_attr(attr); struct regmap *regmap = dev_get_drvdata(dev); unsigned int regval; int ret; ret = regmap_read(regmap, sda->index, &regval); if (ret < 0) return ret; return sprintf(buf, "%d\n", tmp103_reg_to_mc(regval)); } static ssize_t tmp103_set_temp(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct sensor_device_attribute *sda = to_sensor_dev_attr(attr); struct regmap *regmap = dev_get_drvdata(dev); long val; int ret; if (kstrtol(buf, 10, &val) < 0) return -EINVAL; val = clamp_val(val, -55000, 127000); ret = regmap_write(regmap, sda->index, tmp103_mc_to_reg(val)); return ret ? ret : count; } static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, tmp103_show_temp, NULL , TMP103_TEMP_REG); static SENSOR_DEVICE_ATTR(temp1_min, S_IWUSR | S_IRUGO, tmp103_show_temp, tmp103_set_temp, TMP103_TLOW_REG); static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, tmp103_show_temp, tmp103_set_temp, TMP103_THIGH_REG); static struct attribute *tmp103_attrs[] = { &sensor_dev_attr_temp1_input.dev_attr.attr, &sensor_dev_attr_temp1_min.dev_attr.attr, &sensor_dev_attr_temp1_max.dev_attr.attr, NULL }; ATTRIBUTE_GROUPS(tmp103); static bool tmp103_regmap_is_volatile(struct device *dev, unsigned int reg) { return reg == TMP103_TEMP_REG; } static const struct regmap_config tmp103_regmap_config = { .reg_bits = 8, .val_bits = 8, .max_register = TMP103_THIGH_REG, .volatile_reg = tmp103_regmap_is_volatile, }; static int tmp103_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct device *dev = &client->dev; struct device *hwmon_dev; struct regmap *regmap; int ret; regmap = devm_regmap_init_i2c(client, &tmp103_regmap_config); if (IS_ERR(regmap)) { dev_err(dev, "failed to allocate register map\n"); return PTR_ERR(regmap); } ret = regmap_update_bits(regmap, TMP103_CONF_REG, TMP103_CONFIG_MASK, TMP103_CONFIG); if (ret < 0) { dev_err(&client->dev, "error writing config register\n"); return ret; } i2c_set_clientdata(client, regmap); hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name, regmap, tmp103_groups); return PTR_ERR_OR_ZERO(hwmon_dev); } #ifdef CONFIG_PM static int tmp103_suspend(struct device *dev) { struct regmap *regmap = dev_get_drvdata(dev); return regmap_update_bits(regmap, TMP103_CONF_REG, TMP103_CONF_SD_MASK, 0); } static int tmp103_resume(struct device *dev) { struct regmap *regmap = dev_get_drvdata(dev); return regmap_update_bits(regmap, TMP103_CONF_REG, TMP103_CONF_SD_MASK, TMP103_CONF_SD); } static const struct dev_pm_ops tmp103_dev_pm_ops = { .suspend = tmp103_suspend, .resume = tmp103_resume, }; #define TMP103_DEV_PM_OPS (&tmp103_dev_pm_ops) #else #define TMP103_DEV_PM_OPS NULL #endif /* CONFIG_PM */ static const struct i2c_device_id tmp103_id[] = { { "tmp103", 0 }, { } }; MODULE_DEVICE_TABLE(i2c, tmp103_id); static struct i2c_driver tmp103_driver = { .driver = { .name = "tmp103", .pm = TMP103_DEV_PM_OPS, }, .probe = tmp103_probe, .id_table = tmp103_id, }; module_i2c_driver(tmp103_driver); MODULE_AUTHOR("Heiko Schocher <hs@denx.de>"); MODULE_DESCRIPTION("Texas Instruments TMP103 temperature sensor driver"); MODULE_LICENSE("GPL");