forked from Minki/linux
hwmon: (asus-ec-sensors) autoload module via DMI data
Replace autoloading data based on the ACPI EC device with the DMI
records for motherboards models. The ACPI method created a bug that when
this driver returns error from the probe function because of the
unsupported motherboard model, the ACPI subsystem concludes
that the EC device does not work properly.
Fixes: 5cd2901202
("hwmon: (asus-ec-sensors) introduce ec_board_info struct for board data")
Bug: https://bugzilla.kernel.org/show_bug.cgi?id=216412
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=2121844
Signed-off-by: Eugene Shalygin <eugene.shalygin@gmail.com>
Link: https://lore.kernel.org/r/20220909155654.123398-2-eugene.shalygin@gmail.com
Cc: stable@vger.kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
parent
e43212e0f5
commit
88700d1396
@ -266,9 +266,7 @@ static const struct ec_sensor_info sensors_family_intel_600[] = {
|
|||||||
#define SENSOR_SET_WATER_BLOCK \
|
#define SENSOR_SET_WATER_BLOCK \
|
||||||
(SENSOR_TEMP_WATER_BLOCK_IN | SENSOR_TEMP_WATER_BLOCK_OUT)
|
(SENSOR_TEMP_WATER_BLOCK_IN | SENSOR_TEMP_WATER_BLOCK_OUT)
|
||||||
|
|
||||||
|
|
||||||
struct ec_board_info {
|
struct ec_board_info {
|
||||||
const char *board_names[MAX_IDENTICAL_BOARD_VARIATIONS];
|
|
||||||
unsigned long sensors;
|
unsigned long sensors;
|
||||||
/*
|
/*
|
||||||
* Defines which mutex to use for guarding access to the state and the
|
* Defines which mutex to use for guarding access to the state and the
|
||||||
@ -281,152 +279,194 @@ struct ec_board_info {
|
|||||||
enum board_family family;
|
enum board_family family;
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct ec_board_info board_info[] = {
|
static const struct ec_board_info board_info_prime_x470_pro = {
|
||||||
{
|
.sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB |
|
||||||
.board_names = {"PRIME X470-PRO"},
|
SENSOR_TEMP_T_SENSOR | SENSOR_TEMP_VRM |
|
||||||
.sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB |
|
SENSOR_FAN_CPU_OPT |
|
||||||
SENSOR_TEMP_T_SENSOR | SENSOR_TEMP_VRM |
|
SENSOR_CURR_CPU | SENSOR_IN_CPU_CORE,
|
||||||
SENSOR_FAN_CPU_OPT |
|
.mutex_path = ACPI_GLOBAL_LOCK_PSEUDO_PATH,
|
||||||
SENSOR_CURR_CPU | SENSOR_IN_CPU_CORE,
|
.family = family_amd_400_series,
|
||||||
.mutex_path = ACPI_GLOBAL_LOCK_PSEUDO_PATH,
|
};
|
||||||
.family = family_amd_400_series,
|
|
||||||
},
|
static const struct ec_board_info board_info_prime_x570_pro = {
|
||||||
{
|
.sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB | SENSOR_TEMP_VRM |
|
||||||
.board_names = {"PRIME X570-PRO"},
|
SENSOR_TEMP_T_SENSOR | SENSOR_FAN_CHIPSET,
|
||||||
.sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB | SENSOR_TEMP_VRM |
|
.mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX,
|
||||||
SENSOR_TEMP_T_SENSOR | SENSOR_FAN_CHIPSET,
|
.family = family_amd_500_series,
|
||||||
.mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX,
|
};
|
||||||
.family = family_amd_500_series,
|
|
||||||
},
|
static const struct ec_board_info board_info_pro_art_x570_creator_wifi = {
|
||||||
{
|
.sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB | SENSOR_TEMP_VRM |
|
||||||
.board_names = {"ProArt X570-CREATOR WIFI"},
|
SENSOR_TEMP_T_SENSOR | SENSOR_FAN_CPU_OPT |
|
||||||
.sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB | SENSOR_TEMP_VRM |
|
SENSOR_CURR_CPU | SENSOR_IN_CPU_CORE,
|
||||||
SENSOR_TEMP_T_SENSOR | SENSOR_FAN_CPU_OPT |
|
.family = family_amd_500_series,
|
||||||
SENSOR_CURR_CPU | SENSOR_IN_CPU_CORE,
|
};
|
||||||
},
|
|
||||||
{
|
static const struct ec_board_info board_info_pro_ws_x570_ace = {
|
||||||
.board_names = {"Pro WS X570-ACE"},
|
.sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB | SENSOR_TEMP_VRM |
|
||||||
.sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB | SENSOR_TEMP_VRM |
|
SENSOR_TEMP_T_SENSOR | SENSOR_FAN_CHIPSET |
|
||||||
SENSOR_TEMP_T_SENSOR | SENSOR_FAN_CHIPSET |
|
SENSOR_CURR_CPU | SENSOR_IN_CPU_CORE,
|
||||||
SENSOR_CURR_CPU | SENSOR_IN_CPU_CORE,
|
.mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX,
|
||||||
.mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX,
|
.family = family_amd_500_series,
|
||||||
.family = family_amd_500_series,
|
};
|
||||||
},
|
|
||||||
{
|
static const struct ec_board_info board_info_crosshair_viii_dark_hero = {
|
||||||
.board_names = {"ROG CROSSHAIR VIII DARK HERO"},
|
.sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB |
|
||||||
.sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB |
|
SENSOR_TEMP_T_SENSOR |
|
||||||
SENSOR_TEMP_T_SENSOR |
|
SENSOR_TEMP_VRM | SENSOR_SET_TEMP_WATER |
|
||||||
SENSOR_TEMP_VRM | SENSOR_SET_TEMP_WATER |
|
SENSOR_FAN_CPU_OPT | SENSOR_FAN_WATER_FLOW |
|
||||||
SENSOR_FAN_CPU_OPT | SENSOR_FAN_WATER_FLOW |
|
SENSOR_CURR_CPU | SENSOR_IN_CPU_CORE,
|
||||||
SENSOR_CURR_CPU | SENSOR_IN_CPU_CORE,
|
.mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX,
|
||||||
.mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX,
|
.family = family_amd_500_series,
|
||||||
.family = family_amd_500_series,
|
};
|
||||||
},
|
|
||||||
{
|
static const struct ec_board_info board_info_crosshair_viii_hero = {
|
||||||
.board_names = {
|
.sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB |
|
||||||
"ROG CROSSHAIR VIII FORMULA",
|
SENSOR_TEMP_T_SENSOR |
|
||||||
"ROG CROSSHAIR VIII HERO",
|
SENSOR_TEMP_VRM | SENSOR_SET_TEMP_WATER |
|
||||||
"ROG CROSSHAIR VIII HERO (WI-FI)",
|
SENSOR_FAN_CPU_OPT | SENSOR_FAN_CHIPSET |
|
||||||
},
|
SENSOR_FAN_WATER_FLOW | SENSOR_CURR_CPU |
|
||||||
.sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB |
|
SENSOR_IN_CPU_CORE,
|
||||||
SENSOR_TEMP_T_SENSOR |
|
.mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX,
|
||||||
SENSOR_TEMP_VRM | SENSOR_SET_TEMP_WATER |
|
.family = family_amd_500_series,
|
||||||
SENSOR_FAN_CPU_OPT | SENSOR_FAN_CHIPSET |
|
};
|
||||||
SENSOR_FAN_WATER_FLOW | SENSOR_CURR_CPU |
|
|
||||||
SENSOR_IN_CPU_CORE,
|
static const struct ec_board_info board_info_maximus_xi_hero = {
|
||||||
.mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX,
|
.sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB |
|
||||||
.family = family_amd_500_series,
|
SENSOR_TEMP_T_SENSOR |
|
||||||
},
|
SENSOR_TEMP_VRM | SENSOR_SET_TEMP_WATER |
|
||||||
{
|
SENSOR_FAN_CPU_OPT | SENSOR_FAN_WATER_FLOW,
|
||||||
.board_names = {
|
.mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX,
|
||||||
"ROG MAXIMUS XI HERO",
|
.family = family_intel_300_series,
|
||||||
"ROG MAXIMUS XI HERO (WI-FI)",
|
};
|
||||||
},
|
|
||||||
.sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB |
|
static const struct ec_board_info board_info_crosshair_viii_impact = {
|
||||||
SENSOR_TEMP_T_SENSOR |
|
.sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB |
|
||||||
SENSOR_TEMP_VRM | SENSOR_SET_TEMP_WATER |
|
SENSOR_TEMP_T_SENSOR | SENSOR_TEMP_VRM |
|
||||||
SENSOR_FAN_CPU_OPT | SENSOR_FAN_WATER_FLOW,
|
SENSOR_FAN_CHIPSET | SENSOR_CURR_CPU |
|
||||||
.mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX,
|
SENSOR_IN_CPU_CORE,
|
||||||
.family = family_intel_300_series,
|
.mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX,
|
||||||
},
|
.family = family_amd_500_series,
|
||||||
{
|
};
|
||||||
.board_names = {"ROG CROSSHAIR VIII IMPACT"},
|
|
||||||
.sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB |
|
static const struct ec_board_info board_info_strix_b550_e_gaming = {
|
||||||
SENSOR_TEMP_T_SENSOR | SENSOR_TEMP_VRM |
|
.sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB |
|
||||||
SENSOR_FAN_CHIPSET | SENSOR_CURR_CPU |
|
SENSOR_TEMP_T_SENSOR | SENSOR_TEMP_VRM |
|
||||||
SENSOR_IN_CPU_CORE,
|
SENSOR_FAN_CPU_OPT,
|
||||||
.mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX,
|
.mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX,
|
||||||
.family = family_amd_500_series,
|
.family = family_amd_500_series,
|
||||||
},
|
};
|
||||||
{
|
|
||||||
.board_names = {"ROG STRIX B550-E GAMING"},
|
static const struct ec_board_info board_info_strix_b550_i_gaming = {
|
||||||
.sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB |
|
.sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB |
|
||||||
SENSOR_TEMP_T_SENSOR | SENSOR_TEMP_VRM |
|
SENSOR_TEMP_T_SENSOR | SENSOR_TEMP_VRM |
|
||||||
SENSOR_FAN_CPU_OPT,
|
SENSOR_FAN_VRM_HS | SENSOR_CURR_CPU |
|
||||||
.mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX,
|
SENSOR_IN_CPU_CORE,
|
||||||
.family = family_amd_500_series,
|
.mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX,
|
||||||
},
|
.family = family_amd_500_series,
|
||||||
{
|
};
|
||||||
.board_names = {"ROG STRIX B550-I GAMING"},
|
|
||||||
.sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB |
|
static const struct ec_board_info board_info_strix_x570_e_gaming = {
|
||||||
SENSOR_TEMP_T_SENSOR | SENSOR_TEMP_VRM |
|
.sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB |
|
||||||
SENSOR_FAN_VRM_HS | SENSOR_CURR_CPU |
|
SENSOR_TEMP_T_SENSOR | SENSOR_TEMP_VRM |
|
||||||
SENSOR_IN_CPU_CORE,
|
SENSOR_FAN_CHIPSET | SENSOR_CURR_CPU |
|
||||||
.mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX,
|
SENSOR_IN_CPU_CORE,
|
||||||
.family = family_amd_500_series,
|
.mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX,
|
||||||
},
|
.family = family_amd_500_series,
|
||||||
{
|
};
|
||||||
.board_names = {"ROG STRIX X570-E GAMING"},
|
|
||||||
.sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB |
|
static const struct ec_board_info board_info_strix_x570_e_gaming_wifi_ii = {
|
||||||
SENSOR_TEMP_T_SENSOR | SENSOR_TEMP_VRM |
|
.sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB |
|
||||||
SENSOR_FAN_CHIPSET | SENSOR_CURR_CPU |
|
SENSOR_TEMP_T_SENSOR | SENSOR_CURR_CPU |
|
||||||
SENSOR_IN_CPU_CORE,
|
SENSOR_IN_CPU_CORE,
|
||||||
.mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX,
|
.mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX,
|
||||||
.family = family_amd_500_series,
|
.family = family_amd_500_series,
|
||||||
},
|
};
|
||||||
{
|
|
||||||
.board_names = {"ROG STRIX X570-E GAMING WIFI II"},
|
static const struct ec_board_info board_info_strix_x570_f_gaming = {
|
||||||
.sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB |
|
.sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB |
|
||||||
SENSOR_TEMP_T_SENSOR | SENSOR_CURR_CPU |
|
SENSOR_TEMP_T_SENSOR | SENSOR_FAN_CHIPSET,
|
||||||
SENSOR_IN_CPU_CORE,
|
.mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX,
|
||||||
.mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX,
|
.family = family_amd_500_series,
|
||||||
.family = family_amd_500_series,
|
};
|
||||||
},
|
|
||||||
{
|
static const struct ec_board_info board_info_strix_x570_i_gaming = {
|
||||||
.board_names = {"ROG STRIX X570-F GAMING"},
|
.sensors = SENSOR_TEMP_CHIPSET | SENSOR_TEMP_VRM |
|
||||||
.sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB |
|
SENSOR_TEMP_T_SENSOR |
|
||||||
SENSOR_TEMP_T_SENSOR | SENSOR_FAN_CHIPSET,
|
SENSOR_FAN_VRM_HS | SENSOR_FAN_CHIPSET |
|
||||||
.mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX,
|
SENSOR_CURR_CPU | SENSOR_IN_CPU_CORE,
|
||||||
.family = family_amd_500_series,
|
.mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX,
|
||||||
},
|
.family = family_amd_500_series,
|
||||||
{
|
};
|
||||||
.board_names = {"ROG STRIX X570-I GAMING"},
|
|
||||||
.sensors = SENSOR_TEMP_CHIPSET | SENSOR_TEMP_VRM |
|
static const struct ec_board_info board_info_strix_z690_a_gaming_wifi_d4 = {
|
||||||
SENSOR_TEMP_T_SENSOR |
|
.sensors = SENSOR_TEMP_T_SENSOR | SENSOR_TEMP_VRM,
|
||||||
SENSOR_FAN_VRM_HS | SENSOR_FAN_CHIPSET |
|
.mutex_path = ASUS_HW_ACCESS_MUTEX_RMTW_ASMX,
|
||||||
SENSOR_CURR_CPU | SENSOR_IN_CPU_CORE,
|
.family = family_intel_600_series,
|
||||||
.mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX,
|
};
|
||||||
.family = family_amd_500_series,
|
|
||||||
},
|
static const struct ec_board_info board_info_zenith_ii_extreme = {
|
||||||
{
|
.sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB | SENSOR_TEMP_T_SENSOR |
|
||||||
.board_names = {"ROG STRIX Z690-A GAMING WIFI D4"},
|
SENSOR_TEMP_VRM | SENSOR_SET_TEMP_WATER |
|
||||||
.sensors = SENSOR_TEMP_T_SENSOR | SENSOR_TEMP_VRM,
|
SENSOR_FAN_CPU_OPT | SENSOR_FAN_CHIPSET | SENSOR_FAN_VRM_HS |
|
||||||
.mutex_path = ASUS_HW_ACCESS_MUTEX_RMTW_ASMX,
|
SENSOR_FAN_WATER_FLOW | SENSOR_CURR_CPU | SENSOR_IN_CPU_CORE |
|
||||||
.family = family_intel_600_series,
|
SENSOR_SET_WATER_BLOCK |
|
||||||
},
|
SENSOR_TEMP_T_SENSOR_2 | SENSOR_TEMP_SENSOR_EXTRA_1 |
|
||||||
{
|
SENSOR_TEMP_SENSOR_EXTRA_2 | SENSOR_TEMP_SENSOR_EXTRA_3,
|
||||||
.board_names = {"ROG ZENITH II EXTREME"},
|
.mutex_path = ASUS_HW_ACCESS_MUTEX_SB_PCI0_SBRG_SIO1_MUT0,
|
||||||
.sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB | SENSOR_TEMP_T_SENSOR |
|
.family = family_amd_500_series,
|
||||||
SENSOR_TEMP_VRM | SENSOR_SET_TEMP_WATER |
|
};
|
||||||
SENSOR_FAN_CPU_OPT | SENSOR_FAN_CHIPSET | SENSOR_FAN_VRM_HS |
|
|
||||||
SENSOR_FAN_WATER_FLOW | SENSOR_CURR_CPU | SENSOR_IN_CPU_CORE |
|
#define DMI_EXACT_MATCH_ASUS_BOARD_NAME(name, board_info) \
|
||||||
SENSOR_SET_WATER_BLOCK |
|
{ \
|
||||||
SENSOR_TEMP_T_SENSOR_2 | SENSOR_TEMP_SENSOR_EXTRA_1 |
|
.matches = { \
|
||||||
SENSOR_TEMP_SENSOR_EXTRA_2 | SENSOR_TEMP_SENSOR_EXTRA_3,
|
DMI_EXACT_MATCH(DMI_BOARD_VENDOR, \
|
||||||
.mutex_path = ASUS_HW_ACCESS_MUTEX_SB_PCI0_SBRG_SIO1_MUT0,
|
"ASUSTeK COMPUTER INC."), \
|
||||||
.family = family_amd_500_series,
|
DMI_EXACT_MATCH(DMI_BOARD_NAME, name), \
|
||||||
},
|
}, \
|
||||||
{}
|
.driver_data = (void *)board_info, \
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct dmi_system_id dmi_table[] = {
|
||||||
|
DMI_EXACT_MATCH_ASUS_BOARD_NAME("PRIME X470-PRO",
|
||||||
|
&board_info_prime_x470_pro),
|
||||||
|
DMI_EXACT_MATCH_ASUS_BOARD_NAME("PRIME X570-PRO",
|
||||||
|
&board_info_prime_x570_pro),
|
||||||
|
DMI_EXACT_MATCH_ASUS_BOARD_NAME("ProArt X570-CREATOR WIFI",
|
||||||
|
&board_info_pro_art_x570_creator_wifi),
|
||||||
|
DMI_EXACT_MATCH_ASUS_BOARD_NAME("Pro WS X570-ACE",
|
||||||
|
&board_info_pro_ws_x570_ace),
|
||||||
|
DMI_EXACT_MATCH_ASUS_BOARD_NAME("ROG CROSSHAIR VIII DARK HERO",
|
||||||
|
&board_info_crosshair_viii_dark_hero),
|
||||||
|
DMI_EXACT_MATCH_ASUS_BOARD_NAME("ROG CROSSHAIR VIII FORMULA",
|
||||||
|
&board_info_crosshair_viii_hero),
|
||||||
|
DMI_EXACT_MATCH_ASUS_BOARD_NAME("ROG CROSSHAIR VIII HERO",
|
||||||
|
&board_info_crosshair_viii_hero),
|
||||||
|
DMI_EXACT_MATCH_ASUS_BOARD_NAME("ROG CROSSHAIR VIII HERO (WI-FI)",
|
||||||
|
&board_info_crosshair_viii_hero),
|
||||||
|
DMI_EXACT_MATCH_ASUS_BOARD_NAME("ROG MAXIMUS XI HERO",
|
||||||
|
&board_info_maximus_xi_hero),
|
||||||
|
DMI_EXACT_MATCH_ASUS_BOARD_NAME("ROG MAXIMUS XI HERO (WI-FI)",
|
||||||
|
&board_info_maximus_xi_hero),
|
||||||
|
DMI_EXACT_MATCH_ASUS_BOARD_NAME("ROG CROSSHAIR VIII IMPACT",
|
||||||
|
&board_info_crosshair_viii_impact),
|
||||||
|
DMI_EXACT_MATCH_ASUS_BOARD_NAME("ROG STRIX B550-E GAMING",
|
||||||
|
&board_info_strix_b550_e_gaming),
|
||||||
|
DMI_EXACT_MATCH_ASUS_BOARD_NAME("ROG STRIX B550-I GAMING",
|
||||||
|
&board_info_strix_b550_i_gaming),
|
||||||
|
DMI_EXACT_MATCH_ASUS_BOARD_NAME("ROG STRIX X570-E GAMING",
|
||||||
|
&board_info_strix_x570_e_gaming),
|
||||||
|
DMI_EXACT_MATCH_ASUS_BOARD_NAME("ROG STRIX X570-E GAMING WIFI II",
|
||||||
|
&board_info_strix_x570_e_gaming_wifi_ii),
|
||||||
|
DMI_EXACT_MATCH_ASUS_BOARD_NAME("ROG STRIX X570-F GAMING",
|
||||||
|
&board_info_strix_x570_f_gaming),
|
||||||
|
DMI_EXACT_MATCH_ASUS_BOARD_NAME("ROG STRIX X570-I GAMING",
|
||||||
|
&board_info_strix_x570_i_gaming),
|
||||||
|
DMI_EXACT_MATCH_ASUS_BOARD_NAME("ROG STRIX Z690-A GAMING WIFI D4",
|
||||||
|
&board_info_strix_z690_a_gaming_wifi_d4),
|
||||||
|
DMI_EXACT_MATCH_ASUS_BOARD_NAME("ROG ZENITH II EXTREME",
|
||||||
|
&board_info_zenith_ii_extreme),
|
||||||
|
{},
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ec_sensor {
|
struct ec_sensor {
|
||||||
@ -537,12 +577,12 @@ static int find_ec_sensor_index(const struct ec_sensors_data *ec,
|
|||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __init bank_compare(const void *a, const void *b)
|
static int bank_compare(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
return *((const s8 *)a) - *((const s8 *)b);
|
return *((const s8 *)a) - *((const s8 *)b);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __init setup_sensor_data(struct ec_sensors_data *ec)
|
static void setup_sensor_data(struct ec_sensors_data *ec)
|
||||||
{
|
{
|
||||||
struct ec_sensor *s = ec->sensors;
|
struct ec_sensor *s = ec->sensors;
|
||||||
bool bank_found;
|
bool bank_found;
|
||||||
@ -574,7 +614,7 @@ static void __init setup_sensor_data(struct ec_sensors_data *ec)
|
|||||||
sort(ec->banks, ec->nr_banks, 1, bank_compare, NULL);
|
sort(ec->banks, ec->nr_banks, 1, bank_compare, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __init fill_ec_registers(struct ec_sensors_data *ec)
|
static void fill_ec_registers(struct ec_sensors_data *ec)
|
||||||
{
|
{
|
||||||
const struct ec_sensor_info *si;
|
const struct ec_sensor_info *si;
|
||||||
unsigned int i, j, register_idx = 0;
|
unsigned int i, j, register_idx = 0;
|
||||||
@ -589,7 +629,7 @@ static void __init fill_ec_registers(struct ec_sensors_data *ec)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __init setup_lock_data(struct device *dev)
|
static int setup_lock_data(struct device *dev)
|
||||||
{
|
{
|
||||||
const char *mutex_path;
|
const char *mutex_path;
|
||||||
int status;
|
int status;
|
||||||
@ -812,7 +852,7 @@ static umode_t asus_ec_hwmon_is_visible(const void *drvdata,
|
|||||||
return find_ec_sensor_index(state, type, channel) >= 0 ? S_IRUGO : 0;
|
return find_ec_sensor_index(state, type, channel) >= 0 ? S_IRUGO : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __init
|
static int
|
||||||
asus_ec_hwmon_add_chan_info(struct hwmon_channel_info *asus_ec_hwmon_chan,
|
asus_ec_hwmon_add_chan_info(struct hwmon_channel_info *asus_ec_hwmon_chan,
|
||||||
struct device *dev, int num,
|
struct device *dev, int num,
|
||||||
enum hwmon_sensor_types type, u32 config)
|
enum hwmon_sensor_types type, u32 config)
|
||||||
@ -841,27 +881,15 @@ static struct hwmon_chip_info asus_ec_chip_info = {
|
|||||||
.ops = &asus_ec_hwmon_ops,
|
.ops = &asus_ec_hwmon_ops,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct ec_board_info * __init get_board_info(void)
|
static const struct ec_board_info *get_board_info(void)
|
||||||
{
|
{
|
||||||
const char *dmi_board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR);
|
const struct dmi_system_id *dmi_entry;
|
||||||
const char *dmi_board_name = dmi_get_system_info(DMI_BOARD_NAME);
|
|
||||||
const struct ec_board_info *board;
|
|
||||||
|
|
||||||
if (!dmi_board_vendor || !dmi_board_name ||
|
dmi_entry = dmi_first_match(dmi_table);
|
||||||
strcasecmp(dmi_board_vendor, "ASUSTeK COMPUTER INC."))
|
return dmi_entry ? dmi_entry->driver_data : NULL;
|
||||||
return NULL;
|
|
||||||
|
|
||||||
for (board = board_info; board->sensors; board++) {
|
|
||||||
if (match_string(board->board_names,
|
|
||||||
MAX_IDENTICAL_BOARD_VARIATIONS,
|
|
||||||
dmi_board_name) >= 0)
|
|
||||||
return board;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __init asus_ec_probe(struct platform_device *pdev)
|
static int asus_ec_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
const struct hwmon_channel_info **ptr_asus_ec_ci;
|
const struct hwmon_channel_info **ptr_asus_ec_ci;
|
||||||
int nr_count[hwmon_max] = { 0 }, nr_types = 0;
|
int nr_count[hwmon_max] = { 0 }, nr_types = 0;
|
||||||
@ -970,29 +998,37 @@ static int __init asus_ec_probe(struct platform_device *pdev)
|
|||||||
return PTR_ERR_OR_ZERO(hwdev);
|
return PTR_ERR_OR_ZERO(hwdev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MODULE_DEVICE_TABLE(dmi, dmi_table);
|
||||||
static const struct acpi_device_id acpi_ec_ids[] = {
|
|
||||||
/* Embedded Controller Device */
|
|
||||||
{ "PNP0C09", 0 },
|
|
||||||
{}
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct platform_driver asus_ec_sensors_platform_driver = {
|
static struct platform_driver asus_ec_sensors_platform_driver = {
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "asus-ec-sensors",
|
.name = "asus-ec-sensors",
|
||||||
.acpi_match_table = acpi_ec_ids,
|
|
||||||
},
|
},
|
||||||
|
.probe = asus_ec_probe,
|
||||||
};
|
};
|
||||||
|
|
||||||
MODULE_DEVICE_TABLE(acpi, acpi_ec_ids);
|
static struct platform_device *asus_ec_sensors_platform_device;
|
||||||
/*
|
|
||||||
* we use module_platform_driver_probe() rather than module_platform_driver()
|
static int __init asus_ec_init(void)
|
||||||
* because the probe function (and its dependants) are marked with __init, which
|
{
|
||||||
* means we can't put it into the .probe member of the platform_driver struct
|
asus_ec_sensors_platform_device =
|
||||||
* above, and we can't mark the asus_ec_sensors_platform_driver object as __init
|
platform_create_bundle(&asus_ec_sensors_platform_driver,
|
||||||
* because the object is referenced from the module exit code.
|
asus_ec_probe, NULL, 0, NULL, 0);
|
||||||
*/
|
|
||||||
module_platform_driver_probe(asus_ec_sensors_platform_driver, asus_ec_probe);
|
if (IS_ERR(asus_ec_sensors_platform_device))
|
||||||
|
return PTR_ERR(asus_ec_sensors_platform_device);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void __exit asus_ec_exit(void)
|
||||||
|
{
|
||||||
|
platform_device_unregister(asus_ec_sensors_platform_device);
|
||||||
|
platform_driver_unregister(&asus_ec_sensors_platform_driver);
|
||||||
|
}
|
||||||
|
|
||||||
|
module_init(asus_ec_init);
|
||||||
|
module_exit(asus_ec_exit);
|
||||||
|
|
||||||
module_param_named(mutex_path, mutex_path_override, charp, 0);
|
module_param_named(mutex_path, mutex_path_override, charp, 0);
|
||||||
MODULE_PARM_DESC(mutex_path,
|
MODULE_PARM_DESC(mutex_path,
|
||||||
|
Loading…
Reference in New Issue
Block a user