summaryrefslogtreecommitdiff
path: root/drivers/regulator
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2017-02-18 06:38:21 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2017-02-18 06:38:21 -0800
commit8020c4ccfc41edad917c9abc3b39063f169e879c (patch)
treee6a1a2897166388af7d65a0f12620d27a734d84c /drivers/regulator
parent96b6f68843af076b0c4dc111355adb6fd84de0a8 (diff)
parente186ae7318345d032331624eb9b5f9e386eb4509 (diff)
Merge "regulator: cpr4-mmss-ldo: Correct the GFX LDO CPR sensor count for sdm630"
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/cpr4-mmss-ldo-regulator.c44
1 files changed, 30 insertions, 14 deletions
diff --git a/drivers/regulator/cpr4-mmss-ldo-regulator.c b/drivers/regulator/cpr4-mmss-ldo-regulator.c
index 525f9d6fcf75..6c6d112d2a6a 100644
--- a/drivers/regulator/cpr4-mmss-ldo-regulator.c
+++ b/drivers/regulator/cpr4-mmss-ldo-regulator.c
@@ -135,9 +135,15 @@ static const int sdm660_mmss_fuse_ref_volt[SDM660_MMSS_FUSE_CORNERS] = {
#define SDM660_MMSS_VOLTAGE_FUSE_SIZE 5
#define SDM660_MMSS_CPR_SENSOR_COUNT 11
+#define SDM630_MMSS_CPR_SENSOR_COUNT 7
#define SDM660_MMSS_CPR_CLOCK_RATE 19200000
+enum {
+ SDM660_SOC_ID,
+ SDM630_SOC_ID,
+};
+
/**
* cpr4_sdm660_mmss_read_fuse_data() - load MMSS specific fuse parameter
* values
@@ -594,7 +600,10 @@ static int cpr4_mmss_init_controller(struct cpr3_controller *ctrl)
return rc;
}
- ctrl->sensor_count = SDM660_MMSS_CPR_SENSOR_COUNT;
+ if (ctrl->soc_revision == SDM660_SOC_ID)
+ ctrl->sensor_count = SDM660_MMSS_CPR_SENSOR_COUNT;
+ else if (ctrl->soc_revision == SDM630_SOC_ID)
+ ctrl->sensor_count = SDM630_MMSS_CPR_SENSOR_COUNT;
/*
* MMSS only has one thread (0) so the zeroed array does not need
@@ -632,9 +641,23 @@ static int cpr4_mmss_init_controller(struct cpr3_controller *ctrl)
return 0;
}
+/* Data corresponds to the SoC revision */
+static const struct of_device_id cpr4_mmss_regulator_match_table[] = {
+ {
+ .compatible = "qcom,cpr4-sdm660-mmss-ldo-regulator",
+ .data = (void *)(uintptr_t)SDM660_SOC_ID,
+ },
+ {
+ .compatible = "qcom,cpr4-sdm630-mmss-ldo-regulator",
+ .data = (void *)(uintptr_t)SDM630_SOC_ID,
+ },
+ { },
+};
+
static int cpr4_mmss_regulator_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
+ const struct of_device_id *match;
struct cpr3_controller *ctrl;
int rc;
@@ -659,6 +682,12 @@ static int cpr4_mmss_regulator_probe(struct platform_device *pdev)
return rc;
}
+ match = of_match_node(cpr4_mmss_regulator_match_table, dev->of_node);
+ if (match)
+ ctrl->soc_revision = (uintptr_t)match->data;
+ else
+ cpr3_err(ctrl, "could not find compatible string match\n");
+
rc = cpr3_map_fuse_base(ctrl, pdev);
if (rc) {
cpr3_err(ctrl, "could not map fuse base address\n");
@@ -731,19 +760,6 @@ static int cpr4_mmss_regulator_resume(struct platform_device *pdev)
return cpr3_regulator_resume(ctrl);
}
-/* Data corresponds to the SoC revision */
-static const struct of_device_id cpr4_mmss_regulator_match_table[] = {
- {
- .compatible = "qcom,cpr4-sdm660-mmss-ldo-regulator",
- .data = (void *)NULL,
- },
- {
- .compatible = "qcom,cpr4-sdm630-mmss-ldo-regulator",
- .data = (void *)NULL,
- },
- { },
-};
-
static struct platform_driver cpr4_mmss_regulator_driver = {
.driver = {
.name = "qcom,cpr4-mmss-ldo-regulator",