Commit cf0c54db authored by Thara Gopinath's avatar Thara Gopinath Committed by Daniel Lezcano

thermal/drivers/qcom/lmh: Add support for sm8150

Add compatible to support LMh for sm8150 SoC.
sm8150 does not require explicit enabling for various LMh subsystems.
Add a variable indicating the same as match data which is set for sdm845.
Execute the piece of code enabling various LMh subsystems only if
enable algorithm match data is present.
Signed-off-by: default avatarThara Gopinath <thara.gopinath@linaro.org>
Reviewed-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220106173138.411097-2-thara.gopinath@linaro.orgSigned-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
parent 8556e19d
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#define LMH_REG_DCVS_INTR_CLR 0x8 #define LMH_REG_DCVS_INTR_CLR 0x8
#define LMH_ENABLE_ALGOS 1
struct lmh_hw_data { struct lmh_hw_data {
void __iomem *base; void __iomem *base;
struct irq_domain *domain; struct irq_domain *domain;
...@@ -90,6 +92,7 @@ static int lmh_probe(struct platform_device *pdev) ...@@ -90,6 +92,7 @@ static int lmh_probe(struct platform_device *pdev)
struct device_node *cpu_node; struct device_node *cpu_node;
struct lmh_hw_data *lmh_data; struct lmh_hw_data *lmh_data;
int temp_low, temp_high, temp_arm, cpu_id, ret; int temp_low, temp_high, temp_arm, cpu_id, ret;
unsigned int enable_alg;
u32 node_id; u32 node_id;
lmh_data = devm_kzalloc(dev, sizeof(*lmh_data), GFP_KERNEL); lmh_data = devm_kzalloc(dev, sizeof(*lmh_data), GFP_KERNEL);
...@@ -141,6 +144,9 @@ static int lmh_probe(struct platform_device *pdev) ...@@ -141,6 +144,9 @@ static int lmh_probe(struct platform_device *pdev)
if (!qcom_scm_lmh_dcvsh_available()) if (!qcom_scm_lmh_dcvsh_available())
return -EINVAL; return -EINVAL;
enable_alg = (uintptr_t)of_device_get_match_data(dev);
if (enable_alg) {
ret = qcom_scm_lmh_dcvsh(LMH_SUB_FN_CRNT, LMH_ALGO_MODE_ENABLE, 1, ret = qcom_scm_lmh_dcvsh(LMH_SUB_FN_CRNT, LMH_ALGO_MODE_ENABLE, 1,
LMH_NODE_DCVS, node_id, 0); LMH_NODE_DCVS, node_id, 0);
if (ret) if (ret)
...@@ -168,6 +174,7 @@ static int lmh_probe(struct platform_device *pdev) ...@@ -168,6 +174,7 @@ static int lmh_probe(struct platform_device *pdev)
dev_err(dev, "Error %d changing profile\n", ret); dev_err(dev, "Error %d changing profile\n", ret);
return ret; return ret;
} }
}
/* Set default thermal trips */ /* Set default thermal trips */
ret = qcom_scm_lmh_dcvsh(LMH_SUB_FN_THERMAL, LMH_TH_ARM_THRESHOLD, temp_arm, ret = qcom_scm_lmh_dcvsh(LMH_SUB_FN_THERMAL, LMH_TH_ARM_THRESHOLD, temp_arm,
...@@ -213,7 +220,8 @@ static int lmh_probe(struct platform_device *pdev) ...@@ -213,7 +220,8 @@ static int lmh_probe(struct platform_device *pdev)
} }
static const struct of_device_id lmh_table[] = { static const struct of_device_id lmh_table[] = {
{ .compatible = "qcom,sdm845-lmh", }, { .compatible = "qcom,sdm845-lmh", .data = (void *)LMH_ENABLE_ALGOS},
{ .compatible = "qcom,sm8150-lmh", },
{} {}
}; };
MODULE_DEVICE_TABLE(of, lmh_table); MODULE_DEVICE_TABLE(of, lmh_table);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment