Lines Matching +full:micro +full:- +full:watts
1 // SPDX-License-Identifier: GPL-2.0-only
16 #include <linux/hwmon-sysfs.h>
21 * struct iio_hwmon_state - device instance state
49 struct iio_channel *chan = &state->channels[sattr->index]; in iio_hwmon_read_val()
61 result *= 1000; /* mili-Watts to micro-Watts conversion */ in iio_hwmon_read_val()
68 struct device *dev = &pdev->dev; in iio_hwmon_probe()
81 if (ret == -ENODEV) in iio_hwmon_probe()
82 ret = -EPROBE_DEFER; in iio_hwmon_probe()
89 return -ENOMEM; in iio_hwmon_probe()
91 st->channels = channels; in iio_hwmon_probe()
94 while (st->channels[st->num_channels].indio_dev) in iio_hwmon_probe()
95 st->num_channels++; in iio_hwmon_probe()
97 st->attrs = devm_kcalloc(dev, in iio_hwmon_probe()
98 st->num_channels + 1, sizeof(*st->attrs), in iio_hwmon_probe()
100 if (st->attrs == NULL) in iio_hwmon_probe()
101 return -ENOMEM; in iio_hwmon_probe()
103 for (i = 0; i < st->num_channels; i++) { in iio_hwmon_probe()
109 return -ENOMEM; in iio_hwmon_probe()
111 sysfs_attr_init(&a->dev_attr.attr); in iio_hwmon_probe()
112 ret = iio_get_channel_type(&st->channels[i], &type); in iio_hwmon_probe()
138 return -EINVAL; in iio_hwmon_probe()
141 a->dev_attr.attr.name = devm_kasprintf(dev, GFP_KERNEL, in iio_hwmon_probe()
144 if (a->dev_attr.attr.name == NULL) in iio_hwmon_probe()
145 return -ENOMEM; in iio_hwmon_probe()
147 a->dev_attr.show = iio_hwmon_read_val; in iio_hwmon_probe()
148 a->dev_attr.attr.mode = 0444; in iio_hwmon_probe()
149 a->index = i; in iio_hwmon_probe()
150 st->attrs[i] = &a->dev_attr.attr; in iio_hwmon_probe()
153 st->attr_group.attrs = st->attrs; in iio_hwmon_probe()
154 st->groups[0] = &st->attr_group; in iio_hwmon_probe()
159 return -ENOMEM; in iio_hwmon_probe()
160 strreplace(sname, '-', '_'); in iio_hwmon_probe()
166 st->groups); in iio_hwmon_probe()
171 { .compatible = "iio-hwmon", },