Lines Matching refs:pvt

144 	struct pvt_device *pvt = dev_get_drvdata(dev);
145 struct regmap *t_map = pvt->t_map;
171 *val = tmp - PVT_G_CONST - pvt->ip_freq;
181 struct pvt_device *pvt = dev_get_drvdata(dev);
182 struct regmap *v_map = pvt->v_map;
187 if (channel >= pvt->v_num * pvt->c_num)
190 vm_idx = pvt->vm_idx[channel / pvt->c_num];
191 ch_idx = channel % pvt->c_num;
266 static int pvt_init(struct pvt_device *pvt)
269 struct regmap *t_map = pvt->t_map;
270 struct regmap *p_map = pvt->p_map;
271 struct regmap *v_map = pvt->v_map;
272 u32 t_num = pvt->t_num;
273 u32 p_num = pvt->p_num;
274 u32 v_num = pvt->v_num;
278 sys_freq = clk_get_rate(pvt->clk) / HZ_PER_MHZ;
303 pvt->ip_freq = sys_freq * 100 / (key + 2);
401 val = (BIT(pvt->c_num) - 1) | VM_CH_INIT |
459 struct pvt_device *pvt)
466 reg_map = &pvt->c_map;
468 reg_map = &pvt->t_map;
470 reg_map = &pvt->p_map;
472 reg_map = &pvt->v_map;
492 struct pvt_device *pvt = data;
494 clk_disable_unprepare(pvt->clk);
497 static int pvt_clk_enable(struct device *dev, struct pvt_device *pvt)
501 ret = clk_prepare_enable(pvt->clk);
505 return devm_add_action_or_reset(dev, pvt_clk_disable, pvt);
510 struct pvt_device *pvt = data;
512 reset_control_assert(pvt->rst);
515 static int pvt_reset_control_deassert(struct device *dev, struct pvt_device *pvt)
519 ret = reset_control_deassert(pvt->rst);
523 return devm_add_action_or_reset(dev, pvt_reset_control_assert, pvt);
533 struct pvt_device *pvt;
536 pvt = devm_kzalloc(dev, sizeof(*pvt), GFP_KERNEL);
537 if (!pvt)
540 ret = pvt_get_regmap(pdev, "common", pvt);
544 pvt->clk = devm_clk_get(dev, NULL);
545 if (IS_ERR(pvt->clk))
546 return dev_err_probe(dev, PTR_ERR(pvt->clk), "failed to get clock\n");
548 ret = pvt_clk_enable(dev, pvt);
554 pvt->rst = devm_reset_control_get_exclusive(dev, NULL);
555 if (IS_ERR(pvt->rst))
556 return dev_err_probe(dev, PTR_ERR(pvt->rst),
559 ret = pvt_reset_control_deassert(dev, pvt);
563 ret = regmap_read(pvt->c_map, PVT_IP_CONFIG, &val);
571 pvt->t_num = ts_num;
572 pvt->p_num = pd_num;
573 pvt->v_num = vm_num;
574 pvt->c_num = ch_num;
590 ret = pvt_get_regmap(pdev, "ts", pvt);
605 ret = pvt_get_regmap(pdev, "pd", pvt);
613 ret = pvt_get_regmap(pdev, "vm", pvt);
617 pvt->vm_idx = devm_kcalloc(dev, vm_num, sizeof(*pvt->vm_idx),
619 if (!pvt->vm_idx)
623 pvt->vm_idx, vm_num);
630 pvt->vm_idx[i] = i;
633 if (pvt->vm_idx[i] >= vm_num ||
634 pvt->vm_idx[i] == 0xff) {
635 pvt->v_num = i;
654 ret = pvt_init(pvt);
656 dev_err(dev, "failed to init pvt: %d\n", ret);
661 hwmon_dev = devm_hwmon_device_register_with_info(dev, "pvt",
662 pvt,
677 .name = "moortec-pvt",