Re: [PATCH] platform/x86: acer-wmi: improve platform profile handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jan 2, 2025 at 2:28 AM Armin Wolf <W_Armin@xxxxxx> wrote:
> > @@ -1946,12 +2038,10 @@ static int acer_thermal_profile_change(void)
> >               u8 current_tp;
> >               int tp, err;
> >               u64 on_AC;
> > -             acpi_status status;
> > -
> > -             err = ec_read(ACER_PREDATOR_V4_THERMAL_PROFILE_EC_OFFSET,
> > -                           &current_tp);
> >
> > -             if (err < 0)
> > +             err = WMID_gaming_get_misc_setting(ACER_WMID_MISC_SETTING_PLATFORM_PROFILE,
> > +                                                &current_tp);
> > +             if (err)
> >                       return err;
> >
> >               /* Check power source */
> > @@ -1962,54 +2052,52 @@ static int acer_thermal_profile_change(void)
> >               switch (current_tp) {
> >               case ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO:
> >                       if (!on_AC)
> > -                             tp = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED_WMI;
> > +                             tp = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED;
> >                       else if (cycle_gaming_thermal_profile)
> > -                             tp = ACER_PREDATOR_V4_THERMAL_PROFILE_ECO_WMI;
> > +                             tp = ACER_PREDATOR_V4_THERMAL_PROFILE_ECO;
> >                       else
> >                               tp = last_non_turbo_profile;
> >                       break;
> >               case ACER_PREDATOR_V4_THERMAL_PROFILE_PERFORMANCE:
> >                       if (!on_AC)
> > -                             tp = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED_WMI;
> > +                             tp = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED;
> >                       else
> > -                             tp = ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO_WMI;
> > +                             tp = ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO;
> >                       break;
> >               case ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED:
> >                       if (!on_AC)
> > -                             tp = ACER_PREDATOR_V4_THERMAL_PROFILE_ECO_WMI;
> > +                             tp = ACER_PREDATOR_V4_THERMAL_PROFILE_ECO;
> >                       else if (cycle_gaming_thermal_profile)
> > -                             tp = ACER_PREDATOR_V4_THERMAL_PROFILE_PERFORMANCE_WMI;
> > +                             tp = ACER_PREDATOR_V4_THERMAL_PROFILE_PERFORMANCE;
> >                       else
> > -                             tp = ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO_WMI;
> > +                             tp = ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO;
> >                       break;
> >               case ACER_PREDATOR_V4_THERMAL_PROFILE_QUIET:
> >                       if (!on_AC)
> > -                             tp = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED_WMI;
> > +                             tp = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED;
> >                       else if (cycle_gaming_thermal_profile)
> > -                             tp = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED_WMI;
> > +                             tp = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED;
> >                       else
> > -                             tp = ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO_WMI;
> > +                             tp = ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO;
> >                       break;
> >               case ACER_PREDATOR_V4_THERMAL_PROFILE_ECO:
> >                       if (!on_AC)
> > -                             tp = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED_WMI;
> > +                             tp = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED;
> >                       else if (cycle_gaming_thermal_profile)
> > -                             tp = ACER_PREDATOR_V4_THERMAL_PROFILE_QUIET_WMI;
> > +                             tp = ACER_PREDATOR_V4_THERMAL_PROFILE_QUIET;
> >                       else
> > -                             tp = ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO_WMI;
> > +                             tp = ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO;
> >                       break;
> >               default:
> >                       return -EOPNOTSUPP;
> >               }
>
> This needs a bit more work, since you might accidentally select unsupported platform profiles this way.
>
> Using platform_profile_cycle() would make sense here, but we still need to handle "on_AC". I however wonder
> if that is really necessary.
>

[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux