Lines Matching defs:hwmon
3 * drivers/hwmon/nsa320-hwmon.c
17 #include <linux/hwmon.h>
18 #include <linux/hwmon-sysfs.h>
31 * The Zyxel hwmon MCU is a Holtek HT46R065 that is factory programmed
72 struct nsa320_hwmon *hwmon = dev_get_drvdata(dev);
74 mutex_lock(&hwmon->update_lock);
76 mcu_data = hwmon->mcu_data;
78 if (time_after(jiffies, hwmon->last_updated + HZ) || mcu_data == 0) {
79 gpiod_set_value(hwmon->act, 1);
84 gpiod_set_value(hwmon->clk, 0);
86 gpiod_set_value(hwmon->clk, 1);
88 if (gpiod_get_value(hwmon->data))
92 gpiod_set_value(hwmon->act, 0);
99 hwmon->mcu_data = mcu_data;
100 hwmon->last_updated = jiffies;
104 mutex_unlock(&hwmon->update_lock);
161 struct nsa320_hwmon *hwmon;
164 hwmon = devm_kzalloc(&pdev->dev, sizeof(*hwmon), GFP_KERNEL);
165 if (!hwmon)
169 hwmon->act = devm_gpiod_get(&pdev->dev, "act", GPIOD_OUT_LOW);
170 if (IS_ERR(hwmon->act))
171 return PTR_ERR(hwmon->act);
173 hwmon->clk = devm_gpiod_get(&pdev->dev, "clk", GPIOD_OUT_HIGH);
174 if (IS_ERR(hwmon->clk))
175 return PTR_ERR(hwmon->clk);
177 hwmon->data = devm_gpiod_get(&pdev->dev, "data", GPIOD_IN);
178 if (IS_ERR(hwmon->data))
179 return PTR_ERR(hwmon->data);
181 mutex_init(&hwmon->update_lock);
184 "nsa320", hwmon, nsa320_groups);
195 .name = "nsa320-hwmon",
207 MODULE_ALIAS("platform:nsa320-hwmon");