Lines Matching refs:hwmon
1 /* linux/drivers/hwmon/s3c-hwmon.c
7 * S3C24XX/S3C64XX ADC hwmon support
33 #include <linux/hwmon.h>
34 #include <linux/hwmon-sysfs.h>
37 #include <plat/hwmon.h>
47 * struct s3c_hwmon - ADC hwmon client information
50 * @hwmon_dev: The hwmon device we created.
64 * @hwmon: Our state.
72 struct s3c_hwmon *hwmon, int channel)
76 ret = down_interruptible(&hwmon->lock);
82 ret = s3c_adc_read(hwmon->client, channel);
83 up(&hwmon->lock);
171 struct s3c_hwmon *hwmon = platform_get_drvdata(to_platform_device(dev));
178 ret = s3c_hwmon_read_ch(dev, hwmon, sen_attr->index);
210 * s3c_hwmon_create_attr - create hwmon attribute for given channel.
215 * Create the scaled attribute for use with hwmon from the specified
282 struct s3c_hwmon *hwmon;
291 hwmon = kzalloc(sizeof(struct s3c_hwmon), GFP_KERNEL);
292 if (hwmon == NULL) {
297 platform_set_drvdata(dev, hwmon);
299 init_MUTEX(&hwmon->lock);
303 hwmon->client = s3c_adc_register(dev, NULL, NULL, 0);
304 if (IS_ERR(hwmon->client)) {
306 ret = PTR_ERR(hwmon->client);
316 /* register with the hwmon core */
318 hwmon->hwmon_dev = hwmon_device_register(&dev->dev);
319 if (IS_ERR(hwmon->hwmon_dev)) {
320 dev_err(&dev->dev, "error registering with hwmon\n");
321 ret = PTR_ERR(hwmon->hwmon_dev);
342 &hwmon->attrs[i], i);
349 &hwmon->attrs[i]);
358 hwmon_device_unregister(hwmon->hwmon_dev);
364 s3c_adc_release(hwmon->client);
367 kfree(hwmon);
373 struct s3c_hwmon *hwmon = platform_get_drvdata(dev);
378 for (i = 0; i < ARRAY_SIZE(hwmon->attrs); i++)
379 s3c_hwmon_remove_attr(&dev->dev, &hwmon->attrs[i]);
381 hwmon_device_unregister(hwmon->hwmon_dev);
382 s3c_adc_release(hwmon->client);
389 .name = "s3c-hwmon",
412 MODULE_ALIAS("platform:s3c-hwmon");