From patchwork Thu Nov 9 10:05:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 163319 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp332491vqs; Thu, 9 Nov 2023 02:07:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IFPmuOoPkdAUdHJgabmJz3PrlB/aVEQHv5QyTqRlLj+Y+p0Bnl14hl7OgaKzkqiFv6mp1Hg X-Received: by 2002:a05:6a20:2584:b0:181:2526:93b5 with SMTP id k4-20020a056a20258400b00181252693b5mr11733205pzd.13.1699524452954; Thu, 09 Nov 2023 02:07:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699524452; cv=none; d=google.com; s=arc-20160816; b=hAbt93V7zFZEuswBYmJmKL6U+k7f0ROKky8Q1FQ8TsFYekD71F79WcobMYZQ8fYbCO 24cY46UKEpTU2zNDfq76SdVxMsf+nIiRZ6upUA863XlLhYtqIXuoLP1z6Cx4ArhMbbeQ /CoM8uZeYVFMTn6+hWzQrUlW07HF6chF3Ni/sVo2UiN1qsmB69CXBc1M4CiLbRwsu/mk G4Xt12abytBVd5UkPDdVViivcGMAlmDilXxU+Kkwrs/PLj9cKsiReAjpy6CAlRx/kfiL vh3CnBYj0zfwBFXry5GK2KxJ9FH5P8cwh4u9n4qpA8xx2husF/A6AKq4dgb2TsJfGSTA yTJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=DGm2vHynu/hBFToljMIoyOJ5nVIf243JSwQjqrxxy/0=; fh=9RjyB+hDNs618LdaNPm846thAWpv+UOF4Pqs3eQuhzI=; b=NtxQK8id214hl3hg5ZdEMpUhgm0ugI/fSQxH0pmYrELlzFVokyHLfWnvon/BsucsuB pcCFrhk68R2l/Gav9tstz3tBhpUKkT/zzcF8A71DTNOQt39x2ZlCoIGwVjlMZ0IOdZQu d02eaHzud+HpEXYeLTi7lbpy7oR67mtErkCrPAntSGDRuXpd06s28j8PbfMM0lFDLS72 twIW2D/nvZWNU/KmwqSOhpRxcHam4pXRMhdD7qiOyWpBOFPylfIplxyENcgF2W3u1R6Y BS1w+eTzrIDThkMDINwn7pzK/AVyzomDAYukO+XLU4EocsraTx8x3lxhUTriG6AklsCJ CrcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=RxQLjM2b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id cb8-20020a056a02070800b005bddee56e46si3779239pgb.470.2023.11.09.02.07.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 02:07:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=RxQLjM2b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 762D68221564; Thu, 9 Nov 2023 02:07:25 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232763AbjKIKGv (ORCPT + 32 others); Thu, 9 Nov 2023 05:06:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232670AbjKIKGr (ORCPT ); Thu, 9 Nov 2023 05:06:47 -0500 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 662202D70 for ; Thu, 9 Nov 2023 02:06:45 -0800 (PST) Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1cc30bf9e22so6354615ad.1 for ; Thu, 09 Nov 2023 02:06:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1699524405; x=1700129205; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DGm2vHynu/hBFToljMIoyOJ5nVIf243JSwQjqrxxy/0=; b=RxQLjM2bpQKhpTuVZYebaJEIhWTLLYFe2dDFIchDI28Yf0eDype1TS7wThG0GTEenH qlbre4oclTVVYs6pRFJZ2NZVUOLMadbJhxKxUTln0w8sak6nNsXVQZ1gKipnx0fun9E7 3+T8Fnpl1WI07B0G3Cylkf8Qs3GBiwsmN7Wz4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699524405; x=1700129205; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DGm2vHynu/hBFToljMIoyOJ5nVIf243JSwQjqrxxy/0=; b=q8/gCcyfN5idHJO2Rqp+m51LBgMLK/2vhfbVsU8ZvnNPA9QhaXOsctndBiKc68n3cw Kfbo4a/MX+Pi3sbfCpwWiUebnqERssTHMKaEZaNoi5wAlWJI5OhfRh2BSNY4X4rXezQP GsbxAyoaV7DIIqKPRIg0IkDT8ZboFcyu0AwgcZp1TgLOsAE5aHrNm4TeBpH5xUxmAce8 VALjxpkt4RnY4ucJWRgPOicOGrLIbIiMYBXFaPFP3nEGKSGiZdvx/IhfdtCEPa4CqYLV +bKHjZ6Cy0irT0gGrQuXjQcORHj1klkYGBoR16wHjKTmACRLrMN2gCS4IYAUWV4HCSbW kuDQ== X-Gm-Message-State: AOJu0Yzw61zbHmD6GiYRWjRp+QSFi9t2gkgjePAvxFRCB/QSgasS4+1k vvYXRtTjlrGhsHYEMKcR1pMkGA== X-Received: by 2002:a17:902:ec89:b0:1cc:436f:70c2 with SMTP id x9-20020a170902ec8900b001cc436f70c2mr7534166plg.9.1699524404876; Thu, 09 Nov 2023 02:06:44 -0800 (PST) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:6f57:d4c:468c:5daf]) by smtp.gmail.com with ESMTPSA id c13-20020a170902d48d00b001c60ba709b7sm3127511plg.125.2023.11.09.02.06.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 02:06:44 -0800 (PST) From: Chen-Yu Tsai To: Rob Herring , Frank Rowand , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno Cc: Hsin-Yi Wang , Dmitry Torokhov , andriy.shevchenko@linux.intel.com, Jiri Kosina , linus.walleij@linaro.org, broonie@kernel.org, gregkh@linuxfoundation.org, hdegoede@redhat.com, james.clark@arm.com, james@equiv.tech, keescook@chromium.org, petr.tesarik.ext@huawei.com, rafael@kernel.org, tglx@linutronix.de, Jeff LaBundy , linux-input@vger.kernel.org, Chen-Yu Tsai , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, Douglas Anderson , Johan Hovold Subject: [RFC PATCH v2 1/7] of: base: Add of_device_is_fail Date: Thu, 9 Nov 2023 18:05:58 +0800 Message-ID: <20231109100606.1245545-2-wenst@chromium.org> X-Mailer: git-send-email 2.42.0.869.gea05f2083d-goog In-Reply-To: <20231109100606.1245545-1-wenst@chromium.org> References: <20231109100606.1245545-1-wenst@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 09 Nov 2023 02:07:25 -0800 (PST) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782080552884299373 X-GMAIL-MSGID: 1782080552884299373 In some cases we want to check that a device is not only unavailable, but specifically marked as "fail". This will be used in a following change in the hardware prober driver. Signed-off-by: Chen-Yu Tsai --- drivers/of/base.c | 20 ++++++++++++++++++++ include/linux/of.h | 6 ++++++ 2 files changed, 26 insertions(+) diff --git a/drivers/of/base.c b/drivers/of/base.c index 8d93cb6ea9cd..2726e5dce1bf 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -486,6 +486,26 @@ static bool __of_device_is_fail(const struct device_node *device) return !strcmp(status, "fail") || !strncmp(status, "fail-", 5); } +/** + * of_device_is_fail - check if a device has status "fail" or "fail-..." + * + * @device: Node to check status for + * + * Return: True if the status property is set to "fail" or "fail-..." (for any + * error code suffix), false otherwise + */ +bool of_device_is_fail(const struct device_node *device) +{ + unsigned long flags; + bool res; + + raw_spin_lock_irqsave(&devtree_lock, flags); + res = __of_device_is_fail(device); + raw_spin_unlock_irqrestore(&devtree_lock, flags); + return res; +} +EXPORT_SYMBOL(of_device_is_fail); + /** * of_device_is_big_endian - check if a device has BE registers * diff --git a/include/linux/of.h b/include/linux/of.h index 6a9ddf20e79a..463fbf0072bd 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -350,6 +350,7 @@ extern int of_device_is_compatible(const struct device_node *device, extern int of_device_compatible_match(const struct device_node *device, const char *const *compat); extern bool of_device_is_available(const struct device_node *device); +extern bool of_device_is_fail(const struct device_node *device); extern bool of_device_is_big_endian(const struct device_node *device); extern const void *of_get_property(const struct device_node *node, const char *name, @@ -584,6 +585,11 @@ static inline bool of_device_is_available(const struct device_node *device) return false; } +static inline bool of_device_is_fail(const struct device_node *device) +{ + return false; +} + static inline bool of_device_is_big_endian(const struct device_node *device) { return false; From patchwork Thu Nov 9 10:05:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 163323 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp332859vqs; Thu, 9 Nov 2023 02:08:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IHJtKB0OzcdCpr88WERA8SM9peGPUMS9BPcukZSSr/JSJoom65cmAyJfxc/9Wo/ypXoPvpC X-Received: by 2002:a17:90b:3ec4:b0:281:20a0:dae3 with SMTP id rm4-20020a17090b3ec400b0028120a0dae3mr920553pjb.40.1699524503693; Thu, 09 Nov 2023 02:08:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699524503; cv=none; d=google.com; s=arc-20160816; b=zlASEDXHxhY/3NFNkclZcLCfh0MK6MjmYHkxy+KDv9dHVsWmJ2UDKTV7RhAgESFxrS nIOSYw185FVWpCtkauobGahZfU4kmwSZLcTV75ABGHtznzj9BZ0yLWdLdf3Eu/P6A9Q5 cuDrmgeZfnB4c/tTzGnyPJTgWfthIDYbcdbwatnNHfMy/AL6SNWJqQ+BxJHXGcKi0wcn Y2dRYTZGxkRddpnhCh0WdOHOPaQqyr6+WCCmJpZrpy24plZ8WPbS76/wd1VTddUUoy1e Z3WeIMmJiGerXopeHvvG/9xjjIa/j0yn44h7SBUxFWiOrRKj+X+IjOdBWLRSrK2ZeCgC OZ9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=t5ye6xQE9knRoa1If0NJpRXCWT7E3YY80pCdkZR9RUU=; fh=9RjyB+hDNs618LdaNPm846thAWpv+UOF4Pqs3eQuhzI=; b=eygkfS8jfhJhQG3ZK1Wo3AFGlxi1YL6b2TXwc4TN/MR/LB/lMOvecF46/mqbaA6oCr kOUoz1vYlR9FBcdiXjygHxT4bGmE0QPZ1iRYxQ3fcQZ+g3mw45sac9NCXuwC0dhNvFQV K/eS/OzAfpmtLaIIlwFhVtpczZX4wz8/XQx7rIGKwzfF+4j3BAqmqDN6v9zhke8igpth tWIJI6AzNT1NSQYV+0Jm830ZPgiZyVSZJX5BzqDowXyOzl/pdli15PYTpI2UqhFgEZtC NiLBeUrqP3w2TjiZ+KVdjyiuTSTDRrj+72gxfs9g+t6zmz0cTfUOylvbjUPwK6hqcm5h xqTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=hZBMy4UD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id il7-20020a17090b164700b002805a422743si1430211pjb.12.2023.11.09.02.08.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 02:08:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=hZBMy4UD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 68AE5838912F; Thu, 9 Nov 2023 02:08:08 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233305AbjKIKHG (ORCPT + 32 others); Thu, 9 Nov 2023 05:07:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232741AbjKIKG5 (ORCPT ); Thu, 9 Nov 2023 05:06:57 -0500 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BC032D76 for ; Thu, 9 Nov 2023 02:06:50 -0800 (PST) Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-5bdc185c449so544923a12.0 for ; Thu, 09 Nov 2023 02:06:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1699524410; x=1700129210; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=t5ye6xQE9knRoa1If0NJpRXCWT7E3YY80pCdkZR9RUU=; b=hZBMy4UDuygUobGSPbCJdhb96NSnsSTjP2nF6QnsG8V12c3KKo1pIJGq9xtZ7CzMzY sphs0p80O7vxqDIuBLcl+hRtdFJL03cgV2gegaHWB213UJhwgOSwZaUZi1lFIzORVff0 QZyTC2jQNVjSP1hJ5OG/14Q6vcmTeKlec3gqc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699524410; x=1700129210; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=t5ye6xQE9knRoa1If0NJpRXCWT7E3YY80pCdkZR9RUU=; b=o/Z3Av/unfTUzBv/EXwSIhU2ck4pF1CbWc8iGD/Tnc23y9y1u/EnbautJgmEsGUMoj Q7n5baLdRKHNT82IP20xs1lapHF+5zW19DknT+fymZhq/tkkfcf80RTJVZBthgf0kC5x xXp/ErQgkAPNzV7kwb2lVr09y5L9Ygb+KFSvitIcKrE1L8dJJ45j57GgXjaaA7Wm6iYS f9PgyBJ+eooL3HWnLRP35ZTlCkxssQGwHi8cc81+QyQkT1LcTHOi550QHt23HG4Uf2QA 7Vku+knwk+Q/pVXWwlEkigHh3s3rBIaAfvLHAnfUTzQ/1KkWXDmd9RNBPTNhpV3QSjuJ HIxw== X-Gm-Message-State: AOJu0Yy3Lcgw0poXg+dHNkDxPnaABPuvWny0JTYlcC0kpD2TZjqVCKk3 TxgNGcEnHfcrGMIMIEv4ixWn9w== X-Received: by 2002:a17:902:8c83:b0:1cc:2c45:757a with SMTP id t3-20020a1709028c8300b001cc2c45757amr4475248plo.10.1699524409702; Thu, 09 Nov 2023 02:06:49 -0800 (PST) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:6f57:d4c:468c:5daf]) by smtp.gmail.com with ESMTPSA id c13-20020a170902d48d00b001c60ba709b7sm3127511plg.125.2023.11.09.02.06.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 02:06:49 -0800 (PST) From: Chen-Yu Tsai To: Rob Herring , Frank Rowand , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno Cc: Hsin-Yi Wang , Dmitry Torokhov , andriy.shevchenko@linux.intel.com, Jiri Kosina , linus.walleij@linaro.org, broonie@kernel.org, gregkh@linuxfoundation.org, hdegoede@redhat.com, james.clark@arm.com, james@equiv.tech, keescook@chromium.org, petr.tesarik.ext@huawei.com, rafael@kernel.org, tglx@linutronix.de, Jeff LaBundy , linux-input@vger.kernel.org, Chen-Yu Tsai , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, Douglas Anderson , Johan Hovold Subject: [RFC PATCH v2 2/7] of: Introduce hardware prober driver Date: Thu, 9 Nov 2023 18:05:59 +0800 Message-ID: <20231109100606.1245545-3-wenst@chromium.org> X-Mailer: git-send-email 2.42.0.869.gea05f2083d-goog In-Reply-To: <20231109100606.1245545-1-wenst@chromium.org> References: <20231109100606.1245545-1-wenst@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Thu, 09 Nov 2023 02:08:08 -0800 (PST) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782080605869416337 X-GMAIL-MSGID: 1782080605869416337 Some devices are designed and manufactured with some components having multiple drop-in replacement options. These components are often connected to the mainboard via ribbon cables, having the same signals and pin assignments across all options. These may include the display panel and touchscreen on laptops and tablets, and the trackpad on laptops. Sometimes which component option is used in a particular device can be detected by some firmware provided identifier, other times that information is not available, and the kernel has to try to probe each device. This change attempts to make the "probe each device" case cleaner. The current approach is to have all options added and enabled in the device tree. The kernel would then bind each device and run each driver's probe function. This works, but has been broken before due to the introduction of asynchronous probing, causing multiple instances requesting "shared" resources, such as pinmuxes, GPIO pins, interrupt lines, at the same time, with only one instance succeeding. Work arounds for these include moving the pinmux to the parent I2C controller, using GPIO hogs or pinmux settings to keep the GPIO pins in some fixed configuration, and requesting the interrupt line very late. Such configurations can be seen on the MT8183 Krane Chromebook tablets, and the Qualcomm sc8280xp-based Lenovo Thinkpad 13S. Instead of this delicate dance between drivers and device tree quirks, this change introduces a simple I2C component prober. For any given class of devices on the same I2C bus, it will go through all of them, doing a simple I2C read transfer and see which one of them responds. It will then enable the device that responds. This requires some minor modifications in the existing device tree. The status for all the device nodes for the component options must be set to "failed-needs-probe-xxx". This makes it clear that some mechanism is needed to enable one of them, and also prevents the prober and device drivers running at the same time. Signed-off-by: Chen-Yu Tsai --- drivers/of/Kconfig | 13 ++++ drivers/of/Makefile | 1 + drivers/of/hw_prober.c | 154 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 168 insertions(+) create mode 100644 drivers/of/hw_prober.c diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig index da9826accb1b..269d20d51936 100644 --- a/drivers/of/Kconfig +++ b/drivers/of/Kconfig @@ -102,4 +102,17 @@ config OF_OVERLAY config OF_NUMA bool +config HW_PROBER + bool "Hardware Prober driver" + select I2C + select OF_DYNAMIC + help + Some devices will have multiple drop-in options for one component. + In many cases the different options are indistinguishable by the + kernel without actually probing each possible option. + + This driver is meant to handle the probing of such components, and + update the running device tree such that the correct variant is + made available. + endif # OF diff --git a/drivers/of/Makefile b/drivers/of/Makefile index eff624854575..ed3875cdc554 100644 --- a/drivers/of/Makefile +++ b/drivers/of/Makefile @@ -12,6 +12,7 @@ obj-$(CONFIG_OF_RESERVED_MEM) += of_reserved_mem.o obj-$(CONFIG_OF_RESOLVE) += resolver.o obj-$(CONFIG_OF_OVERLAY) += overlay.o obj-$(CONFIG_OF_NUMA) += of_numa.o +obj-$(CONFIG_HW_PROBER) += hw_prober.o ifdef CONFIG_KEXEC_FILE ifdef CONFIG_OF_FLATTREE diff --git a/drivers/of/hw_prober.c b/drivers/of/hw_prober.c new file mode 100644 index 000000000000..442da6eff896 --- /dev/null +++ b/drivers/of/hw_prober.c @@ -0,0 +1,154 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * hw_prober.c - Hardware prober driver + * + * Copyright (c) 2023 Google LLC + */ + +#include +#include +#include +#include + +#define DRV_NAME "hw_prober" + +/** + * struct hw_prober_entry - Holds an entry for the hardware prober + * + * @compatible: compatible string to match against the machine + * @prober: prober function to call when machine matches + * @data: extra data for the prober function + */ +struct hw_prober_entry { + const char *compatible; + int (*prober)(struct platform_device *pdev, const void *data); + const void *data; +}; + +/* + * Some devices, such as Google Hana Chromebooks, are produced by multiple + * vendors each using their preferred components. This prober assumes such + * drop-in parts are on dedicated I2C busses, have non-conflicting addresses, + * and can be directly probed by seeing which address responds without needing + * regulators or GPIOs being enabled or toggled. + */ +static int i2c_component_prober(struct platform_device *pdev, const void *data) +{ + const char *node_name = data; + struct device_node *node, *i2c_node; + struct i2c_adapter *i2c; + int ret = 0; + + node = of_find_node_by_name(NULL, node_name); + if (!node) + return dev_err_probe(&pdev->dev, -ENODEV, "Could not find %s device node\n", + node_name); + + i2c_node = of_get_next_parent(node); + if (strcmp(i2c_node->name, "i2c")) { + of_node_put(i2c_node); + return dev_err_probe(&pdev->dev, -EINVAL, "%s device isn't on I2C bus\n", + node_name); + } + + for_each_child_of_node(i2c_node, node) { + if (!of_node_name_prefix(node, node_name)) + continue; + if (!of_device_is_fail(node)) { + /* device tree has component already enabled */ + of_node_put(node); + of_node_put(i2c_node); + return 0; + } + } + + i2c = of_get_i2c_adapter_by_node(i2c_node); + if (!i2c) { + of_node_put(i2c_node); + return dev_err_probe(&pdev->dev, -EPROBE_DEFER, "Couldn't get I2C adapter\n"); + } + + for_each_child_of_node(i2c_node, node) { + struct property *prop; + union i2c_smbus_data data; + u32 addr; + + if (!of_node_name_prefix(node, node_name)) + continue; + if (of_property_read_u32(node, "reg", &addr)) + continue; + if (i2c_smbus_xfer(i2c, addr, 0, I2C_SMBUS_READ, 0, I2C_SMBUS_BYTE, &data) < 0) + continue; + + dev_info(&pdev->dev, "Enabling %pOF\n", node); + + prop = kzalloc(sizeof(*prop), GFP_KERNEL); + if (!prop) { + ret = -ENOMEM; + of_node_put(node); + break; + } + + prop->name = "status"; + prop->length = 5; + prop->value = "okay"; + + /* Found a device that is responding */ + ret = of_update_property(node, prop); + if (ret) + kfree(prop); + + of_node_put(node); + break; + } + + i2c_put_adapter(i2c); + of_node_put(i2c_node); + + return ret; +} + +static const struct hw_prober_entry hw_prober_platforms[] = { + { .compatible = "google,hana", .prober = i2c_component_prober, .data = "touchscreen" }, + { .compatible = "google,hana", .prober = i2c_component_prober, .data = "trackpad" }, +}; + +static int hw_prober_probe(struct platform_device *pdev) +{ + for (int i = 0; i < ARRAY_SIZE(hw_prober_platforms); i++) + if (of_machine_is_compatible(hw_prober_platforms[i].compatible)) { + int ret; + + ret = hw_prober_platforms[i].prober(pdev, hw_prober_platforms[i].data); + if (ret) + return ret; + } + + return 0; +} + +static struct platform_driver hw_prober_driver = { + .probe = hw_prober_probe, + .driver = { + .name = DRV_NAME, + }, +}; + +static int __init hw_prober_driver_init(void) +{ + struct platform_device *pdev; + int ret; + + ret = platform_driver_register(&hw_prober_driver); + if (ret) + return ret; + + pdev = platform_device_register_simple(DRV_NAME, -1, NULL, 0); + if (!IS_ERR(pdev)) + return 0; + + platform_driver_unregister(&hw_prober_driver); + + return PTR_ERR(pdev); +} +device_initcall(hw_prober_driver_init); From patchwork Thu Nov 9 10:06:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 163320 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp332743vqs; Thu, 9 Nov 2023 02:08:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IGzwuboE8XXDswccBVV4D12vA3uBokQejK6EEtZUfK4MfCDLfLUi00kyOPLJicoG5hU7YrP X-Received: by 2002:a05:6358:52d2:b0:16b:406c:a005 with SMTP id z18-20020a05635852d200b0016b406ca005mr5648038rwz.28.1699524487523; Thu, 09 Nov 2023 02:08:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699524487; cv=none; d=google.com; s=arc-20160816; b=HrRiNzzGnRCZDKHlDUOAMMI980lxtCQDIVGJ7KGkQptOPUuMbLSUKapcnelgFsbhkH OLoac+Z0tNfQ7wMMAE4YtnpCxamfinPD6JWMmPehH3811S9UngBCbGPpgJ4GkPHcEJCN iedjCj5I5UjGUzW3yjwEVHjYs9pNHQquYaay2Flgxdjc39kF2rEWrUYAPzfR8FTu4SAz 4xRbuqas6MN1GKD+pNpPCUq8JeYeQJajWr5YF64ZaiBNFUXEWuegLs94kLeK/e1UVpE1 VGV7GkBJFLrbYom19CDVuI3VpLEiIrZMMvVbnyrObuC/BlyNUjYdoPipVv6kMVDpshCe Qj3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=WEwbem2dUlV4PdFvgxehEwFjO+wcgltSG0KbchvjnmI=; fh=9RjyB+hDNs618LdaNPm846thAWpv+UOF4Pqs3eQuhzI=; b=JNoAQ1TepSqzqLjP9w9eI4/231Fjxax+hESua8/+N94iDPtdsMAXHgnmKHhZbo0Fqd PmhlVRQxfVKaMHXMbA0OJC5DJ7c1/wU8Qv/5tmaRRfw/3Ccz18Pd2WzDAH9do03MiBq9 6+cBVllPeJGYI7JG3wM/Q0is30GESf/4TGNyRQtW2l+/CBYUmbBJnc18T0j/tUHs/7Qn VDoeuhc5SsZLAF2+6+40Y6nI37qrMSgXtuYp+U2bQusozgEQ9z0BbtiSjqpSZokVTkQK l9pmPMePIj+BCj16XBddwwKQPBg1HQ8rNLaTif0jHrZU5csuG98HWYqwBzAFN/oeHq1x Pyug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=nF9TanRc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id w38-20020a634926000000b005b16e351343si6573093pga.241.2023.11.09.02.08.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 02:08:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=nF9TanRc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 0E3FF833838F; Thu, 9 Nov 2023 02:07:53 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232896AbjKIKHJ (ORCPT + 32 others); Thu, 9 Nov 2023 05:07:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233262AbjKIKHB (ORCPT ); Thu, 9 Nov 2023 05:07:01 -0500 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A6D930EF for ; Thu, 9 Nov 2023 02:06:55 -0800 (PST) Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1cc9784dbc1so5852405ad.2 for ; Thu, 09 Nov 2023 02:06:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1699524414; x=1700129214; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WEwbem2dUlV4PdFvgxehEwFjO+wcgltSG0KbchvjnmI=; b=nF9TanRcchKTlQLg3f7JsPamKJ7EkQPrapPlnbCKQkXFHSN3WYwRpCCnknAI8uuxRO q6i2jnQlhVbNeisCkbxNRTINXdewdqNd9QRzTTH6EtjKqCTLYjr/ue5GUf+QtIx6YIBx VztaGn50hHTYZIE+jwaOQ+s15Ri5eTOeRw8v8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699524414; x=1700129214; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WEwbem2dUlV4PdFvgxehEwFjO+wcgltSG0KbchvjnmI=; b=F3iWzUDackiJNnxPlqczdOHpvcXsqNAZcBl7JO9MLZUJaujD3niQ2KL+fdkxQmIUxW Rtlh5xxnMI0SiIHqyCaYmdtBZlaPPFfN50sdu+rPigA5uemXXoE0FIQlKQCJC4KI533E DzNwre8Q3HbOwafiTM+or7N8pBeLRsLcQ7u9oBNih3BdqH3+5ifKDG4ZpoObVuGTsVx/ NaHWE7ZaRCsbAui3RHO2fl04YVDEOFazqH0CFfZPEMUJBCOGFlIINC1d3e3bEwhz5CiQ 7sL4Onu5bKRcAQw5vDmKB4BDRVSb9tmhB1Z4AHF+Zq/gynDn+K4NU/UZZ7vjHiYKaRBN JaGA== X-Gm-Message-State: AOJu0YyzQYe7NUBxRNbCSH+LQ9OY4g/wxT9/Kpz/tOUEzqMwZCpUynZt pbefsVf11xWGgk556gUNy2epHQ== X-Received: by 2002:a17:902:8603:b0:1c9:e229:f5e2 with SMTP id f3-20020a170902860300b001c9e229f5e2mr4402418plo.34.1699524414545; Thu, 09 Nov 2023 02:06:54 -0800 (PST) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:6f57:d4c:468c:5daf]) by smtp.gmail.com with ESMTPSA id c13-20020a170902d48d00b001c60ba709b7sm3127511plg.125.2023.11.09.02.06.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 02:06:54 -0800 (PST) From: Chen-Yu Tsai To: Rob Herring , Frank Rowand , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno Cc: Hsin-Yi Wang , Dmitry Torokhov , andriy.shevchenko@linux.intel.com, Jiri Kosina , linus.walleij@linaro.org, broonie@kernel.org, gregkh@linuxfoundation.org, hdegoede@redhat.com, james.clark@arm.com, james@equiv.tech, keescook@chromium.org, petr.tesarik.ext@huawei.com, rafael@kernel.org, tglx@linutronix.de, Jeff LaBundy , linux-input@vger.kernel.org, Chen-Yu Tsai , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, Douglas Anderson , Johan Hovold Subject: [RFC PATCH v2 3/7] arm64: dts: mediatek: mt8173-elm-hana: Mark touchscreens and trackpads as fail Date: Thu, 9 Nov 2023 18:06:00 +0800 Message-ID: <20231109100606.1245545-4-wenst@chromium.org> X-Mailer: git-send-email 2.42.0.869.gea05f2083d-goog In-Reply-To: <20231109100606.1245545-1-wenst@chromium.org> References: <20231109100606.1245545-1-wenst@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 09 Nov 2023 02:07:53 -0800 (PST) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782080589129991252 X-GMAIL-MSGID: 1782080589129991252 Instead of having them all available, mark them all as "fail-needs-probe-*" and have the implementation try to probe which one is present. Signed-off-by: Chen-Yu Tsai --- arch/arm64/boot/dts/mediatek/mt8173-elm-hana.dtsi | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/arm64/boot/dts/mediatek/mt8173-elm-hana.dtsi b/arch/arm64/boot/dts/mediatek/mt8173-elm-hana.dtsi index bdcd35cecad9..052109b0fa3b 100644 --- a/arch/arm64/boot/dts/mediatek/mt8173-elm-hana.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8173-elm-hana.dtsi @@ -15,6 +15,7 @@ touchscreen2: touchscreen@34 { reg = <0x34>; interrupt-parent = <&pio>; interrupts = <88 IRQ_TYPE_LEVEL_LOW>; + status = "fail-needs-probe-touchscreen"; }; /* @@ -28,6 +29,7 @@ touchscreen3: touchscreen@20 { hid-descr-addr = <0x0020>; interrupt-parent = <&pio>; interrupts = <88 IRQ_TYPE_LEVEL_LOW>; + status = "fail-needs-probe-touchscreen"; }; }; @@ -44,6 +46,7 @@ trackpad2: trackpad@2c { reg = <0x2c>; hid-descr-addr = <0x0020>; wakeup-source; + status = "fail-needs-probe-trackpad"; }; }; @@ -68,3 +71,11 @@ pins_wp { }; }; }; + +&touchscreen { + status = "fail-needs-probe-touchscreen"; +}; + +&trackpad { + status = "fail-needs-probe-trackpad"; +}; From patchwork Thu Nov 9 10:06:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 163322 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp332839vqs; Thu, 9 Nov 2023 02:08:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IGDcwATUjX4YSkCnzEZtQGwaKx7jXIv+10i8xBxi7a2ajDHwTCUgUot7qSBNC72ajPCxbfb X-Received: by 2002:a05:6358:7f19:b0:168:eaa2:a6c4 with SMTP id p25-20020a0563587f1900b00168eaa2a6c4mr4969212rwn.8.1699524501007; Thu, 09 Nov 2023 02:08:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699524500; cv=none; d=google.com; s=arc-20160816; b=dpx84MDnfQzcUPOpdwIijL8YdWn1v7l7HU/TSptx3TGIiDgPk9k/OJDkvXoM0+9G+M PyjIUdw52GPcPnNs/RYJLklqBWFC5fXKffGOF61L/ItNgyQ9EiQzY5Q5S2mLJtFJAu5e 989I2WLx3zETgbqBLjVDFJmzH4MbqJEJic6p3wCGBM0EHU3mWTgmovcnb45EciuGiuX6 DjeD5374HHlnyZ8zuHcxO5We33b7E8HZ8ccPtRzZ0rf8QKW9wZ8VZ3xSmB88j3Mx44Cz jvzJa25pP2w85HMHXPQfj2oIL5YFA9ilFhhYqQs6BGRMTiX5uXSvdtByesCqjIiincXb 0KxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=SXvBziOOzPoe9p06qPekw9ojRyDCzXj55skHWBeOemE=; fh=9RjyB+hDNs618LdaNPm846thAWpv+UOF4Pqs3eQuhzI=; b=JM0AEcJjbPU4XRWH37tZkS56KAAeZ3EliEW5yQ+QQE6+S6I7zQjKloPeGAtF8sDl4a QOEk+AyzF+Fy7yt0ahq5j3GIHAERYQPtXudOtNTog+Dw+cKQs8dX+sT0mCQzduZEmvsH Y0bzfx8Jbl0R7S+8K8owRZieOBloaOMQK8JAjuNzAyNEK83A7LW+EcT2ZIhL2VxIszYv deyvjL31RypNfLGGXLA7PmMhUY8ZbT6RuaZT/7c0oH2HatTDUJbZdfuKk9Ds0Ydj+biq coPSxyCJD09GSLAGPJBTHNu8BCgO90bnd3dXtyXONbH6MyjhwiQboPToSfYIySDOsajA nW7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ajmVrbMG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id bm12-20020a656e8c000000b00565eb0b2e66si8533063pgb.864.2023.11.09.02.08.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 02:08:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ajmVrbMG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id D305D8221570; Thu, 9 Nov 2023 02:08:18 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232822AbjKIKH0 (ORCPT + 32 others); Thu, 9 Nov 2023 05:07:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233594AbjKIKHD (ORCPT ); Thu, 9 Nov 2023 05:07:03 -0500 Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B350A30C0 for ; Thu, 9 Nov 2023 02:06:59 -0800 (PST) Received: by mail-pg1-x52b.google.com with SMTP id 41be03b00d2f7-53fa455cd94so534447a12.2 for ; Thu, 09 Nov 2023 02:06:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1699524419; x=1700129219; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SXvBziOOzPoe9p06qPekw9ojRyDCzXj55skHWBeOemE=; b=ajmVrbMGWgyVyN6sBJtEnLZk7H61ypCu7jyPZaS89xXqfP5U34t67op+dEhLmB3pAH 007llL49pH3ehzyG5i3/XhebxnJI7LYoNX1Byno1opPax8DsmQVHeHX/ck1UhdOAWcxd IwHUrN8sp6/H1F527JzVl795gW+6snJ6h9FQE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699524419; x=1700129219; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SXvBziOOzPoe9p06qPekw9ojRyDCzXj55skHWBeOemE=; b=vzuyw6DEZmpJhjFBc3SF617HijgovJS821LIJt0jeYkuIafCUPdmpZ+cUZhVRyYykb b3z2+GpL//m92jh9ndw2hH88DsSKb3s5LQI2KSi6syV+3Efv5o4KdS2RJWV44cO1O07U pf8xEDOZ+Ra737kyjOaw46/6miqZSqsnUBgZX5G8H+7oTDnV6uBNNUaIvnS69N2IaXMt aS7hBx8d2YYs1bGpTah5RwCu5/qw/Zahm0bWl8eEJHArOV+mwyo/wHLJmwfw7XMZqI11 hjL5e23RHEWR+zsM0pc1CT0SXB0BP4PRR2LzKvZi0pVAHHjDAI3vwlNYmxcI3F8OZp++ sGiw== X-Gm-Message-State: AOJu0YyxHNLchf1o8tmc27vL8dr62bp9AJa4ufzxMQZDDMTfKrI6l6jt Y8G/FZ8Szgbf1GAnP0uiBV9VIA== X-Received: by 2002:a17:903:234e:b0:1cc:50f6:7fcc with SMTP id c14-20020a170903234e00b001cc50f67fccmr5370038plh.55.1699524419209; Thu, 09 Nov 2023 02:06:59 -0800 (PST) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:6f57:d4c:468c:5daf]) by smtp.gmail.com with ESMTPSA id c13-20020a170902d48d00b001c60ba709b7sm3127511plg.125.2023.11.09.02.06.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 02:06:58 -0800 (PST) From: Chen-Yu Tsai To: Rob Herring , Frank Rowand , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno Cc: Hsin-Yi Wang , Dmitry Torokhov , andriy.shevchenko@linux.intel.com, Jiri Kosina , linus.walleij@linaro.org, broonie@kernel.org, gregkh@linuxfoundation.org, hdegoede@redhat.com, james.clark@arm.com, james@equiv.tech, keescook@chromium.org, petr.tesarik.ext@huawei.com, rafael@kernel.org, tglx@linutronix.de, Jeff LaBundy , linux-input@vger.kernel.org, Chen-Yu Tsai , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, Douglas Anderson , Johan Hovold Subject: [RFC PATCH v2 4/7] arm64: dts: mediatek: mt8173-elm-hana: Add G2touch G7500 touchscreen Date: Thu, 9 Nov 2023 18:06:01 +0800 Message-ID: <20231109100606.1245545-5-wenst@chromium.org> X-Mailer: git-send-email 2.42.0.869.gea05f2083d-goog In-Reply-To: <20231109100606.1245545-1-wenst@chromium.org> References: <20231109100606.1245545-1-wenst@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 09 Nov 2023 02:08:18 -0800 (PST) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782080602789894540 X-GMAIL-MSGID: 1782080602789894540 This introduces yet another second-source touchscreen found on Hana. This is a G2touch G7500 touchscreen, which is compatible with HID over I2C. Add a device node for it. In keeping with the new scheme for second source components, mark it as "failed-needs-probe-touchscreen". Signed-off-by: Chen-Yu Tsai --- arch/arm64/boot/dts/mediatek/mt8173-elm-hana.dtsi | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/arm64/boot/dts/mediatek/mt8173-elm-hana.dtsi b/arch/arm64/boot/dts/mediatek/mt8173-elm-hana.dtsi index 052109b0fa3b..d3f1277ac9b2 100644 --- a/arch/arm64/boot/dts/mediatek/mt8173-elm-hana.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8173-elm-hana.dtsi @@ -31,6 +31,15 @@ touchscreen3: touchscreen@20 { interrupts = <88 IRQ_TYPE_LEVEL_LOW>; status = "fail-needs-probe-touchscreen"; }; + + touchscreen4: touchscreen@40 { + compatible = "hid-over-i2c"; + reg = <0x40>; + hid-descr-addr = <0x0001>; + interrupt-parent = <&pio>; + interrupts = <88 IRQ_TYPE_LEVEL_LOW>; + status = "fail-needs-probe-touchscreen"; + }; }; &i2c4 { From patchwork Thu Nov 9 10:06:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 163321 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp332758vqs; Thu, 9 Nov 2023 02:08:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IFi7zfY+MckibgJteWzP1XzPjruye1xadJ62orFqOM0jGCASITe39EndYAyFXa7kNR4pHCZ X-Received: by 2002:a05:6a21:7189:b0:17b:e0a3:f6f4 with SMTP id wq9-20020a056a21718900b0017be0a3f6f4mr4845854pzb.25.1699524489061; Thu, 09 Nov 2023 02:08:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699524489; cv=none; d=google.com; s=arc-20160816; b=L/T4DqN8IdXs0xVPSNkyObdOFwVdhrM3RyuXRykUwfBSwaIl8vH131Ir7WRsRPCr0s l+TPBwbFxK/yJlziAcDRzn+1jt3KU0L5mWXmScmw99snu00gpFId8rQHulqIs1HC3Nc6 iaHOdeTD33Q6ziIC19i79VvJzS//cWzQo7o3QBUrJx50Y+ixNo75xm8Gzphw5NWUy+nH gX7BXXjz8Boz3N7OFjBZRegrdQRwdaV9YqX3NOhKMltX5ACRwKHx1XYU73gFgSmRDAJe 0pnUS5b02Aikk4QvuT1bKCucft6l9S3Gi2svYnhn8d32n0KtziExbZsZQk67AnELsmM+ Dsbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Rs4qbwNofKphTE2zreJeFqCc6xRNAsKGF5LoBHdl0a8=; fh=9RjyB+hDNs618LdaNPm846thAWpv+UOF4Pqs3eQuhzI=; b=jO/m9Im01867ZInfEOz1zc132mtLS8uhn9+rzfuz6llBCb8kJY8mD3mRZYhYLSc8Y9 LzIZQX6HagKF4H3oW7dDMd3QvUPgx5v/uPD36sgSdeo7XRlyarQuWbCG35kEe8zann1/ /pJD9qAqLHei5tJXhPKHelUIvkNtrfwpEVVZZ2d01GCyJ9Yb8CqngOiNTS6ujM4SA+/W iBtnlx1AWVYm3PPlBJHftRiITjjZ5qs5abWG8mzlWVbU9Yt5YgOImHJ7u4CVbotoMQw+ n/WsBaDVRzb3WF55yG3FoDUVX5s9jnYszEIyrwtK+FlcS2OssAZ/wGNZX6oeQS9dwtDT bITg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=HAkuhHb7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id ob18-20020a17090b391200b002775999122csi1448035pjb.141.2023.11.09.02.08.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 02:08:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=HAkuhHb7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 33BA18258997; Thu, 9 Nov 2023 02:08:00 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234334AbjKIKH3 (ORCPT + 32 others); Thu, 9 Nov 2023 05:07:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233290AbjKIKHG (ORCPT ); Thu, 9 Nov 2023 05:07:06 -0500 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 783CD30E1 for ; Thu, 9 Nov 2023 02:07:04 -0800 (PST) Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-5b856d73a12so566654a12.1 for ; Thu, 09 Nov 2023 02:07:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1699524424; x=1700129224; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Rs4qbwNofKphTE2zreJeFqCc6xRNAsKGF5LoBHdl0a8=; b=HAkuhHb7SzSz6OhGNf394Dui6jFOjbDVL3coBmNzq37xaektQl4rJtUPvTlaBeB42p q+As9HodIdDYp7KbqaNKRJTu1ASdCL5Fs1DdUMHs5q/gYAUtIuu2QVd5jVlYsoRlPPyL fpUw1CLXQhgPD3R7s6HFUjMFYsN+RuzDmDWk0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699524424; x=1700129224; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Rs4qbwNofKphTE2zreJeFqCc6xRNAsKGF5LoBHdl0a8=; b=wrLuduWSMbjbnZ5qsOQzOWsANM4tzrNDtVunWj7s3jm1hn/vlqrqWF+xgIyolI8urA SbeUK6rFjI2tM9BoykjrC3arEZWhb0kD120QMAPXj2USW4iI+ohp+m5fZ9db507Bmq2P Fkzr9XVj1w9kiICmCBsEgKs/uXTmvDFJwUYcTdLzup0onn0BdBQ0nLWxuETi6mbyqWWV YBNL340cLqM1Kmo1H9dIQidJm5bencB4ZIot/NG8pCmeZcGyTlDkYnv6FoL/1XiKk8TL bUSp161siLhtdJ+w0JUdbAgAKMMQ66CVaFg4p5VYENrMrrPuns5ColtHPdfRajOZNxLQ VQtg== X-Gm-Message-State: AOJu0YzpjaitFS+vj5FfL1Wxq3UbTZEHx5GlH3zXE2lcIdYxU60Yxx6C AtZzrvT5HXhINVe6pkFIhllEKQ== X-Received: by 2002:a17:902:f807:b0:1c9:b2c1:139c with SMTP id ix7-20020a170902f80700b001c9b2c1139cmr4180478plb.62.1699524423943; Thu, 09 Nov 2023 02:07:03 -0800 (PST) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:6f57:d4c:468c:5daf]) by smtp.gmail.com with ESMTPSA id c13-20020a170902d48d00b001c60ba709b7sm3127511plg.125.2023.11.09.02.06.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 02:07:03 -0800 (PST) From: Chen-Yu Tsai To: Rob Herring , Frank Rowand , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno Cc: Hsin-Yi Wang , Dmitry Torokhov , andriy.shevchenko@linux.intel.com, Jiri Kosina , linus.walleij@linaro.org, broonie@kernel.org, gregkh@linuxfoundation.org, hdegoede@redhat.com, james.clark@arm.com, james@equiv.tech, keescook@chromium.org, petr.tesarik.ext@huawei.com, rafael@kernel.org, tglx@linutronix.de, Jeff LaBundy , linux-input@vger.kernel.org, Chen-Yu Tsai , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, Douglas Anderson , Johan Hovold Subject: [RFC PATCH v2 5/7] of: hw_prober: Support Chromebook SKU ID based component selection Date: Thu, 9 Nov 2023 18:06:02 +0800 Message-ID: <20231109100606.1245545-6-wenst@chromium.org> X-Mailer: git-send-email 2.42.0.869.gea05f2083d-goog In-Reply-To: <20231109100606.1245545-1-wenst@chromium.org> References: <20231109100606.1245545-1-wenst@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 09 Nov 2023 02:08:00 -0800 (PST) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782080590623997770 X-GMAIL-MSGID: 1782080590623997770 In cases where the same Chromebook model is manufactured with different components (MIPI DSI panels, MIPI CSI camera sensors, or trackpad / touchscreens with conflicting addresses), a different SKU ID is allocated to each specific combination. This SKU ID is exported by the bootloader into the device tree, and can be used to "discover" which combination is present on the current machine. This change adds a hardware prober that will match the SKU ID against a provided table, and enable the component for the matched entry based on the given compatible string. In the MIPI DSI panel and MIPI CSI camera sensor cases which have OF graphs, it will also update the remote endpoint to point to the enabled component. This assumes a single endpoint only. This will provide a path to reducing the number of Chromebook device trees. Signed-off-by: Chen-Yu Tsai --- drivers/of/hw_prober.c | 160 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 160 insertions(+) diff --git a/drivers/of/hw_prober.c b/drivers/of/hw_prober.c index 442da6eff896..4345e5aed6d8 100644 --- a/drivers/of/hw_prober.c +++ b/drivers/of/hw_prober.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #define DRV_NAME "hw_prober" @@ -108,9 +109,168 @@ static int i2c_component_prober(struct platform_device *pdev, const void *data) return ret; } +static int cros_get_coreboot_sku_id(struct device *dev, u32 *sku_id) +{ + struct device_node *node = NULL; + int ret; + + node = of_find_node_by_path("/firmware/coreboot"); + if (!node) + return dev_err_probe(dev, -EINVAL, "Cannot find coreboot firmware node\n"); + + ret = of_property_read_u32(node, "sku-id", sku_id); + if (ret) + dev_err_probe(dev, ret, "Cannot get SKU ID\n"); + + of_node_put(node); + return ret; +} + +struct cros_sku_option { + u32 sku_id_val; + u32 sku_id_mask; + const char *compatible; +}; + +struct cros_sku_component_data { + const struct cros_sku_option *options; + int num_options; +}; + +/* + * cros_sku_component_selector - Selectively enable a component based on SKU ID + * + * Based on the list of component options and SKU ID read back from the device + * tree, enable the matching component. Also update the OF graph if it exists, + * so that the enabled component's remote endpoint correctly points to it. This + * assumes a single local endpoint, which should be the case for panels and + * camera sensors. + */ +static int cros_sku_component_selector(struct platform_device *pdev, const void *data) +{ + const struct cros_sku_component_data *pdata = data; + const char *compatible; + struct device_node *node = NULL, *endpoint = NULL, *remote = NULL; + struct property *status_prop = NULL, *endpoint_prop = NULL; + struct of_changeset *ocs = NULL; + __be32 *val = NULL; + int ret, i; + u32 sku_id; + + if (!data) + return dev_err_probe(&pdev->dev, -EINVAL, "No data given\n"); + + ret = cros_get_coreboot_sku_id(&pdev->dev, &sku_id); + if (ret) + return ret; + + for (i = 0; i < pdata->num_options; i++) + if ((sku_id & pdata->options[i].sku_id_mask) == pdata->options[i].sku_id_val) { + compatible = pdata->options->compatible; + break; + } + + if (i == pdata->num_options) + return dev_err_probe(&pdev->dev, -EINVAL, "Unknown SKU ID: 0x%x\n", sku_id); + + node = of_find_compatible_node(NULL, NULL, compatible); + if (!node) + return dev_err_probe(&pdev->dev, -ENODEV, "Cannot find matching device node\n"); + + /* device node not marked as fail; don't mess with the device tree */ + if (!of_device_is_fail(node)) + goto err_free; + + dev_info(&pdev->dev, "Enabling %pOF for SKU 0x%x\n", node, sku_id); + + ret = -ENOMEM; + ocs = kzalloc(sizeof(*ocs), GFP_KERNEL); + if (!ocs) + goto err_free; + + status_prop = kzalloc(sizeof(*status_prop), GFP_KERNEL); + if (!status_prop) + goto err_free; + + status_prop->name = "status"; + status_prop->length = 5; + status_prop->value = "okay"; + + /* Create changeset to apply DT changes atomically */ + of_changeset_init(ocs); + + if (of_graph_is_present(node)) { + ret = -EINVAL; + + /* This currently assumes a single port on the component. */ + endpoint = of_graph_get_next_endpoint(node, NULL); + if (!endpoint) { + dev_err(&pdev->dev, "No endpoint found for %pOF\n", node); + goto err_destroy_ocs; + } + + remote = of_graph_get_remote_endpoint(endpoint); + if (!remote) { + dev_err(&pdev->dev, "No remote endpoint node found for %pOF\n", endpoint); + goto err_destroy_ocs; + } + + endpoint_prop = kzalloc(sizeof(*endpoint_prop), GFP_KERNEL); + if (!endpoint_prop) + goto err_destroy_ocs; + + val = kzalloc(sizeof(*val), GFP_KERNEL); + if (!val) + goto err_destroy_ocs; + + *val = cpu_to_be32(endpoint->phandle); + endpoint_prop->name = "remote-endpoint"; + endpoint_prop->length = sizeof(*val); + endpoint_prop->value = val; + + ret = of_changeset_update_property(ocs, node, endpoint_prop); + if (ret) + goto err_destroy_ocs; + } + + ret = of_changeset_update_property(ocs, node, status_prop); + if (ret) + goto err_destroy_ocs; + ret = of_changeset_apply(ocs); + if (ret) + goto err_destroy_ocs; + + of_node_put(node); + + return 0; + +err_destroy_ocs: + of_node_put(remote); + of_node_put(endpoint); + kfree(val); + kfree(endpoint_prop); + of_changeset_destroy(ocs); +err_free: + kfree(ocs); + kfree(status_prop); + of_node_put(node); + return ret; +} + +static const struct cros_sku_option cros_krane_panel_options[] = { + { .sku_id_val = 0x00, .sku_id_mask = 0xf0, .compatible = "auo,kd101n80-45na" }, + { .sku_id_val = 0xb0, .sku_id_mask = 0xf0, .compatible = "boe,tv101wum-nl6" }, +}; + +static const struct cros_sku_component_data cros_krane_panel_data = { + .options = cros_krane_panel_options, + .num_options = ARRAY_SIZE(cros_krane_panel_options), +}; + static const struct hw_prober_entry hw_prober_platforms[] = { { .compatible = "google,hana", .prober = i2c_component_prober, .data = "touchscreen" }, { .compatible = "google,hana", .prober = i2c_component_prober, .data = "trackpad" }, + { .compatible = "google,krane", .prober = cros_sku_component_selector, .data = &cros_krane_panel_data }, }; static int hw_prober_probe(struct platform_device *pdev) From patchwork Thu Nov 9 10:06:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 163324 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp332874vqs; Thu, 9 Nov 2023 02:08:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IGQBMRTK6dV4RD2dSgaMlq2hRPZl6Qss0lZ8Ga1UKa1DLpYCOAg/KbL0uKoC0cbjuQFDneK X-Received: by 2002:a05:6358:7581:b0:168:ec61:c26 with SMTP id x1-20020a056358758100b00168ec610c26mr3104773rwf.21.1699524507166; Thu, 09 Nov 2023 02:08:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699524507; cv=none; d=google.com; s=arc-20160816; b=SGvmw9BTAkFexxyuHSykaSWmk3Bt1NVB6WXtFO48jC3krQ0v/b+ArfXViEcZKiMhF4 0n/J4uJVjWjMYioq1McGLmpvTq6NxYCssDF2eqyY4ODvctyXpKS9yIBXO7iy2lgSwdoH G/wonxY6mtoTuWJntiavhhseM51lWz7Nwd1VagsDiKSmgX/XUWhA4fJi2ZD/LQUY1fcz k7spgcy5nhjISU26EPBF23GMMXexzJZv+Ok5e+Tj3ajqZ4HovKF2EJGg2DGKNAi3pR+8 Hz9rA8J90WS0nwpCrwlbKPRtTc+CowdkOZ6CMeQmbjwBnnS+7JU0e8M9OAb87igXmJG/ /fiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0ireTpCfN0lAkDpS22SoHjbEWTJUzLlFEUnZESQj8kY=; fh=9RjyB+hDNs618LdaNPm846thAWpv+UOF4Pqs3eQuhzI=; b=ColkAgj8akA8ios+Kld7mM2X/f1LJrvavkcC69qfJBFssJ3HII1VNImtUCY+0pFthT 8uCtQ47xuFyKrdxKzlTLJuTaUw5lD0e33McpbJrOLjYQiMmAArPU3MUusV3wFISf8zYU Z7hoJBWlMgTetfXZSNEBn3bO4BOCOms7ZOzxPW8J6CeT6gbr7dnN2ZcaWAwJHOSB23ds UdFr7dw6zZDqrUp7qweYWck1w9viIkkBSRNE2R6BKSsBQZJuxwDKi8FMoEHwqsN3ALqn BZdB9V+O+Lsk1voNTxEnz+8+HHWcvVCu8vpNa1HT3HWGkc4dltGSas668sar2lmCGZwu ArGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=V+U3PVkf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id z23-20020a634c17000000b00588fa0def2asi6469491pga.778.2023.11.09.02.08.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 02:08:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=V+U3PVkf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 75EEC83113A4; Thu, 9 Nov 2023 02:08:16 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233454AbjKIKHc (ORCPT + 32 others); Thu, 9 Nov 2023 05:07:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232046AbjKIKHS (ORCPT ); Thu, 9 Nov 2023 05:07:18 -0500 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A78E3250 for ; Thu, 9 Nov 2023 02:07:09 -0800 (PST) Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1cc329ce84cso6282015ad.2 for ; Thu, 09 Nov 2023 02:07:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1699524428; x=1700129228; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0ireTpCfN0lAkDpS22SoHjbEWTJUzLlFEUnZESQj8kY=; b=V+U3PVkfF5uxOrXpN8BVULqi55XRpztj0ymrjnICLVyJmKd10JQNEw0fITvjirFT0S kik+ceQR3+ctMCdte0jR42wXZWRkoVmrmRqVtcCGiAdVfi/krDrfZC9zTyL2/U0yP2EW xRwymNhHUdCT7ZuaIklIrRPeOvpXWr5Vn05ZY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699524428; x=1700129228; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0ireTpCfN0lAkDpS22SoHjbEWTJUzLlFEUnZESQj8kY=; b=HM0rBDNNaYGJP5cEwWqaXALCOuvbxQo08UwnAtAEhrYGFdnS5Jme1KtbqH51miDcEI gGdP+i3h7JCl7WjSOY6ZEUvRX+3uCNXctXrDOwzcBpE4g1mGkq16OByRELFPczjVNawx F1gQsou1fHg5zQXyv5xMHxqv/2kc/N78+SgwYp8o+6xTM/77WgcIclTDvAif3gTWz+wv bNWZWectUoXX8DDIZJzAZGSmUtj5ZJOzEDvfrVtHJD37XiA88Xz2T76dDTTABwLg0/vu HlrkVlgfhUcRaVEiEl26T+P8VKwsmBY4oefdhEv3cf+Wd2IO9uJpT4yHojqZuB3fhbQD 0Rgw== X-Gm-Message-State: AOJu0YycKy1KskkWaoxEORnAOOmN5+eMmhymx3v9vMPNyeQnpXBO1Cvn 6X4afu0YwS/D8FhLsMViO+9m2Q== X-Received: by 2002:a17:902:ecc1:b0:1cc:2ed0:5ab1 with SMTP id a1-20020a170902ecc100b001cc2ed05ab1mr5039394plh.17.1699524428617; Thu, 09 Nov 2023 02:07:08 -0800 (PST) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:6f57:d4c:468c:5daf]) by smtp.gmail.com with ESMTPSA id c13-20020a170902d48d00b001c60ba709b7sm3127511plg.125.2023.11.09.02.07.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 02:07:08 -0800 (PST) From: Chen-Yu Tsai To: Rob Herring , Frank Rowand , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno Cc: Hsin-Yi Wang , Dmitry Torokhov , andriy.shevchenko@linux.intel.com, Jiri Kosina , linus.walleij@linaro.org, broonie@kernel.org, gregkh@linuxfoundation.org, hdegoede@redhat.com, james.clark@arm.com, james@equiv.tech, keescook@chromium.org, petr.tesarik.ext@huawei.com, rafael@kernel.org, tglx@linutronix.de, Jeff LaBundy , linux-input@vger.kernel.org, Chen-Yu Tsai , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, Douglas Anderson , Johan Hovold Subject: [RFC PATCH v2 6/7] dt-bindings: arm: mediatek: Remove SKU specific compatibles for Google Krane Date: Thu, 9 Nov 2023 18:06:03 +0800 Message-ID: <20231109100606.1245545-7-wenst@chromium.org> X-Mailer: git-send-email 2.42.0.869.gea05f2083d-goog In-Reply-To: <20231109100606.1245545-1-wenst@chromium.org> References: <20231109100606.1245545-1-wenst@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 09 Nov 2023 02:08:16 -0800 (PST) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782080609444375801 X-GMAIL-MSGID: 1782080609444375801 In cases where the same Chromebook model is manufactured with different components (MIPI DSI panels, MIPI CSI camera sensors, or trackpad / touchscreens with conflicting addresses), a different SKU ID is allocated to each specific combination. This SKU ID is exported by the bootloader into the device tree, and can be used to "discover" which combination is present on the current machine. Thus we no longer have to specify separate compatible strings for each of them. Remove the SKU specific compatible strings for Google Krane. Signed-off-by: Chen-Yu Tsai --- Documentation/devicetree/bindings/arm/mediatek.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/Documentation/devicetree/bindings/arm/mediatek.yaml b/Documentation/devicetree/bindings/arm/mediatek.yaml index a4541855a838..ef3dfb286814 100644 --- a/Documentation/devicetree/bindings/arm/mediatek.yaml +++ b/Documentation/devicetree/bindings/arm/mediatek.yaml @@ -186,9 +186,6 @@ properties: - const: mediatek,mt8183 - description: Google Krane (Lenovo IdeaPad Duet, 10e,...) items: - - enum: - - google,krane-sku0 - - google,krane-sku176 - const: google,krane - const: mediatek,mt8183 - description: Google Willow (Acer Chromebook 311 C722/C722T) From patchwork Thu Nov 9 10:06:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 163325 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp332959vqs; Thu, 9 Nov 2023 02:08:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IH2cpSHTC77PNtmK0g3jBtzpxfzlsj+KkxIDyJL6AUvBJvLd2WEvUjq3gw+mFxdb3JU8dlz X-Received: by 2002:a05:6a20:978d:b0:181:3129:363 with SMTP id hx13-20020a056a20978d00b0018131290363mr4271964pzc.58.1699524517231; Thu, 09 Nov 2023 02:08:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699524517; cv=none; d=google.com; s=arc-20160816; b=t+0ACTnFlETkRYRI8FgnQbzjBGwCYxZ6xTh1RUGdpqdPZOgEjam0JNBcrN7DY8j+85 aHVTObADAfu8H4ySazTS3ryuP1Ys78Fg5nSlgRedfHt8+sL5hbUpojqkQhFSlduF6gvz 66QeRiHqbhes5EhbThMGTgD3kU22NR+kBokHKOHmS+KfsokY+XYYEx3uMquKYgDQ5uWf kuLv0ZRZpoAfTKfLtWG6EOFeH4J+fB7ZFI6F+Fo2DCBGiyvaxd+EQHQourZByERyFWx6 Teq6c/+CEQmLJyBw1xw5UYNcxSRdoWTS6szu4te7ZiTiI3r99aKXhjWnhrR7itc03LMX GEeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=onLNc+Oko6/d4dZDi8m4Ahc5zglhx4oC8hmNsm3uUAA=; fh=9RjyB+hDNs618LdaNPm846thAWpv+UOF4Pqs3eQuhzI=; b=CwIKdrmunMjjr/44Y7ges+gWf0Lox/TKZggVKCxQiamYl4qDoZSGsNPhC8kBhA0MXy 2RNcfeymZLHPvLYjPtHjkoUyIJ4o+Hua1Wg2SUTGTTIkdvfZWksCutyuXlWuZM47dA19 8f5dVEMrXRsGZcdqib4EdFvcN/GhSR/XmW5hjP4tS78SjSMhKz5h6eSrk9+LDTiZI80H QNJ9b0QQ9gK17NWEMyfZkk/bR0eSiy1o6fZ0JiZZ3c54ck3rBo3TnXXKxoLl2c8GdCoj bLSNnMp3pMsBXirKheGUA0PdeDP37FhY/LoaxXF2Ye6THDeu5cy44mb4Yscu0R6wf+5U XhQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=CdwuVzTc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id y15-20020a17090322cf00b001c5f5153e41si5020522plg.535.2023.11.09.02.08.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 02:08:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=CdwuVzTc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id A5F16831138F; Thu, 9 Nov 2023 02:08:29 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233027AbjKIKHo (ORCPT + 32 others); Thu, 9 Nov 2023 05:07:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233557AbjKIKHW (ORCPT ); Thu, 9 Nov 2023 05:07:22 -0500 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 0F744358C for ; Thu, 9 Nov 2023 02:07:13 -0800 (PST) Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-6c3363a2b93so711728b3a.3 for ; Thu, 09 Nov 2023 02:07:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1699524433; x=1700129233; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=onLNc+Oko6/d4dZDi8m4Ahc5zglhx4oC8hmNsm3uUAA=; b=CdwuVzTcLaNuBWm+5+Eyq35jTiVIQezZYsIJ/TuYU3pt1Cm54umZ2eQZ/7u92dCADF mVmV/nvqCJrh9HIh3sURGPaARnApWRc39+IT95mTp/ryN3aV4BjyK0dTyGXe8OJcmshg BrYsnYxfDR5Y0Onaai+8FCNo5TTuyV1p7O9ZQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699524433; x=1700129233; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=onLNc+Oko6/d4dZDi8m4Ahc5zglhx4oC8hmNsm3uUAA=; b=ZASseHrWJtujXdtzRqJLIi/BiddLHjgKQDqJkVWGahnR5OfJu0W0/pc56z8Hw5fjNQ 3r8j0BddmFx9HwJsqeKy+uaWtvHm+Rccf0t6EF5o6hUyznn3pv8RXEq57FfplavmtzOl QNqzCn/CyxVj6a5ml+C3r5bnc3L71en+pyx17DyYnCSnBYI5A9T6+le5SCNKMOoyzC5T fi8rT7CoLJ/vWhmynoPPtXVqTl6Lt4C8gTIUPMzjnlQxV+TIlUCtUY2vjsZeY11iO55b YeccZVJvpCEahAZVqFJD5FKH2e7zVIQf2qga3zmKUGW/X4E++sWSqTw9Y2JtaAY6yUC2 6L7Q== X-Gm-Message-State: AOJu0YwQgj3nKPsWjW+LplRM+gL72b/+0cIVeGtyLIbMJED5hfVpDfXg T5qS9hsN/Y7PJRhdUO4trEJZJw== X-Received: by 2002:a05:6a21:19a:b0:181:10ee:20d5 with SMTP id le26-20020a056a21019a00b0018110ee20d5mr6079204pzb.12.1699524433438; Thu, 09 Nov 2023 02:07:13 -0800 (PST) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:6f57:d4c:468c:5daf]) by smtp.gmail.com with ESMTPSA id c13-20020a170902d48d00b001c60ba709b7sm3127511plg.125.2023.11.09.02.07.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 02:07:12 -0800 (PST) From: Chen-Yu Tsai To: Rob Herring , Frank Rowand , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno Cc: Hsin-Yi Wang , Dmitry Torokhov , andriy.shevchenko@linux.intel.com, Jiri Kosina , linus.walleij@linaro.org, broonie@kernel.org, gregkh@linuxfoundation.org, hdegoede@redhat.com, james.clark@arm.com, james@equiv.tech, keescook@chromium.org, petr.tesarik.ext@huawei.com, rafael@kernel.org, tglx@linutronix.de, Jeff LaBundy , linux-input@vger.kernel.org, Chen-Yu Tsai , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, Douglas Anderson , Johan Hovold Subject: [RFC PATCH v2 7/7] arm64: dts: mediatek: mt8183-kukui: Merge Krane device trees Date: Thu, 9 Nov 2023 18:06:04 +0800 Message-ID: <20231109100606.1245545-8-wenst@chromium.org> X-Mailer: git-send-email 2.42.0.869.gea05f2083d-goog In-Reply-To: <20231109100606.1245545-1-wenst@chromium.org> References: <20231109100606.1245545-1-wenst@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 09 Nov 2023 02:08:29 -0800 (PST) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782080619909128792 X-GMAIL-MSGID: 1782080619909128792 In cases where the same Chromebook model is manufactured with different components (MIPI DSI panels, MIPI CSI camera sensors, or trackpad / touchscreens with conflicting addresses), a different SKU ID is allocated to each specific combination. This SKU ID is exported by the bootloader into the device tree, and can be used to "discover" which combination is present on the current machine. Merge the separate Krane dtsi/dts files into one shared for all SKUs. A new device node is added for the alternative panel. Both it and the original panel are marked as "fail-needs-probe-panel" to let the hardware prober handle it. Also move the cros_ec node so that all node references are ordered alphabetically. Signed-off-by: Chen-Yu Tsai --- arch/arm64/boot/dts/mediatek/Makefile | 3 +- .../dts/mediatek/mt8183-kukui-krane-sku0.dts | 24 ---------- .../mediatek/mt8183-kukui-krane-sku176.dts | 24 ---------- ...ukui-krane.dtsi => mt8183-kukui-krane.dts} | 47 +++++++++++++++++-- 4 files changed, 44 insertions(+), 54 deletions(-) delete mode 100644 arch/arm64/boot/dts/mediatek/mt8183-kukui-krane-sku0.dts delete mode 100644 arch/arm64/boot/dts/mediatek/mt8183-kukui-krane-sku176.dts rename arch/arm64/boot/dts/mediatek/{mt8183-kukui-krane.dtsi => mt8183-kukui-krane.dts} (86%) diff --git a/arch/arm64/boot/dts/mediatek/Makefile b/arch/arm64/boot/dts/mediatek/Makefile index 7e365e9516ab..d4d97b315b2f 100644 --- a/arch/arm64/boot/dts/mediatek/Makefile +++ b/arch/arm64/boot/dts/mediatek/Makefile @@ -40,8 +40,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += mt8183-kukui-kodama-sku16.dtb dtb-$(CONFIG_ARCH_MEDIATEK) += mt8183-kukui-kodama-sku272.dtb dtb-$(CONFIG_ARCH_MEDIATEK) += mt8183-kukui-kodama-sku288.dtb dtb-$(CONFIG_ARCH_MEDIATEK) += mt8183-kukui-kodama-sku32.dtb -dtb-$(CONFIG_ARCH_MEDIATEK) += mt8183-kukui-krane-sku0.dtb -dtb-$(CONFIG_ARCH_MEDIATEK) += mt8183-kukui-krane-sku176.dtb +dtb-$(CONFIG_ARCH_MEDIATEK) += mt8183-kukui-krane.dtb dtb-$(CONFIG_ARCH_MEDIATEK) += mt8183-pumpkin.dtb dtb-$(CONFIG_ARCH_MEDIATEK) += mt8186-corsola-magneton-sku393216.dtb dtb-$(CONFIG_ARCH_MEDIATEK) += mt8186-corsola-magneton-sku393217.dtb diff --git a/arch/arm64/boot/dts/mediatek/mt8183-kukui-krane-sku0.dts b/arch/arm64/boot/dts/mediatek/mt8183-kukui-krane-sku0.dts deleted file mode 100644 index 4ac75806fa94..000000000000 --- a/arch/arm64/boot/dts/mediatek/mt8183-kukui-krane-sku0.dts +++ /dev/null @@ -1,24 +0,0 @@ -// SPDX-License-Identifier: (GPL-2.0 OR MIT) -/* - * Copyright 2019 Google LLC - * - * Device-tree for Krane sku0. - * - * SKU is a 8-bit value (0x00 == 0): - * - Bits 7..4: Panel ID: 0x0 (AUO) - * - Bits 3..0: SKU ID: 0x0 (default) - */ - -/dts-v1/; -#include "mt8183-kukui-krane.dtsi" - -/ { - model = "MediaTek krane sku0 board"; - chassis-type = "tablet"; - compatible = "google,krane-sku0", "google,krane", "mediatek,mt8183"; -}; - -&panel { - status = "okay"; - compatible = "auo,kd101n80-45na"; -}; diff --git a/arch/arm64/boot/dts/mediatek/mt8183-kukui-krane-sku176.dts b/arch/arm64/boot/dts/mediatek/mt8183-kukui-krane-sku176.dts deleted file mode 100644 index 095279e55d50..000000000000 --- a/arch/arm64/boot/dts/mediatek/mt8183-kukui-krane-sku176.dts +++ /dev/null @@ -1,24 +0,0 @@ -// SPDX-License-Identifier: (GPL-2.0 OR MIT) -/* - * Copyright 2019 Google LLC - * - * Device-tree for Krane sku176. - * - * SKU is a 8-bit value (0xb0 == 176): - * - Bits 7..4: Panel ID: 0xb (BOE) - * - Bits 3..0: SKU ID: 0x0 (default) - */ - -/dts-v1/; -#include "mt8183-kukui-krane.dtsi" - -/ { - model = "MediaTek krane sku176 board"; - chassis-type = "tablet"; - compatible = "google,krane-sku176", "google,krane", "mediatek,mt8183"; -}; - -&panel { - status = "okay"; - compatible = "boe,tv101wum-nl6"; -}; diff --git a/arch/arm64/boot/dts/mediatek/mt8183-kukui-krane.dtsi b/arch/arm64/boot/dts/mediatek/mt8183-kukui-krane.dts similarity index 86% rename from arch/arm64/boot/dts/mediatek/mt8183-kukui-krane.dtsi rename to arch/arm64/boot/dts/mediatek/mt8183-kukui-krane.dts index d5f41c6c9881..75a734c0fbcc 100644 --- a/arch/arm64/boot/dts/mediatek/mt8183-kukui-krane.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8183-kukui-krane.dts @@ -1,12 +1,24 @@ // SPDX-License-Identifier: (GPL-2.0 OR MIT) /* * Copyright 2019 Google LLC + * + * Device tree for Krane Chromebook family. + * + * SKU ID is a 8-bit value (0x00 == 0): + * - Bits 7..4: Panel ID: 0x0 (AUO) + * 0xb (BOE) + * - Bits 3..0: SKU ID: 0x0 (default) */ +/dts-v1/; #include "mt8183-kukui.dtsi" #include "mt8183-kukui-audio-max98357a.dtsi" / { + model = "Google Krane Chromebook"; + chassis-type = "tablet"; + compatible = "google,krane", "mediatek,mt8183"; + ppvarn_lcd: ppvarn-lcd { compatible = "regulator-fixed"; regulator-name = "ppvarn_lcd"; @@ -45,6 +57,34 @@ &bluetooth { firmware-name = "nvm_00440302_i2s_eu.bin"; }; +&cros_ec { + keyboard-controller { + compatible = "google,cros-ec-keyb-switches"; + }; +}; + +&dsi0 { + panel2@0 { + compatible = "boe,tv101wum-nl6"; + reg = <0>; + enable-gpios = <&pio 45 0>; + pinctrl-names = "default"; + pinctrl-0 = <&panel_pins_default>; + avdd-supply = <&ppvarn_lcd>; + avee-supply = <&ppvarp_lcd>; + pp1800-supply = <&pp1800_lcd>; + backlight = <&backlight_lcd0>; + rotation = <270>; + status = "fail-needs-probe-panel"; + + port { + endpoint { + remote-endpoint = <&dsi_out>; + }; + }; + }; +}; + &i2c0 { status = "okay"; @@ -343,10 +383,9 @@ rst_pin { }; }; -&cros_ec { - keyboard-controller { - compatible = "google,cros-ec-keyb-switches"; - }; +&panel { + compatible = "auo,kd101n80-45na"; + status = "fail-needs-probe-panel"; }; &qca_wifi {