cascardo/linux.git
8 years agoMerge branch 'pm-opp'
Rafael J. Wysocki [Mon, 22 Jun 2015 12:23:44 +0000 (14:23 +0200)]
Merge branch 'pm-opp'

* pm-opp:
  PM / OPP: Add binding for 'opp-suspend'
  PM / OPP: Allow multiple OPP tables to be passed via DT
  PM / OPP: Add new bindings to address shortcomings of existing bindings

8 years agoPM / OPP: Add binding for 'opp-suspend'
Viresh Kumar [Mon, 22 Jun 2015 12:23:27 +0000 (14:23 +0200)]
PM / OPP: Add binding for 'opp-suspend'

On few platforms, for power efficiency, we want the device to be
configured for a specific OPP while we put the device in suspend state.

Add an optional property in operating-points-v2 bindings for that.

Suggested-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Nishanth Menon <nm@ti.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agoPM / OPP: Allow multiple OPP tables to be passed via DT
Viresh Kumar [Mon, 22 Jun 2015 12:21:38 +0000 (14:21 +0200)]
PM / OPP: Allow multiple OPP tables to be passed via DT

On some platforms (Like Qualcomm's SoCs), it is not decided until
runtime on what OPPs to use. The OPP tables can be fixed at compile
time, but which table to use is found out only after reading some efuses
(sort of an prom) and knowing characteristics of the SoC.

To support such platform we need to pass multiple OPP tables per device
and hardware should be able to choose one and only one table out of
those.

Update operating-points-v2 bindings to support that.

Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agoPM / OPP: Add new bindings to address shortcomings of existing bindings
Viresh Kumar [Thu, 4 Jun 2015 16:20:31 +0000 (21:50 +0530)]
PM / OPP: Add new bindings to address shortcomings of existing bindings

Current OPP (Operating performance point) device tree bindings have been
insufficient due to the inflexible nature of the original bindings. Over
time, we have realized that Operating Performance Point definitions and
usage is varied depending on the SoC and a "single size (just frequency,
voltage) fits all" model which the original bindings attempted and
failed.

The proposed next generation of the bindings addresses by providing a
expandable binding for OPPs and introduces the following common
shortcomings seen with the original bindings:

- Getting clock/voltage/current rails sharing information between CPUs.
  Shared by all cores vs independent clock per core vs shared clock per
  cluster.

- Support for specifying current levels along with voltages.

- Support for multiple regulators.

- Support for turbo modes.

- Other per OPP settings: transition latencies, disabled status, etc.?

- Expandability of OPPs in future.

This patch introduces new bindings "operating-points-v2" to get these problems
solved. Refer to the bindings for more details.

We now have multiple versions of OPP binding and only one of them should
be used per device.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Acked-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agoMerge branches 'pnp' and 'pm-tools'
Rafael J. Wysocki [Thu, 18 Jun 2015 23:18:43 +0000 (01:18 +0200)]
Merge branches 'pnp' and 'pm-tools'

* pnp:
  PNP / ACPI: use unsigned int in pnpacpi_encode_resources()
  PNP / ACPI: use u8 instead of int in acpi_resource_extended_irq context

* pm-tools:
  cpupower: mperf monitor: fix output in MAX_FREQ_SYSFS mode

8 years agoMerge branches 'pm-clk', 'pm-domains' and 'powercap'
Rafael J. Wysocki [Thu, 18 Jun 2015 23:18:30 +0000 (01:18 +0200)]
Merge branches 'pm-clk', 'pm-domains' and 'powercap'

* pm-clk:
  PM / clk: Print acquired clock name in addition to con_id
  PM / clk: Fix clock error check in __pm_clk_add()
  drivers: sh: remove boilerplate code and use USE_PM_CLK_RUNTIME_OPS
  arm: davinci: remove boilerplate code and use USE_PM_CLK_RUNTIME_OPS
  arm: omap1: remove boilerplate code and use USE_PM_CLK_RUNTIME_OPS
  arm: keystone: remove boilerplate code and use USE_PM_CLK_RUNTIME_OPS
  PM / clock_ops: Provide default runtime ops to users

* pm-domains:
  PM / Domains: Skip timings during syscore suspend/resume

* powercap:
  powercap / RAPL: Support Knights Landing
  powercap / RAPL: Floor frequency setting in Atom SoC

8 years agoMerge branch 'pm-wakeirq'
Rafael J. Wysocki [Thu, 18 Jun 2015 23:18:14 +0000 (01:18 +0200)]
Merge branch 'pm-wakeirq'

* pm-wakeirq:
  PM / wakeirq: Fix typo in prototype for dev_pm_set_dedicated_wake_irq
  PM / Wakeirq: Add automated device wake IRQ handling

8 years agoMerge branches 'pm-sleep' and 'pm-runtime'
Rafael J. Wysocki [Thu, 18 Jun 2015 23:18:02 +0000 (01:18 +0200)]
Merge branches 'pm-sleep' and 'pm-runtime'

* pm-sleep:
  PM / sleep: trace_device_pm_callback coverage in dpm_prepare/complete
  PM / wakeup: add a dummy wakeup_source to record statistics
  PM / sleep: Make suspend-to-idle-specific code depend on CONFIG_SUSPEND
  PM / sleep: Return -EBUSY from suspend_enter() on wakeup detection
  PM / tick: Add tracepoints for suspend-to-idle diagnostics
  PM / sleep: Fix symbol name in a comment in kernel/power/main.c
  leds / PM: fix hibernation on arm when gpio-led used with CPU led trigger
  ARM: omap-device: use SET_NOIRQ_SYSTEM_SLEEP_PM_OPS
  bus: omap_l3_noc: add missed callbacks for suspend-to-disk
  PM / sleep: Add macro to define common noirq system PM callbacks
  PM / sleep: Refine diagnostic messages in enter_state()
  PM / wakeup: validate wakeup source before activating it.

* pm-runtime:
  PM / Runtime: Update last_busy in rpm_resume
  PM / runtime: add note about re-calling in during device probe()

8 years agoMerge branch 'pm-cpufreq'
Rafael J. Wysocki [Thu, 18 Jun 2015 23:17:50 +0000 (01:17 +0200)]
Merge branch 'pm-cpufreq'

* pm-cpufreq: (37 commits)
  cpufreq: dt: allow driver to boot automatically
  intel_pstate: Fix overflow in busy_scaled due to long delay
  cpufreq: qoriq: optimize the CPU frequency switching time
  cpufreq: gx-suspmod: Fix two typos in two comments
  cpufreq: nforce2: Fix typo in comment to function nforce2_init()
  cpufreq: governor: Serialize governor callbacks
  cpufreq: governor: split cpufreq_governor_dbs()
  cpufreq: governor: register notifier from cs_init()
  cpufreq: Remove cpufreq_update_policy()
  cpufreq: Restart governor as soon as possible
  cpufreq: Call cpufreq_policy_put_kobj() from cpufreq_policy_free()
  cpufreq: Initialize policy->kobj while allocating policy
  cpufreq: Stop migrating sysfs files on hotplug
  cpufreq: Don't allow updating inactive policies from sysfs
  intel_pstate: Force setting target pstate when required
  intel_pstate: change some inconsistent debug information
  cpufreq: Track cpu managing sysfs kobjects separately
  cpufreq: Fix for typos in two comments
  cpufreq: Mark policy->governor = NULL for inactive policies
  cpufreq: Manage governor usage history with 'policy->last_governor'
  ...

8 years agoMerge branch 'pm-cpuidle'
Rafael J. Wysocki [Thu, 18 Jun 2015 23:17:44 +0000 (01:17 +0200)]
Merge branch 'pm-cpuidle'

* pm-cpuidle:
  cpuidle: Do not use CPUIDLE_DRIVER_STATE_START in cpuidle.c
  cpuidle: Select a different state on tick_broadcast_enter() failures
  sched / idle: Call default_idle_call() from cpuidle_enter_state()
  sched / idle: Call idle_set_state() from cpuidle_enter_state()
  cpuidle: Fix the kerneldoc comment for cpuidle_enter_state()
  sched / idle: Eliminate the "reflect" check from cpuidle_idle_call()
  cpuidle: Check the sign of index in cpuidle_reflect()
  sched / idle: Move the default idle call code to a separate function

8 years agoMerge branch 'acpi-cca'
Rafael J. Wysocki [Thu, 18 Jun 2015 23:17:35 +0000 (01:17 +0200)]
Merge branch 'acpi-cca'

* acpi-cca:
  ufs: fix TRUE and FALSE re-define build error
  megaraid_sas: fix TRUE and FALSE re-define build error
  amd-xgbe: Unify coherency checking logic with device_dma_is_coherent()
  crypto: ccp - Unify coherency checking logic with device_dma_is_coherent()
  device property: Introduces device_dma_is_coherent()
  arm64 : Introduce support for ACPI _CCA object
  ACPI / scan: Parse _CCA and setup device coherency

