diff --git a/README b/README index 22d63ad..b5b861f 100644 --- a/README +++ b/README @@ -18,6 +18,9 @@ Currently supported: * NF110/NF210/NF310 * N220 * N230 +* N350 +* R470/R420 +* R528/R728 Not tested: @@ -31,7 +34,7 @@ Have a similar problem, but need more information to add it (if you are owner of ## Installation -git clone https://xonatius@github.com/xonatius/samsung-backlight.git +git clone git://github.com/xonatius/samsung-backlight.git cd samsung-backlight make sudo make install diff --git a/samsung-backlight.c b/samsung-backlight.c index 8d16408..eba99f4 100644 --- a/samsung-backlight.c +++ b/samsung-backlight.c @@ -1,6 +1,7 @@ /* * Samsung N130, N220, N230 NC10, Np-Q45, R468/R418, X320/X420/X520, X360, - * R518, R510/P510, R410 and NF110/NF210/NF310 Laptop Backlight driver + * R518, R510/P510, R410, NF110/NF210/NF310, N350, R470/R420, R528/R728 + * Laptop Backlight driver * * Copyright (C) 2011 Peter Savichev (proton) (psavichev@gmail.com) * Copyright (C) 2010 xonatius (xonatius@gmail.com) @@ -31,9 +32,9 @@ * overkill, that's fine. So let's map the 256 values to 8 different ones: * * userspace 0 1 2 3 4 5 6 7 - * hardware 31 63 95 127 159 195 223 255 + * hardware 3 39 75 111 147 183 219 255 * - * or hardware = ((userspace + 1) * 32)-1 + * or hardware = (userspace * 36) + 3 * * Note, we keep value 0 at a positive value, otherwise the screen goes * blank because HAL likes to set the backlight to 0 at startup when there is @@ -54,7 +55,7 @@ static u8 read_brightness(void) u8 user_brightness = 0; pci_read_config_byte(pci_device, offset, &kernel_brightness); - user_brightness = ((kernel_brightness + 1) / 32) - 1; + user_brightness = (kernel_brightness - 3) / 36; return user_brightness; } @@ -62,7 +63,7 @@ static void set_brightness(u8 user_brightness) { u16 kernel_brightness = 0; - kernel_brightness = ((user_brightness + 1) * 32) - 1; + kernel_brightness = (user_brightness * 36) + 3; pci_write_config_byte(pci_device, offset, (u8)kernel_brightness); } @@ -207,7 +208,33 @@ static struct dmi_system_id __initdata samsung_dmi_table[] = { }, .callback = dmi_check_cb, }, - + { + .ident = "N350", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), + DMI_MATCH(DMI_PRODUCT_NAME, "N350"), + DMI_MATCH(DMI_BOARD_NAME, "N350"), + }, + .callback = dmi_check_cb, + }, + { + .ident = "R470/R420", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), + DMI_MATCH(DMI_PRODUCT_NAME, "R470/R420"), + DMI_MATCH(DMI_BOARD_NAME, "R470/R420"), + }, + .callback = dmi_check_cb, + }, + { + .ident = "R528/R728", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), + DMI_MATCH(DMI_PRODUCT_NAME, "R528/R728"), + DMI_MATCH(DMI_BOARD_NAME, "R528/R728"), + }, + .callback = dmi_check_cb, + }, { }, }; @@ -222,13 +249,14 @@ static int __init samsung_init(void) /* * The Samsung N120, N130, and NC10 use pci device id 0x27ae, while the * NP-Q45 uses 0x2a02 - * R410P, R468/R418, R518, R510/P510, X320/X420/X520 and X360 uses 0x2a42 - * N220 and NF110/NF210/NF310 uses 0xa011 + * R410P, R468/R418, R518, R510/P510, X320/X420/X520, X360, R470/R420 + * and R528/R728 uses 0x2a42 + * N220, NF110/NF210/NF310 and N350 uses 0xa011 * Odds are we might need to add more to the * list over time... */ pci_device = pci_get_device(PCI_VENDOR_ID_INTEL, 0x27ae, NULL); - if (!pci_device) + if (!pci_device) pci_device = pci_get_device(PCI_VENDOR_ID_INTEL, 0x2a02, NULL); if (!pci_device) pci_device = pci_get_device(PCI_VENDOR_ID_INTEL, 0x2a42, NULL); @@ -236,7 +264,7 @@ static int __init samsung_init(void) pci_device = pci_get_device(PCI_VENDOR_ID_INTEL, 0xa011, NULL); if (!pci_device) return -ENODEV; - + /* create a backlight device to talk to this one */ backlight_device = backlight_device_register("samsung", @@ -282,3 +310,6 @@ MODULE_ALIAS("dmi:*:svnSAMSUNGELECTRONICSCO.,LTD.:pnR510/P510:*:rnR510/P510:*"); MODULE_ALIAS("dmi:*:svnSAMSUNGELECTRONICSCO.,LTD.:pnNF110/NF210/NF310:*:rnNF110/NF210/NF310:*"); MODULE_ALIAS("dmi:*:svnSAMSUNGELECTRONICSCO.,LTD.:pnN220:*:rnN220:*"); MODULE_ALIAS("dmi:*:svnSAMSUNGELECTRONICSCO.,LTD.:pnN230:*:rnN230:*"); +MODULE_ALIAS("dmi:*:svnSAMSUNGELECTRONICSCO.,LTD.:pnN350:*:rnN350:*"); +MODULE_ALIAS("dmi:*:svnSAMSUNGELECTRONICSCO.,LTD.:pnR470/R420:*:rnR470/R420:*"); +MODULE_ALIAS("dmi:*:svnSAMSUNGELECTRONICSCO.,LTD.:pnR528/R728:*:rnR528/R728:*");