Commit 923a327e authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'acpi-6.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull ACPI updates from Rafael Wysocki:
 "The only kind of new feature added by these is the hwmon interface
  support in the ACPI fan driver. Apart from that, they mostly address
  issues and clean up code.

  Specifics:

   - Switch the ACPI x86 utility code and the ACPI LPSS driver to new
     Intel CPU model defines (Tony Luck)

   - Add hwmon interface support to the ACPI fan driver (Armin Wolf)

   - Add sysfs entry for guaranteed performance to the ACPI CPPC library
     and replace a ternary operator with umax() in it (Petr Tesařík,
     Prabhakar Pujeri)

   - Clean up the ACPI PMIC driver in multiple ways (Andy Shevchenko,
     Christophe JAILLET)

   - Add support for charge limiting state to the ACPI battery driver
     and update _OSC to indicate support for it (Armin Wolf)

   - Clean up the sysfs interface in the ACPI battery, SBS (smart
     battery subsystem) and AC drivers (Thomas Weißschuh)

   - Coordinate header includes in the ACPI NUMA code and make it use
     ACCESS_COORDINATE_CPU when appropriate (Huang Ying, Thorsten Blum)

   - Downgrade Intel _OSC and _PDC messages in the ACPI processor driver
     to debug to reduce log noise (Mario Limonciello)

   - Still evaluate _OST when _PUR evaluation fails in the ACPI PAD
     (processor aggregator) driver as per the spec (Armin Wolf)

   - Skip ACPI IRQ override on Asus Vivobook Pro N6506MJ and N6506MU
     platforms (Tamim Khan)

   - Force native mode on some T2 macbooks in the ACPI backlight driver
     and replace strcpy() with strscpy() in it (Orlando Chamberlain,
     Muhammad Qasim Abdul Majeed)

   - Add missing MODULE_DESCRIPTION() macros in two places (Jeff
     Johnson)"

* tag 'acpi-6.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (26 commits)
  ACPI: resource: Skip IRQ override on Asus Vivobook Pro N6506MJ
  ACPI: video: force native for some T2 macbooks
  ACPI: video: Use strscpy() instead of strcpy()
  ACPI: CPPC: Replace ternary operator with umax()
  ACPI: resource: Skip IRQ override on Asus Vivobook Pro N6506MU
  ACPI: PMIC: Constify struct pmic_table
  ACPI: bus: Indicate support for battery charge limiting thru _OSC
  ACPI: battery: Add support for charge limiting state
  ACPI: processor: Downgrade Intel _OSC and _PDC messages to debug
  ACPI: SBS: manage alarm sysfs attribute through psy core
  ACPI: battery: create alarm sysfs attribute atomically
  ACPI: battery: use sysfs_emit over sprintf
  ACPI: battery: constify powersupply properties
  ACPI: SBS: constify powersupply properties
  ACPI: AC: constify powersupply properties
  ACPI: PMIC: Replace open coded be16_to_cpu()
  ACPI: PMIC: Convert pr_*() to dev_*() printing macros
  ACPI: PMIC: Use sizeof() instead of hard coded value
  ACPI: NUMA: Consolidate header includes
  ACPI: CPPC: add sysfs entry for guaranteed performance
  ...
