From nobody Thu Nov 14 08:03:40 2024 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 E6BA7C4332F for ; Tue, 18 Oct 2022 05:41:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230243AbiJRFlX (ORCPT ); Tue, 18 Oct 2022 01:41:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229976AbiJRFlT (ORCPT ); Tue, 18 Oct 2022 01:41:19 -0400 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 825769DFBA; Mon, 17 Oct 2022 22:41:18 -0700 (PDT) Received: by mail-pl1-x62a.google.com with SMTP id c24so12849533plo.3; Mon, 17 Oct 2022 22:41:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=jTn1dphwNOkdUyNvDetLqqezFlO3LTymy8eZ70ptOU4=; b=lz0HD8RW5uepcDP4ExPxobkGeybyVM1a/aLHa5C8LHvYddXJ4DPGBq5N3gTF0xUkdT 5r+Y/MijFhpqdp9ZYE5yZJGylo3K+DSYD69+IuGZnJni/FEyqZe9sO79SZmNUCSPO1L7 VXglj6d4U3yuIqtRjTnzn/KYrpjkL4fG6yRwUN3mbojj3elf0Wtr/vELfeGOYgbAF+3B nKDRrddxLyXbKnN92Cw09Z8lDqxi4s5Kxmi48bGQWeWrqsTpB7m/iFg8qRjp2gbiaVSd lsdjBpgKqsmTW51CbYyK2OOZi888FUKFR9KT4555diSCxYJPobkBmP4kY4mlJWaOKXtr lpJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=jTn1dphwNOkdUyNvDetLqqezFlO3LTymy8eZ70ptOU4=; b=bL8P92BPaem95UHz+/iLBsRLc54wTozKU2SWw7d5n5Sad1bttG/8Yz/l0F0v5D7c5W tFdV0bhw+E7gPxEZx4S26GvFJy21It/PmLLPP3Tm8umWPDRF5k3paXeMqwUvtabwCa7i rTZL1NKvs9KIkeEfhlDLpuNr94XXNLy305TkNh0bvdpeazHO08uB5BTM4emsTbPPyY60 TfDKeQcVzEF+m75JufesPEic+KEVUp5Utf5Ji0Tpvbp9E5/BApOkHMEUk5FE0n6omRUi wGHyIWz9+p7T1S1qgSb/LGhmXjEWcPHarS96x3kc0R3YK/i0bvjL7Wy7atFZuKuCXHFT QS/g== X-Gm-Message-State: ACrzQf3JyZA5I9k1QLjnO8ywsSe2dUHH1P76R5MB95X1ibxzM0rzmSO/ uRusPuhBrk0woGlIIYflJtAeHQjm09niHQ== X-Google-Smtp-Source: AMsMyM5rs1kB4rFeIfAfMs/wl4emcwgpOJcxfI8D4+foneG1Oqh62ltVnNeCS1hPaOOZKRp3wXqlkA== X-Received: by 2002:a17:90b:48c9:b0:20a:e225:1afd with SMTP id li9-20020a17090b48c900b0020ae2251afdmr36387992pjb.21.1666071677837; Mon, 17 Oct 2022 22:41:17 -0700 (PDT) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:9d:2:f7bc:1bb5:e0b1:92cb]) by smtp.gmail.com with ESMTPSA id z7-20020a1709027e8700b00172f4835f53sm7597435pla.192.2022.10.17.22.41.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Oct 2022 22:41:17 -0700 (PDT) From: Dmitry Torokhov To: Bartosz Golaszewski , Linus Walleij Cc: Alexander Stein , linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, Andy Shevchenko , Daniel Thompson , linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH v3 01/10] gpiolib: of: add a quirk for legacy names in Mediatek mt2701-cs42448 Date: Mon, 17 Oct 2022 22:41:02 -0700 Message-Id: <20221011-gpiolib-quirks-v3-1-eae9cc2ed0a1@gmail.com> X-Mailer: git-send-email 2.38.0.413.g74048e4d9e-goog In-Reply-To: <20221011-gpiolib-quirks-v3-0-eae9cc2ed0a1@gmail.com> References: <20221011-gpiolib-quirks-v3-0-eae9cc2ed0a1@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Mailer: b4 0.11.0-dev-5166b Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The driver is using non-standard "i2s1-in-sel-gpio1" and "i2s1-in-sel-gpio2" names to describe its gpios. In preparation to converting to the standard naming (i2s1-in-sel-gpios) and switching the driver to gpiod API add a quirk to gpiolib to keep compatibility with existing DTSes. Reviewed-by: Daniel Thompson Reviewed-by: Linus Walleij Signed-off-by: Dmitry Torokhov --- drivers/gpio/gpiolib-of.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index 0e4e1291604d..cef4f6634125 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -488,6 +488,38 @@ static struct gpio_desc *of_find_usb_gpio(struct devic= e_node *np, return of_get_named_gpiod_flags(np, con_id, idx, of_flags); } =20 +static struct gpio_desc *of_find_mt2701_gpio(struct device_node *np, + const char *con_id, + unsigned int idx, + enum of_gpio_flags *of_flags) +{ + struct gpio_desc *desc; + const char *legacy_id; + + if (!IS_ENABLED(CONFIG_SND_SOC_MT2701_CS42448)) + return ERR_PTR(-ENOENT); + + if (!of_device_is_compatible(np, "mediatek,mt2701-cs42448-machine")) + return ERR_PTR(-ENOENT); + + if (!con_id || strcmp(con_id, "i2s1-in-sel")) + return ERR_PTR(-ENOENT); + + if (idx =3D=3D 0) + legacy_id =3D "i2s1-in-sel-gpio1"; + else if (idx =3D=3D 1) + legacy_id =3D "i2s1-in-sel-gpio2"; + else + return ERR_PTR(-ENOENT); + + desc =3D of_get_named_gpiod_flags(np, legacy_id, 0, of_flags); + if (!gpiod_not_found(desc)) + pr_info("%s is using legacy gpio name '%s' instead of '%s-gpios'\n", + of_node_full_name(np), legacy_id, con_id); + + return desc; +} + typedef struct gpio_desc *(*of_find_gpio_quirk)(struct device_node *np, const char *con_id, unsigned int idx, @@ -498,6 +530,7 @@ static const of_find_gpio_quirk of_find_gpio_quirks[] = =3D { of_find_regulator_gpio, of_find_arizona_gpio, of_find_usb_gpio, + of_find_mt2701_gpio, NULL }; =20 --=20 b4 0.11.0-dev-5166b From nobody Thu Nov 14 08:03:40 2024 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 CA804C4332F for ; Tue, 18 Oct 2022 05:41:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230325AbiJRFln (ORCPT ); Tue, 18 Oct 2022 01:41:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230251AbiJRFlZ (ORCPT ); Tue, 18 Oct 2022 01:41:25 -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 8A62B9E2F6; Mon, 17 Oct 2022 22:41:21 -0700 (PDT) Received: by mail-pl1-x62c.google.com with SMTP id z20so12799393plb.10; Mon, 17 Oct 2022 22:41:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=irh82m/Qp0GNkDByM4lA7WDy1dQieqAl2YHxexC44Os=; b=qM+7dUmyLkuLDovXyoDzXR4ZJpAmZEdJGbZmluNHy9gwL9ovsevbMseXwDgIpDBLyJ OZxzyzDmo1EDoIj/aW9A1oqy+N21Qkye+klde2LrJ6uWjtC3qpnnEDvasVjjKEf3NuUM yUeiw5Csgwv7NOsE+dF3orUttQy43BtzBpu4ioNjBBDvrKfBg7J0n0QVPKEn75jnJT5J fDOsFzSJnLNppTx+HtbLp/PyXmCfSivMTsfPryuqO211YBvr+qf5IRg3MEGtT1Q2khGG snrOs178pvUx1AVkNeSz6hhXFu4Uq3doCNrG6OhyBeXPDw/nY/cKN12J0zpBC/k9YvLi FDDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=irh82m/Qp0GNkDByM4lA7WDy1dQieqAl2YHxexC44Os=; b=XGja31BhtAdVg0zjACPqvSYTD/dsSwST2wRQ5RcjHJkOO7ntXeXORvJr8divPikFw8 US5mpkFdUUNjBzUGpnVUVzGWsIH2sQp8MayJwEfhxEIXRxkxISMo6d04FPptX37tgcGO P+YvjQsU5tkYsiXkhWCuZ/gzXlvcxdnqQKGTE8fri9C6sieRNbTsZ/ZHKpwj4KefZZRK 2lKnb6Pd1+IX1MkRbAEwUpyLcGMCDouogn3vh8Hj2VKff0Cr5mYtl4fVyzTD8VdPL102 M8F74EGCMiY/DzfF4tcLyUbW5BomD1aY+ZIXfsizoqVJfPkxr0FsiyywJrvZ3GFBxfi6 Y6OQ== X-Gm-Message-State: ACrzQf1/3KXwtH/MSbxxFN1HeVpLRqaWQx6tmLcab1SY0UMg+Aqw0e32 Nxx4+Xo5iI8UpM058YNSJf0= X-Google-Smtp-Source: AMsMyM44JNbRgjz/ycKNs7oGzL14JzEH+ynshgXTVlDVyeaouBVbIzDLES45gV0ttfgxsmviubHGbg== X-Received: by 2002:a17:90b:33cf:b0:20d:981a:a5b4 with SMTP id lk15-20020a17090b33cf00b0020d981aa5b4mr34749058pjb.137.1666071679676; Mon, 17 Oct 2022 22:41:19 -0700 (PDT) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:9d:2:f7bc:1bb5:e0b1:92cb]) by smtp.gmail.com with ESMTPSA id z7-20020a1709027e8700b00172f4835f53sm7597435pla.192.2022.10.17.22.41.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Oct 2022 22:41:18 -0700 (PDT) From: Dmitry Torokhov To: Bartosz Golaszewski , Linus Walleij Cc: Alexander Stein , linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, Andy Shevchenko , Daniel Thompson , linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH v3 02/10] gpiolib: of: consolidate simple renames into a single quirk Date: Mon, 17 Oct 2022 22:41:03 -0700 Message-Id: <20221011-gpiolib-quirks-v3-2-eae9cc2ed0a1@gmail.com> X-Mailer: git-send-email 2.38.0.413.g74048e4d9e-goog In-Reply-To: <20221011-gpiolib-quirks-v3-0-eae9cc2ed0a1@gmail.com> References: <20221011-gpiolib-quirks-v3-0-eae9cc2ed0a1@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Mailer: b4 0.11.0-dev-5166b Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This consolidates all quirks doing simple renames (either allowing suffix-less names or trivial renames, when index changes are not required) into a single quirk. Reviewed-by: Daniel Thompson Reviewed-by: Linus Walleij Signed-off-by: Dmitry Torokhov --- drivers/gpio/gpiolib-of.c | 183 ++++++++++++++++++------------------------= ---- 1 file changed, 71 insertions(+), 112 deletions(-) diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index cef4f6634125..63c6fa3086f3 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -365,127 +365,90 @@ struct gpio_desc *gpiod_get_from_of_node(const struc= t device_node *node, } EXPORT_SYMBOL_GPL(gpiod_get_from_of_node); =20 -/* - * The SPI GPIO bindings happened before we managed to establish that GPIO - * properties should be named "foo-gpios" so we have this special kludge f= or - * them. - */ -static struct gpio_desc *of_find_spi_gpio(struct device_node *np, - const char *con_id, - unsigned int idx, - enum of_gpio_flags *of_flags) -{ - char prop_name[32]; /* 32 is max size of property name */ - - /* - * Hopefully the compiler stubs the rest of the function if this - * is false. - */ - if (!IS_ENABLED(CONFIG_SPI_MASTER)) - return ERR_PTR(-ENOENT); - - /* Allow this specifically for "spi-gpio" devices */ - if (!of_device_is_compatible(np, "spi-gpio") || !con_id) - return ERR_PTR(-ENOENT); - - /* Will be "gpio-sck", "gpio-mosi" or "gpio-miso" */ - snprintf(prop_name, sizeof(prop_name), "%s-%s", "gpio", con_id); - - return of_get_named_gpiod_flags(np, prop_name, idx, of_flags); -} - -/* - * The old Freescale bindings use simply "gpios" as name for the chip sele= ct - * lines rather than "cs-gpios" like all other SPI hardware. Account for t= his - * with a special quirk. - */ -static struct gpio_desc *of_find_spi_cs_gpio(struct device_node *np, +static struct gpio_desc *of_find_gpio_rename(struct device_node *np, const char *con_id, unsigned int idx, enum of_gpio_flags *of_flags) { - if (!IS_ENABLED(CONFIG_SPI_MASTER)) - return ERR_PTR(-ENOENT); - - /* Allow this specifically for Freescale and PPC devices */ - if (!of_device_is_compatible(np, "fsl,spi") && - !of_device_is_compatible(np, "aeroflexgaisler,spictrl") && - !of_device_is_compatible(np, "ibm,ppc4xx-spi")) - return ERR_PTR(-ENOENT); - /* Allow only if asking for "cs-gpios" */ - if (!con_id || strcmp(con_id, "cs")) - return ERR_PTR(-ENOENT); + static const struct of_rename_gpio { + const char *con_id; + const char *legacy_id; /* NULL - same as con_id */ + /* + * Compatible string can be set to NULL in case where + * matching to a particular compatible is not practical, + * but it should only be done for gpio names that have + * vendor prefix to reduce risk of false positives. + * Addition of such entries is strongly discouraged. + */ + const char *compatible; + } gpios[] =3D { +#if IS_ENABLED(CONFIG_MFD_ARIZONA) + { "wlf,reset", NULL, NULL }, +#endif +#if IS_ENABLED(CONFIG_REGULATOR) + /* + * Some regulator bindings happened before we managed to + * establish that GPIO properties should be named + * "foo-gpios" so we have this special kludge for them. + */ + { "wlf,ldoena", NULL, NULL }, /* Arizona */ + { "wlf,ldo1ena", NULL, NULL }, /* WM8994 */ + { "wlf,ldo2ena", NULL, NULL }, /* WM8994 */ +#endif +#if IS_ENABLED(CONFIG_SPI_MASTER) =20 - /* - * While all other SPI controllers use "cs-gpios" the Freescale - * uses just "gpios" so translate to that when "cs-gpios" is - * requested. - */ - return of_get_named_gpiod_flags(np, "gpios", idx, of_flags); -} + /* + * The SPI GPIO bindings happened before we managed to + * establish that GPIO properties should be named + * "foo-gpios" so we have this special kludge for them. + */ + { "miso", "gpio-miso", "spi-gpio" }, + { "mosi", "gpio-mosi", "spi-gpio" }, + { "sck", "gpio-sck", "spi-gpio" }, =20 -/* - * Some regulator bindings happened before we managed to establish that GP= IO - * properties should be named "foo-gpios" so we have this special kludge f= or - * them. - */ -static struct gpio_desc *of_find_regulator_gpio(struct device_node *np, - const char *con_id, - unsigned int idx, - enum of_gpio_flags *of_flags) -{ - /* These are the connection IDs we accept as legacy GPIO phandles */ - const char *whitelist[] =3D { - "wlf,ldoena", /* Arizona */ - "wlf,ldo1ena", /* WM8994 */ - "wlf,ldo2ena", /* WM8994 */ + /* + * The old Freescale bindings use simply "gpios" as name + * for the chip select lines rather than "cs-gpios" like + * all other SPI hardware. Allow this specifically for + * Freescale and PPC devices. + */ + { "cs", "gpios", "fsl,spi" }, + { "cs", "gpios", "aeroflexgaisler,spictrl" }, + { "cs", "gpios", "ibm,ppc4xx-spi" }, +#endif +#if IS_ENABLED(CONFIG_TYPEC_FUSB302) + /* + * Fairchild FUSB302 host is using undocumented "fcs,int_n" + * property without the compulsory "-gpios" suffix. + */ + { "fcs,int_n", NULL, "fcs,fusb302" }, +#endif }; - int i; - - if (!IS_ENABLED(CONFIG_REGULATOR)) - return ERR_PTR(-ENOENT); + struct gpio_desc *desc; + const char *legacy_id; + unsigned int i; =20 if (!con_id) return ERR_PTR(-ENOENT); =20 - i =3D match_string(whitelist, ARRAY_SIZE(whitelist), con_id); - if (i < 0) - return ERR_PTR(-ENOENT); - - return of_get_named_gpiod_flags(np, con_id, idx, of_flags); -} - -static struct gpio_desc *of_find_arizona_gpio(struct device_node *np, - const char *con_id, - unsigned int idx, - enum of_gpio_flags *of_flags) -{ - if (!IS_ENABLED(CONFIG_MFD_ARIZONA)) - return ERR_PTR(-ENOENT); - - if (!con_id || strcmp(con_id, "wlf,reset")) - return ERR_PTR(-ENOENT); - - return of_get_named_gpiod_flags(np, con_id, idx, of_flags); -} + for (i =3D 0; i < ARRAY_SIZE(gpios); i++) { + if (strcmp(con_id, gpios[i].con_id)) + continue; =20 -static struct gpio_desc *of_find_usb_gpio(struct device_node *np, - const char *con_id, - unsigned int idx, - enum of_gpio_flags *of_flags) -{ - /* - * Currently this USB quirk is only for the Fairchild FUSB302 host - * which is using an undocumented DT GPIO line named "fcs,int_n" - * without the compulsory "-gpios" suffix. - */ - if (!IS_ENABLED(CONFIG_TYPEC_FUSB302)) - return ERR_PTR(-ENOENT); + if (gpios[i].compatible && + !of_device_is_compatible(np, gpios[i].compatible)) + continue; =20 - if (!con_id || strcmp(con_id, "fcs,int_n")) - return ERR_PTR(-ENOENT); + legacy_id =3D gpios[i].legacy_id ?: gpios[i].con_id; + desc =3D of_get_named_gpiod_flags(np, legacy_id, idx, of_flags); + if (!gpiod_not_found(desc)) { + pr_info("%s uses legacy gpio name '%s' instead of '%s-gpios'\n", + of_node_full_name(np), legacy_id, con_id); + return desc; + } + } =20 - return of_get_named_gpiod_flags(np, con_id, idx, of_flags); + return ERR_PTR(-ENOENT); } =20 static struct gpio_desc *of_find_mt2701_gpio(struct device_node *np, @@ -525,11 +488,7 @@ typedef struct gpio_desc *(*of_find_gpio_quirk)(struct= device_node *np, unsigned int idx, enum of_gpio_flags *of_flags); static const of_find_gpio_quirk of_find_gpio_quirks[] =3D { - of_find_spi_gpio, - of_find_spi_cs_gpio, - of_find_regulator_gpio, - of_find_arizona_gpio, - of_find_usb_gpio, + of_find_gpio_rename, of_find_mt2701_gpio, NULL }; --=20 b4 0.11.0-dev-5166b From nobody Thu Nov 14 08:03:40 2024 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 C0679C4332F for ; Tue, 18 Oct 2022 05:41:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230281AbiJRFlh (ORCPT ); Tue, 18 Oct 2022 01:41:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230267AbiJRFlc (ORCPT ); Tue, 18 Oct 2022 01:41:32 -0400 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B6AEA344C; Mon, 17 Oct 2022 22:41:22 -0700 (PDT) Received: by mail-pj1-x102a.google.com with SMTP id t12-20020a17090a3b4c00b0020b04251529so12986102pjf.5; Mon, 17 Oct 2022 22:41:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=ch1kkg4DviDr6cISnBueqNw+RVHy+3iDkYpvZ9QTu+8=; b=mHve54bc7ls4cCd6C+WM3vdDSNGdw+8I7tX818Y+FQd+0A1EfGoZp1Cu9SjKAkb8s3 Mz6bLG0nCRdSFm8PoxRktOPdBxTSH/1gJ+psd/3tNwGufenYlwBHOHRkanuiFHnkpNbi qKTDWws9xj62X8nQs4UY3tIbcymrjuUmf4ng7BiDtgNfN/5CNBFnDncwzG+tmQfasCo8 EMOl9ry8ZHYazcKg0NtcFqpURBiE/IcwXyv8od3GcSZ50/ViCKHX4Hv5ukC0a5reOb+Y EBu8Ag4Up1LyZ87fjL4Y/Qg9Hic/ClAL2eYp5ytA96PKAALHcXOMXHT+Xf1Vr8VqLTbg bVtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=ch1kkg4DviDr6cISnBueqNw+RVHy+3iDkYpvZ9QTu+8=; b=V25XIWm/413y8fw38/c/kKYX6ci7odKjkkukbkCWklhpkwSm00I8DQL8F0mgFAeh7f ry8FZfMxDKiaiLFu7rdTxy1lTTyEKQ4j5Klp7l2k5J5cyA0p6ON9AeyBAtzvusZqp3rv 2im2sLjOutA3K3b+V0r5Qh84VnWQh6ds6Eph3kPlo+86ejBGr/oL7e/nwZiBqmgYck6G TzoMDUpd75gnQIi+JuQautlHUs8Z/p1WRUBUtxesMl8QIQTRMcRg3QZBwUEZFYuXFWDB ud+O7M9kvtEqpYqSrTQ5cYjJAqa/yGMhjWt3CoxUOhpdIqmGwYekdxpyg/ufbX1Wf1bS WAyQ== X-Gm-Message-State: ACrzQf0yMio64LMOBScbZRmbYLrk119bd3MKtSt9b7HtA5LWgAGsimUj VwNPFy2ePt4hncs6VOkVcY0= X-Google-Smtp-Source: AMsMyM7d59XGsjP6DygOpdlJU+BHF6POz0TjgtvZCukR/4f2RTioIXZcjn/vo/jVJHpfY2p3ENJHbA== X-Received: by 2002:a17:903:11c3:b0:17a:e62:16e8 with SMTP id q3-20020a17090311c300b0017a0e6216e8mr1354374plh.137.1666071681430; Mon, 17 Oct 2022 22:41:21 -0700 (PDT) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:9d:2:f7bc:1bb5:e0b1:92cb]) by smtp.gmail.com with ESMTPSA id z7-20020a1709027e8700b00172f4835f53sm7597435pla.192.2022.10.17.22.41.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Oct 2022 22:41:20 -0700 (PDT) From: Dmitry Torokhov To: Bartosz Golaszewski , Linus Walleij Cc: Alexander Stein , linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, Andy Shevchenko , Daniel Thompson , linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH v3 03/10] gpiolib: of: tighten selection of gpio renaming quirks Date: Mon, 17 Oct 2022 22:41:04 -0700 Message-Id: <20221011-gpiolib-quirks-v3-3-eae9cc2ed0a1@gmail.com> X-Mailer: git-send-email 2.38.0.413.g74048e4d9e-goog In-Reply-To: <20221011-gpiolib-quirks-v3-0-eae9cc2ed0a1@gmail.com> References: <20221011-gpiolib-quirks-v3-0-eae9cc2ed0a1@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Mailer: b4 0.11.0-dev-5166b Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Tighten selection of legacy gpio renaming quirks so that they only considered on more relevant configurations. Suggested-by: Daniel Thompson Reviewed-by: Daniel Thompson Reviewed-by: Linus Walleij Signed-off-by: Dmitry Torokhov --- drivers/gpio/gpiolib-of.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index 63c6fa3086f3..7d4bbf6484bc 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -385,18 +385,21 @@ static struct gpio_desc *of_find_gpio_rename(struct d= evice_node *np, #if IS_ENABLED(CONFIG_MFD_ARIZONA) { "wlf,reset", NULL, NULL }, #endif -#if IS_ENABLED(CONFIG_REGULATOR) + /* * Some regulator bindings happened before we managed to * establish that GPIO properties should be named * "foo-gpios" so we have this special kludge for them. */ +#if IS_ENABLED(CONFIG_REGULATOR_ARIZONA_LDO1) { "wlf,ldoena", NULL, NULL }, /* Arizona */ +#endif +#if IS_ENABLED(CONFIG_REGULATOR_WM8994) { "wlf,ldo1ena", NULL, NULL }, /* WM8994 */ { "wlf,ldo2ena", NULL, NULL }, /* WM8994 */ #endif -#if IS_ENABLED(CONFIG_SPI_MASTER) =20 +#if IS_ENABLED(CONFIG_SPI_GPIO) /* * The SPI GPIO bindings happened before we managed to * establish that GPIO properties should be named @@ -405,6 +408,7 @@ static struct gpio_desc *of_find_gpio_rename(struct dev= ice_node *np, { "miso", "gpio-miso", "spi-gpio" }, { "mosi", "gpio-mosi", "spi-gpio" }, { "sck", "gpio-sck", "spi-gpio" }, +#endif =20 /* * The old Freescale bindings use simply "gpios" as name @@ -412,10 +416,14 @@ static struct gpio_desc *of_find_gpio_rename(struct d= evice_node *np, * all other SPI hardware. Allow this specifically for * Freescale and PPC devices. */ +#if IS_ENABLED(CONFIG_SPI_FSL_SPI) { "cs", "gpios", "fsl,spi" }, { "cs", "gpios", "aeroflexgaisler,spictrl" }, +#endif +#if IS_ENABLED(CONFIG_SPI_PPC4xx) { "cs", "gpios", "ibm,ppc4xx-spi" }, #endif + #if IS_ENABLED(CONFIG_TYPEC_FUSB302) /* * Fairchild FUSB302 host is using undocumented "fcs,int_n" --=20 b4 0.11.0-dev-5166b From nobody Thu Nov 14 08:03:40 2024 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 47DF5C43217 for ; Tue, 18 Oct 2022 05:41:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230346AbiJRFlq (ORCPT ); Tue, 18 Oct 2022 01:41:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230250AbiJRFld (ORCPT ); Tue, 18 Oct 2022 01:41:33 -0400 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79FD4A3F69; Mon, 17 Oct 2022 22:41:25 -0700 (PDT) Received: by mail-pj1-x1029.google.com with SMTP id pq16so13004993pjb.2; Mon, 17 Oct 2022 22:41:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=Fg1dNJF1vhKWQF5OI6LtaWfps2s1BCKrpVH4Il7rIdQ=; b=O95+mzHEcle2Ir6v0uacACuy02++l9p0omhzJtlOZhaUOCfzfMRpr6PHgmTCaPrP73 RiNvXFopkCF0RpH6YTipn9qSU4snxvXBTBFdNA6j7qaMS04d3MRn6cR+iTO8OT6sKuSk 0p1W2NWPkEdxkQ7eL02U9TTLZI53eI+pHjHcRv3xL8gTEehwI0J/2gcZiOIULLBot69c eN3YERgjVVeNVoDXFUBCu6XAncWUaOMkPZ2TK+dAIGNKpGpIgh2yn2u7fgaGHIHO5+hs H4acQX76HiAl87hNKkf858IFZiMj79BzLi7P6ENsdjmhKnl8iCrDr6vgAYtVQ5p9vlb8 VTpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=Fg1dNJF1vhKWQF5OI6LtaWfps2s1BCKrpVH4Il7rIdQ=; b=jNUedwNXZbM/j+AR8rA7WbCUXF5UP8d34H8U5rj/Q9i7f0YkJ41lifbKzgYPBuuSG0 U182CQf6bEOvejVjgsncr4FAPI112Sx/8nx4XHZX2zEimUD6ZTWNKJjZaiNYRPcgYYIJ E7y/AD7s/IcHhJBTFSh6WUqqabuR3tslSz3PYse6Iu0/mSKdwvIOJULvO0z2eju0UxKs PxT8/lkE5nHjijdazL4iI1gz1w397kUf0D3st6Nvnv4QJ0PIlqu71VuYbVA2u/8hnAEe Ov1dqCJeUTtwyDViP1V2w/nmmHAv4t/YbPdWckWLGKLe+yPNE3sG1s9swOyyE6ph36Bd LaZQ== X-Gm-Message-State: ACrzQf3nvu88pitCmVt0OGSEoEZMF1AIZchb0piphQlHIizUHedymeVS j/PSYDOII9FaDzYgHqKSPs0= X-Google-Smtp-Source: AMsMyM5TXIErFU1qFPq8kS0hh969nSm3FNAZmi0hgmHSHZ9HOAFSf5JXBUNzhXCfwoX9Fw7Hni8JZg== X-Received: by 2002:a17:90b:2691:b0:20c:d655:c67d with SMTP id pl17-20020a17090b269100b0020cd655c67dmr37605795pjb.36.1666071683285; Mon, 17 Oct 2022 22:41:23 -0700 (PDT) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:9d:2:f7bc:1bb5:e0b1:92cb]) by smtp.gmail.com with ESMTPSA id z7-20020a1709027e8700b00172f4835f53sm7597435pla.192.2022.10.17.22.41.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Oct 2022 22:41:22 -0700 (PDT) From: Dmitry Torokhov To: Bartosz Golaszewski , Linus Walleij Cc: Alexander Stein , linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, Andy Shevchenko , Daniel Thompson , linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH v3 04/10] gpiolib: of: add quirk for locating reset lines with legacy bindings Date: Mon, 17 Oct 2022 22:41:05 -0700 Message-Id: <20221011-gpiolib-quirks-v3-4-eae9cc2ed0a1@gmail.com> X-Mailer: git-send-email 2.38.0.413.g74048e4d9e-goog In-Reply-To: <20221011-gpiolib-quirks-v3-0-eae9cc2ed0a1@gmail.com> References: <20221011-gpiolib-quirks-v3-0-eae9cc2ed0a1@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Mailer: b4 0.11.0-dev-5166b Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some legacy mappings used "gpio[s]-reset" instead of "reset-gpios", add a quirk so that gpiod API will still work on unmodified DTSes. Reviewed-by: Daniel Thompson Reviewed-by: Linus Walleij Signed-off-by: Dmitry Torokhov --- drivers/gpio/gpiolib-of.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index 7d4bbf6484bc..2b5d1b3095c7 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -382,9 +382,18 @@ static struct gpio_desc *of_find_gpio_rename(struct de= vice_node *np, */ const char *compatible; } gpios[] =3D { +#if !IS_ENABLED(CONFIG_LCD_HX8357) + /* Himax LCD controllers used "gpios-reset" */ + { "reset", "gpios-reset", "himax,hx8357" }, + { "reset", "gpios-reset", "himax,hx8369" }, +#endif #if IS_ENABLED(CONFIG_MFD_ARIZONA) { "wlf,reset", NULL, NULL }, #endif +#if !IS_ENABLED(CONFIG_PCI_LANTIQ) + /* MIPS Lantiq PCI */ + { "reset", "gpios-reset", "lantiq,pci-xway" }, +#endif =20 /* * Some regulator bindings happened before we managed to @@ -399,6 +408,13 @@ static struct gpio_desc *of_find_gpio_rename(struct de= vice_node *np, { "wlf,ldo2ena", NULL, NULL }, /* WM8994 */ #endif =20 +#if IS_ENABLED(CONFIG_SND_SOC_TLV320AIC3X) + { "reset", "gpio-reset", "ti,tlv320aic3x" }, + { "reset", "gpio-reset", "ti,tlv320aic33" }, + { "reset", "gpio-reset", "ti,tlv320aic3007" }, + { "reset", "gpio-reset", "ti,tlv320aic3104" }, + { "reset", "gpio-reset", "ti,tlv320aic3106" }, +#endif #if IS_ENABLED(CONFIG_SPI_GPIO) /* * The SPI GPIO bindings happened before we managed to --=20 b4 0.11.0-dev-5166b From nobody Thu Nov 14 08:03:40 2024 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 0D567C433FE for ; Tue, 18 Oct 2022 05:41:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230287AbiJRFlv (ORCPT ); Tue, 18 Oct 2022 01:41:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230303AbiJRFle (ORCPT ); Tue, 18 Oct 2022 01:41:34 -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 E90949E2EB; Mon, 17 Oct 2022 22:41:26 -0700 (PDT) Received: by mail-pl1-x62c.google.com with SMTP id b2so12825237plc.7; Mon, 17 Oct 2022 22:41:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=8DMgKUA1ndW99FtkgK7fFtqDLzR447NcQVyF5tYxkvo=; b=Mlfgrqkvj70vbejMKTCGMp9GJ3gaaUYU2AlqRY+VhyqGg6D1JLN0HUd/z3p1RhbjYA qKTm6/8A7q0//QibXBHZ/htlvYzCq4TaldEc4XHw7CViZCvb8xbfGIIkQTFt648ancWP ApQ5j5FmpBzZ/HcXdZigRmLted9Ydib9kYLTdgTYfiaHLXEGhlUpp0Zvfhj85HfaSJii GRlbrM+XZHKiQUgHKBrwMovQuWt7uncd3+kDmAn6fJgoyUD/k6I/GLLP8z6YuKkj13zS LNrkr2xF/J1ZwPe06l0GZlJGBysiHgLQvDhLFXZ3o1wUoFXpaYhGJaV2wykb62sZnjyv 4+nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=8DMgKUA1ndW99FtkgK7fFtqDLzR447NcQVyF5tYxkvo=; b=tqUjlPSnOY8kgbUr14lFA5TF3au7RX4NYtqSYVMOcA9lqD9reMehk8ZVbR97HCRTYh VrsGAGWh2U2Y64DlT0jkwj47A7+H9vvYH7WmEOLbuQW/YcShcN/DIuV+0nSxA98edT7T 95wPr6r1Mq8aLR5GQtaefoKbC3AmnddNgNgIgHWLh0rOFd8Cc64GysweNaF5CvitLLue h9zzZi+8MMwNGj5comaPg13f1ZFLLQkUo6NLPnVZK0f0iMcfyhJl+tHYuwbGhaMAhqtx DdQR1TCBqobF0Td9mQkKLt7oAHQcCGzQQM4TqHozQBAPuVkOaHJdZkx0PRuLwVVuJ4tI 3B9Q== X-Gm-Message-State: ACrzQf0LC8K7gIkxS/aCLWv7DTuiPxm2txgQbIq03zDUSOvDWjIeJMAF 821EE0F8cm9NCSzih6d+KnM= X-Google-Smtp-Source: AMsMyM4APqjmpfE8dbaBzrp0RzRGgW+hybGoL45HKLrtC/NaYxPDQ1SgvY67ey1Va7pYiWzVz1nvvg== X-Received: by 2002:a17:90b:4c04:b0:20d:4ef6:aacc with SMTP id na4-20020a17090b4c0400b0020d4ef6aaccmr37879621pjb.199.1666071685218; Mon, 17 Oct 2022 22:41:25 -0700 (PDT) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:9d:2:f7bc:1bb5:e0b1:92cb]) by smtp.gmail.com with ESMTPSA id z7-20020a1709027e8700b00172f4835f53sm7597435pla.192.2022.10.17.22.41.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Oct 2022 22:41:24 -0700 (PDT) From: Dmitry Torokhov To: Bartosz Golaszewski , Linus Walleij Cc: Alexander Stein , linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, Andy Shevchenko , Daniel Thompson , linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH v3 05/10] gpiolib: of: add a quirk for reset line for Marvell NFC controller Date: Mon, 17 Oct 2022 22:41:06 -0700 Message-Id: <20221011-gpiolib-quirks-v3-5-eae9cc2ed0a1@gmail.com> X-Mailer: git-send-email 2.38.0.413.g74048e4d9e-goog In-Reply-To: <20221011-gpiolib-quirks-v3-0-eae9cc2ed0a1@gmail.com> References: <20221011-gpiolib-quirks-v3-0-eae9cc2ed0a1@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Mailer: b4 0.11.0-dev-5166b Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The controller is using non-standard "reset-n-io" name for its reset gpio property, whereas gpiod API expects "-gpios". Add a quirk so that gpiod API will still work on unmodified DTSes. Reviewed-by: Daniel Thompson Signed-off-by: Dmitry Torokhov --- drivers/gpio/gpiolib-of.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index 2b5d1b3095c7..a9cedc39a245 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -390,6 +390,16 @@ static struct gpio_desc *of_find_gpio_rename(struct de= vice_node *np, #if IS_ENABLED(CONFIG_MFD_ARIZONA) { "wlf,reset", NULL, NULL }, #endif +#if IS_ENABLED(CONFIG_NFC_MRVL_I2C) + { "reset", "reset-n-io", "marvell,nfc-i2c" }, +#endif +#if IS_ENABLED(CONFIG_NFC_MRVL_SPI) + { "reset", "reset-n-io", "marvell,nfc-spi" }, +#endif +#if IS_ENABLED(CONFIG_NFC_MRVL_UART) + { "reset", "reset-n-io", "marvell,nfc-uart" }, + { "reset", "reset-n-io", "mrvl,nfc-uart" }, +#endif #if !IS_ENABLED(CONFIG_PCI_LANTIQ) /* MIPS Lantiq PCI */ { "reset", "gpios-reset", "lantiq,pci-xway" }, --=20 b4 0.11.0-dev-5166b From nobody Thu Nov 14 08:03:40 2024 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 3E8EEC4332F for ; Tue, 18 Oct 2022 05:42:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230399AbiJRFmI (ORCPT ); Tue, 18 Oct 2022 01:42:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230299AbiJRFli (ORCPT ); Tue, 18 Oct 2022 01:41:38 -0400 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9ABB2A4857; Mon, 17 Oct 2022 22:41:28 -0700 (PDT) Received: by mail-pj1-x1034.google.com with SMTP id 70so12977103pjo.4; Mon, 17 Oct 2022 22:41:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=/Iq5wXewW+3MLQ47QaRSsdQhrIqjL73N0jwmptRfg2I=; b=JQB+eZ4i05NAahlAWprnOds04fTCwA66xi1PBCvw2NsAD8IJGCoC03i4GSFNm5yadT FcBha25882OHsG44R9qqRzBjDU8V6yiJphui8DvrJE2VWzWRHTH2PtAml+vDOXmI+HAH 0BRxMcBqGj4GPM5FgMS94xP5gLNiGpGa9hYpBTAETp6KMSh0uKbODdUKLZIuCfwLwibj tSA9REgAVhA10Mu6VLAH3HPgmOy/r/2cQ6K7y45shGOARzDZafsWzMzxXZu7ivqD37y1 pFfOP+H7Z6EfGIfSRE2fHOQFfL1V5LAlyELPuzSEPSHGRphzr9fABIfNGKHZZ/1a7cHc h0ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=/Iq5wXewW+3MLQ47QaRSsdQhrIqjL73N0jwmptRfg2I=; b=RZ/B+vS+QGezZezttfQmq6K2vJsI5ZiHgEQ2kn8NJAHPBrsZL6bpAWepJHV7Ob5rq1 8SOsjzDI6FOJxqTPoAPVipd3N+Skqp1uW8RjQXW1P8rE8MwXrWArPYKydFyzvOWkz6gs 5Nmx8XkpWOSo0EiLDA/RoyS4VWJQKBtZFGBs5EDWUv8Mh1Ej9zooxsmGKip0ST0rNId9 yI84ryfCXBY7VDN+41CZwAMrLegeFJ60V6POlXUcp/gsCjlVWDYuBRXkBDYx1PL4NjSv PPhLxfUpYQUw0bX6MJCwG7a5B/EU7fgaUR0ZnXLL+UUsR2Za2tYpwmGYe9xtddWUYkMw RiYw== X-Gm-Message-State: ACrzQf0ryj+fZvEndHFLAiL9J2Ku9MCf27x4uT4rR9aAUAl+u4XkHCxe qGJhVqaJDeSyZnuqpXI+Jrg= X-Google-Smtp-Source: AMsMyM5gBeGncCbF84yTFH4n1ABrlLB8WKM8Ryt93L29N3lO44OWDACsNtGrHRQRXDcKIK2MujAfpQ== X-Received: by 2002:a17:90a:1a43:b0:20a:ea98:b962 with SMTP id 3-20020a17090a1a4300b0020aea98b962mr37411322pjl.118.1666071687002; Mon, 17 Oct 2022 22:41:27 -0700 (PDT) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:9d:2:f7bc:1bb5:e0b1:92cb]) by smtp.gmail.com with ESMTPSA id z7-20020a1709027e8700b00172f4835f53sm7597435pla.192.2022.10.17.22.41.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Oct 2022 22:41:26 -0700 (PDT) From: Dmitry Torokhov To: Bartosz Golaszewski , Linus Walleij Cc: Alexander Stein , linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, Andy Shevchenko , Daniel Thompson , linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH v3 06/10] gpiolib: of: add a quirk for reset line for Cirrus CS42L56 codec Date: Mon, 17 Oct 2022 22:41:07 -0700 Message-Id: <20221011-gpiolib-quirks-v3-6-eae9cc2ed0a1@gmail.com> X-Mailer: git-send-email 2.38.0.413.g74048e4d9e-goog In-Reply-To: <20221011-gpiolib-quirks-v3-0-eae9cc2ed0a1@gmail.com> References: <20221011-gpiolib-quirks-v3-0-eae9cc2ed0a1@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Mailer: b4 0.11.0-dev-5166b Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The controller is using non-standard "cirrus,gpio-nreset" name for its reset gpio property, whereas gpiod API expects "-gpios". Add a quirk so that gpiod API will still work on unmodified DTSes. Reviewed-by: Daniel Thompson Reviewed-by: Linus Walleij Signed-off-by: Dmitry Torokhov --- drivers/gpio/gpiolib-of.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index a9cedc39a245..ffdbac2eeaa6 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -418,6 +418,9 @@ static struct gpio_desc *of_find_gpio_rename(struct dev= ice_node *np, { "wlf,ldo2ena", NULL, NULL }, /* WM8994 */ #endif =20 +#if IS_ENABLED(CONFIG_SND_SOC_CS42L56) + { "reset", "cirrus,gpio-nreset", "cirrus,cs42l56" }, +#endif #if IS_ENABLED(CONFIG_SND_SOC_TLV320AIC3X) { "reset", "gpio-reset", "ti,tlv320aic3x" }, { "reset", "gpio-reset", "ti,tlv320aic33" }, --=20 b4 0.11.0-dev-5166b From nobody Thu Nov 14 08:03:40 2024 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 73D7DC43217 for ; Tue, 18 Oct 2022 05:42:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230436AbiJRFmC (ORCPT ); Tue, 18 Oct 2022 01:42:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230301AbiJRFli (ORCPT ); Tue, 18 Oct 2022 01:41:38 -0400 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64A019E2E8; Mon, 17 Oct 2022 22:41:30 -0700 (PDT) Received: by mail-pj1-x1034.google.com with SMTP id p3-20020a17090a284300b0020a85fa3ffcso16327042pjf.2; Mon, 17 Oct 2022 22:41:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=Wp1cBpWUY30jjN2J7CcGdlUhYOxMYiDZ9klcTi4agnU=; b=ee8rh4QG2mAL7Ri/3NtGm/AHCynx43fRJ5aRgRJR/rvsR5wTw4Tw04fE+heq/NH2gx /NCfeGqVp/p+aj2pS+E4ujKOQDA/DuV1KoEDSx48yWFOBP4lWUBkErwbCzXplrX/Fscq WLqvn0iEEYZRmuu1zbIs9qhbKBpA1xS6lu+PpOaNnOuwBQ7/GzH6Lb+xk0jPVWMZDiZ3 iyZ9K+RNP185XOSck/dWYS+W7gQAdVcUXzK0PbXoNrQU9H7iuxQ0ulYD7NNfHkkaMeMI jF6tjXA6BCcJcasknRWtW5KPX6IPeyTYUerhW0kq9hSLwOfAPo+YqXXr/x5w79zKhVfV NURw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=Wp1cBpWUY30jjN2J7CcGdlUhYOxMYiDZ9klcTi4agnU=; b=Dikrpf+wq46eozRfyRpeBjuKgp32NznnImEvP3I/HgS6lwi/rExR0EjY/UiemxGHXR s3cJ7ctGTc7okz6DFEkmk3YaqeCpdSKzYfjRCu2lkwL0ddYg2/S8kzS+ie8hbcwKyi8+ yDCHLV1H7YcFf5dO7tLOIoNcXtxW4m8BERO4Q/kwyf2KnZ19DYC0vBt5u0nmW0m6887j cAeW0L2fEyY0+eYIx6sJefqD45Fx9BtLHlv2TxFV7zLbX0SueE+0V7dBN2ABJkfsjPUM l+UKuDzo9XE/NRlNYqwzqndod4HsAzfvuHNWsZSC71KolO7gxj2o0DHzMLkWcZLWbS8y mgrQ== X-Gm-Message-State: ACrzQf3mVNtYO8wZ1gi6oJCae5OPhrjglD/xlnKTpOBAaeJwSsGM3s1N crtSdr6ymYHkvfwxT5H+RjY= X-Google-Smtp-Source: AMsMyM72OZc8jyvkubedFterjeulwVvYQX/Vfc+Prm+hEtd0voYoAJr9Lpg4D227RLB7V7esYmNEag== X-Received: by 2002:a17:90b:1e0b:b0:20d:7ddf:9b08 with SMTP id pg11-20020a17090b1e0b00b0020d7ddf9b08mr1665378pjb.187.1666071688833; Mon, 17 Oct 2022 22:41:28 -0700 (PDT) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:9d:2:f7bc:1bb5:e0b1:92cb]) by smtp.gmail.com with ESMTPSA id z7-20020a1709027e8700b00172f4835f53sm7597435pla.192.2022.10.17.22.41.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Oct 2022 22:41:28 -0700 (PDT) From: Dmitry Torokhov To: Bartosz Golaszewski , Linus Walleij Cc: Alexander Stein , linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, Andy Shevchenko , Daniel Thompson , linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH v3 07/10] gpiolib: of: add a quirk for legacy names in MOXA ART RTC Date: Mon, 17 Oct 2022 22:41:08 -0700 Message-Id: <20221011-gpiolib-quirks-v3-7-eae9cc2ed0a1@gmail.com> X-Mailer: git-send-email 2.38.0.413.g74048e4d9e-goog In-Reply-To: <20221011-gpiolib-quirks-v3-0-eae9cc2ed0a1@gmail.com> References: <20221011-gpiolib-quirks-v3-0-eae9cc2ed0a1@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Mailer: b4 0.11.0-dev-5166b Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The driver is using non-standard "gpio-rtc-data", "gpio-rtc-sclk", and "gpio-rtc-reset" names for properties describing its gpios. In preparation to converting to the standard naming ("rtc-*-gpios") and switching the driver to gpiod API add a quirk to gpiolib to keep compatibility with existing DTSes. Signed-off-by: Dmitry Torokhov --- drivers/gpio/gpiolib-of.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index ffdbac2eeaa6..d22498c72a67 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -390,6 +390,11 @@ static struct gpio_desc *of_find_gpio_rename(struct de= vice_node *np, #if IS_ENABLED(CONFIG_MFD_ARIZONA) { "wlf,reset", NULL, NULL }, #endif +#if IS_ENABLED(CONFIG_RTC_DRV_MOXART) + { "rtc-data", "gpio-rtc-data", "moxa,moxart-rtc" }, + { "rtc-sclk", "gpio-rtc-sclk", "moxa,moxart-rtc" }, + { "rtc-reset", "gpio-rtc-reset", "moxa,moxart-rtc" }, +#endif #if IS_ENABLED(CONFIG_NFC_MRVL_I2C) { "reset", "reset-n-io", "marvell,nfc-i2c" }, #endif --=20 b4 0.11.0-dev-5166b From nobody Thu Nov 14 08:03:40 2024 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 A9CBBC433FE for ; Tue, 18 Oct 2022 05:42:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230480AbiJRFmM (ORCPT ); Tue, 18 Oct 2022 01:42:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230019AbiJRFlo (ORCPT ); Tue, 18 Oct 2022 01:41:44 -0400 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8446A3F60; Mon, 17 Oct 2022 22:41:31 -0700 (PDT) Received: by mail-pj1-x102f.google.com with SMTP id a6-20020a17090abe0600b0020d7c0c6650so16363802pjs.0; Mon, 17 Oct 2022 22:41:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=aAo5oGxoQQ9M35JSkjwS/M3VaYU6KO6LohL0MAi6tfs=; b=Nj7SpUxqGWO/g5w8qtXKXYOgpeXvQWI0giRLoUtM/08fFN1XpvrQ0O30qHx6FrIfIb C/CR50B74wIm07MrIzIj6cC9kLGf2G/5cp/sHdMQMrdazlroSc+Biv2BC5VqQWqP8915 yTXE3pSWpXjhjKFf/yZTiJxImEV4wPYpJPLZAa9RAarPTxWVoo9PbZ6oyL8zH3jeSHOX XmTTLNZMCJ01LDAHOhv+hgMcaboEyicpyUtz9Ro8apyzA9Uy5JwauG/RDI/aCe94GHvv PpVjGTBmJmx+n+35E9c5u4KL4j2/nut1WZu7AKFv4Gdyfrbkopv6yiB/4Md5dVvGf/vT CwQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=aAo5oGxoQQ9M35JSkjwS/M3VaYU6KO6LohL0MAi6tfs=; b=Mvb2EvusChTSlW02SEXCVuOs2gpQmiX0Myw/NGIpxX1mhdEX9QHzyVKs3gD6z4PpZ2 vk3ieNtQDMeJXPtdo3kVMvRyWdLKT5KeJFOSDQ5BtPU1Fdh5b5T3IZZuM/lrSEU1rD9F FVn31FWc7wtbBDTdz8r8q3XtPI2ppbHxDh63kR4p61Uxdd7LIA5bPgaKSkIXqtR1xMGf 7el66ZNgz8b7Dwadk58eHz9/UclWmpACLLj5MwE+pFPnX4ZT/4H+yPyKyKUry15o1eE7 E5uwvRX9z1rBqWXe/EPSGdgShrntVpeLRWp5XgYmnNtewu2e7vc1Be/urXUbCa95AbEF 6nPA== X-Gm-Message-State: ACrzQf3dXVuFw26hEouLhYAhYTcjL3IVUOONwbLcRmbg1bhWkl2a9fcW Xul5A7CgVBMhxmh0Z5Baj11FhjwD14J2XA== X-Google-Smtp-Source: AMsMyM5psfIakJgMDw/HEqJqCW2SWqB/Y1AAF5bTHufNONjzn9g2OVeIPLHFUev+XHc/9EEpIwa20A== X-Received: by 2002:a17:902:b606:b0:184:1183:5f9f with SMTP id b6-20020a170902b60600b0018411835f9fmr1431169pls.84.1666071690510; Mon, 17 Oct 2022 22:41:30 -0700 (PDT) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:9d:2:f7bc:1bb5:e0b1:92cb]) by smtp.gmail.com with ESMTPSA id z7-20020a1709027e8700b00172f4835f53sm7597435pla.192.2022.10.17.22.41.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Oct 2022 22:41:29 -0700 (PDT) From: Dmitry Torokhov To: Bartosz Golaszewski , Linus Walleij Cc: Alexander Stein , linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, Andy Shevchenko , Daniel Thompson , linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH v3 08/10] gpiolib: of: factor out code overriding gpio line polarity Date: Mon, 17 Oct 2022 22:41:09 -0700 Message-Id: <20221011-gpiolib-quirks-v3-8-eae9cc2ed0a1@gmail.com> X-Mailer: git-send-email 2.38.0.413.g74048e4d9e-goog In-Reply-To: <20221011-gpiolib-quirks-v3-0-eae9cc2ed0a1@gmail.com> References: <20221011-gpiolib-quirks-v3-0-eae9cc2ed0a1@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Mailer: b4 0.11.0-dev-5166b Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are several instances where we use a separate property to override polarity specified in gpio property. Factor it out into a separate function. Reviewed-by: Linus Walleij Signed-off-by: Dmitry Torokhov --- drivers/gpio/gpiolib-of.c | 48 +++++++++++++++++++++++++++----------------= ---- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index d22498c72a67..6faf0dc7bc31 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -130,6 +130,28 @@ bool of_gpio_need_valid_mask(const struct gpio_chip *g= c) return false; } =20 +/* + * Overrides stated polarity of a gpio line and warns when there is a + * discrepancy. + */ +static void of_gpio_quirk_polarity(const struct device_node *np, + bool active_high, + enum of_gpio_flags *flags) +{ + if (active_high) { + if (*flags & OF_GPIO_ACTIVE_LOW) { + pr_warn("%s GPIO handle specifies active low - ignored\n", + of_node_full_name(np)); + *flags &=3D ~OF_GPIO_ACTIVE_LOW; + } + } else { + if (!(*flags & OF_GPIO_ACTIVE_LOW)) + pr_info("%s enforce active low on GPIO handle\n", + of_node_full_name(np)); + *flags |=3D OF_GPIO_ACTIVE_LOW; + } +} + static void of_gpio_flags_quirks(const struct device_node *np, const char *propname, enum of_gpio_flags *flags, @@ -145,7 +167,7 @@ static void of_gpio_flags_quirks(const struct device_no= de *np, (!(strcmp(propname, "enable-gpio") && strcmp(propname, "enable-gpios")) && of_device_is_compatible(np, "regulator-gpio")))) { - bool active_low =3D !of_property_read_bool(np, + bool active_high =3D of_property_read_bool(np, "enable-active-high"); /* * The regulator GPIO handles are specified such that the @@ -153,13 +175,7 @@ static void of_gpio_flags_quirks(const struct device_n= ode *np, * the polarity of the GPIO line. Any phandle flags must * be actively ignored. */ - if ((*flags & OF_GPIO_ACTIVE_LOW) && !active_low) { - pr_warn("%s GPIO handle specifies active low - ignored\n", - of_node_full_name(np)); - *flags &=3D ~OF_GPIO_ACTIVE_LOW; - } - if (active_low) - *flags |=3D OF_GPIO_ACTIVE_LOW; + of_gpio_quirk_polarity(np, active_high, flags); } /* * Legacy open drain handling for fixed voltage regulators. @@ -200,18 +216,10 @@ static void of_gpio_flags_quirks(const struct device_= node *np, * conflict and the "spi-cs-high" flag will * take precedence. */ - if (of_property_read_bool(child, "spi-cs-high")) { - if (*flags & OF_GPIO_ACTIVE_LOW) { - pr_warn("%s GPIO handle specifies active low - ignored\n", - of_node_full_name(child)); - *flags &=3D ~OF_GPIO_ACTIVE_LOW; - } - } else { - if (!(*flags & OF_GPIO_ACTIVE_LOW)) - pr_info("%s enforce active low on chipselect handle\n", - of_node_full_name(child)); - *flags |=3D OF_GPIO_ACTIVE_LOW; - } + bool active_high =3D of_property_read_bool(child, + "spi-cs-high"); + of_gpio_quirk_polarity(child, active_high, + flags); of_node_put(child); break; } --=20 b4 0.11.0-dev-5166b From nobody Thu Nov 14 08:03:40 2024 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 D8C7CC4332F for ; Tue, 18 Oct 2022 05:42:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230274AbiJRFmQ (ORCPT ); Tue, 18 Oct 2022 01:42:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230333AbiJRFlo (ORCPT ); Tue, 18 Oct 2022 01:41:44 -0400 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14F3AA344C; Mon, 17 Oct 2022 22:41:33 -0700 (PDT) Received: by mail-pj1-x102f.google.com with SMTP id 70so12977283pjo.4; Mon, 17 Oct 2022 22:41:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=QaKCpTaQOM7oy+irhSb/L7sMiah4MLH0I+sgYpZFdYA=; b=YZNP16yD09yoREPsWOruNPclr4jdwc2OvyEtL+Q/xMqzBvIrpr3WxzzAwOPLbp4e7L eefS9hRfZcfgMrZP47TIwnO/C0aOPslNe5DPDfWxS37bzccir2OFPHNwGgZUIubcIFnc nhjGKqgSpnJDGy8rKC8bpolKaHqfT6o71TCXMnmidh1JJCpdyTBhrsBENtuqWLh6Ud6g 4u5D4nG/JVx003mINsDiyaBR1LH2OpOl35AeNOJ7Qismy8SixfjVhmeUxBOtTIwViKBE njHD2kw4FHEoWZwjYBCs7xmHJoF/5xkglS+/xto323zYrhBpzTYsQztXVDK3xasTeb/c t3Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=QaKCpTaQOM7oy+irhSb/L7sMiah4MLH0I+sgYpZFdYA=; b=E5s+UfZVJ+cy8h36BLbxosIsT+GZBPfbrgluydgKJiXgmPemwQbWAAEzIwOWuCEMC2 SvHDNsQH35IE9EMKsEtgBw5S8ClQlpPCPxZV/A2i30VlXmCv2Qkpx5q36xj2+QBNCgIZ BW6zNT5tif2goMEfC/K2/wwp0KhEM5nq7bI3gZ8CAR1z2tWfsKG27xAVs5BgvcQIKwT0 /NSn7dTTkPbKxaARB3mG8id4YRCRQ2Txx5rvT7AFju6Sina9XKXLE9Oel9oEdj/O+SZh Q+CAxTWFWgwi5zcRJA1JFckXYfcgFRUaPpEXxyGGYee3+hyoc9uGznMw0Y8EOPrY6yUa smJw== X-Gm-Message-State: ACrzQf3lB/UWd9OIpXc1NOoR3LSr/9SAOLgCXPregUZGUDV7Im0PvINn u92BS+VQPOfIKQTVt8kxNdheDhxm9xjX0Q== X-Google-Smtp-Source: AMsMyM5fllnPD7r8O0aTtwSrfbMe9atjxB7xfGjnHWOFmMUSWnF5KjSvkJlnzTVHw09BY7+BGejjcw== X-Received: by 2002:a17:903:200a:b0:184:1881:bfd1 with SMTP id s10-20020a170903200a00b001841881bfd1mr1545243pla.95.1666071692411; Mon, 17 Oct 2022 22:41:32 -0700 (PDT) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:9d:2:f7bc:1bb5:e0b1:92cb]) by smtp.gmail.com with ESMTPSA id z7-20020a1709027e8700b00172f4835f53sm7597435pla.192.2022.10.17.22.41.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Oct 2022 22:41:31 -0700 (PDT) From: Dmitry Torokhov To: Bartosz Golaszewski , Linus Walleij Cc: Alexander Stein , linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, Andy Shevchenko , Daniel Thompson , linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH v3 09/10] gpiolib: of: add quirk for phy reset polarity for Freescale Ethernet Date: Mon, 17 Oct 2022 22:41:10 -0700 Message-Id: <20221011-gpiolib-quirks-v3-9-eae9cc2ed0a1@gmail.com> X-Mailer: git-send-email 2.38.0.413.g74048e4d9e-goog In-Reply-To: <20221011-gpiolib-quirks-v3-0-eae9cc2ed0a1@gmail.com> References: <20221011-gpiolib-quirks-v3-0-eae9cc2ed0a1@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Mailer: b4 0.11.0-dev-5166b Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Bindings for Freescale Fast Ethernet Controller use a separate property "phy-reset-active-high" to specify polarity of its phy gpio line. To allow converting the driver to gpiod API we need to add this quirk to gpiolib. Reviewed-by: Linus Walleij Signed-off-by: Dmitry Torokhov --- drivers/gpio/gpiolib-of.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index 6faf0dc7bc31..c2a55ffb2b20 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -231,6 +231,33 @@ static void of_gpio_flags_quirks(const struct device_n= ode *np, !strcmp(propname, "snps,reset-gpio") && of_property_read_bool(np, "snps,reset-active-low")) *flags |=3D OF_GPIO_ACTIVE_LOW; + + /* + * Freescale Fast Ethernet Controller uses a separate property to + * describe polarity of the phy reset line. + */ + if (IS_ENABLED(CONFIG_FEC)) { + static const char * const fec_devices[] =3D { + "fsl,imx25-fec", + "fsl,imx27-fec", + "fsl,imx28-fec", + "fsl,imx6q-fec", + "fsl,mvf600-fec", + "fsl,imx6sx-fec", + "fsl,imx6ul-fec", + "fsl,imx8mq-fec", + "fsl,imx8qm-fec", + "fsl,s32v234-fec", + NULL + }; + + if (!strcmp(propname, "phy-reset-gpios") && + of_device_compatible_match(np, fec_devices)) { + bool active_high =3D of_property_read_bool(np, + "phy-reset-active-high"); + of_gpio_quirk_polarity(np, active_high, flags); + } + } } =20 /** --=20 b4 0.11.0-dev-5166b From nobody Thu Nov 14 08:03:40 2024 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 7F718C433FE for ; Tue, 18 Oct 2022 05:42:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230513AbiJRFmV (ORCPT ); Tue, 18 Oct 2022 01:42:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230389AbiJRFl6 (ORCPT ); Tue, 18 Oct 2022 01:41:58 -0400 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0C789E2E9; Mon, 17 Oct 2022 22:41:35 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id 10so12876793pli.0; Mon, 17 Oct 2022 22:41:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=4G7tl3tu203DyVK2JSTYCp8XTOzlUsDNSnxbzKDtrDc=; b=DY8rsTzt3XFTA3ilefLgkcsB8eFjSt+06weMni51hOasFmIa7Jotx4YgXvtmEAbbDx UPbF2b01JU/WPhhYVVgi7BdTUOk0oJ5LlzsyQb6967vDVgogm+zZwTUawXfemy0JCcSU 2jplFegk3aDg4yURx0rzogEtqpYN2xZh/8kYwB297rEnsQzASNl19AuUJiDFQ9svKcub rAcoQ++Y1eKWirRU5LruBEIcYZLfwu6zso0C7oogfa/o/vGd4cr05NBVUL2Jsg8mOI9i MncnVg6O8Uj4+AqllFDOgKhdPwVIH09TmVo2O62iPN7KoLh4EGoQUb0hXT7aPtibgcCt CZpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=4G7tl3tu203DyVK2JSTYCp8XTOzlUsDNSnxbzKDtrDc=; b=7RbL3BNhbRZ1w/ZkmvSMaYlv1v8UqnNVR7k4mocmcpxwUubQDn5lsm4O7AP9sXTsqM TZ2VR1DOHmKWdtCOkQkLY7MyEjPyJWlnj7stqeiI6D6eqKD72ePScS3BkxGLIU2Gygh4 TcYiAf68s66k0k4tE08Xy6XuRQlN3rx6AxqD/aOJQ7taNdaiwVfBoNoSgrC+2fPJIGvS Qa7DnEHj+9x2GxyOOyYZ+/kfTrDVs/x4M7npPsTGH4mJTisCkINpH3WaYfINtwxSJoJI Wvjjnz3QJH91qR2Zv3aKr877xDSrcRbTwH9ht2OPct9+XGXalmI/RM/7Lfjubnb478n6 +ZPg== X-Gm-Message-State: ACrzQf1+veoF0WCxQ4iCcbvaY9xPlRAMsFIvCuIbyFhKJM4NVnlTEA9n CQP/uvQxcqZBVdlcU1H4xp8= X-Google-Smtp-Source: AMsMyM5aCgV2chNKlAxGvAIPaU6HYil84zewpav+AIFvUMP05smKopj/ebnWwPFQRHb0YwRVY+VLQw== X-Received: by 2002:a17:90b:4f4e:b0:20d:9f5b:abbf with SMTP id pj14-20020a17090b4f4e00b0020d9f5babbfmr1748885pjb.148.1666071694222; Mon, 17 Oct 2022 22:41:34 -0700 (PDT) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:9d:2:f7bc:1bb5:e0b1:92cb]) by smtp.gmail.com with ESMTPSA id z7-20020a1709027e8700b00172f4835f53sm7597435pla.192.2022.10.17.22.41.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Oct 2022 22:41:33 -0700 (PDT) From: Dmitry Torokhov To: Bartosz Golaszewski , Linus Walleij Cc: Alexander Stein , linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, Andy Shevchenko , Daniel Thompson , linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH v3 10/10] gpiolib: of: add a quirk for reset line polarity for Himax LCDs Date: Mon, 17 Oct 2022 22:41:11 -0700 Message-Id: <20221011-gpiolib-quirks-v3-10-eae9cc2ed0a1@gmail.com> X-Mailer: git-send-email 2.38.0.413.g74048e4d9e-goog In-Reply-To: <20221011-gpiolib-quirks-v3-0-eae9cc2ed0a1@gmail.com> References: <20221011-gpiolib-quirks-v3-0-eae9cc2ed0a1@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Mailer: b4 0.11.0-dev-5166b Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Existing DTS that use legacy (non-standard) property name for the reset line "gpios-reset" also specify incorrect polarity (0 which maps to "active high"). Add a quirk to force polarity to "active low" so that once driver is converted to gpiod API that pays attention to line polarity it will work properly. Reviewed-by: Linus Walleij Signed-off-by: Dmitry Torokhov --- drivers/gpio/gpiolib-of.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index c2a55ffb2b20..52616848a37c 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -152,11 +152,47 @@ static void of_gpio_quirk_polarity(const struct devic= e_node *np, } } =20 +/* + * This quirk does static polarity overrides in cases where existing + * DTS specified incorrect polarity. + */ +static void of_gpio_try_fixup_polarity(const struct device_node *np, + const char *propname, + enum of_gpio_flags *flags) +{ + static const struct { + const char *compatible; + const char *propname; + bool active_high; + } gpios[] =3D { +#if !IS_ENABLED(CONFIG_LCD_HX8357) + /* + * Himax LCD controllers used incorrectly named + * "gpios-reset" property and also specified wrong + * polarity. + */ + { "himax,hx8357", "gpios-reset", false }, + { "himax,hx8369", "gpios-reset", false }, +#endif + }; + unsigned int i; + + for (i =3D 0; i < ARRAY_SIZE(gpios); i++) { + if (of_device_is_compatible(np, gpios[i].compatible) && + !strcmp(propname, gpios[i].propname)) { + of_gpio_quirk_polarity(np, gpios[i].active_high, flags); + break; + } + } +} + static void of_gpio_flags_quirks(const struct device_node *np, const char *propname, enum of_gpio_flags *flags, int index) { + of_gpio_try_fixup_polarity(np, propname, flags); + /* * Some GPIO fixed regulator quirks. * Note that active low is the default. --=20 b4 0.11.0-dev-5166b