View Single Post
Old 05-01-10, 09:52 AM   #53
muddenhed
Creator of oBacklight
 
Join Date: Apr 2010
Posts: 19
Default Re: Linux backlight driver

Now i'm in total bliss, i got the backlight working on my laptop.

Below is how i did and i have attached the script i used to accomplish the FN functionality.

This how-to and the script is based on my system, a Sony VAIO VPCCW1S1E and openSUSE 11.2 but should with minor modification work on other systems & distributions to.

Code:
Get backlight to work on Sony laptops with nVidia GT 230M & nvidia_bl on openSUSE 11.2
--------------------------------------------------------------------------------------

Install DKMS.
-------------
- Download DKMS fom http://linux.dell.com/dkms/, choose the rpm format.

- Install the rpm package by doubleclick on it.

Install nvidia_bl.
------------------
- Download nvidia_bl from http://www.nvnews.net/vbulletin/showthread.php?t=143025.

- Open up a terminal window and enter sudo mode.
  $ sudo -i

- Change to the folder where you unpacked the nvidia_bl.
  # cd /folder/of/nvidia_bl

- Run following command to unpack it into /usr/src folder
  # dkms ldtarball --archive=nvidia_bl-0.xx.tar.gz

- Change folder to /usr/src/nvidia_bl-0.xx where 0.xx is the version number of nvidia_bl
  # cd /usr/src/nvidia_bl-x.xx

- Start editing the nvidia_bl.c file
  # nano nvidia_bl.c

- Find the static struct driver_data nv5x_driver_data section and edit the min & max values.
  static struct driver_data nv5x_driver_data = {
	.bar           = 0,
	.reg_offset    = NV5X_PDISPLAY_OFFSET + NV5X_PDISPLAY_SOR0_BRIGHTNESS,
	.reg_size      = 4,
	.off           = 0,
	.min           = 7000,
	.max           = 2500000,

- Now find the static DEFINE_PCI_DEVICE_TABLE(nvidia_bl_device_table) and add the GT 230M chipset.
  static DEFINE_PCI_DEVICE_TABLE(nvidia_bl_device_table) = {
  /* NVIDIA Geforce 230M */
	{ PCI_VDEVICE(NVIDIA, 0x0A2A), (kernel_ulong_t)&nv5x_driver_data },

- Save nvidia_bl.c

- Time to build and install. Match 0.xx with correct version of nvidia_bl. The ldtarball command above did some prep work and we need to unload them to.
  # dkms remove -m nvidia_bl -v 0.xx --all
  # dkms add build install -m nvidia_bl -v 0.xx

- Now we need to add nvidia_bl to module startup. Edit the /etc/sysconfig/kernel file and modify MODULE_LOADED_ON_BOOT row to have nvidia_bl included & save it.
  # nano /etc/sysconfig/kernel
  MODULES_LOADED_ON_BOOT="nvidia_bl"

- Reboot your machine and check so that the nvidia_bl got loaded during startup. Open up a terminal window.
  $ lsmod | grep nvidia_bl
  Should produce an output like this.
  nvidia_bl               9792  0

- To test it do the following and you should see a change of brightness on your display.
  $ sudo echo 3 | sudo tee -a /sys/class/backlight/nvidia_backlight/brightness

Now you should be able to change your backlight.
If you spot any errors in the how to please let me know so i can correct them.

Last edited by muddenhed; 06-23-10 at 04:55 AM. Reason: Added better min & max values
muddenhed is offline   Reply With Quote