From patchwork Tue Sep 21 04:39:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Jeffery X-Patchwork-Id: 12507225 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=-13.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham 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 0DF49C433EF for ; Tue, 21 Sep 2021 04:42:06 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id CB041610A0 for ; Tue, 21 Sep 2021 04:42:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org CB041610A0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=aj.id.au Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To: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=TzYC49SXg5XE/IRYiuU7IRuU2zbBYcP4TP1Byte9f6M=; b=vYRwSpSuBLxEOY rMA6ViJbryKeow6W0D1xU3+mpg/mxk7O8etcv9HMMViZeuvDsMXluMs8VvDRRYZ4RRqosHggbOlxf IcHHSvRvvalhe2prcDt69napU/mpwwZDMuA96rT+Z4ZPt2pnRgMc9SZU0qHqLuT72bGuwQM+pCBYc HoQnboJY/hfSDPRRbL/P1olCsYaDqQ8yAsVLnnqSZkqGwik2nGG9WlQd+TEPtaDnS1R23xyvlc6/w PKRihz+DUEphrrOwA4UKiYXeAM0ADmpR2Kcq+e197/4Ago29cmrmV0C5WA6B3BWW4miXz2xKUB0TV msSPffbnLompm8jl+grg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mSXZb-003a8Q-4e; Tue, 21 Sep 2021 04:40:03 +0000 Received: from wnew4-smtp.messagingengine.com ([64.147.123.18]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mSXZX-003a7C-6k for linux-arm-kernel@lists.infradead.org; Tue, 21 Sep 2021 04:40:00 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailnew.west.internal (Postfix) with ESMTP id 01FA52B01422; Tue, 21 Sep 2021 00:39:51 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Tue, 21 Sep 2021 00:39:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aj.id.au; h=from :to:cc:subject:date:message-id:mime-version :content-transfer-encoding; s=fm3; bh=I4ve/cgxK4c8BY7+UtD8bEL+nk Zo9i2k6Rhodknqgww=; b=E61X9XFXPJOOQayHDvUcuo+rTPfjF/ky5zk3Mi4hS2 rVVK7HKI5BQweODHKuu2SNklSikLEnAOIzatUf1x7kuwKzatQtG8tUPknIs5tEwC WeIgCgSwgZnqaYJajBac1iUb5AEU7Crh7uNRm4PudjOuvyrWKcwmt9GooSEqsKH9 CYmYdY9A5VMxgX62Qu87Jsm9OC9KHz5PIv8rCwVpdF8khFJoT9I/55qqnn1HRQT8 GQPGdPZRlM4kemArr9OEUtxrC47/24fL2tFGdsL4y9rYZ8UUsMYUxWenQrbWKH/w GMqT7P2AKDB/oK7+vfBqLNGXOajv2TfAVNMWd2Ap72gA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=I4ve/cgxK4c8BY7+U tD8bEL+nkZo9i2k6Rhodknqgww=; b=QY39RzHwtcUTsQe560mXBFfewJazNxmHD kwLUpf7ulzx9P9K3cbWHYtxi73rS8UXVYnkpWgoNnUWYVwmBe5MIKYeoPJqwYS7p 8vdPnFh/xwbXc/Y0lcfECT9cswW4rB3WpfzGetDElmk99o6KkJywz3cZZ/0q/QdQ TOT14YNDOEY4N5PeZ6qzRHueeixC8eUkNUKd/Gg8yDHzkXjBgdahpO2UkJFXDtKV bhpxE91z17KsYiSiBa9KZrXRv1b30oKbhiFR4j9MdF/lrOkveu8Po4QdJY5VRFur Q/jpmVZwhK+fYOmEguV54k4krU1zeC/MYZDeXMEY0Yw1zCpbTogsw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudeifedgkeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgggfestdekredtre dttdenucfhrhhomheptehnughrvgifucflvghffhgvrhihuceorghnughrvgifsegrjhdr ihgurdgruheqnecuggftrfgrthhtvghrnhepieetheduveelhfdvvdejleeuhfelteevhe ffgfeitdefgeekjeefieevgfehhefgnecuffhomhgrihhnpehkvghrnhgvlhdrohhrghen ucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrnhgurh gvfiesrghjrdhiugdrrghu X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 21 Sep 2021 00:39:45 -0400 (EDT) From: Andrew Jeffery To: linux-leds@vger.kernel.org, linux-gpio@vger.kernel.org Cc: clg@kaod.org, robh+dt@kernel.org, joel@jms.id.au, pavel@ucw.cz, linus.walleij@linaro.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org, andy.shevchenko@gmail.com Subject: [PATCH 0/2] leds: pca955x: Expose GPIOs for all pins Date: Tue, 21 Sep 2021 14:09:34 +0930 Message-Id: <20210921043936.468001-1-andrew@aj.id.au> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210920_213959_294519_DE1703AA X-CRM114-Status: GOOD ( 12.60 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hello, This is a rework of a Rube Goldberg-inspired RFC I posted previously: https://lore.kernel.org/lkml/20210723075858.376378-1-andrew@aj.id.au/ This time around there's a lot less Rube - the series: 1. Contains no (ab)use of pinctrl 2. Always exposes all pins as GPIOs 3. Internally tracks the active pins Without these patches the driver limits the number of pins exposed on the gpiochip to the number of pins specified as GPIO in the devicetree, but doesn't map between the GPIO and pin number spaces. The result is that specifying offset or interleaved GPIOs in the devicetree gives unexpected behaviour in userspace. By always exposing all pins as GPIOs the patches resolve the lack of mapping between GPIO offsets and pins on the package in the driver by ensuring we always have a 1-to-1 mapping. The issue is primarily addressed by patch 1/2. Patch 2/2 makes it possible to not expose any pins as LEDs (and therefore make them all accessible as GPIOs). This has a follow-on effect of allowing the driver to bind to a device instantiated at runtime without requiring a description in the devicetree. I've tested the series under qemu to inspect the various interactions between LEDs vs GPIOs as well as conflicting GPIO requests. Please review! Andrew Andrew Jeffery (2): leds: pca955x: Make the gpiochip always expose all pins leds: pca955x: Allow zero LEDs to be specified drivers/leds/leds-pca955x.c | 65 +++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 31 deletions(-) base-commit: 239f32b4f161c1584cd4b386d6ab8766432a6ede Reviewed-by: Andy Shevchenko Reviewed-by: Linus Walleij Reviewed-by: Joel Stanley Reviewed-by: Cédric Le Goater