Skip to content

Commit e543d0b

Browse files
committed
Merge tag 'platform-drivers-x86-v6.7-6' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86
Pull x86 platform driver fixes from Ilpo Järvinen: - Intel PMC GBE LTR regression - P2SB / PCI deadlock fix * tag 'platform-drivers-x86-v6.7-6' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86: platform/x86/intel/pmc: Move GBE LTR ignore to suspend callback platform/x86/intel/pmc: Allow reenabling LTRs platform/x86/intel/pmc: Add suspend callback platform/x86: p2sb: Allow p2sb_bar() calls during PCI device probe
2 parents 09c57a7 + 70681aa commit e543d0b

File tree

7 files changed

+176
-68
lines changed

7 files changed

+176
-68
lines changed

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -314,16 +314,13 @@ int adl_core_init(struct pmc_dev *pmcdev)
314314
struct pmc *pmc = pmcdev->pmcs[PMC_IDX_MAIN];
315315
int ret;
316316

317+
pmcdev->suspend = cnl_suspend;
318+
pmcdev->resume = cnl_resume;
319+
317320
pmc->map = &adl_reg_map;
318321
ret = get_primary_reg_base(pmc);
319322
if (ret)
320323
return ret;
321324

322-
/* Due to a hardware limitation, the GBE LTR blocks PC10
323-
* when a cable is attached. Tell the PMC to ignore it.
324-
*/
325-
dev_dbg(&pmcdev->pdev->dev, "ignoring GBE LTR\n");
326-
pmc_core_send_ltr_ignore(pmcdev, 3);
327-
328325
return 0;
329326
}

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

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,21 +204,35 @@ const struct pmc_reg_map cnp_reg_map = {
204204
.etr3_offset = ETR3_OFFSET,
205205
};
206206

207+
void cnl_suspend(struct pmc_dev *pmcdev)
208+
{
209+
/*
210+
* Due to a hardware limitation, the GBE LTR blocks PC10
211+
* when a cable is attached. To unblock PC10 during suspend,
212+
* tell the PMC to ignore it.
213+
*/
214+
pmc_core_send_ltr_ignore(pmcdev, 3, 1);
215+
}
216+
217+
int cnl_resume(struct pmc_dev *pmcdev)
218+
{
219+
pmc_core_send_ltr_ignore(pmcdev, 3, 0);
220+
221+
return pmc_core_resume_common(pmcdev);
222+
}
223+
207224
int cnp_core_init(struct pmc_dev *pmcdev)
208225
{
209226
struct pmc *pmc = pmcdev->pmcs[PMC_IDX_MAIN];
210227
int ret;
211228

229+
pmcdev->suspend = cnl_suspend;
230+
pmcdev->resume = cnl_resume;
231+
212232
pmc->map = &cnp_reg_map;
213233
ret = get_primary_reg_base(pmc);
214234
if (ret)
215235
return ret;
216236

217-
/* Due to a hardware limitation, the GBE LTR blocks PC10
218-
* when a cable is attached. Tell the PMC to ignore it.
219-
*/
220-
dev_dbg(&pmcdev->pdev->dev, "ignoring GBE LTR\n");
221-
pmc_core_send_ltr_ignore(pmcdev, 3);
222-
223237
return 0;
224238
}

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ static int pmc_core_pll_show(struct seq_file *s, void *unused)
460460
}
461461
DEFINE_SHOW_ATTRIBUTE(pmc_core_pll);
462462

