From patchwork Mon Sep 9 18:37:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= X-Patchwork-Id: 13797416 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AF5EDECE577 for ; Mon, 9 Sep 2024 18:39:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To: Content-Transfer-Encoding:Content-Type:MIME-Version:Message-Id:Date:Subject: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=Ctniu5o5pSn2Xl9x/oQ3EOBA3dmB7q9aVi1ZjFolhD4=; b=wynyZuMKtBcIAV 0dFZXxEbcW0HgSk9UgzH0q0aqHa19L4ulhRuXxXquUAcV77GiDfzvUVyZNmgSH1fjI/h3lGimZT2C 8jFhsb1G0iSvq9qeMER5AlgIlYecGFt1uB/gFlTF3neMdIrMWJipBWIS+lqiwRROj1JEEEjqlGodh aaGx+OD44B6hKOvgNB9UqHfxB3jA3KssFgOGBhc+I9EADiivKbhAXHXr5VdUilF0W1Tf/KkoUMlII 8dRtk3OVe/n7izS0sbeTAASEA/jlddeLQl6WJQE2lg7K1PLfySV5IeJUdPzvyOZCK6BSgsmFXJoOV IRyK7TjRzpAXeU+jagKA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1snjIG-00000002zau-2ucX; Mon, 09 Sep 2024 18:39:20 +0000 Received: from bali.collaboradmins.com ([148.251.105.195]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1snjHD-00000002zLj-1KrQ; Mon, 09 Sep 2024 18:38:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1725907093; bh=QvSdxTDvn8AaYy6kGpwsljEiMhfwzV+X7Yjh0q69b1g=; h=From:Subject:Date:To:Cc:From; b=b5OE9DTdhoalVXxxeEAxJs4KvmlVPW5zCkFstuELc2cLUW/NE0RqPnFPm7z1ebPof qldjWVxBgavSO3WPNll69gLZLM36jEABuWO4sRRSwtH6Y7gKH4TpK9LN1ZaJJWtjTD M5eO3wwC9V6126wbdoFtMdRg4mQZVfotachXYMl4qqVvuhiY218LIojdijtOy877L8 jn1yompLUoI+9TeJ5Y0L3m6UTsHeZV/tlgwu2uLWg6U60p1/GxtNIGi4jgvK/MHUZs 6FyljcO5m99Ko+EgN1ZDirIqhnqIR3g4AXv3aHmqd6O5al+L1cOhZVYpO1p6EVzygw CR3jFj0T+Q4AQ== Received: from [192.168.1.95] (pool-100-2-116-133.nycmny.fios.verizon.net [100.2.116.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: nfraprado) by bali.collaboradmins.com (Postfix) with ESMTPSA id A441217E35FB; Mon, 9 Sep 2024 20:38:11 +0200 (CEST) From: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= Subject: [PATCH RFC 0/3] Verify bias functionality for pinctrl_paris driver through new gpio test Date: Mon, 09 Sep 2024 14:37:31 -0400 Message-Id: <20240909-kselftest-gpio-set-get-config-v1-0-16a065afc3c1@collabora.com> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAGtA32YC/x2MwQrCMBAFf6Xs2YW0tBG9Cn6AV/HQxpe4KEnJl iKU/ruLh4GZy2ykqAKlc7NRxSoqJVu0h4bCa8wJLE9r6lzXu5Pz/FZ84gJdOM1SWGFihJKjJPY YpskfXWjHgewxV0T5/v93ul0v9Nj3H+YIlT10AAAA To: Sean Wang , Linus Walleij , Matthias Brugger , AngeloGioacchino Del Regno , Bamvor Jian Zhang , Shuah Khan Cc: kernel@collabora.com, linux-mediatek@lists.infradead.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, kernelci@lists.linux.dev, =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= X-Mailer: b4 0.14.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240909_113815_548263_405C7F6D X-CRM114-Status: GOOD ( 13.74 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org This series was motivated by the regression fixed by 166bf8af9122 ("pinctrl: mediatek: common-v2: Fix broken bias-disable for PULL_PU_PD_RSEL_TYPE"). A bug was introduced in the pinctrl_paris driver which prevented certain pins from having their bias configured. Running this test on the mt8195-tomato platform with the test plan included below[1] shows the test passing with the fix applied, but failing without the fix: With fix: $ ./gpio-setget-config.py TAP version 13 # Using test plan file: ./google,tomato.yaml 1..3 ok 1 pinctrl_paris.34.pull-up ok 2 pinctrl_paris.34.pull-down ok 3 pinctrl_paris.34.disabled # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0 Without fix: $ ./gpio-setget-config.py TAP version 13 # Using test plan file: ./google,tomato.yaml 1..3 # Bias doesn't match: Expected pull-up, read pull-down. not ok 1 pinctrl_paris.34.pull-up ok 2 pinctrl_paris.34.pull-down # Bias doesn't match: Expected disabled, read pull-down. not ok 3 pinctrl_paris.34.disabled # Totals: pass:1 fail:2 xfail:0 xpass:0 skip:0 error:0 In order to achieve this, the first patch exposes bias configuration through the GPIO API in the pinctrl_paris driver, patch 2 extends the gpio-mockup-cdev utility for use by patch 3, and patch 3 introduces a new GPIO kselftest that takes a test plan in YAML, which can be tailored per-platform to specify the configurations to test, and sets and gets back each pin configuration to verify that they match and thus that the driver is behaving as expected. Since the GPIO uAPI only allows setting the pin configuration, getting it back is done through pinconf-pins in the pinctrl debugfs folder. The test currently only verifies bias but it would be easy to extend to verify other pin configurations. The test plan YAML file can be customized for each use-case and is platform-dependant. For that reason, only an example is included in patch 3 and the user is supposed to provide their test plan. That said, the aim is to collect test plans for ease of use at [2]. [1] This is the test plan used for mt8195-tomato: - label: "pinctrl_paris" tests: # Pin 34 has type MTK_PULL_PU_PD_RSEL_TYPE and is unused. # Setting bias to MTK_PULL_PU_PD_RSEL_TYPE pins was fixed by # 166bf8af9122 ("pinctrl: mediatek: common-v2: Fix broken bias-disable for PULL_PU_PD_RSEL_TYPE") - pin: 34 bias: "pull-up" - pin: 34 bias: "pull-down" - pin: 34 bias: "disabled" [2] https://github.com/kernelci/platform-test-parameters Signed-off-by: NĂ­colas F. R. A. Prado --- NĂ­colas F. R. A. Prado (3): pinctrl: mediatek: paris: Expose more configurations to GPIO set_config selftest: gpio: Add wait flag to gpio-mockup-cdev selftest: gpio: Add a new set-get config test drivers/pinctrl/mediatek/pinctrl-paris.c | 20 +-- tools/testing/selftests/gpio/Makefile | 2 +- tools/testing/selftests/gpio/gpio-mockup-cdev.c | 14 +- .../gpio-set-get-config-example-test-plan.yaml | 15 ++ .../testing/selftests/gpio/gpio-set-get-config.py | 183 +++++++++++++++++++++ 5 files changed, 220 insertions(+), 14 deletions(-) --- base-commit: 6a7917c89f219f09b1d88d09f376000914a52763 change-id: 20240906-kselftest-gpio-set-get-config-6e5bb670c1a5 Best regards,