8 years agoMerge branch 'acpi-video'
Rafael J. Wysocki [Thu, 18 Jun 2015 23:17:26 +0000 (01:17 +0200)]
Merge branch 'acpi-video'

* acpi-video: (38 commits)
  ACPI / video: Make acpi_video_unregister_backlight() private
  acpi-video-detect: Remove old API
  toshiba-acpi: Port to new backlight interface selection API
  thinkpad-acpi: Port to new backlight interface selection API
  sony-laptop: Port to new backlight interface selection API
  samsung-laptop: Port to new backlight interface selection API
  msi-wmi: Port to new backlight interface selection API
  msi-laptop: Port to new backlight interface selection API
  intel-oaktrail: Port to new backlight interface selection API
  ideapad-laptop: Port to new backlight interface selection API
  fujitsu-laptop: Port to new backlight interface selection API
  eeepc-laptop: Port to new backlight interface selection API
  dell-wmi: Port to new backlight interface selection API
  dell-laptop: Port to new backlight interface selection API
  compal-laptop: Port to new backlight interface selection API
  asus-wmi: Port to new backlight interface selection API
  asus-laptop: Port to new backlight interface selection API
  apple-gmux: Port to new backlight interface selection API
  acer-wmi: Port to new backlight interface selection API
  ACPI / video: Fix acpi_video _register vs _unregister_backlight race
  ...

8 years agoMerge branches 'acpi-battery' and 'acpi-processor'
Rafael J. Wysocki [Thu, 18 Jun 2015 23:17:18 +0000 (01:17 +0200)]
Merge branches 'acpi-battery' and 'acpi-processor'

* acpi-battery:
  ACPI / battery: mark DMI table as __initconst
  ACPI / battery: minor tweaks to acpi_battery_units()
  ACPI / battery: constify the offset tables
  ACPI / battery: ensure acpi_battery_init() has finish
  ACPI / battery: drop useless return statements
  ACPI / battery: abort initialization earlier if acpi_disabled

* acpi-processor:
  ACPI / processor: constify DMI system id table
  ACPI / processor: Introduce invalid_phys_cpuid()
  ACPI / processor: return specific error instead of -1
  ACPI / processor: remove phys_id in acpi_processor_get_info()
  ACPI / processor: remove cpu_index in acpi_processor_get_info()
  Xen / ACPI / processor: Remove unneeded NULL check
  Xen / ACPI / processor: use invalid_logical_cpuid()
  ACPI / processor: Introduce invalid_logical_cpuid()

8 years agoMerge branches 'acpi-ac', 'acpi-soc' and 'acpi-assorted'
Rafael J. Wysocki [Thu, 18 Jun 2015 23:17:03 +0000 (01:17 +0200)]
Merge branches 'acpi-ac', 'acpi-soc' and 'acpi-assorted'

* acpi-ac:
  ACPI / AC: constify DMI system id table

* acpi-soc:
  ACPI / LPSS: constify device descriptors

* acpi-assorted:
  ACPI / HED: constify ACPI device ids

8 years agoMerge branch 'acpi-ec'
Rafael J. Wysocki [Thu, 18 Jun 2015 23:16:45 +0000 (01:16 +0200)]
Merge branch 'acpi-ec'

* acpi-ec:
  ACPI / EC: Fix a code coverity issue when QR_EC transactions are failed.
  ACPI / EC: Fix EC_FLAGS_QUERY_HANDSHAKE platforms using new event clearing timing.
  ACPI / EC: Add event clearing variation support.
  ACPI / EC: Convert event handling work queue into loop style.
  ACPI / EC: Cleanup transaction state transition.
  ACPI / EC: Remove non-root-caused busy polling quirks.
  ACPI / EC: Add module params for polling modes.
  ACPI / EC: Fix and clean up register access guarding logics.
  ACPI / EC: Remove irqs_disabled() check.
  ACPI / EC: Remove storming threashold enlarging quirk.
  ACPI / EC: Update acpi_ec_is_gpe_raised() with new GPE status flag.

8 years agoMerge branches 'acpi-pm', 'acpi-apei', 'acpi-osl' and 'acpi-pci'
Rafael J. Wysocki [Thu, 18 Jun 2015 23:16:21 +0000 (01:16 +0200)]
Merge branches 'acpi-pm', 'acpi-apei', 'acpi-osl' and 'acpi-pci'

* acpi-pm:
  ACPI / PM: Add missing pm_generic_complete() invocation
  ACPI / PM: Turn power resources on and off in the right order during resume
  ACPI / PM: Rework device power management to follow ACPI 6
  ACPI / PM: Drop stale comment from acpi_power_transition()

* acpi-apei:
  GHES: Make NMI handler have a single reader
  GHES: Elliminate double-loop in the NMI handler
  GHES: Panic right after detection
  GHES: Carve out the panic functionality
  GHES: Carve out error queueing in a separate function

* acpi-osl:
  ACPI / osl: use same type for acpi_predefined_names values as in definition

* acpi-pci:
  ACPI / PCI: remove stale list_head in struct acpi_prt_entry

8 years agoMerge branches 'acpi-init', 'acpi-pnp', 'acpi-scan', 'acpi-proc' and 'acpi-doc'
Rafael J. Wysocki [Thu, 18 Jun 2015 23:15:49 +0000 (01:15 +0200)]
Merge branches 'acpi-init', 'acpi-pnp', 'acpi-scan', 'acpi-proc' and 'acpi-doc'

* acpi-init:
  ACPI / init: Switch over platform to the ACPI mode later

* acpi-pnp:
  ACPI / PNP: Avoid conflicting resource reservations

* acpi-scan:
  ACPI / scan: constify ACPI device ids
  ACPI / property: Define a symbol for PRP0001
  ACPI / property: Refine consistency check for PRP0001

* acpi-proc:
  ACPI / proc: make ACPI_PROCFS_POWER X86 only

* acpi-doc:
  ACPI: Constify ACPI device IDs in documentation
  ACPI / enumeration: Document the rules regarding the PRP0001 device ID
  ACPI: fix kernel-parameters ordering in Documentation

8 years agoMerge branch 'acpica'
Rafael J. Wysocki [Thu, 18 Jun 2015 23:15:19 +0000 (01:15 +0200)]
Merge branch 'acpica'

* acpica: (22 commits)
  ACPICA: Fix for ill-formed GUID strings for NFIT tables.
  ACPICA: acpihelp: Update for new NFIT table GUIDs.
  ACPICA: Update version to 20150515.
  ACPICA: ACPI 6.0: Add support for NFIT table.
  ACPICA: acpi_help: Add option to display all known/supported ACPI tables.
  ACPICA: iASL/disassembler - fix possible fault for -e option.
  ACPICA: ACPI 6.0: Add changes for DRTM table.
  ACPICA: ACPI 6.0: Add support for IORT table.
  ACPICA: ACPI 6.0: Add ACPI_SUB_PTR().
  ACPICA: ACPI 6.0: Add changes for MADT table.
  ACPICA: Hardware: Fix a resource leak issue in acpi_hw_build_pci_list().
  ACPICA: Dispatcher: Fix a resource leak issue in acpi_ds_auto_serialize_method().
  ACPICA: ACPI 6.0: Add changes for LPIT table.
  ACPICA: ACPI 6.0: Add changes for FADT table.
  ACPICA: ACPI 6.0: Add support for WPBT table.
  ACPICA: iASL: Enhance detection of non-ascii or corrupted input files.
  ACPICA: Parser: Move a couple externals to the proper header.
  ACPICA: ACPI 6.0: Add support for XENV table.
  ACPICA: ACPI 6.0: Add support for new predefined names.
  ACPICA: ACPI 6.0: Add support for STAO table.
  ...

8 years agoACPI: Constify ACPI device IDs in documentation
Mathias Krause [Sat, 13 Jun 2015 12:27:00 +0000 (14:27 +0200)]
ACPI: Constify ACPI device IDs in documentation

ACPI device ID arrays normally don't need to be written to as they're
only ever read. The common usage -- embedding pointers to acpi_device_id
arrays in other data structures -- reference them as 'const', e.g. as in
struct acpi_driver / acpi_scan_handler / device_driver. The matchers are
taking const pointers, too. So it's only natural, to propose using const
arrays. Change the documentation accordingly.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agoACPI / enumeration: Document the rules regarding the PRP0001 device ID
Rafael J. Wysocki [Mon, 15 Jun 2015 11:48:00 +0000 (13:48 +0200)]
ACPI / enumeration: Document the rules regarding the PRP0001 device ID

