platform/kernel/linux-starfive.git
13 months agoplatform/x86:intel/pmc: Add Meteor Lake IOE-M PMC related maps
Xi Pardee [Tue, 13 Jun 2023 22:53:47 +0000 (15:53 -0700)]
platform/x86:intel/pmc: Add Meteor Lake IOE-M PMC related maps

Add device ID and register maps for the PMC in IO expansion die M in
Meteor Lake.

Signed-off-by: Xi Pardee <xi.pardee@intel.com>
Signed-off-by: Rajvi Jingar <rajvi.jingar@linux.intel.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20230613225347.2720665-9-rajvi.jingar@linux.intel.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
13 months agoplatform/x86:intel/pmc: Add Meteor Lake IOE-P PMC related maps
Xi Pardee [Tue, 13 Jun 2023 22:53:46 +0000 (15:53 -0700)]
platform/x86:intel/pmc: Add Meteor Lake IOE-P PMC related maps

Add device ID and register maps for the PMC in IO expansion die P in
Meteor Lake.

Signed-off-by: Xi Pardee <xi.pardee@intel.com>
Signed-off-by: Rajvi Jingar <rajvi.jingar@linux.intel.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20230613225347.2720665-8-rajvi.jingar@linux.intel.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
13 months agoplatform/x86:intel/pmc: Use SSRAM to discover pwrm base address of primary PMC
Xi Pardee [Tue, 13 Jun 2023 22:53:45 +0000 (15:53 -0700)]
platform/x86:intel/pmc: Use SSRAM to discover pwrm base address of primary PMC

On older platforms, the base address for PMC was hardcoded in the
driver. Newer platforms can now retrieve the base address from SSRAM.
Use SSRAM to discover pwrm base address on Meteor Lake platform. If
this method fails, it will fall back to the hardcoded value.

Signed-off-by: Xi Pardee <xi.pardee@intel.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20230613225347.2720665-7-rajvi.jingar@linux.intel.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
13 months agoplatform/x86:intel/pmc: Discover PMC devices
David E. Box [Tue, 13 Jun 2023 22:53:44 +0000 (15:53 -0700)]
platform/x86:intel/pmc: Discover PMC devices

On platforms with multiple PMCs, additional PMC devices are discovered
in the SSRAM device associated with the primary PMC. Add support for
discovering PMC devices from SSRAM. Use PMC devid to assign the
corresponding register map.

Signed-off-by: Xi Pardee <xi.pardee@intel.com>
Signed-off-by: David E. Box <david.e.box@linux.intel.com>
Signed-off-by: Rajvi Jingar <rajvi.jingar@linux.intel.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20230613225347.2720665-6-rajvi.jingar@linux.intel.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
13 months agoplatform/x86:intel/pmc: Enable debugfs multiple PMC support
Xi Pardee [Tue, 13 Jun 2023 22:53:43 +0000 (15:53 -0700)]
platform/x86:intel/pmc: Enable debugfs multiple PMC support

Enable debugfs support for multiple PMC. These debugfs attributes
show information for all enabled PMCs.

pch_ip_power_gating_status
substate_status_registers
substate_live_status_registers
ltr_show
ltr_ignore

Signed-off-by: Xi Pardee <xi.pardee@intel.com>
Signed-off-by: Rajvi Jingar <rajvi.jingar@linux.intel.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20230613225347.2720665-5-rajvi.jingar@linux.intel.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
13 months agoplatform/x86:intel/pmc: Add support to handle multiple PMCs
Xi Pardee [Tue, 13 Jun 2023 22:53:42 +0000 (15:53 -0700)]
platform/x86:intel/pmc: Add support to handle multiple PMCs

To support platforms with multiple PMCs, add a PMC device structure to
support each PMC instance.

Signed-off-by: Xi Pardee <xi.pardee@intel.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20230613225347.2720665-4-rajvi.jingar@linux.intel.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
13 months agoplatform/x86:intel/pmc: Combine core_init() and core_configure()
Xi Pardee [Tue, 13 Jun 2023 22:53:41 +0000 (15:53 -0700)]
platform/x86:intel/pmc: Combine core_init() and core_configure()

Combine core_init() and core_configure() functions to have a
cleaner setup for platforms.

Signed-off-by: Xi Pardee <xi.pardee@intel.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20230613225347.2720665-3-rajvi.jingar@linux.intel.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
13 months agoplatform/x86:intel/pmc: Update maps for Meteor Lake P/M platforms
Xi Pardee [Tue, 13 Jun 2023 22:53:40 +0000 (15:53 -0700)]
platform/x86:intel/pmc: Update maps for Meteor Lake P/M platforms

Fix the IP name errors in the register maps used by the following
debugfs attributes in the Meteor Lake SOC-M PMC.

pfear_sts
lpm_sts
ltr_show

Fixes: c5ad454a12c6 ("platform/x86: intel/pmc/core: Add Meteor Lake support to pmc core driver")
Signed-off-by: Xi Pardee <xi.pardee@intel.com>
Signed-off-by: Rajvi Jingar <rajvi.jingar@linux.intel.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20230613225347.2720665-2-rajvi.jingar@linux.intel.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
13 months agoplatform/x86/intel: tpmi: Remove hardcoded unit and offset
Srinivas Pandruvada [Sat, 17 Jun 2023 01:44:47 +0000 (18:44 -0700)]
platform/x86/intel: tpmi: Remove hardcoded unit and offset

Use sizeof(u32) for TPMI entry size units. Also add a define
for capability offset unit size.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Link: https://lore.kernel.org/r/20230617014447.2543592-1-srinivas.pandruvada@linux.intel.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
13 months agoplatform/x86: int3472: discrete: Log a warning if the pin-numbers don't match
Hans de Goede [Fri, 16 Jun 2023 17:21:32 +0000 (19:21 +0200)]
platform/x86: int3472: discrete: Log a warning if the pin-numbers don't match

The INT3472 discrete code assumes that the ACPI GPIO resources are
in the same order as the pin-info _DSM entries.

The returned pin-info includes the pin-number in bits 15-8. Add a check
that this matches with the ACPI GPIO resource pin-number in case
the assumption is not true with some ACPI tables.

Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230616172132.37859-7-hdegoede@redhat.com
13 months agoplatform/x86: int3472: discrete: Use FIELD_GET() on the GPIO _DSM return value
Hans de Goede [Fri, 16 Jun 2023 17:21:31 +0000 (19:21 +0200)]
platform/x86: int3472: discrete: Use FIELD_GET() on the GPIO _DSM return value

Add defines for the various fields encoded in the GPIO _DSM integer
return value and then use FIELD_GET() to get field values.

Suggested-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230616172132.37859-6-hdegoede@redhat.com
13 months agoplatform/x86: int3472: discrete: Add alternative "AVDD" regulator supply name
Hans de Goede [Fri, 16 Jun 2023 17:21:30 +0000 (19:21 +0200)]
platform/x86: int3472: discrete: Add alternative "AVDD" regulator supply name

Add an "AVDD" regulator supply name alias to the supply-map which
gets registered for the INT3472 GPIO regulator.

This is necessary for the ov2680 driver which expects "AVDD" rather then
"avdd". Updating the ov2680 driver to use "avdd" is not possible because
that will break compatibility with existing DT / DTB files.

Tested-by: Hao Yao <hao.yao@intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Link: https://lore.kernel.org/r/20230616172132.37859-5-hdegoede@redhat.com
13 months agoplatform/x86: int3472: discrete: Add support for 1 GPIO regulator shared between...
Hans de Goede [Fri, 16 Jun 2023 17:21:29 +0000 (19:21 +0200)]
platform/x86: int3472: discrete: Add support for 1 GPIO regulator shared between 2 sensors

On the Lenovo Miix 510-12IKB there is 1 GPIO regulator, with its GPIO
listed in the INT3472 device belonging to the OV5648 back sensor.
But this regulator also needs to be enabled for the OV2680 front sensor
to work.

Add support to skl_int3472_register_regulator() to add supply map entries
pointing to both sensors based on a DMI quirk table which gives the
dev_name part of the supply map for the second sensor (the sensor without
the GPIO listed in its matching INT3472 ACPI device).

Tested-by: Hao Yao <hao.yao@intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230616172132.37859-4-hdegoede@redhat.com
13 months agoplatform/x86: int3472: discrete: Remove sensor_config-s
Hans de Goede [Fri, 16 Jun 2023 17:21:28 +0000 (19:21 +0200)]
platform/x86: int3472: discrete: Remove sensor_config-s

Currently the only 2 sensor_config-s both specify "avdd" as supply-id.

