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=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS 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 B770AC2B9F7 for ; Wed, 26 May 2021 06:03:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 95519613C9 for ; Wed, 26 May 2021 06:03:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232492AbhEZGEb (ORCPT ); Wed, 26 May 2021 02:04:31 -0400 Received: from mail-lj1-f171.google.com ([209.85.208.171]:38778 "EHLO mail-lj1-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231657AbhEZGEa (ORCPT ); Wed, 26 May 2021 02:04:30 -0400 Received: by mail-lj1-f171.google.com with SMTP id a4so111289ljd.5; Tue, 25 May 2021 23:02:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=bLwEdy+rrLsCVQ5NTrNvxDpvweYe5d2q0y9UoLoVLJY=; b=dx7LmWQ/qW+AfC3y6TsONYNC6BO5fji7u4DP5bbBVVsKBh6NeR4hRi3ZtiycqTzCT0 h0ifux81a/ep23GMrbcGuut1Fd+3jlbWjyi97wbQpEhpXin+nEgI2L4Exa9v0U95sDBE 1K2vuhcFEMG9CWhFxuGDF8xQC/pOcDQEnPnem+Tt7eABwUbSKCTPGxPY3sgDJC55E5s3 C6BEySAHL+QrujU4yoeRkjnPZiQX5YyvbetennMp14VL0r8XM7AQVXMcARUiyAlxWaml S7qJiAQCLi6d5ifncH7tyO1CcyNA4sLu/XJJeVlVl084hH4p7xaVqx/C6UCGNs8xcKhl hK2Q== X-Gm-Message-State: AOAM532H4Paac/OGeKfrFUl+3DH0dkBY9m+qfNhVg06cpez+MnS2wD+j 9M2gEELse+H63qusFwNgdx0= X-Google-Smtp-Source: ABdhPJwFVTLG8GWu+T8Y0QAPo8nQNpl2RVxETxVByejUnpBYVrrZfLHW6rGLDfeWqKi0f36ruM8h4Q== X-Received: by 2002:a2e:9dc5:: with SMTP id x5mr957592ljj.147.1622008977509; Tue, 25 May 2021 23:02:57 -0700 (PDT) Received: from localhost.localdomain (dc7vkhyyyyyyyyyyyyycy-3.rev.dnainternet.fi. [2001:14ba:16e2:8300::4]) by smtp.gmail.com with ESMTPSA id j1sm1922622lfg.166.2021.05.25.23.02.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 May 2021 23:02:56 -0700 (PDT) Date: Wed, 26 May 2021 09:02:50 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Linus Walleij , Bartosz Golaszewski , Matti Vaittinen , Michael Walle , Florian Fainelli , bcm-kernel-feedback-list@broadcom.com, Jonas Gorski , =?iso-8859-1?Q?=C1lvaro_Fern=E1ndez?= Rojas , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-power@fi.rohmeurope.com, linux-arm-kernel@lists.infradead.org, Andy Shevchenko Subject: [PATCH v4 0/3] gpio: gpio-regmap: Support few custom operations Message-ID: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="UlVJffcvxoiEqYs2" Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org --UlVJffcvxoiEqYs2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Support providing some IC specific operations at gpio_regmap registration. Implementation of few GPIO related functionalities are likely to be very IC specific. For example the pin-configuration registers and the pin validity checks. Allow IC driver to provide IC specific functions which gpio-regmap can utilize for these IC specific configurations. This should help broaden the gpio-regmap IC coverage without the need of exposing the registered gpio_chip or struct gpio_regmap to IC drivers. The set_config and init_valid_mask are used by ROHM BD71815 GPIO driver. Convert the BD71815 GPIO driver to use gpio-regmap and get rid of some code. Rest of the ROHM GPIO drivers are to be reworked after the mechanism of adding IC specific functions is settled. Some preliminary discussion can be seen here: https://lore.kernel.org/linux-gpio/c4faac648d3e0c7f3dcb50f7e24c8b322e8c6974= =2Ecamel@fi.rohmeurope.com/ I did also prepare change where the getters for drvdata and regmap are used. It can also work - but it does not scale quite as well if (when) IC drivers need some register information to do custom operations. Interested people can see the: https://github.com/M-Vaittinen/linux/commits/gpio-regmap-getters for comparison. Changelog v4: - Convert also the existing users. Changelog v3: - divide gpio_regmap into private part and part which contains user-visible configurations. This should allow keeping the internal data internal to gpio_regmap - while allowing the IC driver to re-use configurations it has provided to gpio-regmap without a need of storing them to private-data. Furthermore avoid implementing dummy 'getter-functions' for regmap, driver-data, register details, firmware node etc. - change devm_add_action() to devm_add_action_or_reset() - the bd71815 GPIO driver, completely drop private-data. Changelog v2: - Add cover-letter - Drop unnecessary checks for callback function validity - drop driver_data setting function as it is likely to be a race-condition-by-design --- Matti Vaittinen (3): gpio: regmap: Support few IC specific operations gpio: gpio-regmap: Use devm_add_action_or_reset() gpio: bd71815: Use gpio-regmap drivers/gpio/Kconfig | 1 + drivers/gpio/gpio-bd71815.c | 121 ++++----------- drivers/gpio/gpio-regmap.c | 212 +++++++++++++++----------- drivers/gpio/gpio-sl28cpld.c | 3 +- drivers/pinctrl/bcm/pinctrl-bcm63xx.c | 8 +- include/linux/gpio/regmap.h | 51 +++++-- 6 files changed, 194 insertions(+), 202 deletions(-) base-commit: c4681547bcce777daf576925a966ffa824edd09d --=20 2.25.4 --=20 Matti Vaittinen, Linux device drivers ROHM Semiconductors, Finland SWDC Kiviharjunlenkki 1E 90220 OULU FINLAND ~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~ Simon says - in Latin please. ~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~ Thanks to Simon Glass for the translation =3D]=20 --UlVJffcvxoiEqYs2 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmCt5H0ACgkQeFA3/03a ocVG2gf/cGL1Rx2rIC520y0EBzFBbSHvHu56eUlaER8PFO3IVaiNswgOzZNpneiy EP2WNzcpxctz1nx3lp7bX6GLtnu4wD9xte/uHi1u6tFB/PuSub5KynPO0V6r3bky VhOywIILQr9MvhUH7S01WCosGjDMCggUTNDGecrEXGVIV1J9MNwS7RHTUSehn3Bc gW7D0n3QWbC8W8R+GG7w7Wk7aceT1BImD3jzSFRd+q3aNrri8B7g7tg1JofEAMwi 7vZgQXX4JYwhPLz3Q8baiM0mox+og4oQyAsJUkP3TnEXsX0SlTQ1a1eEr7YOwN+G 4x9aiveKMqkcsf3tP83oCzYupnQTXw== =hOoY -----END PGP SIGNATURE----- --UlVJffcvxoiEqYs2-- 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=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS 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 2445EC2B9F7 for ; Wed, 26 May 2021 06:04:54 +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 DA416613CC for ; Wed, 26 May 2021 06:04:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DA416613CC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=fi.rohmeurope.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@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-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: MIME-Version:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=6olnQJErDAo1z7DNmOG3f5Ahp2lHwkN8kFrW5Q+iGA8=; b=OA5 QPf3l4iyiI4Z2wWny5i3QTG0bVufmVnBP9/DbCBKFyIRxHPFG0BKFK29rWiY153jz64mNtoYDMBlf hL7wXQ3mCZhfBQq8/BXJLHaIQxtBmQ+LzeLIJw7i4nxXSwWOoPclNXrb3wKLKeekiLzZpXs7G5PL4 6RJ0yavKu+F6m7zqmHsGzIYoKCbSfZjBoXCcMCSsGsQg8X/tgpjCXA0Bs7MH4O5Hdc2EQ6ColV2q4 DH6OW3sqzn2Ap/Du0MAqNeYynzlrWZEYChP9bF9/P2JaNrelu2MQsSyltn2S7latOxtNidzZBthxk 32EZ7mk33I3IanbrWBkCis2h9QIfVRw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1llmdX-00BQCn-Lc; Wed, 26 May 2021 06:03:23 +0000 Received: from mail-lj1-f172.google.com ([209.85.208.172]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1llmdA-00BQ0W-Ls for linux-arm-kernel@lists.infradead.org; Wed, 26 May 2021 06:03:04 +0000 Received: by mail-lj1-f172.google.com with SMTP id f12so122313ljp.2 for ; Tue, 25 May 2021 23:02:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=bLwEdy+rrLsCVQ5NTrNvxDpvweYe5d2q0y9UoLoVLJY=; b=li1FaA8S53yQuGXsXuUvxomXKBcqcKSaTASZJ5SeSG09CETEGsor8uYBbM+X1UG7Po wVkBMSsNTvIEszo+BpAm+Bbfayd4T/Q94VZJwI7u8gLIxwkjHfyPrnOF2FIeLu4Iin4S G8gs3k8a2lRUpZKFx7htOWUVL9WiYEOJDORMsoY3046+I8j+a+P8yZJpRudvGqmKHtzr xJDaPQb30hF8KkF3RVeq0+wDImCDnSGrlVU+ChotXBVei7bbMnCCQCyvvhMB2O2WaemX rbr7Cb7kvfxgmD9RtsERYyFUZIjttouJsgOPXCVIZDr2Yx/oUB0yaYXcBY6WDp/Zk+2t lJ1w== X-Gm-Message-State: AOAM530L61+bHcEXDgFc7aUFwpC+92m4VQ4r5XoyY3LbF5YfBLBNMb9R cyXteHb9iw65LdZG09A1g30= X-Google-Smtp-Source: ABdhPJwFVTLG8GWu+T8Y0QAPo8nQNpl2RVxETxVByejUnpBYVrrZfLHW6rGLDfeWqKi0f36ruM8h4Q== X-Received: by 2002:a2e:9dc5:: with SMTP id x5mr957592ljj.147.1622008977509; Tue, 25 May 2021 23:02:57 -0700 (PDT) Received: from localhost.localdomain (dc7vkhyyyyyyyyyyyyycy-3.rev.dnainternet.fi. [2001:14ba:16e2:8300::4]) by smtp.gmail.com with ESMTPSA id j1sm1922622lfg.166.2021.05.25.23.02.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 May 2021 23:02:56 -0700 (PDT) Date: Wed, 26 May 2021 09:02:50 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Linus Walleij , Bartosz Golaszewski , Matti Vaittinen , Michael Walle , Florian Fainelli , bcm-kernel-feedback-list@broadcom.com, Jonas Gorski , =?iso-8859-1?Q?=C1lvaro_Fern=E1ndez?= Rojas , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-power@fi.rohmeurope.com, linux-arm-kernel@lists.infradead.org, Andy Shevchenko Subject: [PATCH v4 0/3] gpio: gpio-regmap: Support few custom operations Message-ID: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210525_230300_744685_3F404700 X-CRM114-Status: GOOD ( 15.25 ) 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: , Content-Type: multipart/mixed; boundary="===============1977199046808118057==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============1977199046808118057== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="UlVJffcvxoiEqYs2" Content-Disposition: inline --UlVJffcvxoiEqYs2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Support providing some IC specific operations at gpio_regmap registration. Implementation of few GPIO related functionalities are likely to be very IC specific. For example the pin-configuration registers and the pin validity checks. Allow IC driver to provide IC specific functions which gpio-regmap can utilize for these IC specific configurations. This should help broaden the gpio-regmap IC coverage without the need of exposing the registered gpio_chip or struct gpio_regmap to IC drivers. The set_config and init_valid_mask are used by ROHM BD71815 GPIO driver. Convert the BD71815 GPIO driver to use gpio-regmap and get rid of some code. Rest of the ROHM GPIO drivers are to be reworked after the mechanism of adding IC specific functions is settled. Some preliminary discussion can be seen here: https://lore.kernel.org/linux-gpio/c4faac648d3e0c7f3dcb50f7e24c8b322e8c6974= =2Ecamel@fi.rohmeurope.com/ I did also prepare change where the getters for drvdata and regmap are used. It can also work - but it does not scale quite as well if (when) IC drivers need some register information to do custom operations. Interested people can see the: https://github.com/M-Vaittinen/linux/commits/gpio-regmap-getters for comparison. Changelog v4: - Convert also the existing users. Changelog v3: - divide gpio_regmap into private part and part which contains user-visible configurations. This should allow keeping the internal data internal to gpio_regmap - while allowing the IC driver to re-use configurations it has provided to gpio-regmap without a need of storing them to private-data. Furthermore avoid implementing dummy 'getter-functions' for regmap, driver-data, register details, firmware node etc. - change devm_add_action() to devm_add_action_or_reset() - the bd71815 GPIO driver, completely drop private-data. Changelog v2: - Add cover-letter - Drop unnecessary checks for callback function validity - drop driver_data setting function as it is likely to be a race-condition-by-design --- Matti Vaittinen (3): gpio: regmap: Support few IC specific operations gpio: gpio-regmap: Use devm_add_action_or_reset() gpio: bd71815: Use gpio-regmap drivers/gpio/Kconfig | 1 + drivers/gpio/gpio-bd71815.c | 121 ++++----------- drivers/gpio/gpio-regmap.c | 212 +++++++++++++++----------- drivers/gpio/gpio-sl28cpld.c | 3 +- drivers/pinctrl/bcm/pinctrl-bcm63xx.c | 8 +- include/linux/gpio/regmap.h | 51 +++++-- 6 files changed, 194 insertions(+), 202 deletions(-) base-commit: c4681547bcce777daf576925a966ffa824edd09d --=20 2.25.4 --=20 Matti Vaittinen, Linux device drivers ROHM Semiconductors, Finland SWDC Kiviharjunlenkki 1E 90220 OULU FINLAND ~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~ Simon says - in Latin please. ~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~ Thanks to Simon Glass for the translation =3D]=20 --UlVJffcvxoiEqYs2 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmCt5H0ACgkQeFA3/03a ocVG2gf/cGL1Rx2rIC520y0EBzFBbSHvHu56eUlaER8PFO3IVaiNswgOzZNpneiy EP2WNzcpxctz1nx3lp7bX6GLtnu4wD9xte/uHi1u6tFB/PuSub5KynPO0V6r3bky VhOywIILQr9MvhUH7S01WCosGjDMCggUTNDGecrEXGVIV1J9MNwS7RHTUSehn3Bc gW7D0n3QWbC8W8R+GG7w7Wk7aceT1BImD3jzSFRd+q3aNrri8B7g7tg1JofEAMwi 7vZgQXX4JYwhPLz3Q8baiM0mox+og4oQyAsJUkP3TnEXsX0SlTQ1a1eEr7YOwN+G 4x9aiveKMqkcsf3tP83oCzYupnQTXw== =hOoY -----END PGP SIGNATURE----- --UlVJffcvxoiEqYs2-- --===============1977199046808118057== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============1977199046808118057==--