History log of /linux-master/drivers/platform/x86/samsung-laptop.c
Revision Date Author Comments
# 8d05fc03 30-Sep-2022 Barnabás Pőcze <pobrn@protonmail.com>

platform/x86: use PLATFORM_DEVID_NONE instead of -1

Use the `PLATFORM_DEVID_NONE` constant instead of
hard-coding -1 when creating a platform device.

No functional changes are intended.

Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>
Link: https://lore.kernel.org/r/20220930104857.2796923-1-pobrn@protonmail.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>


# 8991d7d9 18-Jun-2022 Hans de Goede <hdegoede@redhat.com>

platform/x86: samsung-laptop: Move acpi_backlight=[vendor|native] quirks to ACPI video_detect.c

acpi_video_set_dmi_backlight_type() is troublesome because it may end up
getting called after other backlight drivers have already called
acpi_video_get_backlight_type() resulting in the other drivers
already being registered even though they should not.

Move all the acpi_backlight=[vendor|native] quirks from samsung-laptop to
drivers/acpi/video_detect.c .

Note the X360 -> acpi_backlight=native quirk is not moved because that
already was present in drivers/acpi/video_detect.c .

Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>


# c8ad6a76 10-May-2022 Minghao Chi <chi.minghao@zte.com.cn>

platform/x86: samsung-laptop: use kobj_to_dev()

Use kobj_to_dev() instead of open-coding it.

Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220511021522.1488373-1-chi.minghao@zte.com.cn
Signed-off-by: Hans de Goede <hdegoede@redhat.com>


# 0284d4d1 22-Mar-2022 Jiapeng Chong <jiapeng.chong@linux.alibaba.com>

platform/x86: samsung-laptop: Fix an unsigned comparison which can never be negative

Eliminate the follow smatch warnings:

drivers/platform/x86/samsung-laptop.c:1124 kbd_led_set() warn: unsigned
'value' is never less than zero.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Link: https://lore.kernel.org/r/20220322061830.105579-1-jiapeng.chong@linux.alibaba.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>


# 3e58e1c4 12-Nov-2021 Jason Wang <wangborong@cdjrlc.com>

platform/x86: samsung-laptop: Fix typo in a comment

