Lines Matching +full:pmic +full:- +full:id

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Device driver for Hi6421 PMIC
5 * Copyright (c) <2011-2014> HiSilicon Technologies Co., Ltd.
7 * Copyright (c) <2013-2017> Linaro Ltd.
16 #include <linux/mfd/hi6421-pmic.h>
23 { .name = "hi6421-regulator", },
27 { .name = "hi6421v530-regulator", },
39 .compatible = "hisilicon,hi6421-pmic",
43 .compatible = "hisilicon,hi6421v530-pmic",
52 struct hi6421_pmic *pmic; in hi6421_pmic_probe() local
54 const struct of_device_id *id; in hi6421_pmic_probe() local
60 id = of_match_device(of_hi6421_pmic_match, &pdev->dev); in hi6421_pmic_probe()
61 if (!id) in hi6421_pmic_probe()
62 return -EINVAL; in hi6421_pmic_probe()
63 type = (enum hi6421_type)id->data; in hi6421_pmic_probe()
65 pmic = devm_kzalloc(&pdev->dev, sizeof(*pmic), GFP_KERNEL); in hi6421_pmic_probe()
66 if (!pmic) in hi6421_pmic_probe()
67 return -ENOMEM; in hi6421_pmic_probe()
70 base = devm_ioremap_resource(&pdev->dev, res); in hi6421_pmic_probe()
74 pmic->regmap = devm_regmap_init_mmio_clk(&pdev->dev, NULL, base, in hi6421_pmic_probe()
76 if (IS_ERR(pmic->regmap)) { in hi6421_pmic_probe()
77 dev_err(&pdev->dev, "Failed to initialise Regmap: %ld\n", in hi6421_pmic_probe()
78 PTR_ERR(pmic->regmap)); in hi6421_pmic_probe()
79 return PTR_ERR(pmic->regmap); in hi6421_pmic_probe()
82 platform_set_drvdata(pdev, pmic); in hi6421_pmic_probe()
86 /* set over-current protection debounce 8ms */ in hi6421_pmic_probe()
87 regmap_update_bits(pmic->regmap, HI6421_OCP_DEB_CTRL_REG, in hi6421_pmic_probe()
102 dev_err(&pdev->dev, "Unknown device type %d\n", in hi6421_pmic_probe()
104 return -EINVAL; in hi6421_pmic_probe()
107 ret = devm_mfd_add_devices(&pdev->dev, PLATFORM_DEVID_NONE, in hi6421_pmic_probe()
110 dev_err(&pdev->dev, "Failed to add child devices: %d\n", ret); in hi6421_pmic_probe()
127 MODULE_DESCRIPTION("Hi6421 PMIC driver");