Lines Matching full:hwmon

5 #include <linux/hwmon.h>
80 struct lan966x_hwmon *hwmon = dev_get_drvdata(dev); in lan966x_hwmon_read_temp() local
84 ret = regmap_read(hwmon->regmap_pvt, PVT_SENSOR_STAT, &data); in lan966x_hwmon_read_temp()
99 struct lan966x_hwmon *hwmon = dev_get_drvdata(dev); in lan966x_hwmon_read_fan() local
103 ret = regmap_read(hwmon->regmap_fan, FAN_CNT, &data); in lan966x_hwmon_read_fan()
118 struct lan966x_hwmon *hwmon = dev_get_drvdata(dev); in lan966x_hwmon_read_pwm() local
122 ret = regmap_read(hwmon->regmap_fan, FAN_CFG, &data); in lan966x_hwmon_read_pwm()
133 struct lan966x_hwmon *hwmon = dev_get_drvdata(dev); in lan966x_hwmon_read_pwm_freq() local
138 ret = regmap_read(hwmon->regmap_fan, FAN_PWM_FREQ, &data); in lan966x_hwmon_read_pwm_freq()
147 tmp = DIV_ROUND_CLOSEST(hwmon->clk_rate, 256); in lan966x_hwmon_read_pwm_freq()
177 struct lan966x_hwmon *hwmon = dev_get_drvdata(dev); in lan966x_hwmon_write_pwm() local
182 return regmap_update_bits(hwmon->regmap_fan, FAN_CFG, in lan966x_hwmon_write_pwm()
189 struct lan966x_hwmon *hwmon = dev_get_drvdata(dev); in lan966x_hwmon_write_pwm_freq() local
194 val = DIV_ROUND_CLOSEST(hwmon->clk_rate, val); in lan966x_hwmon_write_pwm_freq()
198 return regmap_update_bits(hwmon->regmap_fan, FAN_PWM_FREQ, in lan966x_hwmon_write_pwm_freq()
284 struct lan966x_hwmon *hwmon = data; in lan966x_hwmon_disable() local
286 regmap_update_bits(hwmon->regmap_pvt, PVT_SENSOR_CFG, in lan966x_hwmon_disable()
292 struct lan966x_hwmon *hwmon) in lan966x_hwmon_enable() argument
307 div = DIV_ROUND_CLOSEST(hwmon->clk_rate, LAN966X_PVT_CLK); in lan966x_hwmon_enable()
310 ret = regmap_update_bits(hwmon->regmap_pvt, PVT_SENSOR_CFG, in lan966x_hwmon_enable()
315 return devm_add_action_or_reset(dev, lan966x_hwmon_disable, hwmon); in lan966x_hwmon_enable()
340 struct lan966x_hwmon *hwmon; in lan966x_hwmon_probe() local
344 hwmon = devm_kzalloc(dev, sizeof(*hwmon), GFP_KERNEL); in lan966x_hwmon_probe()
345 if (!hwmon) in lan966x_hwmon_probe()
348 hwmon->clk = devm_clk_get_enabled(dev, NULL); in lan966x_hwmon_probe()
349 if (IS_ERR(hwmon->clk)) in lan966x_hwmon_probe()
350 return dev_err_probe(dev, PTR_ERR(hwmon->clk), in lan966x_hwmon_probe()
353 hwmon->clk_rate = clk_get_rate(hwmon->clk); in lan966x_hwmon_probe()
355 hwmon->regmap_pvt = lan966x_init_regmap(pdev, "pvt"); in lan966x_hwmon_probe()
356 if (IS_ERR(hwmon->regmap_pvt)) in lan966x_hwmon_probe()
357 return dev_err_probe(dev, PTR_ERR(hwmon->regmap_pvt), in lan966x_hwmon_probe()
360 hwmon->regmap_fan = lan966x_init_regmap(pdev, "fan"); in lan966x_hwmon_probe()
361 if (IS_ERR(hwmon->regmap_fan)) in lan966x_hwmon_probe()
362 return dev_err_probe(dev, PTR_ERR(hwmon->regmap_fan), in lan966x_hwmon_probe()
365 ret = lan966x_hwmon_enable(dev, hwmon); in lan966x_hwmon_probe()
370 "lan966x_hwmon", hwmon, in lan966x_hwmon_probe()
374 "failed to register hwmon device\n"); in lan966x_hwmon_probe()
380 { .compatible = "microchip,lan9668-hwmon" },
388 .name = "lan966x-hwmon",