Message ID | 1365465371-24652-1-git-send-email-abrestic@chromium.org (mailing list archive) |
---|---|
State | Superseded, archived |
Delegated to: | Zhang Rui |
Headers | show |
Hi Andrew, On 08-04-2013 19:56, Andrew Bresticker wrote: > When selecting a target cooling state in get_target_state(), make sure > that the state is at least as high as the minimum when the temperature > is rising and at least as low as the maximum when the temperature is > falling. Previously the cooling level would only be incremented or > decremented by one in these cases. > > Signed-off-by: Andrew Bresticker <abrestic@chromium.org> > --- > drivers/thermal/step_wise.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/thermal/step_wise.c b/drivers/thermal/step_wise.c > index 0cd5e9f..49992a4 100644 > --- a/drivers/thermal/step_wise.c > +++ b/drivers/thermal/step_wise.c > @@ -47,9 +47,13 @@ static unsigned long get_target_state(struct thermal_instance *instance, > if (trend == THERMAL_TREND_RAISING) { > cur_state = cur_state < instance->upper ? > (cur_state + 1) : instance->upper; > + if (cur_state < instance->lower) > + cur_state = instance->lower; > } else if (trend == THERMAL_TREND_DROPPING) { > cur_state = cur_state > instance->lower ? > (cur_state - 1) : instance->lower; > + if (cur_state > instance->upper) > + cur_state = instance->upper; > } In which situations cur_state will be out of the [lower;upper] boundaries? I mean at this point while temperature is rising, and we are rising the cooling level, we should be already above lower (and vice-versa). Can you please describe better the situation you are trying to cover/ that you have identified? > > return cur_state; > -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Eduardo, On Tue, Apr 9, 2013 at 8:00 AM, Eduardo Valentin <eduardo.valentin@ti.com> wrote: > Hi Andrew, > > > On 08-04-2013 19:56, Andrew Bresticker wrote: >> >> When selecting a target cooling state in get_target_state(), make sure >> that the state is at least as high as the minimum when the temperature >> is rising and at least as low as the maximum when the temperature is >> falling. Previously the cooling level would only be incremented or >> decremented by one in these cases. >> >> Signed-off-by: Andrew Bresticker <abrestic@chromium.org> >> --- >> drivers/thermal/step_wise.c | 4 ++++ >> 1 file changed, 4 insertions(+) >> >> diff --git a/drivers/thermal/step_wise.c b/drivers/thermal/step_wise.c >> index 0cd5e9f..49992a4 100644 >> --- a/drivers/thermal/step_wise.c >> +++ b/drivers/thermal/step_wise.c >> @@ -47,9 +47,13 @@ static unsigned long get_target_state(struct >> thermal_instance *instance, >> if (trend == THERMAL_TREND_RAISING) { >> cur_state = cur_state < instance->upper ? >> (cur_state + 1) : instance->upper; >> + if (cur_state < instance->lower) >> + cur_state = instance->lower; >> } else if (trend == THERMAL_TREND_DROPPING) { >> cur_state = cur_state > instance->lower ? >> (cur_state - 1) : instance->lower; >> + if (cur_state > instance->upper) >> + cur_state = instance->upper; >> } > > > > In which situations cur_state will be out of the [lower;upper] boundaries? I > mean at this point while temperature is rising, and we are rising the > cooling level, we should be already above lower (and vice-versa). Can you > please describe better the situation you are trying to cover/ that you have > identified? Suppose we hit a trip point which has bounds from 5 to 10, but cur_state is 0 because there has previously been no thermal throttling. In that case, we would only go to level 1, even though the thermal instance specifies we should be between 5 and 10. This patch would fix it so that we go directly to level 5 instead. I will resend this with a more descriptive commit message. > >> >> return cur_state; >> > Thanks, Andrew -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 09-04-2013 13:09, Andrew Bresticker wrote: > Hi Eduardo, > > On Tue, Apr 9, 2013 at 8:00 AM, Eduardo Valentin > <eduardo.valentin@ti.com> wrote: >> Hi Andrew, >> >> >> On 08-04-2013 19:56, Andrew Bresticker wrote: >>> >>> When selecting a target cooling state in get_target_state(), make sure >>> that the state is at least as high as the minimum when the temperature >>> is rising and at least as low as the maximum when the temperature is >>> falling. Previously the cooling level would only be incremented or >>> decremented by one in these cases. >>> >>> Signed-off-by: Andrew Bresticker <abrestic@chromium.org> >>> --- >>> drivers/thermal/step_wise.c | 4 ++++ >>> 1 file changed, 4 insertions(+) >>> >>> diff --git a/drivers/thermal/step_wise.c b/drivers/thermal/step_wise.c >>> index 0cd5e9f..49992a4 100644 >>> --- a/drivers/thermal/step_wise.c >>> +++ b/drivers/thermal/step_wise.c >>> @@ -47,9 +47,13 @@ static unsigned long get_target_state(struct >>> thermal_instance *instance, >>> if (trend == THERMAL_TREND_RAISING) { >>> cur_state = cur_state < instance->upper ? >>> (cur_state + 1) : instance->upper; >>> + if (cur_state < instance->lower) >>> + cur_state = instance->lower; >>> } else if (trend == THERMAL_TREND_DROPPING) { >>> cur_state = cur_state > instance->lower ? >>> (cur_state - 1) : instance->lower; >>> + if (cur_state > instance->upper) >>> + cur_state = instance->upper; >>> } >> >> >> >> In which situations cur_state will be out of the [lower;upper] boundaries? I >> mean at this point while temperature is rising, and we are rising the >> cooling level, we should be already above lower (and vice-versa). Can you >> please describe better the situation you are trying to cover/ that you have >> identified? > > Suppose we hit a trip point which has bounds from 5 to 10, but > cur_state is 0 because there has previously been no thermal > throttling. In that case, we would only go to level 1, even though > the thermal instance specifies we should be between 5 and 10. This > patch would fix it so that we go directly to level 5 instead. > > I will resend this with a more descriptive commit message. Thanks, I appreciate it. > >> >>> >>> return cur_state; >>> >> > > Thanks, > Andrew > > -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/thermal/step_wise.c b/drivers/thermal/step_wise.c index 0cd5e9f..49992a4 100644 --- a/drivers/thermal/step_wise.c +++ b/drivers/thermal/step_wise.c @@ -47,9 +47,13 @@ static unsigned long get_target_state(struct thermal_instance *instance, if (trend == THERMAL_TREND_RAISING) { cur_state = cur_state < instance->upper ? (cur_state + 1) : instance->upper; + if (cur_state < instance->lower) + cur_state = instance->lower; } else if (trend == THERMAL_TREND_DROPPING) { cur_state = cur_state > instance->lower ? (cur_state - 1) : instance->lower; + if (cur_state > instance->upper) + cur_state = instance->upper; } return cur_state;
When selecting a target cooling state in get_target_state(), make sure that the state is at least as high as the minimum when the temperature is rising and at least as low as the maximum when the temperature is falling. Previously the cooling level would only be incremented or decremented by one in these cases. Signed-off-by: Andrew Bresticker <abrestic@chromium.org> --- drivers/thermal/step_wise.c | 4 ++++ 1 file changed, 4 insertions(+)