Lines Matching refs:pdev

402 static int get_metrics_table(struct amd_pmc_dev *pdev, struct smu_metrics *table)
404 if (!pdev->smu_virt_addr) {
405 int ret = amd_pmc_setup_smu_logging(pdev);
411 if (pdev->cpu_id == AMD_CPU_ID_PCO)
413 memcpy_fromio(table, pdev->smu_virt_addr, sizeof(struct smu_metrics));
417 static void amd_pmc_validate_deepest(struct amd_pmc_dev *pdev)
421 if (get_metrics_table(pdev, &table))
425 dev_warn(pdev->dev, "Last suspend didn't reach deepest state\n");
487 struct amd_pmc_dev *pdev = dev_get_drvdata(dev);
489 if (pdev->cpu_id == AMD_CPU_ID_PCO)
575 static int amd_pmc_idlemask_read(struct amd_pmc_dev *pdev, struct device *dev,
581 switch (pdev->cpu_id) {
584 if (!pdev->major) {
585 rc = amd_pmc_get_smu_version(pdev);
589 if (pdev->major > 56 || (pdev->major >= 55 && pdev->minor >= 37))
590 val = amd_pmc_reg_read(pdev, AMD_PMC_SCRATCH_REG_CZN);
597 val = amd_pmc_reg_read(pdev, AMD_PMC_SCRATCH_REG_YC);
600 val = amd_pmc_reg_read(pdev, AMD_PMC_SCRATCH_REG_1AH);
772 static int amd_pmc_wa_irq1(struct amd_pmc_dev *pdev)
778 if (pdev->cpu_id == AMD_CPU_ID_CZN) {
779 if (!pdev->major) {
780 rc = amd_pmc_get_smu_version(pdev);
785 if (pdev->major > 64 || (pdev->major == 64 && pdev->minor > 65))
802 static int amd_pmc_verify_czn_rtc(struct amd_pmc_dev *pdev, u32 *arg)
811 if (!pdev->major) {
812 rc = amd_pmc_get_smu_version(pdev);
817 if (pdev->major < 64 || (pdev->major == 64 && pdev->minor < 53))
827 dev_dbg(pdev->dev, "alarm not enabled\n");
856 struct amd_pmc_dev *pdev = &pmc;
862 amd_pmc_setup_smu_logging(pdev);
865 if (pdev->cpu_id == AMD_CPU_ID_CZN && !disable_workarounds) {
866 rc = amd_pmc_verify_czn_rtc(pdev, &arg);
868 dev_err(pdev->dev, "failed to set RTC: %d\n", rc);
873 msg = amd_pmc_get_os_hint(pdev);
874 rc = amd_pmc_send_cmd(pdev, arg, NULL, msg, false);
876 dev_err(pdev->dev, "suspend failed: %d\n", rc);
880 rc = amd_pmc_write_stb(pdev, AMD_PMC_STB_S2IDLE_PREPARE);
882 dev_err(pdev->dev, "error writing to STB: %d\n", rc);
887 struct amd_pmc_dev *pdev = &pmc;
892 if (pdev->cpu_id == AMD_CPU_ID_CZN && !get_metrics_table(pdev, &table) &&
897 amd_pmc_idlemask_read(pdev, pdev->dev, NULL);
899 rc = amd_pmc_write_stb(pdev, AMD_PMC_STB_S2IDLE_CHECK);
901 dev_err(pdev->dev, "error writing to STB: %d\n", rc);
904 static int amd_pmc_dump_data(struct amd_pmc_dev *pdev)
906 if (pdev->cpu_id == AMD_CPU_ID_PCO)
909 return amd_pmc_send_cmd(pdev, 0, NULL, SMU_MSG_LOG_DUMP_DATA, false);
914 struct amd_pmc_dev *pdev = &pmc;
918 msg = amd_pmc_get_os_hint(pdev);
919 rc = amd_pmc_send_cmd(pdev, 0, NULL, msg, false);
921 dev_err(pdev->dev, "resume failed: %d\n", rc);
924 amd_pmc_dump_data(pdev);
926 rc = amd_pmc_write_stb(pdev, AMD_PMC_STB_S2IDLE_RESTORE);
928 dev_err(pdev->dev, "error writing to STB: %d\n", rc);
931 amd_pmc_validate_deepest(pdev);
933 amd_pmc_process_restore_quirks(pdev);
944 struct amd_pmc_dev *pdev = dev_get_drvdata(dev);
946 if (pdev->disable_8042_wakeup && !disable_workarounds) {
947 int rc = amd_pmc_wa_irq1(pdev);
950 dev_err(pdev->dev, "failed to adjust keyboard wakeup: %d\n", rc);
1036 static int amd_pmc_probe(struct platform_device *pdev)
1045 dev->dev = &pdev->dev;
1099 platform_set_drvdata(pdev, dev);
1119 static void amd_pmc_remove(struct platform_device *pdev)
1121 struct amd_pmc_dev *dev = platform_get_drvdata(pdev);