mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 16:10:56 +07:00
ACPI: SBS: Ignore alarms coming from unknown devices
http://bugzilla.kernel.org/show_bug.cgi?id=9362 Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de> Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
parent
09f1fb41ad
commit
c2d00f2d1b
@ -54,12 +54,6 @@
|
|||||||
#define ACPI_BATTERY_DIR_NAME "BAT%i"
|
#define ACPI_BATTERY_DIR_NAME "BAT%i"
|
||||||
#define ACPI_AC_DIR_NAME "AC0"
|
#define ACPI_AC_DIR_NAME "AC0"
|
||||||
|
|
||||||
enum acpi_sbs_device_addr {
|
|
||||||
ACPI_SBS_CHARGER = 0x9,
|
|
||||||
ACPI_SBS_MANAGER = 0xa,
|
|
||||||
ACPI_SBS_BATTERY = 0xb,
|
|
||||||
};
|
|
||||||
|
|
||||||
#define ACPI_SBS_NOTIFY_STATUS 0x80
|
#define ACPI_SBS_NOTIFY_STATUS 0x80
|
||||||
#define ACPI_SBS_NOTIFY_INFO 0x81
|
#define ACPI_SBS_NOTIFY_INFO 0x81
|
||||||
|
|
||||||
|
@ -202,10 +202,9 @@ int acpi_smbus_unregister_callback(struct acpi_smb_hc *hc)
|
|||||||
|
|
||||||
EXPORT_SYMBOL_GPL(acpi_smbus_unregister_callback);
|
EXPORT_SYMBOL_GPL(acpi_smbus_unregister_callback);
|
||||||
|
|
||||||
static void acpi_smbus_callback(void *context)
|
static inline void acpi_smbus_callback(void *context)
|
||||||
{
|
{
|
||||||
struct acpi_smb_hc *hc = context;
|
struct acpi_smb_hc *hc = context;
|
||||||
|
|
||||||
if (hc->callback)
|
if (hc->callback)
|
||||||
hc->callback(hc->context);
|
hc->callback(hc->context);
|
||||||
}
|
}
|
||||||
@ -214,6 +213,7 @@ static int smbus_alarm(void *context)
|
|||||||
{
|
{
|
||||||
struct acpi_smb_hc *hc = context;
|
struct acpi_smb_hc *hc = context;
|
||||||
union acpi_smb_status status;
|
union acpi_smb_status status;
|
||||||
|
u8 address;
|
||||||
if (smb_hc_read(hc, ACPI_SMB_STATUS, &status.raw))
|
if (smb_hc_read(hc, ACPI_SMB_STATUS, &status.raw))
|
||||||
return 0;
|
return 0;
|
||||||
/* Check if it is only a completion notify */
|
/* Check if it is only a completion notify */
|
||||||
@ -222,10 +222,18 @@ static int smbus_alarm(void *context)
|
|||||||
if (!status.fields.alarm)
|
if (!status.fields.alarm)
|
||||||
return 0;
|
return 0;
|
||||||
mutex_lock(&hc->lock);
|
mutex_lock(&hc->lock);
|
||||||
|
smb_hc_read(hc, ACPI_SMB_ALARM_ADDRESS, &address);
|
||||||
status.fields.alarm = 0;
|
status.fields.alarm = 0;
|
||||||
smb_hc_write(hc, ACPI_SMB_STATUS, status.raw);
|
smb_hc_write(hc, ACPI_SMB_STATUS, status.raw);
|
||||||
if (hc->callback)
|
/* We are only interested in events coming from known devices */
|
||||||
acpi_os_execute(OSL_GPE_HANDLER, acpi_smbus_callback, hc);
|
switch (address >> 1) {
|
||||||
|
case ACPI_SBS_CHARGER:
|
||||||
|
case ACPI_SBS_MANAGER:
|
||||||
|
case ACPI_SBS_BATTERY:
|
||||||
|
acpi_os_execute(OSL_GPE_HANDLER,
|
||||||
|
acpi_smbus_callback, hc);
|
||||||
|
default:;
|
||||||
|
}
|
||||||
mutex_unlock(&hc->lock);
|
mutex_unlock(&hc->lock);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,12 @@ enum acpi_smb_protocol {
|
|||||||
|
|
||||||
static const u8 SMBUS_PEC = 0x80;
|
static const u8 SMBUS_PEC = 0x80;
|
||||||
|
|
||||||
|
enum acpi_sbs_device_addr {
|
||||||
|
ACPI_SBS_CHARGER = 0x9,
|
||||||
|
ACPI_SBS_MANAGER = 0xa,
|
||||||
|
ACPI_SBS_BATTERY = 0xb,
|
||||||
|
};
|
||||||
|
|
||||||
typedef void (*smbus_alarm_callback)(void *context);
|
typedef void (*smbus_alarm_callback)(void *context);
|
||||||
|
|
||||||
extern int acpi_smbus_read(struct acpi_smb_hc *hc, u8 protocol, u8 address,
|
extern int acpi_smbus_read(struct acpi_smb_hc *hc, u8 protocol, u8 address,
|
||||||
|
Loading…
Reference in New Issue
Block a user