Installing Slackware 13.37 on a ThinkPad W520

From ThinkWiki
Revision as of 02:13, 22 July 2011 by Dimm0k (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Installation

Slackware 13.37 64-bit installed like a breeze on a hot, humid day! For the most part all of the essentials to get the system up and running on the W520 was detected and put into play with little or no intervention or editing of files on my end. Kernel 2.6.37.6 was supplied with Slackware 13.37 so I compiled and installed 2.6.39.2 using the .config file from the testing/source/linux-2.6.39-rc4-configs/ directory on the Slackware install DVD. Made some minor changes to the config as follows:

NOTE!
Sections with -[ ] were removed.
  • Processor type and features
    • Preemption Model > Preemptible Kernel
  • Networking support
    • -[Amateur Radio support]
    • -[CAN bus subsystem support]
    • -[IrDA (infrared) subsystem support
    • -[WiMAX Wireless Broadband support]
  • Device Drivers
    • -[Parallel port support]
    • -[Fusion MPT device support]
    • -[I2O device support]
    • -[Macintosh device drivers]
      • Network device support
        • -[ARCnet support]
        • -[Token Ring driver support]
        • -[ATM drivers]
        • -[FDDI driver support]
        • -[HIPPI driver support]
        • -[ISDN support]
    • -[Dallas's 1-wire support]
      • Multimedia support
        • -[Remote Controller adapters]
        • -[Radio Adapters]

Video

Coming from a W510, the W520 introduced me to the concepts of discrete and integrated graphics, as well as NVIDIA's Optimus technology. Unfortunately because of NVIDIA's unwillingness to bring Optimus support to Linux, you have three choices. You can use the integrated Intel HD graphics, NVIDIA's discrete graphics, or look into the bumblebee project here. I went with the NVIDIA discrete graphics route with plans to try out the bumblebee project at a later time. Make sure to specifically set your graphics option in the BIOS to discrete, otherwise Slackware/Linux will select integrated.

Instead of the open source nouveau driver, which is limited to 2D graphics I went with NVIDIA's binary, version 275.09.07. Used xf86-video-nouveau-blacklist-noarch-1.txz in the extra/ directory on the Slackware install DVD to blacklist the loading of the nouveau driver, which causes conflicts with NVIDIA's binary. With X.Org's X Server 1.9.5 in Slackware, xorg.conf is pretty bare these days as detection is done pretty smoothly at start. Using NVIDIA's installer to create a default xorg.conf, the only things I edited were

Section "Device"

   Identifier     "Device0"
   Driver         "nvidia"
   VendorName     "NVIDIA Corporation"
   BoardName      "Quadro 2000M"
   Option         "RenderAccel"       "true"
   Option         "AddARGBGLXVisuals" "true"
   Option         "HWCursor"          "yes"
   Option         "CursorShadow"      "yes"
   Option         "RegistryDwords"    "EnableBrightnessControl=1"

EndSection


The Option "RegistryDwords" "EnableBrightnessControl=1" line allows you to change the brightness of the notebook's LCD via the Fn-HOME and Fn-END key combinations.


Section "Screen"

   Identifier     "Screen0"
   Device         "Device0"
   Monitor        "Monitor0"
   DefaultDepth    24
   Option         "TwinView"                  "1"
   Option         "DynamicTwinView"           "True"
   Option         "TwinViewXineramaInfoOrder" "DFP-1"
   Option         "MetaModes" "DFP-1: 1920x1200_60 +0+0, DFP-0: NULL, CRT: NULL; DFP-0: 1920x1080_60 +0+0, DFP-1: NULL, CRT: NULL;"
   SubSection     "Display"
       Depth       24
   EndSubSection

EndSection


Here I set up the 2 MetaModes:

  • notebook LCD off, external LCD on, VGA off
  • notebook LCD on, external LCD off, VGA off


NOTE!
By setting CRT-0: NULL, you can save some battery by turning off the VGA port.


The thinkpad_acpi module reports the wrong number for the LCD brightness level. On mine, issuing cat sys/class/backlight/acpi_video0/max_brightness shows 15 regardless of what I change it to. Because of this the LCD’s brightness always gets set to 15 when resuming from hibernation so we add a options thinkpad_acpi brightness_mode=2 to /etc/modprobe.d/w520.conf fix. You can also disable it altogether and use ACPI with options thinkpad_acpi brightness_enable=0.

Audio

Because I mainly use this notebook at home, I have an external LCD capable of HDMI video and audio attached via a DisplayPort to HDMI cable that allows me to not only display video, but also audio. To enable the HDMI audio, I needed to add the following to /etc/modprobe.d/w520.conf

options snd-hda-intel enable_msi=0 probe_mask=0xffff,0xfff2

Issue the command aplay -l in a console and it should hopefully list the sound devices you have on your system. For me it listed one for the sound device that controls the Lenovo speakers and a bunch for nVidia's HDMI interface. I do not have my machine in front of me now, but it was similar to this:

 **** List of PLAYBACK Hardware Devices ****
 card 0: PCH [HDA Intel PCH], device 0: CONEXANT Analog [CONEXANT Analog]
   Subdevices: 0/1
   Subdevice #0: subdevice #0
 card 1: NVidia [HDA NVidia], device 3: NVIDIA HDMI [NVIDIA HDMI]
   Subdevices: 1/1
   Subdevice #0: subdevice #0
 card 1: NVidia [HDA NVidia], device 7: NVIDIA HDMI [NVIDIA HDMI]
   Subdevices: 1/1
   Subdevice #0: subdevice #0
 card 1: NVidia [HDA NVidia], device 8: NVIDIA HDMI [NVIDIA HDMI]
   Subdevices: 1/1
   Subdevice #0: subdevice #0
 card 1: NVidia [HDA NVidia], device 9: NVIDIA HDMI [NVIDIA HDMI]
   Subdevices: 1/1
   Subdevice #0: subdevice #0

In the above you can see that the HDMI device is seen as card 1 so the above probe_mask is appropriate. If you have card number 0, remove the extra 0xffff so probe_mask=0xfff2 would be more appropriate. If it was card number 2, add two 0xffff like probe_mask=0xffff,0xffff,0xfff2. After putting this in w520.conf and reloading the snd_hda_intel module, aplay -l should list only one nVidia card. On mine it looks like this:

 **** List of PLAYBACK Hardware Devices ****
 card 0: PCH [HDA Intel PCH], device 0: CONEXANT Analog [CONEXANT Analog]
   Subdevices: 0/1
   Subdevice #0: subdevice #0
 card 1: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
   Subdevices: 0/1
   Subdevice #0: subdevice #0

To actually allow audio to play over HDMI and the analog headphone jack, you need to edit asoundrc. Either /etc/asoundrc or ~/.asoundrc should work. I went with the latter and used ALSA's dmix to do the magic.

 # ~/.asoundrc or /etc/asound.conf
 # ALSA configuration file from http://forum.xbmc.org/showpost.php?p=513810&postcount=4
 
 ##### USAGE #####
 # Save this file as "~/.asoundrc" (for user-specific sound configuration) or
 # "/etc/asound.conf" (for system-wide sound configuration) and specify ALSA
 # device names ad described in the next section.
 
 
 ##### DEVICE NAMES #####
 # This configuration file defines four devices for use by the user.  Those
 # devices are "analog", "mixed-analog", "digital", and "mixed-digital".  The
 # user may also re-define "default" to be identical to one of the above-named
 # devices (i.e. to send all sound output to the digital output unless otherwise
 # specified).  Use the device names as described below:
 #  - "analog" outputs to the analog output directly and (at least on software
 #  sound cards) blocks other audio output.  After playback completes, "queued"
 #  sounds are output in sequence.
 #  - "mixed-analog" mixes audio output from multiple programs into the analog
 #  output (so you can hear beeps, alerts, and other noises while playing back
 #  an audio stream).
 #  - "digital" outputs to the digital output directly.  Since most (all?)
 #  digital outputs expect 48kHz PCM audio, this may not work for some playback
 #  (i.e. CD's--which are 44.1kHz PCM audio--or 32kHz audio streams from TV
 #  recordings, etc.).
 #  - "mixed-digital"
 
 # All other devices created within this file are used only by the configuration
 # file itself and should /not/ be used directly.  In other words, do not use
 # the devices "analog-hw", "dmix-analog", "digital-hw", or "dmix-digital".
 
 
 ##### IMPORTANT #####
 # To make this ALSA configuration file work with your sound card, you will need
 # to define the appropriate card and device information for the "analog-hw" and
 # "digital-hw" devices below.  You can find the card and device information
 # using "aplay -l".
 
 # Alias for (converted) analog output on the card
 # - This is identical to the device named "default"--which always exists and
 # refers to hw:0,0 (unless overridden)
 # - Therefore, we can specify "hw:0,0", "default", or "analog" to access analog
 # output on the card
 # - Note that as of ALSA 1.0.9, "software" sound card definitions redefine
 # "default" to do mixing, meaning this device is different from "default" and
 # allows playback while blocking other sound sources (until playback
 # completes).
 pcm.analog {
   type plug
   slave.pcm "analog-hw"
   hint {
     show on
     description "Analog Output - Use analog outputs, converting samples, format, and rate as necessary."
   }
 }
 
 # Control device (mixer, etc.) for the card
 ctl.analog {
   type hw
   card 0
   device 0
 }
 
 # Alias for (converted) mixed analog output on the card
 # - This will accept audio input--regardless of rate--and convert to the rate
 # required for the dmix plugin (in this case 48000Hz)
 # - Note that as of ALSA 1.0.9, "software" sound card definitions redefine
 # "default" to do mixing, meaning this device is identical to "default" for
 # "software" sound cards.
 pcm.mixed-analog {
   type plug
   slave.pcm "dmix-analog"
   hint {
     show on
     description "Mixed Analog Output - Use analog outputs, converting samples, format, and rate as necessary. Allows mixing with system sounds."
   }
 }
 
 # Control device (mixer, etc.) for the card
 ctl.mixed-analog {
   type hw
   card 0
   device 0
 }
 
 # Alias for (converted) digital (HDMI) output on the card
 pcm.digital {
   type plug
   slave.pcm "digital-hw"
   hint {
     show on
     description "Digital Output - Use digital outputs, converting samples, format, and rate as necessary."
   }
 }
 
 # Control device (mixer, etc.) for the card
 ctl.digital {
   type hw
   card 1
   device 3
 }
 
 # Alias for mixed (converted) digital (HDMI) output on the card
 
 pcm.mixed-digital {
   type plug
   slave.pcm "dmix-digital"
   hint {
     show on
     description "Mixed Digital Output - Use digital outputs, converting samples, format, and rate as necessary. Allows mixing with system sounds."
   }
 }
 
 # Control device (mixer, etc.) for the card
 ctl.mixed-digital {
   type hw
   card 1
   device 3
 }
 
 # The following devices are not useful by themselves.  They require specific
 # rates, channels, and formats.  Therefore, you probably do not want to use
 # them directly.  Instead use of of the devices defined above.
 
 # Alias for analog output on the card
 # Do not use this directly--it requires specific rate, channels, and format
 pcm.analog-hw {
   type hw
   card 0
   device 0
 }
 
 # Control device (mixer, etc.) for the card
 ctl.analog-hw {
   type hw
   card 0
   device 0
 }
 
 # Alias for digital (HDMI) output on the card
 # Do not use this directly--it requires specific rate, channels, and format
 pcm.digital-hw {
   type hw
   card 1
   device 3
 }
 
 # Control device (mixer, etc.) for the card
 ctl.digital-hw {
   type hw
   card 1
   device 3
 }
 
 # Direct software mixing plugin for analog output on the card
 # Do not use this directly--it requires specific rate, channels, and format
 pcm.dmix-analog {
   type dmix
   ipc_key 1234
   slave {
     pcm "analog-hw"
     period_time 0
     period_size 1024
 #    buffer_size 4096
     buffer_size 8192
     rate 48000
   }
 }
 
 # Control device (mixer, etc.) for the card
 ctl.dmix-analog {
   type hw
   card 0
   device 0
 }
 
 # Direct software mixing plugin for digital (S/PDIF) output on the card
 # Do not use this directly--it requires specific rate, channels, and format
 pcm.dmix-digital {
   type dmix
   ipc_key 1235
   slave {
     pcm "digital-hw"
     period_time 0
     period_size 1024
 #    buffer_size 4096
     buffer_size 8192
     rate 48000
   }
 }
 
 # Control device (mixer, etc.) for the card
 ctl.dmix-digital {
   type hw
   card 1
   device 3
 }
 
 # Make joint analog/HDMI the default
 pcm.!default {
   type plug
   slave {
     pcm multi
     rate 48000
   }
   ttable.0.0 1.0;
   ttable.1.1 1.0;
   ttable.0.2 1.0;  # front left
   ttable.1.3 1.0;  # front right
   hint {
     show on
     description "Default - output using Mixed Analog AND Mixed Digital"
   }
 }
 
 # Control device (mixer, etc.) for the card
 ctl.!default {
   type hw
   card 0
 }
 
 pcm.multi {
   type multi
   slaves.a.pcm "softvol"
   slaves.a.channels 2
   slaves.b.pcm "dmix-digital"
   slaves.b.channels 2
   bindings.0.slave a;
   bindings.0.channel 0;
   bindings.1.slave a;
   bindings.1.channel 1;
 
   bindings.2.slave b;
   bindings.2.channel 0;
   bindings.3.slave b;
   bindings.3.channel 1;
 }
 
 ctl.multi {
   type hw
   card 0
 }
 
 pcm.softvol {
   type softvol
   slave {
     pcm "dmix-analog"
   }
   control {
     name "Pre-Amp"
     card 0
   }
   min_dB -5.0
   max_dB 10.0
   resolution 6
 }

Networking

The Intel Centrino Ultimate-N 6300 Wi-Fi card and Intel Gigabit Ethernet (10/100/1000) PCI-Express Ethernet card both worked right out of the box.

By default the Wi-Fi indicator flashes whenever there is activity, which I found to be quite annoying and distracting. You can change its behavior so that it will be on steady whenever the radio is powered on and off when the radio is off by adding "options iwlcore led_mode=1" to /etc/modprobe.d/w520.conf. Setting led_mode=0, the default, will cause the indicator to flash whenever there is wireless activity.

Misc notes

  • You can verify that Turbo Boost is working properly by using Intel's powertop or i7z to show the actual CPU state, including Turbo Boost and advanced C-states.
  • You will need to make sure the following modules are loaded: ac, battery, button, coretemp, fan, processor, and thermal for proper ACPI and temperature monitoring.
  • BIOS version was 1.25, which was buggy with Linux in terms of ACPI. I had reverted to 1.22 temporarily to get ACPI working fully, but it looks to be all fixed in 1.26, which is what I am currently running.

W520 --dimm0k 03:13, 22 July 2011 (CEST)