parents 41906248 b77b0bc8
...@@ -77,6 +77,7 @@ obj-$(CONFIG_ACPI_TINY_POWER_BUTTON) += tiny-power-button.o ...@@ -77,6 +77,7 @@ obj-$(CONFIG_ACPI_TINY_POWER_BUTTON) += tiny-power-button.o
obj-$(CONFIG_ACPI_FAN) += fan.o obj-$(CONFIG_ACPI_FAN) += fan.o
fan-objs := fan_core.o fan-objs := fan_core.o
fan-objs += fan_attr.o fan-objs += fan_attr.o
fan-$(CONFIG_HWMON) += fan_hwmon.o
obj-$(CONFIG_ACPI_VIDEO) += video.o obj-$(CONFIG_ACPI_VIDEO) += video.o
obj-$(CONFIG_ACPI_TAD) += acpi_tad.o obj-$(CONFIG_ACPI_TAD) += acpi_tad.o
......
...@@ -112,7 +112,7 @@ static int get_ac_property(struct power_supply *psy, ...@@ -112,7 +112,7 @@ static int get_ac_property(struct power_supply *psy,
return 0; return 0;
} }
static enum power_supply_property ac_props[] = { static const enum power_supply_property ac_props[] = {
POWER_SUPPLY_PROP_ONLINE, POWER_SUPPLY_PROP_ONLINE,
}; };
......
...@@ -25,6 +25,10 @@ ...@@ -25,6 +25,10 @@
#define ACPI_PROCESSOR_AGGREGATOR_CLASS "acpi_pad" #define ACPI_PROCESSOR_AGGREGATOR_CLASS "acpi_pad"
#define ACPI_PROCESSOR_AGGREGATOR_DEVICE_NAME "Processor Aggregator" #define ACPI_PROCESSOR_AGGREGATOR_DEVICE_NAME "Processor Aggregator"
#define ACPI_PROCESSOR_AGGREGATOR_NOTIFY 0x80 #define ACPI_PROCESSOR_AGGREGATOR_NOTIFY 0x80
#define ACPI_PROCESSOR_AGGREGATOR_STATUS_SUCCESS 0
#define ACPI_PROCESSOR_AGGREGATOR_STATUS_NO_ACTION 1
static DEFINE_MUTEX(isolated_cpus_lock); static DEFINE_MUTEX(isolated_cpus_lock);
static DEFINE_MUTEX(round_robin_lock); static DEFINE_MUTEX(round_robin_lock);
...@@ -382,16 +386,23 @@ static void acpi_pad_handle_notify(acpi_handle handle) ...@@ -382,16 +386,23 @@ static void acpi_pad_handle_notify(acpi_handle handle)
.length = 4, .length = 4,
.pointer = (void *)&idle_cpus, .pointer = (void *)&idle_cpus,
}; };
u32 status;
mutex_lock(&isolated_cpus_lock); mutex_lock(&isolated_cpus_lock);
num_cpus = acpi_pad_pur(handle); num_cpus = acpi_pad_pur(handle);
if (num_cpus < 0) { if (num_cpus < 0) {
mutex_unlock(&isolated_cpus_lock); /* The ACPI specification says that if no action was performed when
return; * processing the _PUR object, _OST should still be evaluated, albeit
} * with a different status code.
*/
status = ACPI_PROCESSOR_AGGREGATOR_STATUS_NO_ACTION;
} else {
status = ACPI_PROCESSOR_AGGREGATOR_STATUS_SUCCESS;
acpi_pad_idle_cpus(num_cpus); acpi_pad_idle_cpus(num_cpus);
}
idle_cpus = acpi_pad_idle_cpus_num(); idle_cpus = acpi_pad_idle_cpus_num();
acpi_evaluate_ost(handle, ACPI_PROCESSOR_AGGREGATOR_NOTIFY, 0, &param); acpi_evaluate_ost(handle, ACPI_PROCESSOR_AGGREGATOR_NOTIFY, status, &param);
mutex_unlock(&isolated_cpus_lock); mutex_unlock(&isolated_cpus_lock);
} }
......
...@@ -619,9 +619,9 @@ static bool __init acpi_early_processor_osc(void) ...@@ -619,9 +619,9 @@ static bool __init acpi_early_processor_osc(void)
void __init acpi_early_processor_control_setup(void) void __init acpi_early_processor_control_setup(void)
{ {
if (acpi_early_processor_osc()) { if (acpi_early_processor_osc()) {
pr_info("_OSC evaluated successfully for all CPUs\n"); pr_debug("_OSC evaluated successfully for all CPUs\n");
} else { } else {
pr_info("_OSC evaluation for CPUs failed, trying _PDC\n"); pr_debug("_OSC evaluation for CPUs failed, trying _PDC\n");
acpi_early_processor_set_pdc(); acpi_early_processor_set_pdc();
} }
} }
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <linux/suspend.h> #include <linux/suspend.h>
MODULE_DESCRIPTION("ACPI Time and Alarm (TAD) Device Driver");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
MODULE_AUTHOR("Rafael J. Wysocki"); MODULE_AUTHOR("Rafael J. Wysocki");
......
...@@ -1128,8 +1128,8 @@ static int acpi_video_bus_get_one_device(struct acpi_device *device, void *arg) ...@@ -1128,8 +1128,8 @@ static int acpi_video_bus_get_one_device(struct acpi_device *device, void *arg)
return -ENOMEM; return -ENOMEM;
} }
strcpy(acpi_device_name(device), ACPI_VIDEO_DEVICE_NAME); strscpy(acpi_device_name(device), ACPI_VIDEO_DEVICE_NAME);
strcpy(acpi_device_class(device), ACPI_VIDEO_CLASS); strscpy(acpi_device_class(device), ACPI_VIDEO_CLASS);
data->device_id = device_id; data->device_id = device_id;
data->video = video; data->video = video;
...@@ -2010,8 +2010,8 @@ static int acpi_video_bus_add(struct acpi_device *device) ...@@ -2010,8 +2010,8 @@ static int acpi_video_bus_add(struct acpi_device *device)
} }
video->device = device; video->device = device;
strcpy(acpi_device_name(device), ACPI_VIDEO_BUS_NAME); strscpy(acpi_device_name(device), ACPI_VIDEO_BUS_NAME);
strcpy(acpi_device_class(device), ACPI_VIDEO_CLASS); strscpy(acpi_device_class(device), ACPI_VIDEO_CLASS);
device->driver_data = video; device->driver_data = video;
acpi_video_bus_find_cap(video); acpi_video_bus_find_cap(video);
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#define ACPI_BATTERY_STATE_DISCHARGING 0x1 #define ACPI_BATTERY_STATE_DISCHARGING 0x1
#define ACPI_BATTERY_STATE_CHARGING 0x2 #define ACPI_BATTERY_STATE_CHARGING 0x2
#define ACPI_BATTERY_STATE_CRITICAL 0x4 #define ACPI_BATTERY_STATE_CRITICAL 0x4
#define ACPI_BATTERY_STATE_CHARGE_LIMITING 0x8
#define MAX_STRING_LENGTH 64 #define MAX_STRING_LENGTH 64
...@@ -155,7 +156,7 @@ static int acpi_battery_get_state(struct acpi_battery *battery); ...@@ -155,7 +156,7 @@ static int acpi_battery_get_state(struct acpi_battery *battery);
static int acpi_battery_is_charged(struct acpi_battery *battery) static int acpi_battery_is_charged(struct acpi_battery *battery)
{ {
/* charging, discharging or critical low */ /* charging, discharging, critical low or charge limited */
if (battery->state != 0) if (battery->state != 0)
return 0; return 0;
...@@ -215,6 +216,8 @@ static int acpi_battery_get_property(struct power_supply *psy, ...@@ -215,6 +216,8 @@ static int acpi_battery_get_property(struct power_supply *psy,
val->intval = acpi_battery_handle_discharging(battery); val->intval = acpi_battery_handle_discharging(battery);
else if (battery->state & ACPI_BATTERY_STATE_CHARGING) else if (battery->state & ACPI_BATTERY_STATE_CHARGING)
val->intval = POWER_SUPPLY_STATUS_CHARGING; val->intval = POWER_SUPPLY_STATUS_CHARGING;
else if (battery->state & ACPI_BATTERY_STATE_CHARGE_LIMITING)
val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING;
else if (acpi_battery_is_charged(battery)) else if (acpi_battery_is_charged(battery))
val->intval = POWER_SUPPLY_STATUS_FULL; val->intval = POWER_SUPPLY_STATUS_FULL;
else else
...@@ -308,7 +311,7 @@ static int acpi_battery_get_property(struct power_supply *psy, ...@@ -308,7 +311,7 @@ static int acpi_battery_get_property(struct power_supply *psy,
return ret; return ret;
} }
static enum power_supply_property charge_battery_props[] = { static const enum power_supply_property charge_battery_props[] = {
POWER_SUPPLY_PROP_STATUS, POWER_SUPPLY_PROP_STATUS,
POWER_SUPPLY_PROP_PRESENT, POWER_SUPPLY_PROP_PRESENT,
POWER_SUPPLY_PROP_TECHNOLOGY, POWER_SUPPLY_PROP_TECHNOLOGY,
...@@ -326,7 +329,7 @@ static enum power_supply_property charge_battery_props[] = { ...@@ -326,7 +329,7 @@ static enum power_supply_property charge_battery_props[] = {
POWER_SUPPLY_PROP_SERIAL_NUMBER, POWER_SUPPLY_PROP_SERIAL_NUMBER,
}; };
static enum power_supply_property charge_battery_full_cap_broken_props[] = { static const enum power_supply_property charge_battery_full_cap_broken_props[] = {
POWER_SUPPLY_PROP_STATUS, POWER_SUPPLY_PROP_STATUS,
POWER_SUPPLY_PROP_PRESENT, POWER_SUPPLY_PROP_PRESENT,
POWER_SUPPLY_PROP_TECHNOLOGY, POWER_SUPPLY_PROP_TECHNOLOGY,
...@@ -340,7 +343,7 @@ static enum power_supply_property charge_battery_full_cap_broken_props[] = { ...@@ -340,7 +343,7 @@ static enum power_supply_property charge_battery_full_cap_broken_props[] = {
POWER_SUPPLY_PROP_SERIAL_NUMBER, POWER_SUPPLY_PROP_SERIAL_NUMBER,
}; };
static enum power_supply_property energy_battery_props[] = { static const enum power_supply_property energy_battery_props[] = {
POWER_SUPPLY_PROP_STATUS, POWER_SUPPLY_PROP_STATUS,
POWER_SUPPLY_PROP_PRESENT, POWER_SUPPLY_PROP_PRESENT,
POWER_SUPPLY_PROP_TECHNOLOGY, POWER_SUPPLY_PROP_TECHNOLOGY,
...@@ -358,7 +361,7 @@ static enum power_supply_property energy_battery_props[] = { ...@@ -358,7 +361,7 @@ static enum power_supply_property energy_battery_props[] = {
POWER_SUPPLY_PROP_SERIAL_NUMBER, POWER_SUPPLY_PROP_SERIAL_NUMBER,
}; };
static enum power_supply_property energy_battery_full_cap_broken_props[] = { static const enum power_supply_property energy_battery_full_cap_broken_props[] = {
POWER_SUPPLY_PROP_STATUS, POWER_SUPPLY_PROP_STATUS,
POWER_SUPPLY_PROP_PRESENT, POWER_SUPPLY_PROP_PRESENT,
POWER_SUPPLY_PROP_TECHNOLOGY, POWER_SUPPLY_PROP_TECHNOLOGY,
...@@ -661,7 +664,7 @@ static ssize_t acpi_battery_alarm_show(struct device *dev, ...@@ -661,7 +664,7 @@ static ssize_t acpi_battery_alarm_show(struct device *dev,
{ {
struct acpi_battery *battery = to_acpi_battery(dev_get_drvdata(dev)); struct acpi_battery *battery = to_acpi_battery(dev_get_drvdata(dev));
return sprintf(buf, "%d\n", battery->alarm * 1000); return sysfs_emit(buf, "%d\n", battery->alarm * 1000);
} }
static ssize_t acpi_battery_alarm_store(struct device *dev, static ssize_t acpi_battery_alarm_store(struct device *dev,
...@@ -678,12 +681,18 @@ static ssize_t acpi_battery_alarm_store(struct device *dev, ...@@ -678,12 +681,18 @@ static ssize_t acpi_battery_alarm_store(struct device *dev,
return count; return count;
} }
static const struct device_attribute alarm_attr = { static struct device_attribute alarm_attr = {
.attr = {.name = "alarm", .mode = 0644}, .attr = {.name = "alarm", .mode = 0644},
.show = acpi_battery_alarm_show, .show = acpi_battery_alarm_show,
.store = acpi_battery_alarm_store, .store = acpi_battery_alarm_store,
}; };
static struct attribute *acpi_battery_attrs[] = {
&alarm_attr.attr,
NULL
};
ATTRIBUTE_GROUPS(acpi_battery);
/* /*
* The Battery Hooking API * The Battery Hooking API
* *
...@@ -838,7 +847,10 @@ static void __exit battery_hook_exit(void) ...@@ -838,7 +847,10 @@ static void __exit battery_hook_exit(void)
static int sysfs_add_battery(struct acpi_battery *battery) static int sysfs_add_battery(struct acpi_battery *battery)
{ {
struct power_supply_config psy_cfg = { .drv_data = battery, }; struct power_supply_config psy_cfg = {
.drv_data = battery,
.attr_grp = acpi_battery_groups,
};
bool full_cap_broken = false; bool full_cap_broken = false;
if (!ACPI_BATTERY_CAPACITY_VALID(battery->full_charge_capacity) && if (!ACPI_BATTERY_CAPACITY_VALID(battery->full_charge_capacity) &&
...@@ -883,7 +895,7 @@ static int sysfs_add_battery(struct acpi_battery *battery) ...@@ -883,7 +895,7 @@ static int sysfs_add_battery(struct acpi_battery *battery)
return result; return result;
} }
battery_hook_add_battery(battery); battery_hook_add_battery(battery);
return device_create_file(&battery->bat->dev, &alarm_attr); return 0;
} }
static void sysfs_remove_battery(struct acpi_battery *battery) static void sysfs_remove_battery(struct acpi_battery *battery)
...@@ -894,7 +906,6 @@ static void sysfs_remove_battery(struct acpi_battery *battery) ...@@ -894,7 +906,6 @@ static void sysfs_remove_battery(struct acpi_battery *battery)
return; return;
} }
battery_hook_remove_battery(battery); battery_hook_remove_battery(battery);
device_remove_file(&battery->bat->dev, &alarm_attr);
power_supply_unregister(battery->bat); power_supply_unregister(battery->bat);
battery->bat = NULL; battery->bat = NULL;
mutex_unlock(&battery->sysfs_lock); mutex_unlock(&battery->sysfs_lock);
......
...@@ -329,6 +329,8 @@ static void acpi_bus_osc_negotiate_platform_control(void) ...@@ -329,6 +329,8 @@ static void acpi_bus_osc_negotiate_platform_control(void)
capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_PPC_OST_SUPPORT; capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_PPC_OST_SUPPORT;
if (IS_ENABLED(CONFIG_ACPI_THERMAL)) if (IS_ENABLED(CONFIG_ACPI_THERMAL))
capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_FAST_THERMAL_SAMPLING_SUPPORT; capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_FAST_THERMAL_SAMPLING_SUPPORT;
if (IS_ENABLED(CONFIG_ACPI_BATTERY))
capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_BATTERY_CHARGE_LIMITING_SUPPORT;
capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_HOTPLUG_OST_SUPPORT; capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_HOTPLUG_OST_SUPPORT;
capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_PCLPI_SUPPORT; capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_PCLPI_SUPPORT;
......
...@@ -160,6 +160,7 @@ show_cppc_data(cppc_get_perf_caps, cppc_perf_caps, highest_perf); ...@@ -160,6 +160,7 @@ show_cppc_data(cppc_get_perf_caps, cppc_perf_caps, highest_perf);
show_cppc_data(cppc_get_perf_caps, cppc_perf_caps, lowest_perf); show_cppc_data(cppc_get_perf_caps, cppc_perf_caps, lowest_perf);
show_cppc_data(cppc_get_perf_caps, cppc_perf_caps, nominal_perf); show_cppc_data(cppc_get_perf_caps, cppc_perf_caps, nominal_perf);
show_cppc_data(cppc_get_perf_caps, cppc_perf_caps, lowest_nonlinear_perf); show_cppc_data(cppc_get_perf_caps, cppc_perf_caps, lowest_nonlinear_perf);
show_cppc_data(cppc_get_perf_caps, cppc_perf_caps, guaranteed_perf);
show_cppc_data(cppc_get_perf_caps, cppc_perf_caps, lowest_freq); show_cppc_data(cppc_get_perf_caps, cppc_perf_caps, lowest_freq);
show_cppc_data(cppc_get_perf_caps, cppc_perf_caps, nominal_freq); show_cppc_data(cppc_get_perf_caps, cppc_perf_caps, nominal_freq);
...@@ -196,6 +197,7 @@ static struct attribute *cppc_attrs[] = { ...@@ -196,6 +197,7 @@ static struct attribute *cppc_attrs[] = {
&highest_perf.attr, &highest_perf.attr,
&lowest_perf.attr, &lowest_perf.attr,
&lowest_nonlinear_perf.attr, &lowest_nonlinear_perf.attr,
&guaranteed_perf.attr,
&nominal_perf.attr, &nominal_perf.attr,
&nominal_freq.attr, &nominal_freq.attr,
&lowest_freq.attr, &lowest_freq.attr,
...@@ -1837,7 +1839,7 @@ static void cppc_find_dmi_mhz(const struct dmi_header *dm, void *private) ...@@ -1837,7 +1839,7 @@ static void cppc_find_dmi_mhz(const struct dmi_header *dm, void *private)
dm->length >= DMI_ENTRY_PROCESSOR_MIN_LENGTH) { dm->length >= DMI_ENTRY_PROCESSOR_MIN_LENGTH) {
u16 val = (u16)get_unaligned((const u16 *) u16 val = (u16)get_unaligned((const u16 *)
(dmi_data + DMI_PROCESSOR_MAX_SPEED)); (dmi_data + DMI_PROCESSOR_MAX_SPEED));
*mhz = val > *mhz ? val : *mhz; *mhz = umax(val, *mhz);
} }
} }
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
#ifndef _ACPI_FAN_H_ #ifndef _ACPI_FAN_H_
#define _ACPI_FAN_H_ #define _ACPI_FAN_H_
#include <linux/kconfig.h>
#define ACPI_FAN_DEVICE_IDS \ #define ACPI_FAN_DEVICE_IDS \
{"INT3404", }, /* Fan */ \ {"INT3404", }, /* Fan */ \
{"INTC1044", }, /* Fan for Tiger Lake generation */ \ {"INTC1044", }, /* Fan for Tiger Lake generation */ \
...@@ -57,4 +59,11 @@ struct acpi_fan { ...@@ -57,4 +59,11 @@ struct acpi_fan {
int acpi_fan_get_fst(struct acpi_device *device, struct acpi_fan_fst *fst); int acpi_fan_get_fst(struct acpi_device *device, struct acpi_fan_fst *fst);
int acpi_fan_create_attributes(struct acpi_device *device); int acpi_fan_create_attributes(struct acpi_device *device);
void acpi_fan_delete_attributes(struct acpi_device *device); void acpi_fan_delete_attributes(struct acpi_device *device);
#if IS_REACHABLE(CONFIG_HWMON)
int devm_acpi_fan_create_hwmon(struct acpi_device *device);
#else
static inline int devm_acpi_fan_create_hwmon(struct acpi_device *device) { return 0; };
#endif
#endif #endif
...@@ -336,6 +336,10 @@ static int acpi_fan_probe(struct platform_device *pdev) ...@@ -336,6 +336,10 @@ static int acpi_fan_probe(struct platform_device *pdev)
if (result) if (result)
return result; return result;
result = devm_acpi_fan_create_hwmon(device);
if (result)
return result;
result = acpi_fan_create_attributes(device); result = acpi_fan_create_attributes(device);
if (result) if (result)
return result; return result;
......
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* hwmon interface for the ACPI Fan driver.
*
* Copyright (C) 2024 Armin Wolf <W_Armin@gmx.de>
*/
#include <linux/acpi.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/hwmon.h>
#include <linux/limits.h>
#include <linux/types.h>
#include <linux/units.h>
#include "fan.h"
/* Returned when the ACPI fan does not support speed reporting */
#define FAN_SPEED_UNAVAILABLE U32_MAX
#define FAN_POWER_UNAVAILABLE U32_MAX
static struct acpi_fan_fps *acpi_fan_get_current_fps(struct acpi_fan *fan, u64 control)
{
unsigned int i;
for (i = 0; i < fan->fps_count; i++) {
if (fan->fps[i].control == control)
return &fan->fps[i];
}
return NULL;
}
static umode_t acpi_fan_hwmon_is_visible(const void *drvdata, enum hwmon_sensor_types type,
u32 attr, int channel)
{
const struct acpi_fan *fan = drvdata;
unsigned int i;
switch (type) {
case hwmon_fan:
switch (attr) {
case hwmon_fan_input:
return 0444;
case hwmon_fan_target:
/*
* When in fine grain control mode, not every fan control value
* has an associated fan performance state.
*/
if (fan->fif.fine_grain_ctrl)
return 0;
return 0444;
default:
return 0;
}
case hwmon_power:
switch (attr) {
case hwmon_power_input:
/*
* When in fine grain control mode, not every fan control value
* has an associated fan performance state.
*/
if (fan->fif.fine_grain_ctrl)
return 0;
/*
* When all fan performance states contain no valid power data,
* when the associated attribute should not be created.
*/
for (i = 0; i < fan->fps_count; i++) {
if (fan->fps[i].power != FAN_POWER_UNAVAILABLE)
return 0444;
}
return 0;
default:
return 0;
}
default:
return 0;
}
}
static int acpi_fan_hwmon_read(struct device *dev, enum hwmon_sensor_types type, u32 attr,
int channel, long *val)
{
struct acpi_device *adev = to_acpi_device(dev->parent);
struct acpi_fan *fan = dev_get_drvdata(dev);
struct acpi_fan_fps *fps;
struct acpi_fan_fst fst;
int ret;
ret = acpi_fan_get_fst(adev, &fst);
if (ret < 0)
return ret;
switch (type) {
case hwmon_fan:
switch (attr) {
case hwmon_fan_input:
if (fst.speed == FAN_SPEED_UNAVAILABLE)
return -ENODEV;
if (fst.speed > LONG_MAX)
return -EOVERFLOW;
*val = fst.speed;
return 0;
case hwmon_fan_target:
fps = acpi_fan_get_current_fps(fan, fst.control);
if (!fps)
return -EIO;
if (fps->speed > LONG_MAX)
return -EOVERFLOW;
*val = fps->speed;
return 0;
default:
return -EOPNOTSUPP;
}
case hwmon_power:
switch (attr) {
case hwmon_power_input:
fps = acpi_fan_get_current_fps(fan, fst.control);
if (!fps)
return -EIO;
if (fps->power == FAN_POWER_UNAVAILABLE)
return -ENODEV;
if (fps->power > LONG_MAX / MICROWATT_PER_MILLIWATT)
return -EOVERFLOW;
*val = fps->power * MICROWATT_PER_MILLIWATT;
return 0;
default:
return -EOPNOTSUPP;
}
default:
return -EOPNOTSUPP;
}
}
static const struct hwmon_ops acpi_fan_hwmon_ops = {
.is_visible = acpi_fan_hwmon_is_visible,
.read = acpi_fan_hwmon_read,
};
static const struct hwmon_channel_info * const acpi_fan_hwmon_info[] = {
HWMON_CHANNEL_INFO(fan, HWMON_F_INPUT | HWMON_F_TARGET),
HWMON_CHANNEL_INFO(power, HWMON_P_INPUT),
NULL
};
static const struct hwmon_chip_info acpi_fan_hwmon_chip_info = {
.ops = &acpi_fan_hwmon_ops,
.info = acpi_fan_hwmon_info,
};
int devm_acpi_fan_create_hwmon(struct acpi_device *device)
{
struct acpi_fan *fan = acpi_driver_data(device);
struct device *hdev;
hdev = devm_hwmon_device_register_with_info(&device->dev, "acpi_fan", fan,
&acpi_fan_hwmon_chip_info, NULL);
return PTR_ERR_OR_ZERO(hdev);
}
...@@ -408,7 +408,7 @@ static __init void hmat_update_target(unsigned int tgt_pxm, unsigned int init_px ...@@ -408,7 +408,7 @@ static __init void hmat_update_target(unsigned int tgt_pxm, unsigned int init_px
if (target && target->processor_pxm == init_pxm) { if (target && target->processor_pxm == init_pxm) {
hmat_update_target_access(target, type, value, hmat_update_target_access(target, type, value,
ACCESS_COORDINATE_LOCAL); ACCESS_COORDINATE_LOCAL);
/* If the node has a CPU, update access 1 */ /* If the node has a CPU, update access ACCESS_COORDINATE_CPU */
if (node_state(pxm_to_node(init_pxm), N_CPU)) if (node_state(pxm_to_node(init_pxm), N_CPU))
hmat_update_target_access(target, type, value, hmat_update_target_access(target, type, value,
ACCESS_COORDINATE_CPU); ACCESS_COORDINATE_CPU);
...@@ -948,7 +948,7 @@ static int hmat_set_default_dram_perf(void) ...@@ -948,7 +948,7 @@ static int hmat_set_default_dram_perf(void)
target = find_mem_target(pxm); target = find_mem_target(pxm);
if (!target) if (!target)
continue; continue;
attrs = &target->coord[1]; attrs = &target->coord[ACCESS_COORDINATE_CPU];
rc = mt_set_default_dram_perf(nid, attrs, "ACPI HMAT"); rc = mt_set_default_dram_perf(nid, attrs, "ACPI HMAT");
if (rc) if (rc)
return rc; return rc;
...@@ -975,7 +975,7 @@ static int hmat_calculate_adistance(struct notifier_block *self, ...@@ -975,7 +975,7 @@ static int hmat_calculate_adistance(struct notifier_block *self,
hmat_update_target_attrs(target, p_nodes, ACCESS_COORDINATE_CPU); hmat_update_target_attrs(target, p_nodes, ACCESS_COORDINATE_CPU);
mutex_unlock(&target_lock); mutex_unlock(&target_lock);
perf = &target->coord[1]; perf = &target->coord[ACCESS_COORDINATE_CPU];
if (mt_perf_to_adistance(perf, adist)) if (mt_perf_to_adistance(perf, adist))
return NOTIFY_OK; return NOTIFY_OK;
......
...@@ -217,4 +217,5 @@ int platform_profile_remove(void) ...@@ -217,4 +217,5 @@ int platform_profile_remove(void)
EXPORT_SYMBOL_GPL(platform_profile_remove); EXPORT_SYMBOL_GPL(platform_profile_remove);
MODULE_AUTHOR("Mark Pearson <markpearson@lenovo.com>"); MODULE_AUTHOR("Mark Pearson <markpearson@lenovo.com>");
MODULE_DESCRIPTION("ACPI platform profile sysfs interface");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -31,7 +31,7 @@ struct intel_pmic_opregion { ...@@ -31,7 +31,7 @@ struct intel_pmic_opregion {
static struct intel_pmic_opregion *intel_pmic_opregion; static struct intel_pmic_opregion *intel_pmic_opregion;
static int pmic_get_reg_bit(int address, struct pmic_table *table, static int pmic_get_reg_bit(int address, const struct pmic_table *table,
int count, int *reg, int *bit) int count, int *reg, int *bit)
{ {
int i; int i;
......
...@@ -21,9 +21,9 @@ struct intel_pmic_opregion_data { ...@@ -21,9 +21,9 @@ struct intel_pmic_opregion_data {
u32 reg_address, u32 value, u32 mask); u32 reg_address, u32 value, u32 mask);
int (*lpat_raw_to_temp)(struct acpi_lpat_conversion_table *lpat_table, int (*lpat_raw_to_temp)(struct acpi_lpat_conversion_table *lpat_table,
int raw); int raw);
struct pmic_table *power_table; const struct pmic_table *power_table;
int power_table_count; int power_table_count;
struct pmic_table *thermal_table; const struct pmic_table *thermal_table;
int thermal_table_count; int thermal_table_count;
/* For generic exec_mipi_pmic_seq_element handling */ /* For generic exec_mipi_pmic_seq_element handling */
int pmic_i2c_address; int pmic_i2c_address;
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#define VSWITCH1_OUTPUT BIT(4) #define VSWITCH1_OUTPUT BIT(4)
#define VUSBPHY_CHARGE BIT(1) #define VUSBPHY_CHARGE BIT(1)
static struct pmic_table power_table[] = { static const struct pmic_table power_table[] = {
{ {
.address = 0x0, .address = 0x0,
.reg = 0x63, .reg = 0x63,
...@@ -177,7 +177,7 @@ static struct pmic_table power_table[] = { ...@@ -177,7 +177,7 @@ static struct pmic_table power_table[] = {
} /* MOFF -> MODEMCTRL Bit 0 */ } /* MOFF -> MODEMCTRL Bit 0 */
}; };
static struct pmic_table thermal_table[] = { static const struct pmic_table thermal_table[] = {
{ {
.address = 0x00, .address = 0x00,
.reg = 0x4F39 .reg = 0x4F39
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#define PMIC_A0LOCK_REG 0xc5 #define PMIC_A0LOCK_REG 0xc5
static struct pmic_table power_table[] = { static const struct pmic_table power_table[] = {
/* { /* {
.address = 0x00, .address = 0x00,
.reg = ??, .reg = ??,
...@@ -134,7 +134,7 @@ static struct pmic_table power_table[] = { ...@@ -134,7 +134,7 @@ static struct pmic_table power_table[] = {
}, /* V105 -> V1P05S, L2 SRAM */ }, /* V105 -> V1P05S, L2 SRAM */
}; };
static struct pmic_table thermal_table[] = { static const struct pmic_table thermal_table[] = {
{ {
.address = 0x00, .address = 0x00,
.reg = 0x75 .reg = 0x75
......
...@@ -8,18 +8,22 @@ ...@@ -8,18 +8,22 @@
*/ */
#include <linux/acpi.h> #include <linux/acpi.h>
#include <linux/bits.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/mfd/intel_soc_pmic.h> #include <linux/mfd/intel_soc_pmic.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <asm/byteorder.h>
#include "intel_pmic.h" #include "intel_pmic.h"
/* registers stored in 16bit BE (high:low, total 10bit) */ /* registers stored in 16bit BE (high:low, total 10bit) */
#define PMIC_REG_MASK GENMASK(9, 0)
#define CHTDC_TI_VBAT 0x54 #define CHTDC_TI_VBAT 0x54
#define CHTDC_TI_DIETEMP 0x56 #define CHTDC_TI_DIETEMP 0x56
#define CHTDC_TI_BPTHERM 0x58 #define CHTDC_TI_BPTHERM 0x58
#define CHTDC_TI_GPADC 0x5a #define CHTDC_TI_GPADC 0x5a
static struct pmic_table chtdc_ti_power_table[] = { static const struct pmic_table chtdc_ti_power_table[] = {
{ .address = 0x00, .reg = 0x41 }, /* LDO1 */ { .address = 0x00, .reg = 0x41 }, /* LDO1 */
{ .address = 0x04, .reg = 0x42 }, /* LDO2 */ { .address = 0x04, .reg = 0x42 }, /* LDO2 */
{ .address = 0x08, .reg = 0x43 }, /* LDO3 */ { .address = 0x08, .reg = 0x43 }, /* LDO3 */
...@@ -35,7 +39,7 @@ static struct pmic_table chtdc_ti_power_table[] = { ...@@ -35,7 +39,7 @@ static struct pmic_table chtdc_ti_power_table[] = {
{ .address = 0x30, .reg = 0x4e }, /* LD14 */ { .address = 0x30, .reg = 0x4e }, /* LD14 */
}; };
static struct pmic_table chtdc_ti_thermal_table[] = { static const struct pmic_table chtdc_ti_thermal_table[] = {
{ {
.address = 0x00, .address = 0x00,
.reg = CHTDC_TI_GPADC .reg = CHTDC_TI_GPADC
...@@ -73,7 +77,7 @@ static int chtdc_ti_pmic_get_power(struct regmap *regmap, int reg, int bit, ...@@ -73,7 +77,7 @@ static int chtdc_ti_pmic_get_power(struct regmap *regmap, int reg, int bit,
if (regmap_read(regmap, reg, &data)) if (regmap_read(regmap, reg, &data))
return -EIO; return -EIO;
*value = data & 1; *value = data & BIT(0);
return 0; return 0;
} }
...@@ -85,13 +89,12 @@ static int chtdc_ti_pmic_update_power(struct regmap *regmap, int reg, int bit, ...@@ -85,13 +89,12 @@ static int chtdc_ti_pmic_update_power(struct regmap *regmap, int reg, int bit,
static int chtdc_ti_pmic_get_raw_temp(struct regmap *regmap, int reg) static int chtdc_ti_pmic_get_raw_temp(struct regmap *regmap, int reg)
{ {
u8 buf[2]; __be16 buf;
if (regmap_bulk_read(regmap, reg, buf, 2)) if (regmap_bulk_read(regmap, reg, &buf, sizeof(buf)))
return -EIO; return -EIO;
/* stored in big-endian */ return be16_to_cpu(buf) & PMIC_REG_MASK;
return ((buf[0] & 0x03) << 8) | buf[1];
} }
static const struct intel_pmic_opregion_data chtdc_ti_pmic_opregion_data = { static const struct intel_pmic_opregion_data chtdc_ti_pmic_opregion_data = {
......
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
* "regulator: whiskey_cove: implements Whiskey Cove pmic VRF support" * "regulator: whiskey_cove: implements Whiskey Cove pmic VRF support"
* https://github.com/intel-aero/meta-intel-aero/blob/master/recipes-kernel/linux/linux-yocto/0019-regulator-whiskey_cove-implements-WhiskeyCove-pmic-V.patch * https://github.com/intel-aero/meta-intel-aero/blob/master/recipes-kernel/linux/linux-yocto/0019-regulator-whiskey_cove-implements-WhiskeyCove-pmic-V.patch
*/ */
static struct pmic_table power_table[] = { static const struct pmic_table power_table[] = {
{ {
.address = 0x0, .address = 0x0,
.reg = CHT_WC_V1P8A_CTRL, .reg = CHT_WC_V1P8A_CTRL,
...@@ -236,11 +236,12 @@ static int intel_cht_wc_exec_mipi_pmic_seq_element(struct regmap *regmap, ...@@ -236,11 +236,12 @@ static int intel_cht_wc_exec_mipi_pmic_seq_element(struct regmap *regmap,
u32 reg_address, u32 reg_address,
u32 value, u32 mask) u32 value, u32 mask)
{ {
struct device *dev = regmap_get_device(regmap);
u32 address; u32 address;
if (i2c_client_address > 0xff || reg_address > 0xff) { if (i2c_client_address > 0xff || reg_address > 0xff) {
pr_warn("%s warning addresses too big client 0x%x reg 0x%x\n", dev_warn(dev, "warning addresses too big client 0x%x reg 0x%x\n",
__func__, i2c_client_address, reg_address); i2c_client_address, reg_address);
return -ERANGE; return -ERANGE;
} }
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#define AXP288_ADC_TS_CURRENT_ON_ONDEMAND (2 << 0) #define AXP288_ADC_TS_CURRENT_ON_ONDEMAND (2 << 0)
#define AXP288_ADC_TS_CURRENT_ON (3 << 0) #define AXP288_ADC_TS_CURRENT_ON (3 << 0)
static struct pmic_table power_table[] = { static const struct pmic_table power_table[] = {
{ {
.address = 0x00, .address = 0x00,
.reg = 0x13, .reg = 0x13,
...@@ -129,7 +129,7 @@ static struct pmic_table power_table[] = { ...@@ -129,7 +129,7 @@ static struct pmic_table power_table[] = {
}; };
/* TMP0 - TMP5 are the same, all from GPADC */ /* TMP0 - TMP5 are the same, all from GPADC */
static struct pmic_table thermal_table[] = { static const struct pmic_table thermal_table[] = {
{ {
.address = 0x00, .address = 0x00,
.reg = XPOWER_GPADC_LOW .reg = XPOWER_GPADC_LOW
...@@ -255,7 +255,7 @@ static int intel_xpower_pmic_get_raw_temp(struct regmap *regmap, int reg) ...@@ -255,7 +255,7 @@ static int intel_xpower_pmic_get_raw_temp(struct regmap *regmap, int reg)
if (ret) if (ret)
return ret; return ret;
ret = regmap_bulk_read(regmap, AXP288_GP_ADC_H, buf, 2); ret = regmap_bulk_read(regmap, AXP288_GP_ADC_H, buf, sizeof(buf));
if (ret == 0) if (ret == 0)
ret = (buf[0] << 4) + ((buf[1] >> 4) & 0x0f); ret = (buf[0] << 4) + ((buf[1] >> 4) & 0x0f);
...@@ -274,11 +274,12 @@ static int intel_xpower_exec_mipi_pmic_seq_element(struct regmap *regmap, ...@@ -274,11 +274,12 @@ static int intel_xpower_exec_mipi_pmic_seq_element(struct regmap *regmap,
u16 i2c_address, u32 reg_address, u16 i2c_address, u32 reg_address,
u32 value, u32 mask) u32 value, u32 mask)
{ {
struct device *dev = regmap_get_device(regmap);
int ret; int ret;
if (i2c_address != 0x34) { if (i2c_address != 0x34) {
pr_err("%s: Unexpected i2c-addr: 0x%02x (reg-addr 0x%x value 0x%x mask 0x%x)\n", dev_err(dev, "Unexpected i2c-addr: 0x%02x (reg-addr 0x%x value 0x%x mask 0x%x)\n",
__func__, i2c_address, reg_address, value, mask); i2c_address, reg_address, value, mask);
return -ENXIO; return -ENXIO;
} }
......
...@@ -524,6 +524,20 @@ static const struct dmi_system_id irq1_level_low_skip_override[] = { ...@@ -524,6 +524,20 @@ static const struct dmi_system_id irq1_level_low_skip_override[] = {
DMI_MATCH(DMI_BOARD_NAME, "N6506MV"), DMI_MATCH(DMI_BOARD_NAME, "N6506MV"),
}, },
}, },
{
/* Asus Vivobook Pro N6506MU */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
DMI_MATCH(DMI_BOARD_NAME, "N6506MU"),
},
},
{
/* Asus Vivobook Pro N6506MJ */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
DMI_MATCH(DMI_BOARD_NAME, "N6506MJ"),
},
},
{ {
/* LG Electronics 17U70P */ /* LG Electronics 17U70P */
.matches = { .matches = {
......
...@@ -77,7 +77,6 @@ struct acpi_battery { ...@@ -77,7 +77,6 @@ struct acpi_battery {
u16 spec; u16 spec;
u8 id; u8 id;
u8 present:1; u8 present:1;
u8 have_sysfs_alarm:1;
}; };
#define to_acpi_battery(x) power_supply_get_drvdata(x) #define to_acpi_battery(x) power_supply_get_drvdata(x)
...@@ -241,11 +240,11 @@ static int acpi_sbs_battery_get_property(struct power_supply *psy, ...@@ -241,11 +240,11 @@ static int acpi_sbs_battery_get_property(struct power_supply *psy,
return 0; return 0;
} }
static enum power_supply_property sbs_ac_props[] = { static const enum power_supply_property sbs_ac_props[] = {
POWER_SUPPLY_PROP_ONLINE, POWER_SUPPLY_PROP_ONLINE,
}; };
static enum power_supply_property sbs_charge_battery_props[] = { static const enum power_supply_property sbs_charge_battery_props[] = {
POWER_SUPPLY_PROP_STATUS, POWER_SUPPLY_PROP_STATUS,
POWER_SUPPLY_PROP_PRESENT, POWER_SUPPLY_PROP_PRESENT,
POWER_SUPPLY_PROP_TECHNOLOGY, POWER_SUPPLY_PROP_TECHNOLOGY,
...@@ -263,7 +262,7 @@ static enum power_supply_property sbs_charge_battery_props[] = { ...@@ -263,7 +262,7 @@ static enum power_supply_property sbs_charge_battery_props[] = {
POWER_SUPPLY_PROP_MANUFACTURER, POWER_SUPPLY_PROP_MANUFACTURER,
}; };
static enum power_supply_property sbs_energy_battery_props[] = { static const enum power_supply_property sbs_energy_battery_props[] = {
POWER_SUPPLY_PROP_STATUS, POWER_SUPPLY_PROP_STATUS,
POWER_SUPPLY_PROP_PRESENT, POWER_SUPPLY_PROP_PRESENT,
POWER_SUPPLY_PROP_TECHNOLOGY, POWER_SUPPLY_PROP_TECHNOLOGY,
...@@ -462,12 +461,18 @@ static ssize_t acpi_battery_alarm_store(struct device *dev, ...@@ -462,12 +461,18 @@ static ssize_t acpi_battery_alarm_store(struct device *dev,
return count; return count;
} }
static const struct device_attribute alarm_attr = { static struct device_attribute alarm_attr = {
.attr = {.name = "alarm", .mode = 0644}, .attr = {.name = "alarm", .mode = 0644},
.show = acpi_battery_alarm_show, .show = acpi_battery_alarm_show,
.store = acpi_battery_alarm_store, .store = acpi_battery_alarm_store,
}; };
static struct attribute *acpi_battery_attrs[] = {
&alarm_attr.attr,
NULL
};
ATTRIBUTE_GROUPS(acpi_battery);
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
Driver Interface Driver Interface
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
...@@ -518,7 +523,10 @@ static int acpi_battery_read(struct acpi_battery *battery) ...@@ -518,7 +523,10 @@ static int acpi_battery_read(struct acpi_battery *battery)
static int acpi_battery_add(struct acpi_sbs *sbs, int id) static int acpi_battery_add(struct acpi_sbs *sbs, int id)
{ {
struct acpi_battery *battery = &sbs->battery[id]; struct acpi_battery *battery = &sbs->battery[id];
struct power_supply_config psy_cfg = { .drv_data = battery, }; struct power_supply_config psy_cfg = {
.drv_data = battery,
.attr_grp = acpi_battery_groups,
};
int result; int result;
battery->id = id; battery->id = id;
...@@ -548,10 +556,6 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) ...@@ -548,10 +556,6 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id)
goto end; goto end;
} }
result = device_create_file(&battery->bat->dev, &alarm_attr);
if (result)
goto end;
battery->have_sysfs_alarm = 1;
end: end:
pr_info("%s [%s]: Battery Slot [%s] (battery %s)\n", pr_info("%s [%s]: Battery Slot [%s] (battery %s)\n",
ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device),
...@@ -563,11 +567,8 @@ static void acpi_battery_remove(struct acpi_sbs *sbs, int id) ...@@ -563,11 +567,8 @@ static void acpi_battery_remove(struct acpi_sbs *sbs, int id)
{ {
struct acpi_battery *battery = &sbs->battery[id]; struct acpi_battery *battery = &sbs->battery[id];
if (battery->bat) { if (battery->bat)
if (battery->have_sysfs_alarm)
device_remove_file(&battery->bat->dev, &alarm_attr);
power_supply_unregister(battery->bat); power_supply_unregister(battery->bat);
}
} }
static int acpi_charger_add(struct acpi_sbs *sbs) static int acpi_charger_add(struct acpi_sbs *sbs)
......
...@@ -539,6 +539,14 @@ static const struct dmi_system_id video_detect_dmi_table[] = { ...@@ -539,6 +539,14 @@ static const struct dmi_system_id video_detect_dmi_table[] = {
DMI_MATCH(DMI_PRODUCT_NAME, "iMac12,2"), DMI_MATCH(DMI_PRODUCT_NAME, "iMac12,2"),
}, },
}, },
{
.callback = video_detect_force_native,
/* Apple MacBook Air 9,1 */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."),
DMI_MATCH(DMI_PRODUCT_NAME, "MacBookAir9,1"),
},
},
{ {
/* https://bugzilla.redhat.com/show_bug.cgi?id=1217249 */ /* https://bugzilla.redhat.com/show_bug.cgi?id=1217249 */
.callback = video_detect_force_native, .callback = video_detect_force_native,
...@@ -548,6 +556,14 @@ static const struct dmi_system_id video_detect_dmi_table[] = { ...@@ -548,6 +556,14 @@ static const struct dmi_system_id video_detect_dmi_table[] = {
DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro12,1"), DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro12,1"),
}, },
}, },
{
.callback = video_detect_force_native,
/* Apple MacBook Pro 16,2 */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."),
DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,2"),
},
},
{ {
.callback = video_detect_force_native, .callback = video_detect_force_native,
/* Dell Inspiron N4010 */ /* Dell Inspiron N4010 */
......
...@@ -338,8 +338,8 @@ static const struct lpss_device_desc bsw_spi_dev_desc = { ...@@ -338,8 +338,8 @@ static const struct lpss_device_desc bsw_spi_dev_desc = {
}; };
static const struct x86_cpu_id lpss_cpu_ids[] = { static const struct x86_cpu_id lpss_cpu_ids[] = {
X86_MATCH_INTEL_FAM6_MODEL(ATOM_SILVERMONT, NULL), X86_MATCH_VFM(INTEL_ATOM_SILVERMONT, NULL),
X86_MATCH_INTEL_FAM6_MODEL(ATOM_AIRMONT, NULL), X86_MATCH_VFM(INTEL_ATOM_AIRMONT, NULL),
{} {}
}; };
......
...@@ -45,37 +45,37 @@ struct override_status_id { ...@@ -45,37 +45,37 @@ struct override_status_id {
unsigned long long status; unsigned long long status;
}; };
#define ENTRY(status, hid, uid, path, cpu_model, dmi...) { \ #define ENTRY(status, hid, uid, path, cpu_vfm, dmi...) { \
{ { hid, }, {} }, \ { { hid, }, {} }, \
{ X86_MATCH_INTEL_FAM6_MODEL(cpu_model, NULL), {} }, \ { X86_MATCH_VFM(cpu_vfm, NULL), {} }, \
{ { .matches = dmi }, {} }, \ { { .matches = dmi }, {} }, \
uid, \ uid, \
path, \ path, \
status, \ status, \
} }
#define PRESENT_ENTRY_HID(hid, uid, cpu_model, dmi...) \ #define PRESENT_ENTRY_HID(hid, uid, cpu_vfm, dmi...) \
ENTRY(ACPI_STA_DEFAULT, hid, uid, NULL, cpu_model, dmi) ENTRY(ACPI_STA_DEFAULT, hid, uid, NULL, cpu_vfm, dmi)
#define NOT_PRESENT_ENTRY_HID(hid, uid, cpu_model, dmi...) \ #define NOT_PRESENT_ENTRY_HID(hid, uid, cpu_vfm, dmi...) \
ENTRY(0, hid, uid, NULL, cpu_model, dmi) ENTRY(0, hid, uid, NULL, cpu_vfm, dmi)
#define PRESENT_ENTRY_PATH(path, cpu_model, dmi...) \ #define PRESENT_ENTRY_PATH(path, cpu_vfm, dmi...) \
ENTRY(ACPI_STA_DEFAULT, "", NULL, path, cpu_model, dmi) ENTRY(ACPI_STA_DEFAULT, "", NULL, path, cpu_vfm, dmi)
#define NOT_PRESENT_ENTRY_PATH(path, cpu_model, dmi...) \ #define NOT_PRESENT_ENTRY_PATH(path, cpu_vfm, dmi...) \
ENTRY(0, "", NULL, path, cpu_model, dmi) ENTRY(0, "", NULL, path, cpu_vfm, dmi)
static const struct override_status_id override_status_ids[] = { static const struct override_status_id override_status_ids[] = {
/* /*
* Bay / Cherry Trail PWM directly poked by GPU driver in win10, * Bay / Cherry Trail PWM directly poked by GPU driver in win10,
* but Linux uses a separate PWM driver, harmless if not used. * but Linux uses a separate PWM driver, harmless if not used.
*/ */
PRESENT_ENTRY_HID("80860F09", "1", ATOM_SILVERMONT, {}), PRESENT_ENTRY_HID("80860F09", "1", INTEL_ATOM_SILVERMONT, {}),
PRESENT_ENTRY_HID("80862288", "1", ATOM_AIRMONT, {}), PRESENT_ENTRY_HID("80862288", "1", INTEL_ATOM_AIRMONT, {}),
/* The Xiaomi Mi Pad 2 uses PWM2 for touchkeys backlight control */ /* The Xiaomi Mi Pad 2 uses PWM2 for touchkeys backlight control */
PRESENT_ENTRY_HID("80862289", "2", ATOM_AIRMONT, { PRESENT_ENTRY_HID("80862289", "2", INTEL_ATOM_AIRMONT, {
DMI_MATCH(DMI_SYS_VENDOR, "Xiaomi Inc"), DMI_MATCH(DMI_SYS_VENDOR, "Xiaomi Inc"),
DMI_MATCH(DMI_PRODUCT_NAME, "Mipad2"), DMI_MATCH(DMI_PRODUCT_NAME, "Mipad2"),
}), }),
...@@ -84,18 +84,18 @@ static const struct override_status_id override_status_ids[] = { ...@@ -84,18 +84,18 @@ static const struct override_status_id override_status_ids[] = {
* The INT0002 device is necessary to clear wakeup interrupt sources * The INT0002 device is necessary to clear wakeup interrupt sources
* on Cherry Trail devices, without it we get nobody cared IRQ msgs. * on Cherry Trail devices, without it we get nobody cared IRQ msgs.
*/ */
PRESENT_ENTRY_HID("INT0002", "1", ATOM_AIRMONT, {}), PRESENT_ENTRY_HID("INT0002", "1", INTEL_ATOM_AIRMONT, {}),
/* /*
* On the Dell Venue 11 Pro 7130 and 7139, the DSDT hides * On the Dell Venue 11 Pro 7130 and 7139, the DSDT hides
* the touchscreen ACPI device until a certain time * the touchscreen ACPI device until a certain time
* after _SB.PCI0.GFX0.LCD.LCD1._ON gets called has passed * after _SB.PCI0.GFX0.LCD.LCD1._ON gets called has passed
* *and* _STA has been called at least 3 times since. * *and* _STA has been called at least 3 times since.
*/ */
PRESENT_ENTRY_HID("SYNA7500", "1", HASWELL_L, { PRESENT_ENTRY_HID("SYNA7500", "1", INTEL_HASWELL_L, {
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
DMI_MATCH(DMI_PRODUCT_NAME, "Venue 11 Pro 7130"), DMI_MATCH(DMI_PRODUCT_NAME, "Venue 11 Pro 7130"),
}), }),
PRESENT_ENTRY_HID("SYNA7500", "1", HASWELL_L, { PRESENT_ENTRY_HID("SYNA7500", "1", INTEL_HASWELL_L, {
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
DMI_MATCH(DMI_PRODUCT_NAME, "Venue 11 Pro 7139"), DMI_MATCH(DMI_PRODUCT_NAME, "Venue 11 Pro 7139"),
}), }),
...@@ -104,7 +104,7 @@ static const struct override_status_id override_status_ids[] = { ...@@ -104,7 +104,7 @@ static const struct override_status_id override_status_ids[] = {
* The Dell XPS 15 9550 has a SMO8110 accelerometer / * The Dell XPS 15 9550 has a SMO8110 accelerometer /
* HDD freefall sensor which is wrongly marked as not present. * HDD freefall sensor which is wrongly marked as not present.
*/ */
PRESENT_ENTRY_HID("SMO8810", "1", SKYLAKE, { PRESENT_ENTRY_HID("SMO8810", "1", INTEL_SKYLAKE, {
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
DMI_MATCH(DMI_PRODUCT_NAME, "XPS 15 9550"), DMI_MATCH(DMI_PRODUCT_NAME, "XPS 15 9550"),
}), }),
...@@ -121,19 +121,19 @@ static const struct override_status_id override_status_ids[] = { ...@@ -121,19 +121,19 @@ static const struct override_status_id override_status_ids[] = {
* was copy-pasted from the GPD win, so it has a disabled KIOX000A * was copy-pasted from the GPD win, so it has a disabled KIOX000A
* node which we should not enable, thus we also check the BIOS date. * node which we should not enable, thus we also check the BIOS date.
*/ */
PRESENT_ENTRY_HID("KIOX000A", "1", ATOM_AIRMONT, { PRESENT_ENTRY_HID("KIOX000A", "1", INTEL_ATOM_AIRMONT, {
DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"), DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
DMI_MATCH(DMI_BOARD_NAME, "Default string"), DMI_MATCH(DMI_BOARD_NAME, "Default string"),
DMI_MATCH(DMI_PRODUCT_NAME, "Default string"), DMI_MATCH(DMI_PRODUCT_NAME, "Default string"),
DMI_MATCH(DMI_BIOS_DATE, "02/21/2017") DMI_MATCH(DMI_BIOS_DATE, "02/21/2017")
}), }),
PRESENT_ENTRY_HID("KIOX000A", "1", ATOM_AIRMONT, { PRESENT_ENTRY_HID("KIOX000A", "1", INTEL_ATOM_AIRMONT, {
DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"), DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
DMI_MATCH(DMI_BOARD_NAME, "Default string"), DMI_MATCH(DMI_BOARD_NAME, "Default string"),
DMI_MATCH(DMI_PRODUCT_NAME, "Default string"), DMI_MATCH(DMI_PRODUCT_NAME, "Default string"),
DMI_MATCH(DMI_BIOS_DATE, "03/20/2017") DMI_MATCH(DMI_BIOS_DATE, "03/20/2017")
}), }),
PRESENT_ENTRY_HID("KIOX000A", "1", ATOM_AIRMONT, { PRESENT_ENTRY_HID("KIOX000A", "1", INTEL_ATOM_AIRMONT, {
DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"), DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
DMI_MATCH(DMI_BOARD_NAME, "Default string"), DMI_MATCH(DMI_BOARD_NAME, "Default string"),
DMI_MATCH(DMI_PRODUCT_NAME, "Default string"), DMI_MATCH(DMI_PRODUCT_NAME, "Default string"),
...@@ -146,7 +146,7 @@ static const struct override_status_id override_status_ids[] = { ...@@ -146,7 +146,7 @@ static const struct override_status_id override_status_ids[] = {
* method sets a GPIO causing the PCI wifi card to turn off. * method sets a GPIO causing the PCI wifi card to turn off.
* See above remark about uniqueness of the DMI match. * See above remark about uniqueness of the DMI match.
*/ */
NOT_PRESENT_ENTRY_PATH("\\_SB_.PCI0.SDHB.BRC1", ATOM_AIRMONT, { NOT_PRESENT_ENTRY_PATH("\\_SB_.PCI0.SDHB.BRC1", INTEL_ATOM_AIRMONT, {
DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"), DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
DMI_EXACT_MATCH(DMI_BOARD_NAME, "Default string"), DMI_EXACT_MATCH(DMI_BOARD_NAME, "Default string"),
DMI_EXACT_MATCH(DMI_BOARD_SERIAL, "Default string"), DMI_EXACT_MATCH(DMI_BOARD_SERIAL, "Default string"),
...@@ -158,7 +158,7 @@ static const struct override_status_id override_status_ids[] = { ...@@ -158,7 +158,7 @@ static const struct override_status_id override_status_ids[] = {
* as both ACCL0001 and MAGN0001. As we can only ever register an * as both ACCL0001 and MAGN0001. As we can only ever register an
* i2c client for one of them, ignore MAGN0001. * i2c client for one of them, ignore MAGN0001.
*/ */
NOT_PRESENT_ENTRY_HID("MAGN0001", "1", ATOM_SILVERMONT, { NOT_PRESENT_ENTRY_HID("MAGN0001", "1", INTEL_ATOM_SILVERMONT, {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_FAMILY, "YOGATablet2"), DMI_MATCH(DMI_PRODUCT_FAMILY, "YOGATablet2"),
}), }),
......
...@@ -24,6 +24,7 @@ struct irq_domain_ops; ...@@ -24,6 +24,7 @@ struct irq_domain_ops;
#define _LINUX #define _LINUX
#endif #endif
#include <acpi/acpi.h> #include <acpi/acpi.h>
#include <acpi/acpi_numa.h>
#ifdef CONFIG_ACPI #ifdef CONFIG_ACPI
...@@ -35,7 +36,6 @@ struct irq_domain_ops; ...@@ -35,7 +36,6 @@ struct irq_domain_ops;
#include <acpi/acpi_bus.h> #include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h> #include <acpi/acpi_drivers.h>
#include <acpi/acpi_numa.h>
#include <acpi/acpi_io.h> #include <acpi/acpi_io.h>
#include <asm/acpi.h> #include <asm/acpi.h>
...@@ -573,6 +573,7 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context); ...@@ -573,6 +573,7 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context);
#define OSC_SB_CPC_FLEXIBLE_ADR_SPACE 0x00004000 #define OSC_SB_CPC_FLEXIBLE_ADR_SPACE 0x00004000
#define OSC_SB_GENERIC_INITIATOR_SUPPORT 0x00020000 #define OSC_SB_GENERIC_INITIATOR_SUPPORT 0x00020000
#define OSC_SB_NATIVE_USB4_SUPPORT 0x00040000 #define OSC_SB_NATIVE_USB4_SUPPORT 0x00040000
#define OSC_SB_BATTERY_CHARGE_LIMITING_SUPPORT 0x00080000
#define OSC_SB_PRM_SUPPORT 0x00200000 #define OSC_SB_PRM_SUPPORT 0x00200000
#define OSC_SB_FFH_OPR_SUPPORT 0x00400000 #define OSC_SB_FFH_OPR_SUPPORT 0x00400000
...@@ -774,8 +775,6 @@ const char *acpi_get_subsystem_id(acpi_handle handle); ...@@ -774,8 +775,6 @@ const char *acpi_get_subsystem_id(acpi_handle handle);
#define acpi_dev_uid_match(adev, uid2) (adev && false) #define acpi_dev_uid_match(adev, uid2) (adev && false)
#define acpi_dev_hid_uid_match(adev, hid2, uid2) (adev && false) #define acpi_dev_hid_uid_match(adev, hid2, uid2) (adev && false)
#include <acpi/acpi_numa.h>
struct fwnode_handle; struct fwnode_handle;
static inline bool acpi_dev_found(const char *hid) static inline bool acpi_dev_found(const char *hid)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment