diff options
author | Ansuel Smith <ansuelsmth@gmail.com> | 2020-01-26 04:32:45 +0100 |
---|---|---|
committer | Petr Štetiar <ynezz@true.cz> | 2020-03-03 23:38:23 +0100 |
commit | efc5be2ecfd0f43b5a603f63a8f0950d484c5e8f (patch) | |
tree | 237cabb56c472320c7a2c5a8023bf5bf64976fd1 /target/linux/ipq806x/patches-5.4/0063-3-tsens-fix-kernel-5_4.patch | |
parent | c692d896eb6315edb46df851f5ecd96c49e2b65d (diff) | |
download | upstream-efc5be2ecfd0f43b5a603f63a8f0950d484c5e8f.tar.gz upstream-efc5be2ecfd0f43b5a603f63a8f0950d484c5e8f.tar.bz2 upstream-efc5be2ecfd0f43b5a603f63a8f0950d484c5e8f.zip |
ipq806x: fix tsens driver
Rework tsens driver.
Since in the new kernel 5.4 init common do more than it
should, inizialize the kernel memory directly in the driver and
drop use of this function. Rework all the patch with the new
variable names.
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
Diffstat (limited to 'target/linux/ipq806x/patches-5.4/0063-3-tsens-fix-kernel-5_4.patch')
-rw-r--r-- | target/linux/ipq806x/patches-5.4/0063-3-tsens-fix-kernel-5_4.patch | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/target/linux/ipq806x/patches-5.4/0063-3-tsens-fix-kernel-5_4.patch b/target/linux/ipq806x/patches-5.4/0063-3-tsens-fix-kernel-5_4.patch new file mode 100644 index 0000000000..6c056db3b7 --- /dev/null +++ b/target/linux/ipq806x/patches-5.4/0063-3-tsens-fix-kernel-5_4.patch @@ -0,0 +1,68 @@ +--- a/drivers/thermal/qcom/tsens-ipq8064.c ++++ b/drivers/thermal/qcom/tsens-ipq8064.c +@@ -18,6 +18,7 @@ + #include <linux/regmap.h> + #include <linux/thermal.h> + #include <linux/nvmem-consumer.h> ++#include <linux/of_platform.h> + #include <linux/io.h> + #include <linux/interrupt.h> + #include "tsens.h" +@@ -320,15 +321,42 @@ static void hw_init(struct tsens_priv *p + INIT_WORK(&priv->tsens_work, tsens_scheduler_fn); + } + ++static const struct regmap_config tsens_config = { ++ .name = "tm", ++ .reg_bits = 32, ++ .val_bits = 32, ++ .reg_stride = 4, ++}; ++ + static int init_ipq8064(struct tsens_priv *priv) + { +- int ret, i; ++ struct device *dev = priv->dev; + u32 reg_cntl, offset = 0; ++ struct resource *res; ++ resource_size_t size; ++ void __iomem *base; ++ int ret, i; ++ struct platform_device *op = of_find_device_by_node(priv->dev->of_node); ++ ++ if (!op) ++ return -EINVAL; + +- init_common(priv); +- if (!priv->tm_map) +- return -ENODEV; ++ /* old DTs where SROT and TM were in a contiguous 2K block */ ++ priv->tm_offset = 0x1000; + ++ res = platform_get_resource(op, IORESOURCE_MEM, 0); ++ size = resource_size(res); ++ base = devm_ioremap(&op->dev, res->start, size); ++ if (IS_ERR(base)) { ++ ret = PTR_ERR(base); ++ goto err_put_device; ++ } ++ ++ priv->tm_map = devm_regmap_init_mmio(dev, base, &tsens_config); ++ if (IS_ERR(priv->tm_map)) { ++ ret = PTR_ERR(priv->tm_map); ++ goto err_put_device; ++ } + /* + * The status registers for each sensor are discontiguous + * because some SoCs have 5 sensors while others have more +@@ -367,6 +395,10 @@ static int init_ipq8064(struct tsens_pri + return ret; + + return 0; ++ ++err_put_device: ++ put_device(&op->dev); ++ return ret; + } + + static int calibrate_ipq8064(struct tsens_priv *priv) |