mirror of https://gitee.com/openkylin/linux.git
Merge branches 'acpi-soc', 'acpi-bus', 'acpi-pmic' and 'acpi-power'
* acpi-soc: ACPI / LPSS: Call pwm_add_table() for Bay Trail PWM device i2c: designware: Add ACPI HID for Hisilicon Hip07/08 I2C controller ACPI / APD: Add clock frequency for Hisilicon Hip07/08 I2C controller * acpi-bus: ACPI / bus: Add INT0002 to list of always-present devices ACPI / bus: Introduce a list of ids for "always present" devices * acpi-pmic: ACPI / PMIC: xpower: Fix power_table addresses * acpi-power: ACPI / power: Delay turning off unused power resources after suspend
This commit is contained in:
commit
46436eb2f9
|
@ -50,6 +50,7 @@ acpi-$(CONFIG_ACPI_REDUCED_HARDWARE_ONLY) += evged.o
|
||||||
acpi-y += sysfs.o
|
acpi-y += sysfs.o
|
||||||
acpi-y += property.o
|
acpi-y += property.o
|
||||||
acpi-$(CONFIG_X86) += acpi_cmos_rtc.o
|
acpi-$(CONFIG_X86) += acpi_cmos_rtc.o
|
||||||
|
acpi-$(CONFIG_X86) += x86/utils.o
|
||||||
acpi-$(CONFIG_DEBUG_FS) += debugfs.o
|
acpi-$(CONFIG_DEBUG_FS) += debugfs.o
|
||||||
acpi-$(CONFIG_ACPI_NUMA) += numa.o
|
acpi-$(CONFIG_ACPI_NUMA) += numa.o
|
||||||
acpi-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o
|
acpi-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o
|
||||||
|
|
|
@ -106,6 +106,16 @@ static const struct apd_device_desc vulcan_spi_desc = {
|
||||||
.setup = acpi_apd_setup,
|
.setup = acpi_apd_setup,
|
||||||
.fixed_clk_rate = 133000000,
|
.fixed_clk_rate = 133000000,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const struct apd_device_desc hip07_i2c_desc = {
|
||||||
|
.setup = acpi_apd_setup,
|
||||||
|
.fixed_clk_rate = 200000000,
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct apd_device_desc hip08_i2c_desc = {
|
||||||
|
.setup = acpi_apd_setup,
|
||||||
|
.fixed_clk_rate = 250000000,
|
||||||
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -169,6 +179,8 @@ static const struct acpi_device_id acpi_apd_device_ids[] = {
|
||||||
#ifdef CONFIG_ARM64
|
#ifdef CONFIG_ARM64
|
||||||
{ "APMC0D0F", APD_ADDR(xgene_i2c_desc) },
|
{ "APMC0D0F", APD_ADDR(xgene_i2c_desc) },
|
||||||
{ "BRCM900D", APD_ADDR(vulcan_spi_desc) },
|
{ "BRCM900D", APD_ADDR(vulcan_spi_desc) },
|
||||||
|
{ "HISI0A21", APD_ADDR(hip07_i2c_desc) },
|
||||||
|
{ "HISI0A22", APD_ADDR(hip08_i2c_desc) },
|
||||||
#endif
|
#endif
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
|
@ -143,6 +143,22 @@ static void lpss_deassert_reset(struct lpss_private_data *pdata)
|
||||||
writel(val, pdata->mmio_base + offset);
|
writel(val, pdata->mmio_base + offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* BYT PWM used for backlight control by the i915 driver on systems without
|
||||||
|
* the Crystal Cove PMIC.
|
||||||
|
*/
|
||||||
|
static struct pwm_lookup byt_pwm_lookup[] = {
|
||||||
|
PWM_LOOKUP_WITH_MODULE("80860F09:00", 0, "0000:00:02.0",
|
||||||
|
"pwm_backlight", 0, PWM_POLARITY_NORMAL,
|
||||||
|
"pwm-lpss-platform"),
|
||||||
|
};
|
||||||
|
|
||||||
|
static void byt_pwm_setup(struct lpss_private_data *pdata)
|
||||||
|
{
|
||||||
|
if (!acpi_dev_present("INT33FD", NULL, -1))
|
||||||
|
pwm_add_table(byt_pwm_lookup, ARRAY_SIZE(byt_pwm_lookup));
|
||||||
|
}
|
||||||
|
|
||||||
#define LPSS_I2C_ENABLE 0x6c
|
#define LPSS_I2C_ENABLE 0x6c
|
||||||
|
|
||||||
static void byt_i2c_setup(struct lpss_private_data *pdata)
|
static void byt_i2c_setup(struct lpss_private_data *pdata)
|
||||||
|
@ -200,6 +216,7 @@ static const struct lpss_device_desc lpt_sdio_dev_desc = {
|
||||||
|
|
||||||
static const struct lpss_device_desc byt_pwm_dev_desc = {
|
static const struct lpss_device_desc byt_pwm_dev_desc = {
|
||||||
.flags = LPSS_SAVE_CTX,
|
.flags = LPSS_SAVE_CTX,
|
||||||
|
.setup = byt_pwm_setup,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct lpss_device_desc bsw_pwm_dev_desc = {
|
static const struct lpss_device_desc bsw_pwm_dev_desc = {
|
||||||
|
|
|
@ -114,6 +114,11 @@ int acpi_bus_get_status(struct acpi_device *device)
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
unsigned long long sta;
|
unsigned long long sta;
|
||||||
|
|
||||||
|
if (acpi_device_always_present(device)) {
|
||||||
|
acpi_set_device_status(device, ACPI_STA_DEFAULT);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
status = acpi_bus_get_status_handle(device->handle, &sta);
|
status = acpi_bus_get_status_handle(device->handle, &sta);
|
||||||
if (ACPI_FAILURE(status))
|
if (ACPI_FAILURE(status))
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
|
@ -27,97 +27,97 @@ static struct pmic_table power_table[] = {
|
||||||
.address = 0x00,
|
.address = 0x00,
|
||||||
.reg = 0x13,
|
.reg = 0x13,
|
||||||
.bit = 0x05,
|
.bit = 0x05,
|
||||||
},
|
}, /* ALD1 */
|
||||||
{
|
{
|
||||||
.address = 0x04,
|
.address = 0x04,
|
||||||
.reg = 0x13,
|
.reg = 0x13,
|
||||||
.bit = 0x06,
|
.bit = 0x06,
|
||||||
},
|
}, /* ALD2 */
|
||||||
{
|
{
|
||||||
.address = 0x08,
|
.address = 0x08,
|
||||||
.reg = 0x13,
|
.reg = 0x13,
|
||||||
.bit = 0x07,
|
.bit = 0x07,
|
||||||
},
|
}, /* ALD3 */
|
||||||
{
|
{
|
||||||
.address = 0x0c,
|
.address = 0x0c,
|
||||||
.reg = 0x12,
|
.reg = 0x12,
|
||||||
.bit = 0x03,
|
.bit = 0x03,
|
||||||
},
|
}, /* DLD1 */
|
||||||
{
|
{
|
||||||
.address = 0x10,
|
.address = 0x10,
|
||||||
.reg = 0x12,
|
.reg = 0x12,
|
||||||
.bit = 0x04,
|
.bit = 0x04,
|
||||||
},
|
}, /* DLD2 */
|
||||||
{
|
{
|
||||||
.address = 0x14,
|
.address = 0x14,
|
||||||
.reg = 0x12,
|
.reg = 0x12,
|
||||||
.bit = 0x05,
|
.bit = 0x05,
|
||||||
},
|
}, /* DLD3 */
|
||||||
{
|
{
|
||||||
.address = 0x18,
|
.address = 0x18,
|
||||||
.reg = 0x12,
|
.reg = 0x12,
|
||||||
.bit = 0x06,
|
.bit = 0x06,
|
||||||
},
|
}, /* DLD4 */
|
||||||
{
|
{
|
||||||
.address = 0x1c,
|
.address = 0x1c,
|
||||||
.reg = 0x12,
|
.reg = 0x12,
|
||||||
.bit = 0x00,
|
.bit = 0x00,
|
||||||
},
|
}, /* ELD1 */
|
||||||
{
|
{
|
||||||
.address = 0x20,
|
.address = 0x20,
|
||||||
.reg = 0x12,
|
.reg = 0x12,
|
||||||
.bit = 0x01,
|
.bit = 0x01,
|
||||||
},
|
}, /* ELD2 */
|
||||||
{
|
{
|
||||||
.address = 0x24,
|
.address = 0x24,
|
||||||
.reg = 0x12,
|
.reg = 0x12,
|
||||||
.bit = 0x02,
|
.bit = 0x02,
|
||||||
},
|
}, /* ELD3 */
|
||||||
{
|
{
|
||||||
.address = 0x28,
|
.address = 0x28,
|
||||||
.reg = 0x13,
|
.reg = 0x13,
|
||||||
.bit = 0x02,
|
.bit = 0x02,
|
||||||
},
|
}, /* FLD1 */
|
||||||
{
|
{
|
||||||
.address = 0x2c,
|
.address = 0x2c,
|
||||||
.reg = 0x13,
|
.reg = 0x13,
|
||||||
.bit = 0x03,
|
.bit = 0x03,
|
||||||
},
|
}, /* FLD2 */
|
||||||
{
|
{
|
||||||
.address = 0x30,
|
.address = 0x30,
|
||||||
.reg = 0x13,
|
.reg = 0x13,
|
||||||
.bit = 0x04,
|
.bit = 0x04,
|
||||||
},
|
}, /* FLD3 */
|
||||||
|
{
|
||||||
|
.address = 0x34,
|
||||||
|
.reg = 0x10,
|
||||||
|
.bit = 0x03,
|
||||||
|
}, /* BUC1 */
|
||||||
{
|
{
|
||||||
.address = 0x38,
|
.address = 0x38,
|
||||||
.reg = 0x10,
|
.reg = 0x10,
|
||||||
.bit = 0x03,
|
.bit = 0x06,
|
||||||
},
|
}, /* BUC2 */
|
||||||
{
|
{
|
||||||
.address = 0x3c,
|
.address = 0x3c,
|
||||||
.reg = 0x10,
|
.reg = 0x10,
|
||||||
.bit = 0x06,
|
.bit = 0x05,
|
||||||
},
|
}, /* BUC3 */
|
||||||
{
|
{
|
||||||
.address = 0x40,
|
.address = 0x40,
|
||||||
.reg = 0x10,
|
.reg = 0x10,
|
||||||
.bit = 0x05,
|
.bit = 0x04,
|
||||||
},
|
}, /* BUC4 */
|
||||||
{
|
{
|
||||||
.address = 0x44,
|
.address = 0x44,
|
||||||
.reg = 0x10,
|
.reg = 0x10,
|
||||||
.bit = 0x04,
|
.bit = 0x01,
|
||||||
},
|
}, /* BUC5 */
|
||||||
{
|
{
|
||||||
.address = 0x48,
|
.address = 0x48,
|
||||||
.reg = 0x10,
|
.reg = 0x10,
|
||||||
.bit = 0x01,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.address = 0x4c,
|
|
||||||
.reg = 0x10,
|
|
||||||
.bit = 0x00
|
.bit = 0x00
|
||||||
},
|
}, /* BUC6 */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* TMP0 - TMP5 are the same, all from GPADC */
|
/* TMP0 - TMP5 are the same, all from GPADC */
|
||||||
|
|
|
@ -864,6 +864,16 @@ void acpi_resume_power_resources(void)
|
||||||
|
|
||||||
mutex_unlock(&resource->resource_lock);
|
mutex_unlock(&resource->resource_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mutex_unlock(&power_resource_list_lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
void acpi_turn_off_unused_power_resources(void)
|
||||||
|
{
|
||||||
|
struct acpi_power_resource *resource;
|
||||||
|
|
||||||
|
mutex_lock(&power_resource_list_lock);
|
||||||
|
|
||||||
list_for_each_entry_reverse(resource, &acpi_power_resource_list, list_node) {
|
list_for_each_entry_reverse(resource, &acpi_power_resource_list, list_node) {
|
||||||
int result, state;
|
int result, state;
|
||||||
|
|
||||||
|
|
|
@ -474,6 +474,7 @@ static void acpi_pm_start(u32 acpi_state)
|
||||||
*/
|
*/
|
||||||
static void acpi_pm_end(void)
|
static void acpi_pm_end(void)
|
||||||
{
|
{
|
||||||
|
acpi_turn_off_unused_power_resources();
|
||||||
acpi_scan_lock_release();
|
acpi_scan_lock_release();
|
||||||
/*
|
/*
|
||||||
* This is necessary in case acpi_pm_finish() is not called during a
|
* This is necessary in case acpi_pm_finish() is not called during a
|
||||||
|
|
|
@ -6,6 +6,7 @@ extern struct list_head acpi_wakeup_device_list;
|
||||||
extern struct mutex acpi_device_lock;
|
extern struct mutex acpi_device_lock;
|
||||||
|
|
||||||
extern void acpi_resume_power_resources(void);
|
extern void acpi_resume_power_resources(void);
|
||||||
|
extern void acpi_turn_off_unused_power_resources(void);
|
||||||
|
|
||||||
static inline acpi_status acpi_set_waking_vector(u32 wakeup_address)
|
static inline acpi_status acpi_set_waking_vector(u32 wakeup_address)
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,90 @@
|
||||||
|
/*
|
||||||
|
* X86 ACPI Utility Functions
|
||||||
|
*
|
||||||
|
* Copyright (C) 2017 Hans de Goede <hdegoede@redhat.com>
|
||||||
|
*
|
||||||
|
* Based on various non upstream patches to support the CHT Whiskey Cove PMIC:
|
||||||
|
* Copyright (C) 2013-2015 Intel Corporation. All rights reserved.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <linux/acpi.h>
|
||||||
|
#include <asm/cpu_device_id.h>
|
||||||
|
#include <asm/intel-family.h>
|
||||||
|
#include "../internal.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Some ACPI devices are hidden (status == 0x0) in recent BIOS-es because
|
||||||
|
* some recent Windows drivers bind to one device but poke at multiple
|
||||||
|
* devices at the same time, so the others get hidden.
|
||||||
|
* We work around this by always reporting ACPI_STA_DEFAULT for these
|
||||||
|
* devices. Note this MUST only be done for devices where this is safe.
|
||||||
|
*
|
||||||
|
* This forcing of devices to be present is limited to specific CPU (SoC)
|
||||||
|
* models both to avoid potentially causing trouble on other models and
|
||||||
|
* because some HIDs are re-used on different SoCs for completely
|
||||||
|
* different devices.
|
||||||
|
*/
|
||||||
|
struct always_present_id {
|
||||||
|
struct acpi_device_id hid[2];
|
||||||
|
struct x86_cpu_id cpu_ids[2];
|
||||||
|
const char *uid;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define ICPU(model) { X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, }
|
||||||
|
|
||||||
|
#define ENTRY(hid, uid, cpu_models) { \
|
||||||
|
{ { hid, }, {} }, \
|
||||||
|
{ cpu_models, {} }, \
|
||||||
|
uid, \
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct always_present_id always_present_ids[] = {
|
||||||
|
/*
|
||||||
|
* Bay / Cherry Trail PWM directly poked by GPU driver in win10,
|
||||||
|
* but Linux uses a separate PWM driver, harmless if not used.
|
||||||
|
*/
|
||||||
|
ENTRY("80860F09", "1", ICPU(INTEL_FAM6_ATOM_SILVERMONT1)),
|
||||||
|
ENTRY("80862288", "1", ICPU(INTEL_FAM6_ATOM_AIRMONT)),
|
||||||
|
/*
|
||||||
|
* The INT0002 device is necessary to clear wakeup interrupt sources
|
||||||
|
* on Cherry Trail devices, without it we get nobody cared IRQ msgs.
|
||||||
|
*/
|
||||||
|
ENTRY("INT0002", "1", ICPU(INTEL_FAM6_ATOM_AIRMONT)),
|
||||||
|
};
|
||||||
|
|
||||||
|
bool acpi_device_always_present(struct acpi_device *adev)
|
||||||
|
{
|
||||||
|
u32 *status = (u32 *)&adev->status;
|
||||||
|
u32 old_status = *status;
|
||||||
|
bool ret = false;
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
/* acpi_match_device_ids checks status, so set it to default */
|
||||||
|
*status = ACPI_STA_DEFAULT;
|
||||||
|
for (i = 0; i < ARRAY_SIZE(always_present_ids); i++) {
|
||||||
|
if (acpi_match_device_ids(adev, always_present_ids[i].hid))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!adev->pnp.unique_id ||
|
||||||
|
strcmp(adev->pnp.unique_id, always_present_ids[i].uid))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!x86_match_cpu(always_present_ids[i].cpu_ids))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (old_status != ACPI_STA_DEFAULT) /* Log only once */
|
||||||
|
dev_info(&adev->dev,
|
||||||
|
"Device [%s] is in always present list\n",
|
||||||
|
adev->pnp.bus_id);
|
||||||
|
|
||||||
|
ret = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
*status = old_status;
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
|
@ -129,6 +129,8 @@ static const struct acpi_device_id dw_i2c_acpi_match[] = {
|
||||||
{ "AMDI0010", ACCESS_INTR_MASK },
|
{ "AMDI0010", ACCESS_INTR_MASK },
|
||||||
{ "AMDI0510", 0 },
|
{ "AMDI0510", 0 },
|
||||||
{ "APMC0D0F", 0 },
|
{ "APMC0D0F", 0 },
|
||||||
|
{ "HISI02A1", 0 },
|
||||||
|
{ "HISI02A2", 0 },
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
MODULE_DEVICE_TABLE(acpi, dw_i2c_acpi_match);
|
MODULE_DEVICE_TABLE(acpi, dw_i2c_acpi_match);
|
||||||
|
|
|
@ -587,6 +587,15 @@ struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle);
|
||||||
int acpi_enable_wakeup_device_power(struct acpi_device *dev, int state);
|
int acpi_enable_wakeup_device_power(struct acpi_device *dev, int state);
|
||||||
int acpi_disable_wakeup_device_power(struct acpi_device *dev);
|
int acpi_disable_wakeup_device_power(struct acpi_device *dev);
|
||||||
|
|
||||||
|
#ifdef CONFIG_X86
|
||||||
|
bool acpi_device_always_present(struct acpi_device *adev);
|
||||||
|
#else
|
||||||
|
static inline bool acpi_device_always_present(struct acpi_device *adev)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_PM
|
#ifdef CONFIG_PM
|
||||||
acpi_status acpi_add_pm_notifier(struct acpi_device *adev, struct device *dev,
|
acpi_status acpi_add_pm_notifier(struct acpi_device *adev, struct device *dev,
|
||||||
void (*work_func)(struct work_struct *work));
|
void (*work_func)(struct work_struct *work));
|
||||||
|
|
Loading…
Reference in New Issue