From: "J, KEERTHY" <j-keerthy@ti.com> To: Daniel Lezcano <daniel.lezcano@linaro.org>, <rui.zhang@intel.com>, <robh+dt@kernel.org> Cc: <amit.kucheria@verdurent.com>, <t-kristo@ti.com>, <devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>, <linux-pm@vger.kernel.org>, <mark.rutland@arm.com> Subject: Re: [RESEND PATCH v4 2/4] thermal: k3: Add support for bandgap sensors Date: Mon, 23 Mar 2020 09:22:52 +0530 [thread overview] Message-ID: <b73f1fdc-16d6-7320-ab63-e51bb388fb5d@ti.com> (raw) In-Reply-To: <d8bff098-f852-4c55-0afc-d7fd043dd10a@linaro.org> On 3/19/2020 7:06 PM, Daniel Lezcano wrote: > On 19/03/2020 13:52, Keerthy wrote: >> >> >> On 19/03/20 6:08 pm, Daniel Lezcano wrote: >>> On 18/03/2020 09:30, 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 and creating work to periodically >>>> read temperatures from the zones are supported. >>>> There are no active/passive cooling agent supported. >>>> >>>> Signed-off-by: Keerthy <j-keerthy@ti.com> >>>> --- > > [ ... ] > >>>> +static const int k3_adc_to_temp[] = { >>>> + -40000, -40000, -40000, -40000, -39800, -39400, -39000, -38600, > > [ ... ] > >>>> 123000, >>>> + 123400, 123800, 124200, 124600, 124900, 125000, >>>> +}; >>> >>> Can be this array replaced by an initialization array with a formula? >>> >>> Why do we have most of the time a step of 400 then suddenly 500 and 400 >>> again? eg. 30600, 31000, 31400, 31900, 32500, 33000, 33400 >> >> This has come from a polynomial equation which i do not want to >> calculate every time we read the temperature. Hence prefer Look up table. > > Agree, it makes sense to not calculate every time the temperature is read. > > I was suggesting to fill the array at init time with this polynomial > formula instead of hardcoding it. As in case of OMAP this is a standard polynomial equation that does not change so i would prefer not calculating in the driver and having the look up table from TRM. > > [ ... ] > >>>> + >>>> + /* Get the sensor count in the VTM */ >>>> + val = readl(bgp->base + K3_VTM_DEVINFO_PWR0_OFFSET); >>>> + cnt = val & K3_VTM_DEVINFO_PWR0_TEMPSENS_CT_MASK; >>>> + cnt >>= __ffs(K3_VTM_DEVINFO_PWR0_TEMPSENS_CT_MASK); >>>> + >>>> + data = devm_kcalloc(dev, cnt, sizeof(*data), GFP_KERNEL); >>>> + if (!data) { >>>> + ret = -ENOMEM; >>>> + goto err_alloc; >>>> + } >>>> + >>>> + /* 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; >>>> + INIT_WORK(&data[id].thermal_wq, k3_thermal_work); >>> >>> What is supposed to do ? >> >> Periodically poll temperature. I know there is no passive cooling agent >> like cpufreq at the moment but i do have a critical trip do you >> recommend to remove that? > > Actually I was referring to the workq which is initialized, the callback > set but it is never called. It can be removed. Okay got it. > > Please take also the opportunity to wrap the calls to the register with > an explicit helper function name. IIUC the comment asks me to define a separate function that takes care of the body of the for loop. > > And remove reg_cnt which is unused. Sure Thanks, Keerthy > > Thanks > > -- Daniel >
WARNING: multiple messages have this Message-ID (diff)
From: "J, KEERTHY" <j-keerthy@ti.com> To: Daniel Lezcano <daniel.lezcano@linaro.org>, <rui.zhang@intel.com>, <robh+dt@kernel.org> Cc: mark.rutland@arm.com, devicetree@vger.kernel.org, amit.kucheria@verdurent.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, t-kristo@ti.com, linux-arm-kernel@lists.infradead.org Subject: Re: [RESEND PATCH v4 2/4] thermal: k3: Add support for bandgap sensors Date: Mon, 23 Mar 2020 09:22:52 +0530 [thread overview] Message-ID: <b73f1fdc-16d6-7320-ab63-e51bb388fb5d@ti.com> (raw) In-Reply-To: <d8bff098-f852-4c55-0afc-d7fd043dd10a@linaro.org> On 3/19/2020 7:06 PM, Daniel Lezcano wrote: > On 19/03/2020 13:52, Keerthy wrote: >> >> >> On 19/03/20 6:08 pm, Daniel Lezcano wrote: >>> On 18/03/2020 09:30, 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 and creating work to periodically >>>> read temperatures from the zones are supported. >>>> There are no active/passive cooling agent supported. >>>> >>>> Signed-off-by: Keerthy <j-keerthy@ti.com> >>>> --- > > [ ... ] > >>>> +static const int k3_adc_to_temp[] = { >>>> + -40000, -40000, -40000, -40000, -39800, -39400, -39000, -38600, > > [ ... ] > >>>> 123000, >>>> + 123400, 123800, 124200, 124600, 124900, 125000, >>>> +}; >>> >>> Can be this array replaced by an initialization array with a formula? >>> >>> Why do we have most of the time a step of 400 then suddenly 500 and 400 >>> again? eg. 30600, 31000, 31400, 31900, 32500, 33000, 33400 >> >> This has come from a polynomial equation which i do not want to >> calculate every time we read the temperature. Hence prefer Look up table. > > Agree, it makes sense to not calculate every time the temperature is read. > > I was suggesting to fill the array at init time with this polynomial > formula instead of hardcoding it. As in case of OMAP this is a standard polynomial equation that does not change so i would prefer not calculating in the driver and having the look up table from TRM. > > [ ... ] > >>>> + >>>> + /* Get the sensor count in the VTM */ >>>> + val = readl(bgp->base + K3_VTM_DEVINFO_PWR0_OFFSET); >>>> + cnt = val & K3_VTM_DEVINFO_PWR0_TEMPSENS_CT_MASK; >>>> + cnt >>= __ffs(K3_VTM_DEVINFO_PWR0_TEMPSENS_CT_MASK); >>>> + >>>> + data = devm_kcalloc(dev, cnt, sizeof(*data), GFP_KERNEL); >>>> + if (!data) { >>>> + ret = -ENOMEM; >>>> + goto err_alloc; >>>> + } >>>> + >>>> + /* 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; >>>> + INIT_WORK(&data[id].thermal_wq, k3_thermal_work); >>> >>> What is supposed to do ? >> >> Periodically poll temperature. I know there is no passive cooling agent >> like cpufreq at the moment but i do have a critical trip do you >> recommend to remove that? > > Actually I was referring to the workq which is initialized, the callback > set but it is never called. It can be removed. Okay got it. > > Please take also the opportunity to wrap the calls to the register with > an explicit helper function name. IIUC the comment asks me to define a separate function that takes care of the body of the for loop. > > And remove reg_cnt which is unused. Sure Thanks, Keerthy > > Thanks > > -- Daniel > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-03-23 3:53 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-03-18 8:30 [PATCH v4 0/4] thermal: k3: Add support for bandgap sensors Keerthy 2020-03-18 8:30 ` Keerthy 2020-03-18 8:30 ` [RESEND PATCH v4 1/4] dt-bindings: thermal: k3: Add VTM bindings documentation Keerthy 2020-03-18 8:30 ` Keerthy 2020-03-30 23:00 ` Rob Herring 2020-03-30 23:00 ` Rob Herring 2020-03-18 8:30 ` [RESEND PATCH v4 2/4] thermal: k3: Add support for bandgap sensors Keerthy 2020-03-18 8:30 ` Keerthy 2020-03-19 12:38 ` Daniel Lezcano 2020-03-19 12:38 ` Daniel Lezcano 2020-03-19 12:52 ` Keerthy 2020-03-19 12:52 ` Keerthy 2020-03-19 13:36 ` Daniel Lezcano 2020-03-19 13:36 ` Daniel Lezcano 2020-03-23 3:52 ` J, KEERTHY [this message] 2020-03-23 3:52 ` J, KEERTHY 2020-03-18 8:30 ` [RESEND PATCH v4 3/4] arm64: dts: ti: am654: Add thermal zones Keerthy 2020-03-18 8:30 ` Keerthy 2020-03-18 8:30 ` [RESEND PATCH v4 4/4] arm64: dts: ti: am6: Add VTM node Keerthy 2020-03-18 8:30 ` Keerthy
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=b73f1fdc-16d6-7320-ab63-e51bb388fb5d@ti.com \ --to=j-keerthy@ti.com \ --cc=amit.kucheria@verdurent.com \ --cc=daniel.lezcano@linaro.org \ --cc=devicetree@vger.kernel.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-pm@vger.kernel.org \ --cc=mark.rutland@arm.com \ --cc=robh+dt@kernel.org \ --cc=rui.zhang@intel.com \ --cc=t-kristo@ti.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.