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=unavailable 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 2179AC4707F for ; Tue, 25 May 2021 12:43:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F1EDC6141D for ; Tue, 25 May 2021 12:43:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232732AbhEYMpS (ORCPT ); Tue, 25 May 2021 08:45:18 -0400 Received: from mail-lf1-f50.google.com ([209.85.167.50]:40907 "EHLO mail-lf1-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232222AbhEYMpR (ORCPT ); Tue, 25 May 2021 08:45:17 -0400 Received: by mail-lf1-f50.google.com with SMTP id w33so37918410lfu.7; Tue, 25 May 2021 05:43:46 -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=7Q+UExfa0BSPVkLH1erCFRG3VOI+JhLI3Bcdlf7hGQ0=; b=HnHKpEfoq/mqdtg2dKch10OgqA1YIf10AZRyp5YlyZMFUl5+T2QEsKWUlLaaC/zglU Nf2nugn7+3MiNuzB2u8JoVHGIBvX/bdfVHiaBCpUF1gBldHGD/GVvw+NLFGHkso8LMNK Qy65n5njC05pSPI//qPbcwCmL9Rq8DP6ryX+MB9azjR+EopS7VYqyjznFBBA+fUKjneU HVVouV6+onZhu+Ibx1lbsSzawYXtNkupw6Rnu0DHdJbBNIKovRx9PaT0X8D5y4jjJRCz KKpe1Swn4KMCn79x/Yfb9NHqzmGNQxXXSfu0z72qDgIMMUgcITYtkhH4K8M4vygNwPLJ sPOg== X-Gm-Message-State: AOAM532l4rthnc0N9c/OXTwwpVCvl4spha0O6ZKgaE4AFzRoyMD+BTdj C1osY9rJU4VQyspmDzAYOnnVI24DGV0= X-Google-Smtp-Source: ABdhPJw4SA9UdbzuC0vPlwOORtUtjAk3fMSNenq38CYsKI2XuqALp0KNrbaPVJvnRGk5TJRGNGDmTw== X-Received: by 2002:ac2:4246:: with SMTP id m6mr14107795lfl.611.1621946625405; Tue, 25 May 2021 05:43:45 -0700 (PDT) Received: from localhost.localdomain (dc7vkhyyyyyyyyyyyyycy-3.rev.dnainternet.fi. [2001:14ba:16e2:8300::4]) by smtp.gmail.com with ESMTPSA id m5sm2091782ljg.118.2021.05.25.05.43.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 May 2021 05:43:44 -0700 (PDT) Date: Tue, 25 May 2021 15:43:37 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Linus Walleij , Bartosz Golaszewski , Matti Vaittinen , Michael Walle , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-power@fi.rohmeurope.com Subject: [PATCH v3 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="huq684BweRXVnRxX" Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --huq684BweRXVnRxX 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 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 ++++++++++++++++++++---------------- include/linux/gpio/regmap.h | 51 ++++++--- 4 files changed, 187 insertions(+), 198 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 --huq684BweRXVnRxX Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmCs8PkACgkQeFA3/03a ocWONwf6AgPjOWaF86mTQqjG/M5ueA9FVKHi7CjvONMk7mVjZoO+0FP70F+k8Cpf 7t+kucWP8VDU0ho+f/v/+wn4Kf0VX31rAogepdA6LQkL9N4LcxVpCNGYhjGFiV1I CvgmhiiJBwdVPku2PLnKLEqTaLR2jv9+FaSxIT527aIEDGQUs1IF5Mi1KuxTPPcO MSNDuMLAsXy6913Ce9b31wqCM8vqZlgu/HrI9j6aEge8a1rsiz6q+G/XPv8qzlY1 TbpL7dm3HkIrRNJRUUfw/SFImuurtEvGfmFhVC6lOLSfSgRjBogOuIhWHHJQ/teb +Q0QLKCcJKCKaVXP0zq2OjMrMjzSiw== =Q42K -----END PGP SIGNATURE----- --huq684BweRXVnRxX--