Lines Matching refs:pmic
94 struct hi655x_pmic *pmic; in hi655x_pmic_probe() local
98 pmic = devm_kzalloc(dev, sizeof(*pmic), GFP_KERNEL); in hi655x_pmic_probe()
99 if (!pmic) in hi655x_pmic_probe()
101 pmic->dev = dev; in hi655x_pmic_probe()
103 pmic->res = platform_get_resource(pdev, IORESOURCE_MEM, 0); in hi655x_pmic_probe()
104 base = devm_ioremap_resource(dev, pmic->res); in hi655x_pmic_probe()
108 pmic->regmap = devm_regmap_init_mmio_clk(dev, NULL, base, in hi655x_pmic_probe()
110 if (IS_ERR(pmic->regmap)) in hi655x_pmic_probe()
111 return PTR_ERR(pmic->regmap); in hi655x_pmic_probe()
113 regmap_read(pmic->regmap, HI655X_BUS_ADDR(HI655X_VER_REG), &pmic->ver); in hi655x_pmic_probe()
114 if ((pmic->ver < PMU_VER_START) || (pmic->ver > PMU_VER_END)) { in hi655x_pmic_probe()
115 dev_warn(dev, "PMU version %d unsupported\n", pmic->ver); in hi655x_pmic_probe()
119 hi655x_local_irq_clear(pmic->regmap); in hi655x_pmic_probe()
121 pmic->gpio = devm_gpiod_get_optional(dev, "pmic", GPIOD_IN); in hi655x_pmic_probe()
122 if (IS_ERR(pmic->gpio)) in hi655x_pmic_probe()
123 return dev_err_probe(dev, PTR_ERR(pmic->gpio), in hi655x_pmic_probe()
126 ret = regmap_add_irq_chip(pmic->regmap, gpiod_to_irq(pmic->gpio), in hi655x_pmic_probe()
128 &hi655x_irq_chip, &pmic->irq_data); in hi655x_pmic_probe()
134 platform_set_drvdata(pdev, pmic); in hi655x_pmic_probe()
138 regmap_irq_get_domain(pmic->irq_data)); in hi655x_pmic_probe()
141 regmap_del_irq_chip(gpiod_to_irq(pmic->gpio), pmic->irq_data); in hi655x_pmic_probe()
150 struct hi655x_pmic *pmic = platform_get_drvdata(pdev); in hi655x_pmic_remove() local
152 regmap_del_irq_chip(gpiod_to_irq(pmic->gpio), pmic->irq_data); in hi655x_pmic_remove()