18 #include <linux/kernel.h>
19 #include <linux/module.h>
22 #include <linux/slab.h>
47 return sprintf(buf,
"jz4740\n");
78 val = (val * 3300) >> 12;
79 ret =
sprintf(buf,
"%lu\n", val);
95 static struct attribute *jz4740_hwmon_attributes[] = {
97 &dev_attr_in0_input.attr,
102 .attrs = jz4740_hwmon_attributes,
114 hwmon->
cell = mfd_get_cell(pdev);
117 if (hwmon->
irq < 0) {
118 dev_err(&pdev->
dev,
"Failed to get platform irq: %d\n",
125 dev_err(&pdev->
dev,
"Failed to get platform mmio resource\n");
130 resource_size(hwmon->
mem), pdev->
name);
132 dev_err(&pdev->
dev,
"Failed to request mmio memory region\n");
137 resource_size(hwmon->
mem));
139 dev_err(&pdev->
dev,
"Failed to ioremap mmio memory\n");
146 platform_set_drvdata(pdev, hwmon);
148 ret = devm_request_irq(&pdev->
dev, hwmon->
irq, jz4740_hwmon_irq, 0,
151 dev_err(&pdev->
dev,
"Failed to request irq: %d\n", ret);
158 dev_err(&pdev->
dev,
"Failed to create sysfs group: %d\n", ret);
163 if (IS_ERR(hwmon->
hwmon)) {
164 ret = PTR_ERR(hwmon->
hwmon);
165 goto err_remove_file;
177 struct jz4740_hwmon *hwmon = platform_get_drvdata(pdev);
186 .probe = jz4740_hwmon_probe,
189 .name =
"jz4740-hwmon",