NetBSD-Bugs archive

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

Re: kern/43508: fan are shut down in any case if running on battery



On Thu, Jul 01, 2010 at 10:27:28AM +0200, David DEMELIER wrote:
> I think we have catch the problem, take a look at the dmesg.txt there
> is a lot of :
> 
> acpi_power-0447 [4294967256] power_set             : failed to set
> power state to D0 for FAN7: AE_NOT_FOUND

Thanks. That might indeed be the problem. This also indicates that the
problem might be in the NetBSD implementation.

> Since HP does not provide any fans control capability, NetBSD can not

No, this laptop provides fan controls. Something like the following should
appear in your laptop:

$ sysctl hw.acpi.power
...
hw.acpi.power.FAN6 = D0
hw.acpi.power.FAN7 = D3
...

where D0 is "on" and D3 is "off".

> So the solution would be removing any fans control if AE_NOT_FOUND?

I am still trying to understand the DSDT of this laptop. But in the
meanwhile, can you try the following patch? It tries to address a case where
it might be unreliable to get the power state of a device (e.g. fan) but it
is still possible to set the power state.

Index: acpi_power.c
===================================================================
RCS file: /cvsroot/src/sys/dev/acpi/acpi_power.c,v
retrieving revision 1.20
diff -u -p -r1.20 acpi_power.c
--- acpi_power.c        8 Jun 2010 21:47:26 -0000       1.20
+++ acpi_power.c        1 Jul 2010 08:41:22 -0000
@@ -358,7 +358,6 @@ acpi_power_set(ACPI_HANDLE hdl, int stat
        struct acpi_devnode *ad = acpi_get_node(hdl);
        ACPI_STATUS rv;
        char path[5];
-       int old;
 
        if (ad == NULL)
                return false;
@@ -373,19 +372,6 @@ acpi_power_set(ACPI_HANDLE hdl, int stat
                goto fail;
        }
 
-       if (acpi_power_get(ad, &old) != true) {
-               rv = AE_NOT_FOUND;
-               goto fail;
-       }
-
-       KASSERT(ad->ad_state == old);
-       KASSERT(ad->ad_state != ACPI_STATE_ERROR);
-
-       if (ad->ad_state == state) {
-               rv = AE_ALREADY_EXISTS;
-               goto fail;
-       }
-
        /*
         * It is only possible to go to D0 ("on") from D3 ("off").
         */
@@ -434,7 +420,7 @@ acpi_power_set(ACPI_HANDLE hdl, int stat
        (void)AcpiEvaluateObject(ad->ad_handle, path, NULL, NULL);
 
        ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s turned from "
-               "D%d to D%d\n", ad->ad_name, old, state));
+               "D%d to D%d\n", ad->ad_name, ad->ad_state, state));
 
        ad->ad_state = state;
 
@@ -499,7 +485,7 @@ acpi_power_res(ACPI_HANDLE hdl, ACPI_HAN
        res = acpi_power_res_get(hdl);
 
        if (res == NULL)
-               return AE_NOT_FOUND;
+               return AE_NOT_EXIST;
 
        /*
         * (De)reference the resource.


Home | Main Index | Thread Index | Old Index