Bug 42946

Summary: Toshiba Portege M901(Series M900) fan can't start properly
Product: ACPI Reporter: Peiding CHEN (mcadoo.chen)
Component: Power-FanAssignee: Zhang Rui (rui.zhang)
Status: CLOSED OBSOLETE    
Severity: normal CC: aaron.lu, lenb, rui.zhang
Priority: P1    
Hardware: x86-64   
OS: Linux   
Kernel Version: x86_64 3.2.1-gentoo-r2 Subsystem:
Regression: No Bisected commit-id:
Attachments: acpidump output
dmesg output
detailed device information
loaded modules
information about respiratory "/sys/class/thermal"
kernel config
info in /proc/acpi/
dsdt.aml
dsdt.dat
dsdt.dsl
dsdt.hex
output of "iasl -tc dsdt.dsl"
output of "acpitool -e"
output of "acpitool -F 1"
grep_thermal
customized DSDT
Customized DSDT in aml format

Description Peiding CHEN 2012-03-17 01:07:45 UTC
Hello everyone, Bonjour

Due to the need of study, I installed Linux on my laptop Toshiba Portégé M901(Series M900), Right now I am struggling to fix a problem with my fan control. Here is the problem:

In fact, during the starting procedure, the fan stops turning after loading the acpi control(I think. In fact, that occurs when this error appears:"pci0000:00: ACPI _OSC request failed (AE_NOT_FOUND), returned control mask: 0x1d"), then the fan will never start unless the CPU temperature drops and passes through 85, 75, 65 or 55 degrees. If it starts turning, the fan works better, it seems that the speed could be adjusted according to CPU temperature. 
I've tried everything that I could find from internet, such as adding acpi_osi="Linux", acpi.power_nocheck=1, etc. as options to the bootloader) except for fixing the DSDT. I didn't succeeding in fixing it, I don't understand that and how to do that. There are too many warnings but no error, so I guess it may not be the problem source.

I look at the /proc/acpi, it seems that some respiroties should have existed like thermal_zone or fan[see attachment "proc_acpi"]. In /proc/acpi/toshiba, there isn't file "fan" either. I tried detect my fan by lm_sensors but failed with information which is my chipset ITE IT8512 is not supported. It showed only my cpu and chipset temperature. acpitool is installed too but doesn't find right fan device.

On the contrary, from the output of dmesg, it implies that the fan is on and "acpi device:07: registered as cooling_device8" is registed [see attachment "dmesg"]. But after verifing, the value of ***/cooling_device8/type is "LCD" while ***/cooling_device0/type is "fan". So weird.[see attachment "thermal_zone"]

I don't know what is wrong, where I could start? I still haven't fixed the fan control. So I would like to know if you have some ideas about this issue. Here are some information in attachement files about my laptop and system. I'll be very grateful for your help. Many thanks. If you need more information, say it please.

