Received: by 2002:a05:6a10:8395:0:0:0:0 with SMTP id n21csp351822pxh; Tue, 9 Nov 2021 11:46:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJyaCAD9FeOhvhblF3UugkJVP5G9KU/B4zsNzY2zGiyTQosRdFtehwCJWYlgtULF/OwCKE11 X-Received: by 2002:a17:907:1b16:: with SMTP id mp22mr12968688ejc.503.1636487174312; Tue, 09 Nov 2021 11:46:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636487174; cv=none; d=google.com; s=arc-20160816; b=DLnqcFnkF2KMEdmRUAxKJgjw3PvkJV/yRCc8Rk+UMJGg2RtWtLjsVo6Hpjs4nB+KEr A4uXIXirzpLxbHrlF33VzAJyrhy26rYJ00Ydh1qNUuY1qMwU4vkoXpKsFoQDld2IS6qK oRDFEeh2oWAoJJzySQoXmv9IH5l65WJGlpAEh7CXjOLpQrZs3hypL/keZ3XNZYZWWqx0 Ouv25143QnNAtFX+ElARU0jJ4Ke4KQlW02NBUs/4wdWEU4vE9ZyCVgdsJbzaU60Ho3Bs mIX/OhPVlHtonoN6IYi6pWjjZEjEk67Siu5yJgLw/TwT2DoaSRdFbJRblP/Tqbbx1eWB azbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Cde9sTeLd0vmgQnDHFOawLma/945mJa1LBSD0r3d4s0=; b=D9NiZicRrtyU/eCEHeZKnC5ALf4fe84AVmyd4/waFdodBO+NbtbiuAOKf/gt27Eiji OmQV3mHUxpBv5TMeGhxKL3K3+KWC8bxyJyriMyiynDy0qvjzanQ0mrU+2fTKV3cEm7Mk +PDJBuqm7ihR9VWeFo175u9yIi2FFyvjlGJtLYoPcasDH5skM2paQHqL+s3U1uoGmhWQ 5VG7ip/f0vfOA+rAfUAWUi8KvnMcdRQXuZUYCxdzc8DhibofIVqGfLzSV98ZSQ/2SqXu LyM7pEq9UOYbOAAf0E99b1xfNiHWEFEgE5DRKsldZK7TpC7i8jT0K5CYrWVKdu5Cgi3z mlzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KUI62Pd4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y9si42452115edd.10.2021.11.09.11.45.47; Tue, 09 Nov 2021 11:46:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KUI62Pd4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230136AbhKILG3 (ORCPT + 99 others); Tue, 9 Nov 2021 06:06:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236019AbhKILG2 (ORCPT ); Tue, 9 Nov 2021 06:06:28 -0500 Received: from mail-ot1-x334.google.com (mail-ot1-x334.google.com [IPv6:2607:f8b0:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 637E5C0613F5 for ; Tue, 9 Nov 2021 03:03:42 -0800 (PST) Received: by mail-ot1-x334.google.com with SMTP id v40-20020a056830092800b0055591caa9c6so30301654ott.4 for ; Tue, 09 Nov 2021 03:03:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Cde9sTeLd0vmgQnDHFOawLma/945mJa1LBSD0r3d4s0=; b=KUI62Pd4Hj8HYSVaTZVhn3KQ/1ACqdRRbXUCxDm7Cl8VDNJ30jya31vSmTFZoNbTqZ alW0aZBNZ6y07fcs1h/IQ76exO8Tt+nUWG1WLdpjZXJzbv7JBbkb6Th0s6hutWHTMJul zNpfutFxzNwYz5uCgG6ipTjXUBqGZwv0pPQhMTLUoHB/kgUresoM+UTy0SXno5zo4vnr KpufGMJgF7Sk3SuTLYslA+Oa1Dq/gzdkM0jNnr/+O7z/76BsdwzbRGb2HJtr2gdPTcuG GjbBl9U35n20sIBbapohjJXCfJYxQoczB9QGluiaDkmhQEyS+U9OT1rRoyV7/1LookLj DINw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Cde9sTeLd0vmgQnDHFOawLma/945mJa1LBSD0r3d4s0=; b=jYqPtqP5w9s8KjjaVDGZNw+0k42pNVNfMeWnSA+b0vqdfiRNpFFLOcKrEi90ipyJrT jSnvdHYV5yWf2XPC4QGspGpBq3sh2SZFfHDcj/cA0afdUtkup9TZVr/wfYUBhGh8492D 8ApuS6iPP2Lg2YfTH9ZITwgMWQc1syPZUV8e5GwdDbffe7QGbiWFUOCe7nr1E59oVRpW TExZYNVm5czoRZpDpwRMsRTiFhZMM+z/E16HhNNg9ncqnqnB6EMpK84X87GtceHadjAd 2R4+yh8XczWMxt83bLwVR99mZCzhuMGkP792F5HUMv2kynMntlX8/DLHS2UcfvgGulGk J8hg== X-Gm-Message-State: AOAM5307KbKG6MLVtci1b6BLyfvBLW7H5S2eYdVxZ8olyKDN3JioIiTA xorBeRjQZ6OqC0fo//WIFXy4SBjXVe6vM4v1u6l7yQ== X-Received: by 2002:a05:6830:2809:: with SMTP id w9mr5110934otu.237.1636455821654; Tue, 09 Nov 2021 03:03:41 -0800 (PST) MIME-Version: 1.0 References: <20210921043936.468001-1-andrew@aj.id.au> <20210921043936.468001-2-andrew@aj.id.au> In-Reply-To: <20210921043936.468001-2-andrew@aj.id.au> From: Linus Walleij Date: Tue, 9 Nov 2021 12:03:30 +0100 Message-ID: Subject: Re: [PATCH 1/2] leds: pca955x: Make the gpiochip always expose all pins To: Andrew Jeffery Cc: linux-leds@vger.kernel.org, linux-gpio@vger.kernel.org, clg@kaod.org, robh+dt@kernel.org, joel@jms.id.au, pavel@ucw.cz, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org, andy.shevchenko@gmail.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 21, 2021 at 6:40 AM Andrew Jeffery wrote: > The devicetree binding allows specifying which pins are GPIO vs LED. > Limiting the instantiated gpiochip to just these pins as the driver > currently does requires an arbitrary mapping between pins and GPIOs, but > such a mapping is not implemented by the driver. As a result, > specifying GPIOs in such a way that they don't map 1-to-1 to pin indexes > does not function as expected. > > Establishing such a mapping is more complex than not and even if we did, > doing so leads to a slightly hairy userspace experience as the behaviour > of the PCA955x gpiochip would depend on how the pins are assigned in the > devicetree. Instead, always expose all pins via the gpiochip to provide > a stable interface and track which pins are in use. > > Specifying a pin as `type = ;` in the devicetree > becomes a no-op. > > I've assessed the impact of this change by looking through all of the > affected devicetrees as of the tag leds-5.15-rc1: > > ``` > $ git grep -l 'pca955[0123]' $(find . -name dts -type d) > arch/arm/boot/dts/aspeed-bmc-ibm-everest.dts > arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts > arch/arm/boot/dts/aspeed-bmc-opp-mihawk.dts > arch/arm/boot/dts/aspeed-bmc-opp-mowgli.dts > arch/arm/boot/dts/aspeed-bmc-opp-swift.dts > arch/arm/boot/dts/aspeed-bmc-opp-tacoma.dts > arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts > ``` > > These are all IBM-associated platforms. I've analysed both the > devicetrees and schematics where necessary to determine whether any > systems hit the hazard of the current broken behaviour. For the most > part, the systems specify the pins as either all LEDs or all GPIOs, or > at least do so in a way such that the broken behaviour isn't exposed. > > The main counter-point to this observation is the Everest system whose > devicetree describes a large number of PCA955x devices and in some cases > has pin assignments that hit the hazard. However, there does not seem to > be any use of the affected GPIOs in the userspace associated with > Everest. > > Regardless, any use of the hazardous GPIOs in Everest is already broken, > so let's fix the interface and then fix any already broken userspace > with it. > > Signed-off-by: Andrew Jeffery Acked-by: Linus Walleij Yours, Linus Walleij