# Dell inspiron 8200 nvidia APM

## Paulten

Hello!

I have a Dell Inspiron 8200 with a Geforce440 card.

I just resently installed Gentoo, I used debian before! 

I love gentoo, but I can't get my laptop to suspend! I followed some of the howto's on linux-laptop.net. 

It worked perfectly in debian, and it works sometimes here in Gentoo.

I installed the Nvidia drivers by downloading Version: 1.0-4363 of the tar.gz files.

I have to use the tar.gz files because I need to modify the nv.c to disable AGP and get APM working..

So after editing nv.c to return 0 like this : 

        case PM_SUSPEND:

            nv_printf(NV_DBG_INFO, "NVRM: received PM suspend event\n");

            rm_power_management(NV_STATE_PTR(lnv), 0, rqst);

            break;

#endif              

        default:

            nv_printf(NV_DBG_INFO, "NVRM: received unknown PM event: 0x%x\n", rqst);

            return 0;           # <---- This is what I changed!!

    }           

    return 0;   

}               

#endif

I compiled with make, added nvidia to modules.autoload and added Option      "NvAGP" "0" in my XF86Config-4 file.

This is what I did in debian.

When I suspend my laptop it turns itself off, as if everything was normal. But when I start it I see the X flash but then it turns black, and freeze.

Thanks!

Paul

----------

## djglass

I use a Dell Inspiron 4000 w/ a Rage 128 Mobility card, and have had the same problem going on six months.  Unfortunately, the only workaround I found is to actually end my X session and drop into the shell.  Then I close the lid and it works like a charm.

Not much help I know, but at least you don't have to boot everytime!

If you find a better solution, please post it.

thanks.

----------

## Paulten

There has to be a solution, it worked in debian! I'll be sure to post it when I find out  :Smile: 

Paul

----------

## mkremers

I have a Dell Inspiron 8100 with a Geforce2 go and have the same problem but only when using the nvidia drivers  that are newer than version 3123. When using the 3123 drivers (and altering the nv.c) suspend and resume works perfectly.

You could try to use the 3123 driver.

----------

## Paulten

Hey, thanks for the tip! I tried to compile the 3123 nvidia driver but I get a error :

Here is the make output :: 

