@@ -99,6 +99,7 @@ static void apmf_if_parse_functions(struct apmf_if_functions *func, u32 mask)
{
func->system_params = mask & APMF_FUNC_GET_SYS_PARAMS;
func->static_slider_granular = mask & APMF_FUNC_STATIC_SLIDER_GRANULAR;
+ func->fan_table_idx = mask & APMF_FUNC_SET_FAN_IDX;
}
int is_apmf_func_supported(unsigned long index)
@@ -134,6 +135,31 @@ static void apmf_sbios_heartbeat_notify(struct work_struct *work)
kfree(info);
}
+int apmf_update_fan_idx(struct apmf_if *ampf_if, bool manual, u32 idx)
+{
+ union acpi_object *info;
+ struct apmf_fan_idx args;
+ struct acpi_buffer params;
+ int err = 0;
+
+ args.size = sizeof(args);
+ args.fan_ctl_mode = manual;
+ args.fan_ctl_idx = idx;
+
+ params.length = sizeof(args);
+ params.pointer = (void *)&args;
+
+ info = apmf_if_call(ampf_if, APMF_FUNC_SET_FAN_IDX, ¶ms);
+ if (!info) {
+ err = -EIO;
+ goto out;
+ }
+
+out:
+ kfree(info);
+ return err;
+}
+
static int apmf_if_verify_interface(struct amd_pmf_dev *pdev, struct apmf_if *apmf_if)
{
struct apmf_verify_interface output;
@@ -18,6 +18,7 @@
#define APMF_FUNC_VERIFY_INTERFACE 0
#define APMF_FUNC_GET_SYS_PARAMS 1
#define APMF_FUNC_SBIOS_HEARTBEAT 4
+#define APMF_FUNC_SET_FAN_IDX 7
#define APMF_FUNC_STATIC_SLIDER_GRANULAR 9
/* Message Definitions */
@@ -39,12 +40,16 @@
#define GET_STT_LIMIT_APU 0x20
#define GET_STT_LIMIT_HS2 0x21
+/* Fan Index for Auto Mode */
+#define FAN_INDEX_AUTO 0xFFFFFFFF
+
#define ARG_NONE 0
/* AMD PMF BIOS interfaces */
struct apmf_if_functions {
bool system_params;
bool sbios_heartbeat;
+ bool fan_table_idx;
bool static_slider_granular;
};
@@ -73,6 +78,12 @@ struct apmf_system_params {
u32 heartbeat_int;
} __packed;
+struct apmf_fan_idx {
+ u16 size;
+ u8 fan_ctl_mode;
+ u32 fan_ctl_idx;
+} __packed;
+
enum amd_stt_skin_temp {
STT_TEMP_APU,
STT_TEMP_HS2,
@@ -133,6 +144,11 @@ struct amd_pmf_static_slider_granular {
struct apmf_sps_prop_granular prop[POWER_SOURCE_MAX][POWER_MODE_MAX];
};
+struct fan_table_control {
+ bool manual;
+ unsigned long fan_id;
+};
+
/* Core Layer */
int apmf_acpi_init(struct amd_pmf_dev *pmf_dev);
void apmf_acpi_deinit(struct amd_pmf_dev *pmf_dev);
@@ -150,4 +166,5 @@ int apmf_get_static_slider_granular(struct apmf_if *ampf_if,
struct apmf_static_slider_granular_output *output);
void amd_pmf_load_defaults_sps(struct amd_pmf_dev *dev);
+int apmf_update_fan_idx(struct apmf_if *ampf_if, bool manual, u32 idx);
#endif /* PMF_H */