Lines Matching full: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); in nsa320_hwmon_update() local
72 mutex_lock(&hwmon->update_lock); in nsa320_hwmon_update()
74 mcu_data = hwmon->mcu_data; in nsa320_hwmon_update()
76 if (time_after(jiffies, hwmon->last_updated + HZ) || mcu_data == 0) { in nsa320_hwmon_update()
77 gpiod_set_value(hwmon->act, 1); in nsa320_hwmon_update()
82 gpiod_set_value(hwmon->clk, 0); in nsa320_hwmon_update()
84 gpiod_set_value(hwmon->clk, 1); in nsa320_hwmon_update()
86 if (gpiod_get_value(hwmon->data)) in nsa320_hwmon_update()
90 gpiod_set_value(hwmon->act, 0); in nsa320_hwmon_update()
97 hwmon->mcu_data = mcu_data; in nsa320_hwmon_update()
98 hwmon->last_updated = jiffies; in nsa320_hwmon_update()
102 mutex_unlock(&hwmon->update_lock); in nsa320_hwmon_update()
159 struct nsa320_hwmon *hwmon; in nsa320_hwmon_probe() local
162 hwmon = devm_kzalloc(&pdev->dev, sizeof(*hwmon), GFP_KERNEL); in nsa320_hwmon_probe()
163 if (!hwmon) in nsa320_hwmon_probe()
167 hwmon->act = devm_gpiod_get(&pdev->dev, "act", GPIOD_OUT_LOW); in nsa320_hwmon_probe()
168 if (IS_ERR(hwmon->act)) in nsa320_hwmon_probe()
169 return PTR_ERR(hwmon->act); in nsa320_hwmon_probe()
171 hwmon->clk = devm_gpiod_get(&pdev->dev, "clk", GPIOD_OUT_HIGH); in nsa320_hwmon_probe()
172 if (IS_ERR(hwmon->clk)) in nsa320_hwmon_probe()
173 return PTR_ERR(hwmon->clk); in nsa320_hwmon_probe()
175 hwmon->data = devm_gpiod_get(&pdev->dev, "data", GPIOD_IN); in nsa320_hwmon_probe()
176 if (IS_ERR(hwmon->data)) in nsa320_hwmon_probe()
177 return PTR_ERR(hwmon->data); in nsa320_hwmon_probe()
179 mutex_init(&hwmon->update_lock); in nsa320_hwmon_probe()
182 "nsa320", hwmon, nsa320_groups); in nsa320_hwmon_probe()
193 .name = "nsa320-hwmon",
205 MODULE_ALIAS("platform:nsa320-hwmon");