[laptop!!#] make                                      [/home/paul/apps/NVIDIA_kernel-1.0-4191]

echo \#define NV_COMPILER \"`cc -v 2>&1 | tail -1`\" > nv_compiler.h

cc -c -Wall -Wimplicit -Wreturn-type -Wswitch -Wformat -Wchar-subscripts -Wparentheses -Wpointer-arith -Wcast-qual -Wno-multichar  -O -MD -D__KERNEL__ -DMODULE -D_LOOSE_KERNEL_NAMES -DNTRM -D_GNU_SOURCE -D_LOOSE_KERNEL_NAMES -D__KERNEL__ -DMODULE  -DNV_MAJOR_VERSION=1 -DNV_MINOR_VERSION=0 -DNV_PATCHLEVEL=4191  -DNV_UNIX   -DNV_LINUX   -DNV_INT64_OK   -DNVCPU_X86       -I. -I/lib/modules/2.4.20-gentoo-r5/build/include -Wno-cast-qual nv.c

nv.c: In function `nv_get_phys_address':

nv.c:2250: warning: implicit declaration of function `pte_offset'

nv.c:2250: invalid type argument of `unary *'

make: *** [nv.o] Error 1

Any tip? 

I'm running 2.4.20-gentoo-r5 kernel , and gcc 3.2.3.

Thanks

Paul

----------

## mkremers

Not sure about the compile error. Why not use the ebuild, that's what i did.

First try to install the driver without changing it (to see if it works)

```
emerge /usr/portage/media-video/nvidia-kernel/nvidia-kernel-1.0.3123-r2.ebuild /usr/portage/media-video/nvidia-glx/nvidia-glx-1.0.3123.ebuild
```

If those drivers work then try the changes to fix suspend. 

```
# cd /usr/portage/distfiles

# mv NVIDIA-kernel-1.0-3123.tar.gz NVIDIA-kernel-1.0-old.tar.gz

# tar xvfz NVIDIA-kernel-1.0-old.tar.gz

# nano -w NVIDIA-kernel-1.0-3123/nv.c

-Search for the words 'avoiding suspend'

-For the case statements PM_SUSPEND and default change the lines return 1 to return 0. 

-Make sure you keep the same amount of characters in the file, so just replace 1 with 0.

# tar cvfz NVIDIA-kernel-1.0-3123.tar.gz NVIDIA-kernel-1.0-3123/

# cd /usr/portage/media-video/nvidia-kernel/

# ebuild nvidia-kernel-1.0.3123.ebuild digest

# emerge nvidia-kernel-1.0.3123.ebuild

```

Please post your results, good luck!

----------

## Paulten

Thanks for the quick reply.

This did not either  :Sad: 

Same error using the first command you wrote.

src/linux/include -Wno-cast-qual nv.c

nv.c: In function `nv_get_phys_address':

nv.c:2305: warning: implicit declaration of function `pte_offset'

nv.c:2305: invalid type argument of `unary *'

make: *** [nv.o] Error 1

!!! ERROR: media-video/nvidia-kernel-1.0.3123-r2 failed.

!!! Function src_compile, Line 75, Exitcode 2

!!! (no error message)

by the way, I get a warning when trying to make the Nvidia_kernel.

You appear to be compiling the NVdriver kernel module with 

a compiler different from the one that was used to compile 

the running kernel. This may be perfectly fine, but there  

are cases where this can lead to unexpected behaviour and  

system crashes.                                            

If you know what you are doing and want to override this   

check, you can do so by setting IGNORE_CC_MISMATCH.        

In any other case, set the CC environment variable to the  

name of the compiler that was used to compile the kernel.  

*** Failed cc sanity check. Bailing out! ***

make: *** [gcc-check] Error 1

I fix it by setting ignore_cc_mismatch to 1. 

Could the compile error be something with my kernel??

Thanks

----------

## mkremers

 *Quote:*   

> Could the compile error be something with my kernel?? 

 

Well I also think this error has something to do with your kernel, you may want to re-emerge your kernel (no need to re-compile it) to make sure all include files are ok.

I also have 2.4.20-gentoo-r5 kernel but i have gcc 3.2.2. I do not think that would make a difference.

Another thing you can try is to remove the CFLAGS declaration from your /etc/make.conf file for this compile.

----------

## Paulten

Hello.

I finally got it working now. I had to patch the NVIDIA_kernel.

I found the patch at :: http://www.minion.de/

patch -p1 <NVIDIA_kernel-version.diff

ln -s Makefile.kbuild Makefile

Make

Now it works perfect  :Smile: 

Thank you for the tip about using the 3123 kernel file.

By the way, does your volume keys work? 

Paul

----------

## atac

 *djglass wrote:*   

> I use a Dell Inspiron 4000 w/ a Rage 128 Mobility card, and have had the same problem going on six months.  Unfortunately, the only workaround I found is to actually end my X session and drop into the shell.  Then I close the lid and it works like a charm.
> 
> Not much help I know, but at least you don't have to boot everytime!
> 
> If you find a better solution, please post it.
> ...

 

you don't have to end the x-session, just switch to the console and then close the lid, workes for me.

haven't tried to solve this problem since i'm not in need of suspending.

----------

## opello

I've stumbled across this while getting Gentoo working on my Inspiron 8200 ...

I'm using Fluxbox as my window manager, when I close the lid the resolution changes, and when I use the battery key or the setup key, I get into the bios, but when I hit escape to get out it blanks and freezes.

I get the "normal" freeze effect then I drop to a concole from within the window manager (ctrl+alt+f2 for example) and then close the lid, or hit FN+D (blanks the screen) but the FN+D works if I ihaven't started X.

As for trying the 3123 driver, I get:

```
nv.c: In function `nv_get_phys_address':

nv.c:2305: warning: implicit declaration of function `pte_offset'

nv.c:2305: invalid type argument of `unary *'

make: *** [nv.o] Error 1

!!! ERROR: media-video/nvidia-kernel-1.0.3123-r2 failed.

!!! Function src_compile, Line 75, Exitcode 2

!!! (no error message)
```

also ... I have no idea how to set the IGNORE_CC_MATCH (I tried just setting an environment variable).  I ran the emerge, never applied the patch to nv.c manually ... because I couldn't emerge.

Anything you can suggest for that error?  Oh, and I never set an NvAGP in XF86Config...

----------

## Paulten

Dammit.. Now it dosen't work again, it just worked the first two times. 

I can't sleep at night, I have to get this fixed!

I think I'll try to compile a new kernel.

opello I got the same error as you did, if you read three posts up you can see what I did to fix it. (patching the NVIDIA_kernel)

export IGNORE_CC_MISMATCH=1 does the trick.

Now when I close the lid the computer turns it self off. When I open it, it turns itself on and tries to start up, and then it turns it self off. When I push my power button it again tries to restore suspend, but freezes.  :Sad: 

I really need to get this working

----------

## Paulten

Well finaly, I got it working now. Really working now  :Smile: 

After I compiled a new 2.4.21 kernel, patched the Nvidia driver and changed the settings in the nv.c (3123 driver) it now works.

Other who might have problem with APM + nvidia, send me a mail and I will send my kernel config and suggestions.

--Paul

----------

## d33d0

 *Paulten wrote:*   

> 
> 
> By the way, does your volume keys work? 
> 
> 

 

Sure:

```

# emerge sys-apps/i8kutils

# emerge media-sound/umix

```

add this to /etc/conf.d/local.start:

```

i8kbuttons -u "umix vol 5+" -d "umix vol 5-"

```

----------

## Ant

Thanks for the volume key tips.

Just for the record, I use alsa, so I put

```

i8kbuttons -u "amixer -q sset "Master" 1+" -d "amixer -q sset "Master" 1-"

```

in my /etc/conf.d/local.start

Ant.

----------

## Paulten

Great!

I love i8kutils.

I also fixed my play stop next back buttons.

Using xmodmap.

xmodmap -e "keycode 129 = F13"

xmodmap -e "keycode 130 = F14"

xmodmap -e "keycode 131 = F15"

xmodmap -e "keycode 132 = F16"

Here is whats annoying me. In kmenuedit I made a new Item and called it Xmmsnext, with command xmms -f

And it works but when I push next KDE tries to lanch a application, so the xmms -f lies on the taskbar for about 5 sec before it closes. 

Does anyone have a tip how to fix this?

I tried to make xmms -f in a script, but the same happens.

This does not happen when I type it in my console.

--Paul

----------

## Paulten

One more thing, when I added i8kbuttons -u "umix vol 5+" -d "umix vol 5-" in the local.start gentoo would not start at all. Hanged in init 5 somewhere.

I wrote it like this and it works fine : i8kbuttons -u "umix vol 5+" -d "umix vol 5-" 1>/dev/null &

The topic of the file explains it, I just diden't notice it.  :Sad: 

--Paul

----------

## Jimbow

 *Paulten wrote:*   

>  ... it works but when I push next KDE tries to lanch a application, so the xmms -f lies on the taskbar for about 5 sec before it closes. 
> 
> Does anyone have a tip how to fix this?
> 
> I tried to make xmms -f in a script, but the same happens.
> ...

 

I use Karamba which comes with a transparent xmms player that resides on the KDE desktop.

Also, I use xmodmap to convert the caps-lock key into a control key and to convert the right alt and ctrl keys into page-up and page-down (which brings them to the front of the keyboard): 

```
keycode 66 = Control_L

clear Lock

add Control = Control_L

keycode 109 = Next

keycode 113 = Prior
```

----------

## Paulten

Okay, thanks for the reply.

Can you set the volume keys in the karamba theme or do you just use that instead of the spesial buttons?

--Paul  :Smile: 

----------

## Jimbow

Here is the xmms player as I use it: 

```
KARAMBA  X=10 Y=10 W=512 H=50 INTERVAL=1000

#XMMS

<GROUP> X=3 Y=0

  TEXT X=0 Y=0 SENSOR=XMMS COLOR=240,240,240 BGCOLOR=60,60,60 FONTSIZE=10 FORMAT="%title"

  TEXT X=10 Y=31 SENSOR=XMMS COLOR=240,240,240 BGCOLOR=60,60,60 FONTSIZE=8 FORMAT="%remain"

  <GROUP> X=72 Y=34

    #PROGRESS BAR

    <GROUP> X=0 Y=0

      BAR  X=0 Y=0 SENSOR=XMMS FORMAT="%full" PATH="pics/xmms_bar_background.png"

      BAR  X=0 Y=0 SENSOR=XMMS FORMAT="%ms" PATH="pics/xmms_bar.png"

      CLICKAREA X=0 Y=0 W=150 H=13 ONCLICK="xmmsctrl time -20"

      CLICKAREA X=150 Y=0 W=150 H=13 ONCLICK="xmmsctrl time +20"

    </GROUP>

    #BUTTONS

    <GROUP> X=310 Y=0

      IMAGE X=0 Y=0 PATH="pics/xmms_buttons_dimmed.png"

      BAR X=0 Y=0 SENSOR=XMMS FORMAT="%full" PATH="pics/xmms_buttons.png"

      CLICKAREA X=0 Y=0 W=20 H=13 ONCLICK="xmms --rew"

      CLICKAREA X=20 Y=0 W=20 H=13 ONCLICK="xmms --play"

      CLICKAREA X=40 Y=0 W=20 H=13 ONCLICK="xmms --pause"

      CLICKAREA X=60 Y=0 W=20 H=13 ONCLICK="xmms --stop"

      CLICKAREA X=80 Y=0 W=20 H=13 ONCLICK="xmms --fwd"

    </GROUP>

  </GROUP>

</GROUP>
```

I made a few cosmetic changes to the xmms player that was distributed with Karamba (or a set of Karamba themes).

----------

## opello

great tip on the extra buttons and xmodmap (another thing for my local.start  :Smile: 

still no luck getting the 3123 drivers working ... or closing the lid ... i'm about to try apm to suspend to ram ... maybe that'll work  :Smile: 

update: apm --standby locks everything up, apm --suspend doesn't do anything  :Smile:  ....

----------

## Paulten

You can't compile the 3123 driver? What kernel are you running? What's the error? What about your kernel configuration? 

Paul

----------

## opello

kernel: gentoo  2.4.20-r2

error:

 *emerge wrote:*   

> inspiron /usr/portage/media-video/nvidia-kernel # emerge nvidia-kernel-1.0.3123-r2.ebuild
> 
> Calculating dependencies ...done!
> 
> >>> emerge (1 of 1) media-video/nvidia-kernel-1.0.3123-r2 to /
> ...

 

and my kernel config can be found here

----------

## Paulten

Here is what I got in my kernel config under APM : 

CONFIG_APM=y

# CONFIG_APM_IGNORE_USER_SUSPEND is not set

# CONFIG_APM_DO_ENABLE is not set

CONFIG_APM_CPU_IDLE=y

CONFIG_APM_DISPLAY_BLANK=y

# CONFIG_APM_RTC_IS_GMT is not set

CONFIG_APM_ALLOW_INTS=y

CONFIG_APM_REAL_MODE_POWER_OFF=y

I got the same error compiling nvidia-kernel under gs-2.4.20. I am using vanilla now. 

Actually I still get that error using emerge to install it, maybe gentoo put some patches in it or something. So try to download it from nvidia.com and installing it. 

If that does not work, try patching it.

How and where to patch it, look at a previous post where I explained it.

Good luck.

--Paul

----------

## opello

well i've reconfigured my kernel to include nfsv3 client as well as the changes you posted.  downloaded the drivers from nvidia, made the 2 changes (return 0) to the nv.c file, make install'd nvidia-kernel and nvidia-glx, and still can't suspend as far as i know

close the lid and the font skews (switching to text console then back to alt+f7 fixes it)

dunno about suspending, but apm -s or apm -S (one or the other crashes the system, the other just returns and doesn't do anything).

kernel 2.4.20, using 3123 drivers from nvidia.com ... and the patch that you sent the site for applied without errors

----------

## Paulten

```
kernel 2.4.20, using 3123 drivers from nvidia.com ... and the patch that you sent the site for applied without errors
```

Did you try to compile the nvidia driver from nvidia.com without the minion patch? Did it fail?

apm --suspend works if you enter a new tty? 

Paul

----------

## Jimbow

I recently got suspend to work on my i8200.   Brief instructions on what I did are in  This message.

Suspend works great as long as I don't try to close the lid.   Go figure.   

The clock drift problem is now fixed too.   I've stopped running ntpd a few days ago so I could see how the clock does on its own.   I just checked and I am now 3 seconds ahead.

If anyone knows how to get an i8200 to totally ignore screen closing/opening PLMK.

One more thing.   In a recent Apache thread they explained a way of stopping emerge from trying to update apache-1.xxxx to apache-2.xxxx.   This technique could probably be used instead of the inject I describe in the message linked to above.   For the nvidia drivers you would put the following two lines in /etc/portage/package.mask: 

```
<=nvidia-kernel-1.0.3123-r2

<=nvidia-glx-1.0.3123
```

----------

## Paulten

And yes, do you have nvAGP "0" in your XF86Config-4 ? 

--Paul

----------

## opello

emerge of the 3123 drivers failed, manual compile succeded, nvagp is 0 in my XF86Config

closing the lid changes the xserver size to that of the concole (proved by framebuffering to 0x31A and the chaging the xserver's resolution to 1280x1024 (looks ugly) but closing the lid works) -- trying the 838 vga line in a bit so i can run x at 'normal' size  :Very Happy: 

Jimbow was using the NVdriver but mine compiles as nvidia (nvidia.o) so i dunno if that's a discrepancy but my apm --suspend (from a tty or an eterm) works perfectly, the screen gets kinda distorted when in x doing it, but it comes back fine.

using the gs-sources now as i saw somewhere else ... i dunno if that makes a difference either, but that got my framebuffer working (although i think it was just a wrong setting of mine somewhere)

will post back on the 1600x1200 framefuffer (just edit this msg)

EDIT:  yup it works great, framebuffered console has to be the same size as the x server (same resolution that is) otherwise it distorts (for me anyway)

----------

## Jimbow

 *Paulten wrote:*   

> And yes, do you have nvAGP "0" in your XF86Config-4 ? 

 

Yes I do.

----------

## Jimbow

I just installed the new 4496 nvidia driver.  It not only works like a champ, it not only suspends via "apm -s", it also suspends with :

```
Option          "NvAGP"         "1"
```

My gosh, now I'm running out of things to complain about.

----------

## Paulten

what?  :Smile: 

emerge nvidia-kernel then APM works? 

kernel 2.4 still?

cool!

----------

## Paulten

Has anyone got a working 2.6 kernel with APM or ACPI support? 

I tried 2.6 with APM and nvidia 3123 . My computer just freezed when I closed the lid. 

Did not try that much but if anyone can tell me how to use ACPI instead of APM that would be great. My computer is a Dell 8200.

Thanks

----------

## krazo

The newest Nvidia drivers have preliminary support for APM.

Has anyone tried ACPI in 2.6, or rather the suspend to ram function? It suspends fine, and seems to resume fine but the LCD does not come back on, even though I can type and the HD will churn, so I must reboot afterward.

----------

## opello

yeah that's the problem i had (you can sorta see the text on the lcd, if you look close and tip it toward the light just right)

no fix yet afaik, so i'm using 2.4.22-gss_pre2 and APM with 3123 + manual patch (hey, it works  :Smile: )

----------

## BitJam

 *opello wrote:*   

> no fix yet afaik, so i'm using 2.4.22-gss_pre2 and APM with 3123 + manual patch (hey, it works )

 

I'm using 2.4.22-gss_pre2 and APM with the 4496 drivers (no patches) and the A10 BIOS.   Suspend works (via apm -s) and the clock actually keeps the correct time without ntp.

----------

## opello

yeah old drivers and the clock works too - once the new drivers are out of mask i'll likely update

----------

## Paulten

Has anyone tried 2.6 with APM and nvidia driver? how is it? 

Does ACPI work with my 8200? 

Regards Paul

----------

## opello

well i had acpi working under 2.4, but no suspend (so I went back to apm, the only cool thing that acpi had was the ability to throttle the cpu / fans to the preset modes)

so i would think that acpi works, but it's worth a try  :Smile:  as for 2.6, I haven't had time to play with that yet, post your results please if you do

----------

## BitJam

What he said.

----------

## BitJam

What he said.

----------

## kosan

I see that this thread has been inactive for a little over a month but i wanted to go ahead and add something. 

    I have an inspiron 8200 running 2.6.0_beta6 kernel with using APM (i was using APCI but it tells me that my battery is at 111% when it is fully charged... anyone know what's up with this?) 

   Any way when i first was running the 2.6 kernel apmd wouldn't compile but with the beta6 kernel now it does and after reading this post i tried "apm -s" to see what would happen and it works like a charm. 

  I have done absolutely no tweaking to nvidia or anything. I have the latest nvidia kernel installed, have apm enabled and have the bios set not to suspend when i close the lid, instead it just blanks the screen. But now suspend is fully working. Now all i have to do is change it to run apm-s when i close the lid. 

  I know i saw a thread explaining how to do that before but if anyone wants to post the info before i find it that would be great.

   If anyone needs any specifics on how i have my system set up let me know and i will post more info.

-chris

----------

## BitJam

 *kosan wrote:*   

>    If anyone needs any specifics on how i have my system set up let me know and i will post more info.

 

Please post more info.  I'd love to upgrade to 2.6 but I've been waiting because there are often weird laptop issues that I didn't want to contend with.

----------

## kosan

Well if you need to know how something specific is set up then tell me what you want to know about. As for the general using of 2.6 kernel i have had far more possitive experiences with it than negative. 

  Volume buttons work fine with i8kutils, the multimedia buttons are a little messed up, i had to edit the atkbd.c before recompiling the kernel so that the buttons would map properly but i have changed another thing so they don't seem to be working right now, but i don't use xmms enough right now that it bothers me. The only other thing that i have had a problem with is pcmcia since the pcmcia stuff is still really set up for 2.4 kernel, however i haven't tried since the 2.6_beta4 kernel so it may be working better now. Other than that everything with 2.6 works really well on the laptop so far. I did a fresh install and never even compiled the 2.4 kernel and the only problems i have had are the ones listed.

  Like i said if you need something specific i can post specific configurations.

-chris

----------