The INT3472 device is going to be the only supplier of a regulator for
the sensor device.

So there is no chance of collisions with other regulator suppliers
and it is undesirable to need to manually add new entries to
int3472_sensor_configs[] for each new sensor module which uses
a GPIO regulator.

Instead just always use "avdd" as supply-id when registering
the GPIO regulator.

If necessary for specific sensor drivers then other supply-ids can
be added as aliases in the future, adding aliases will be safe
since INT3472 will be the only regulator supplier for the sensor.

Cc: Bingbu Cao <bingbu.cao@intel.com>
Tested-by: Hao Yao <hao.yao@intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Link: https://lore.kernel.org/r/20230616172132.37859-3-hdegoede@redhat.com
13 months agoplatform/x86: int3472: discrete: Drop GPIO remapping support
Hans de Goede [Fri, 16 Jun 2023 17:21:27 +0000 (19:21 +0200)]
platform/x86: int3472: discrete: Drop GPIO remapping support

The only sensor driver which needs GPIO remapping support is the ov2680
driver and ACPI enumeration support + other necessary changes to
the ov2680 driver were never upstreamed.

A new series updating the ov2680 driver is pending upstream now and
in this series the ov2680 driver is patched to look for "powerdown"
as con-id, instead of relying on GPIO remapping in the int3472 code,
so the GPIO remapping is no longer necessary.

Tested-by: Hao Yao <hao.yao@intel.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230616172132.37859-2-hdegoede@redhat.com
13 months agoplatform/x86: apple-gmux: don't use be32_to_cpu and cpu_to_be32
Orlando Chamberlain [Wed, 14 Jun 2023 06:49:32 +0000 (16:49 +1000)]
platform/x86: apple-gmux: don't use be32_to_cpu and cpu_to_be32

Sparce doesn't seem to like using be32_to_cpu and cpu_to_be32 to convert
values for the MMIO gmux to/from the host architecture.

Instead use iowrite32be and ioread32be to always convert, which should be
fine because apple-gmux is only used on x86 with is always little endian.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202305161712.5l3f4iI4-lkp@intel.com/
Signed-off-by: Orlando Chamberlain <orlandoch.dev@gmail.com>
Link: https://lore.kernel.org/r/20230614064931.3263-2-orlandoch.dev@gmail.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
13 months agoplatform/x86/dell/dell-rbtn: Fix resources leaking on error path
Michal Wilczynski [Tue, 13 Jun 2023 08:43:10 +0000 (11:43 +0300)]
platform/x86/dell/dell-rbtn: Fix resources leaking on error path

Currently rbtn_add() in case of failure is leaking resources. Fix this
by adding a proper rollback. Move devm_kzalloc() before rbtn_acquire(),
so it doesn't require rollback in case of failure. While at it, remove
unnecessary assignment of NULL to device->driver_data and unnecessary
whitespace, plus add a break for the default case in a switch.

Suggested-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Suggested-by: Pali Rohár <pali@kernel.org>
Fixes: 817a5cdb40c8 ("dell-rbtn: Dell Airplane Mode Switch driver")
Signed-off-by: Michal Wilczynski <michal.wilczynski@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Rafael J. Wysocki <rafael@kernel.org>
Reviewed-by: Pali Rohár <pali@kernel.org>
Link: https://lore.kernel.org/r/20230613084310.2775896-1-michal.wilczynski@intel.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
13 months agoMerge remote-tracking branch 'intel-speed-select/intel-sst' into review-hans
Hans de Goede [Tue, 13 Jun 2023 10:37:05 +0000 (12:37 +0200)]
Merge remote-tracking branch 'intel-speed-select/intel-sst' into review-hans

13 months agoplatform/x86: ISST: Fix usage counter
Srinivas Pandruvada [Mon, 12 Jun 2023 22:40:33 +0000 (15:40 -0700)]
platform/x86: ISST: Fix usage counter

On multi package system, the TPMI SST instance is getting allocated
again as the usage counter is not getting incremented. Here the
instance is allocated only when the usage count is zero. There is
no need to allocate again.

Increment usage ID on successful return from isst_if_cdev_register().

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Link: https://lore.kernel.org/r/20230612224033.2382527-3-srinivas.pandruvada@linux.intel.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
13 months agoplatform/x86: ISST: Reset default callback on unregister
Srinivas Pandruvada [Mon, 12 Jun 2023 22:40:32 +0000 (15:40 -0700)]
platform/x86: ISST: Reset default callback on unregister

When multiple clients are registered and some of those modules are
removed, the default IOCTL callback for those clients are still not
NULL. Calling them will result in crash.

Set the default IOCTL callback pointer to NULL on unregister.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Link: https://lore.kernel.org/r/20230612224033.2382527-2-srinivas.pandruvada@linux.intel.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
13 months agoplatform/x86: int3472: Switch back to use struct i2c_driver's .probe()
Uwe Kleine-König [Mon, 12 Jun 2023 07:39:02 +0000 (09:39 +0200)]
platform/x86: int3472: Switch back to use struct i2c_driver's .probe()

After commit b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new()
call-back type"), all drivers being converted to .probe_new() and then
commit 03c835f498b5 ("i2c: Switch .probe() to not take an id parameter")
convert back to (the new) .probe() to be able to eventually drop
.probe_new() from struct i2c_driver.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20230612073902.840435-4-u.kleine-koenig@pengutronix.de
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
13 months agoplatform/x86: asus-tf103c-dock: Switch back to use struct i2c_driver's .probe()
Uwe Kleine-König [Mon, 12 Jun 2023 07:39:01 +0000 (09:39 +0200)]
platform/x86: asus-tf103c-dock: Switch back to use struct i2c_driver's .probe()

After commit b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new()
call-back type"), all drivers being converted to .probe_new() and then
commit 03c835f498b5 ("i2c: Switch .probe() to not take an id parameter")
convert back to (the new) .probe() to be able to eventually drop
.probe_new() from struct i2c_driver.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20230612073902.840435-3-u.kleine-koenig@pengutronix.de
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
13 months agoplatform/surface: surface3_power: Switch back to use struct i2c_driver's .probe()
Uwe Kleine-König [Mon, 12 Jun 2023 07:39:00 +0000 (09:39 +0200)]
platform/surface: surface3_power: Switch back to use struct i2c_driver's .probe()

After commit b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new()
call-back type"), all drivers being converted to .probe_new() and then
commit 03c835f498b5 ("i2c: Switch .probe() to not take an id parameter")
convert back to (the new) .probe() to be able to eventually drop
.probe_new() from struct i2c_driver.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Maximilian Luz <luzmaximilian@gmail.com>
Link: https://lore.kernel.org/r/20230612073902.840435-2-u.kleine-koenig@pengutronix.de
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
13 months agoplatform/x86/intel/pmc/mtl: Put devices in D3 during resume
David E. Box [Wed, 7 Jun 2023 23:38:49 +0000 (16:38 -0700)]
platform/x86/intel/pmc/mtl: Put devices in D3 during resume

An earlier commit placed some driverless devices in D3 during boot so that
they don't block package cstate entry on Meteor Lake. Also place these
devices in D3 after resume from suspend.

Fixes: 336ba968d3e3 ("platform/x86/intel/pmc/mtl: Put GNA/IPU/VPU devices in D3")
Signed-off-by: David E. Box <david.e.box@linux.intel.com>
Link: https://lore.kernel.org/r/20230607233849.239047-2-david.e.box@linux.intel.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
13 months agoplatform/x86/intel/pmc: Add resume callback
David E. Box [Wed, 7 Jun 2023 23:38:48 +0000 (16:38 -0700)]
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 <david.e.box@linux.intel.com>
Link: https://lore.kernel.org/r/20230607233849.239047-1-david.e.box@linux.intel.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
13 months agoplatform/x86: thinkpad_acpi: Fix lkp-tests warnings for platform profiles
Mark Pearson [Tue, 6 Jun 2023 15:18:04 +0000 (11:18 -0400)]
platform/x86: thinkpad_acpi: Fix lkp-tests warnings for platform profiles

Fix issues identified in dytc_profile_refresh identified by lkp-tests.
drivers/platform/x86/thinkpad_acpi.c:10538
dytc_profile_refresh() error: uninitialized symbol 'funcmode'.
drivers/platform/x86/thinkpad_acpi.c:10531
dytc_profile_refresh() error: uninitialized symbol 'output'.
drivers/platform/x86/thinkpad_acpi.c:10537
dytc_profile_refresh() error: uninitialized symbol 'output'.

These issues should not lead to real problems in the field as the refresh
function should only be called if MMC or PSC mode enabled. But good to fix.

