From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17360C433E0 for ; Wed, 17 Mar 2021 12:32:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BBCC164F41 for ; Wed, 17 Mar 2021 12:32:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229809AbhCQMba (ORCPT ); Wed, 17 Mar 2021 08:31:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230036AbhCQMbS (ORCPT ); Wed, 17 Mar 2021 08:31:18 -0400 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72660C06174A for ; Wed, 17 Mar 2021 05:31:07 -0700 (PDT) Received: by mail-pl1-x634.google.com with SMTP id j6so709749plx.6 for ; Wed, 17 Mar 2021 05:31:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=uCehQM5n09baGDMb5XhUk5RLtfCd8CSNDzQDNtr8gqA=; b=AkluZnfEnHQChAEldVi8VWw4eemWw4+337YuJwWqDxuW5aetwlBzqe8W0YZgy4iye4 LUArg80InQoLCDoctD9eJ0vg8pHiuNZIS/MO4v85p0MXnfvRJISaeG7PS4F5YZuWCIKX /Ogdy2HAmI7Y+2PLBfYHU4nXVJn+M6R32JNt40htiu14C3W2rj06wr982Lcv0s7ogCsB uSwAjLD7lRKu0qKwpEBbIqP1XJgCPmXkAEVmHL+kLpL5GsXTIt6JsySfgr1F8sOpMWPE RfF2P6SaaNJoi98MNZF+1cNEugozbJ19UNtzG4B89aykt/RUr3cU0/dh5zKDVMnRkasP IPaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=uCehQM5n09baGDMb5XhUk5RLtfCd8CSNDzQDNtr8gqA=; b=Hmu02ecMIocosLhbMwIVm3XtG3bvUer5fd0PxpVYz4CCeAWI237tGOZEKMZtN8L60H vNr4IgWV6V69kq04eI5F3Uky9m1fiB3Ryah5jR2nsMFujNMw2EkDf7fDgR7gyBq0wqa8 aVjGjgMu+aQxulImMUj3SK8umx7U/TqWBO/gtLIh4KortTFrjw3em4dMXzcWKbCNI+VI 9hCw5Zk0Leir49BLl8AilXVbheVZss40dfpczWAVP6WT11leurotADdJX1IaHUOCsmwd c4tZgxpNa3AZMUPzok9xUw2wjmmy06Gu0PzsVU4RNTQ2kl1UCNJU+p8WpZdPjAfMcyfE znAg== X-Gm-Message-State: AOAM530WlEyZgjt8WNfsAlJH5YDA3qe8uqOLR0Fv7TqS6KM3py4O+sx1 bTrtoLzCEaEQnkjjP9XsvZU0z3OV/+277uU5e5g= X-Google-Smtp-Source: ABdhPJxKLg8qfZTAA98u5c3OzjNb8Eh86gXCCpzQ491nFLhsqUCWMM5YsNe/+MFJvAN1olibAGdNbSVV6csa7/KoMUk= X-Received: by 2002:a17:90a:db49:: with SMTP id u9mr4631907pjx.181.1615984266821; Wed, 17 Mar 2021 05:31:06 -0700 (PDT) MIME-Version: 1.0 References: <545111184.50061.1615922388276@ichabod.co-bxl> In-Reply-To: From: Andy Shevchenko Date: Wed, 17 Mar 2021 14:30:50 +0200 Message-ID: Subject: Re: RFC for a GPIO input muxer To: Mauri Sandberg , Drew Fustini Cc: Linux GPIO Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org +Cc: Drew, I believe he has some thoughts about. On Wed, Mar 17, 2021 at 1:17 AM Andy Shevchenko wrote: > > > > On Tuesday, March 16, 2021, Mauri Sandberg wrote= : >> >> I am writing to you to ask for comments on the preferred way of implemen= ting a 4-way GPIO multiplexer in the most generic way. The situation is tha= t there is a dual 4-way multiplexer on my device and its select pins a cont= rolled with GPIOs. The output pins of the multiplexer are connected to two = other GPIOs. The datasheet of the multiplexer is here: https://assets.nexpe= ria.com/documents/data-sheet/74HC_HCT153.pdf >> >> This is what I have been contemplating on but I am not aware if the same= could be achieved with existing pinctrl or gpio driver or combination of t= hose. > > > To me looks like a typical pinmux. Dunno if pinctrl supports pure pinmux = and how it can handle that at runtime. > > That said, I would consider what has been done in pinctrl for that. >> >> >> The 'key-mux1' below implements a gpio-controller that drives the multip= lexer and provides gpios for reading device key presses. At the moment it h= as to be polled as interrupts are not being generated by the key presses. I= tried looking around but software interrupts did not give me any hits. >> >> I have omitted 'key-mux2' from this for clarity. >> >> mux: mux-controller { >> compatible =3D "gpio-mux"; >> #mux-control-cells =3D <0>; >> >> mux-gpios =3D <&gpio 9 GPIO_ACTIVE_HIGH>, /* s0 */ >> <&gpio 11 GPIO_ACTIVE_HIGH>; /* s1 */ >> }; >> >> gpio2: key-mux1 { >> compatible =3D "gpio-mux-input"; >> mux-controls =3D <&mux>; >> >> gpio-controller; >> #gpio-cells =3D <2>; >> >> // GPIOs used by this node, mux pin >> pin-gpios =3D <&gpio 12 GPIO_ACTIVE_HIGH>; /* 1y */ >> }; >> >> keys { >> compatible =3D "gpio-keys-polled"; >> poll-interval =3D <20>; >> >> aoss { >> label =3D "aoss"; >> linux,code =3D ; >> gpios =3D <&gpio2 0 GPIO_ACTIVE_LOW>; >> debounce-interval =3D <60>; >> }; >> } >> >> Sincerely, >> Mauri > > > > -- > With Best Regards, > Andy Shevchenko > > --=20 With Best Regards, Andy Shevchenko