X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=drivers%2Fthermal%2Frcar_gen3_thermal.c;h=561a0a332208504ac274730649da62af23fcdafe;hb=1420edf7a3fbc9b8b0bbe24c3724d582dd4def28;hp=203aca44a2bb4bdfd3bc3d6465446f0eadba1a4b;hpb=033d56f6c0e0e53ee4fb1b87e49d301be6f46707;p=linux-2.6-block.git diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c index 203aca44a2bb..561a0a332208 100644 --- a/drivers/thermal/rcar_gen3_thermal.c +++ b/drivers/thermal/rcar_gen3_thermal.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include "thermal_core.h" @@ -90,10 +91,6 @@ struct rcar_gen3_thermal_priv { struct rcar_gen3_thermal_tsc *tscs[TSC_MAX_NUM]; unsigned int num_tscs; spinlock_t lock; /* Protect interrupts on and off */ - const struct rcar_gen3_thermal_data *data; -}; - -struct rcar_gen3_thermal_data { void (*thermal_init)(struct rcar_gen3_thermal_tsc *tsc); }; @@ -278,7 +275,12 @@ static irqreturn_t rcar_gen3_thermal_irq_thread(int irq, void *data) return IRQ_HANDLED; } -static void r8a7795_thermal_init(struct rcar_gen3_thermal_tsc *tsc) +static const struct soc_device_attribute r8a7795es1[] = { + { .soc_id = "r8a7795", .revision = "ES1.*" }, + { /* sentinel */ } +}; + +static void rcar_gen3_thermal_init_r8a7795es1(struct rcar_gen3_thermal_tsc *tsc) { rcar_gen3_thermal_write(tsc, REG_GEN3_CTSR, CTSR_THBGR); rcar_gen3_thermal_write(tsc, REG_GEN3_CTSR, 0x0); @@ -303,7 +305,7 @@ static void r8a7795_thermal_init(struct rcar_gen3_thermal_tsc *tsc) usleep_range(1000, 2000); } -static void r8a7796_thermal_init(struct rcar_gen3_thermal_tsc *tsc) +static void rcar_gen3_thermal_init(struct rcar_gen3_thermal_tsc *tsc) { u32 reg_val; @@ -324,17 +326,9 @@ static void r8a7796_thermal_init(struct rcar_gen3_thermal_tsc *tsc) usleep_range(1000, 2000); } -static const struct rcar_gen3_thermal_data r8a7795_data = { - .thermal_init = r8a7795_thermal_init, -}; - -static const struct rcar_gen3_thermal_data r8a7796_data = { - .thermal_init = r8a7796_thermal_init, -}; - static const struct of_device_id rcar_gen3_thermal_dt_ids[] = { - { .compatible = "renesas,r8a7795-thermal", .data = &r8a7795_data}, - { .compatible = "renesas,r8a7796-thermal", .data = &r8a7796_data}, + { .compatible = "renesas,r8a7795-thermal", }, + { .compatible = "renesas,r8a7796-thermal", }, {}, }; MODULE_DEVICE_TABLE(of, rcar_gen3_thermal_dt_ids); @@ -371,7 +365,9 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev) if (!priv) return -ENOMEM; - priv->data = of_device_get_match_data(dev); + priv->thermal_init = rcar_gen3_thermal_init; + if (soc_device_match(r8a7795es1)) + priv->thermal_init = rcar_gen3_thermal_init_r8a7795es1; spin_lock_init(&priv->lock); @@ -423,7 +419,7 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev) priv->tscs[i] = tsc; - priv->data->thermal_init(tsc); + priv->thermal_init(tsc); rcar_gen3_thermal_calc_coefs(&tsc->coef, ptat, thcode[i]); zone = devm_thermal_zone_of_sensor_register(dev, i, tsc, @@ -476,7 +472,7 @@ static int __maybe_unused rcar_gen3_thermal_resume(struct device *dev) for (i = 0; i < priv->num_tscs; i++) { struct rcar_gen3_thermal_tsc *tsc = priv->tscs[i]; - priv->data->thermal_init(tsc); + priv->thermal_init(tsc); rcar_gen3_thermal_set_trips(tsc, tsc->low, tsc->high); }