463-
int pmc_core_send_ltr_ignore(struct pmc_dev *pmcdev, u32 value)
463+
int pmc_core_send_ltr_ignore(struct pmc_dev *pmcdev, u32 value, int ignore)
464464
{
465465
struct pmc *pmc;
466466
const struct pmc_reg_map *map;
@@ -498,7 +498,10 @@ int pmc_core_send_ltr_ignore(struct pmc_dev *pmcdev, u32 value)
498498
mutex_lock(&pmcdev->lock);
499499

500500
reg = pmc_core_reg_read(pmc, map->ltr_ignore_offset);
501-
reg |= BIT(ltr_index);
501+
if (ignore)
502+
reg |= BIT(ltr_index);
503+
else
504+
reg &= ~BIT(ltr_index);
502505
pmc_core_reg_write(pmc, map->ltr_ignore_offset, reg);
503506

504507
mutex_unlock(&pmcdev->lock);
@@ -521,7 +524,7 @@ static ssize_t pmc_core_ltr_ignore_write(struct file *file,
521524
if (err)
522525
return err;
523526

524-
err = pmc_core_send_ltr_ignore(pmcdev, value);
527+
err = pmc_core_send_ltr_ignore(pmcdev, value, 1);
525528

526529
return err == 0 ? count : err;
527530
}
@@ -1279,6 +1282,9 @@ static __maybe_unused int pmc_core_suspend(struct device *dev)
12791282
struct pmc_dev *pmcdev = dev_get_drvdata(dev);
12801283
struct pmc *pmc = pmcdev->pmcs[PMC_IDX_MAIN];
12811284

1285+
if (pmcdev->suspend)
1286+
pmcdev->suspend(pmcdev);
1287+
12821288
/* Check if the syspend will actually use S0ix */
12831289
if (pm_suspend_via_firmware())
12841290
return 0;

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@ struct pmc {
363363
* @s0ix_counter: S0ix residency (step adjusted)
364364
* @num_lpm_modes: Count of enabled modes
365365
* @lpm_en_modes: Array of enabled modes from lowest to highest priority
366+
* @suspend: Function to perform platform specific suspend
366367
* @resume: Function to perform platform specific resume
367368
*
368369
* pmc_dev contains info about power management controller device.
@@ -379,6 +380,7 @@ struct pmc_dev {
379380
u64 s0ix_counter;
380381
int num_lpm_modes;
381382
int lpm_en_modes[LPM_MAX_NUM_MODES];
383+
void (*suspend)(struct pmc_dev *pmcdev);
382384
int (*resume)(struct pmc_dev *pmcdev);
383385

384386
bool has_die_c6;
@@ -486,7 +488,7 @@ extern const struct pmc_bit_map *mtl_ioem_lpm_maps[];
486488
extern const struct pmc_reg_map mtl_ioem_reg_map;
487489

488490
extern void pmc_core_get_tgl_lpm_reqs(struct platform_device *pdev);
489-
extern int pmc_core_send_ltr_ignore(struct pmc_dev *pmcdev, u32 value);
491+
int pmc_core_send_ltr_ignore(struct pmc_dev *pmcdev, u32 value, int ignore);
490492

491493
int pmc_core_resume_common(struct pmc_dev *pmcdev);
492494
int get_primary_reg_base(struct pmc *pmc);
@@ -500,6 +502,9 @@ int tgl_core_init(struct pmc_dev *pmcdev);
500502
int adl_core_init(struct pmc_dev *pmcdev);
501503
int mtl_core_init(struct pmc_dev *pmcdev);
502504

505+
void cnl_suspend(struct pmc_dev *pmcdev);
506+
int cnl_resume(struct pmc_dev *pmcdev);
507+
503508
#define pmc_for_each_mode(i, mode, pmcdev) \
504509
for (i = 0, mode = pmcdev->lpm_en_modes[i]; \
505510
i < pmcdev->num_lpm_modes; \

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -979,6 +979,8 @@ static void mtl_d3_fixup(void)
979979
static int mtl_resume(struct pmc_dev *pmcdev)
980980
{
981981
mtl_d3_fixup();
982+
pmc_core_send_ltr_ignore(pmcdev, 3, 0);
983+
982984
return pmc_core_resume_common(pmcdev);
983985
}
984986

@@ -989,6 +991,7 @@ int mtl_core_init(struct pmc_dev *pmcdev)
989991

990992
mtl_d3_fixup();
991993

994+
pmcdev->suspend = cnl_suspend;
992995
pmcdev->resume = mtl_resume;
993996

994997
pmcdev->regmap_list = mtl_pmc_info_list;
@@ -1002,11 +1005,5 @@ int mtl_core_init(struct pmc_dev *pmcdev)
10021005
return ret;
10031006
}
10041007

1005-
/* Due to a hardware limitation, the GBE LTR blocks PC10
1006-
* when a cable is attached. Tell the PMC to ignore it.
1007-
*/
1008-
dev_dbg(&pmcdev->pdev->dev, "ignoring GBE LTR\n");
1009-
pmc_core_send_ltr_ignore(pmcdev, 3);
1010-
10111008
return 0;
10121009
}

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,16 +259,15 @@ int tgl_core_init(struct pmc_dev *pmcdev)
259259
int ret;
260260

261261
pmc->map = &tgl_reg_map;
262+
263+
pmcdev->suspend = cnl_suspend;
264+
pmcdev->resume = cnl_resume;
265+
262266
ret = get_primary_reg_base(pmc);
263267
if (ret)
264268
return ret;
265269

266270
pmc_core_get_tgl_lpm_reqs(pmcdev->pdev);
267-
/* Due to a hardware limitation, the GBE LTR blocks PC10
268-
* when a cable is attached. Tell the PMC to ignore it.
269-
*/
270-
dev_dbg(&pmcdev->pdev->dev, "ignoring GBE LTR\n");
271-
pmc_core_send_ltr_ignore(pmcdev, 3);
272271

273272
return 0;
274273
}

0 commit comments

Comments
 (0)