Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3949603rwb; Sat, 12 Nov 2022 17:25:57 -0800 (PST) X-Google-Smtp-Source: AA0mqf6qyWnE+fdyMkDEhM9jx3QQURF2Fv4wuohytBUVqbjB5gM/U+FdPpnzA341bPVgdwcs3NO+ X-Received: by 2002:a05:6a00:1a4e:b0:563:b60:b097 with SMTP id h14-20020a056a001a4e00b005630b60b097mr8605927pfv.36.1668302757429; Sat, 12 Nov 2022 17:25:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668302757; cv=none; d=google.com; s=arc-20160816; b=iYFYcNgezqrpejKImSgfw6fTcrVPqHcCgzWam1Gj0nKlaOd8cYuJT+AF7eIgeZMCGr jm9ifagUTQR7Ekh6zS2i28UeuhnT2uoqmMD+52xL1RRUyfZtS6xkITXj06BMhL3w7IbE ZxR1KewulztafWcO+w1TiBopS26WHBu6yAy5BKN8bLIRrmeujkhxH9B9re+3vXnqnSEs 8OUBWu26P6SLjLj152V3WBBcj0wY2NNp5vIGnnR2Jwbzo4Y8hsl8bvK5ic3LlvNOd8BT zXuN93qFCIO9I4Qddk6Akp9ulPFm0u6/qn8RXDdrU2uJUGwlItRo+Ot5/nnqENJYN7U4 mFyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=B9moV2tcf0ddmvHVedu+MwgRdlsmBZvgLK4p0sh0Kag=; b=JPo4TFpoFP6p3/w8wPgz03ESoYcbd/3gMuLhVN0FgcqcdYiSrUUzpm6IBzPsR5wkBQ QmnQWlLi0mUYm54QiDr+snk/kOefCPMTrKH6sBbMaj6TGGHQwu+wGVFglo/NQtn3pmou 2KbNUTEJT48ISBb3aghXjrLS9QuuxjGGwipj9aCGTOsPSV5MdErGI9EmcLxYyesNrJsA xLqKYRU4V4kkcQs/VmCQtxzmknRhLGVXggPLs81GdTKLncOeJW0SxK8hoA5d6bYD67vz ySyScE7XpJ457g/5PftAb/IFv1OQkWvSL1NIlNQgUGLzHDrvTD9nduKes8FAPd2uqXEo SmoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MzFHzbaK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n15-20020a17090aab8f00b00205daac38absi5977155pjq.59.2022.11.12.17.25.45; Sat, 12 Nov 2022 17:25:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MzFHzbaK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S235108AbiKMBJq (ORCPT + 89 others); Sat, 12 Nov 2022 20:09:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234838AbiKMBJo (ORCPT ); Sat, 12 Nov 2022 20:09:44 -0500 Received: from mail-qt1-x832.google.com (mail-qt1-x832.google.com [IPv6:2607:f8b0:4864:20::832]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A849013F1D for ; Sat, 12 Nov 2022 17:09:43 -0800 (PST) Received: by mail-qt1-x832.google.com with SMTP id s4so5039950qtx.6 for ; Sat, 12 Nov 2022 17:09:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=B9moV2tcf0ddmvHVedu+MwgRdlsmBZvgLK4p0sh0Kag=; b=MzFHzbaKyQbKnOXzPTkgOjON2Qv8hd/hDviB3+TH1oCIWHE5zZB1hb6X2SalbSoV7n V5sNyfdL1KlMNpjXRnZdrU4NmFd/prZGDkhYi6oxUxR0OleT/VKDo8Eg4vlpuRfMHn3f dmPo/Hp/nAq9PJ5N/XhOR3u78yeKiQ8Vn0tEFOg12ve/jqHxkRBbxjDEPEJrIZ5/J8eF Bayx3llZjhdGZ+A6hZWoCz393OkeWaLocp8IMZV2cWGZp20ktSyCbINbxNO8EsuYvuiQ Mri4+5DeBd7Rt13PQyWm0nSZSM3GlfIHRs2aq1OjBy6zKtbpmUm9WjSbmd6qv/fRPPtj zc4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=B9moV2tcf0ddmvHVedu+MwgRdlsmBZvgLK4p0sh0Kag=; b=sV1CiYFpt2WCcU6lk6ALrTXPn9qsuiA+DPaRcJWsX45ID8KtjQan4z0uGtqFHoyzk0 C/wUUHph+Q4YNKVbZsDyDJ6EOITfohS3JEA4waunX/Ku0lFP4LlBXQycr/21lBaFbtJu jKkRueMbXHpv/Ki8Gy6j5+wFGSUdDjNtXe1ypba9lHBDSvEMcC6RUWdUdVaDNcPSCwXY N9PeXqsin9jd5zLNBPrvswVNCA3qtara3gLejyLGg4RxvhgYLvJL0Hso/lhKmL9yhNxH GzGLsLzUoB9tr7ixINmRYfpF+5xSyFd9Ervh3S/ujQaM4PMpvJ8Kbbs3Ktgb5uVjV9m0 d6Rw== X-Gm-Message-State: ANoB5plL1FgnvM3m3ZV5vQtStcJGQwEOO/rfyVebtr1QDiFU5mHs/a6D razfm9JPd1N1vzmfF/vH7Wpovg== X-Received: by 2002:ac8:6993:0:b0:3a5:81e1:7571 with SMTP id o19-20020ac86993000000b003a581e17571mr7252481qtq.290.1668301782781; Sat, 12 Nov 2022 17:09:42 -0800 (PST) Received: from fedora.attlocal.net (69-109-179-158.lightspeed.dybhfl.sbcglobal.net. [69.109.179.158]) by smtp.gmail.com with ESMTPSA id t6-20020a05622a180600b00343057845f7sm3552498qtc.20.2022.11.12.17.09.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Nov 2022 17:09:41 -0800 (PST) From: William Breathitt Gray To: linus.walleij@linaro.org, brgl@bgdev.pl Cc: andriy.shevchenko@linux.intel.com, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, michael@walle.cc, broonie@kernel.org, William Breathitt Gray Subject: [PATCH v2 0/4] Migrate i8255 GPIO drivers to regmap API Date: Thu, 10 Nov 2022 20:55:49 -0500 Message-Id: X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,DATE_IN_PAST_24_48, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Changes in v2: - Leveraged gpio_regmap to support GPIO functionality in 104-idi-48 driver and i8255 library - Leveraged regmap_irq to support IRQ functionality in 104-idi-48 and 104-dio-48e drivers - Removed i8255 dependency from 104-idi-48; simpler to just use gpio_regmap directly in this case - Adjust gpio_regmap to always set gpio_chip get_direction - Introduce handle_mask_sync() callback to regmap_irq API - i8255 library is simplified to a registration function, a configuration structure, and a helper macro The regmap API supports IO port accessors so we can take advantage of regmap abstractions rather than handling access to the device registers directly in the driver. The 104-dio-48e and gpio-mm modules depend on the i8255 library and are thus updated accordingly. The 104-IDI-48 is hardwired as an input-only device. Because the i8255 control registers are not exposed on the 104-IDI-48, the i8255 library doesn't provide much benefit here. In this case it's simpler to utilize the gpio_regmap API directly, so this patch series does such and removes the i8255 library dependency from the 104-idi-48 module. The first patch in this series adjusts gpio_regmap to always set gpio_chip get_direction. This patch is larger independent of the rest of the patches in the series and can be picked up separately if desired. I'm including it here because it allows the input-only 104-idi-48 driver to continue reporting offset directions after migrating to gpio_regmap. A handle_mask_sync() callback is introduced for the regmap_irq API. This is used by the 104-dio-48e driver to handle its enable/disable interrupt functionality. The 104-DIO-48E has a single register to handle enabling/disabling interrupts: a write of any value to this register enables interrupts, while any read disables interrupts. By leveraging the gpio_regmap API, the i8255 library is reduced to simply a devm_i8255_regmap_register() function, a configuration structure struct i8255_regmap_config, and a helper macro i8255_volatile_regmap_range() provided to simplify volatile PPI register hinting for the regmap. The regmap_irq API is leveraged by the 104-idi-48 and 104-dio-48e modules to support their IRQ functionality. Do their respective regmap configurations need use_hwlock set to true in this case, or is adequate locking already handled by the regmap_irq API? William Breathitt Gray (4): gpio: regmap: Always set gpio_chip get_direction regmap-irq: Add handle_mask_sync() callback gpio: 104-idi-48: Migrate to regmap API gpio: i8255: Migrate to regmap API drivers/base/regmap/regmap-irq.c | 44 +++- drivers/gpio/Kconfig | 5 +- drivers/gpio/gpio-104-dio-48e.c | 397 ++++++++++------------------ drivers/gpio/gpio-104-idi-48.c | 329 ++++++++---------------- drivers/gpio/gpio-gpio-mm.c | 151 ++--------- drivers/gpio/gpio-i8255.c | 429 ++++++++++--------------------- drivers/gpio/gpio-i8255.h | 80 +++--- drivers/gpio/gpio-regmap.c | 7 +- include/linux/regmap.h | 5 + 9 files changed, 483 insertions(+), 964 deletions(-) rewrite drivers/gpio/gpio-i8255.c (89%) rewrite drivers/gpio/gpio-i8255.h (89%) base-commit: 8dab99c9eab3162bfb4326c35579a3388dbf68f2 -- 2.38.1