Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Other samsung laptop backlight support #1

Closed
wants to merge 13 commits into from

2 participants

@xonatius

Hi Greg,

Thanks a lot for your samsung-bakclight module. We've added some other samsung laptop's models with the same backlight problems. It would be great if you could merge source and add it to the linux kernel. Thanks.

Daniil Bondarev

@gregkh
Owner

Please send patches against the latest linux kernel releases from kernel.org, that's the only way I can accept patches
to get into the main kernel tree. Please see Documentation/SubmittingPatches for how to do this.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 9, 2010
  1. Add Samsung R468/R418 to model list

    elemc authored
Commits on Dec 19, 2010
  1. @xonatius
  2. @xonatius

    Added make install.

    xonatius authored
  3. @xonatius
  4. @xonatius

    Add support X360, R518, R510/P510 laptops.

    xonatius authored
    Testing need.
Commits on Dec 20, 2010
  1. @xonatius

    Tab fixes

    xonatius authored
  2. @xonatius

    Fixed comment header

    xonatius authored
  3. @xonatius

    Documentation fixes

    xonatius authored
Commits on Jan 25, 2011
  1. @xonatius

    Add NF110/NF210/NF310 laptops support.

    xonatius authored
    Thanks nikobockerman.
Commits on Jan 29, 2011
  1. @xonatius

    Added R410 laptop

    xonatius authored
  2. @xonatius

    fix R410 name

    xonatius authored
Commits on Feb 2, 2011
  1. @xonatius
Commits on Feb 3, 2011
  1. @xonatius

    Tested x360

    xonatius authored
This page is out of date. Refresh to see the latest.
Showing with 227 additions and 94 deletions.
  1. +4 −0 Makefile
  2. +48 −0 README
  3. +175 −94 samsung-backlight.c
