Skip to content

Commit d163544

Browse files
debox1jwrdegoede
authored andcommitted
platform/x86: intel_pmc_core: Ignore GBE LTR on Tiger Lake platforms
Due to a HW limitation, the Latency Tolerance Reporting (LTR) value programmed in the Tiger Lake GBE controller is not large enough to allow the platform to enter Package C10, which in turn prevents the platform from achieving its low power target during suspend-to-idle. Ignore the GBE LTR value on Tiger Lake. LTR ignore functionality is currently performed solely by a debugfs write call. Split out the LTR code into its own function that can be called by both the debugfs writer and by this work around. Signed-off-by: David E. Box <david.e.box@linux.intel.com> Reviewed-by: Sasha Neftin <sasha.neftin@intel.com> Cc: intel-wired-lan@lists.osuosl.org Reviewed-by: Rajneesh Bhardwaj <irenic.rajneesh@gmail.com> Link: https://lore.kernel.org/r/20210319201844.3305399-2-david.e.box@linux.intel.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
1 parent 269b04a commit d163544

1 file changed

Lines changed: 35 additions & 15 deletions

File tree

drivers/platform/x86/intel_pmc_core.c

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -863,34 +863,45 @@ static int pmc_core_pll_show(struct seq_file *s, void *unused)
863863
}
864864
DEFINE_SHOW_ATTRIBUTE(pmc_core_pll);
865865

866-
static ssize_t pmc_core_ltr_ignore_write(struct file *file,
867-
const char __user *userbuf,
868-
size_t count, loff_t *ppos)
866+
static int pmc_core_send_ltr_ignore(u32 value)
869867
{
870868
struct pmc_dev *pmcdev = &pmc;
871869
const struct pmc_reg_map *map = pmcdev->map;
872-
u32 val, buf_size, fd;
873-
int err;
874-
875-
buf_size = count < 64 ? count : 64;
876-
877-
err = kstrtou32_from_user(userbuf, buf_size, 10, &val);
878-
if (err)
879-
return err;
870+
u32 reg;
871+
int err = 0;
880872

881873
mutex_lock(&pmcdev->lock);
882874

883-
if (val > map->ltr_ignore_max) {
875+
if (value > map->ltr_ignore_max) {
884876
err = -EINVAL;
885877
goto out_unlock;
886878
}
887879

888-
fd = pmc_core_reg_read(pmcdev, map->ltr_ignore_offset);
889-
fd |= (1U << val);
890-
pmc_core_reg_write(pmcdev, map->ltr_ignore_offset, fd);
880+
reg = pmc_core_reg_read(pmcdev, map->ltr_ignore_offset);
881+
reg |= BIT(value);
882+
pmc_core_reg_write(pmcdev, map->ltr_ignore_offset, reg);
891883

892884
out_unlock:
893885
mutex_unlock(&pmcdev->lock);
886+
887+
return err;
888+
}
889+
890+
static ssize_t pmc_core_ltr_ignore_write(struct file *file,
891+
const char __user *userbuf,
892+
size_t count, loff_t *ppos)
893+
{
894+
u32 buf_size, value;
895+
int err;
896+
897+
buf_size = min_t(u32, count, 64);
898+
899+
err = kstrtou32_from_user(userbuf, buf_size, 10, &value);
900+
if (err)
901+
return err;
902+
903+
err = pmc_core_send_ltr_ignore(value);
904+
894905
return err == 0 ? count : err;
895906
}
896907

@@ -1244,6 +1255,15 @@ static int pmc_core_probe(struct platform_device *pdev)
12441255
pmcdev->pmc_xram_read_bit = pmc_core_check_read_lock_bit();
12451256
dmi_check_system(pmc_core_dmi_table);
12461257

1258+
/*
1259+
* On TGL, due to a hardware limitation, the GBE LTR blocks PC10 when
1260+
* a cable is attached. Tell the PMC to ignore it.
1261+
*/
1262+
if (pmcdev->map == &tgl_reg_map) {
1263+
dev_dbg(&pdev->dev, "ignoring GBE LTR\n");
1264+
pmc_core_send_ltr_ignore(3);
1265+
}
1266+
12471267
pmc_core_dbgfs_register(pmcdev);
12481268

12491269
device_initialized = true;

0 commit comments

Comments
 (0)