Lines Matching full:hwmon

2 /* linux/drivers/hwmon/s3c-hwmon.c
8 * S3C24XX/S3C64XX ADC hwmon support
20 #include <linux/hwmon.h>
21 #include <linux/hwmon-sysfs.h>
24 #include <linux/platform_data/hwmon-s3c.h>
34 * struct s3c_hwmon - ADC hwmon client information
37 * @hwmon_dev: The hwmon device we created.
51 * @hwmon: Our state.
59 struct s3c_hwmon *hwmon, int channel) in s3c_hwmon_read_ch() argument
63 ret = mutex_lock_interruptible(&hwmon->lock); in s3c_hwmon_read_ch()
69 ret = s3c_adc_read(hwmon->client, channel); in s3c_hwmon_read_ch()
70 mutex_unlock(&hwmon->lock); in s3c_hwmon_read_ch()
155 struct s3c_hwmon *hwmon = dev_get_drvdata(dev); in s3c_hwmon_ch_show() local
162 ret = s3c_hwmon_read_ch(dev, hwmon, sen_attr->index); in s3c_hwmon_ch_show()
194 * s3c_hwmon_create_attr - create hwmon attribute for given channel.
199 * Create the scaled attribute for use with hwmon from the specified
266 struct s3c_hwmon *hwmon; in s3c_hwmon_probe() local
275 hwmon = devm_kzalloc(&dev->dev, sizeof(struct s3c_hwmon), GFP_KERNEL); in s3c_hwmon_probe()
276 if (hwmon == NULL) in s3c_hwmon_probe()
279 platform_set_drvdata(dev, hwmon); in s3c_hwmon_probe()
281 mutex_init(&hwmon->lock); in s3c_hwmon_probe()
285 hwmon->client = s3c_adc_register(dev, NULL, NULL, 0); in s3c_hwmon_probe()
286 if (IS_ERR(hwmon->client)) { in s3c_hwmon_probe()
288 return PTR_ERR(hwmon->client); in s3c_hwmon_probe()
297 /* register with the hwmon core */ in s3c_hwmon_probe()
299 hwmon->hwmon_dev = hwmon_device_register(&dev->dev); in s3c_hwmon_probe()
300 if (IS_ERR(hwmon->hwmon_dev)) { in s3c_hwmon_probe()
301 dev_err(&dev->dev, "error registering with hwmon\n"); in s3c_hwmon_probe()
302 ret = PTR_ERR(hwmon->hwmon_dev); in s3c_hwmon_probe()
323 &hwmon->attrs[i], i); in s3c_hwmon_probe()
330 &hwmon->attrs[i]); in s3c_hwmon_probe()
339 hwmon_device_unregister(hwmon->hwmon_dev); in s3c_hwmon_probe()
345 s3c_adc_release(hwmon->client); in s3c_hwmon_probe()
352 struct s3c_hwmon *hwmon = platform_get_drvdata(dev); in s3c_hwmon_remove() local
357 for (i = 0; i < ARRAY_SIZE(hwmon->attrs); i++) in s3c_hwmon_remove()
358 s3c_hwmon_remove_attr(&dev->dev, &hwmon->attrs[i]); in s3c_hwmon_remove()
360 hwmon_device_unregister(hwmon->hwmon_dev); in s3c_hwmon_remove()
361 s3c_adc_release(hwmon->client); in s3c_hwmon_remove()
368 .name = "s3c-hwmon",
377 MODULE_DESCRIPTION("S3C ADC HWMon driver");
379 MODULE_ALIAS("platform:s3c-hwmon");