Lines Matching +full:2 +full:- +full:compatible
1 // SPDX-License-Identifier: GPL-2.0-only
17 #include <soc/qcom/qcom-spmi-pmic.h>
40 { .compatible = "qcom,pm660", .data = N_USIDS(2) },
41 { .compatible = "qcom,pm660l", .data = N_USIDS(2) },
42 { .compatible = "qcom,pm8004", .data = N_USIDS(2) },
43 { .compatible = "qcom,pm8005", .data = N_USIDS(2) },
44 { .compatible = "qcom,pm8019", .data = N_USIDS(2) },
45 { .compatible = "qcom,pm8028", .data = N_USIDS(2) },
46 { .compatible = "qcom,pm8110", .data = N_USIDS(2) },
47 { .compatible = "qcom,pm8150", .data = N_USIDS(2) },
48 { .compatible = "qcom,pm8150b", .data = N_USIDS(2) },
49 { .compatible = "qcom,pm8150c", .data = N_USIDS(2) },
50 { .compatible = "qcom,pm8150l", .data = N_USIDS(2) },
51 { .compatible = "qcom,pm8226", .data = N_USIDS(2) },
52 { .compatible = "qcom,pm8841", .data = N_USIDS(2) },
53 { .compatible = "qcom,pm8901", .data = N_USIDS(2) },
54 { .compatible = "qcom,pm8909", .data = N_USIDS(2) },
55 { .compatible = "qcom,pm8916", .data = N_USIDS(2) },
56 { .compatible = "qcom,pm8937", .data = N_USIDS(2) },
57 { .compatible = "qcom,pm8941", .data = N_USIDS(2) },
58 { .compatible = "qcom,pm8950", .data = N_USIDS(2) },
59 { .compatible = "qcom,pm8994", .data = N_USIDS(2) },
60 { .compatible = "qcom,pm8998", .data = N_USIDS(2) },
61 { .compatible = "qcom,pma8084", .data = N_USIDS(2) },
62 { .compatible = "qcom,pmd9635", .data = N_USIDS(2) },
63 { .compatible = "qcom,pmi8950", .data = N_USIDS(2) },
64 { .compatible = "qcom,pmi8962", .data = N_USIDS(2) },
65 { .compatible = "qcom,pmi8994", .data = N_USIDS(2) },
66 { .compatible = "qcom,pmi8998", .data = N_USIDS(2) },
67 { .compatible = "qcom,pmk8002", .data = N_USIDS(2) },
68 { .compatible = "qcom,pmp8074", .data = N_USIDS(2) },
69 { .compatible = "qcom,smb2351", .data = N_USIDS(2) },
70 { .compatible = "qcom,spmi-pmic", .data = N_USIDS(1) },
82 * This only supports PMICs with 1 or 2 USIDs.
94 if (sdev->usid % ctx->num_usids == 0) { in qcom_pmic_get_base_usid()
95 get_device(&sdev->dev); in qcom_pmic_get_base_usid()
99 function_parent_usid = sdev->usid; in qcom_pmic_get_base_usid()
104 * number of USIDs in the PMIC array, e.g. for a PMIC with 2 USIDs in qcom_pmic_get_base_usid()
106 * device for USID 2. in qcom_pmic_get_base_usid()
108 spmi_bus = of_get_parent(sdev->dev.of_node); in qcom_pmic_get_base_usid()
109 sdev = ERR_PTR(-ENODATA); in qcom_pmic_get_base_usid()
117 if (pmic_addr == function_parent_usid - (ctx->num_usids - 1)) { in qcom_pmic_get_base_usid()
124 sdev = ERR_PTR(-EPROBE_DEFER); in qcom_pmic_get_base_usid()
152 ret = -EPROBE_DEFER; in pmic_spmi_get_base_revid()
155 memcpy(&ctx->pmic, &base_ctx->pmic, sizeof(ctx->pmic)); in pmic_spmi_get_base_revid()
159 put_device(&base->dev); in pmic_spmi_get_base_revid()
169 ret = regmap_read(map, PMIC_TYPE, &pmic->type); in pmic_spmi_load_revid()
173 if (pmic->type != PMIC_TYPE_VALUE) in pmic_spmi_load_revid()
176 ret = regmap_read(map, PMIC_SUBTYPE, &pmic->subtype); in pmic_spmi_load_revid()
180 pmic->name = of_match_device(pmic_spmi_id_table, dev)->compatible; in pmic_spmi_load_revid()
182 ret = regmap_read(map, PMIC_REV2, &pmic->rev2); in pmic_spmi_load_revid()
186 ret = regmap_read(map, PMIC_REV3, &pmic->minor); in pmic_spmi_load_revid()
190 ret = regmap_read(map, PMIC_REV4, &pmic->major); in pmic_spmi_load_revid()
194 if (pmic->subtype == PMI8998_SUBTYPE || pmic->subtype == PM660_SUBTYPE) { in pmic_spmi_load_revid()
195 ret = regmap_read(map, PMIC_FAB_ID, &pmic->fab_id); in pmic_spmi_load_revid()
206 if ((pmic->subtype == PM8941_SUBTYPE || pmic->subtype == PM8226_SUBTYPE) && in pmic_spmi_load_revid()
207 pmic->major < PMIC_REV4_V2) in pmic_spmi_load_revid()
208 pmic->major++; in pmic_spmi_load_revid()
210 if (pmic->subtype == PM8110_SUBTYPE) in pmic_spmi_load_revid()
211 pmic->minor = pmic->rev2; in pmic_spmi_load_revid()
214 pmic->subtype, pmic->name, pmic->major, pmic->minor); in pmic_spmi_load_revid()
220 * qcom_pmic_get() - Get a pointer to the base PMIC device
236 if (!of_match_device(pmic_spmi_id_table, dev->parent)) in qcom_pmic_get()
237 return ERR_PTR(-EINVAL); in qcom_pmic_get()
239 sdev = to_spmi_device(dev->parent); in qcom_pmic_get()
240 spmi = dev_get_drvdata(&sdev->dev); in qcom_pmic_get()
242 return &spmi->pmic; in qcom_pmic_get()
263 ctx = devm_kzalloc(&sdev->dev, sizeof(*ctx), GFP_KERNEL); in pmic_spmi_probe()
265 return -ENOMEM; in pmic_spmi_probe()
267 ctx->num_usids = (uintptr_t)device_get_match_data(&sdev->dev); in pmic_spmi_probe()
270 if (sdev->usid % ctx->num_usids == 0) { in pmic_spmi_probe()
271 ret = pmic_spmi_load_revid(regmap, &sdev->dev, &ctx->pmic); in pmic_spmi_probe()
284 return devm_of_platform_populate(&sdev->dev); in pmic_spmi_probe()
300 .name = "pmic-spmi",
307 MODULE_ALIAS("spmi:spmi-pmic");
310 MODULE_AUTHOR("Stanimir Varbanov <svarbanov@mm-sol.com>");