mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-26 12:34:41 +08:00
5516745311
ASUS WMI driver got a big refactoring in order to support the TUF Gaming laptops. Besides that, the regression with backlight being permanently off on various EeePC laptops has been fixed. Accelerometer on HP ProBook 450 G0 shows wrong measurements due to X axis being inverted. This has been fixed. Intel PMC core driver has been extended to be ACPI enumerated if the DSDT provides device with _HID "INT33A1". This allows to convert the driver to be pure platform and support new hardware purely based on ACPI DSDT. From now on the Intel Speed Select Technology is supported thru a corresponding driver. This driver provides an access to the features of the ISST, such as Performance Profile, Core Power, Base frequency and Turbo Frequency. Mellanox platform drivers has been refactored and now extended to support more systems, including new coming ones. The OLPC XO-1.75 platform is now supported. CB4063 Beckhoff Automation board is using PMC clocks, provided via pmc_atom driver, for ethernet controllers in a way that they can't be managed by the clock driver. The quirk has been extended to cover this case. Touchscreen on Chuwi Hi10 Plus tablet has been enabled. Meanwhile the information of Chuwi Hi10 Air has been fixed to cover more models based on the same platform. Xiaomi notebooks have WMI interface enabled. Thus, the driver to support it has been provided. It required some extension of the generic WMI library, which allows to propagate opaque context to the ->probe() of the individual drivers. This release includes debugfs clean up from Greg KH for several drivers that drop return code check and make debugfs absence or failure non-fatal. Miscellaneous fixes here and there, mostly for Acer WMI and various Intel drivers. The listed below commits are duplicated due to previously pushed fixes in v5.2 cycle: -1dd93f873d
platform/x86: asus-wmi: Only Tell EC the OS will handle display hotkeys from asus_nb_wmi -89ae3a0736
platform/x86: intel-vbtn: Report switch events when event wakes device -fa882fc80d
platform/x86: mlx-platform: Fix parent device in i2c-mux-reg device registration -0bfcd24b39
platform/mellanox: mlxreg-hotplug: Add devm_free_irq call to remove flow The following is an automated git shortlog grouped by driver: acer-wmi: - Mark expected switch fall-throughs - no need to check return value of debugfs_create functions asus-nb-wmi: - Add microphone mute key code asus-wmi: - Use dev_get_drvdata() - Do not disable keyboard backlight on unloading - Switch fan boost mode - Enhance detection of thermal data - Organize code into sections - Refactor error handling - Support WMI event queue - Refactor WMI event handling - Improve DSTS WMI method ID detection - Increase input buffer size of WMI methods - Fix preserving keyboard backlight intensity on load - Fix hwmon device cleanup - no need to check return value of debugfs_create functions - Only Tell EC the OS will handle display hotkeys from asus_nb_wmi dell-laptop: - no need to check return value of debugfs_create functions hp_accel: - Add support for HP ProBook 450 G0 ideapad-laptop: - no need to check return value of debugfs_create functions intel_int0002_vgpio: - Get rid of custom ICPU() macro intel_menlow: - avoid null pointer deference error intel_pmc: - no need to check return value of debugfs_create functions intel_pmc_core: - Attach using APCI HID "INT33A1" - transform Pkg C-state residency from TSC ticks into microseconds intel_telemetry: - no need to check return value of debugfs_create functions intel-vbtn: - Report switch events when event wakes device ISST: - Restore state on resume - Add Intel Speed Select PUNIT MSR interface - Add Intel Speed Select mailbox interface via MSRs - Add Intel Speed Select mailbox interface via PCI - Add Intel Speed Select mmio interface - Add IOCTL to Translate Linux logical CPU to PUNIT CPU number - Store per CPU information - Add common API to register and handle ioctls - Update ioctl-number.txt for Intel Speed Select interface - A tool to validate Intel Speed Select commands - Add .gitignore file MAINTAINERS: - Update for Intel Speed Select Technology mlx-platform: - Fix error handling in mlxplat_init() - Add more reset cause attributes - Modify DMI matching order - Add regmap structure for the next generation systems - Change API for i2c-mlxcpld driver activation - Move regmap initialization before all drivers activation - Fix parent device in i2c-mux-reg device registration - Add new attribute for mlxreg-io sysfs interfaces pcengines-apuv2: - Make two symbols static - Fix PCENGINES_APU2 Kconfig warning OLPC: - Add a config menu category for XO 1.75 - Require CONFIG_POWER_SUPPLY for XO-1.75 EC - Fix olpc_xo175_ec_cmd() return value - Make olpc_dt_compatible_match() static __init - Add INPUT dependencies - Fix build error without CONFIG_SPI - Add a regulator for the DCON - Add XO-1.75 EC driver - Use BIT() and GENMASK() for event masks - Avoid a warning if the EC didn't register yet - Move EC-specific functionality out from x86 - Remove an unused include - Add OLPC XO-1.75 EC bindings platform/mellanox: - mlxreg-hotplug: Add devm_free_irq call to remove flow pmc_atom: - Add CB4063 Beckhoff Automation board to critclk_systems DMI table - no need to check return value of debugfs_create functions Kconfig: - Remove left-over BACKLIGHT_LCD_SUPPORT samsung-laptop: - no need to check return value of debugfs_create functions touchscreen_dmi: - Update Hi10 Air filter - Add info for the CHUWI Hi10 Plus tablet. wmi: - add Xiaomi WMI key driver - add context argument to the probe function - add context pointer field to struct wmi_device_id - Add function to get _UID of WMI device -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEqaflIX74DDDzMJJtb7wzTHR8rCgFAl0rP88ACgkQb7wzTHR8 rCis8BAAnRgRgi8x1C7xn66gAUHsDXpY0tF9cp/Fw3HyTmFCQkRSmnLkMM2DqGi+ dvB9U1zPcGWwdwryKFsJXioEK3erYpiYyT2VwLtW4S7P5jQ+N9biT4TZ8yFp0MEr MZC50LZDV1JTp1a0GQyrMpfoMBnE7UhR2GL8UbGli/WwXFE5BLkrJ1pdrjhYZOHl rJcgq3HPAhV5qkUkIU7gTC2GGSPydjBqk0OhVIU4dPsYwXIb2gXc0yR0QVwKm5x3 I/NQwBOBMKmdI6uJ8BJyg/p888Strw65YJaTe5wtvG8ljuIbcN/aQ3ZmClNrUnc0 58byqJCpRhg9HN39VpF9rsApEGxKTlitAUAUKy7lgue7/mycHbA1Syzz29AIM+2v ey2/zgFeeWtgh1cuh2cUWlCE6woW7ED4VpDxhkXlX4xGUp+CILEiFqcsULlcc4j5 sgojCLRPs78roYj9Y84CwYbsd7J/Ce4r2evBpKYPqYxDbUiuH2aVQtEdPTKv9/xC yHtBuJJSxY7a+sf4OZONRo13dfvRoZIPjcccR8yTOakS2/1Fqph7MpHyDkwFAfeS M2f+OcJn9IECol1391PTLj9Dx3jApyVk21HJdiIj7sKZgJOSS54AFm0/Ywk0MFpY XScXKulV48SdL4ZKup5aIpDzyP5zuvXszKQboRitep1dHiR9bl0= =DC5j -----END PGP SIGNATURE----- Merge tag 'platform-drivers-x86-v5.3-1' of git://git.infradead.org/linux-platform-drivers-x86 Pull x86 platform driver updates from Andy Shevchenko: "Gathered a bunch of x86 platform driver changes. It's rather big, since includes two big refactors and completely new driver: - ASUS WMI driver got a big refactoring in order to support the TUF Gaming laptops. Besides that, the regression with backlight being permanently off on various EeePC laptops has been fixed. - Accelerometer on HP ProBook 450 G0 shows wrong measurements due to X axis being inverted. This has been fixed. - Intel PMC core driver has been extended to be ACPI enumerated if the DSDT provides device with _HID "INT33A1". This allows to convert the driver to be pure platform and support new hardware purely based on ACPI DSDT. - From now on the Intel Speed Select Technology is supported thru a corresponding driver. This driver provides an access to the features of the ISST, such as Performance Profile, Core Power, Base frequency and Turbo Frequency. - Mellanox platform drivers has been refactored and now extended to support more systems, including new coming ones. - The OLPC XO-1.75 platform is now supported. - CB4063 Beckhoff Automation board is using PMC clocks, provided via pmc_atom driver, for ethernet controllers in a way that they can't be managed by the clock driver. The quirk has been extended to cover this case. - Touchscreen on Chuwi Hi10 Plus tablet has been enabled. Meanwhile the information of Chuwi Hi10 Air has been fixed to cover more models based on the same platform. - Xiaomi notebooks have WMI interface enabled. Thus, the driver to support it has been provided. It required some extension of the generic WMI library, which allows to propagate opaque context to the ->probe() of the individual drivers. This release includes debugfs clean up from Greg KH for several drivers that drop return code check and make debugfs absence or failure non-fatal. Also miscellaneous fixes here and there, mostly for Acer WMI and various Intel drivers" * tag 'platform-drivers-x86-v5.3-1' of git://git.infradead.org/linux-platform-drivers-x86: (74 commits) platform/x86: Fix PCENGINES_APU2 Kconfig warning tools/power/x86/intel-speed-select: Add .gitignore file platform/x86: mlx-platform: Fix error handling in mlxplat_init() platform/x86: intel_pmc_core: Attach using APCI HID "INT33A1" platform/x86: intel_pmc_core: transform Pkg C-state residency from TSC ticks into microseconds platform/x86: asus-wmi: Use dev_get_drvdata() Documentation/ABI: Add new attribute for mlxreg-io sysfs interfaces platform/x86: mlx-platform: Add more reset cause attributes platform/x86: mlx-platform: Modify DMI matching order platform/x86: mlx-platform: Add regmap structure for the next generation systems platform/x86: mlx-platform: Change API for i2c-mlxcpld driver activation platform/x86: mlx-platform: Move regmap initialization before all drivers activation MAINTAINERS: Update for Intel Speed Select Technology tools/power/x86: A tool to validate Intel Speed Select commands platform/x86: ISST: Restore state on resume platform/x86: ISST: Add Intel Speed Select PUNIT MSR interface platform/x86: ISST: Add Intel Speed Select mailbox interface via MSRs platform/x86: ISST: Add Intel Speed Select mailbox interface via PCI platform/x86: ISST: Add Intel Speed Select mmio interface platform/x86: ISST: Add IOCTL to Translate Linux logical CPU to PUNIT CPU number ...
327 lines
7.1 KiB
C
327 lines
7.1 KiB
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
/*
|
|
* OLPC-specific OFW device tree support code.
|
|
*
|
|
* Paul Mackerras August 1996.
|
|
* Copyright (C) 1996-2005 Paul Mackerras.
|
|
*
|
|
* Adapted for 64bit PowerPC by Dave Engebretsen and Peter Bergner.
|
|
* {engebret|bergner}@us.ibm.com
|
|
*
|
|
* Adapted for sparc by David S. Miller davem@davemloft.net
|
|
* Adapted for x86/OLPC by Andres Salomon <dilinger@queued.net>
|
|
*/
|
|
|
|
#include <linux/kernel.h>
|
|
#include <linux/memblock.h>
|
|
#include <linux/of.h>
|
|
#include <linux/of_pdt.h>
|
|
#include <asm/olpc.h>
|
|
#include <asm/olpc_ofw.h>
|
|
|
|
static phandle __init olpc_dt_getsibling(phandle node)
|
|
{
|
|
const void *args[] = { (void *)node };
|
|
void *res[] = { &node };
|
|
|
|
if ((s32)node == -1)
|
|
return 0;
|
|
|
|
if (olpc_ofw("peer", args, res) || (s32)node == -1)
|
|
return 0;
|
|
|
|
return node;
|
|
}
|
|
|
|
static phandle __init olpc_dt_getchild(phandle node)
|
|
{
|
|
const void *args[] = { (void *)node };
|
|
void *res[] = { &node };
|
|
|
|
if ((s32)node == -1)
|
|
return 0;
|
|
|
|
if (olpc_ofw("child", args, res) || (s32)node == -1) {
|
|
pr_err("PROM: %s: fetching child failed!\n", __func__);
|
|
return 0;
|
|
}
|
|
|
|
return node;
|
|
}
|
|
|
|
static int __init olpc_dt_getproplen(phandle node, const char *prop)
|
|
{
|
|
const void *args[] = { (void *)node, prop };
|
|
int len;
|
|
void *res[] = { &len };
|
|
|
|
if ((s32)node == -1)
|
|
return -1;
|
|
|
|
if (olpc_ofw("getproplen", args, res)) {
|
|
pr_err("PROM: %s: getproplen failed!\n", __func__);
|
|
return -1;
|
|
}
|
|
|
|
return len;
|
|
}
|
|
|
|
static int __init olpc_dt_getproperty(phandle node, const char *prop,
|
|
char *buf, int bufsize)
|
|
{
|
|
int plen;
|
|
|
|
plen = olpc_dt_getproplen(node, prop);
|
|
if (plen > bufsize || plen < 1) {
|
|
return -1;
|
|
} else {
|
|
const void *args[] = { (void *)node, prop, buf, (void *)plen };
|
|
void *res[] = { &plen };
|
|
|
|
if (olpc_ofw("getprop", args, res)) {
|
|
pr_err("PROM: %s: getprop failed!\n", __func__);
|
|
return -1;
|
|
}
|
|
}
|
|
|
|
return plen;
|
|
}
|
|
|
|
static int __init olpc_dt_nextprop(phandle node, char *prev, char *buf)
|
|
{
|
|
const void *args[] = { (void *)node, prev, buf };
|
|
int success;
|
|
void *res[] = { &success };
|
|
|
|
buf[0] = '\0';
|
|
|
|
if ((s32)node == -1)
|
|
return -1;
|
|
|
|
if (olpc_ofw("nextprop", args, res) || success != 1)
|
|
return -1;
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int __init olpc_dt_pkg2path(phandle node, char *buf,
|
|
const int buflen, int *len)
|
|
{
|
|
const void *args[] = { (void *)node, buf, (void *)buflen };
|
|
void *res[] = { len };
|
|
|
|
if ((s32)node == -1)
|
|
return -1;
|
|
|
|
if (olpc_ofw("package-to-path", args, res) || *len < 1)
|
|
return -1;
|
|
|
|
return 0;
|
|
}
|
|
|
|
static unsigned int prom_early_allocated __initdata;
|
|
|
|
void * __init prom_early_alloc(unsigned long size)
|
|
{
|
|
static u8 *mem;
|
|
static size_t free_mem;
|
|
void *res;
|
|
|
|
if (free_mem < size) {
|
|
const size_t chunk_size = max(PAGE_SIZE, size);
|
|
|
|
/*
|
|
* To mimimize the number of allocations, grab at least
|
|
* PAGE_SIZE of memory (that's an arbitrary choice that's
|
|
* fast enough on the platforms we care about while minimizing
|
|
* wasted bootmem) and hand off chunks of it to callers.
|
|
*/
|
|
res = memblock_alloc(chunk_size, SMP_CACHE_BYTES);
|
|
if (!res)
|
|
panic("%s: Failed to allocate %zu bytes\n", __func__,
|
|
chunk_size);
|
|
BUG_ON(!res);
|
|
prom_early_allocated += chunk_size;
|
|
memset(res, 0, chunk_size);
|
|
free_mem = chunk_size;
|
|
mem = res;
|
|
}
|
|
|
|
/* allocate from the local cache */
|
|
free_mem -= size;
|
|
res = mem;
|
|
mem += size;
|
|
return res;
|
|
}
|
|
|
|
static struct of_pdt_ops prom_olpc_ops __initdata = {
|
|
.nextprop = olpc_dt_nextprop,
|
|
.getproplen = olpc_dt_getproplen,
|
|
.getproperty = olpc_dt_getproperty,
|
|
.getchild = olpc_dt_getchild,
|
|
.getsibling = olpc_dt_getsibling,
|
|
.pkg2path = olpc_dt_pkg2path,
|
|
};
|
|
|
|
static phandle __init olpc_dt_finddevice(const char *path)
|
|
{
|
|
phandle node;
|
|
const void *args[] = { path };
|
|
void *res[] = { &node };
|
|
|
|
if (olpc_ofw("finddevice", args, res)) {
|
|
pr_err("olpc_dt: finddevice failed!\n");
|
|
return 0;
|
|
}
|
|
|
|
if ((s32) node == -1)
|
|
return 0;
|
|
|
|
return node;
|
|
}
|
|
|
|
static int __init olpc_dt_interpret(const char *words)
|
|
{
|
|
int result;
|
|
const void *args[] = { words };
|
|
void *res[] = { &result };
|
|
|
|
if (olpc_ofw("interpret", args, res)) {
|
|
pr_err("olpc_dt: interpret failed!\n");
|
|
return -1;
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
/*
|
|
* Extract board revision directly from OFW device tree.
|
|
* We can't use olpc_platform_info because that hasn't been set up yet.
|
|
*/
|
|
static u32 __init olpc_dt_get_board_revision(void)
|
|
{
|
|
phandle node;
|
|
__be32 rev;
|
|
int r;
|
|
|
|
node = olpc_dt_finddevice("/");
|
|
if (!node)
|
|
return 0;
|
|
|
|
r = olpc_dt_getproperty(node, "board-revision-int",
|
|
(char *) &rev, sizeof(rev));
|
|
if (r < 0)
|
|
return 0;
|
|
|
|
return be32_to_cpu(rev);
|
|
}
|
|
|
|
static int __init olpc_dt_compatible_match(phandle node, const char *compat)
|
|
{
|
|
char buf[64], *p;
|
|
int plen, len;
|
|
|
|
plen = olpc_dt_getproperty(node, "compatible", buf, sizeof(buf));
|
|
if (plen <= 0)
|
|
return 0;
|
|
|
|
len = strlen(compat);
|
|
for (p = buf; p < buf + plen; p += strlen(p) + 1) {
|
|
if (strcmp(p, compat) == 0)
|
|
return 1;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
void __init olpc_dt_fixup(void)
|
|
{
|
|
phandle node;
|
|
u32 board_rev;
|
|
|
|
node = olpc_dt_finddevice("/battery@0");
|
|
if (!node)
|
|
return;
|
|
|
|
board_rev = olpc_dt_get_board_revision();
|
|
if (!board_rev)
|
|
return;
|
|
|
|
if (board_rev >= olpc_board_pre(0xd0)) {
|
|
/* XO-1.5 */
|
|
|
|
if (olpc_dt_compatible_match(node, "olpc,xo1.5-battery"))
|
|
return;
|
|
|
|
/* Add olpc,xo1.5-battery compatible marker to battery node */
|
|
olpc_dt_interpret("\" /battery@0\" find-device");
|
|
olpc_dt_interpret(" \" olpc,xo1.5-battery\" +compatible");
|
|
olpc_dt_interpret("device-end");
|
|
|
|
if (olpc_dt_compatible_match(node, "olpc,xo1-battery")) {
|
|
/*
|
|
* If we have a olpc,xo1-battery compatible, then we're
|
|
* running a new enough firmware that already has
|
|
* the dcon node.
|
|
*/
|
|
return;
|
|
}
|
|
|
|
/* Add dcon device */
|
|
olpc_dt_interpret("\" /pci/display@1\" find-device");
|
|
olpc_dt_interpret(" new-device");
|
|
olpc_dt_interpret(" \" dcon\" device-name");
|
|
olpc_dt_interpret(" \" olpc,xo1-dcon\" +compatible");
|
|
olpc_dt_interpret(" finish-device");
|
|
olpc_dt_interpret("device-end");
|
|
} else {
|
|
/* XO-1 */
|
|
|
|
if (olpc_dt_compatible_match(node, "olpc,xo1-battery")) {
|
|
/*
|
|
* If we have a olpc,xo1-battery compatible, then we're
|
|
* running a new enough firmware that already has
|
|
* the dcon and RTC nodes.
|
|
*/
|
|
return;
|
|
}
|
|
|
|
/* Add dcon device, mark RTC as olpc,xo1-rtc */
|
|
olpc_dt_interpret("\" /pci/display@1,1\" find-device");
|
|
olpc_dt_interpret(" new-device");
|
|
olpc_dt_interpret(" \" dcon\" device-name");
|
|
olpc_dt_interpret(" \" olpc,xo1-dcon\" +compatible");
|
|
olpc_dt_interpret(" finish-device");
|
|
olpc_dt_interpret("device-end");
|
|
|
|
olpc_dt_interpret("\" /rtc\" find-device");
|
|
olpc_dt_interpret(" \" olpc,xo1-rtc\" +compatible");
|
|
olpc_dt_interpret("device-end");
|
|
}
|
|
|
|
/* Add olpc,xo1-battery compatible marker to battery node */
|
|
olpc_dt_interpret("\" /battery@0\" find-device");
|
|
olpc_dt_interpret(" \" olpc,xo1-battery\" +compatible");
|
|
olpc_dt_interpret("device-end");
|
|
}
|
|
|
|
void __init olpc_dt_build_devicetree(void)
|
|
{
|
|
phandle root;
|
|
|
|
if (!olpc_ofw_is_installed())
|
|
return;
|
|
|
|
olpc_dt_fixup();
|
|
|
|
root = olpc_dt_getsibling(0);
|
|
if (!root) {
|
|
pr_err("PROM: unable to get root node from OFW!\n");
|
|
return;
|
|
}
|
|
of_pdt_build_devicetree(root, &prom_olpc_ops);
|
|
|
|
pr_info("PROM DT: Built device tree with %u bytes of memory.\n",
|
|
prom_early_allocated);
|
|
}
|