Thanks to Dan Carpenter and the lkp-tests project for flagging these.

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <error27@gmail.com>
Closes: https://lore.kernel.org/r/202306011202.1hbgLRD4-lkp@intel.com/
Fixes: 1bc5d819f0b9 ("platform/x86: thinkpad_acpi: Fix profile modes on Intel platforms")
Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Link: https://lore.kernel.org/r/20230606151804.8819-1-mpearson-lenovo@squebb.ca
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
13 months agotools/power/x86/intel-speed-select: v1.16 release
Srinivas Pandruvada [Mon, 12 Jun 2023 23:10:37 +0000 (16:10 -0700)]
tools/power/x86/intel-speed-select: v1.16 release

This version addresses issues with core power configuration for
non CPU dies. Also address issue with JSON formatting of output.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
13 months agotools/power/x86/intel-speed-select: Fix json formatting issue
Srinivas Pandruvada [Mon, 22 May 2023 19:55:24 +0000 (12:55 -0700)]
tools/power/x86/intel-speed-select: Fix json formatting issue

Fix two issues related to JSON formatting:
1.
intel-speed-select -f json -o cp.out -c 1 core-power assoc -c 1
Intel(R) Speed Select Technology
Executing on CPU model:143[0x8f]
[root@spr-bkc bin]# cat cp.out | jq .
"package-0:die-0:cpu-1"

2.
intel-speed-select -f json -o tf.out turbo-freq enable -a
Intel(R) Speed Select Technology
Executing on CPU model:143[0x8f]
[root@spr-bkc bin]# cat tf.out | jq .
{
  "package-0:die-0:cpu-0": {
    "turbo-freq": {
      "enable": "success"
    }
  },
  "package-1:die-0:cpu-48": {
    "turbo-freq": {
      "enable": "success"
    }
  }
}
"turbo-freq --auto"
parse error: Expected string key before ':' at line 17, column 24

Both of these issues needed proper closing "}" for JSON.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
13 months agotools/power/x86/intel-speed-select: Adjust scope of core-power config
Srinivas Pandruvada [Thu, 18 May 2023 16:49:35 +0000 (09:49 -0700)]
tools/power/x86/intel-speed-select: Adjust scope of core-power config

When core-power configuration or enabled is modified, this is only done
for compute dies. But the config must also be set to cores with no CPUs.
Without this the configuration is not affective.

On displaying config information, allow display for non compute dies
also.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
13 months agoplatform/x86: hp-wmi: Add thermal profile for Victus 16-d1xxx
SungHwan Jung [Sun, 4 Jun 2023 17:30:23 +0000 (02:30 +0900)]
platform/x86: hp-wmi: Add thermal profile for Victus 16-d1xxx

This patch includes Platform Profile support (performance, balanced, quiet)
for Victus 16-d1xxx (8A25).

Signed-off-by: SungHwan Jung <onenowy@gmail.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20230604173023.4675-1-onenowy@gmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
13 months agoplatform/x86: think-lmi: Don't display unnecessary authentication settings
Mark Pearson [Thu, 1 Jun 2023 20:05:52 +0000 (16:05 -0400)]
platform/x86: think-lmi: Don't display unnecessary authentication settings

If Opcode support is available (which is the standard for all platforms
going forward) then there is no need to have the encoding and kbdlang
attributes visible.

Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230601200552.4396-8-mpearson-lenovo@squebb.ca
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
13 months agoplatform/x86: think-lmi: Correct NVME index default
Mark Pearson [Thu, 1 Jun 2023 20:05:51 +0000 (16:05 -0400)]
platform/x86: think-lmi: Correct NVME index default

The NVME/HDD index used by WMI starts at 1 so corrected the default
appropriately.
Note, zero index is still permitted in case it is required on future
platforms.
Documentation updated correspondingly

Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230601200552.4396-7-mpearson-lenovo@squebb.ca
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
13 months agoplatform/x86: think-lmi: Correct NVME password handling
Mark Pearson [Thu, 1 Jun 2023 20:05:50 +0000 (16:05 -0400)]
platform/x86: think-lmi: Correct NVME password handling

NVME passwords identifier have been standardised across the Lenovo
systems and now use udrp and adrp (user and admin level) instead of
unvp and mnvp.

This should apparently be backwards compatible.

Fixes: 640a5fa50a42 ("platform/x86: think-lmi: Opcode support")
Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230601200552.4396-6-mpearson-lenovo@squebb.ca
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
13 months agoplatform/x86: think-lmi: Update password fields to use BIT
Mark Pearson [Thu, 1 Jun 2023 20:05:49 +0000 (16:05 -0400)]
platform/x86: think-lmi: Update password fields to use BIT

Code clean up to use BIT macro as suggested.

Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230601200552.4396-5-mpearson-lenovo@squebb.ca
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
13 months agoplatform/x86: think-lmi: Update password attribute comments
Mark Pearson [Thu, 1 Jun 2023 20:05:48 +0000 (16:05 -0400)]
platform/x86: think-lmi: Update password attribute comments

Add comments to clarify what the different password attributes
are (as requested).

Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230601200552.4396-4-mpearson-lenovo@squebb.ca
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
13 months agoplatform/x86: think-lmi: Correct System password interface
Mark Pearson [Thu, 1 Jun 2023 20:05:47 +0000 (16:05 -0400)]
platform/x86: think-lmi: Correct System password interface

The system password identification was incorrect. This means that if
the password was enabled it wouldn't be detected correctly; and setting
it would not work.
Also updated code to use TLMI_SMP_PWD instead of TLMI_SYS_PWD to be in
sync with Lenovo documentation.

Fixes: 640a5fa50a42 ("platform/x86: think-lmi: Opcode support")
Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230601200552.4396-3-mpearson-lenovo@squebb.ca
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
13 months agoplatform/x86: think-lmi: Enable opcode support on BIOS settings
Mark Pearson [Thu, 1 Jun 2023 20:05:46 +0000 (16:05 -0400)]
platform/x86: think-lmi: Enable opcode support on BIOS settings

Whilst reviewing some documentation from the FW team on using WMI on
Lenovo system I noticed that we weren't using Opcode support when
changing BIOS settings in the thinkLMI driver.

We should be doing this to ensure we're future proof as the old
non-opcode mechanism has been deprecated.

Tested on X1 Carbon G10 and G11.

Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230601200552.4396-2-mpearson-lenovo@squebb.ca
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
13 months agoplatform/x86: think-lmi: mutex protection around multiple WMI calls
Mark Pearson [Thu, 1 Jun 2023 20:05:45 +0000 (16:05 -0400)]
platform/x86: think-lmi: mutex protection around multiple WMI calls

When an attribute is being changed if the Admin account is enabled, or if
a password is being updated then multiple WMI calls are needed.
Add mutex protection to ensure no race conditions are introduced.

Fixes: b49f72e7f96d ("platform/x86: think-lmi: Certificate authentication support")
Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230601200552.4396-1-mpearson-lenovo@squebb.ca
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
13 months agoplatform/x86:intel/pmc: Remove Meteor Lake S platform support
Xi Pardee [Thu, 1 Jun 2023 00:47:06 +0000 (17:47 -0700)]
platform/x86:intel/pmc: Remove Meteor Lake S platform support

