lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ec66d4e7-cb82-46c6-84ae-bd51df7cab7c@mercury.local>
Date:   Wed, 8 Mar 2023 19:42:08 +0100
From:   Sebastian Reichel <sebastian.reichel@...labora.com>
To:     Daniel Lezcano <daniel.lezcano@...aro.org>
Cc:     Heiko Stuebner <heiko@...ech.de>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Amit Kucheria <amitk@...nel.org>,
        Zhang Rui <rui.zhang@...el.com>,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        linux-pm@...r.kernel.org, linux-rockchip@...ts.infradead.org,
        devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
        kernel@...labora.com
Subject: Re: [RESEND] [PATCHv3 4/7] thermal: rockchip: Simplify channel id
 logic

Hi Daniel,

On Wed, Mar 08, 2023 at 07:13:22PM +0100, Daniel Lezcano wrote:
> On 08/03/2023 12:22, Sebastian Reichel wrote:
> > Replace the channel ID lookup table by a simple offset, since
> > the channel IDs are consecutive.
> > 
> > Signed-off-by: Sebastian Reichel <sebastian.reichel@...labora.com>
> 
> As all the other patches are reviewed by Heiko, is the tag missing here?

Heiko was not happy with this in PATCHv2, when he reviewed most
of the patches:

https://lore.kernel.org/all/3601039.e9J7NaK4W3@phil/

I replied, but never got a response, so I kept it as is:

https://lore.kernel.org/all/20221206170232.xsm4kcbfwrmlrriw@mercury.elektranox.org/

FWIW it is essential for the series and cannot be dropped, because
RK3588 has more than 2 channels.

Greetings,

-- Sebastian

