Re: [PATCH v5 2/4] thermal: k3: Add support for bandgap sensors
From: Daniel Lezcano
Date: Mon Apr 06 2020 - 12:40:13 EST
On 31/03/2020 09:53, Keerthy wrote:
> The bandgap provides current and voltage reference for its internal
> circuits and other analog IP blocks. The analog-to-digital
> converter (ADC) produces an output value that is proportional
> to the silicon temperature.
>
> Currently reading temperatures only is supported.
> There are no active/passive cooling agent supported.
>
> Signed-off-by: Keerthy <j-keerthy@xxxxxx>
> ---
[ ... ]
> +static int k3_bandgap_probe(struct platform_device *pdev)
> +{
> + int ret = 0, cnt, val, id, reg_cnt = 0;
We missed 'reg_cnt' which is not used.
[ ... ]
> + /* Register the thermal sensors */
> + for (id = 0; id < cnt; id++) {
> + data[id].sensor_id = id;
> + data[id].bgp = bgp;
> + data[id].ctrl_offset = K3_VTM_TMPSENS0_CTRL_OFFSET +
> + id * K3_VTM_REGS_PER_TS;
> + data[id].stat_offset = data[id].ctrl_offset + 0x8;
> +
> + val = readl(data[id].bgp->base + data[id].ctrl_offset);
> + val |= (K3_VTM_TMPSENS_CTRL_SOC |
> + K3_VTM_TMPSENS_CTRL_CLRZ |
> + K3_VTM_TMPSENS_CTRL_CLKON_REQ);
> + val &= ~K3_VTM_TMPSENS_CTRL_CBIASSEL;
> + writel(val, data[id].bgp->base + data[id].ctrl_offset);
> +
> + data[id].ti_thermal =
> + devm_thermal_zone_of_sensor_register(dev, id,
> + &data[id],
> + &k3_of_thermal_ops);
> + if (IS_ERR(data[id].ti_thermal)) {
> + dev_err(dev, "thermal zone device is NULL\n");
> + ret = PTR_ERR(data[id].ti_thermal);
> + goto err_alloc;
> + }
> +
> + reg_cnt++;
> + }
[ ... ]
--
<http://www.linaro.org/> Linaro.org â Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog