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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 E1B27C433DB for ; Tue, 16 Mar 2021 19:21:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B8C366507D for ; Tue, 16 Mar 2021 19:21:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236688AbhCPTUl (ORCPT ); Tue, 16 Mar 2021 15:20:41 -0400 Received: from wilbur.contactoffice.com ([212.3.242.68]:42930 "EHLO wilbur.contactoffice.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240347AbhCPTUF (ORCPT ); Tue, 16 Mar 2021 15:20:05 -0400 Received: from ichabod.co-bxl (ichabod.co-bxl [10.2.0.36]) by wilbur.contactoffice.com (Postfix) with ESMTP id DA4FAF9B for ; Tue, 16 Mar 2021 20:19:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1615922390; s=20210208-e7xh; d=mailfence.com; i=sandberg@mailfence.com; h=Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Subject:Reply-To:From:To; l=1543; bh=2gGj5NOSb+REYiRX0Fq5ZNPVzvSzaXqeYGucNszRHcI=; b=uNRHubix+GNuwbsNldf3YvZGNLvr4UXkQ0dvNXeEX7lHSaRzYvuv4hf/oDlWi7s+ UYIcODKmZMxsfyPWHVdG2t59aZQNx1uRcnp4YxhJ99RhecEXl5U8xLLnkHQ1l51dMjX 9o79vGVhPpFOlQbjLtTA5ld5eDvIPNIwz15m8pCSGK9Qv8hCaWRFKZeXYtJj0KwYxB/ tzzRH2tEG4bJY066xHLBU9piqhdbnd5WKQA7bWeOjQmfeKxdzKGV4OZQV+ZpX7Lz2ga 8LiKp+xDtRRpkdIC/jpMuTdCJ0UGb1exQCGDtp1npXZEPVKNvZTJ8icFNmPETt8Vb7C hCspNfENVw== Date: Tue, 16 Mar 2021 20:19:48 +0100 (CET) Message-ID: <545111184.50061.1615922388276@ichabod.co-bxl> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: RFC for a GPIO input muxer X-Priority: 3 Reply-To: Mauri Sandberg From: Mauri Sandberg To: Linux GPIO X-Mailer: ContactOffice Mail X-ContactOffice-Account: com:250217426 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org I am writing to you to ask for comments on the preferred way of implementing a 4-way GPIO multiplexer in the most generic way. The situation is that there is a dual 4-way multiplexer on my device and its select pins a controlled with GPIOs. The output pins of the multiplexer are connected to two other GPIOs. The datasheet of the multiplexer is here: https://assets.nexperia.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 those. The 'key-mux1' below implements a gpio-controller that drives the multiplexer and provides gpios for reading device key presses. At the moment it has 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 = "gpio-mux"; #mux-control-cells = <0>; mux-gpios = <&gpio 9 GPIO_ACTIVE_HIGH>, /* s0 */ <&gpio 11 GPIO_ACTIVE_HIGH>; /* s1 */ }; gpio2: key-mux1 { compatible = "gpio-mux-input"; mux-controls = <&mux>; gpio-controller; #gpio-cells = <2>; // GPIOs used by this node, mux pin pin-gpios = <&gpio 12 GPIO_ACTIVE_HIGH>; /* 1y */ }; keys { compatible = "gpio-keys-polled"; poll-interval = <20>; aoss { label = "aoss"; linux,code = ; gpios = <&gpio2 0 GPIO_ACTIVE_LOW>; debounce-interval = <60>; }; } Sincerely, Mauri