Lines Matching refs:hwmon
27 #include <linux/hwmon.h>
36 struct device *hwmon;
51 struct jz4740_hwmon *hwmon = data;
53 complete(&hwmon->read_completion);
60 struct jz4740_hwmon *hwmon = dev_get_drvdata(dev);
61 struct completion *completion = &hwmon->read_completion;
66 mutex_lock(&hwmon->lock);
70 enable_irq(hwmon->irq);
71 hwmon->cell->enable(to_platform_device(dev));
76 val = readw(hwmon->base) & 0xfff;
83 hwmon->cell->disable(to_platform_device(dev));
84 disable_irq(hwmon->irq);
86 mutex_unlock(&hwmon->lock);
107 struct jz4740_hwmon *hwmon;
109 hwmon = kmalloc(sizeof(*hwmon), GFP_KERNEL);
110 if (!hwmon) {
115 hwmon->cell = pdev->dev.platform_data;
117 hwmon->irq = platform_get_irq(pdev, 0);
118 if (hwmon->irq < 0) {
119 ret = hwmon->irq;
124 hwmon->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
125 if (!hwmon->mem) {
131 hwmon->mem = request_mem_region(hwmon->mem->start,
132 resource_size(hwmon->mem), pdev->name);
133 if (!hwmon->mem) {
139 hwmon->base = ioremap_nocache(hwmon->mem->start,
140 resource_size(hwmon->mem));
141 if (!hwmon->base) {
147 init_completion(&hwmon->read_completion);
148 mutex_init(&hwmon->lock);
150 platform_set_drvdata(pdev, hwmon);
152 ret = request_irq(hwmon->irq, jz4740_hwmon_irq, 0, pdev->name, hwmon);
157 disable_irq(hwmon->irq);
165 hwmon->hwmon = hwmon_device_register(&pdev->dev);
166 if (IS_ERR(hwmon->hwmon)) {
167 ret = PTR_ERR(hwmon->hwmon);
176 free_irq(hwmon->irq, hwmon);
179 iounmap(hwmon->base);
181 release_mem_region(hwmon->mem->start, resource_size(hwmon->mem));
183 kfree(hwmon);
190 struct jz4740_hwmon *hwmon = platform_get_drvdata(pdev);
192 hwmon_device_unregister(hwmon->hwmon);
195 free_irq(hwmon->irq, hwmon);
197 iounmap(hwmon->base);
198 release_mem_region(hwmon->mem->start, resource_size(hwmon->mem));
201 kfree(hwmon);
210 .name = "jz4740-hwmon",
230 MODULE_ALIAS("platform:jz4740-hwmon");