Tuesday, 3 September 2013

Running Linux on ASUS N550JV - Fedora 19

The ASUS N550JV is the latest version of the performance/entertainment notebook N series from ASUS. It features a Haswell quad-core CPU with RAM expandable to 16GB and a replaceable HDD. The star of the show is the Full HD IPS screen, which is top-notch. Also, the entire case is made from aluminium and build quality is close to a MBP.

Linux runs rather well on the unit, but it took me some trial and error in order to get most of the features and components working properly on Fedora 19.

Update: The newest F19 kernel - 3.11.1-200 isn't supported by the bumblebee package and you will get poor battery life unless you manually echo "OFF" to /proc/acpi/bbswitch.

To install the previous version of the kernel from fedora-updates, download the RPMs from koji -
http://koji.fedoraproject.org/koji/buildinfo?buildID=463094

Model: ASUS N550JV CM067H
CPU: Intel i7-4700HQ Haswell Quad-Core (47w)
Discrete Graphics: Nvidia 750M 2GB DDR3
RAM: 1 x 8GB DDR3 1600mhz SODIMM (2 slots total, 1 slot free)
HDD: 1TB 5400rpm HDD (Replaceable)
Display: 15.6" IPS LCD Panel (LP156WF4-SPB1)


ACPI -

The main thing is to run a recent kernel and put acpi_osi="" in the kernel command line in grub. This will fix the backlight brightness and function keys. You may also have to manually load the asus-nb-wmi module in /etc/modules-load.d to ensure that the module load on boot.

Also, remember to take out any other ACPI kernel command line options you may have put in before, such as acpi_backlight as the keys will not work properly if you have those.

Also consider updating the BIOS to 206 as it has proven to be a stable configuration for me and the ACPI keys work consistently.


Optimus/Bumblebee -

To get Optimus/Bumblebee working, you will need to revert a ACPI commit in the kernel 3.8, see these links for more info -

https://bugzilla.kernel.org/show_bug.cgi?id=60561
https://github.com/Bumblebee-Project/bbswitch/issues/65
https://github.com/Bumblebee-Project/bbswitch/issues/446

The patch fixing this issue has been accepted in Linus' tree and appears to be on track for the 3.11 kernel release.

After installing the modified kernel RPM that reverts the change (not necessary when the 3.11 kernel comes out), and then installing the bumblebee RPMS from http://techies.ncsu.edu/wiki/bumblebee, everything works as expected.

Update: The ACPI handle works without patches as of kernel-3.10.10-200.fc19

Update 20131103: There is a problem with the Fedora Xorg which makes bbswitch unable shut off the Nvidia card after using optirun. This is detailed in the following issue ticket -

https://github.com/Bumblebee-Project/Bumblebee/issues/433

To fix this, I had to create  /etc/udev/rules.d/99-drm-bumblebee-fix-issue-433.rules (the file could be any name you want), with the following inside -

SUBSYSTEM=="drm", KERNEL=="card1", RUN+="/bin/rm /dev/dri/card1"


Subwoofer -

There is some information on how to get previous ASUS notebooks with an external subwoofer working under ALSA. However, I've not been able to get the subwoofer to work on the N550JV. If I do have some free time, might have a go at it. It's not a big issue for me, as it is a hassle to carry the subwoofer around, and on the desk I can connect the system to proper audio equipment that sounds much better than with the external subwoofer unit.


Full Disk Encryption -

The really interesting thing about this system is that it allows the user to set the ATA security passwords. When the system is equipped with a Full Disk Encryption supporting SSD or HDD, the FDE support can be completely seemless. You can set both master and user passwords in the UEFI BIOS. I've replaced the original HDD with a 960GB Crucial M500 SSD with ATA security enabled. No problems with this setup so far.


Power Management -

Put the following in /etc/pm/power.d/power (create the file with executable permissions if not present) -

#!/bin/sh

# Shell script to reduce energy consumption when running battery. Place
# it in /etc/pm/power.d/ and give execution rights.

#if on_ac_power; then
# Put specific AC power config here
#else
# Put specific Battery power config here
#fi

# Common Settings

# Enable Laptop-Mode disk writing
echo 5 > /proc/sys/vm/laptop_mode

# NMI watchdog should be turned off
for foo in /proc/sys/kernel/nmi_watchdog;
do echo 0 > $foo;
done

# Set SATA channel to power saving
for foo in /sys/class/scsi_host/host*/link_power_management_policy;
#do echo "min_power" > $foo;
#do echo "medium_power" > $foo;
#do echo "max_performance" > $foo;
done

# Activate USB autosuspend
# Autosuspend for USB device Bluetooth USB Host Controller [Atheros Communications]
echo 'auto' > '/sys/bus/usb/devices/3-5/power/control';
# Autosuspend for USB device Touchscreen [ELAN]
echo 'auto' > '/sys/bus/usb/devices/3-10/power/control';
# Autosuspend for USB device USB2.0-CRW [Generic]
echo 'auto' > '/sys/bus/usb/devices/3-8/power/control';

# Activate PCI autosuspend
for foo in /sys/bus/pci/devices/*/power/control;
do echo auto > $foo;
done

# Activate audio card power saving
echo '1' > '/sys/module/snd_hda_intel/parameters/power_save';

# VM Writeback timeout
echo '1500' > '/proc/sys/vm/dirty_writeback_centisecs';

# Turn off WOL
ethtool -s p3p1 wol d;

The script above will turn on most of the power management setting. However, regarding SATA link power management, some SSDs (and maybe some HDDs as well) do not work well with min_power, and I have corrupted disks with this setting on. Currently, I'm using medium_power and this setting is fine for my M500 SSD so far. However, please do your own tests before turning on the SATA link power management - I left this commented out in the script above for this reason!


SD Card Reader -

Update: It looks that that the kmod-staging driver for the rts5139 loads and detects the a block device, but does not actually detect media. So as of yet, the module isn't actually functional.

The card reader on the N550JV uses the RTS5139 chipset. As the driver for this is in staging, the module is not included in the default Fedora kernel. To fix this install kmod-staging from rpmfusion.org which should install the correct kmod-staging rpm for your current kernel. Be aware that this package sometimes lag behind the Fedora kernel.


Bluetooth -

My N550JV came with an Atheros AR9485 Card that includes also the bluetooth adapter (Atheros AR3012). Older versions of the kernel didn't include the USB ID of the device. See the following link for details -

https://bugzilla.kernel.org/show_bug.cgi?id=60726

I can confirm that this now work on Fedora since kernel 3.10.11.

You may also need to enable bt_coex. To do this, create a new file /etc/modprobe.d/ath9k.conf and put in the file the following -

options ath9k btcoex_enable=1

With the new kernel, bluetooth is now working fine on the system. However, as the Atheros card only support single-band wifi, it may be a good option to upgrade to an Intel card that supports dual-band.