Lines Matching refs:hwmon

72 	struct nsa320_hwmon *hwmon = dev_get_drvdata(dev);  in nsa320_hwmon_update()  local
74 mutex_lock(&hwmon->update_lock); in nsa320_hwmon_update()
76 mcu_data = hwmon->mcu_data; in nsa320_hwmon_update()
78 if (time_after(jiffies, hwmon->last_updated + HZ) || mcu_data == 0) { in nsa320_hwmon_update()
79 gpiod_set_value(hwmon->act, 1); in nsa320_hwmon_update()
84 gpiod_set_value(hwmon->clk, 0); in nsa320_hwmon_update()
86 gpiod_set_value(hwmon->clk, 1); in nsa320_hwmon_update()
88 if (gpiod_get_value(hwmon->data)) in nsa320_hwmon_update()
92 gpiod_set_value(hwmon->act, 0); in nsa320_hwmon_update()
99 hwmon->mcu_data = mcu_data; in nsa320_hwmon_update()
100 hwmon->last_updated = jiffies; in nsa320_hwmon_update()
104 mutex_unlock(&hwmon->update_lock); in nsa320_hwmon_update()
161 struct nsa320_hwmon *hwmon; in nsa320_hwmon_probe() local
164 hwmon = devm_kzalloc(&pdev->dev, sizeof(*hwmon), GFP_KERNEL); in nsa320_hwmon_probe()
165 if (!hwmon) in nsa320_hwmon_probe()
169 hwmon->act = devm_gpiod_get(&pdev->dev, "act", GPIOD_OUT_LOW); in nsa320_hwmon_probe()
170 if (IS_ERR(hwmon->act)) in nsa320_hwmon_probe()
171 return PTR_ERR(hwmon->act); in nsa320_hwmon_probe()
173 hwmon->clk = devm_gpiod_get(&pdev->dev, "clk", GPIOD_OUT_HIGH); in nsa320_hwmon_probe()
174 if (IS_ERR(hwmon->clk)) in nsa320_hwmon_probe()
175 return PTR_ERR(hwmon->clk); in nsa320_hwmon_probe()
177 hwmon->data = devm_gpiod_get(&pdev->dev, "data", GPIOD_IN); in nsa320_hwmon_probe()
178 if (IS_ERR(hwmon->data)) in nsa320_hwmon_probe()
179 return PTR_ERR(hwmon->data); in nsa320_hwmon_probe()
181 mutex_init(&hwmon->update_lock); in nsa320_hwmon_probe()
184 "nsa320", hwmon, nsa320_groups); in nsa320_hwmon_probe()