Document how the ACPI device enumeration code uses the special
PRP0001 device ID.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Hanjun Guo <hanjun.guo@linaro.org>
Reviewed-by: Darren Hart <dvhart@linux.intel.com>
8 years agoACPI / video: Make acpi_video_unregister_backlight() private
Hans de Goede [Tue, 16 Jun 2015 14:28:13 +0000 (16:28 +0200)]
ACPI / video: Make acpi_video_unregister_backlight() private

acpi_video_unregister_backlight() is now only used by video_detect.c
which is part of the same acpi_video module as video.c, make
acpi_video_unregister_backlight() private to this module.

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>
8 years agoacpi-video-detect: Remove old API
Hans de Goede [Tue, 16 Jun 2015 14:28:12 +0000 (16:28 +0200)]
acpi-video-detect: Remove old API

Remove the old backlight interface selection API now that all drivers
have been ported to the new API.

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>
8 years agotoshiba-acpi: Port to new backlight interface selection API
Hans de Goede [Tue, 16 Jun 2015 14:28:11 +0000 (16:28 +0200)]
toshiba-acpi: Port to new backlight interface selection API

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

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Azael Avalos <coproscefalo@gmail.com>
Acked-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agothinkpad-acpi: Port to new backlight interface selection API
Hans de Goede [Tue, 16 Jun 2015 14:28:10 +0000 (16:28 +0200)]
thinkpad-acpi: Port to new backlight interface selection API

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

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Acked-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agosony-laptop: Port to new backlight interface selection API
Hans de Goede [Tue, 16 Jun 2015 14:28:09 +0000 (16:28 +0200)]
sony-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: Mattia Dongili <malattia@linux.it>
Acked-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agosamsung-laptop: Port to new backlight interface selection API
Hans de Goede [Tue, 16 Jun 2015 14:28:08 +0000 (16:28 +0200)]
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>
8 years agomsi-wmi: Port to new backlight interface selection API
Hans de Goede [Tue, 16 Jun 2015 14:28:07 +0000 (16:28 +0200)]
msi-wmi: Port to new backlight interface selection API

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

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>
8 years agomsi-laptop: Port to new backlight interface selection API
Hans de Goede [Tue, 16 Jun 2015 14:28:06 +0000 (16:28 +0200)]
msi-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>
8 years agointel-oaktrail: Port to new backlight interface selection API
Hans de Goede [Tue, 16 Jun 2015 14:28:05 +0000 (16:28 +0200)]
intel-oaktrail: 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>
8 years agoideapad-laptop: Port to new backlight interface selection API
Hans de Goede [Tue, 16 Jun 2015 14:28:04 +0000 (16:28 +0200)]
ideapad-laptop: Port to new backlight interface selection API

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

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>
8 years agofujitsu-laptop: Port to new backlight interface selection API
Hans de Goede [Tue, 16 Jun 2015 14:28:03 +0000 (16:28 +0200)]
fujitsu-laptop: Port to new backlight interface selection API

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

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Jonathan Woithe <jwoithe@just42.net>
Acked-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agoeeepc-laptop: Port to new backlight interface selection API
Hans de Goede [Tue, 16 Jun 2015 14:28:02 +0000 (16:28 +0200)]
eeepc-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>
8 years agodell-wmi: Port to new backlight interface selection API
Hans de Goede [Tue, 16 Jun 2015 14:28:01 +0000 (16:28 +0200)]
dell-wmi: Port to new backlight interface selection API

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

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Acked-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agodell-laptop: Port to new backlight interface selection API
Hans de Goede [Tue, 16 Jun 2015 14:28:00 +0000 (16:28 +0200)]
dell-laptop: Port to new backlight interface selection API

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

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Acked-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agocompal-laptop: Port to new backlight interface selection API
Hans de Goede [Tue, 16 Jun 2015 14:27:59 +0000 (16:27 +0200)]
compal-laptop: Port to new backlight interface selection API

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

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>
8 years agoasus-wmi: Port to new backlight interface selection API
Hans de Goede [Tue, 16 Jun 2015 14:27:58 +0000 (16:27 +0200)]
asus-wmi: 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>
8 years agoasus-laptop: Port to new backlight interface selection API
Hans de Goede [Tue, 16 Jun 2015 14:27:57 +0000 (16:27 +0200)]
asus-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>
8 years agoapple-gmux: Port to new backlight interface selection API
Hans de Goede [Tue, 16 Jun 2015 14:27:56 +0000 (16:27 +0200)]
apple-gmux: Port to new backlight interface selection API

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

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>
8 years agoacer-wmi: Port to new backlight interface selection API
Hans de Goede [Tue, 16 Jun 2015 14:27:55 +0000 (16:27 +0200)]
acer-wmi: 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>
Reviewed-by: Lee, Chun-Yi <jlee@suse.com>
Acked-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agoACPI / video: Fix acpi_video _register vs _unregister_backlight race
Hans de Goede [Tue, 16 Jun 2015 14:27:54 +0000 (16:27 +0200)]
ACPI / video: Fix acpi_video _register vs _unregister_backlight race

It is possible for a native backlight driver to load while
acpi_video_register is running, which may lead to
acpi_video_unregister_backlight being called while acpi_video_register
is running and the 2 racing against eachother.

The register_count variable protects against this, but not in a thread
safe manner, this commit adds locking to make this thread safe.

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>
8 years agoACPI / video: Move dmi_check_system from module_init to acpi_video_register
Hans de Goede [Tue, 16 Jun 2015 14:27:53 +0000 (16:27 +0200)]
ACPI / video: Move dmi_check_system from module_init to acpi_video_register

When builtin there is no guarantee in which order module_init functions
are run, so acpi_video_register() may get called from the i915 driver
(if it is also builtin) before acpi_video_init() gets called, resulting
in the dmi quirks not yet being parsed.

This commit moves the dmi_check_system() call to acpi_video_register(),
so that we can be sure the dmi quirks have always been applied before
probing.

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>
8 years agoACPI / video: Move backlight notifier to video_detect.c
Hans de Goede [Tue, 16 Jun 2015 14:27:52 +0000 (16:27 +0200)]
ACPI / video: Move backlight notifier to video_detect.c

Move the unregistering of the acpi backlight interface on registering of a
native backlight from video.c to video_detect.c where it belongs.

Note this removes support for re-registering the acpi backlight interface
when the native interface goes away. In practice this never happens and
it needlessly complicates the code.

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>
8 years agoACPI / video: Port to new backlight interface selection API
Hans de Goede [Tue, 16 Jun 2015 14:27:51 +0000 (16:27 +0200)]
ACPI / video: Port to new backlight interface selection API

Most of the patch is moving the dmi quirks for forcing use of the
acpi-video / the native backlight interface to video_detect.c.

What remains is a nice cleanup.

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>
8 years agodrm: i915: Port to new backlight interface selection API
Hans de Goede [Tue, 16 Jun 2015 14:27:50 +0000 (16:27 +0200)]
drm: i915: Port to new backlight interface selection API

This results in a nice cleanup, as we can replace the complicated logic
from should_ignore_backlight_request() with a simple check for the type
being native.

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>
8 years agoacpi-video-detect: Unregister acpi_video backlight when dmi quirks are added
Hans de Goede [Tue, 16 Jun 2015 14:27:49 +0000 (16:27 +0200)]
acpi-video-detect: Unregister acpi_video backlight when dmi quirks are added

Make acpi_video_set_dmi_backlight_type() call
acpi_video_unregister_backlight() when the new dmi quirk results in
the desired backlight interface being of a type other then
acpi_backlight_video.

This avoid the need for the second if in the following construction
which is currently found in many platform/x86 drivers:

if (prefer_vendor_quirk)
acpi_video_dmi_promote_vendor();

if (!acpi_video_backlight_support())
acpi_video_unregister_backlight()

This second if-block will be removed from the platform drivers as part
of their conversion to the new backlight interface selection API.

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>
8 years agoacpi-video-detect: Rewrite backlight interface selection logic
Hans de Goede [Tue, 16 Jun 2015 14:27:48 +0000 (16:27 +0200)]
acpi-video-detect: Rewrite backlight interface selection logic

