rtc: s5m: support different register layout

Prepare for adding support for S2MPS14 RTC device to the rtc-s5m driver:

1. Add a map of registers used by the driver which differ between
   the chipsets (S5M876X and S2MPS14).

2. Move code of checking for alarm pending to separate function.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Sangbeom Kim <sbkim73@samsung.com>
Cc: Samuel Ortiz <sameo@linux.intel.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
rtc: s5m: add support for S2MPS14 RTC

Add support for S2MPS14 to the rtc-s5m driver.  Differences in S2MPS14
(in comparison to S5M8767):

 - Layout of registers
 - Lack of century support for time and alarms (7 registers used for
   storing time/alarm)
 - Two buffer control registers: WUDR and RUDR
 - No register for enabling writing time
 - RTC interrupts are reported in main PMIC I2C device

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Sangbeom Kim <sbkim73@samsung.com>
Cc: Samuel Ortiz <sameo@linux.intel.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
rtc: s5m: consolidate two device type switch statements

In probe the configuration of driver for different chipsets was done in
two switch (pdata->device_type) statements.  Consolidate them into one
switch statement to increase code readability.

Additionally check the return value of regmap_irq_get_virq and exit
probe on error.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Sangbeom Kim <sbkim73@samsung.com>
Cc: Samuel Ortiz <sameo@linux.intel.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Merge branch 'akpm' (patches from Andrew Morton)

Merge leftovers from Andrew Morton:
 "A few leftovers: ocfs2, gcov, RTC"

* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
  rtc: s5m: consolidate two device type switch statements
  rtc: s5m: add support for S2MPS14 RTC
  rtc: s5m: support different register layout
  rtc: s5m: use shorter time of register update
  rtc: s5m: remove undocumented time init on first boot
  mfd/rtc: sec/s5m: rename SEC* symbols to S5M
  gcov: add support for GCC 4.9
  ocfs2/o2net: incorrect to terminate accepting connections loop upon rejecting an invalid one
x86, vdso: Remove one final use of htole16()

One final use of the macros from <endian.h> which are not available on
older system.  In this case we had one sole case of *writing* a
littleendian number, but the number is SHN_UNDEF which is the constant
zero, so rather than dealing with the general case of littleendian
puts here, just document that the constant is zero and be done with
it.

Reported-and-Tested-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Link: http://lkml.kernel.org/r/20140610135051.c3c34165f73d67d218b62bd9@linux-foundation.org
alienware-wmi: For WMAX HDMI method, introduce a way to query HDMI cable status

Since there are now multiple HDMI attributes associated with the WMAX method,
create a sysfs group for them instead.

Signed-off-by: Mario Limonciello <mario_limonciello@dell.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
asus-wmi: Set WAPF to 4 for Asus X550CA

The 'asus-nb-wmi' WAPF parameter must be set to 4, so the internal Wireless LAN device is operational.

Signed-off-by: Andreas Utterberg <andreas.utterberg@thundera.se>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
ideapad-laptop: Blacklist rfkill control on the Lenovo Yoga 2 11

The Lenovo Yoga 2 11 always reports everything as blocked, causing userspace
to not even try to use the wlan / bluetooth even though they work fine.

Note this patch also removes the "else priv->rfk[i] = NULL;" bit of the
rfkill initialization, it is not necessary as the priv struct is allocated
with kzalloc.

Reported-and-tested-by: Vincent Gerris <vgerris@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
Documentation: Add list of laptop models supported by the Compal driver

Signed-off-by: Ismael Luceno <ismael.luceno@gmail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
platform x86 Kconfig: Refer to the laptop list in the Compal driver help

Signed-off-by: Ismael Luceno <ismael.luceno@gmail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
ix86/mid/thermal: Introduce the use of the managed version of kzalloc

This patch moves data allocated using kzalloc to managed data allocated
using devm_kzalloc and cleans now unnecessary kfrees in probe and remove
functions.

The following Coccinelle semantic patch was used for making the change:

@platform@
identifier p, probefn, removefn;
@@
struct platform_driver p = {
  .probe = probefn,
  .remove = removefn,
};

@prb@
identifier platform.probefn, pdev;
expression e, e1, e2;
@@
probefn(struct platform_device *pdev, ...) {
  <+...
- e = kzalloc(e1, e2)
+ e = devm_kzalloc(&pdev->dev, e1, e2)
  ...
?-kfree(e);
  ...+>
}

@rem depends on prb@
identifier platform.removefn;
expression e;
@@
removefn(...) {
  <...
- kfree(e);
  ...>
}

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
platform: x86: asus-wmi.c: Cleaning up uninitialized variables

There is a risk that the variable will be used without being initialized.

This was largely found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
platform/x86: Fix run-time dependencies of OLPC drivers

Let the xo15-ebook driver depend on OLPC as all other OLPC drivers
already do. Add COMPILE_TEST as an alternative for both xo1-rfkill
and xo15-ebook, to increase the build testing coverage.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: Matthew Garrett <matthew.garrett@nebula.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
ideapad_laptop: Introduce the use of the managed version of kzalloc