Best regards
Comment 1 Peiding CHEN 2012-03-17 01:08:24 UTC
Created attachment 72617 [details]
acpidump output
Comment 2 Peiding CHEN 2012-03-17 01:09:19 UTC
Created attachment 72618 [details]
dmesg output
Comment 3 Peiding CHEN 2012-03-17 01:09:52 UTC
Created attachment 72619 [details]
detailed device information
Comment 4 Peiding CHEN 2012-03-17 01:10:18 UTC
Created attachment 72620 [details]
loaded modules
Comment 5 Peiding CHEN 2012-03-17 01:11:26 UTC
Created attachment 72621 [details]
information about respiratory "/sys/class/thermal"
Comment 6 Peiding CHEN 2012-03-17 01:11:46 UTC
Created attachment 72622 [details]
kernel config
Comment 7 Peiding CHEN 2012-03-17 01:12:15 UTC
Created attachment 72623 [details]
info in /proc/acpi/
Comment 8 Peiding CHEN 2012-03-17 01:12:49 UTC
Created attachment 72624 [details]
dsdt.aml
Comment 9 Peiding CHEN 2012-03-17 01:13:03 UTC
Created attachment 72625 [details]
dsdt.dat
Comment 10 Peiding CHEN 2012-03-17 01:13:21 UTC
Created attachment 72626 [details]
dsdt.dsl
Comment 11 Peiding CHEN 2012-03-17 01:13:40 UTC
Created attachment 72627 [details]
dsdt.hex
Comment 12 Peiding CHEN 2012-03-17 01:14:36 UTC
Created attachment 72628 [details]
output of "iasl -tc dsdt.dsl"
Comment 13 Peiding CHEN 2012-03-17 01:15:44 UTC
Created attachment 72630 [details]
output of "acpitool -e"
Comment 14 Peiding CHEN 2012-03-17 01:16:55 UTC
Created attachment 72631 [details]
output of "acpitool -F 1"
Comment 15 Peiding CHEN 2012-03-17 09:04:04 UTC
Sorry, I'm not sure if it occurs at "pci0000:00:
ACPI _OSC request failed (AE_NOT_FOUND), returned control mask: 0x1d". What I am sure is that it occurs at "failed to execute '/lib/udev/pci-db' 'pci-db /devices/pci0000:00/0000: 00:" when the system is booting
Comment 16 Zhang Rui 2012-03-19 08:31:17 UTC
(In reply to comment #5)
> Created an attachment (id=72621) [details]
> information about respiratory "/sys/class/thermal"

please attach the output of "grep . /sys/class/thermal/*/*" instead.
Comment 17 Zhang Rui 2012-03-19 08:36:38 UTC
According to the acpidump, there are five ACPI controlled fans in your laptop.
cooling_device0 ~ cooling_device5
So we need to make clear if these ACPI fans work properly or not first.
So would you please turn on/off these fans manually and see if they work as expected or not?
You can run "echo 1 > /sys/class/thermal/cooling_device0/cur_state" to turn on the fan and "echo 0 > /sys/class/thermal/cooling_device0/cur_state" to turn off it.
Comment 18 Peiding CHEN 2012-03-19 08:54:08 UTC
Created attachment 72651 [details]
grep_thermal

info before running "echo 1 > /sys/class/thermal/cooling_device0/cur_state"
Comment 19 Peiding CHEN 2012-03-19 08:54:46 UTC
(In reply to comment #16)
> (In reply to comment #5)
> > Created an attachment (id=72621) [details] [details]
> > information about respiratory "/sys/class/thermal"
> 
> please attach the output of "grep . /sys/class/thermal/*/*" instead.

already uploaded, please check it.
Comment 20 Peiding CHEN 2012-03-19 09:03:24 UTC
(In reply to comment #17)
> According to the acpidump, there are five ACPI controlled fans in your
> laptop.
> cooling_device0 ~ cooling_device5
> So we need to make clear if these ACPI fans work properly or not first.
> So would you please turn on/off these fans manually and see if they work as
> expected or not?
> You can run "echo 1 > /sys/class/thermal/cooling_device0/cur_state" to turn
> on
> the fan and "echo 0 > /sys/class/thermal/cooling_device0/cur_state" to turn
> off
> it.

I run linux in my laptop, there should be only 1 fan. I've no idea what the 5 fans are standing for. 

"echo 1 > /sys/class/thermal/cooling_device0/cur_state" did turn the fan on, but 
"echo 0 > /sys/class/thermal/cooling_device0/cur_state" didn't work.
by the way, after "echo 1 > /sys/class/thermal/cooling_device0/cur_state" the speed of fan couldn't be controlled any more. It work at only one speed level. On the contrary, if it starts working by itself when the condition mentioned above is satisfied, the fan works perfectly for that moment.
Comment 21 Peiding CHEN 2012-03-19 18:19:58 UTC
Sorry, forgot to mention that I am running the 64bit system
Comment 22 Len Brown 2012-03-20 02:14:58 UTC
typically 5 fans really are just a way to represent
5 speeds of a single fan.  So they typically must be enabled
and disabled in sequence to be effective.
Comment 23 Peiding CHEN 2012-03-23 23:12:27 UTC
(In reply to comment #17)
> According to the acpidump, there are five ACPI controlled fans in your
> laptop.
> cooling_device0 ~ cooling_device5
> So we need to make clear if these ACPI fans work properly or not first.
> So would you please turn on/off these fans manually and see if they work as
> expected or not?
> You can run "echo 1 > /sys/class/thermal/cooling_device0/cur_state" to turn
> on
> the fan and "echo 0 > /sys/class/thermal/cooling_device0/cur_state" to turn
> off
> it.

after several test, I confirm that "echo 1 > ..." and "echo 0 > ..." work to turn on or off the fan, but the the cooling device number should be correctly chosen. But the value of the file "cur_state" is always 1.
In addition, automatic control is still impossible when I start the fan manually. Recovering from suspending renders the same effect. Or, the automaic control starts with luck...(I've only observed this one time). 

Do you find something that may fix this problem?

Thanks

Regards
Comment 24 Peiding CHEN 2012-03-23 23:48:03 UTC
Another weird thing is, when I just finished booting the system, "echo 1" doesn't work for any of the 6 cooling_devices. So to start them, "echo 0" should run firtly. Then, if I put "echo 0" to all cooling_device's cur_state, it will restart again at full speed when I turn them off one by one and run again "grep . /sys/class/thermal/*/*" and it seems that all cooling_device start.
Comment 25 Peiding CHEN 2012-03-24 11:08:46 UTC
I found another record from "messages" when the fan starts automatically

"PD nobody: ACPI event unhandled: thermal_zone TZ0 00000081 00000000"

hope that it's useful
Comment 26 Peiding CHEN 2012-04-02 08:33:46 UTC
well, problem seems to be solved.

I recompile the kernel, all the options regarding to the acpi are compiled as built-in except for the fan which is compiled as module.
After that, the fan stops at the beginning of system boot and restarts aftering the fan module is loaded(I guess). I'm not sure if it's really solved permanently. At least, it works for the moment. I believe that for the acpi options in kernel, neither all built-in nor all modules compiled will make the fan start working just after boot. That' it. I'll be back if I found something else weird.

I replace status by "resolved". I don't know which sort of "Resolved "should I choose.

Thank you all the same
Comment 27 Peiding CHEN 2012-05-26 19:42:16 UTC
Problem is there.

The thing is:
The fan can start working if I do what I mentioned before, but the fan works only at one speed and can't be modulated automatically.

Could you propose some idea?

Thanks a lot
Comment 28 Peiding CHEN 2012-05-30 09:42:09 UTC
After system booting, the fan will generally work only at one speed level like resuming from suspended status and the speed will never change. The automatic control is still impossible just after booting. It is only activated when the cpu temperature drops and passes the trip point (doesn't start while temperature increase). So my temporary solution is to start the fan manually in high speed when I run some heavy applications for getting a high cpu temperature(more than 70°C). Then when the temperature drops and passes the trip point, the automatic control is activated. The fan could be modulated according to the cpu temperature as what it should be.

The way to activate the fan manually is what is mentioned by Rui Zhang in one reply

grep . /sys/class/thermal/*/*
echo 0 > /sys/class/thermal/cooling_device4/cur_state
echo 0 > /sys/class/thermal/cooling_device5/cur_state

I think it's weird to start the fan by "echo 0" since it commonly means stopping the fan. I should do "echo 0" first to make the fan work at certain speed(running "echo 1 > " at first doesn't work). 
Then all commands seem to work correctly as "echo 0" for stopping and "echo 1" for start.

So my fan could work. I only need to start it manually so that automatic control could be started by itself in the certain condition. But it's not pleasant.
Why does the fan could be modulated after being activated by what I did? What do you think should I do to make fan be modulated properly itself just after booting? Do you have some ideas?
Comment 29 Zhang Rui 2012-11-28 10:47:31 UTC
Created attachment 87511 [details]
customized DSDT

Please apply the custom DSDT and see if everything works fine.

        PowerResource (PF1, 0x00, 0x0000)
        {
            Method (_STA, 0, NotSerialized)
            {
                If (LOr (FSTA, 0x02))
                {
                    Return (One)
                }
                Else
                {
                    Return (Zero)
                }
            }

            Method (_ON, 0, NotSerialized)
            {
                Store (" ---- FAN1 _ON ----", Debug)
                Or (FSTA, 0x02, FSTA)
                If (LGreaterEqual (WAFF, 0x08))
                {
                    FCTL ()
                }
            }

            Method (_OFF, 0, NotSerialized)
            {
                If (LLessEqual (WAFF, 0x08))
                {
                    Add (WAFF, 0x01, WAFF)
                }

                Store (" ---- FAN1 _OFF ----", Debug)
                And (FSTA, Not (0x02), FSTA)
                FCTL ()
            }
        }

in _STA, we should use LAnd instead of LOr to check the status of a power resource, or else it always return One.
Comment 30 Zhang Rui 2012-12-11 01:45:35 UTC
ping...
Comment 31 Peiding CHEN 2012-12-11 08:48:41 UTC
(In reply to comment #30)
> ping...

I am sorry that I missed the last response. I will try later since I don't have my laptop, I am travelling right now. I will let you know if it works.
Comment 32 Zhang Rui 2013-05-15 07:07:58 UTC
any update?
Comment 33 Peiding CHEN 2013-05-15 09:03:59 UTC
(In reply to comment #32)
> any update?

failed to recompile the kernel with your new hex file, because I can't set the config correctly with the new kernel (I am always updating the kernel hoping the problem be solved in new version), so I gave up. I am running some commands to start fan automatically after booting. I cleaned my laptop so it doesn't bother me too much now.
Comment 34 Zhang Rui 2013-05-15 09:11:37 UTC
(In reply to comment #33)
> (In reply to comment #32)
> > any update?
> 
> failed to recompile the kernel with your new hex file, because I can't set
> the
> config correctly with the new kernel (I am always updating the kernel hoping
> the problem be solved in new version), so I gave up. I am running some
> commands
> to start fan automatically after booting. I cleaned my laptop so it doesn't
> bother me too much now.

I will close this bug if you do not want to continue debugging it.
of course you can re-open it again once the problem bothers you again, with the latest Linux upstream kernel. does this sound okay to you?
Comment 35 Peiding CHEN 2013-05-15 09:20:28 UTC
(In reply to comment #34)
> (In reply to comment #33)
> > (In reply to comment #32)
> > > any update?
> > 
> > failed to recompile the kernel with your new hex file, because I can't set
> the
> > config correctly with the new kernel (I am always updating the kernel
> hoping
> > the problem be solved in new version), so I gave up. I am running some
> commands
> > to start fan automatically after booting. I cleaned my laptop so it doesn't
> > bother me too much now.
> 
> I will close this bug if you do not want to continue debugging it.
> of course you can re-open it again once the problem bothers you again, with
> the
> latest Linux upstream kernel. does this sound okay to you?

No problem. Thank you soooooo much for your help.
Comment 36 Peiding CHEN 2013-05-15 16:27:31 UTC
I jst(In reply to comment #34)
> (In reply to comment #33)
> > (In reply to comment #32)
> > > any update?
> > 
> > failed to recompile the kernel with your new hex file, because I can't set
> the
> > config correctly with the new kernel (I am always updating the kernel
> hoping
> > the problem be solved in new version), so I gave up. I am running some
> commands
> > to start fan automatically after booting. I cleaned my laptop so it doesn't
> > bother me too much now.
> 
> I will close this bug if you do not want to continue debugging it.
> of course you can re-open it again once the problem bothers you again, with
> the
> latest Linux upstream kernel. does this sound okay to you?

Hi again. Could also send me the .aml file please? As I just find with grub2, there is another way which doesn't need to recompile the kernel. Thanks in advance
Comment 37 Aaron Lu 2013-06-21 08:17:38 UTC
Created attachment 105591 [details]
Customized DSDT in aml format

Modify

Method GTPT
If (And (FSTA, 0x01))
{
    Store (Zero, Local3)
    Increment (Local2)
}
->
If (LAnd (FSTA, 0x01))
{
    Store (Zero, Local3)
    Increment (Local2)
}

Method _STA for all power resources of FAN
       PowerResource (PF0, 0x00, 0x0000)
        {
            Method (_STA, 0, NotSerialized)  // _STA: Status
            {
                If (LOr (FSTA, 0x01))
                {
                    Return (One)
                }
                Else
                {
                    Return (Zero)
                }
            }
        }
->
       PowerResource (PF0, 0x00, 0x0000)
        {
            Method (_STA, 0, NotSerialized)  // _STA: Status
            {
                If (LAnd (FSTA, 0x01))
                {
                    Return (One)
                }
                Else
                {
                    Return (Zero)
                }
            }
        }

BTW, you can also override DSDT in initrd, please follow the below steps to replace your initrd:
// make a copy of your original initrd. After test, restore it
$ sudo cp /boot/initramfs-xxx.img /boot/initram-xxx.img.orig
// insert the new DSDT table into a new initrd
$ mkdir $HOME/initrd/kernel/firmware/acpi
$ cd $HOME/initrd
// the dsdt.aml is the new DSDT table attached here
$ cp dsdt.aml kernel/firmware/acpi
// generate the new initrd
$ find kernel |cpio -H newc --create > new_initrd
// cat it with the original one
$ cat /boot/initramfs-xxx.img >> new_initrd
Now the new initrd is ready, use it to boot the system. Also, make sure to add
the following kernel command line:
acpi.aml_debug_output=1
Comment 38 Aaron Lu 2013-06-21 08:19:17 UTC
(In reply to comment #37)
> Created an attachment (id=105591) [details]
> Customized DSDT in aml format
> 
> Modify

I mean modified here -
I have done the below changes.

> 
> Method GTPT
> If (And (FSTA, 0x01))
> {
>     Store (Zero, Local3)
>     Increment (Local2)
> }
> ->
> If (LAnd (FSTA, 0x01))
> {
>     Store (Zero, Local3)
>     Increment (Local2)
> }
> 
> Method _STA for all power resources of FAN
>        PowerResource (PF0, 0x00, 0x0000)
>         {
>             Method (_STA, 0, NotSerialized)  // _STA: Status
>             {
>                 If (LOr (FSTA, 0x01))
>                 {
>                     Return (One)
>                 }
>                 Else
>                 {
>                     Return (Zero)
>                 }
>             }
>         }
> ->
>        PowerResource (PF0, 0x00, 0x0000)
>         {
>             Method (_STA, 0, NotSerialized)  // _STA: Status
>             {
>                 If (LAnd (FSTA, 0x01))
>                 {
>                     Return (One)
>                 }
>                 Else
>                 {
>                     Return (Zero)
>                 }
>             }
>         }
Comment 39 Peiding CHEN 2013-06-22 20:10:36 UTC
(In reply to comment #38)
> (In reply to comment #37)
> > Created an attachment (id=105591) [details] [details]
> > Customized DSDT in aml format
> > 
> > Modify
> 
> I mean modified here -
> I have done the below changes.
> 
> > 
> > Method GTPT
> > If (And (FSTA, 0x01))
> > {
> >     Store (Zero, Local3)
> >     Increment (Local2)
> > }
> > ->
> > If (LAnd (FSTA, 0x01))
> > {
> >     Store (Zero, Local3)
> >     Increment (Local2)
> > }
> > 
> > Method _STA for all power resources of FAN
> >        PowerResource (PF0, 0x00, 0x0000)
> >         {
> >             Method (_STA, 0, NotSerialized)  // _STA: Status
> >             {
> >                 If (LOr (FSTA, 0x01))
> >                 {
> >                     Return (One)
> >                 }
> >                 Else
> >                 {
> >                     Return (Zero)
> >                 }
> >             }
> >         }
> > ->
> >        PowerResource (PF0, 0x00, 0x0000)
> >         {
> >             Method (_STA, 0, NotSerialized)  // _STA: Status
> >             {
> >                 If (LAnd (FSTA, 0x01))
> >                 {
> >                     Return (One)
> >                 }
> >                 Else
> >                 {
> >                     Return (Zero)
> >                 }
> >             }
> >         }

Thanks, But I don't use initramfs, I will try grub2 with the aml file.
Comment 40 Aaron Lu 2013-07-01 02:41:42 UTC
Any updates?
Comment 41 Peiding CHEN 2013-07-01 11:33:14 UTC
(In reply to comment #40)
> Any updates?

I tried yesterday loading the customed file "dsdt.aml" under grub2. Fan still can't start automatically after rebooting. Let it pass. Please close this thread as I will soon change the laptop. Hope there won't be the same problem in the next one.
Comment 42 Aaron Lu 2013-07-01 13:03:20 UTC
OK. BTW, it's interesting to know grub can do such things, I'll try it sometime later.
Comment 43 Peiding CHEN 2013-07-01 13:23:32 UTC
(In reply to comment #42)
> OK. BTW, it's interesting to know grub can do such things, I'll try it
> sometime
> later.

grub2 can load customed acpi dsdt.aml without recompiling the kernel
Comment 44 Aaron Lu 2013-07-03 01:09:27 UTC
What info do you need? I suppose you mean this bug can be closed in your comment #41.
Comment 45 Peiding CHEN 2013-07-03 16:26:22 UTC
(In reply to comment #44)
> What info do you need? I suppose you mean this bug can be closed in your
> comment #41.

sorry to change the status
Comment 46 Peiding CHEN 2013-07-03 16:26:55 UTC
(In reply to comment #44)
> What info do you need? I suppose you mean this bug can be closed in your
> comment #41.

sorry not to change the status
Comment 47 Aaron Lu 2013-07-05 00:48:18 UTC
It's OK, I just want to make sure I understand you correctly :-)