The double `it' is repeated in a comment, therefore one of them
is removed.

Signed-off-by: Jason Wang <wangborong@cdjrlc.com>
Link: https://lore.kernel.org/r/20211113054827.199517-1-wangborong@cdjrlc.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>


# 1351f1d1 16-May-2021 Wolfram Sang <wsa+renesas@sang-engineering.com>

platform/x86: samsung-laptop: set debugfs blobs to read only

Those blobs can only be read. So, don't confuse users with 'writable'
flags. Also, remove S_IFREG because debugfs takes care of that.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Link: https://lore.kernel.org/r/20210517100746.29663-2-wsa+renesas@sang-engineering.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>


# 5b6a9a2f 16-May-2021 Wolfram Sang <wsa+renesas@sang-engineering.com>

platform/x86: samsung-laptop: use octal numbers for rwx file permissions

Andy asked me to do it before working further on the code.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Link: https://lore.kernel.org/r/20210517100746.29663-1-wsa+renesas@sang-engineering.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>


# a87406c5 07-May-2020 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

platform/x86: samsung-laptop: Drop duplicate check for led_classdev_unregister()

led_classdev_unregister() already has the very same check, so,
drop a duplicate in the driver.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>


# 4bdc0d67 06-Jan-2020 Christoph Hellwig <hch@lst.de>

remove ioremap_nocache and devm_ioremap_nocache

ioremap has provided non-cached semantics by default since the Linux 2.6
days, so remove the additional ioremap_nocache interface.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>


# d2912cb1 04-Jun-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500

Based on 2 normalized pattern(s):

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license version 2 as
published by the free software foundation

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license version 2 as
published by the free software foundation #

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-only

has been chosen to replace the boilerplate/reference in 4122 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Enrico Weigelt <info@metux.net>
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190604081206.933168790@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# d30cdc9a 12-Jun-2019 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

platform/x86: samsung-laptop: no need to check return value of debugfs_create functions

When calling debugfs functions, there is no need to ever check the
return value. The function can work or not, but the code logic should
never do something different based on this.

Cc: Corentin Chary <corentin.chary@gmail.com>
Cc: Darren Hart <dvhart@infradead.org>
Cc: Andy Shevchenko <andy@infradead.org>
Cc: platform-driver-x86@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>


# d605ca29 19-Apr-2018 Wolfram Sang <wsa+renesas@sang-engineering.com>

platform/x86: Simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>


# 9a7c551b 22-Jan-2018 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

platform/x86: samsung-laptop: Re-use DEFINE_SHOW_ATTRIBUTE() macro

...instead of open coding file operations followed by custom ->open()
callbacks per each attribute.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>


# 6faadbbb 14-Sep-2017 Christoph Hellwig <hch@lst.de>

dmi: Mark all struct dmi_system_id instances const

... and __initconst if applicable.

Based on similar work for an older kernel in the Grsecurity patch.

[JD: fix toshiba-wmi build]
[JD: add htcpen]
[JD: move __initconst where checkscript wants it]

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jean Delvare <jdelvare@suse.de>


# 8546268e 11-Jul-2017 Arvind Yadav <arvind.yadav.cs@gmail.com>

platform/x86: samsung-laptop: constify attribute_group structures.

attribute_groups are not supposed to change at runtime. All functions
working with attribute_groups provided by <linux/sysfs.h> work
with const attribute_group. So mark the non-const structs as const.

File size before:
text data bss dec hex filename
8710 5452 23 14185 3769 drivers/platform/x86/samsung-laptop.o

File size After adding 'const':
text data bss dec hex filename
8774 5388 23 14185 3769 drivers/platform/x86/samsung-laptop.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>


# 8314a1c8 09-Jun-2017 Bhumika Goyal <bhumirks@gmail.com>

platform/x86: samsung-laptop: constify rfkill_ops structures

Add const to rfkill_ops structures that are only passed as an argument
to the functions rfkill_alloc or samsung_new_rfkill. These arguments are
of type const, so such structures can be annotated with const.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>


# 0d2c9535 07-Jun-2017 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

platform/x86: samsung-laptop: Initialize loca variable

The variable is used uninitialized which might come into unexpected
behaviour on some Samsung laptops.

Initialize it to 0xffff which seems a proper value for non-supported
feature.

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>


# 6c072299 16-Jun-2015 Hans de Goede <hdegoede@redhat.com>

samsung-laptop: Port to new backlight interface selection API

Port the backlight selection logic to the new backlight interface
selection API.

This commit also removes various obsolete pr_xxx messages related to
backlight interface selection. These are obsolete because they assume
there is only a vendor or acpi backlight driver and no other choice.
Also they are not necessary, if the user wants to know which backlight
interfaces are registered a simple "ls /sys/class/backlight" suffices.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>


# acf5493c 16-Jun-2015 Hans de Goede <hdegoede@redhat.com>

samsung-laptop: Use acpi_video_unregister_backlight instead of acpi_video_unregister

acpi_video_unregister() not only unregisters the acpi-video backlight
interface but also unregisters the acpi video bus event listener, causing
e.g. brightness hotkey presses to no longer generate keypress events.

The unregistering of the acpi video bus event listener usually is
undesirable, which by itself is a good reason to switch to
acpi_video_unregister_backlight().

Another problem with using acpi_video_unregister() rather then using
acpi_video_unregister_backlight() is that on systems with an intel video
opregion (most systems) and a broken_acpi_video quirk, whether or not
the acpi video bus event listener actually gets unregistered depends on
module load ordering:

Scenario a:
1) acpi/video.ko gets loaded (*), does not do acpi_video_register as there
is an intel opregion.
2) intel.ko gets loaded, calls acpi_video_register() which registers both
the listener and the acpi backlight interface
3) samsung-laptop.ko gets loaded, calls acpi_video_unregister() causing
both the listener and the acpi backlight interface to unregister

Scenario b:
1) acpi/video.ko gets loaded (*), does not do acpi_video_register as there
is an intel opregion.
2) samsung-laptop.ko gets loaded, calls acpi_video_dmi_promote_vendor(),
calls acpi_video_unregister(), which is a nop since acpi_video_register
has not yet been called
2) intel.ko gets loaded, calls acpi_video_register() which registers
the listener, but does not register the acpi backlight interface due to
the call to the preciding call to acpi_video_dmi_promote_vendor()

*) acpi/video.ko always loads first as both other modules depend on it.

So we end up with or without an acpi video bus event listener depending
on module load ordering, not good.

Switching to using acpi_video_unregister_backlight() means that independ
of ordering we will always have an acpi video bus event listener fixing
this.

Note that this commit means that systems without an intel video opregion,
and systems which were hitting scenario a wrt module load ordering, are
now getting an acpi video bus event listener while before they were not!

On some systems this may cause the brightness hotkeys to start generating
keypresses while before they were not (good), while on other systems this
may cause the brightness hotkeys to generate multiple keypress events for
a single press (not so good). Since on most systems the acpi video bus is
the canonical source for brightness events I believe that the latter case
will needs to be handled on a case by case basis by filtering out the
duplicate keypresses at the other source for them.

Cc: Corentin Chary <corentin.chary@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>


# 9330dcdd 01-Jun-2015 Hans de Goede <hdegoede@redhat.com>

samsung-laptop: Use acpi_video_unregister_backlight instead of acpi_video_unregister

acpi_video_unregister() not only unregisters the acpi-video backlight
interface but also unregisters the acpi video bus event listener, causing
e.g. brightness hotkey presses to no longer generate keypress events.

The unregistering of the acpi video bus event listener usually is
undesirable, which by itself is a good reason to switch to
acpi_video_unregister_backlight().

Another problem with using acpi_video_unregister() rather then using
acpi_video_unregister_backlight() is that on systems with an intel video
opregion (most systems) and a broken_acpi_video quirk, whether or not
the acpi video bus event listener actually gets unregistered depends on
module load ordering:

Scenario a:
1) acpi/video.ko gets loaded (*), does not do acpi_video_register as there
is an intel opregion.
2) intel.ko gets loaded, calls acpi_video_register() which registers both
the listener and the acpi backlight interface
3) samsung-laptop.ko gets loaded, calls acpi_video_unregister() causing
both the listener and the acpi backlight interface to unregister

Scenario b:
1) acpi/video.ko gets loaded (*), does not do acpi_video_register as there
is an intel opregion.
2) samsung-laptop.ko gets loaded, calls acpi_video_dmi_promote_vendor(),
calls acpi_video_unregister(), which is a nop since acpi_video_register
has not yet been called
2) intel.ko gets loaded, calls acpi_video_register() which registers
the listener, but does not register the acpi backlight interface due to
the call to the preciding call to acpi_video_dmi_promote_vendor()

*) acpi/video.ko always loads first as both other modules depend on it.

So we end up with or without an acpi video bus event listener depending
on module load ordering, not good.

Switching to using acpi_video_unregister_backlight() means that independ
of ordering we will always have an acpi video bus event listener fixing
this.

Note that this commit means that systems without an intel video opregion,
and systems which were hitting scenario a wrt module load ordering, are
now getting an acpi video bus event listener while before they were not!

On some systems this may cause the brightness hotkeys to start generating
keypresses while before they were not (good), while on other systems this
may cause the brightness hotkeys to generate multiple keypress events for
a single press (not so good). Since on most systems the acpi video bus is
the canonical source for brightness events I believe that the latter case
will needs to be handled on a case by case basis by filtering out the
duplicate keypresses at the other source for them.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Corentin Chary <corentin.chary@gmail.com)
Signed-off-by: Darren Hart <dvhart@linux.intel.com>


# 802cf2e1 06-Feb-2015 Darren Hart <dvhart@linux.intel.com>

samsung-laptop.c: Prefer kstrtoint over single variable sscanf

Replace existing usage of single variable sscanf with kstrtoint for
consistency with checkpatch warnings against such usage.

Signed-off-by: Darren Hart <dvhart@linux.intel.com>


# 4e7f09ad 05-Feb-2015 Lad, Prabhakar <prabhakar.csengg@gmail.com>

samsung-laptop: Fix sparse integer as NULL warning

Fix the following sparse warning:

samsung-laptop.c:1365:52: warning: Using plain integer as NULL pointer

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>


# b0dcaf4f 29-Jan-2015 Julijonas Kikutis <julijonas.kikutis@gmail.com>

samsung-laptop: enable better lid handling

Some Samsung laptops with SABI3 delay the sleep for 10 seconds after
the lid is closed and do not wake up from sleep after the lid is opened.
A SABI command is needed to enable the better behavior.

Command = 0x6e, d0 = 0x81 enables this behavior. Returns d0 = 0x01.
Command = 0x6e, d0 = 0x80 disables this behavior. Returns d0 = 0x00.

Command = 0x6d and any d0 queries the state. This returns:
d0 = 0x00000*01, d1 = 0x00, d2 = 0x00, d3 = 0x0* when it is enabled.
d0 = 0x00000*00, d1 = 0x00, d2 = 0x00, d3 = 0x0* when it is disabled.
Where * is 0 - laptop has never slept or hibernated after switch on,
1 - laptop has hibernated just before,
2 - laptop has slept just before.

Patch addresses bug https://bugzilla.kernel.org/show_bug.cgi?id=75901 .
It adds a sysfs attribute lid_handling with a description and also an
addition to the quirks structure to enable the mode by default.

A user with another laptop in the bug report says that "power button has
to be pressed twice to wake the machine" when he or she enabled the mode
manually using the SABI command. Therefore, it is enabled by default
only for the single laptop that I have tested.

Signed-off-by: Julijonas Kikutis <julijonas.kikutis@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>


# 4690555e 09-Jan-2015 Hans de Goede <hdegoede@redhat.com>

samsung-laptop: Add use_native_backlight quirk, and enable it on some models

Since kernel 3.14 the backlight control has been broken on various Samsung
Atom based netbooks. This has been bisected and this problem happens since
commit b35684b8fa94 ("drm/i915: do full backlight setup at enable time")

This has been reported and discussed in detail here:
http://lists.freedesktop.org/archives/intel-gfx/2014-July/049395.html

Unfortunately no-one has been able to fix this. This only affects Samsung
Atom netbooks, and the Linux kernel and the BIOS of those laptops have never
worked well together. All affected laptops already have a quirk to avoid using
the standard acpi-video interface and instead use the samsung specific SABI
interface which samsung-laptop uses. It seems that recent fixes to the i915
driver have also broken backlight control through the SABI interface.

The intel_backlight driver OTOH works fine, and also allows for finer grained
backlight control. So add a new use_native_backlight quirk, and replace the
broken_acpi_video quirk with this quirk for affected models. This new quirk
disables acpi-video as before and also stops samsung-laptop from registering
the SABI based samsung_laptop backlight interface, leaving only the working
intel_backlight interface.

This commit enables this new quirk for 3 models which are known to be affected,
chances are that it needs to be used on other models too.

BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1094948 # N145P
BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1115713 # N250P
Reported-by: Bertrik Sikken <bertrik@sikken.nl> # N150P
Cc: stable@vger.kernel.org # 3.16
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>


# 5a1426c9 22-Oct-2014 Hans de Goede <hdegoede@redhat.com>

samsung-laptop: Add broken-acpi-video quirk for NC210/NC110

The acpi-video backlight interface on the NC210 does not work, blacklist it
and use the samsung-laptop interface instead.

BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=861573
Cc: stable@vger.kernel.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>


# 0ca849ea 06-May-2014 Scott Thrasher <scott.thrasher@gmail.com>

platform/x86: samsung-laptop: Add support for Samsung's NP7[34]0U3E models.

These models have only 4 levels of keyboard backlight brightness and forget
how to work the backlight after resuming from S3 sleep. I've added a quirk
to set the appropriate number of backlight levels, and one to re-enable the
keyboard backlight on resume.

(Whitespace cleaned up by Matthew Garrett)

Signed-off-by: Scott Thrasher <scott.thrasher@gmail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>


# e0094244 03-Jan-2013 Matt Fleming <matt.fleming@intel.com>

samsung-laptop: Disable on EFI hardware

It has been reported that running this driver on some Samsung laptops
with EFI can cause those machines to become bricked as detailed in the
following report,

https://bugs.launchpad.net/ubuntu-cdimage/+bug/1040557

There have also been reports of this driver causing Machine Check
Exceptions on recent EFI-enabled Samsung laptops,

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

So disable it if booting from EFI since this driver relies on
grovelling around in the BIOS memory map which isn't going to work.

Cc: Corentin Chary <corentincj@iksaif.net>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: Colin Ian King <colin.king@canonical.com>
Cc: Steve Langasek <steve.langasek@canonical.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>


# e04c200f 05-Dec-2012 Seth Forshee <seth.forshee@canonical.com>

samsung-laptop: Add quirk for broken acpi_video backlight on N250P

BugLink: http://bugs.launchpad.net/bugs/1086921
Cc: stable@vger.kernel.org # v3.4+
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>


# 689db784 20-Aug-2012 Corentin Chary <corentin.chary@gmail.com>

drivers-platform-x86: remove useless #ifdef CONFIG_ACPI_VIDEO

Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# e052067d 13-Jun-2012 Corentin Chary <corentin.chary@gmail.com>

samsung-laptop: support R40/R41

> Chassis Information
> Manufacturer: SAMSUNG ELECTRONICS CO., LTD.
> Type: Other

Type should be "Notebook", "Laptop", .. not "Other".

Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 09d5677c 13-Jun-2012 Corentin Chary <corentin.chary@gmail.com>

samsung-laptop: X360 ACPI backlight device is broken

Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# a60b2176 13-Jun-2012 Corentin Chary <corentin.chary@gmail.com>

drivers-platform-x86: use acpi_video_dmi_promote_vendor()

Instead of using directly acpi_video_unregister(), use
acpi_video_dmi_promote_vendor() (and make it call
acpi_video_unregister() if needed)

Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# a979e2e2 22-Mar-2012 Corentin Chary <corentincj@iksaif.net>

samsung-laptop: unregister ACPI video module for some well known laptops

On these laptops, the ACPI video is not functional, and very unlikely
to be fixed by the vendor. Note that intel_backlight works for some
of these laptops, and the backlight from samsung-laptop always work.

The good news is that newer laptops have functional ACPI video device
and won't end up growing this list.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# bde9e509 20-Mar-2012 Dan Carpenter <dan.carpenter@oracle.com>

samsung-laptop: cleanup return type: mode_t vs umode_t

This function returns a umode_t (unsigned short) instead of mode_t which
is an unsigned int on some architectures. Cleaning this up silences a
compile warning:

drivers/platform/x86/samsung-laptop.c:1108:2: warning: initialization
from incompatible pointer type [enabled by default]

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 82c333aa 20-Mar-2012 David Rientjes <rientjes@google.com>

drivers, samsung-laptop: fix usage of isalnum

linux/ctype.h is needed for isalnum() to avoid a build error:

drivers/platform/x86/samsung-laptop.c: In function ‘samsung_sabi_diag’:
drivers/platform/x86/samsung-laptop.c:1306: error: implicit declaration of function ‘isalnum’

Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 85229440 20-Mar-2012 David Rientjes <rientjes@google.com>

drivers, samsung-laptop: fix initialization of sabi_data in sabi_set_commandb

Fields d0, d1, d2, and d3 are members of an anonymous struct inside an
anonymous union inside struct sabi_data. Initialization must be done by
wrapping the anonymous union and structs with brackets to avoid a build
error:

drivers/platform/x86/samsung-laptop.c: In function ‘sabi_set_commandb’:
drivers/platform/x86/samsung-laptop.c:433: error: unknown field ‘d0’ specified in initializer
drivers/platform/x86/samsung-laptop.c:433: warning: missing braces around initializer
drivers/platform/x86/samsung-laptop.c:433: warning: (near initialization for ‘in.<anonymous>’)
...

Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 20db88e3 15-Dec-2011 Corentin Chary <corentincj@iksaif.net>

samsung-laptop: fix seclinux rfkill and us it as fallback

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 2e777187 26-Nov-2011 Corentin Chary <corentincj@iksaif.net>

samsung-laptop: tweak traces

- don't output error when probing features at load
- print the SABI signature if samsung_sabi_init()
succeed

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 6f6ae06e 26-Nov-2011 Corentin Chary <corentincj@iksaif.net>

samsung-laptop: dump model and version informations

We still need to figure out exactly what each of different fields
represent, but they contain at least model and version informations.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 3be324a9 26-Nov-2011 Corentin Chary <corentincj@iksaif.net>

samsung-laptop: make the dmi check less strict

This enable the driver for everything that look like
a laptop and is from vendor "SAMSUNG ELECTRONICS CO., LTD.".
Note that laptop supported by samsung-q10 seem to have a different
vendor strict.

Also remove every log output until we know that we have a SABI interface
(except if the driver is forced to load, or debug is enabled).

Keeping a whitelist of laptop with a model granularity is something that can't
work without close vendor cooperation (and we don't have that).

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 84d482f2 26-Nov-2011 Corentin Chary <corentincj@iksaif.net>

samsung-laptop: add true rfkill support for swsmi

The wireless status get and get commands seems to use one
byte per device. First byte is for wlan and third is for bluetooh,
we will have to find what the other are for.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# f674ebf1 26-Nov-2011 Corentin Chary <corentincj@iksaif.net>

samsung-laptop: add keyboard backlight support

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 3a75d378 26-Nov-2011 Corentin Chary <corentincj@iksaif.net>

samsung-laptop: add usb charge support

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# cb5b5c91 26-Nov-2011 Corentin Chary <corentincj@iksaif.net>

samsung-laptop: add battery life extender support

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 49dd7730 26-Nov-2011 Corentin Chary <corentincj@iksaif.net>

samsung-laptop: remove selftest

We can now do the self test using debugfs, so remove the code
and keep the debug flag to enable more traces.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 5b80fc40 26-Nov-2011 Corentin Chary <corentincj@iksaif.net>

samsung-laptop: add a small debugfs interface

This allow to call arbitrary sabi commands wihout
modifying the driver at all. For example, setting
the keyboard backlight brightness to 5 using debugfs
interface can be done like that:

; Set the command
echo 0x78 > command
; Set the data
echo 0x0582 > d0
; Fill the rest with 0
echo 0 > d1
echo 0 > d2
echo 0 > d3
; And issue the command
cat call

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 7e960711 26-Nov-2011 Corentin Chary <corentincj@iksaif.net>

samsung-laptop: ehance SABI support

* SABI command are on 16 bits, not 8
* SABI can read/write up to 11 byte of data
* There is not real difference between "get" and "set"
commands, so refactorise the code of both functions

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# a66c1662 26-Nov-2011 Corentin Chary <corentincj@iksaif.net>

samsung-laptop: use a sysfs group

Will be usefull later when we will have more platform sysfs files
like battery_life_extender or usb_charge.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# f34cd9ca 26-Nov-2011 Corentin Chary <corentincj@iksaif.net>

samsung-laptop: don't handle backlight if handled by acpi/video

samsung-laptop is not at all related to ACPI, but since this interface
is not documented at all, and the driver has to use it at load to
understand how it works on the laptop, I think it's a good idea to
disable it if a better solution is available.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 5dea7a20 26-Nov-2011 Corentin Chary <corentincj@iksaif.net>

samsung-laptop: move code into init/exit functions

Create _init()/_exit() function for each subsystem, remove
the local struct samsung_laptop * and only keep a
struct platform_device * that can only be used in samsung_init()
and samsung_exit().

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# a6df4894 26-Nov-2011 Corentin Chary <corentincj@iksaif.net>

samsung-laptop: put all local variables in a single structure

Even if this driver can only be loaded once, it is still a good
idea to create some kind of context structure.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 90ab5ee9 12-Jan-2012 Rusty Russell <rusty@rustcorp.com.au>

module_param: make bool parameters really bool (drivers & misc)

module_param(bool) used to counter-intuitively take an int. In
fddd5201 (mid-2009) we allowed bool or int/unsigned int using a messy
trick.

It's time to remove the int/unsigned int option. For this version
it'll simply give a warning, but it'll break next kernel version.

Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


# 7500eeb0 20-Sep-2011 Tommaso Massimi <tmassimi@gmail.com>

Platform: samsung_laptop: add support for X520 machines.

my samsung laptop would be very happy if you add
these lines to the file drivers/platform/x86/samsung-laptop.c

Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# f87d0299 20-Sep-2011 Stefan Beller <stefanbeller@googlemail.com>

platform: samsung_laptop: add dmi information for Samsung R700 laptops

My DMI model is this:
>dmesg |grep DMI
[ 0.000000] DMI present.
[ 0.000000] DMI: SAMSUNG ELECTRONICS CO., LTD. SR700/SR700, BIOS
04SR 02/20/2008

adding dmi information of Samsung R700 laptops
This adds the dmi information of Samsungs R700 laptops.

Signed-off-by: Stefan Beller <stefanbeller@googlemail.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# ba05b237 13-Oct-2011 John Serock <john.serock@gmail.com>

Platform: Detect samsung laptop quirk when initial level is zero

This patch depends on the "Platform: Brightness quirk for samsung
laptop driver" patch from Jason Stubbs. This patch adds a check for an
initial brightness level of 0; if the level is 0, this patch changes
the brightness level to 1 before the driver attempts to detect the
brightness quirk.

The Samsung N150 netbook experiences the brightness quirk. Without
Jason's patch, the only brightness levels available on the N150 are 0,
1, and 8. This patch ensures that, when the initial brightness level
is 0, the samsang-laptop driver detects the brightness quirk on the
N150, thereby making brightness levels 0 through 8 available.

Signed-off-by: John Serock <john.serock@gmail.com>
Acked-by: Jason Stubbs <jasonbstubbs@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# f689c875 20-Sep-2011 Raul Gutierrez Segales <rgs@collabora.co.uk>

Platform: fix samsung-laptop DMI identification for N220 model

This is a follow-up for commit 78a7539b, which didn't cover the
Samsung N220 laptop. With this backlight brightness works nicely
on the N220 netbook.

Signed-off-by: Raul Gutierrez Segales <rgs@collabora.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 7b3c257c 20-Sep-2011 Jason Stubbs <jasonbstubbs@gmail.com>

Platform: Samsung laptop DMI info for NC210/NC110

This patch just adds the DMI info for the samsung laptop driver to work with
the NC210/NC110. It needs the brightness quirk patch for proper support.

Signed-off-by: Jason Stubbs <jasonbstubbs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# ac080523 20-Sep-2011 Jason Stubbs <jasonbstubbs@gmail.com>

Platform: Brightness quirk for samsung laptop driver

On some Samsung laptops the brightness regulation works slightly different.
All SABI commands except for set_brightness work as expected. The behaviour
of set_brightness is as follows:

- Setting a new brightness will only step one level toward the new brightness
level. For example, setting a level of 5 when the current level is 2 will
result in a brightness level of 3.
- A spurious KEY_BRIGHTNESS_UP or KEY_BRIGHTNESS_DOWN event is also generated
along with the change in brightness.
- Neither of the above two issues occur when changing from/to brightness
level 0.

This patch adds detection and a non-intrusive workaround for the above issues.

Signed-off-by: Jason Stubbs <jasonbstubbs@gmail.com>
Tested-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# a7ea1992 20-Sep-2011 David Herrmann <dh.herrmann@googlemail.com>

Platform: Fix error path in samsung-laptop init

samsung_init() should not return success if not all devices are initialized.
Otherwise, samsung_exit() will dereference sdev NULL pointers and others.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# bee460be 20-Sep-2011 Jason Stubbs <jasonbstubbs@gmail.com>

platform: samsung_laptop: fix samsung brightness min/max calculations

The min_brightness value of the sabi_config is incorrectly used in brightness
calculations. For the config where min_brightness = 1 and max_brightness = 8,
the user visible range should be 0 to 7 with hardware being set in the range
of 1 to 8. What is actually happening is that the user visible range is 0 to
8 with hardware being set in the range of -1 to 7.

This patch fixes the above issue as well as a miscalculation that would occur
in the case of min_brightness > 1.

Signed-off-by: Jason Stubbs <jasonbstubbs@gmail.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 093ed561 20-Sep-2011 Smelov Andrey <xor29a@bk.ru>

Platform: samsung_laptop: samsung backlight for R528/R728

patch works for me, but I need to add "acpi_backlight=vendor" to kernel
params

Signed-off-by: Smelov Andrey <xor29a@bk.ru>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 78a7539b 20-Jul-2011 Thomas Courbon <thcourbon@gmail.com>

Platform: fix samsung-laptop DMI identification for N150/N210/220/N230

Some samsung latop of the N150/N2{10,20,30} serie are badly detected by the samsung-laptop platform driver, see bug # 36082.
It appears that N230 identifies itself as N150/N210/N220/N230 whereas the other identify themselves as N150/N210/220.
This patch attemtp fix #36082 allowing correct identification for all the said netbook model.

Reported-by: Daniel Eklöf <daniel@ekloef.se>
Signed-off-by: Thomas Courbon <thcourbon@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 4e2441c0 03-Jul-2011 J Witteveen <jwitteve@liacs.nl>

Samsung Laptop platform driver: support N510

The N510 benefits from this code as well. Below is a patch to include support.

Signed-off-by: Jouke Witteveen <j.witteveen@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 8713b04a 08-Apr-2011 Michal Marek <mmarek@suse.cz>

samsung-laptop: set backlight type

Cherry-picked from drivers/staging/samsung-laptop/samsung-laptop.c

Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 3d536ed4 08-Apr-2011 Alberto Mardegan <mardy@users.sourceforge.net>

samsung-laptop: Samsung R410P backlight driver

Here's a trivial patch which adds support to the backlight device found
in Samsung R410 Plus laptops.

Signed-off-by: Alberto Mardegan <mardy@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
[mmarek: cherry-picked from staging commit d542f180]
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 10165072 08-Apr-2011 Greg Kroah-Hartman <gregkh@suse.de>

samsung-laptop: add support for N230 model

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
[mmarek: cherry-picked from staging commit 0789b003]
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 27836584 14-Mar-2011 Axel Lin <axel.lin@gmail.com>

platform-driver-x86: samsung-laptop: make dmi_check_cb to return 1 instead of 0

dmi_check_system() walks the table running matching functions until
someone returns non zero or we hit the end.

This patch makes dmi_check_cb to return 1 so dmi_check_system() return
immediately when a match is found.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 2d70b73a 10-Mar-2011 Greg Kroah-Hartman <gregkh@suse.de>

Platform: add Samsung Laptop platform driver

This adds the samsung-laptop driver to the kernel. It now supports
all known Samsung laptops that use the SABI interface.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Matthew Garrett <mjg@redhat.com>