Lines Matching full:pvt
5 * This driver is a hardware monitoring driver for PVT controller
21 /* PVT Common register */
142 struct pvt_device *pvt = dev_get_drvdata(dev); in pvt_read_temp() local
143 struct regmap *t_map = pvt->t_map; in pvt_read_temp()
169 *val = tmp - PVT_G_CONST - pvt->ip_freq; in pvt_read_temp()
179 struct pvt_device *pvt = dev_get_drvdata(dev); in pvt_read_in() local
180 struct regmap *v_map = pvt->v_map; in pvt_read_in()
185 if (channel >= pvt->v_num) in pvt_read_in()
188 vm_idx = pvt->vm_idx[channel]; in pvt_read_in()
253 static int pvt_init(struct pvt_device *pvt) in pvt_init() argument
256 struct regmap *t_map = pvt->t_map; in pvt_init()
257 struct regmap *p_map = pvt->p_map; in pvt_init()
258 struct regmap *v_map = pvt->v_map; in pvt_init()
259 u32 t_num = pvt->t_num; in pvt_init()
260 u32 p_num = pvt->p_num; in pvt_init()
261 u32 v_num = pvt->v_num; in pvt_init()
265 sys_freq = clk_get_rate(pvt->clk) / HZ_PER_MHZ; in pvt_init()
290 pvt->ip_freq = sys_freq * 100 / (key + 2); in pvt_init()
433 struct pvt_device *pvt) in pvt_get_regmap() argument
440 reg_map = &pvt->c_map; in pvt_get_regmap()
442 reg_map = &pvt->t_map; in pvt_get_regmap()
444 reg_map = &pvt->p_map; in pvt_get_regmap()
446 reg_map = &pvt->v_map; in pvt_get_regmap()
466 struct pvt_device *pvt = data; in pvt_clk_disable() local
468 clk_disable_unprepare(pvt->clk); in pvt_clk_disable()
471 static int pvt_clk_enable(struct device *dev, struct pvt_device *pvt) in pvt_clk_enable() argument
475 ret = clk_prepare_enable(pvt->clk); in pvt_clk_enable()
479 return devm_add_action_or_reset(dev, pvt_clk_disable, pvt); in pvt_clk_enable()
484 struct pvt_device *pvt = data; in pvt_reset_control_assert() local
486 reset_control_assert(pvt->rst); in pvt_reset_control_assert()
489 static int pvt_reset_control_deassert(struct device *dev, struct pvt_device *pvt) in pvt_reset_control_deassert() argument
493 ret = reset_control_deassert(pvt->rst); in pvt_reset_control_deassert()
497 return devm_add_action_or_reset(dev, pvt_reset_control_assert, pvt); in pvt_reset_control_deassert()
507 struct pvt_device *pvt; in mr75203_probe() local
510 pvt = devm_kzalloc(dev, sizeof(*pvt), GFP_KERNEL); in mr75203_probe()
511 if (!pvt) in mr75203_probe()
514 ret = pvt_get_regmap(pdev, "common", pvt); in mr75203_probe()
518 pvt->clk = devm_clk_get(dev, NULL); in mr75203_probe()
519 if (IS_ERR(pvt->clk)) in mr75203_probe()
520 return dev_err_probe(dev, PTR_ERR(pvt->clk), "failed to get clock\n"); in mr75203_probe()
522 ret = pvt_clk_enable(dev, pvt); in mr75203_probe()
528 pvt->rst = devm_reset_control_get_exclusive(dev, NULL); in mr75203_probe()
529 if (IS_ERR(pvt->rst)) in mr75203_probe()
530 return dev_err_probe(dev, PTR_ERR(pvt->rst), in mr75203_probe()
533 ret = pvt_reset_control_deassert(dev, pvt); in mr75203_probe()
537 ret = regmap_read(pvt->c_map, PVT_IP_CONFIG, &val); in mr75203_probe()
544 pvt->t_num = ts_num; in mr75203_probe()
545 pvt->p_num = pd_num; in mr75203_probe()
546 pvt->v_num = vm_num; in mr75203_probe()
562 ret = pvt_get_regmap(pdev, "ts", pvt); in mr75203_probe()
577 ret = pvt_get_regmap(pdev, "pd", pvt); in mr75203_probe()
585 ret = pvt_get_regmap(pdev, "vm", pvt); in mr75203_probe()
589 pvt->vm_idx = devm_kcalloc(dev, vm_num, sizeof(*pvt->vm_idx), in mr75203_probe()
591 if (!pvt->vm_idx) in mr75203_probe()
595 pvt->vm_idx, vm_num); in mr75203_probe()
600 if (pvt->vm_idx[i] >= vm_num || in mr75203_probe()
601 pvt->vm_idx[i] == 0xff) { in mr75203_probe()
612 pvt->vm_idx[i] = i; in mr75203_probe()
626 ret = pvt_init(pvt); in mr75203_probe()
628 dev_err(dev, "failed to init pvt: %d\n", ret); in mr75203_probe()
633 hwmon_dev = devm_hwmon_device_register_with_info(dev, "pvt", in mr75203_probe()
634 pvt, in mr75203_probe()
649 .name = "moortec-pvt",