Currently we have 2 kernel commandline options + dmi-quirks in 3 places all
interacting (in interesting ways) to select which which backlight interface
to use. On the commandline we've acpi_backlight=[video|vendor] and
video.use_native_backlight=[0|1]. DMI quirks we have in
acpi/video-detect.c, acpi/video.c and drivers/platform/x86/*.c .

This commit is the first step to cleaning this up, replacing the 2 cmdline
options with just acpi_backlight=[video|vendor|native|none], and adds a
new API to video_detect.c to reflect this.

Follow up commits will also move other related code, like unregistering the
acpi_video backlight interface if it was registered before other drivers
which take priority over it are loaded, to video_detect.c where this
logic really belongs.

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>
8 years agoacpi-video-detect: video: Make video_detect code part of the video module
Hans de Goede [Tue, 16 Jun 2015 14:27:47 +0000 (16:27 +0200)]
acpi-video-detect: video: Make video_detect code part of the video module

This is a preparation patch for the backlight interface selection logic
cleanup, there are 2 reasons to not always build the video_detect code
into the kernel:

1) In order for the video_detect.c to also deal with / select native
backlight interfaces on win8 systems, instead of doing this in video.c
where it does not belong, video_detect.c needs to call into the backlight
class code. Which cannot be done if it is builtin and the blacklight class
is not.

2) Currently all the platform/x86 drivers which have quirks to prefer
the vendor driver over acpi-video call acpi_video_unregister_backlight()
to remove the acpi-video backlight interface, this logic really belongs
in video_detect.c, which will cause video_detect.c to depend on symbols of
video.c and video.c already depends on video_detect.c symbols, so they
really need to be a single module.

Note that this commits make 2 changes so as to maintain 100% kernel
commandline compatibility:

1) The __setup call for the acpi_backlight= handling is moved to
   acpi/util.c as __setup may only be used by code which is alwasy builtin
2) video.c is renamed to acpi_video.c so that it can be combined with
   video_detect.c into video.ko

This commit also makes changes to drivers/platform/x86/Kconfig to ensure
that drivers which use acpi_video_backlight_support() from video_detect.c,
will not be built-in when acpi_video is not built in. This also changes
some "select" uses to "depends on" to avoid dependency loops.

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>
8 years agoacpi-video-detect: Move acpi_osi_is_win8 to osl.c
Hans de Goede [Tue, 16 Jun 2015 14:27:46 +0000 (16:27 +0200)]
acpi-video-detect: Move acpi_osi_is_win8 to osl.c

acpi_osi_is_win8 needs access to acpi_gbl_osi_data which is not exported,
so move it to osl.c. Alternatively we could export acpi_gbl_osi_data but
that seems undesirable.

This allows video_detect.c to be build as a module, besides that
acpi_osi_is_win8() is something which does not really belong in
video_detect.c in the first place.

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>
8 years agoacpi-video-detect: Move acpi_is_video_device() to acpi/scan.c
Hans de Goede [Tue, 16 Jun 2015 14:27:45 +0000 (16:27 +0200)]
acpi-video-detect: Move acpi_is_video_device() to acpi/scan.c

This allows video_detect.c to be build as a module, this is a preparation
patch for the backlight interface selection logic cleanup.

Note this commit also causes acpi_is_video_device() to always be build
indepedent of CONFIG_ACPI_VIDEO, as there is no reason to make its
building depend on CONFIG_ACPI_VIDEO.

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>
8 years agoacpi-video-detect: Make acpi_video_get_capabilities a private function
Hans de Goede [Tue, 16 Jun 2015 14:27:44 +0000 (16:27 +0200)]
acpi-video-detect: Make acpi_video_get_capabilities a private function

acpi_video_get_capabilities() is only used inside video_detect.c so make
it static. While at it also remove the prototype for the non existent
acpi_video_display_switch_support function from acpi.h

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>
8 years agoacpi-video-detect: Remove the unused acpi_video_dmi_demote_vendor() function
Hans de Goede [Tue, 16 Jun 2015 14:27:43 +0000 (16:27 +0200)]
acpi-video-detect: Remove the unused acpi_video_dmi_demote_vendor() function

Remove the now unused acpi_video_dmi_demote_vendor() function, this was
never a proper counter part of acpi_video_dmi_promote_vendor() since
the calls to acpi_video_dmi_promote_vendor() are not counted.

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>
8 years agoapple-gmux: Stop using acpi_video_dmi_demote_vendor()
Hans de Goede [Tue, 16 Jun 2015 14:27:42 +0000 (16:27 +0200)]
apple-gmux: Stop using acpi_video_dmi_demote_vendor()

acpi_video_dmi_demote_vendor() is going away as part of the cleanup of
the code for determinging which backlight class driver(s) to register.

The call to acpi_video_dmi_demote_vendor() was meant to undo the call to
acpi_video_dmi_promote_vendor() when the gmux device is removed, this is
questionable though since the promote call sets a flag, not a counter, so
the demote call may undo a promoto done elsewhere. Moreover in practice
this is a nop since the gmux device is never removed, and the flag is only
checked when acpi/video.ko gets loaded, so even if the user manually
removes apple-gmux the demote call is still a nop as video.ko will already
have loaded by this time.

Also note that none of the other users of acpi_video_dmi_promote_vendor()
use acpi_video_dmi_demote_vendor().

If we ever encounter a system with a gmux where the acpi-video interface
should be used, then the proper fix would be to dmi-blacklist the gmux
driver on that system.

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>
8 years agosamsung-laptop: Use acpi_video_unregister_backlight instead of acpi_video_unregister
Hans de Goede [Tue, 16 Jun 2015 14:27:41 +0000 (16:27 +0200)]
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>
8 years agoasus-wmi: Use acpi_video_unregister_backlight instead of acpi_video_unregister
Hans de Goede [Tue, 16 Jun 2015 14:27:40 +0000 (16:27 +0200)]
asus-wmi: 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 wmi_backlight_power 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) asus-wmi.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) asus-wmi.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>
8 years agoapple_gmux: Use acpi_video_unregister_backlight instead of acpi_video_unregister
Hans de Goede [Tue, 16 Jun 2015 14:27:39 +0000 (16:27 +0200)]
apple_gmux: 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) 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) apple-gmux.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) apple-gmux.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: Seth Forshee <seth.forshee@canonical.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>
8 years agoACPI / PNP: Avoid conflicting resource reservations
Rafael J. Wysocki [Thu, 18 Jun 2015 16:32:02 +0000 (18:32 +0200)]
ACPI / PNP: Avoid conflicting resource reservations

Commit b9a5e5e18fbf "ACPI / init: Fix the ordering of
acpi_reserve_resources()" overlooked the fact that the memory
and/or I/O regions reserved by acpi_reserve_resources() may
conflict with those reserved by the PNP "system" driver.

If that conflict actually takes place, it causes the reservations
made by the "system" driver to fail while before commit b9a5e5e18fbf
all reservations made by it and by acpi_reserve_resources() would be
successful.  In turn, that allows the resources that haven't been
reserved by the "system" driver to be used by others (e.g. PCI) which
sometimes leads to functional problems (up to and including boot
failures).

To fix that issue, introduce a common resource reservation routine,
acpi_reserve_region(), to be used by both acpi_reserve_resources()
and the "system" driver, that will track all resources reserved by
it and avoid making conflicting requests.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=99831
Link: http://marc.info/?t=143389402600001&r=1&w=2
Fixes: b9a5e5e18fbf "ACPI / init: Fix the ordering of acpi_reserve_resources()"
Reported-by: Roland Dreier <roland@purestorage.com>
Cc: All applicable <stable@vger.kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agocpufreq: dt: allow driver to boot automatically
Felipe Balbi [Fri, 8 May 2015 19:57:30 +0000 (14:57 -0500)]
cpufreq: dt: allow driver to boot automatically

by adding the missing MODULE_ALIAS(), cpufreq-dt
can be autoloaded by udev/systemd.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Acked-by: Nishanth Menon <nm@ti.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agointel_pstate: Fix overflow in busy_scaled due to long delay
Prarit Bhargava [Mon, 15 Jun 2015 17:43:29 +0000 (13:43 -0400)]
intel_pstate: Fix overflow in busy_scaled due to long delay

The kernel may delay interrupts for a long time which can result in timers
being delayed. If this occurs the intel_pstate driver will crash with a
divide by zero error:

divide error: 0000 [#1] SMP
Modules linked in: btrfs zlib_deflate raid6_pq xor msdos ext4 mbcache jbd2 binfmt_misc arc4 md4 nls_utf8 cifs dns_resolver tcp_lp bnep bluetooth rfkill fuse dm_service_time iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi nf_conntrack_netbios_ns nf_conntrack_broadcast nf_conntrack_ftp ip6t_rpfilter ip6t_REJECT ipt_REJECT xt_conntrack ebtable_nat ebtable_broute bridge stp llc ebtable_filter ebtables ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 ip6table_mangle ip6table_security ip6table_raw ip6table_filter ip6_tables iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack iptable_mangle iptable_security iptable_raw iptable_filter ip_tables intel_powerclamp coretemp vfat fat kvm_intel iTCO_wdt iTCO_vendor_support ipmi_devintf sr_mod kvm crct10dif_pclmul
 crc32_pclmul crc32c_intel ghash_clmulni_intel aesni_intel cdc_ether lrw usbnet cdrom mii gf128mul glue_helper ablk_helper cryptd lpc_ich mfd_core pcspkr sb_edac edac_core ipmi_si ipmi_msghandler ioatdma wmi shpchp acpi_pad nfsd auth_rpcgss nfs_acl lockd uinput dm_multipath sunrpc xfs libcrc32c usb_storage sd_mod crc_t10dif crct10dif_common ixgbe mgag200 syscopyarea sysfillrect sysimgblt mdio drm_kms_helper ttm igb drm ptp pps_core dca i2c_algo_bit megaraid_sas i2c_core dm_mirror dm_region_hash dm_log dm_mod
CPU: 113 PID: 0 Comm: swapper/113 Tainted: G        W   --------------   3.10.0-229.1.2.el7.x86_64 #1
Hardware name: IBM x3950 X6 -[3837AC2]-/00FN827, BIOS -[A8E112BUS-1.00]- 08/27/2014
task: ffff880fe8abe660 ti: ffff880fe8ae4000 task.ti: ffff880fe8ae4000
RIP: 0010:[<ffffffff814a9279>]  [<ffffffff814a9279>] intel_pstate_timer_func+0x179/0x3d0
RSP: 0018:ffff883fff4e3db8  EFLAGS: 00010206
RAX: 0000000027100000 RBX: ffff883fe6965100 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000010 RDI: 000000002e53632d
RBP: ffff883fff4e3e20 R08: 000e6f69a5a125c0 R09: ffff883fe84ec001
R10: 0000000000000002 R11: 0000000000000005 R12: 00000000000049f5
R13: 0000000000271000 R14: 00000000000049f5 R15: 0000000000000246
FS:  0000000000000000(0000) GS:ffff883fff4e0000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f7668601000 CR3: 000000000190a000 CR4: 00000000001407e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Stack:
 ffff883fff4e3e58 ffffffff81099dc1 0000000000000086 0000000000000071
 ffff883fff4f3680 0000000000000071 fbdc8a965e33afee ffffffff810b69dd
 ffff883fe84ec000 ffff883fe6965108 0000000000000100 ffffffff814a9100
Call Trace:
 <IRQ>

 [<ffffffff81099dc1>] ? run_posix_cpu_timers+0x51/0x840
 [<ffffffff810b69dd>] ? trigger_load_balance+0x5d/0x200
 [<ffffffff814a9100>] ? pid_param_set+0x130/0x130
 [<ffffffff8107df56>] call_timer_fn+0x36/0x110
 [<ffffffff814a9100>] ? pid_param_set+0x130/0x130
 [<ffffffff8107fdcf>] run_timer_softirq+0x21f/0x320
 [<ffffffff81077b2f>] __do_softirq+0xef/0x280
 [<ffffffff816156dc>] call_softirq+0x1c/0x30
 [<ffffffff81015d95>] do_softirq+0x65/0xa0
 [<ffffffff81077ec5>] irq_exit+0x115/0x120
 [<ffffffff81616355>] smp_apic_timer_interrupt+0x45/0x60
 [<ffffffff81614a1d>] apic_timer_interrupt+0x6d/0x80
 <EOI>

 [<ffffffff814a9c32>] ? cpuidle_enter_state+0x52/0xc0
 [<ffffffff814a9c28>] ? cpuidle_enter_state+0x48/0xc0
 [<ffffffff814a9d65>] cpuidle_idle_call+0xc5/0x200
 [<ffffffff8101d14e>] arch_cpu_idle+0xe/0x30
 [<ffffffff810c67c1>] cpu_startup_entry+0xf1/0x290
 [<ffffffff8104228a>] start_secondary+0x1ba/0x230
Code: 42 0f 00 45 89 e6 48 01 c2 43 8d 44 6d 00 39 d0 73 26 49 c1 e5 08 89 d2 4d 63 f4 49 63 c5 48 c1 e2 08 48 c1 e0 08 48 63 ca 48 99 <48> f7 f9 48 98 4c 0f af f0 49 c1 ee 08 8b 43 78 c1 e0 08 44 29
RIP  [<ffffffff814a9279>] intel_pstate_timer_func+0x179/0x3d0
 RSP <ffff883fff4e3db8>

The kernel values for cpudata for CPU 113 were:

struct cpudata {
  cpu = 113,
  timer = {
    entry = {
      next = 0x0,
      prev = 0xdead000000200200
    },
    expires = 8357799745,
    base = 0xffff883fe84ec001,
    function = 0xffffffff814a9100 <intel_pstate_timer_func>,
    data = 18446612406765768960,
<snip>
    i_gain = 0,
    d_gain = 0,
    deadband = 0,
    last_err = 22489
  },
  last_sample_time = {
    tv64 = 4063132438017305
  },
  prev_aperf = 287326796397463,
  prev_mperf = 251427432090198,
  sample = {
    core_pct_busy = 23081,
    aperf = 2937407,
    mperf = 3257884,
    freq = 2524484,
    time = {
      tv64 = 4063149215234118
    }
  }
}

which results in the time between samples = last_sample_time - sample.time
4063149215234118 - 4063132438017305 = 16777216813 which is 16.777 seconds.

The duration between reads of the APERF and MPERF registers overflowed a s32
sized integer in intel_pstate_get_scaled_busy()'s call to div_fp().  The result
is that int_tofp(duration_us) == 0, and the kernel attempts to divide by 0.

While the kernel shouldn't be delaying for a long time, it can and does
happen and the intel_pstate driver should not panic in this situation.  This
patch changes the div_fp() function to use div64_s64() to allow for "long"
division.  This will avoid the overflow condition on long delays.

[v2]: use div64_s64() in div_fp()

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agoMerge branch 'acpi-scan' into acpi-video
Rafael J. Wysocki [Tue, 16 Jun 2015 17:59:09 +0000 (19:59 +0200)]
Merge branch 'acpi-scan' into acpi-video

8 years agoPM / clk: Print acquired clock name in addition to con_id
Geert Uytterhoeven [Fri, 29 May 2015 16:35:31 +0000 (18:35 +0200)]
PM / clk: Print acquired clock name in addition to con_id

Currently the con_id of the acquired clock is printed for debugging
purposes.  But in several cases, the con_id is NULL, which doesn't
provide much debugging information when printed.  These cases are:
  - When explicitly passing a NULL con_id (which means the first clock
    tied to the device, if available),
  - When not using pm_clk_add(), but pm_clk_add_clk() (which takes a
    "struct clk *" directly).

Hence print the actual clock name in addition to (and not instead of;
thanks Grygorii Strashko!) the con_id.

Note that the clock name is not available with legacy clock frameworks,
and the hex pointer address will be printed instead.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Grygorii Strashko <grygorii.strashko@linaro.org>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agoPM / Domains: Skip timings during syscore suspend/resume
Geert Uytterhoeven [Fri, 29 May 2015 15:24:23 +0000 (17:24 +0200)]
PM / Domains: Skip timings during syscore suspend/resume

The PM Domain code uses ktime_get() to perform various latency
measurements.  However, if ktime_get() is called while timekeeping is
suspended, the following warning is printed:

    WARNING: CPU: 0 PID: 1340 at kernel/time/timekeeping.c:576 ktime_get+0x3

This happens when resuming the PM Domain that contains the clock events
source, which calls pm_genpd_syscore_poweron(). Chain of operations is:

    timekeeping_resume()
    {
clockevents_resume()
    sh_cmt_clock_event_resume()
pm_genpd_syscore_poweron()
    pm_genpd_sync_poweron()
genpd_syscore_switch()
    genpd_power_on()
ktime_get(), but timekeeping_suspended == 1
...
timekeeping_suspended = 0;
    }

Fix this by adding a "timed" parameter to genpd_power_{on,off}() and
pm_genpd_sync_power{off,on}(), to indicate whether latency measurements
are allowed.  This parameter is passed as false in
genpd_syscore_switch() (i.e. during syscore suspend/resume), and true in
all other cases.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agocpufreq: qoriq: optimize the CPU frequency switching time
Tang Yuantian [Thu, 4 Jun 2015 06:25:42 +0000 (14:25 +0800)]
cpufreq: qoriq: optimize the CPU frequency switching time

Each time the CPU switches its frequency, the clock nodes in
DTS are walked through to find proper clock source. This is
very time-consuming, for example, it is up to 500+ us on T4240.
Besides, switching time varies from clock to clock.
To optimize this, each input clock of CPU is buffered, so that
it can be picked up instantly when needed.

Since for each CPU each input clock is stored in a pointer
which takes 4 or 8 bytes memory and normally there are several
input clocks per CPU, that will not take much memory as well.

Signed-off-by: Tang Yuantian <Yuantian.Tang@freescale.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agocpufreq: gx-suspmod: Fix two typos in two comments
Shailendra Verma [Sat, 23 May 2015 05:06:49 +0000 (10:36 +0530)]
cpufreq: gx-suspmod: Fix two typos in two comments

Signed-off-by: Shailendra Verma <shailendra.capricorn@gmail.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agocpufreq: nforce2: Fix typo in comment to function nforce2_init()
Shailendra Verma [Sat, 23 May 2015 05:06:18 +0000 (10:36 +0530)]
cpufreq: nforce2: Fix typo in comment to function nforce2_init()

Signed-off-by: Shailendra Verma <shailendra.capricorn@gmail.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agocpufreq: governor: Serialize governor callbacks
Viresh Kumar [Wed, 3 Jun 2015 10:27:13 +0000 (15:57 +0530)]
cpufreq: governor: Serialize governor callbacks

There are several races reported in cpufreq core around governors (only
ondemand and conservative) by different people.

There are at least two race scenarios present in governor code:
 (a) Concurrent access/updates of governor internal structures.

 It is possible that fields such as 'dbs_data->usage_count', etc.  are
 accessed simultaneously for different policies using same governor
 structure (i.e. CPUFREQ_HAVE_GOVERNOR_PER_POLICY flag unset). And
 because of this we can dereference bad pointers.

 For example consider a system with two CPUs with separate 'struct
 cpufreq_policy' instances. CPU0 governor: ondemand and CPU1: powersave.
 CPU0 switching to powersave and CPU1 to ondemand:
CPU0 CPU1

store* store*

cpufreq_governor_exit() cpufreq_governor_init()
dbs_data = cdata->gdbs_data;

if (!--dbs_data->usage_count)
kfree(dbs_data);

dbs_data->usage_count++;
*Bad pointer dereference*

 There are other races possible between EXIT and START/STOP/LIMIT as
 well. Its really complicated.

 (b) Switching governor state in bad sequence:

 For example trying to switch a governor to START state, when the
 governor is in EXIT state. There are some checks present in
 __cpufreq_governor() but they aren't sufficient as they compare events
 against 'policy->governor_enabled', where as we need to take governor's
 state into account, which can be used by multiple policies.

These two issues need to be solved separately and the responsibility
should be properly divided between cpufreq and governor core.

The first problem is more about the governor core, as it needs to
protect its structures properly. And the second problem should be fixed
in cpufreq core instead of governor, as its all about sequence of
events.

This patch is trying to solve only the first problem.

There are two types of data we need to protect,
- 'struct common_dbs_data': No matter what, there is going to be a
  single copy of this per governor.
- 'struct dbs_data': With CPUFREQ_HAVE_GOVERNOR_PER_POLICY flag set, we
  will have per-policy copy of this data, otherwise a single copy.

Because of such complexities, the mutex present in 'struct dbs_data' is
insufficient to solve our problem. For example we need to protect
fetching of 'dbs_data' from different structures at the beginning of
cpufreq_governor_dbs(), to make sure it isn't currently being updated.

This can be fixed if we can guarantee serialization of event parsing
code for an individual governor. This is best solved with a mutex per
governor, and the placeholder for that is 'struct common_dbs_data'.

And so this patch moves the mutex from 'struct dbs_data' to 'struct
common_dbs_data' and takes it at the beginning and drops it at the end
of cpufreq_governor_dbs().

Tested with and without following configuration options:

CONFIG_LOCKDEP_SUPPORT=y
CONFIG_DEBUG_RT_MUTEXES=y
CONFIG_DEBUG_PI_LIST=y
CONFIG_DEBUG_SPINLOCK=y
CONFIG_DEBUG_MUTEXES=y
CONFIG_DEBUG_LOCK_ALLOC=y
CONFIG_PROVE_LOCKING=y
CONFIG_LOCKDEP=y
CONFIG_DEBUG_ATOMIC_SLEEP=y

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Preeti U Murthy <preeti@linux.vnet.ibm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agocpufreq: governor: split cpufreq_governor_dbs()
Viresh Kumar [Thu, 4 Jun 2015 11:13:27 +0000 (16:43 +0530)]
cpufreq: governor: split cpufreq_governor_dbs()

cpufreq_governor_dbs() is hardly readable, it is just too big and
complicated. Lets make it more readable by splitting out event specific
routines.

Order of statements is changed at few places, but that shouldn't bring
any functional change.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Preeti U Murthy <preeti@linux.vnet.ibm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agocpufreq: governor: register notifier from cs_init()
Viresh Kumar [Wed, 3 Jun 2015 10:27:11 +0000 (15:57 +0530)]
cpufreq: governor: register notifier from cs_init()

Notifiers are required only for conservative governor and the common
governor code is unnecessarily polluted with that. Handle that from
cs_init/exit() instead of cpufreq_governor_dbs().

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Preeti U Murthy <preeti@linux.vnet.ibm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agoufs: fix TRUE and FALSE re-define build error
Suthikulpanit, Suravee [Wed, 10 Jun 2015 16:08:58 +0000 (11:08 -0500)]
ufs: fix TRUE and FALSE re-define build error

Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Cc: Vinayak Holikatti <vinholikatti@gmail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agomegaraid_sas: fix TRUE and FALSE re-define build error
Suthikulpanit, Suravee [Wed, 10 Jun 2015 16:08:57 +0000 (11:08 -0500)]
megaraid_sas: fix TRUE and FALSE re-define build error

Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Cc: Kashyap Desai <kashyap.desai@avagotech.com>
Cc: Sumit Saxena <sumit.saxena@avagotech.com>
Cc: Uday Lingala <uday.lingala@avagotech.com>
Acked-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agoamd-xgbe: Unify coherency checking logic with device_dma_is_coherent()
Suthikulpanit, Suravee [Wed, 10 Jun 2015 16:08:56 +0000 (11:08 -0500)]
amd-xgbe: Unify coherency checking logic with device_dma_is_coherent()

Currently, amd-xgbe driver has separate logic to determine device
coherency for DT vs. ACPI. This patch simplifies the code with
a call to device_dma_is_coherent().

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agocrypto: ccp - Unify coherency checking logic with device_dma_is_coherent()
Suthikulpanit, Suravee [Wed, 10 Jun 2015 16:08:55 +0000 (11:08 -0500)]
crypto: ccp - Unify coherency checking logic with device_dma_is_coherent()

Currently, the driver has separate logic to determine device coherency
for DT vs ACPI.  This patch simplifies the code with a call to
device_dma_is_coherent().

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agodevice property: Introduces device_dma_is_coherent()
Suthikulpanit, Suravee [Wed, 10 Jun 2015 16:08:54 +0000 (11:08 -0500)]
device property: Introduces device_dma_is_coherent()

Currently, device drivers, which support both OF and ACPI,
need to call two separate APIs, of_dma_is_coherent() and
acpi_dma_is_coherent()) to determine device coherency attribute.

This patch simplifies this process by introducing a new device
property API, device_dma_is_coherent(), which calls the appropriate
interface based on the booting architecture.

Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agoarm64 : Introduce support for ACPI _CCA object
Suthikulpanit, Suravee [Wed, 10 Jun 2015 16:08:53 +0000 (11:08 -0500)]
arm64 : Introduce support for ACPI _CCA object

section 6.2.17 _CCA states that ARM platforms require ACPI _CCA
object to be specified for DMA-cabpable devices. Therefore, this patch
specifies ACPI_CCA_REQUIRED in arm64 Kconfig.

In addition, to handle the case when _CCA is missing, arm64 would assign
dummy_dma_ops to disable DMA capability of the device.

Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Mark Salter <msalter@redhat.com>
Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agoACPI / scan: Parse _CCA and setup device coherency
Suthikulpanit, Suravee [Wed, 10 Jun 2015 16:08:52 +0000 (11:08 -0500)]
ACPI / scan: Parse _CCA and setup device coherency

This patch implements support for ACPI _CCA object, which is introduced in
ACPIv5.1, can be used for specifying device DMA coherency attribute.

The parsing logic traverses device namespace to parse coherency
information, and stores it in acpi_device_flags. Then uses it to call
arch_setup_dma_ops() when creating each device enumerated in DSDT
during ACPI scan.

This patch also introduces acpi_dma_is_coherent(), which provides
an interface for device drivers to check the coherency information
similarly to the of_dma_is_coherent().

Signed-off-by: Mark Salter <msalter@redhat.com>
Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agoMerge branch 'acpi-scan' into acpi-cca
Rafael J. Wysocki [Mon, 15 Jun 2015 12:38:55 +0000 (14:38 +0200)]
Merge branch 'acpi-scan' into acpi-cca

8 years agoACPI / EC: Fix a code coverity issue when QR_EC transactions are failed.
Lv Zheng [Thu, 11 Jun 2015 05:21:51 +0000 (13:21 +0800)]
ACPI / EC: Fix a code coverity issue when QR_EC transactions are failed.

When the QR_EC transaction fails, the EC_FLAGS_QUERY_PENDING flag prevents
the event handling work queue from being scheduled again.

Though there shouldn't be failed QR_EC transactions, and this gap was
efficiently used for catching and learning the SCI_EVT clearing timing
compliance issues, we need to fix this as we are not fully compatible
with all platforms/Windows to handle SCI_EVT clearing timing correctly.
Fixing this gives the EC driver the chances to recover from a state machine
failure.

So this patch fixes this issue. When nr_pending_queries drops to 0, it
clears EC_FLAGS_QUERY_PENDING at the proper position for different modes in
order to ensure that the SCI_EVT handling can proceed.

In order to be clearer for future ec_event_clearing modes, all checks in
this patch are written in the inclusive style, not the exclusive style.

Cc: 3.16+ <stable@vger.kernel.org> # 3.16+
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agoACPI / EC: Fix EC_FLAGS_QUERY_HANDSHAKE platforms using new event clearing timing.
Lv Zheng [Thu, 11 Jun 2015 05:21:45 +0000 (13:21 +0800)]
ACPI / EC: Fix EC_FLAGS_QUERY_HANDSHAKE platforms using new event clearing timing.

It is reported that on several platforms, EC firmware will not respond
non-expected QR_EC (see EC_FLAGS_QUERY_HANDSHAKE, only write QR_EC when
SCI_EVT is set).

Unfortunately, ACPI specification doesn't define when the SCI_EVT should be
cleared by the firmware, thus the original implementation queued up second
QR_EC right after writing QR_EC command and before reading the returned
event value as at that time the SCI_EVT is ensured not cleared. This
behavior is also based on the assumption that the firmware should be able
to return 0x00 to indicate "no outstanding event". This behavior did fix
issues on Samsung platforms where the spurious query value of 0x00 is
supported and didn't break platforms in my test queue.

But recently, specific Acer, Asus, Lenovo platforms keep on blaming this
change.

This patch changes the behavior to re-check the SCI_EVT a bit later and
removes EC_FLAGS_QUERY_HANDSHAKE quirks, hoping this is the Windows
compliant EC driver behavior.

In order to be robust to the possible regressions, instead of removing the
quirk directly, this patch keeps the quirk code, removes the quirk users
and keeps old behavior for Samsung platforms.

Cc: 3.16+ <stable@vger.kernel.org> # 3.16+
Link: https://bugzilla.kernel.org/show_bug.cgi?id=94411
Link: https://bugzilla.kernel.org/show_bug.cgi?id=97381
Link: https://bugzilla.kernel.org/show_bug.cgi?id=98111
Reported-and-tested-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
Reported-and-tested-by: Tigran Gabrielyan <tigrangab@gmail.com>
Reported-and-tested-by: Adrien D <ghbdtn@openmailbox.org>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agoACPI / EC: Add event clearing variation support.
Lv Zheng [Thu, 11 Jun 2015 05:21:38 +0000 (13:21 +0800)]
ACPI / EC: Add event clearing variation support.

We've been suffering from the uncertainty of the SCI_EVT clearing timing.
This patch implements 3 of 4 possible modes to handle SCI_EVT clearing
variations. The old behavior is kept in this patch.

Status: QR_EC is re-checked as early as possible after checking previous
        SCI_EVT. This always leads to 2 QR_EC transactions per SCI_EVT
        indication and the target may implement event queue which returns
        0x00 indicating "no outstanding event".
        This is proven to be a conflict against Windows behavior, but is
        still kept in this patch to make the EC driver robust to the
        possible regressions that may occur on Samsung platforms.
Query: QR_EC is re-checked after the target has handled the QR_EC query
       request command pushed by the host.
Event: QR_EC is re-checked after the target has noticed the query event
       response data pulled by the host.
       This timing is not determined by any IRQs, so we may need to use a
       guard period in this mode, which may explain the existence of the
       ec_guard() code used by the old EC driver where the re-check timing
       is implemented in the similar way as this mode.
Method: QR_EC is re-checked as late as possible after completing the _Qxx
        evaluation. The target may implement SCI_EVT like a level triggered
        interrupt.
        It is proven on kernel bugzilla 94411 that, Windows will have all
        _Qxx evaluations parallelized. Thus unless required by further
        evidences, we needn't implement this mode as it is a conflict of
        the _Qxx parallelism requirement.

Note that, according to the reports, there are platforms that cannot be
handled using the "Status" mode without enabling the
EC_FLAGS_QUERY_HANDSHAKE quirk. But they can be handled with the other
modes according to the tests (kernel bugzilla 97381).

The following log entry can be used to confirm the differences of the 3
modes as it should appear at the different positions for the 3 modes:
  Command(QR_EC) unblocked
Status: appearing after
         EC_SC(W) = 0x84
Query: appearing after
         EC_DATA(R) = 0xXX
       where XX is the event number used to determine _QXX
Event: appearing after first
         EC_SC(R) = 0xX0 SCI_EVT=x BURST=0 CMD=0 IBF=0 OBF=0
       that is next to the following log entry:
         Command(QR_EC) completed by hardware

Link: https://bugzilla.kernel.org/show_bug.cgi?id=94411
Link: https://bugzilla.kernel.org/show_bug.cgi?id=97381
Link: https://bugzilla.kernel.org/show_bug.cgi?id=98111
Reported-and-tested-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
Reported-and-tested-by: Tigran Gabrielyan <tigrangab@gmail.com>
Reported-and-tested-by: Adrien D <ghbdtn@openmailbox.org>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agoACPI / EC: Convert event handling work queue into loop style.
Lv Zheng [Thu, 11 Jun 2015 05:21:32 +0000 (13:21 +0800)]
ACPI / EC: Convert event handling work queue into loop style.

During the period that a work queue is scheduled (queued up for run) but
hasn't been run, second schedule_work() could fail. This may not lead to
the loss of queries because QR_EC is always ensured to be submitted after
the work queue has been in the running state.

The event handling work queue can be changed into the loop style to allow
us to control the code in a more flexible way:
1. Makes it possible to add event=0x00 termination condition in the loop.
2. Increases the thoughput of the QR_EC transactions as the 2nd+ QR_EC
   transactions may be handled in the same work item used for the 1st QR_EC
   transaction, thus the delay caused by the 2nd+ work item scheduling can
   be eliminated.

Except the logging message changes and the throughput improvement, this
patch is just a funcitonal no-op.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Tested-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
Tested-by: Tigran Gabrielyan <tigrangab@gmail.com>
Tested-by: Adrien D <ghbdtn@openmailbox.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agoACPI / EC: Cleanup transaction state transition.
Lv Zheng [Thu, 11 Jun 2015 05:21:23 +0000 (13:21 +0800)]
ACPI / EC: Cleanup transaction state transition.

This patch collects transaction state transition code into one function. We
then could have a single function to maintain transaction transition
related behaviors. No functional changes.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Tested-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
Tested-by: Tigran Gabrielyan <tigrangab@gmail.com>
Tested-by: Adrien D <ghbdtn@openmailbox.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agoACPI / scan: constify ACPI device ids
Mathias Krause [Sat, 13 Jun 2015 12:26:58 +0000 (14:26 +0200)]
ACPI / scan: constify ACPI device ids

Make the button ACPI device ID array static const. Safes us a little bit
of code.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agoACPI / processor: constify DMI system id table
Mathias Krause [Sat, 13 Jun 2015 12:26:57 +0000 (14:26 +0200)]
ACPI / processor: constify DMI system id table

There is no need to have processor_power_dmi_table[] writeable, constify
it.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agoACPI / HED: constify ACPI device ids
Mathias Krause [Sat, 13 Jun 2015 12:26:56 +0000 (14:26 +0200)]
ACPI / HED: constify ACPI device ids

Constify the acpi_hed_ids[] ACPI device IDs array -- no need to have it
writeable.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agoACPI / LPSS: constify device descriptors
Mathias Krause [Sat, 13 Jun 2015 12:26:50 +0000 (14:26 +0200)]
ACPI / LPSS: constify device descriptors

The device descriptors are never written to -- even pointed to as
'const' from struct lpss_private_data. Make them r/o for real.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agoACPI / battery: mark DMI table as __initconst
Mathias Krause [Sat, 13 Jun 2015 12:26:55 +0000 (14:26 +0200)]
ACPI / battery: mark DMI table as __initconst

The bat_dmi_table[] DMI table is referenced from the __init function
acpi_battery_init_async() only. It and its referenced functions can
therefore be marked __initconst to free up ~1kB of runtime memory after
initialization is done.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agoACPI / battery: minor tweaks to acpi_battery_units()
Mathias Krause [Sat, 13 Jun 2015 12:26:54 +0000 (14:26 +0200)]
ACPI / battery: minor tweaks to acpi_battery_units()

Make the acpi_battery_units() function take a const argument and return
a const char*, too. Also make it static. It probably doesn't matter, as
gcc will be clever enough to optimize and inline the code even without
these hints. However, we also get rid of a #ifdef block by moving the
function closer to its usage location, so it's at least a small gain in
code readability.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agoACPI / battery: constify the offset tables
Mathias Krause [Sat, 13 Jun 2015 12:26:53 +0000 (14:26 +0200)]
ACPI / battery: constify the offset tables

The offset tables are only read, not modified. Make them const.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agoACPI / AC: constify DMI system id table
Mathias Krause [Sat, 13 Jun 2015 12:26:49 +0000 (14:26 +0200)]
ACPI / AC: constify DMI system id table

There is no need to have ac_dmi_table[] writeable, constify it.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agoACPI / video: constify ACPI and DMI id tables
Mathias Krause [Sat, 13 Jun 2015 12:26:59 +0000 (14:26 +0200)]
ACPI / video: constify ACPI and DMI id tables

Make the video ACPI device ID array static and constify the DMI system
IDs array.  Saves us a little bit of code.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agoACPI / video: Add a parameter to not register the backlight sysfs interface
Hans de Goede [Tue, 9 Jun 2015 08:32:25 +0000 (10:32 +0200)]
ACPI / video: Add a parameter to not register the backlight sysfs interface

On some systems acpi-video backlight is broken in the sense that it cannot
control the brightness of the backlight, but it must still be called on
resume to power-up the backlight after resume.

This commit allows these systems to work by going through all the usual
backlight control moves, while not registering a sysfs backlight
interface.

This commit also adds a quirk enabling this parameter on Toshiba Portege
R830 systems which are known to be affected by this.

I wish there was a better way to deal with this, but we've been unable to
find one.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=21012
Link: https://bugs.freedesktop.org/show_bug.cgi?id=82634
Reported-and-tested-by: Sylvain Pasche <sylvain.pasche@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Aaron Lu <aaron.lu@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agoACPI / video: Add enable_native_backlight quirk for MacbookPro12,1
Hans de Goede [Thu, 28 May 2015 16:29:48 +0000 (18:29 +0200)]
ACPI / video: Add enable_native_backlight quirk for MacbookPro12,1

It seems that the latest generation of MacbookPro needs to use the
native backlight driver, just like most modern laptops do, but it does
not automatically get enabled as the Apple BIOS does not advertise
Windows 8 compatibility. So add a quirk for this.

Reported-by: Christopher Beland <beland@alum.mit.edu>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
8 years agoLinux 4.1-rc8 v4.1-rc8
Linus Torvalds [Mon, 15 Jun 2015 01:51:10 +0000 (15:51 -1000)]
Linux 4.1-rc8

8 years agoMerge branch 'fixes' of git://git.infradead.org/users/vkoul/slave-dma
Linus Torvalds [Mon, 15 Jun 2015 01:48:26 +0000 (15:48 -1000)]
Merge branch 'fixes' of git://git.infradead.org/users/vkoul/slave-dma

Pull dmaengine fixes from Vinod Koul:
 "Here are hopefully last set of fixes for 4.1. This time we have:

   - fixing pause capability reporting on both dmaengine pause & resume
     support by Krzysztof

   - locking fix fir at_xdmac by Ludovic

   - slave configuration fix for at_xdmac by Ludovic"

* 'fixes' of git://git.infradead.org/users/vkoul/slave-dma:
  dmaengine: Fix choppy sound because of unimplemented resume
  dmaengine: at_xdmac: rework slave configuration part
  dmaengine: at_xdmac: lock fixes

8 years agoMerge tag 'ntb-4.1' of git://github.com/jonmason/ntb
Linus Torvalds [Mon, 15 Jun 2015 01:46:43 +0000 (15:46 -1000)]
Merge tag 'ntb-4.1' of git://github.com/jonmason/ntb

Pull NTB fixes from Jon Mason:
 "I apologize for the tardiness of this request.  Here are a couple of
  last minute NTB bug fixes for v4.1:

  NTB bug fixes to address issues in unmapping the MW reg base and
  vbase, and an uninitialized variable on Atom platforms"

* tag 'ntb-4.1' of git://github.com/jonmason/ntb:
  ntb: initialize max_mw for Atom before using it
  ntb: iounmap MW reg and vbase in error path

8 years agoMerge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus
Linus Torvalds [Mon, 15 Jun 2015 01:38:57 +0000 (15:38 -1000)]
Merge branch 'upstream' of git://git.linux-mips.org/ralf/upstream-linus

Pull more MIPS fixes from Ralf Baechle:
 "Another round of 4.1 MIPS fixes, one fix to a MIPS-specific #if
  condition in lib/mpi, one fix to the MIPS GIC irqchip driver and one
  SSB fix.

  Details:
   - fix handling of clock in chipco SSB driver.
   - fix two MIPS-specific #if conditions to correctly work for GCC 5.1.
   - fix damage to R6 pgtable bits done by XPA support.
   - fix possible crash due to unloading modules that contain statically
     defined platform devices.
   - fix disabling of the MSA ASE on context switch to also work
     correctly when a new thread/process has the CPU for the very first
     time.

  This is part of linux-next and has been beaten to death on
  Imagination's test farm.

  While things are not looking too grim this pull request also means the
  rate of fixes for 4.1 remains nearly constant so I'd not be unhappy if
  you'd delay the release"

* 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus:
  MPI: MIPS: Fix compilation error with GCC 5.1
  IRQCHIP: mips-gic: Don't nest calls to do_IRQ()
  MIPS: MSA: bugfix - disable MSA correctly for new threads/processes.
  MIPS: Loongson: Do not register 8250 platform device from module.
  MIPS: Cobalt: Do not build MTD platform device registration code as module.
  SSB: Fix handling of ssb_pmu_get_alp_clock()
  MIPS: pgtable-bits: Fix XPA damage to R6 definitions.

8 years agoMerge branch 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Mon, 15 Jun 2015 00:53:02 +0000 (14:53 -1000)]
Merge branch 'irq-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull irqchip fix from Thomas Gleixner:
 "A single fix for an off by one bug in the sunxi irqchip driver"

* 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  irqchip: sunxi-nmi: Fix off-by-one error in irq iterator

8 years agoMerge branch 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Mon, 15 Jun 2015 00:03:11 +0000 (14:03 -1000)]
Merge branch 'locking-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull lockdep fix from Ingo Molnar:
 "A lockdep/modules unload race fix that can oops"

* 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  lockdep: Fix a race between /proc/lock_stat and module unload

8 years agoMerge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Mon, 15 Jun 2015 00:00:13 +0000 (14:00 -1000)]
Merge branch 'perf-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull perf fixes from Ingo Molnar:
 "A regression fix for a crash, and a Intel HSW uncore PMU driver fix"

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  Revert "perf/x86/intel/uncore: Move uncore_box_init() out of driver initialization"
  perf/x86/intel/uncore: Fix CBOX bit wide and UBOX reg on Haswell-EP

8 years agoMerge tag 'sound-4.1-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai...
Linus Torvalds [Sun, 14 Jun 2015 23:55:24 +0000 (13:55 -1000)]
Merge tag 'sound-4.1-rc8' of git://git./linux/kernel/git/tiwai/sound

Pull sound fixes from Takashi Iwai:
 "Most of commits are regression fixes for HD-audio: a few corner case
  fixes for regmap transition, and i915 binding issues.

  In addition, a quirk for another USB-audio device supporting DSD"

* tag 'sound-4.1-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  ALSA: hda - Abort the probe without i915 binding for HSW/BDW
  ALSA: hda - Re-add the lost fake mute support
  ALSA: hda - Continue probing even if i915 binding fails
  ALSA: hda - Don't actually write registers for caps overwrites
  ALSA: hda - fix number of devices query on hotplug
  ALSA: usb-audio: add native DSD support for JLsounds I2SoverUSB

8 years agoMPI: MIPS: Fix compilation error with GCC 5.1
Jaedon Shin [Fri, 12 Jun 2015 09:04:14 +0000 (18:04 +0900)]
MPI: MIPS: Fix compilation error with GCC 5.1

This patch fixes mips compilation error:

lib/mpi/generic_mpih-mul1.c: In function 'mpihelp_mul_1':
lib/mpi/longlong.h:651:2: error: impossible constraint in 'asm'

Signed-off-by: Jaedon Shin <jaedon.shin@gmail.com>
Cc: Linux-MIPS <linux-mips@linux-mips.org>
Patchwork: https://patchwork.linux-mips.org/patch/10546/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>