Lines Matching +full:lan966x +full:- +full:switch

1 // SPDX-License-Identifier: GPL-2.0-only
17 * T = -3.4627e-11*(N^4) + 1.1023e-7*(N^3) + -1.9165e-4*(N^2) +
18 * 3.0604e-1*(N^1) + -5.6197e1
20 * where [-56.197, 136.402]C and N = [0, 1023].
29 * T = -34627e-12*(N^4) + 110230e-9*(N^3) + -191650e-6*(N^2) +
30 * 306040e-3*(N^1) + -56197
32 * where T = [-56197, 136402]mC and N = [0, 1023].
37 {4, -34627, 1000, 1},
39 {2, -191650, 1000, 1},
41 {0, -56197, 1, 1}
84 ret = regmap_read(hwmon->regmap_pvt, PVT_SENSOR_STAT, &data); in lan966x_hwmon_read_temp()
89 return -ENODATA; in lan966x_hwmon_read_temp()
103 ret = regmap_read(hwmon->regmap_fan, FAN_CNT, &data); in lan966x_hwmon_read_fan()
122 ret = regmap_read(hwmon->regmap_fan, FAN_CFG, &data); in lan966x_hwmon_read_pwm()
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()
156 switch (type) { in lan966x_hwmon_read()
162 switch (attr) { in lan966x_hwmon_read()
168 return -EOPNOTSUPP; in lan966x_hwmon_read()
171 return -EOPNOTSUPP; in lan966x_hwmon_read()
180 return -EINVAL; in lan966x_hwmon_write_pwm()
182 return regmap_update_bits(hwmon->regmap_fan, FAN_CFG, in lan966x_hwmon_write_pwm()
192 return -EINVAL; in lan966x_hwmon_write_pwm_freq()
194 val = DIV_ROUND_CLOSEST(hwmon->clk_rate, val); in lan966x_hwmon_write_pwm_freq()
195 val = DIV_ROUND_CLOSEST(val, 256) - 1; in lan966x_hwmon_write_pwm_freq()
198 return regmap_update_bits(hwmon->regmap_fan, FAN_PWM_FREQ, in lan966x_hwmon_write_pwm_freq()
206 switch (type) { in lan966x_hwmon_write()
208 switch (attr) { in lan966x_hwmon_write()
214 return -EOPNOTSUPP; in lan966x_hwmon_write()
217 return -EOPNOTSUPP; in lan966x_hwmon_write()
227 switch (type) { in lan966x_hwmon_is_visible()
229 switch (attr) { in lan966x_hwmon_is_visible()
238 switch (attr) { in lan966x_hwmon_is_visible()
247 switch (attr) { in lan966x_hwmon_is_visible()
286 regmap_update_bits(hwmon->regmap_pvt, PVT_SENSOR_CFG, in lan966x_hwmon_disable()
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()
334 return devm_regmap_init_mmio(&pdev->dev, base, &regmap_config); in lan966x_init_regmap()
339 struct device *dev = &pdev->dev; in lan966x_hwmon_probe()
346 return -ENOMEM; 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()
369 hwmon_dev = devm_hwmon_device_register_with_info(&pdev->dev, in lan966x_hwmon_probe()
380 { .compatible = "microchip,lan9668-hwmon" },
388 .name = "lan966x-hwmon",
394 MODULE_DESCRIPTION("LAN966x Hardware Monitoring Driver");