commit c5ad454a12c6 ("platform/x86: intel/pmc/core: Add Meteor Lake
support to pmc core driver") was supposed to add support for Meter
Lake P/M and mistakenly added support for Meteor Lake S instead. Meteor
Lake P/M support was added later and MTL-S support needs to be removed
since its currently assigned to the wrong register maps.

Fixes: c5ad454a12c6 ("platform/x86: intel/pmc/core: Add Meteor Lake support to pmc core driver")
Signed-off-by: Xi Pardee <xi.pardee@intel.com>
Signed-off-by: David E. Box <david.e.box@linux.intel.com>
Link: https://lore.kernel.org/r/20230601004706.871528-1-xi.pardee@intel.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
13 months agoplatform/x86: int3472: Evaluate device's _DSM method to control imaging clock
Bingbu Cao [Wed, 31 May 2023 13:44:29 +0000 (15:44 +0200)]
platform/x86: int3472: Evaluate device's _DSM method to control imaging clock

On some platforms, the imaging clock should be controlled by evaluating
specific clock device's _DSM method instead of setting gpio, so this
change register clock if no gpio based clock and then use the _DSM method
to enable and disable clock.

Signed-off-by: Bingbu Cao <bingbu.cao@intel.com>
Signed-off-by: Hao Yao <hao.yao@intel.com>
Link: https://lore.kernel.org/r/20230524035135.90315-2-bingbu.cao@intel.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230531134429.171337-1-hdegoede@redhat.com
13 months agoplatform/x86/amd: pmc: Update metrics table info for Pink Sardine
Shyam Sundar S K [Thu, 25 May 2023 14:19:29 +0000 (19:49 +0530)]
platform/x86/amd: pmc: Update metrics table info for Pink Sardine

Starting from Pink Sardine, number of IP blocks were added to the SoC
and the PMFW has the ability to give debug stats on each the IP blocks
after a S0ix cycle within part of the SMU metrics table.

To differentiate this change, the 's2d_msg_id' is also changed. Add these
new capabilities to the driver.

Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20230525141929.866385-5-Shyam-sundar.S-k@amd.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
14 months agoplatform/x86/amd: pmc: Add helper function to check the cpu id
Shyam Sundar S K [Thu, 25 May 2023 14:19:28 +0000 (19:49 +0530)]
platform/x86/amd: pmc: Add helper function to check the cpu id

Add a helper routine to check the underlying cpu id, that can be used
across the PMC driver to remove the duplicate code.

Co-developed-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20230525141929.866385-4-Shyam-sundar.S-k@amd.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
14 months agoplatform/x86/amd: pmc: Get STB DRAM size from PMFW
Shyam Sundar S K [Thu, 25 May 2023 14:19:27 +0000 (19:49 +0530)]
platform/x86/amd: pmc: Get STB DRAM size from PMFW

Recent PMFW's have support for querying the STB DRAM size. Add this
support to the driver.

Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Co-developed-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Link: https://lore.kernel.org/r/20230525141929.866385-3-Shyam-sundar.S-k@amd.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
14 months agoplatform/x86/amd: pmc: Pass true/false to bool argument
Shyam Sundar S K [Thu, 25 May 2023 14:19:26 +0000 (19:49 +0530)]
platform/x86/amd: pmc: Pass true/false to bool argument

Pass true/false to the bool argument of the amd_pmc_send_cmd() function,
instead of 1/0 to match the function signature.

Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Co-developed-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Link: https://lore.kernel.org/r/20230525141929.866385-2-Shyam-sundar.S-k@amd.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
14 months agoplatform/x86: lenovo-yogabook: add I2C dependency
Arnd Bergmann [Fri, 19 May 2023 08:25:52 +0000 (10:25 +0200)]
platform/x86: lenovo-yogabook: add I2C dependency

The added platform_driver support fails to link when I2C core support is
not rechable:

x86_64-linux-ld: drivers/platform/x86/lenovo-yogabook.o: in function `yogabook_pdev_probe':
lenovo-yogabook.c:(.text+0x5a5): undefined reference to `i2c_bus_type'

Add a Kconfig dependency to enforce a working configuration.

Fixes: 6df1523fa0b7 ("platform/x86: lenovo-yogabook: Add platform driver support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20230519082606.375471-1-arnd@kernel.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
14 months agoplatform/x86: toshiba: constify pointers to hwmon_channel_info
Krzysztof Kozlowski [Thu, 11 May 2023 17:56:27 +0000 (19:56 +0200)]
platform/x86: toshiba: constify pointers to hwmon_channel_info

Statically allocated array of pointers to hwmon_channel_info can be made
const for safety.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230511175627.282246-4-krzysztof.kozlowski@linaro.org
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
14 months agoplatform/x86: system76: constify pointers to hwmon_channel_info
Krzysztof Kozlowski [Thu, 11 May 2023 17:56:26 +0000 (19:56 +0200)]
platform/x86: system76: constify pointers to hwmon_channel_info

Statically allocated array of pointers to hwmon_channel_info can be made
const for safety.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230511175627.282246-3-krzysztof.kozlowski@linaro.org
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
14 months agoplatform/x86: hp: constify pointers to hwmon_channel_info
Krzysztof Kozlowski [Thu, 11 May 2023 17:56:25 +0000 (19:56 +0200)]
platform/x86: hp: constify pointers to hwmon_channel_info

Statically allocated array of pointers to hwmon_channel_info can be made
const for safety.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230511175627.282246-2-krzysztof.kozlowski@linaro.org
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
14 months agoplatform/x86: gigabyte: constify pointers to hwmon_channel_info
Krzysztof Kozlowski [Thu, 11 May 2023 17:56:24 +0000 (19:56 +0200)]
platform/x86: gigabyte: constify pointers to hwmon_channel_info

Statically allocated array of pointers to hwmon_channel_info can be made
const for safety.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230511175627.282246-1-krzysztof.kozlowski@linaro.org
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
14 months agomlxbf-bootctl: Add sysfs file for BlueField boot log
Liming Sun [Thu, 11 May 2023 14:49:24 +0000 (10:49 -0400)]
mlxbf-bootctl: Add sysfs file for BlueField boot log

This commit adds sysfs interface to be used to write into the
boot log which is 1KB HW buffer on BlueField SoC. The same log
buffer is also used by firmware code like ATF/UEFI, and can be
displayed by userspace tools or from external host via USB/PCIe.

Signed-off-by: Liming Sun <limings@nvidia.com>
Reviewed-by: Vadim Pasternak <vadimp@nvidia.com>
Link: https://lore.kernel.org/r/20230511144924.171585-1-limings@nvidia.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
14 months agoplatform/x86/amd/pmf: Fix compiler warnings in static slider
Shyam Sundar S K [Tue, 16 May 2023 07:45:31 +0000 (13:15 +0530)]
platform/x86/amd/pmf: Fix compiler warnings in static slider

This patch fixes warnings with -Wmissing-prototypes:

warning: no previous prototype for 'source_as_str' [-Wmissing-prototypes]
warning: no previous prototype for 'slider_as_str' [-Wmissing-prototypes]

Fixes: a82ebb3d800d ("platform/x86/amd/pmf: Add PMF acpi debug support")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202305160220.REQc5T2y-lkp@intel.com/
Suggested-by: Patil Rajesh Reddy <Patil.Reddy@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20230516074531.2885235-1-Shyam-sundar.S-k@amd.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
14 months agoplatform/x86/amd/pmf: Add PMF debug facilities
Shyam Sundar S K [Wed, 10 May 2023 14:47:51 +0000 (20:17 +0530)]
platform/x86/amd/pmf: Add PMF debug facilities

At times, when the mode transitions fail to happen, the current
driver does not give enough debug information on why the transition
failed or the default preset values did not load. Having an on-demand
logs guarded by CONFIG would be helpful in such cases.

Co-developed-by: Patil Rajesh Reddy <Patil.Reddy@amd.com>
Signed-off-by: Patil Rajesh Reddy <Patil.Reddy@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/r/20230510144751.66601-2-Shyam-sundar.S-k@amd.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
14 months agoplatform/x86/amd/pmf: Add PMF acpi debug support
Shyam Sundar S K [Wed, 10 May 2023 14:47:50 +0000 (20:17 +0530)]
platform/x86/amd/pmf: Add PMF acpi debug support

PMF driver maintains an internal config store for each PMF feature
after the feature init happens. Having a debug mechanism to triage
in-field issues w.r.t to mode switch not happening based on the OEM
fed values via the ACPI method to PMF driver is becoming the need of
the hour. Add support to get more ACPI debug spew guarded by a CONFIG.

Co-developed-by: Patil Rajesh Reddy <Patil.Reddy@amd.com>
Signed-off-by: Patil Rajesh Reddy <Patil.Reddy@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/r/20230510144751.66601-1-Shyam-sundar.S-k@amd.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
14 months agoplatform/x86: lenovo-yogabook: Rename lenovo-yogabook-wmi to lenovo-yogabook
Hans de Goede [Sun, 30 Apr 2023 16:58:07 +0000 (18:58 +0200)]
platform/x86: lenovo-yogabook: Rename lenovo-yogabook-wmi to lenovo-yogabook

The lenovo-yogabook-wmi.c code now consists of both a platform and a WMI
driver and it does not use WMI at all when used on the Android model.

Rename the module from lenovo-yogabook-wmi to lenovo-yogabook to
reflect this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230430165807.472798-20-hdegoede@redhat.com
14 months agoplatform/x86: lenovo-yogabook: Add keyboard backlight control to platform driver
Hans de Goede [Sun, 30 Apr 2023 16:58:06 +0000 (18:58 +0200)]
platform/x86: lenovo-yogabook: Add keyboard backlight control to platform driver

On the Android yb1-x90f/l models there is not ACPI method to control
the keyboard backlight brightness. Instead the second PWM controller
is exposed directly to the OS there.

Add support for controlling keyboard backlight brightness on the Android
model by using the PWM subsystem to directly control the PWM.

The Android model also requires explicitly turning the backlight off
on suspend, which on the Windows model was done automatically.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230430165807.472798-19-hdegoede@redhat.com
14 months agoplatform/x86: lenovo-yogabook: Add platform driver support
Hans de Goede [Sun, 30 Apr 2023 16:58:05 +0000 (18:58 +0200)]
platform/x86: lenovo-yogabook: Add platform driver support

The Lenovo Yoga Book 1 comes in 2 versions.

Version 1: The yb1-x91f/l currently supported by lenovo-yogabook-wmi, which
has a WMI interface to deal with toggling the keyboard half between
touch-keyboard and wacom-digitizer mode.

Version 2: The yb1-x90f/l which is the same hardware shipping with Android
as factory OS. This version has a very different BIOS and ACPI tables which
lack the WMI interface.

Instead the x86-android-tablets.ko code which does devices instantiation
for devices missing from ACPI on various x86 Android tablets will
instantiate a platform device for the keyboard half touch-kbd/digitizer
toggle functionality.

This patch adds a platform driver to the lenovo-yogabook code which binds
to the platform device instantiated by x86-android-tablets.ko offering
touch-kbd/digitizer toggle functionality on the Android model.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230430165807.472798-18-hdegoede@redhat.com
14 months agoplatform/x86: lenovo-yogabook: Add YB_KBD_BL_MAX define
Hans de Goede [Sun, 30 Apr 2023 16:58:04 +0000 (18:58 +0200)]
platform/x86: lenovo-yogabook: Add YB_KBD_BL_MAX define

Add a define for the max brightness level instead of hardcoding
this to 255 in multiple places.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230430165807.472798-17-hdegoede@redhat.com
14 months agoplatform/x86: lenovo-yogabook: Group WMI specific code together
Hans de Goede [Sun, 30 Apr 2023 16:58:03 +0000 (18:58 +0200)]
platform/x86: lenovo-yogabook: Group WMI specific code together

Group WMI specific code together. Note this just moves a bunch of
code-blocks around, not a single line is changed.

This is a preparation patch for making lenovo-yogabook-wmi also work
on the Android version of the Yoga Book 1 which does not have a WMI
interface to deal with toggling the keyboard half between
touch-keyboard and wacom-digitizer mode.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230430165807.472798-16-hdegoede@redhat.com
14 months agoplatform/x86: lenovo-yogabook: Drop _wmi_ from remaining generic symbols
Hans de Goede [Sun, 30 Apr 2023 16:58:02 +0000 (18:58 +0200)]
platform/x86: lenovo-yogabook: Drop _wmi_ from remaining generic symbols

Change the yogabook_wmi_ prefix of remaining generic (non WMI specific)
symbols to yogabook_ .

This is a preparation patch for making lenovo-yogabook-wmi also work
on the Android version of the Yoga Book 1 which does not have a WMI
interface to deal with toggling the keyboard half between
touch-keyboard and wacom-digitizer mode.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230430165807.472798-15-hdegoede@redhat.com
14 months agoplatform/x86: lenovo-yogabook: Add a yogabook_toggle_digitizer_mode() helper function
Hans de Goede [Sun, 30 Apr 2023 16:58:01 +0000 (18:58 +0200)]
platform/x86: lenovo-yogabook: Add a yogabook_toggle_digitizer_mode() helper function

Add a yogabook_toggle_digitizer_mode() helper function.

This is a preparation patch for making lenovo-yogabook-wmi also work
on the Android version of the Yoga Book 1 which does not have a WMI
interface to deal with toggling the keyboard half between
touch-keyboard and wacom-digitizer mode.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230430165807.472798-14-hdegoede@redhat.com
14 months agoplatform/x86: lenovo-yogabook: Abstract kbd backlight setting
Hans de Goede [Sun, 30 Apr 2023 16:58:00 +0000 (18:58 +0200)]
platform/x86: lenovo-yogabook: Abstract kbd backlight setting

Abstract kbd backlight setting.

This is a preparation patch for making lenovo-yogabook-wmi also work
on the Android version of the Yoga Book 1 which does not have a WMI
interface to deal with toggling the keyboard half between
touch-keyboard and wacom-digitizer mode.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230430165807.472798-13-hdegoede@redhat.com
14 months agoplatform/x86: lenovo-yogabook: Stop checking adev->power.state
Hans de Goede [Sun, 30 Apr 2023 16:57:59 +0000 (18:57 +0200)]
platform/x86: lenovo-yogabook: Stop checking adev->power.state

lenovo-yogabook-wmi: controls the power-state itself and stores
this in data->flags so there is no need to poke inside ACPI device
internals.

This is a preparation patch for making lenovo-yogabook-wmi also work
on the Android version of the Yoga Book 1 which does not have a WMI
interface to deal with toggling the keyboard half between
touch-keyboard and wacom-digitizer mode.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230430165807.472798-12-hdegoede@redhat.com
14 months agoplatform/x86: lenovo-yogabook: Split probe() into generic and WMI specific parts
Hans de Goede [Sun, 30 Apr 2023 16:57:58 +0000 (18:57 +0200)]
platform/x86: lenovo-yogabook: Split probe() into generic and WMI specific parts

Split probe() and remove() into generic and WMI specific parts.

This is a preparation patch for making lenovo-yogabook-wmi also work
on the Android version of the Yoga Book 1 which does not have a WMI
interface to deal with toggling the keyboard half between
touch-keyboard and wacom-digitizer mode.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230430165807.472798-11-hdegoede@redhat.com
14 months agoplatform/x86: lenovo-yogabook: Use PMIC LED driver for pen icon LED control
Hans de Goede [Sun, 30 Apr 2023 16:57:57 +0000 (18:57 +0200)]
platform/x86: lenovo-yogabook: Use PMIC LED driver for pen icon LED control

Use the (new) PMIC LED driver for pen icon LED control instead of using
custom WMI calls for this.

This will also work on the Android version of the Lenovo Yoga Book 1,
where there is no WMI interface for this.

The dev_id of the lookup is set using dev_name() so that it will also
work for both the Windows YB1 WMI-device as well as the Android YB1
platform-device. While at it also move the gpio_lookup to using dev_name()
for the dev_id.

Note this also removes the need to turn of the LED during suspend since
the PMIC LED driver now already does that.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230430165807.472798-10-hdegoede@redhat.com
14 months agoplatform/x86: lenovo-yogabook: Add dev local variable to probe()
Hans de Goede [Sun, 30 Apr 2023 16:57:56 +0000 (18:57 +0200)]
platform/x86: lenovo-yogabook: Add dev local variable to probe()

Add a "struct device *dev" local variable to probe().

This is a preparation patch for making lenovo-yogabook-wmi also work
on the Android version of the Yoga Book 1 which does not have a WMI
interface to deal with toggling the keyboard half between
touch-keyboard and wacom-digitizer mode.

While at it also move the dev_set_drvdata() call to the end of probe().

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230430165807.472798-9-hdegoede@redhat.com
14 months agoplatform/x86: lenovo-yogabook: Store dev instead of wdev in drvdata struct
Hans de Goede [Sun, 30 Apr 2023 16:57:55 +0000 (18:57 +0200)]
platform/x86: lenovo-yogabook: Store dev instead of wdev in drvdata struct

Store a "struct device *dev" instead of a "struct wmi_device *wdev;"
in the "struct yogabook_wmi" driver-data.

This is a preparation patch for making lenovo-yogabook-wmi also work
on the Android version of the Yoga Book 1 which does not have a WMI
interface to deal with toggling the keyboard half between
touch-keyboard and wacom-digitizer mode.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230430165807.472798-8-hdegoede@redhat.com
14 months agoplatform/x86: lenovo-yogabook: Switch to DEFINE_SIMPLE_DEV_PM_OPS()
Hans de Goede [Sun, 30 Apr 2023 16:57:54 +0000 (18:57 +0200)]
platform/x86: lenovo-yogabook: Switch to DEFINE_SIMPLE_DEV_PM_OPS()

Switch to DEFINE_SIMPLE_DEV_PM_OPS() so that the __maybe_unused can
be dropped from the suspend/resume callbacks.

While at it also drop the _wmi_ part from the callback names in preparation
for making lenovo-yogabook-wmi also work on the Android version of
the Yoga Book 1 which does not have a WMI interface to deal with toggling
the keyboard half between touch-keyboard and wacom-digitizer mode.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230430165807.472798-7-hdegoede@redhat.com
14 months agoplatform/x86: lenovo-yogabook: Simplify gpio lookup table cleanup
Hans de Goede [Sun, 30 Apr 2023 16:57:53 +0000 (18:57 +0200)]
platform/x86: lenovo-yogabook: Simplify gpio lookup table cleanup

After the devm_gpiod_get("backside_hall_sw") call the gpio lookup table
is no longer necessary.

Remove it directly after this call instead using a devm reset-action
for this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230430165807.472798-6-hdegoede@redhat.com
14 months agoplatform/x86: lenovo-yogabook: Set default keyboard backligh brightness on probe()
Hans de Goede [Sun, 30 Apr 2023 16:57:52 +0000 (18:57 +0200)]
platform/x86: lenovo-yogabook: Set default keyboard backligh brightness on probe()

Set default keyboard backlight brightness on probe(), this fixes
the backlight being off after a rmmod + modprobe.

Fixes: c0549b72d99d ("platform/x86: lenovo-yogabook-wmi: Add driver for Lenovo Yoga Book")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230430165807.472798-5-hdegoede@redhat.com
14 months agoplatform/x86: lenovo-yogabook: Reprobe devices on remove()
Hans de Goede [Sun, 30 Apr 2023 16:57:51 +0000 (18:57 +0200)]
platform/x86: lenovo-yogabook: Reprobe devices on remove()

Ensure that both the keyboard touchscreen and the digitizer have their
driver bound after remove(). Without this modprobing lenovo-yogabook-wmi
after a rmmod fails because lenovo-yogabook-wmi defers probing until
both devices have their driver bound.

Fixes: c0549b72d99d ("platform/x86: lenovo-yogabook-wmi: Add driver for Lenovo Yoga Book")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230430165807.472798-4-hdegoede@redhat.com
14 months agoplatform/x86: lenovo-yogabook: Fix work race on remove()
Hans de Goede [Sun, 30 Apr 2023 16:57:50 +0000 (18:57 +0200)]
platform/x86: lenovo-yogabook: Fix work race on remove()

When yogabook_wmi_remove() runs yogabook_wmi_work might still be running
and using the devices which yogabook_wmi_remove() puts.

To avoid this move to explicitly cancelling the work rather then using
devm_work_autocancel().

This requires also making the yogabook_backside_hall_irq handler non
devm managed, so that it cannot re-queue the work while
yogabook_wmi_remove() runs.

Fixes: c0549b72d99d ("platform/x86: lenovo-yogabook-wmi: Add driver for Lenovo Yoga Book")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230430165807.472798-3-hdegoede@redhat.com
14 months agoplatform/x86: gigabyte-wmi: remove allowlist
Thomas Weißschuh [Sun, 7 May 2023 20:45:36 +0000 (22:45 +0200)]
platform/x86: gigabyte-wmi: remove allowlist

Having to maintain a per-system allowlist is burdensome and confusing
for users, drop it.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20230325-gigabyte-wmi-unrestrict-v2-1-0a54bc8e70d2@weissschuh.net
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
14 months agoplatform/x86: dell-sysman: Improve instance detection
Armin Wolf [Sun, 30 Apr 2023 20:31:53 +0000 (22:31 +0200)]
platform/x86: dell-sysman: Improve instance detection

The WMI driver core already knows how many WMI object instances
are available, use this information instead of probing the WMI object
manually.

Compile-tested only.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Link: https://lore.kernel.org/r/20230430203153.5587-3-W_Armin@gmx.de
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
14 months agoplatform/x86: wmi: Allow retrieving the number of WMI object instances
Armin Wolf [Sun, 30 Apr 2023 20:31:52 +0000 (22:31 +0200)]
platform/x86: wmi: Allow retrieving the number of WMI object instances

Currently, the WMI driver core knows how many instances of a given
WMI object exist, but WMI drivers cannot access this information.
At the same time, some current and upcoming WMI drivers want to
have access to this information. Add wmi_instance_count() and
wmidev_instance_count() to allow WMI drivers to get the number of
WMI object instances.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Link: https://lore.kernel.org/r/20230430203153.5587-2-W_Armin@gmx.de
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
14 months agoplatform/x86: x86-android-tablets: Add support for extra buttons on Cyberbook T116
Hans de Goede [Fri, 5 May 2023 20:59:01 +0000 (22:59 +0200)]
platform/x86: x86-android-tablets: Add support for extra buttons on Cyberbook T116

The Cyberbook T116 rugged tablet comes in both Windows and Android versions
and even on the Android version the DSDT is mostly sane. This tablet has
2 extra general purpose buttons in the row with the power + volume-buttons,
labeled P and F.

Use the x86-android-tablets infra to create a gpio-button device for these
2 extra buttons.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20230505205901.42649-2-hdegoede@redhat.com
14 months agoplatform/x86: x86-android-tablets: Add support for more then 1 gpio_key
Hans de Goede [Fri, 5 May 2023 20:59:00 +0000 (22:59 +0200)]
platform/x86: x86-android-tablets: Add support for more then 1 gpio_key

Modify the gpio_keys support in x86_android_tablet_init() for
tablets which have more then 1 key/button which needs to be handled
by the gpio_keys driver.

This requires copying over the struct gpio_keys_button from
the x86_gpio_button struct array to a new gpio_keys_button struct array,
as an added benefit this allows marking the per model x86_gpio_button
arrays __initconst so that they all can be freed after module init().

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20230505205901.42649-1-hdegoede@redhat.com
14 months agoplatform/x86: x86-android-tablets: Add Lenovo Yoga Book lid switch
Hans de Goede [Sat, 29 Apr 2023 18:02:30 +0000 (20:02 +0200)]
platform/x86: x86-android-tablets: Add Lenovo Yoga Book lid switch

Add x86_gpio_button info for the yb1-x90f/l describing the lid switch
on the Lenovo Yoga Book Android models.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230429180230.97716-2-hdegoede@redhat.com
14 months agoplatform/x86: x86-android-tablets: Fix Bluetooth on Lenovo Yoga Book
Hans de Goede [Sat, 29 Apr 2023 18:02:29 +0000 (20:02 +0200)]
platform/x86: x86-android-tablets: Fix Bluetooth on Lenovo Yoga Book

The Lenovo Yoga Book yb1-x90f/l has (another) bug in its DSDT where
the UART resource for the BTH0 ACPI device contains
"\\_SB.PCIO.URT1" as path to the UART.

Note that is with a letter 'O' instead of the number '0' which is wrong.

Add a x86_serdev_info entry to make the x86-android-tablets module
manually setup the /sys/bus/serial device for the Bluetooth UART
to fix Bluetooth not working due to this bug.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230429180230.97716-1-hdegoede@redhat.com
14 months agoplatform/x86: x86-android-tablets: Add Nextbook Ares 8A data
Hans de Goede [Sat, 29 Apr 2023 10:50:57 +0000 (12:50 +0200)]
platform/x86: x86-android-tablets: Add Nextbook Ares 8A data

The Nextbook Ares 8A is a x86 ACPI tablet which ships with Android x86
as factory OS. Its DSDT contains a bunch of I2C devices which are not
actually there, causing various resource conflicts. Enumeration of these
is skipped through the acpi_quirk_skip_i2c_client_enumeration().

Add support for manually instantiating the I2C devices which are
actually present on this tablet by adding the necessary device info to
the x86-android-tablets module.

Note the Ares 8A is the Cherry Trail (CHT) model, the regular Ares 8
is Bay Trail (BYT) based and was already supported. This also updates
the comments for the BYT model to point out this is the BYT model.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230429105057.7697-3-hdegoede@redhat.com
14 months agoplatform/x86: x86-android-tablets: Remove unnecessary invalid_aei_gpiochip settings
Hans de Goede [Sat, 29 Apr 2023 10:50:56 +0000 (12:50 +0200)]
platform/x86: x86-android-tablets: Remove unnecessary invalid_aei_gpiochip settings

Since commit 5adc409340b1 ("ACPI: x86: Introduce an
acpi_quirk_skip_gpio_event_handlers() helper") the ACPI GPIO code will
not register any GPIO event handlers at all for devices which have
the ACPI_QUIRK_SKIP_GPIO_EVENT_HANDLERS set in their DMI table entry
in drivers/acpi/x86/utils.c .

This includes the Nextbook Ares 8 and the Asus ME176C and TF103C models,
so x86-android-tablets no longer needs to disable the GPIO event handlers
on these, since they have never been registered at all.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230429105057.7697-2-hdegoede@redhat.com
14 months agoplatform/x86: x86-android-tablets: Add ALS sensor support for Yoga Tablet 2 1050...
Hans de Goede [Sat, 29 Apr 2023 10:50:55 +0000 (12:50 +0200)]
platform/x86: x86-android-tablets: Add ALS sensor support for Yoga Tablet 2 1050/830 series

The Yoga Tablet 2 1050/830 series have an AL3320A ambient light sensor,
add this to the list of i2c_clients to instantiate on these models.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230429105057.7697-1-hdegoede@redhat.com
14 months agoplatform/x86: hp-wmi: Add HP Envy special key support
Jonathan Singer [Wed, 26 Apr 2023 18:48:54 +0000 (14:48 -0400)]
platform/x86: hp-wmi: Add HP Envy special key support

Previously, some support for certain keys on the HP keyboard has been
added already in commit 3ee5447b2048 ("platform/x86: hp-wmi: Handle Omen
Key event"), however this as tested did not allow even the fn+esc key on
my HP Envy which uses the same keycode on my HP Envy x360 laptop to work
--the keycode rather than being passed in as a separate int from WMI, was
being passed in as the event_data for the HPWMI_OMEN_KEY event.

This patch, as tested was able to properly get the keycode for fn+esc,
and for fn+f12 which is supposed to be a programmable key according to
HP's keyboard diagram and is thus mapped to KEY_PROG2. The fn+f8 key
combination (mute microphone) was a standard HPWMI_BEZEL_BUTTON key,
however it did not previously have an entry in the sparse keymap. This
patch preserves the original HPWMI_OMEN_KEY behavior for laptops that
use it by only taking the keycode from the event_data only when the
event_data is nonzero.

Signed-off-by: Jonathan Singer <jes965@nyu.edu>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/r/20230426184852.2100-2-jes965@nyu.edu
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
14 months agoplatform/x86: hp-wmi: Add HP WMI camera switch
Jonathan Singer [Wed, 26 Apr 2023 18:48:52 +0000 (14:48 -0400)]
platform/x86: hp-wmi: Add HP WMI camera switch

Previously, when the camera toggle switch was hit, the hp-wmi driver
would report an invalid event code. By adding a case for that in the
event handling switch statement we can eliminate that error code and
enable a framework for potential further kernel handling of that key.
This change was tested on my HP Envy x360 15-ey0023dx laptop, but it
would likely work for any HP laptop with a camera toggle button. Now
we emit an SW_CAMERA_LENS_COVER event, on a device that gets created
on the first such event so as to not report incorrectly the state of
the camera shutter before we can know its state.

Signed-off-by: Jonathan Singer <jes965@nyu.edu>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/r/20230426184852.2100-1-jes965@nyu.edu
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
14 months agoplatform/x86/intel-uncore-freq: tpmi: Provide cluster level control
Srinivas Pandruvada [Tue, 18 Apr 2023 17:13:40 +0000 (10:13 -0700)]
platform/x86/intel-uncore-freq: tpmi: Provide cluster level control

The new generation of CPUs have granular control at a cluster level.
Each package/die can have multiple power domains, which further can
have multiple fabric clusters. The TPMI interface allows control at
fabric cluster level.

Use the updated uncore sysfs feature to expose controls at cluster
level. At each cluster level there is a control for maximum and minimum
uncore frequency. Also present current uncore frequency at a cluster
level.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reviewed-by: Zhang Rui <rui.zhang@intel.com>
Tested-by: Wendy Wang <wendy.wang@intel.com>
Link: https://lore.kernel.org/r/20230418171340.681662-4-srinivas.pandruvada@linux.intel.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
14 months agoplatform/x86/intel-uncore-freq: Support for cluster level controls
Srinivas Pandruvada [Tue, 18 Apr 2023 17:13:39 +0000 (10:13 -0700)]
platform/x86/intel-uncore-freq: Support for cluster level controls

An SoC can contain multiple power domains with individual or collection
of mesh partitions. This partition is called fabric cluster.

Certain type of meshes will need to run at the same frequency, they will
be placed in the same fabric cluster. Benefit of fabric cluster is that
it offers a scalable mechanism to deal with partitioned fabrics in a SoC.

The current sysfs interface supports control at package and die level.
This interface is not enough to support more granular control at
fabric cluster level.

SoCs with the support of TPMI (Topology Aware Register and PM Capsule
Interface), can have multiple power domains. Each power domain can
contain one or more fabric clusters.

To support such granular controls, enhance uncore common to optionally
create new directories to provide controls at fabric cluster level. It
is also important to have flexibility to change granularity for future
version of SoCs. If the directory name contains scope like:
"package_*_die_*_power_domain_*_cluster_*", then this is not expandable.

The cpufreq policies also have different scopes. There the scope of the
policy (affected_cpus) specified by attributes inside each policy.
So, follow the same model for uncore frequency scaling sysfs as:
"sys/devices/system/cpu/cpufreq/policy*"

Allow client drivers to optionally support granular control for each
fabric cluster. Here, the directory name will be "uncore" suffixed with
an unique instance number. For example: uncore00, uncore01 etc.
Attributes in the directory identify package id, power domain and
fabric cluster id. This interface is expandable even if some new level
of granularity is introduced. A new sysfs attribute can identify new
level.

For compatibility with the existing sysfs and provide easy way to set
limits for each fabric cluster in the package/die, the existing control
at package/die levels are still provided. For majority of users, this is
an easy approach.

For example: On a single package/die system, with three power domains
and one fabric cluster per power domain:

$tree -L 2 /sys/devices/system/cpu/intel_uncore_frequency/
/sys/devices/system/cpu/intel_uncore_frequency/
├── package_00_die_00
│   ├── current_freq_khz
│   ├── initial_max_freq_khz
│   ├── initial_min_freq_khz
│   ├── max_freq_khz
│   └── min_freq_khz
├── uncore00
│   ├── current_freq_khz
│   ├── domain_id
│   ├── fabric_cluster_id
│   ├── initial_max_freq_khz
│   ├── initial_min_freq_khz
│   ├── max_freq_khz
│   ├── min_freq_khz
│   └── package_id
├── uncore01
│   ├── current_freq_khz
│   ├── domain_id
│   ├── fabric_cluster_id
│   ├── initial_max_freq_khz
│   ├── initial_min_freq_khz
│   ├── max_freq_khz
│   ├── min_freq_khz
│   └── package_id
└── uncore02
    ├── current_freq_khz
    ├── domain_id
    ├── fabric_cluster_id
    ├── initial_max_freq_khz
    ├── initial_min_freq_khz
    ├── max_freq_khz
    ├── min_freq_khz
    └── package_id

The attribute for cluster id is "fabric_cluster_id" instead of just
"cluster_id" is to avoid confusion with usage of term clusters in
other part of the Linux kernel.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reviewed-by: Zhang Rui <rui.zhang@intel.com>
Tested-by: Wendy Wang <wendy.wang@intel.com>
Link: https://lore.kernel.org/r/20230418171340.681662-3-srinivas.pandruvada@linux.intel.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
14 months agoplatform/x86/intel-uncore-freq: Uncore frequency control via TPMI
Srinivas Pandruvada [Thu, 20 Apr 2023 22:05:14 +0000 (15:05 -0700)]
platform/x86/intel-uncore-freq: Uncore frequency control via TPMI

Implement support of uncore frequency control via TPMI (Topology Aware
Register and PM Capsule Interface). This driver provides the similar
functionality as the current uncore frequency driver using MSRs.

The hardware interface to read/write is basically substitution of MSR
0x620 and 0x621. There are specific MMIO offset and bits to get/set
minimum and maximum uncore ratio, similar to MSRs.

The scope of the uncore MSRs is package/die. But new generation of CPUs
have more granular control at a cluster level. Each package/die can have
multiple power domains, which further can have multiple clusters. The
TPMI interface allows control at cluster level.

The primary use case for uncore sysfs is to set maximum and minimum
uncore frequency to reduce power consumption or latency. The current
uncore sysfs control is per package/die. This is enough for the majority
of users as workload will move to different power domains as it moves
between different CPUs.

The current uncore sysfs provides controls at package/die level. When
user sets maximum/minimum limits, the driver sets the same limits to
each cluster.

Here number of power domains = number of resources in this aux device.
There are offsets and bits to discover number of clusters and offset for
each cluster level controls.

The TPMI documentation can be downloaded from:
https://github.com/intel/tpmi_power_management

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reviewed-by: Zhang Rui <rui.zhang@intel.com>
Tested-by: Wendy Wang <wendy.wang@intel.com>
Link: https://lore.kernel.org/r/20230420220514.747573-1-srinivas.pandruvada@linux.intel.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
14 months agoplatform/x86: dell-ddv: Update ABI documentation
Armin Wolf [Mon, 8 May 2023 20:42:41 +0000 (22:42 +0200)]
platform/x86: dell-ddv: Update ABI documentation

Synchronize the ABI documentation with the driver documentation
and direct users to the latter in case the search for more
detailed information.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Link: https://lore.kernel.org/r/20230508204241.11076-2-W_Armin@gmx.de
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
14 months agoplatform/x86: dell-ddv: Add documentation
Armin Wolf [Mon, 8 May 2023 20:42:40 +0000 (22:42 +0200)]
platform/x86: dell-ddv: Add documentation

The WMI interface used by the dell-wmi-ddv driver contains
many methods which are currently unused, making it difficult
to document these inside the drivers source code.
Create the necessary documentation based on current knowledge
so that all details of the WMI interface can be written down
for later use.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Link: https://lore.kernel.org/r/20230508204241.11076-1-W_Armin@gmx.de
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
14 months agoplatform/x86: wmi: Add device specific documentation
Armin Wolf [Mon, 24 Apr 2023 22:29:39 +0000 (00:29 +0200)]
platform/x86: wmi: Add device specific documentation

Add a place for device-specific documentation of WMI drivers.
The first entry is documentation for the wmi-bmof driver, with
additional documentation being expected to follow.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://lore.kernel.org/r/20230424222939.208137-5-W_Armin@gmx.de
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
14 months agoplatform/x86: wmi: Add documentation
Armin Wolf [Mon, 24 Apr 2023 22:29:38 +0000 (00:29 +0200)]
platform/x86: wmi: Add documentation

Add documentation for the WMI subsystem. The documentation describes
both the ACPI WMI interface and the driver API for interacting with
the WMI driver core. The information regarding the ACPI interface
was retrieved from the Ubuntu kernel references and the Windows driver
samples available on GitHub. The documentation is supposed to help
driver developers writing WMI drivers, as many modern machines designed
to run Windows provide an ACPI WMI interface.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://lore.kernel.org/r/20230424222939.208137-4-W_Armin@gmx.de
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
14 months agoplatform/x86: wmi: Mark GUID-based WMI interface as deprecated
Armin Wolf [Mon, 24 Apr 2023 22:29:37 +0000 (00:29 +0200)]
platform/x86: wmi: Mark GUID-based WMI interface as deprecated

The WMI driver core supports a more mordern bus-based interface for
interacting with WMI devices. The older GUID-based interface depends
on each WMI GUID and notification id being unique on a given system,
which turned out is not the case.
Mark the older interface as deprecated since new WMI drivers should
use the bus-based interface to avoid this issues.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://lore.kernel.org/r/20230424222939.208137-3-W_Armin@gmx.de
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
14 months agoplatform/x86: wmi: Add kernel doc comments
Armin Wolf [Mon, 24 Apr 2023 22:29:36 +0000 (00:29 +0200)]
platform/x86: wmi: Add kernel doc comments

Add kernel doc comments useful for documenting the functions/structs
used to interact with the WMI driver core.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://lore.kernel.org/r/20230424222939.208137-2-W_Armin@gmx.de
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
14 months agoplatform/mellanox: fix potential race in mlxbf-tmfifo driver
Liming Sun [Wed, 26 Apr 2023 14:23:44 +0000 (10:23 -0400)]
platform/mellanox: fix potential race in mlxbf-tmfifo driver

This commit adds memory barrier for the 'vq' update in function
mlxbf_tmfifo_virtio_find_vqs() to avoid potential race due to
out-of-order memory write. It also adds barrier for the 'is_ready'
flag to make sure the initializations are visible before this flag
is checked.

Signed-off-by: Liming Sun <limings@nvidia.com>
Reviewed-by: Vadim Pasternak <vadimp@nvidia.com>
Link: https://lore.kernel.org/r/b98c0ab61d644ba38fa9b3fd1607b138b0dd820b.1682518748.git.limings@nvidia.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
14 months agoplatform/x86: touchscreen_dmi: Add info for the Dexp Ursus KX210i
Andrey Avdeev [Sun, 30 Apr 2023 08:01:10 +0000 (11:01 +0300)]
platform/x86: touchscreen_dmi: Add info for the Dexp Ursus KX210i

Add touchscreen info for the Dexp Ursus KX210i

Signed-off-by: Andrey Avdeev <jamesstoun@gmail.com>
Link: https://lore.kernel.org/r/ZE4gRgzRQCjXFYD0@avdeevavpc
Cc: stable@vger.kernel.org
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
14 months agoplatform/x86: touchscreen_dmi: Add upside-down quirk for GDIX1002 ts on the Juno...
Hans de Goede [Fri, 5 May 2023 21:03:23 +0000 (23:03 +0200)]
platform/x86: touchscreen_dmi: Add upside-down quirk for GDIX1002 ts on the Juno Tablet

The Juno Computers Juno Tablet has an upside-down mounted Goodix
touchscreen. Add a quirk to invert both axis to correct for this.

Link: https://junocomputers.com/us/product/juno-tablet/
Cc: stable@vger.kernel.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230505210323.43177-1-hdegoede@redhat.com
14 months agoplatform/x86: thinkpad_acpi: Add profile force ability
Mark Pearson [Fri, 5 May 2023 13:25:23 +0000 (09:25 -0400)]
platform/x86: thinkpad_acpi: Add profile force ability

There has been a lot of confusion around which platform profiles are
supported on various platforms and it would be useful to have a debug
method to be able to override the profile mode that is selected.

I don't expect this to be used in anything other than debugging in
conjunction with Lenovo engineers - but it does give a way to get a
system working whilst we wait for either FW fixes, or a driver fix
to land upstream, if something is wonky in the mode detection logic

Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Link: https://lore.kernel.org/r/20230505132523.214338-2-mpearson-lenovo@squebb.ca
Cc: stable@vger.kernel.org
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
14 months agoplatform/x86: thinkpad_acpi: Fix platform profiles on T490
Mark Pearson [Fri, 5 May 2023 13:25:22 +0000 (09:25 -0400)]
platform/x86: thinkpad_acpi: Fix platform profiles on T490

I had incorrectly thought that PSC profiles were not usable on Intel
platforms so had blocked them in the driver initialistion. This broke
platform profiles on the T490.

After discussion with the FW team PSC does work on Intel platforms and
should be allowed.

Note - it's possible this may impact other platforms where it is advertised
but special driver support that only Windows has is needed. But if it does
then they will need fixing via quirks. Please report any issues to me so I
can get them addressed - but I haven't found any problems in testing...yet

Fixes: bce6243f767f ("platform/x86: thinkpad_acpi: do not use PSC mode on Intel platforms")
Link: https://bugzilla.redhat.com/show_bug.cgi?id=2177962
Cc: stable@vger.kernel.org
Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Link: https://lore.kernel.org/r/20230505132523.214338-1-mpearson-lenovo@squebb.ca
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
14 months agoplatform/x86: hp-wmi: add micmute to hp_wmi_keymap struct
Fae [Tue, 25 Apr 2023 06:36:44 +0000 (01:36 -0500)]
platform/x86: hp-wmi: add micmute to hp_wmi_keymap struct

Fixes micmute key of HP Envy X360 ey0xxx.

Signed-off-by: Fae <faenkhauser@gmail.com>
Link: https://lore.kernel.org/r/20230425063644.11828-1-faenkhauser@gmail.com
Cc: stable@vger.kernel.org
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
14 months agoplatform/x86/intel-uncore-freq: Return error on write frequency
Srinivas Pandruvada [Tue, 18 Apr 2023 15:32:30 +0000 (08:32 -0700)]
platform/x86/intel-uncore-freq: Return error on write frequency

Currently when the uncore_write() returns error, it is silently
ignored. Return error to user space when uncore_write() fails.

Fixes: 49a474c7ba51 ("platform/x86: Add support for Uncore frequency control")
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reviewed-by: Zhang Rui <rui.zhang@intel.com>
Tested-by: Wendy Wang <wendy.wang@intel.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20230418153230.679094-1-srinivas.pandruvada@linux.intel.com
Cc: stable@vger.kernel.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
14 months agoplatform/x86: intel_scu_pcidrv: Add back PCI ID for Medfield
Julian Winkler [Sun, 16 Apr 2023 15:49:32 +0000 (17:49 +0200)]
platform/x86: intel_scu_pcidrv: Add back PCI ID for Medfield

This id was removed in commit b47018a778c1 ("platform/x86: intel_scu_ipc:
Remove Lincroft support"), saying it is only used on Moorestown,
but apparently the same id is also used on Medfield.

Tested on the Medfield based Motorola RAZR i smartphone.

Signed-off-by: Julian Winkler <julian.winkler1@web.de>
Link: https://lore.kernel.org/r/20230416154932.6579-1-julian.winkler1@web.de
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>