This patch moves data allocated using kzalloc to managed data allocated
using devm_kzalloc and cleans now unnecessary kfrees in probe and remove
functions. The label sysfs_failed is removed as it is no longer
required.  Also, linux/device.h is added to make sure the devm_*()
routine declarations are unambiguously available.

The following Coccinelle semantic patch was used for making the change:

@platform@
identifier p, probefn, removefn;
@@
struct platform_driver p = {
  .probe = probefn,
  .remove = removefn,
};

@prb@
identifier platform.probefn, pdev;
expression e, e1, e2;
@@
probefn(struct platform_device *pdev, ...) {
  <+...
- e = kzalloc(e1, e2)
+ e = devm_kzalloc(&pdev->dev, e1, e2)
  ...
?-kfree(e);
  ...+>
}

@rem depends on prb@
identifier platform.removefn;
expression e;
@@
removefn(...) {
  <...
- kfree(e);
  ...>
}

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
platform: x86: dell-smo8800: Dell Latitude freefall driver (ACPI SMO8800/SMO8810)

This acpi driver provide supports for freefall sensors SMO8800/SMO8810 which
can be found on Dell Latitude laptops. Driver register /dev/freefall misc
device which has same interface as driver hp_accel freefall driver. So any
existing applications for HP freefall sensor /dev/freefall will work for with
this new driver for Dell Latitude laptops too.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Cc: Sonal Santan <sonal.santan@gmail.com>
Tested-By: Valdis Kletnieks <valdis.kletnieks@vt.edu>
Acked-By: Valdis Kletnieks <valdis.kletnieks@vt.edu>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
thinkpad_acpi: Add mappings for F9 - F12 hotkeys on X240 / T440 / T540

The T440s user guide says that when Fn-lock is not active, the *40s' F9 - F12
keys should be mapped to: control-panel, search, show-all-windows and Computer.

These keys generate the sofar unused 28 - 31 hotkey scancodes.

For the first 2 this nicely matches the icons on the keys, for the latter 2
the icons are somewhat creative, which is why I ended up looking them up in
the user manual.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
hp-wmi: Enable hotkeys on some systems

This is a third attempt to enable these buttons. The new variable being
commit 997daa1bd9aca412ab97955a35b26c460c0ec7a4 (i.e. hp-wmi: detect
"2009 BIOS or later"). Older systems that do not have the 2009 BIOS query
method respond with a dummy value, in this case 4. Using that, we can
target a fairly narrow group of systems. i.e. old enough to not have
HPWMI_FEATURE_QUERY 0xd, but new enough to have HPWMI_BIOS_QUERY 0x9.
This group may be further limited if some systems respond with something
other than 4 to non-existant feature queries.

Signed-off-by: Kyle Evans <kvans32@gmail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
Merge branch 'for-v3.16/ti-clk-drv' of github.com:t-kristo/linux-pm into clk-next
Merge branch 'for_linus' of git://cavan.codon.org.uk/platform-drivers-x86

Pull x86 platform driver updates from Matthew Garrett:
 "Very little of excitement here - the most significant is a new driver
  for detecting device freefall on Dells, other than that it's pretty
  much entirely minor fixes for specific machines"

* 'for_linus' of git://cavan.codon.org.uk/platform-drivers-x86:
  hp-wmi: Enable hotkeys on some systems
  thinkpad_acpi: Add mappings for F9 - F12 hotkeys on X240 / T440 / T540
  platform: x86: dell-smo8800: Dell Latitude freefall driver (ACPI SMO8800/SMO8810)
  ideapad_laptop: Introduce the use of the managed version of kzalloc
  platform/x86: Fix run-time dependencies of OLPC drivers
  platform: x86: asus-wmi.c: Cleaning up uninitialized variables
  ix86/mid/thermal: Introduce the use of the managed version of kzalloc
  platform x86 Kconfig: Refer to the laptop list in the Compal driver help
  Documentation: Add list of laptop models supported by the Compal driver
  ideapad-laptop: Blacklist rfkill control on the Lenovo Yoga 2 11
  asus-wmi: Set WAPF to 4 for Asus X550CA
  alienware-wmi: For WMAX HDMI method, introduce a way to query HDMI cable status
  alienware-wmi: Update WMAX brightness method limit to 15
  pvpanic: Set high notifier priority
  platform/x86: samsung-laptop: Add support for Samsung's NP7[34]0U3E models.
  toshiba_acpi: Add alternative keymap support for Satellite M840
  platform-drivers-x86: intel_pmic_gpio: Fix off-by-one valid offset range check
Merge branch 'topic/ipu-destaging' of git://git.pengutronix.de/git/pza/linux into drm-next

Destage IPUv3

* 'topic/ipu-destaging' of git://git.pengutronix.de/git/pza/linux:
  gpu: ipu-v3: Register the CSI modules
  gpu: ipu-v3: Add CSI and SMFC module enable wrappers
  gpu: ipu-v3: Add ipu_idmac_get_current_buffer function
  gpu: ipu-v3: Add SMFC code
  gpu: ipu-v3: Move i.MX IPUv3 core driver out of staging