Lines Matching refs:hwmon
3 * drivers/hwmon/nsa320-hwmon.c
17 #include <linux/hwmon.h>
18 #include <linux/hwmon-sysfs.h>
29 * The Zyxel hwmon MCU is a Holtek HT46R065 that is factory programmed
70 struct nsa320_hwmon *hwmon = dev_get_drvdata(dev);
72 mutex_lock(&hwmon->update_lock);
74 mcu_data = hwmon->mcu_data;
76 if (time_after(jiffies, hwmon->last_updated + HZ) || mcu_data == 0) {
77 gpiod_set_value(hwmon->act, 1);
82 gpiod_set_value(hwmon->clk, 0);
84 gpiod_set_value(hwmon->clk, 1);
86 if (gpiod_get_value(hwmon->data))
90 gpiod_set_value(hwmon->act, 0);
97 hwmon->mcu_data = mcu_data;
98 hwmon->last_updated = jiffies;
102 mutex_unlock(&hwmon->update_lock);
159 struct nsa320_hwmon *hwmon;
162 hwmon = devm_kzalloc(&pdev->dev, sizeof(*hwmon), GFP_KERNEL);
163 if (!hwmon)
167 hwmon->act = devm_gpiod_get(&pdev->dev, "act", GPIOD_OUT_LOW);
168 if (IS_ERR(hwmon->act))
169 return PTR_ERR(hwmon->act);
171 hwmon->clk = devm_gpiod_get(&pdev->dev, "clk", GPIOD_OUT_HIGH);
172 if (IS_ERR(hwmon->clk))
173 return PTR_ERR(hwmon->clk);
175 hwmon->data = devm_gpiod_get(&pdev->dev, "data", GPIOD_IN);
176 if (IS_ERR(hwmon->data))
177 return PTR_ERR(hwmon->data);
179 mutex_init(&hwmon->update_lock);
182 "nsa320", hwmon, nsa320_groups);
193 .name = "nsa320-hwmon",
205 MODULE_ALIAS("platform:nsa320-hwmon");