View
4 Makefile
@@ -10,3 +10,7 @@ clean:
rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c
rm -f Module.markers Module.symvers modules.order
rm -rf .tmp_versions Modules.symvers
+
+install:
+ cp samsung-backlight.ko /lib/modules/`uname -r`/kernel/drivers/staging/samsung-laptop/
+ depmod -a
View
48 README
@@ -0,0 +1,48 @@
+## Welcome to the samsung-backlight wiki!
+
+samsung-backlight is a fork of samsung-backlight linux kernel driver. It add backlight support for some of samsung laptops.
+
+## Samsung laptop models
+
+Currently supported:
+
+* N130
+* NC10
+* NP-Q45
+* R410 plus
+* R468/R418
+* X320/X420/X520
+* X360
+* R518
+* R510/P510
+* NF110/NF210/NF310
+
+Not tested:
+
+* R518
+* R510/P510
+
+Have a similar problem, but need more information to add it (if you are owner of these laptops, please add an issue):
+
+* X418
+* Q1
+
+## Installation
+
+git clone https://xonatius@github.com/xonatius/samsung-backlight.git
+cd samsung-backlight
+make
+sudo make install
+
+On some os you need to add samsung_backlight module to modules list. (f.e /etc/modules) After reboot it should work.
+Often you need to add acpi_backlight=vendor to the kernel boot options, to makes your system work with backlight. (F.E. In ubuntu you had to edit /etc/default/grub and add the acpi_backlight=vendor to the end of GRUB_CMD_LINUX_DEFAULT line and then run update-grub)
+
+## Other samsung laptop models
+
+If you've got samsung laptop with intel graphics card and it hasn't supported backlight control, you could create an issue with "lspci -nn" and "dmidecode -s system-product-name
+" information.
+
+## Thanks
+
+* Thanks nikobockerman for the information and patch for NF110/NF210/NF310 laptops.
+* Thanks Alberto Mardegan for R410 laptops patch and solution for acpi_backlight problem.
View
269 samsung-backlight.c
@@ -1,6 +1,9 @@
/*
- * Samsung N130 and NC10 Laptop Backlight driver
+ * Samsung N130, NC10, Np-Q45, R468/R418, X320/X420/X520, X360, R518,
+ * R510/P510, R410 and NF110/NF210/NF310 Laptop Backlight driver
*
+ * Copyright (C) 2010 xonatius (xonatius@gmail.com)
+ * Copyright (C) 2010 elemc, sergem (fedora@conference.jabber.ru)
* Copyright (C) 2009 Greg Kroah-Hartman (gregkh@suse.de)
* Copyright (C) 2009 Novell Inc.
*
@@ -18,16 +21,16 @@
#include <linux/fb.h>
#include <linux/dmi.h>
-#define MAX_BRIGHT 0x07
-#define OFFSET 0xf4
+#define MAX_BRIGHT 0x07
+#define OFFSET 0xf4
/*
* HAL/gnome-display-manager really wants us to only set 8 different levels for
* the brightness control. And since 256 different levels seems a bit
* 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
+ * userspace 0 1 2 3 4 5 6 7
+ * hardware 31 63 95 127 159 195 223 255
*
* or hardware = ((userspace + 1) * 32)-1
*
@@ -46,128 +49,199 @@ static struct backlight_device *backlight_device;
static u8 read_brightness(void)
{
- u8 kernel_brightness;
- u8 user_brightness = 0;
+ u8 kernel_brightness;
+ u8 user_brightness = 0;
- pci_read_config_byte(pci_device, offset, &kernel_brightness);
- user_brightness = ((kernel_brightness + 1) / 32) - 1;
- return user_brightness;
+ pci_read_config_byte(pci_device, offset, &kernel_brightness);
+ user_brightness = ((kernel_brightness + 1) / 32) - 1;
+ return user_brightness;
}
static void set_brightness(u8 user_brightness)
{
- u16 kernel_brightness = 0;
+ u16 kernel_brightness = 0;
- kernel_brightness = ((user_brightness + 1) * 32) - 1;
- pci_write_config_byte(pci_device, offset, (u8)kernel_brightness);
+ kernel_brightness = ((user_brightness + 1) * 32) - 1;
+ pci_write_config_byte(pci_device, offset, (u8)kernel_brightness);
}
static int get_brightness(struct backlight_device *bd)
{
- return bd->props.brightness;
+ return bd->props.brightness;
}
static int update_status(struct backlight_device *bd)
{
- set_brightness(bd->props.brightness);
- return 0;
+ set_brightness(bd->props.brightness);
+ return 0;
}
static struct backlight_ops backlight_ops = {
- .get_brightness = get_brightness,
- .update_status = update_status,
+ .get_brightness = get_brightness,
+ .update_status = update_status,
};
static int __init dmi_check_cb(const struct dmi_system_id *id)
{
- printk(KERN_INFO KBUILD_MODNAME ": found laptop model '%s'\n",
- id->ident);
- return 0;
+ printk(KERN_INFO KBUILD_MODNAME ": found laptop model '%s'\n",
+ id->ident);
+ return 0;
}
static struct dmi_system_id __initdata samsung_dmi_table[] = {
- {
- .ident = "N120",
- .matches = {
- DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
- DMI_MATCH(DMI_PRODUCT_NAME, "N120"),
- DMI_MATCH(DMI_BOARD_NAME, "N120"),
- },
- .callback = dmi_check_cb,
- },
- {
- .ident = "N130",
- .matches = {
- DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
- DMI_MATCH(DMI_PRODUCT_NAME, "N130"),
- DMI_MATCH(DMI_BOARD_NAME, "N130"),
- },
- .callback = dmi_check_cb,
- },
- {
- .ident = "NC10",
- .matches = {
- DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
- DMI_MATCH(DMI_PRODUCT_NAME, "NC10"),
- DMI_MATCH(DMI_BOARD_NAME, "NC10"),
- },
- .callback = dmi_check_cb,
- },
- {
- .ident = "NP-Q45",
- .matches = {
- DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
- DMI_MATCH(DMI_PRODUCT_NAME, "SQ45S70S"),
- DMI_MATCH(DMI_BOARD_NAME, "SQ45S70S"),
- },
- .callback = dmi_check_cb,
- },
- { },
+ {
+ .ident = "N120",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "N120"),
+ DMI_MATCH(DMI_BOARD_NAME, "N120"),
+ },
+ .callback = dmi_check_cb,
+ },
+ {
+ .ident = "N130",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "N130"),
+ DMI_MATCH(DMI_BOARD_NAME, "N130"),
+ },
+ .callback = dmi_check_cb,
+ },
+ {
+ .ident = "NC10",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "NC10"),
+ DMI_MATCH(DMI_BOARD_NAME, "NC10"),
+ },
+ .callback = dmi_check_cb,
+ },
+ {
+ .ident = "NP-Q45",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "SQ45S70S"),
+ DMI_MATCH(DMI_BOARD_NAME, "SQ45S70S"),
+ },
+ .callback = dmi_check_cb,
+ },
+ {
+ .ident = "R410 Plus",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "R410P"),
+ DMI_MATCH(DMI_BOARD_NAME, "R460"),
+ },
+ .callback = dmi_check_cb,
+ },
+ {
+ .ident = "R468/R418",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "R468/R418"),
+ DMI_MATCH(DMI_BOARD_NAME, "R468/R418"),
+ },
+ .callback = dmi_check_cb,
+ },
+ {
+ .ident = "X320/X420/X520",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "X320/X420/X520"),
+ DMI_MATCH(DMI_BOARD_NAME, "X320/X420/X520"),
+ },
+ .callback = dmi_check_cb,
+ },
+ {
+ .ident = "X360",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "X360"),
+ DMI_MATCH(DMI_BOARD_NAME, "X360"),
+ },
+ .callback = dmi_check_cb,
+ },
+ {
+ .ident = "R518",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "R518"),
+ DMI_MATCH(DMI_BOARD_NAME, "R518"),
+ },
+ .callback = dmi_check_cb,
+ },
+ {
+ .ident = "R510/P510",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "R510/P510"),
+ DMI_MATCH(DMI_BOARD_NAME, "R510/P510"),
+ },
+ .callback = dmi_check_cb,
+ },
+ {
+ .ident = "NF110/NF210/NF310",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "NF110/NF210/NF310"),
+ DMI_MATCH(DMI_BOARD_NAME, "NF110/NF210/NF310"),
+ },
+ .callback = dmi_check_cb,
+ },
+
+ { },
};
static int __init samsung_init(void)
{
- struct backlight_properties props;
- memset(&props, 0, sizeof(struct backlight_properties));
-
- if (!dmi_check_system(samsung_dmi_table))
- return -ENODEV;
-
- /*
- * The Samsung N120, N130, and NC10 use pci device id 0x27ae, while the
- * NP-Q45 uses 0x2a02. 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) {
- pci_device = pci_get_device(PCI_VENDOR_ID_INTEL, 0x2a02, NULL);
- if (!pci_device)
- return -ENODEV;
- }
-
- /* create a backlight device to talk to this one */
- backlight_device = backlight_device_register("samsung",
- &pci_device->dev,
- NULL, &backlight_ops, &props);
- if (IS_ERR(backlight_device)) {
- pci_dev_put(pci_device);
- return PTR_ERR(backlight_device);
- }
-
- backlight_device->props.max_brightness = MAX_BRIGHT;
- backlight_device->props.brightness = read_brightness();
- backlight_device->props.power = FB_BLANK_UNBLANK;
- backlight_update_status(backlight_device);
-
- return 0;
+ struct backlight_properties props;
+ memset(&props, 0, sizeof(struct backlight_properties));
+
+ if (!dmi_check_system(samsung_dmi_table))
+ return -ENODEV;
+
+ /*
+ * 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
+ * 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)
+ 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);
+ if (!pci_device)
+ 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",
+ &pci_device->dev,
+ NULL, &backlight_ops, &props);
+ if (IS_ERR(backlight_device)) {
+ pci_dev_put(pci_device);
+ return PTR_ERR(backlight_device);
+ }
+
+ backlight_device->props.max_brightness = MAX_BRIGHT;
+ backlight_device->props.brightness = read_brightness();
+ backlight_device->props.power = FB_BLANK_UNBLANK;
+ backlight_update_status(backlight_device);
+
+ return 0;
}
static void __exit samsung_exit(void)
{
- backlight_device_unregister(backlight_device);
+ backlight_device_unregister(backlight_device);
- /* we are done with the PCI device, put it back */
- pci_dev_put(pci_device);
+ /* we are done with the PCI device, put it back */
+ pci_dev_put(pci_device);
}
module_init(samsung_init);
@@ -180,3 +254,10 @@ MODULE_ALIAS("dmi:*:svnSAMSUNGELECTRONICSCO.,LTD.:pnN120:*:rnN120:*");
MODULE_ALIAS("dmi:*:svnSAMSUNGELECTRONICSCO.,LTD.:pnN130:*:rnN130:*");
MODULE_ALIAS("dmi:*:svnSAMSUNGELECTRONICSCO.,LTD.:pnNC10:*:rnNC10:*");
MODULE_ALIAS("dmi:*:svnSAMSUNGELECTRONICSCO.,LTD.:pnSQ45S70S:*:rnSQ45S70S:*");
+MODULE_ALIAS("dmi:*:svnSAMSUNGELECTRONICSCO.,LTD.:pnR410P:*:rnR410P:*");
+MODULE_ALIAS("dmi:*:svnSAMSUNGELECTRONICSCO.,LTD.:pnR468/R418:*:rnR468/R418:*");
+MODULE_ALIAS("dmi:*:svnSAMSUNGELECTRONICSCO.,LTD.:pnX320/X420/X520:*:rnX320/X420/X520:*");
+MODULE_ALIAS("dmi:*:svnSAMSUNGELECTRONICSCO.,LTD.:pnX360:*:rnX360:*");
+MODULE_ALIAS("dmi:*:svnSAMSUNGELECTRONICSCO.,LTD.:pnR518:*:rnR518:*");
+MODULE_ALIAS("dmi:*:svnSAMSUNGELECTRONICSCO.,LTD.:pnR510/P510:*:rnR510/P510:*");
+MODULE_ALIAS("dmi:*:svnSAMSUNGELECTRONICSCO.,LTD.:pnNF110/NF210/NF310:*:rnNF110/NF210/NF310:*");
Something went wrong with that request. Please try again.