From nobody Fri Jun 19 08:29:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1772C433FE for ; Wed, 6 Apr 2022 02:32:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1848873AbiDFCa6 (ORCPT ); Tue, 5 Apr 2022 22:30:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1387733AbiDEVvU (ORCPT ); Tue, 5 Apr 2022 17:51:20 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3A069D07B; Tue, 5 Apr 2022 14:08:03 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id c23so253205plo.0; Tue, 05 Apr 2022 14:08:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=v4P43Rlgh7lp3dK9b+CJw9yfXarFDQYYvfeGV1gD3+w=; b=VkFq7Q4P0VGmu8j8cSFfCxdujs/azHKmlZgnXZhYehJTQEo+JjpFPlm7Utpt8o8ztB LiiyI+pf9sk7VUdHRVC6q85jMEYbWzMxQRe96Up1Dz7eDEBSa+Kn3+p4HS774DIOZcll DbyrE4EpCiB7wJF4GGyaiceSXkktFr1hdRm30kx3URX7FBoUX8+TvGXN93aJSTz+LsXt gvqLUD/St1ElLhWmcyjI+9d+ZZLydKmoxOm16TUri4uviXINg7lQCvXgm+OQ/NRqPrI3 hYfgl6MITzpjre+tmJeXJJEQJ2wjH60KbCSwN0nqeD5DKj+oTISYnnCjqGbTPzIR9UFm LIZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=v4P43Rlgh7lp3dK9b+CJw9yfXarFDQYYvfeGV1gD3+w=; b=DijYSoa6RTBcIj6QPwa6qsNWRhYJGh2pgelQSpqR59QR7U5FpVvzswDfWbdYl8yL/X A+nTQNv6j5cJeW2tdODcD3TVh9msn4nx6JMZv8SNPMWs0QXI9px54vzVTRpjjonpGpOx yWQQrn/BV2MVM437sUwYomKfCW3oxmEMlCKD+Mr4h/syP+PEylLfedrdFJcVQL2LnUf/ i4wbRJZOu7NtTWRzjgG5HZKrvSlwvuOH5CUn4VpfoUtHlDoGW9rQ8dqzmKwdQHwO8xRI OWRNDURqgLeN709NQbibLDeVNo9oo6Jv+5k09o4M+yr1NXS515qCYSVVt1omxjl5E0Vo 5Ibg== X-Gm-Message-State: AOAM5330LJlZzPgG9h+wuKia64ByXW2Ftx4J8TvR7sPEVKS6Aje/O2pb x+wCCj8VkB1uqZlg0NWyMP4= X-Google-Smtp-Source: ABdhPJxYDCsEJ7bIjriQ/OhhT1U21JJYCTTy9aDkWmQOFWjJPOx/bnNNOg3v2fPea8QaKrMfPG7tgw== X-Received: by 2002:a17:902:c401:b0:154:3b8a:5e6e with SMTP id k1-20020a170902c40100b001543b8a5e6emr5307619plk.18.1649192883418; Tue, 05 Apr 2022 14:08:03 -0700 (PDT) Received: from jaschultz-Thelio-Major.corp.microsoft.com ([2001:4898:80e8:3:511c:41a7:57f7:f826]) by smtp.gmail.com with ESMTPSA id k22-20020aa788d6000000b004faaf897064sm16240010pff.106.2022.04.05.14.08.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 14:08:03 -0700 (PDT) From: Jarrett Schultz X-Google-Original-From: Jarrett Schultz To: Rob Herring , Andy Gross , Bjorn Andersson , Hans de Goede , Mark Gross , Maximilian Luz Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, platform-driver-x86@vger.kernel.org, Felipe Balbi , Jarrett Schultz Subject: [PATCH v5 1/4] dt-bindings: platform: microsoft: Document surface xbl Date: Tue, 5 Apr 2022 14:07:47 -0700 Message-Id: <20220405210750.619511-2-jaschultzMS@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220405210750.619511-1-jaschultzMS@gmail.com> References: <20220405210750.619511-1-jaschultzMS@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jarrett Schultz Introduce yaml for surface xbl driver. Signed-off-by: Jarrett Schultz --- Changed in v5: - Updated description - Added child node for imem - Simplified example --- Changes in v4: - Addressed small formatting changes - Removed unnecessary lines --- Changes in v3: - Updated description to only pertain to the hardware - Updated the required field to properly reflect the binding - Removed the first example - Fixed the size of the reg field in the second example --- Changes in v2: - Removed json-schema dependence - Elaborated on description of driver - Updated example --- .../platform/microsoft/surface-xbl.yaml | 70 +++++++++++++++++++ MAINTAINERS | 7 ++ 2 files changed, 77 insertions(+) create mode 100644 Documentation/devicetree/bindings/platform/microsoft/su= rface-xbl.yaml diff --git a/Documentation/devicetree/bindings/platform/microsoft/surface-x= bl.yaml b/Documentation/devicetree/bindings/platform/microsoft/surface-xbl.= yaml new file mode 100644 index 000000000000..648476670bbd --- /dev/null +++ b/Documentation/devicetree/bindings/platform/microsoft/surface-xbl.yaml @@ -0,0 +1,70 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/platform/microsoft/surface-xbl.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Surface Extensible Bootloader for Microsoft Surface Duo + +maintainers: + - Jarrett Schultz + +description: | + Defined to expose information that is used during production when + the device is in manufacturing mode. Some of the information included + in the imem section is - + * board_id + * battery_present + * hw_init_retries + * is_customer_mode + * is_act_mode + * pmic_reset_reason + * touch_fw_version + * ocp_error_location + +properties: + compatible: + const: simple-mfd + + reg: + maxItems: 1 + + child-node: + description: A description of the xbl space within imem + + type: object + + properties: + compatible:=20 + const: microsoft,sm8150-surface-duo-xbl + + reg: + maxItems: 1 + + required: + - compatible + - reg + +additionalProperties: false + +required: + - compatible + - reg + - ranges + - address-cells + - size-cells + +examples: + - | + imem@146bf000 { + compatible =3D "simple-mfd"; + reg =3D <0x146bf000 0x1000>; + ranges =3D <0x0 0x146bf000 0x1000>; + #address-cells =3D <1>; + #size-cells =3D <1>; + + xbl@a94 { + compatible =3D "microsoft,sm8150-surface-duo-xbl"; + reg =3D <0xa94 0x100>; + }; + }; diff --git a/MAINTAINERS b/MAINTAINERS index 13f9a84a617e..5d0ca2a98b57 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -12649,6 +12649,13 @@ F: Documentation/driver-api/surface_aggregator/cli= ents/dtx.rst F: drivers/platform/surface/surface_dtx.c F: include/uapi/linux/surface_aggregator/dtx.h =20 +MICROSOFT SURFACE DUO XBL DRIVER +M: Jarrett Schultz +L: linux-arm-msm@vger.kernel.org +L: platform-driver-x86@vger.kernel.org +S: Supported +F: Documentation/devicetree/bindings/platform/microsoft/surface-xbl.yaml + MICROSOFT SURFACE GPE LID SUPPORT DRIVER M: Maximilian Luz L: platform-driver-x86@vger.kernel.org --=20 2.25.1 From nobody Fri Jun 19 08:29:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11C0DC43219 for ; Wed, 6 Apr 2022 02:32:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1848930AbiDFCbW (ORCPT ); Tue, 5 Apr 2022 22:31:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1387312AbiDEVvF (ORCPT ); Tue, 5 Apr 2022 17:51:05 -0400 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 100409D07C; Tue, 5 Apr 2022 14:08:06 -0700 (PDT) Received: by mail-pf1-x42a.google.com with SMTP id b15so619532pfm.5; Tue, 05 Apr 2022 14:08:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vhp/aClFSu6zCTiB0ewICEwB0s2D+8VsIVOQhvNHlRA=; b=mOWwgBB0350BmzXtvSyQvA8l9YgwFUHQn5gbM/0B5LqwYoE8VT+N3uIvbyz2Fn2iTS 6XSP5sFolbBLaxiSyZf/h8c7VTI4EguYMXMWWul/Acb90RBcy4ctkt7CF2CTzmwNGgKi EcguIV7JcR3mlfVd9VqHGizXkEQNhCUN+JKnruCcTJ9VS4aT1TfRBa7QxUnX7vGZ1/nw SLPZ8JP01+MP0fxDoUIPhNLWRDD5RRkdeilIu7PUV7TwHMCZMcI1w7NljpuIG5vlWSK4 qkV5THrDEmVhQwRALI+EhoKM3QCjoB/77RkVU87OTzR/xGWh74Hg+mDAo/4DCRpfQaZl VDFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vhp/aClFSu6zCTiB0ewICEwB0s2D+8VsIVOQhvNHlRA=; b=spSuDRKUVobnElqw5+p1Ycukmme9Ed6UKh6JDSz+BeNet+bmWx9uCeo0AXO5N4+L+2 uzc9xFpfSQBhU3ZwU++d0o33988XavX1N1FxpYN8pYCRW/obQYBK/jO4p7EAuJxIl39I 7A1oBqPTE5163jP5gXSD2iD7dyOEL6DQjORoxE74UPib1+1R+ChbQfM9dDIQUFPnHfAY ZoNmvF9wYgT2w4QuHVy76WReExRKvKBa1rQ3PMoMa+jw1mkeNSmZfxkuE9a1qayZDyBY 27qH5g3a1+EN6GlHMZGpWAICPObI/Gk0oloUUowD11E4Enye3/mcnhaLTDzt9rT1Ty/o G45Q== X-Gm-Message-State: AOAM530LIIEIszakvWsJ6M+wMyrdwn1IJVDI6ooAiIhcFS/1AyWIlEPs Wx2Cs00gbFsYSBFILr/FlT8= X-Google-Smtp-Source: ABdhPJyc1u3Glw2U5e5peXjT0VycS6boZpqeGi4jG0Q7ZHHXW4cz+OwFeqpT6dUNN6hiWjj/ZR0PUg== X-Received: by 2002:a05:6a00:1341:b0:4fa:a3af:6ba3 with SMTP id k1-20020a056a00134100b004faa3af6ba3mr5403442pfu.51.1649192885504; Tue, 05 Apr 2022 14:08:05 -0700 (PDT) Received: from jaschultz-Thelio-Major.corp.microsoft.com ([2001:4898:80e8:3:511c:41a7:57f7:f826]) by smtp.gmail.com with ESMTPSA id k22-20020aa788d6000000b004faaf897064sm16240010pff.106.2022.04.05.14.08.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 14:08:05 -0700 (PDT) From: Jarrett Schultz X-Google-Original-From: Jarrett Schultz To: Rob Herring , Andy Gross , Bjorn Andersson , Hans de Goede , Mark Gross , Maximilian Luz Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, platform-driver-x86@vger.kernel.org, Felipe Balbi , Jarrett Schultz Subject: [PATCH v5 2/4] platform: surface: Add surface xbl Date: Tue, 5 Apr 2022 14:07:48 -0700 Message-Id: <20220405210750.619511-3-jaschultzMS@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220405210750.619511-1-jaschultzMS@gmail.com> References: <20220405210750.619511-1-jaschultzMS@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jarrett Schultz Introduce support for the Extensible Boot Loader driver found on the Surface Duo. Makes device information available to users via sysfs. Signed-off-by: Jarrett Schultz --- Changes in v4: - N/A --- Changes in v3: - Updated several descriptions in the yaml to be more descriptive - Renamed files to use an underscore instead of a dash --- Changes in v2: - Added types.h inclusion and removed unused inclusions - Minor updates to code and acronym style - Remove __packed attribute on driver struct - Use .dev_groups for sysfs - Added more in-depth description of driver in Kconfig - Changed target KernelVersion in sysfs documentation --- .../ABI/testing/sysfs-platform-surface-xbl | 79 ++++++++ MAINTAINERS | 2 + drivers/platform/surface/Kconfig | 12 ++ drivers/platform/surface/Makefile | 1 + drivers/platform/surface/surface_xbl.c | 186 ++++++++++++++++++ 5 files changed, 280 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-platform-surface-xbl create mode 100644 drivers/platform/surface/surface_xbl.c diff --git a/Documentation/ABI/testing/sysfs-platform-surface-xbl b/Documen= tation/ABI/testing/sysfs-platform-surface-xbl new file mode 100644 index 000000000000..505a662d8511 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-platform-surface-xbl @@ -0,0 +1,79 @@ +What: /sys/devices/platform/146bfa94.xbl/battery_present +Date: October 2021 +KernelVersion: 5.16 +Contact: jaschultz@microsoft.com +Description: + Read only. It returns whether the battery is present. Valid + values are: + 0 - battery absent + 1 - battery present + +What: /sys/devices/platform/146bfa94.xbl/board_id +Date: October 2021 +KernelVersion: 5.16 +Contact: jaschultz@microsoft.com +Description: + Read only. It returns a Microsoft specific board id. + +What: /sys/devices/platform/146bfa94.xbl/hw_init_retries +Date: October 2021 +KernelVersion: 5.16 +Contact: jaschultz@microsoft.com +Description: + Read only. It returns a Microsoft specific value related to the + retries attempted to properly initialize the battery charging + subsystem. + +What: /sys/devices/platform/146bfa94.xbl/is_act_mode +Date: October 2021 +KernelVersion: 5.16 +Contact: jaschultz@microsoft.com +Description: + Read only. It returns whether ACT mode is enabled. Valid values + are: + 0 - ACT disabled + 1 - ACT enabled + + ACT mode is used to run checks and put the device to shipmode + at factory. + +What: /sys/devices/platform/146bfa94.xbl/is_customer_mode +Date: October 2021 +KernelVersion: 5.16 +Contact: jaschultz@microsoft.com +Description: + + mode. Valid values are: + 0 - Not in manufacturing mode + 1 - In manufacturing mode + +What: /sys/devices/platform/146bfa94.xbl/ocp_error_location +Date: October 2021 +KernelVersion: 5.16 +Contact: jaschultz@microsoft.com +Description: + Read only. It returns 0 or the id of the power rail which has the + OCP error. Valid values are: + Bit(s) Meaning + 15 More than one OCP error occurred + 14-12 PMIC + 11-7 SMPS + 6-2 LDO + 1-0 BOB + +What: /sys/devices/platform/146bfa94.xbl/pmic_reset_reason +Date: October 2021 +KernelVersion: 5.16 +Contact: jaschultz@microsoft.com +Description: + Read only. It returns the reason for the reset. Valid values + are: + 0 - no reason lol + 9 - Battery driver triggered + +What: /sys/devices/platform/146bfa94.xbl/touch_fw_version +Date: October 2021 +KernelVersion: 5.16 +Contact: jaschultz@microsoft.com +Description: + Read only. It returns the version of the firmware. diff --git a/MAINTAINERS b/MAINTAINERS index 5d0ca2a98b57..e65eddf5d25d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -12654,7 +12654,9 @@ M: Jarrett Schultz L: linux-arm-msm@vger.kernel.org L: platform-driver-x86@vger.kernel.org S: Supported +F: Documentation/ABI/testing/sysfs-platform-surface-xbl F: Documentation/devicetree/bindings/platform/microsoft/surface-xbl.yaml +F: drivers/platform/surface/surface-xbl.c =20 MICROSOFT SURFACE GPE LID SUPPORT DRIVER M: Maximilian Luz diff --git a/drivers/platform/surface/Kconfig b/drivers/platform/surface/Kc= onfig index 5f0578e25f71..96d6030d8d49 100644 --- a/drivers/platform/surface/Kconfig +++ b/drivers/platform/surface/Kconfig @@ -185,6 +185,18 @@ config SURFACE_PRO3_BUTTON help This driver handles the power/home/volume buttons on the Microsoft Surf= ace Pro 3/4 tablet. =20 +config SURFACE_XBL + tristate "Surface XBL Driver" + depends on ARM64 || COMPILE_TEST + depends on OF + help + If you say 'Y' to this option, support will be included for the + Surface Extensible Boot Loader (XBL) Driver. This driver exposes + information about the device through sysfs. + + This driver can also be built as a module. If so, the module + will be called surface-xbl. + source "drivers/platform/surface/aggregator/Kconfig" =20 endif # SURFACE_PLATFORMS diff --git a/drivers/platform/surface/Makefile b/drivers/platform/surface/M= akefile index 32889482de55..eef05d247f75 100644 --- a/drivers/platform/surface/Makefile +++ b/drivers/platform/surface/Makefile @@ -16,3 +16,4 @@ obj-$(CONFIG_SURFACE_GPE) +=3D surface_gpe.o obj-$(CONFIG_SURFACE_HOTPLUG) +=3D surface_hotplug.o obj-$(CONFIG_SURFACE_PLATFORM_PROFILE) +=3D surface_platform_profile.o obj-$(CONFIG_SURFACE_PRO3_BUTTON) +=3D surfacepro3_button.o +obj-$(CONFIG_SURFACE_XBL) +=3D surface_xbl.o diff --git a/drivers/platform/surface/surface_xbl.c b/drivers/platform/surf= ace/surface_xbl.c new file mode 100644 index 000000000000..e6272b704526 --- /dev/null +++ b/drivers/platform/surface/surface_xbl.c @@ -0,0 +1,186 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Surface eXtensible Boot Loader (XBL) + * + * Copyright (C) 2021 Microsoft Corporation + * Author: Jarrett Schultz + */ + +#include +#include +#include +#include +#include + +#define SURFACE_XBL_MAX_VERSION_LEN 16 +#define SURFACE_XBL_BOARD_ID 0 +#define SURFACE_XBL_BATTERY_PRESENT 1 +#define SURFACE_XBL_HW_INIT_RETRIES 2 +#define SURFACE_XBL_IS_CUSTOMER_MODE 3 +#define SURFACE_XBL_IS_ACT_MODE 4 +#define SURFACE_XBL_PMIC_RESET_REASON 5 +#define SURFACE_XBL_TOUCH_FW_VERSION 6 +#define SURFACE_XBL_OCP_ERROR_LOCATION \ + (SURFACE_XBL_TOUCH_FW_VERSION + \ + SURFACE_XBL_MAX_VERSION_LEN) + +struct surface_xbl { + struct device *dev; + + u8 board_id; + u8 battery_present; + u8 hw_init_retries; + u8 is_customer_mode; + u8 is_act_mode; + u8 pmic_reset_reason; + char touch_fw_version[SURFACE_XBL_MAX_VERSION_LEN]; + u16 ocp_error_location; +}; + +static ssize_t +board_id_show(struct device *dev, struct device_attribute *attr, char *buf) +{ + struct surface_xbl *sxbl =3D dev_get_drvdata(dev); + + return sysfs_emit(buf, "%d\n", sxbl->board_id); +} +static DEVICE_ATTR_RO(board_id); + +static ssize_t +battery_present_show(struct device *dev, struct device_attribute *attr, ch= ar *buf) +{ + struct surface_xbl *sxbl =3D dev_get_drvdata(dev); + + return sysfs_emit(buf, "%d\n", sxbl->battery_present); +} +static DEVICE_ATTR_RO(battery_present); + +static ssize_t +hw_init_retries_show(struct device *dev, struct device_attribute *attr, ch= ar *buf) +{ + struct surface_xbl *sxbl =3D dev_get_drvdata(dev); + + return sysfs_emit(buf, "%d\n", sxbl->hw_init_retries); +} +static DEVICE_ATTR_RO(hw_init_retries); + +static ssize_t +is_customer_mode_show(struct device *dev, struct device_attribute *attr, c= har *buf) +{ + struct surface_xbl *sxbl =3D dev_get_drvdata(dev); + + return sysfs_emit(buf, "%d\n", sxbl->is_customer_mode); +} +static DEVICE_ATTR_RO(is_customer_mode); + +static ssize_t +is_act_mode_show(struct device *dev, struct device_attribute *attr, char *= buf) +{ + struct surface_xbl *sxbl =3D dev_get_drvdata(dev); + + return sysfs_emit(buf, "%d\n", sxbl->is_act_mode); +} +static DEVICE_ATTR_RO(is_act_mode); + +static ssize_t +pmic_reset_reason_show(struct device *dev, struct device_attribute *attr, = char *buf) +{ + struct surface_xbl *sxbl =3D dev_get_drvdata(dev); + + return sysfs_emit(buf, "%d\n", sxbl->pmic_reset_reason); +} +static DEVICE_ATTR_RO(pmic_reset_reason); + +static ssize_t +touch_fw_version_show(struct device *dev, struct device_attribute *attr, c= har *buf) +{ + struct surface_xbl *sxbl =3D dev_get_drvdata(dev); + + return sysfs_emit(buf, "0x%s\n", sxbl->touch_fw_version); +} +static DEVICE_ATTR_RO(touch_fw_version); + +static ssize_t +ocp_error_location_show(struct device *dev, struct device_attribute *attr,= char *buf) +{ + struct surface_xbl *sxbl =3D dev_get_drvdata(dev); + + return sysfs_emit(buf, "%d\n", sxbl->ocp_error_location); +} +static DEVICE_ATTR_RO(ocp_error_location); + +static struct attribute *xbl_attrs[] =3D { + &dev_attr_board_id.attr, + &dev_attr_battery_present.attr, + &dev_attr_hw_init_retries.attr, + &dev_attr_is_customer_mode.attr, + &dev_attr_is_act_mode.attr, + &dev_attr_pmic_reset_reason.attr, + &dev_attr_touch_fw_version.attr, + &dev_attr_ocp_error_location.attr, + NULL +}; + +static const struct attribute_group xbl_attr_group =3D { + .attrs =3D xbl_attrs, +}; + +const struct attribute_group *xbl_sysfs_groups[] =3D { + &xbl_attr_group, + NULL +}; + +static int surface_xbl_probe(struct platform_device *pdev) +{ + struct surface_xbl *sxbl; + void __iomem *regs; + int i; + + sxbl =3D devm_kzalloc(&pdev->dev, sizeof(*sxbl), GFP_KERNEL); + if (!sxbl) + return -ENOMEM; + + sxbl->dev =3D &pdev->dev; + + regs =3D devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(regs)) + return PTR_ERR(regs); + + platform_set_drvdata(pdev, sxbl); + + sxbl->board_id =3D readb(regs + SURFACE_XBL_BOARD_ID); + sxbl->battery_present =3D readb(regs + SURFACE_XBL_BATTERY_PRESENT); + sxbl->hw_init_retries =3D readb(regs + SURFACE_XBL_HW_INIT_RETRIES); + sxbl->is_customer_mode =3D readb(regs + SURFACE_XBL_IS_CUSTOMER_MODE); + sxbl->is_act_mode =3D readb(regs + SURFACE_XBL_IS_ACT_MODE); + sxbl->pmic_reset_reason =3D readb(regs + SURFACE_XBL_PMIC_RESET_REASON); + + for (i =3D 0; i < SURFACE_XBL_MAX_VERSION_LEN; i++) + sxbl->touch_fw_version[i] =3D readb(regs + SURFACE_XBL_TOUCH_FW_VERSION = + i); + + sxbl->ocp_error_location =3D readb(regs + SURFACE_XBL_OCP_ERROR_LOCATION); + + return 0; +} + +static const struct of_device_id surface_xbl_of_match[] =3D { + { + .compatible =3D "microsoft,sm8150-surface-duo-xbl" + }, + { } +}; +MODULE_DEVICE_TABLE(of, surface_xbl_of_match); + +static struct platform_driver surface_xbl_driver =3D { + .driver =3D { + .name =3D "surface-xbl", + .of_match_table =3D surface_xbl_of_match, + .dev_groups =3D xbl_sysfs_groups + }, + .probe =3D surface_xbl_probe, +}; +module_platform_driver(surface_xbl_driver); + +MODULE_AUTHOR("Jarrett Schultz "); +MODULE_DESCRIPTION("Surface Extensible Bootloader"); +MODULE_LICENSE("GPL"); --=20 2.25.1 From nobody Fri Jun 19 08:29:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D574AC43219 for ; Wed, 6 Apr 2022 02:39:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1849495AbiDFCie (ORCPT ); Tue, 5 Apr 2022 22:38:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443223AbiDEWUP (ORCPT ); Tue, 5 Apr 2022 18:20:15 -0400 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D40AD9D07E; Tue, 5 Apr 2022 14:08:07 -0700 (PDT) Received: by mail-pl1-x62c.google.com with SMTP id j8so188061pll.11; Tue, 05 Apr 2022 14:08:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xQC5STMzw4TlY0FvT781KJXZa9jGBgzdgcysSv7pHIg=; b=hN5MBQWe16GY2+eRacLZyP2J2G0/eXm5i+hVYboOw4O/CEnwwh2Zrl0ANobFYmh9/A ylomaVTByFYvxkOwqktbrgMXfKNwYX9ClMbdnFJrv535F6dK24mR5xRaBv6cdIy+TKWh bsNgBOuGGBU71IKS+vKdWczk7a8eBukXDor7eFDBS0SfxicbTr7q0MeUZGKnCM5W5Rs2 yR7lvR2F/+jFXYzMC7oOOLbCJFQ0cHXcLnUqC1guZ5YnEcYc+r8DzGAB4DN+Zs3Jhpfg E90b0QFByO64SiIBTAk4OFUpL3l048rh4MV7OYFt7M5BMKOGWVRPRR7DvntMynd52uoP Mjwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xQC5STMzw4TlY0FvT781KJXZa9jGBgzdgcysSv7pHIg=; b=xm8wzok6Q3eFh2l9pBP5PpU4Gxnf42ThhTTffRSgbbnPEhjNbqkO4LYLbrKS+nHodM CWgbVE2uwO43xP0ZSju+Ci4VNIaJ/UZMZNC1asWCP00DJY14fU10rBU9nnsumQVhfXn2 OKJEIEv5SkTLBOp6NH/r5DfHlYBgr0XKrWs38gmu1WFD9w6piNbpTiOGViXqRX1oFv4B Z7FPItXjOKAZMg9NXZZTPKtTDnEPVAFawuVPe9ttW1BpbuN8DTyPnyS59FihVv6YPrLl qKjauZS7FF5MDzZdiriXYYLl71e+ruJggc7LF1dsgDKLsdM2ras8h8bugawnf8POuBEx kxtA== X-Gm-Message-State: AOAM533oM9aWRjozIZZfT1slvX0pimGwWPRJfl34RK3cUOw4DVjgNuic OAiY66zpLsC1Xms53nPw+WU= X-Google-Smtp-Source: ABdhPJy+2z/KOYY0vUQdalMA0BMC2rvgh2I4/uuGeF3/G929X6STDhElWLJEl6HJgPRI8UNAIdn10w== X-Received: by 2002:a17:902:f0cb:b0:156:9c51:ca4 with SMTP id v11-20020a170902f0cb00b001569c510ca4mr5294481pla.93.1649192887386; Tue, 05 Apr 2022 14:08:07 -0700 (PDT) Received: from jaschultz-Thelio-Major.corp.microsoft.com ([2001:4898:80e8:3:511c:41a7:57f7:f826]) by smtp.gmail.com with ESMTPSA id k22-20020aa788d6000000b004faaf897064sm16240010pff.106.2022.04.05.14.08.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 14:08:06 -0700 (PDT) From: Jarrett Schultz X-Google-Original-From: Jarrett Schultz To: Rob Herring , Andy Gross , Bjorn Andersson , Hans de Goede , Mark Gross , Maximilian Luz Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, platform-driver-x86@vger.kernel.org, Felipe Balbi , Jarrett Schultz Subject: [PATCH v5 3/4] arm64: dts: qcom: sm8150: Add imem section Date: Tue, 5 Apr 2022 14:07:49 -0700 Message-Id: <20220405210750.619511-4-jaschultzMS@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220405210750.619511-1-jaschultzMS@gmail.com> References: <20220405210750.619511-1-jaschultzMS@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jarrett Schultz Introduce the imem section in preparation for the surface xbl driver. Signed-off-by: Jarrett Schultz Reviewed-by: Bjorn Andersson --- Changes in v4: - N/A --- Changes in v3: - N/A --- Changes in v2: - Created to properly reference the xbl section inside of imem --- arch/arm64/boot/dts/qcom/sm8150.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/sm8150.dtsi b/arch/arm64/boot/dts/qco= m/sm8150.dtsi index 81b4ff2cc4cd..bcfcb7306cdc 100644 --- a/arch/arm64/boot/dts/qcom/sm8150.dtsi +++ b/arch/arm64/boot/dts/qcom/sm8150.dtsi @@ -1175,6 +1175,14 @@ gpi_dma1: dma-controller@a00000 { status =3D "disabled"; }; =20 + imem: imem@146bf000 { + compatible =3D "simple-mfd"; + reg =3D <0x0 0x146bf000 0x0 0x1000>; + ranges =3D <0x0 0x0 0x146bf000 0x1000>; + #address-cells =3D <1>; + #size-cells =3D <1>; + }; + qupv3_id_1: geniqup@ac0000 { compatible =3D "qcom,geni-se-qup"; reg =3D <0x0 0x00ac0000 0x0 0x6000>; --=20 2.25.1 From nobody Fri Jun 19 08:29:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0EB7C433FE for ; Wed, 6 Apr 2022 02:39:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1849468AbiDFCiY (ORCPT ); Tue, 5 Apr 2022 22:38:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443250AbiDEWUP (ORCPT ); Tue, 5 Apr 2022 18:20:15 -0400 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4CE69D0CF; Tue, 5 Apr 2022 14:08:09 -0700 (PDT) Received: by mail-pl1-x630.google.com with SMTP id m16so219376plx.3; Tue, 05 Apr 2022 14:08:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AtngP8d0g0fi2Zi2weqgSY60agKP0OsKMyjizujaa74=; b=LfOLR30Fdj30wr86t2iIVLaxJGwMJ0KBcQXZVtJQZJIuAQ8Dh19WNThfA4VM3e8Ytn HHI932K10nMfwMEC5pKGCcpXIbQhoUUAeZ7kM/ocyYGDjfbhlE2kxs05NXewD7bjvSsR D9hynn+MGRET238VbNLuq5BVeHdbUYOLyGte5DmT7aV8U+9np6LwuSt1YIFplqtQIDNX i15w/TKzB5a5wKj1Di5WJubjB+JtFjMJhMhOOwEu+WTcWongNq1z3vcf0po9kZgSsfMB PbABfib6Q9EU0H6CBfKw8JXF7f4veBaMVUKg5ETkjyUsmsFXWYeuNPYdBjjYco5gVtXr jc3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AtngP8d0g0fi2Zi2weqgSY60agKP0OsKMyjizujaa74=; b=sUnoq488stvnst/Exqho95ARNyfY9OsotaCO/44ivdLuC26cW+x9D4xYm1ySM/xBWc C5fIOY5e4N1+3uJ/ztJ6NNhcs4MZGazk2bkHcI/ukK69PSIfoPxAUjzNjZY7zLwH4/Cp tnYHtFc2BkBsdszHMlz9twZDNNHmeBtSfdDVJ8nZ1aKlJrcuOZOUPaeIovPjXzw5JwiN IO22PzYwKulFG29my3jxqhO/zOQyT3gOvLjp7IAGF79tEZuQNkNbplqoHh79LzxoAuR+ g7bb+D4DoSGwa0v0NiaXzGzLliwXfltmJz7ysuUBQACJsTdNVXSd1xwzZnyYU2j6SdhT bpMA== X-Gm-Message-State: AOAM531B8QY/HvXECu87ZVDJIyo/qJyPUgJu0xNhHGVvCBRi+n+29Gmw PMJ9v9+iX29RZSG8iKYjkN8= X-Google-Smtp-Source: ABdhPJyxCwrKvkUu9M6Duz48XTcvyzgBHvz1hsRU6NdhZWIFqFIcpUkk9QddmT8Sm1NZVtSH0iPIyw== X-Received: by 2002:a17:90b:1bc6:b0:1c7:f32:3aa0 with SMTP id oa6-20020a17090b1bc600b001c70f323aa0mr6336718pjb.168.1649192889310; Tue, 05 Apr 2022 14:08:09 -0700 (PDT) Received: from jaschultz-Thelio-Major.corp.microsoft.com ([2001:4898:80e8:3:511c:41a7:57f7:f826]) by smtp.gmail.com with ESMTPSA id k22-20020aa788d6000000b004faaf897064sm16240010pff.106.2022.04.05.14.08.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 14:08:08 -0700 (PDT) From: Jarrett Schultz X-Google-Original-From: Jarrett Schultz To: Rob Herring , Andy Gross , Bjorn Andersson , Hans de Goede , Mark Gross , Maximilian Luz Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, platform-driver-x86@vger.kernel.org, Felipe Balbi , Jarrett Schultz Subject: [PATCH v5 4/4] arm64: dts: qcom: surface-duo: Add surface xbl Date: Tue, 5 Apr 2022 14:07:50 -0700 Message-Id: <20220405210750.619511-5-jaschultzMS@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220405210750.619511-1-jaschultzMS@gmail.com> References: <20220405210750.619511-1-jaschultzMS@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jarrett Schultz Introduce device tree source for the surface xbl driver. Signed-off-by: Jarrett Schultz --- Changes in v4: - N/A --- Changes in v3: - N/A --- Changes in v2: - Updated to reference an offset inside of imem --- .../boot/dts/qcom/sm8150-microsoft-surface-duo.dts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/sm8150-microsoft-surface-duo.dts b/ar= ch/arm64/boot/dts/qcom/sm8150-microsoft-surface-duo.dts index 5901c28e6696..abb7964daac4 100644 --- a/arch/arm64/boot/dts/qcom/sm8150-microsoft-surface-duo.dts +++ b/arch/arm64/boot/dts/qcom/sm8150-microsoft-surface-duo.dts @@ -430,6 +430,16 @@ &i2c19 { /* MAX34417 @ 0x1e */ }; =20 +&imem { + status =3D "okay"; + + xbl@a94 { + compatible =3D "microsoft,sm8150-surface-duo-xbl"; + reg =3D <0xa94 0x100>; + status =3D "okay"; + }; +}; + &pon { pwrkey { status =3D "okay"; --=20 2.25.1