> > ---
> >   drivers/thermal/rockchip_thermal.c | 48 +++++++++++++-----------------
> >   1 file changed, 21 insertions(+), 27 deletions(-)
> > 
> > diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c
> > index 9ed45b318344..bcbdd618daae 100644
> > --- a/drivers/thermal/rockchip_thermal.c
> > +++ b/drivers/thermal/rockchip_thermal.c
> > @@ -39,15 +39,6 @@ enum tshut_polarity {
> >   	TSHUT_HIGH_ACTIVE,
> >   };
> > -/*
> > - * The system has two Temperature Sensors.
> > - * sensor0 is for CPU, and sensor1 is for GPU.
> > - */
> > -enum sensor_id {
> > -	SENSOR_CPU = 0,
> > -	SENSOR_GPU,
> > -};
> > -
> >   /*
> >    * The conversion table has the adc value and temperature.
> >    * ADC_DECREMENT: the adc value is of diminishing.(e.g. rk3288_code_table)
> > @@ -82,7 +73,7 @@ struct chip_tsadc_table {
> >   /**
> >    * struct rockchip_tsadc_chip - hold the private data of tsadc chip
> > - * @chn_id: array of sensor ids of chip corresponding to the channel
> > + * @chn_offset: the channel offset of the first channel
> >    * @chn_num: the channel number of tsadc chip
> >    * @tshut_temp: the hardware-controlled shutdown temperature value
> >    * @tshut_mode: the hardware-controlled shutdown mode (0:CRU 1:GPIO)
> > @@ -98,7 +89,7 @@ struct chip_tsadc_table {
> >    */
> >   struct rockchip_tsadc_chip {
> >   	/* The sensor id of chip correspond to the ADC channel */
> > -	int chn_id[SOC_MAX_SENSORS];
> > +	int chn_offset;
> >   	int chn_num;
> >   	/* The hardware-controlled tshut property */
> > @@ -925,8 +916,8 @@ static void rk_tsadcv2_tshut_mode(int chn, void __iomem *regs,
> >   }
> >   static const struct rockchip_tsadc_chip px30_tsadc_data = {
> > -	.chn_id[SENSOR_CPU] = 0, /* cpu sensor is channel 0 */
> > -	.chn_id[SENSOR_GPU] = 1, /* gpu sensor is channel 1 */
> > +	/* cpu, gpu */
> > +	.chn_offset = 0,
> >   	.chn_num = 2, /* 2 channels for tsadc */
> >   	.tshut_mode = TSHUT_MODE_CRU, /* default TSHUT via CRU */
> > @@ -949,7 +940,8 @@ static const struct rockchip_tsadc_chip px30_tsadc_data = {
> >   };
> >   static const struct rockchip_tsadc_chip rv1108_tsadc_data = {
> > -	.chn_id[SENSOR_CPU] = 0, /* cpu sensor is channel 0 */
> > +	/* cpu */
> > +	.chn_offset = 0,
> >   	.chn_num = 1, /* one channel for tsadc */
> >   	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
> > @@ -973,7 +965,8 @@ static const struct rockchip_tsadc_chip rv1108_tsadc_data = {
> >   };
> >   static const struct rockchip_tsadc_chip rk3228_tsadc_data = {
> > -	.chn_id[SENSOR_CPU] = 0, /* cpu sensor is channel 0 */
> > +	/* cpu */
> > +	.chn_offset = 0,
> >   	.chn_num = 1, /* one channel for tsadc */
> >   	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
> > @@ -997,8 +990,8 @@ static const struct rockchip_tsadc_chip rk3228_tsadc_data = {
> >   };
> >   static const struct rockchip_tsadc_chip rk3288_tsadc_data = {
> > -	.chn_id[SENSOR_CPU] = 1, /* cpu sensor is channel 1 */
> > -	.chn_id[SENSOR_GPU] = 2, /* gpu sensor is channel 2 */
> > +	/* cpu, gpu */
> > +	.chn_offset = 1,
> >   	.chn_num = 2, /* two channels for tsadc */
> >   	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
> > @@ -1022,7 +1015,8 @@ static const struct rockchip_tsadc_chip rk3288_tsadc_data = {
> >   };
> >   static const struct rockchip_tsadc_chip rk3328_tsadc_data = {
> > -	.chn_id[SENSOR_CPU] = 0, /* cpu sensor is channel 0 */
> > +	/* cpu */
> > +	.chn_offset = 0,
> >   	.chn_num = 1, /* one channels for tsadc */
> >   	.tshut_mode = TSHUT_MODE_CRU, /* default TSHUT via CRU */
> > @@ -1045,8 +1039,8 @@ static const struct rockchip_tsadc_chip rk3328_tsadc_data = {
> >   };
> >   static const struct rockchip_tsadc_chip rk3366_tsadc_data = {
> > -	.chn_id[SENSOR_CPU] = 0, /* cpu sensor is channel 0 */
> > -	.chn_id[SENSOR_GPU] = 1, /* gpu sensor is channel 1 */
> > +	/* cpu, gpu */
> > +	.chn_offset = 0,
> >   	.chn_num = 2, /* two channels for tsadc */
> >   	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
> > @@ -1070,8 +1064,8 @@ static const struct rockchip_tsadc_chip rk3366_tsadc_data = {
> >   };
> >   static const struct rockchip_tsadc_chip rk3368_tsadc_data = {
> > -	.chn_id[SENSOR_CPU] = 0, /* cpu sensor is channel 0 */
> > -	.chn_id[SENSOR_GPU] = 1, /* gpu sensor is channel 1 */
> > +	/* cpu, gpu */
> > +	.chn_offset = 0,
> >   	.chn_num = 2, /* two channels for tsadc */
> >   	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
> > @@ -1095,8 +1089,8 @@ static const struct rockchip_tsadc_chip rk3368_tsadc_data = {
> >   };
> >   static const struct rockchip_tsadc_chip rk3399_tsadc_data = {
> > -	.chn_id[SENSOR_CPU] = 0, /* cpu sensor is channel 0 */
> > -	.chn_id[SENSOR_GPU] = 1, /* gpu sensor is channel 1 */
> > +	/* cpu, gpu */
> > +	.chn_offset = 0,
> >   	.chn_num = 2, /* two channels for tsadc */
> >   	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
> > @@ -1120,8 +1114,8 @@ static const struct rockchip_tsadc_chip rk3399_tsadc_data = {
> >   };
> >   static const struct rockchip_tsadc_chip rk3568_tsadc_data = {
> > -	.chn_id[SENSOR_CPU] = 0, /* cpu sensor is channel 0 */
> > -	.chn_id[SENSOR_GPU] = 1, /* gpu sensor is channel 1 */
> > +	/* cpu, gpu */
> > +	.chn_offset = 0,
> >   	.chn_num = 2, /* two channels for tsadc */
> >   	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
> > @@ -1404,7 +1398,7 @@ static int rockchip_thermal_probe(struct platform_device *pdev)
> >   	for (i = 0; i < thermal->chip->chn_num; i++) {
> >   		error = rockchip_thermal_register_sensor(pdev, thermal,
> >   						&thermal->sensors[i],
> > -						thermal->chip->chn_id[i]);
> > +						thermal->chip->chn_offset + i);
> >   		if (error)
> >   			return dev_err_probe(&pdev->dev, error,
> >   				"failed to register sensor[%d].\n", i);
> 
> -- 
> <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
> 

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