Lines Matching refs:pmf_dev
326 struct amd_pmf_dev *pmf_dev = data; in apmf_event_handler_v2() local
329 guard(mutex)(&pmf_dev->cb_mutex); in apmf_event_handler_v2()
331 ret = apmf_get_sbios_requests_v2(pmf_dev, &pmf_dev->req); in apmf_event_handler_v2()
333 dev_err(pmf_dev->dev, "Failed to get v2 SBIOS requests: %d\n", ret); in apmf_event_handler_v2()
338 struct amd_pmf_dev *pmf_dev = data; in apmf_event_handler() local
342 guard(mutex)(&pmf_dev->update_mutex); in apmf_event_handler()
343 ret = apmf_get_sbios_requests(pmf_dev, &req); in apmf_event_handler()
345 dev_err(pmf_dev->dev, "Failed to get SBIOS requests:%d\n", ret); in apmf_event_handler()
350 dev_dbg(pmf_dev->dev, "AMT is supported and notifications %s\n", in apmf_event_handler()
352 pmf_dev->amt_enabled = !!req.amt_event; in apmf_event_handler()
354 if (pmf_dev->amt_enabled) in apmf_event_handler()
355 amd_pmf_handle_amt(pmf_dev); in apmf_event_handler()
357 amd_pmf_reset_amt(pmf_dev); in apmf_event_handler()
361 dev_dbg(pmf_dev->dev, "CQL is supported and notifications %s\n", in apmf_event_handler()
365 if (pmf_dev->amt_enabled) in apmf_event_handler()
366 amd_pmf_update_2_cql(pmf_dev, req.cql_event); in apmf_event_handler()
424 int apmf_install_handler(struct amd_pmf_dev *pmf_dev) in apmf_install_handler() argument
426 acpi_handle ahandle = ACPI_HANDLE(pmf_dev->dev); in apmf_install_handler()
430 if (is_apmf_func_supported(pmf_dev, APMF_FUNC_AUTO_MODE) && in apmf_install_handler()
431 is_apmf_func_supported(pmf_dev, APMF_FUNC_SBIOS_REQUESTS)) { in apmf_install_handler()
433 apmf_event_handler, pmf_dev); in apmf_install_handler()
435 dev_err(pmf_dev->dev, "failed to install notify handler\n"); in apmf_install_handler()
440 apmf_event_handler(ahandle, 0, pmf_dev); in apmf_install_handler()
443 if (pmf_dev->smart_pc_enabled && pmf_dev->pmf_if_version == PMF_IF_V2) { in apmf_install_handler()
445 apmf_event_handler_v2, pmf_dev); in apmf_install_handler()
447 dev_err(pmf_dev->dev, "failed to install notify handler for custom BIOS inputs\n"); in apmf_install_handler()
455 int apmf_check_smart_pc(struct amd_pmf_dev *pmf_dev) in apmf_check_smart_pc() argument
457 struct platform_device *pdev = to_platform_device(pmf_dev->dev); in apmf_check_smart_pc()
459 pmf_dev->res = platform_get_resource(pdev, IORESOURCE_MEM, 0); in apmf_check_smart_pc()
460 if (!pmf_dev->res) { in apmf_check_smart_pc()
461 dev_dbg(pmf_dev->dev, "Failed to get I/O memory resource\n"); in apmf_check_smart_pc()
465 pmf_dev->policy_addr = pmf_dev->res->start; in apmf_check_smart_pc()
473 pmf_dev->policy_sz = pmf_dev->res->end - pmf_dev->res->start; in apmf_check_smart_pc()
475 if (!pmf_dev->policy_addr || pmf_dev->policy_sz > POLICY_BUF_MAX_SZ || in apmf_check_smart_pc()
476 pmf_dev->policy_sz == 0) { in apmf_check_smart_pc()
477 dev_err(pmf_dev->dev, "Incorrect policy params, possibly a SBIOS bug\n"); in apmf_check_smart_pc()
492 void apmf_acpi_deinit(struct amd_pmf_dev *pmf_dev) in apmf_acpi_deinit() argument
494 acpi_handle ahandle = ACPI_HANDLE(pmf_dev->dev); in apmf_acpi_deinit()
496 if (pmf_dev->hb_interval && pmf_dev->pmf_if_version == PMF_IF_V1) in apmf_acpi_deinit()
497 cancel_delayed_work_sync(&pmf_dev->heart_beat); in apmf_acpi_deinit()
499 if (is_apmf_func_supported(pmf_dev, APMF_FUNC_AUTO_MODE) && in apmf_acpi_deinit()
500 is_apmf_func_supported(pmf_dev, APMF_FUNC_SBIOS_REQUESTS)) in apmf_acpi_deinit()
503 if (pmf_dev->smart_pc_enabled && pmf_dev->pmf_if_version == PMF_IF_V2) in apmf_acpi_deinit()
507 int apmf_acpi_init(struct amd_pmf_dev *pmf_dev) in apmf_acpi_init() argument
511 ret = apmf_if_verify_interface(pmf_dev); in apmf_acpi_init()
513 dev_err(pmf_dev->dev, "APMF verify interface failed :%d\n", ret); in apmf_acpi_init()
517 ret = apmf_get_system_params(pmf_dev); in apmf_acpi_init()
519 dev_dbg(pmf_dev->dev, "APMF apmf_get_system_params failed :%d\n", ret); in apmf_acpi_init()
523 if (pmf_dev->hb_interval && pmf_dev->pmf_if_version == PMF_IF_V1) { in apmf_acpi_init()
525 INIT_DELAYED_WORK(&pmf_dev->heart_beat, apmf_sbios_heartbeat_notify); in apmf_acpi_init()
526 schedule_delayed_work(&pmf_dev->heart_beat, 0); in apmf_acpi_init()