Re: [PATCH 1/3] thermal: ti-soc-thermal: Fix stuck sensor with continuous mode for 4430

Tony Lindgren
2021-01-08T07:20:08Z

* Péter Ujfalusi <peter.ujfalusi@gmail.com> [201231 12:55]:
> On 12/30/20 10:43 AM, Tony Lindgren wrote:
> > @@ -58,7 +58,8 @@ omap4430_adc_to_temp[OMAP4430_ADC_END_VALUE - OMAP4430_ADC_START_VALUE + 1] = {
> > const struct ti_bandgap_data omap4430_data = {
> > .features = TI_BANDGAP_FEATURE_MODE_CONFIG |
> > TI_BANDGAP_FEATURE_CLK_CTRL |
> > - TI_BANDGAP_FEATURE_POWER_SWITCH,
> > + TI_BANDGAP_FEATURE_POWER_SWITCH |
> > + TI_BANDGAP_FEATURE_CONT_MODE_ONLY,
>
> Can we add a comment with the observations?

Sure, and I also noticed that the timeout triggers also on dra7
too. I need to recheck what all are affected.. At least we now
see warnings on the SoCs affected.

> > @@ -605,8 +606,10 @@ ti_bandgap_force_single_read(struct ti_bandgap *bgp, int id)
> > u32 counter = 1000;
> > struct temp_sensor_registers *tsr;
> >
> > - /* Select single conversion mode */
> > - if (TI_BANDGAP_HAS(bgp, MODE_CONFIG))
> > + /* Select continuous or single conversion mode */
> > + if (TI_BANDGAP_HAS(bgp, CONT_MODE_ONLY))
> > + RMW_BITS(bgp, id, bgap_mode_ctrl, mode_ctrl_mask, 1);
> > + else if (TI_BANDGAP_HAS(bgp, MODE_CONFIG))
> > RMW_BITS(bgp, id, bgap_mode_ctrl, mode_ctrl_mask, 0);
>
> Would not be better to:
> if (TI_BANDGAP_HAS(bgp, MODE_CONFIG)) {
> if (TI_BANDGAP_HAS(bgp, CONT_MODE_ONLY))
> RMW_BITS(bgp, id, bgap_mode_ctrl, mode_ctrl_mask, 1);
> else
> RMW_BITS(bgp, id, bgap_mode_ctrl, mode_ctrl_mask, 0);
> }
>
> One can only switch to cont/single mode if the mode config is possible.

Yup makes sense thanks for spotting that.

Regards,

Tony