Skip to content

Commit 801e5dc

Browse files
debox1jwrdegoede
authored andcommitted
platform/x86/intel/pmc: Add resume callback
Add a resume callback to perform platform specific functions during resume from suspend. Signed-off-by: David E. Box <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Ilpo Järvinen <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
1 parent f999e23 commit 801e5dc

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

drivers/platform/x86/intel/pmc/core.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,11 +1222,11 @@ static inline bool pmc_core_is_s0ix_failed(struct pmc_dev *pmcdev)
12221222
return false;
12231223
}
12241224

1225-
static __maybe_unused int pmc_core_resume(struct device *dev)
1225+
int pmc_core_resume_common(struct pmc_dev *pmcdev)
12261226
{
1227-
struct pmc_dev *pmcdev = dev_get_drvdata(dev);
12281227
const struct pmc_bit_map **maps = pmcdev->map->lpm_sts;
12291228
int offset = pmcdev->map->lpm_status_offset;
1229+
struct device *dev = &pmcdev->pdev->dev;
12301230

12311231
/* Check if the syspend used S0ix */
12321232
if (pm_suspend_via_firmware())
@@ -1256,6 +1256,16 @@ static __maybe_unused int pmc_core_resume(struct device *dev)
12561256
return 0;
12571257
}
12581258

1259+
static __maybe_unused int pmc_core_resume(struct device *dev)
1260+
{
1261+
struct pmc_dev *pmcdev = dev_get_drvdata(dev);
1262+
1263+
if (pmcdev->resume)
1264+
return pmcdev->resume(pmcdev);
1265+
1266+
return pmc_core_resume_common(pmcdev);
1267+
}
1268+
12591269
static const struct dev_pm_ops pmc_core_pm_ops = {
12601270
SET_LATE_SYSTEM_SLEEP_PM_OPS(pmc_core_suspend, pmc_core_resume)
12611271
};

drivers/platform/x86/intel/pmc/core.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ struct pmc_reg_map {
327327
* @lpm_en_modes: Array of enabled modes from lowest to highest priority
328328
* @lpm_req_regs: List of substate requirements
329329
* @core_configure: Function pointer to configure the platform
330+
* @resume: Function to perform platform specific resume
330331
*
331332
* pmc_dev contains info about power management controller device.
332333
*/
@@ -345,6 +346,7 @@ struct pmc_dev {
345346
int lpm_en_modes[LPM_MAX_NUM_MODES];
346347
u32 *lpm_req_regs;
347348
void (*core_configure)(struct pmc_dev *pmcdev);
349+
int (*resume)(struct pmc_dev *pmcdev);
348350
};
349351

350352
extern const struct pmc_bit_map msr_map[];
@@ -398,6 +400,7 @@ extern const struct pmc_reg_map mtl_reg_map;
398400
extern void pmc_core_get_tgl_lpm_reqs(struct platform_device *pdev);
399401
extern int pmc_core_send_ltr_ignore(struct pmc_dev *pmcdev, u32 value);
400402

403+
int pmc_core_resume_common(struct pmc_dev *pmcdev);
401404
void spt_core_init(struct pmc_dev *pmcdev);
402405
void cnp_core_init(struct pmc_dev *pmcdev);
403406
void icl_core_init(struct pmc_dev *pmcdev);

0 commit comments

Comments
 (0)