Commit fe3bfa75 authored by Wolfram Sang's avatar Wolfram Sang Committed by Daniel Lezcano

drivers/thermal/rcar_gen3_thermal: introduce 'info' structure

More items to describe the TSCs are needed soon, so encapsulate the
current 'ths_tj_1' item into a struct.
Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: default avatarNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Tested-by: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20230511192220.7523-2-wsa+renesas@sang-engineering.com
parent 0849027b
...@@ -66,6 +66,10 @@ struct equation_coefs { ...@@ -66,6 +66,10 @@ struct equation_coefs {
int b2; int b2;
}; };
struct rcar_thermal_info {
int ths_tj_1;
};
struct rcar_gen3_thermal_tsc { struct rcar_gen3_thermal_tsc {
void __iomem *base; void __iomem *base;
struct thermal_zone_device *zone; struct thermal_zone_device *zone;
...@@ -79,6 +83,7 @@ struct rcar_gen3_thermal_priv { ...@@ -79,6 +83,7 @@ struct rcar_gen3_thermal_priv {
struct thermal_zone_device_ops ops; struct thermal_zone_device_ops ops;
unsigned int num_tscs; unsigned int num_tscs;
int ptat[3]; int ptat[3];
const struct rcar_thermal_info *info;
}; };
static inline u32 rcar_gen3_thermal_read(struct rcar_gen3_thermal_tsc *tsc, static inline u32 rcar_gen3_thermal_read(struct rcar_gen3_thermal_tsc *tsc,
...@@ -318,52 +323,58 @@ static void rcar_gen3_thermal_init(struct rcar_gen3_thermal_priv *priv, ...@@ -318,52 +323,58 @@ static void rcar_gen3_thermal_init(struct rcar_gen3_thermal_priv *priv,
usleep_range(1000, 2000); usleep_range(1000, 2000);
} }
static const int rcar_gen3_ths_tj_1 = 126; static const struct rcar_thermal_info rcar_m3w_thermal_info = {
static const int rcar_gen3_ths_tj_1_m3_w = 116; .ths_tj_1 = 116,
};
static const struct rcar_thermal_info rcar_gen3_thermal_info = {
.ths_tj_1 = 126,
};
static const struct of_device_id rcar_gen3_thermal_dt_ids[] = { static const struct of_device_id rcar_gen3_thermal_dt_ids[] = {
{ {
.compatible = "renesas,r8a774a1-thermal", .compatible = "renesas,r8a774a1-thermal",
.data = &rcar_gen3_ths_tj_1_m3_w, .data = &rcar_m3w_thermal_info,
}, },
{ {
.compatible = "renesas,r8a774b1-thermal", .compatible = "renesas,r8a774b1-thermal",
.data = &rcar_gen3_ths_tj_1, .data = &rcar_gen3_thermal_info,
}, },
{ {
.compatible = "renesas,r8a774e1-thermal", .compatible = "renesas,r8a774e1-thermal",
.data = &rcar_gen3_ths_tj_1, .data = &rcar_gen3_thermal_info,
}, },
{ {
.compatible = "renesas,r8a7795-thermal", .compatible = "renesas,r8a7795-thermal",
.data = &rcar_gen3_ths_tj_1, .data = &rcar_gen3_thermal_info,
}, },
{ {
.compatible = "renesas,r8a7796-thermal", .compatible = "renesas,r8a7796-thermal",
.data = &rcar_gen3_ths_tj_1_m3_w, .data = &rcar_m3w_thermal_info,
}, },
{ {
.compatible = "renesas,r8a77961-thermal", .compatible = "renesas,r8a77961-thermal",
.data = &rcar_gen3_ths_tj_1_m3_w, .data = &rcar_m3w_thermal_info,
}, },
{ {
.compatible = "renesas,r8a77965-thermal", .compatible = "renesas,r8a77965-thermal",
.data = &rcar_gen3_ths_tj_1, .data = &rcar_gen3_thermal_info,
}, },
{ {
.compatible = "renesas,r8a77980-thermal", .compatible = "renesas,r8a77980-thermal",
.data = &rcar_gen3_ths_tj_1, .data = &rcar_gen3_thermal_info,
}, },
{ {
.compatible = "renesas,r8a779a0-thermal", .compatible = "renesas,r8a779a0-thermal",
.data = &rcar_gen3_ths_tj_1, .data = &rcar_gen3_thermal_info,
}, },
{ {
.compatible = "renesas,r8a779f0-thermal", .compatible = "renesas,r8a779f0-thermal",
.data = &rcar_gen3_ths_tj_1, .data = &rcar_gen3_thermal_info,
}, },
{ {
.compatible = "renesas,r8a779g0-thermal", .compatible = "renesas,r8a779g0-thermal",
.data = &rcar_gen3_ths_tj_1, .data = &rcar_gen3_thermal_info,
}, },
{}, {},
}; };
...@@ -418,7 +429,6 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev) ...@@ -418,7 +429,6 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
{ {
struct rcar_gen3_thermal_priv *priv; struct rcar_gen3_thermal_priv *priv;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
const int *ths_tj_1 = of_device_get_match_data(dev);
struct resource *res; struct resource *res;
struct thermal_zone_device *zone; struct thermal_zone_device *zone;
unsigned int i; unsigned int i;
...@@ -430,6 +440,7 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev) ...@@ -430,6 +440,7 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
priv->ops = rcar_gen3_tz_of_ops; priv->ops = rcar_gen3_tz_of_ops;
priv->info = of_device_get_match_data(dev);
platform_set_drvdata(pdev, priv); platform_set_drvdata(pdev, priv);
if (rcar_gen3_thermal_request_irqs(priv, pdev)) if (rcar_gen3_thermal_request_irqs(priv, pdev))
...@@ -469,7 +480,7 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev) ...@@ -469,7 +480,7 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
struct rcar_gen3_thermal_tsc *tsc = priv->tscs[i]; struct rcar_gen3_thermal_tsc *tsc = priv->tscs[i];
rcar_gen3_thermal_init(priv, tsc); rcar_gen3_thermal_init(priv, tsc);
rcar_gen3_thermal_calc_coefs(priv, tsc, *ths_tj_1); rcar_gen3_thermal_calc_coefs(priv, tsc, priv->info->ths_tj_1);
zone = devm_thermal_of_zone_register(dev, i, tsc, &priv->ops); zone = devm_thermal_of_zone_register(dev, i, tsc, &priv->ops);
if (IS_ERR(zone)) { if (IS_ERR(zone)) {
......
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