From patchwork Tue Nov 16 12:54:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vaittinen, Matti" X-Patchwork-Id: 517162 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74E7CC433EF for ; Tue, 16 Nov 2021 12:54:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 54A6160F9C for ; Tue, 16 Nov 2021 12:54:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236405AbhKPM5O (ORCPT ); Tue, 16 Nov 2021 07:57:14 -0500 Received: from mail-lj1-f178.google.com ([209.85.208.178]:44634 "EHLO mail-lj1-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236384AbhKPM5M (ORCPT ); Tue, 16 Nov 2021 07:57:12 -0500 Received: by mail-lj1-f178.google.com with SMTP id 13so43036124ljj.11; Tue, 16 Nov 2021 04:54:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=jqiW8ASdADThCh7M+k//uhUT6Syumml1tOxz2XHPYjo=; b=ILpwZswaMYAhTf2+Rx2+bWbM3Ny/JxwIz+52HfpKXBSGnwp/A39XRB0epj6adbl/rp AfNvE3zilD0IQrTDLRLnLaYmktkeMMt4zSKZOxhanKZ5+Ekgq335aixC5TkQYH/l2I1O Ze6eg/+PBFZ7kUiRg+AGG2aNyJyqWpPcppD702khYKtDZIRw3Ymi2AZZW9NedifCs4Ma 7oY0b8hAXMTpeISIRuSBTX2DPYzfTlPtl7kEn0FuV6i31Oxul5cLuUr5xMXXaE78NGm5 Cu3nUQDRa4oI0QTkI0izapGvcLiEMJFu1EzF9dD1YAaWjHH8CAnX+vGCwUbJCjPymm2s s46A== X-Gm-Message-State: AOAM530+DQukYIYf6geKxTxawvdIpHFphgkE6YTFjGdR0Q7plmmROpSN 5+ppnHNhxD3lE2QYFz7xEj0= X-Google-Smtp-Source: ABdhPJxUezizvNKwvsYYimqB6NLDUeiCuwqyPl3isOcG1b5VpiUe4slpgk8QU+erjMHrdyZWYJFcBA== X-Received: by 2002:a2e:9699:: with SMTP id q25mr6851191lji.6.1637067254212; Tue, 16 Nov 2021 04:54:14 -0800 (PST) Received: from fedora (dc73szyyyyyyyyyyyyycy-3.rev.dnainternet.fi. [2001:14ba:16ee:fa00::4]) by smtp.gmail.com with ESMTPSA id f23sm2008468ljg.90.2021.11.16.04.54.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Nov 2021 04:54:13 -0800 (PST) Date: Tue, 16 Nov 2021 14:54:06 +0200 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: lukas.bulwahn@gmail.com, Lee Jones , Rob Herring , Liam Girdwood , Mark Brown , Linus Walleij , Bartosz Golaszewski , Matti Vaittinen , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-power@fi.rohmeurope.com Subject: [PATCH RESEND 2/4] gpio: bd70528 Drop BD70528 support Message-ID: <4eff6bd5eff8afc137dd8c1697cb5c6b2e3aacd2.1637066805.git.matti.vaittinen@fi.rohmeurope.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org The only known BD70528 use-cases are such that the PMIC is controlled from separate MCU which is not running Linux. I am not aware of any Linux driver users. Furthermore, it seems there is no demand for this IC. Let's ease the maintenance burden and drop the driver. We can always add it back if there is sudden need for it. Signed-off-by: Matti Vaittinen Acked-by: Bartosz Golaszewski --- drivers/gpio/Kconfig | 11 -- drivers/gpio/Makefile | 1 - drivers/gpio/gpio-bd70528.c | 230 ------------------------------------ 3 files changed, 242 deletions(-) delete mode 100644 drivers/gpio/gpio-bd70528.c diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index 072ed610f9c6..4c02ee52b701 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -1132,17 +1132,6 @@ config GPIO_ARIZONA help Support for GPIOs on Wolfson Arizona class devices. -config GPIO_BD70528 - tristate "ROHM BD70528 GPIO support" - depends on MFD_ROHM_BD70528 - help - Support for GPIOs on ROHM BD70528 PMIC. There are four GPIOs - available on the ROHM PMIC in total. The GPIOs can also - generate interrupts. - - This driver can also be built as a module. If so, the module - will be called gpio-bd70528. - config GPIO_BD71815 tristate "ROHM BD71815 PMIC GPIO support" depends on MFD_ROHM_BD71828 diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index 71ee9fc2ff83..ed5f9b1a75ce 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile @@ -38,7 +38,6 @@ obj-$(CONFIG_GPIO_ASPEED_SGPIO) += gpio-aspeed-sgpio.o obj-$(CONFIG_GPIO_ATH79) += gpio-ath79.o obj-$(CONFIG_GPIO_BCM_KONA) += gpio-bcm-kona.o obj-$(CONFIG_GPIO_BCM_XGS_IPROC) += gpio-xgs-iproc.o -obj-$(CONFIG_GPIO_BD70528) += gpio-bd70528.o obj-$(CONFIG_GPIO_BD71815) += gpio-bd71815.o obj-$(CONFIG_GPIO_BD71828) += gpio-bd71828.o obj-$(CONFIG_GPIO_BD9571MWV) += gpio-bd9571mwv.o diff --git a/drivers/gpio/gpio-bd70528.c b/drivers/gpio/gpio-bd70528.c deleted file mode 100644 index 397a50d6bc65..000000000000 --- a/drivers/gpio/gpio-bd70528.c +++ /dev/null @@ -1,230 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -// Copyright (C) 2018 ROHM Semiconductors -// gpio-bd70528.c ROHM BD70528MWV gpio driver - -#include -#include -#include -#include -#include - -#define GPIO_IN_REG(offset) (BD70528_REG_GPIO1_IN + (offset) * 2) -#define GPIO_OUT_REG(offset) (BD70528_REG_GPIO1_OUT + (offset) * 2) - -struct bd70528_gpio { - struct regmap *regmap; - struct device *dev; - struct gpio_chip gpio; -}; - -static int bd70528_set_debounce(struct bd70528_gpio *bdgpio, - unsigned int offset, unsigned int debounce) -{ - u8 val; - - switch (debounce) { - case 0: - val = BD70528_DEBOUNCE_DISABLE; - break; - case 1 ... 15000: - val = BD70528_DEBOUNCE_15MS; - break; - case 15001 ... 30000: - val = BD70528_DEBOUNCE_30MS; - break; - case 30001 ... 50000: - val = BD70528_DEBOUNCE_50MS; - break; - default: - dev_err(bdgpio->dev, - "Invalid debounce value %u\n", debounce); - return -EINVAL; - } - return regmap_update_bits(bdgpio->regmap, GPIO_IN_REG(offset), - BD70528_DEBOUNCE_MASK, val); -} - -static int bd70528_get_direction(struct gpio_chip *chip, unsigned int offset) -{ - struct bd70528_gpio *bdgpio = gpiochip_get_data(chip); - int val, ret; - - /* Do we need to do something to IRQs here? */ - ret = regmap_read(bdgpio->regmap, GPIO_OUT_REG(offset), &val); - if (ret) { - dev_err(bdgpio->dev, "Could not read gpio direction\n"); - return ret; - } - if (val & BD70528_GPIO_OUT_EN_MASK) - return GPIO_LINE_DIRECTION_OUT; - - return GPIO_LINE_DIRECTION_IN; -} - -static int bd70528_gpio_set_config(struct gpio_chip *chip, unsigned int offset, - unsigned long config) -{ - struct bd70528_gpio *bdgpio = gpiochip_get_data(chip); - - switch (pinconf_to_config_param(config)) { - case PIN_CONFIG_DRIVE_OPEN_DRAIN: - return regmap_update_bits(bdgpio->regmap, - GPIO_OUT_REG(offset), - BD70528_GPIO_DRIVE_MASK, - BD70528_GPIO_OPEN_DRAIN); - break; - case PIN_CONFIG_DRIVE_PUSH_PULL: - return regmap_update_bits(bdgpio->regmap, - GPIO_OUT_REG(offset), - BD70528_GPIO_DRIVE_MASK, - BD70528_GPIO_PUSH_PULL); - break; - case PIN_CONFIG_INPUT_DEBOUNCE: - return bd70528_set_debounce(bdgpio, offset, - pinconf_to_config_argument(config)); - break; - default: - break; - } - return -ENOTSUPP; -} - -static int bd70528_direction_input(struct gpio_chip *chip, unsigned int offset) -{ - struct bd70528_gpio *bdgpio = gpiochip_get_data(chip); - - /* Do we need to do something to IRQs here? */ - return regmap_update_bits(bdgpio->regmap, GPIO_OUT_REG(offset), - BD70528_GPIO_OUT_EN_MASK, - BD70528_GPIO_OUT_DISABLE); -} - -static void bd70528_gpio_set(struct gpio_chip *chip, unsigned int offset, - int value) -{ - int ret; - struct bd70528_gpio *bdgpio = gpiochip_get_data(chip); - u8 val = (value) ? BD70528_GPIO_OUT_HI : BD70528_GPIO_OUT_LO; - - ret = regmap_update_bits(bdgpio->regmap, GPIO_OUT_REG(offset), - BD70528_GPIO_OUT_MASK, val); - if (ret) - dev_err(bdgpio->dev, "Could not set gpio to %d\n", value); -} - -static int bd70528_direction_output(struct gpio_chip *chip, unsigned int offset, - int value) -{ - struct bd70528_gpio *bdgpio = gpiochip_get_data(chip); - - bd70528_gpio_set(chip, offset, value); - return regmap_update_bits(bdgpio->regmap, GPIO_OUT_REG(offset), - BD70528_GPIO_OUT_EN_MASK, - BD70528_GPIO_OUT_ENABLE); -} - -#define GPIO_IN_STATE_MASK(offset) (BD70528_GPIO_IN_STATE_BASE << (offset)) - -static int bd70528_gpio_get_o(struct bd70528_gpio *bdgpio, unsigned int offset) -{ - int ret; - unsigned int val; - - ret = regmap_read(bdgpio->regmap, GPIO_OUT_REG(offset), &val); - if (!ret) - ret = !!(val & BD70528_GPIO_OUT_MASK); - else - dev_err(bdgpio->dev, "GPIO (out) state read failed\n"); - - return ret; -} - -static int bd70528_gpio_get_i(struct bd70528_gpio *bdgpio, unsigned int offset) -{ - unsigned int val; - int ret; - - ret = regmap_read(bdgpio->regmap, BD70528_REG_GPIO_STATE, &val); - - if (!ret) - ret = !(val & GPIO_IN_STATE_MASK(offset)); - else - dev_err(bdgpio->dev, "GPIO (in) state read failed\n"); - - return ret; -} - -static int bd70528_gpio_get(struct gpio_chip *chip, unsigned int offset) -{ - int ret; - struct bd70528_gpio *bdgpio = gpiochip_get_data(chip); - - /* - * There is a race condition where someone might be changing the - * GPIO direction after we get it but before we read the value. But - * application design where GPIO direction may be changed just when - * we read GPIO value would be pointless as reader could not know - * whether the returned high/low state is caused by input or output. - * Or then there must be other ways to mitigate the issue. Thus - * locking would make no sense. - */ - ret = bd70528_get_direction(chip, offset); - if (ret == GPIO_LINE_DIRECTION_OUT) - ret = bd70528_gpio_get_o(bdgpio, offset); - else if (ret == GPIO_LINE_DIRECTION_IN) - ret = bd70528_gpio_get_i(bdgpio, offset); - else - dev_err(bdgpio->dev, "failed to read GPIO direction\n"); - - return ret; -} - -static int bd70528_probe(struct platform_device *pdev) -{ - struct device *dev = &pdev->dev; - struct bd70528_gpio *bdgpio; - int ret; - - bdgpio = devm_kzalloc(dev, sizeof(*bdgpio), GFP_KERNEL); - if (!bdgpio) - return -ENOMEM; - bdgpio->dev = dev; - bdgpio->gpio.parent = dev->parent; - bdgpio->gpio.label = "bd70528-gpio"; - bdgpio->gpio.owner = THIS_MODULE; - bdgpio->gpio.get_direction = bd70528_get_direction; - bdgpio->gpio.direction_input = bd70528_direction_input; - bdgpio->gpio.direction_output = bd70528_direction_output; - bdgpio->gpio.set_config = bd70528_gpio_set_config; - bdgpio->gpio.can_sleep = true; - bdgpio->gpio.get = bd70528_gpio_get; - bdgpio->gpio.set = bd70528_gpio_set; - bdgpio->gpio.ngpio = 4; - bdgpio->gpio.base = -1; -#ifdef CONFIG_OF_GPIO - bdgpio->gpio.of_node = dev->parent->of_node; -#endif - bdgpio->regmap = dev_get_regmap(dev->parent, NULL); - if (!bdgpio->regmap) - return -ENODEV; - - ret = devm_gpiochip_add_data(dev, &bdgpio->gpio, bdgpio); - if (ret) - dev_err(dev, "gpio_init: Failed to add bd70528-gpio\n"); - - return ret; -} - -static struct platform_driver bd70528_gpio = { - .driver = { - .name = "bd70528-gpio" - }, - .probe = bd70528_probe, -}; - -module_platform_driver(bd70528_gpio); - -MODULE_AUTHOR("Matti Vaittinen "); -MODULE_DESCRIPTION("BD70528 voltage regulator driver"); -MODULE_LICENSE("GPL"); -MODULE_ALIAS("platform:bd70528-gpio"); From patchwork Tue Nov 16 12:55:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vaittinen, Matti" X-Patchwork-Id: 517161 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9898C433FE for ; Tue, 16 Nov 2021 12:55:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 90C6B60EE0 for ; Tue, 16 Nov 2021 12:55:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236473AbhKPM6m (ORCPT ); Tue, 16 Nov 2021 07:58:42 -0500 Received: from mail-lf1-f45.google.com ([209.85.167.45]:37470 "EHLO mail-lf1-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236536AbhKPM6L (ORCPT ); Tue, 16 Nov 2021 07:58:11 -0500 Received: by mail-lf1-f45.google.com with SMTP id c32so52985456lfv.4; Tue, 16 Nov 2021 04:55:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ZNPDHxYI4sB4L1Wdku41vgCHS19KWodVnP9uBEUZsuk=; b=3gwCoEe9N4zUjNIaYpq3DA81pIPWyg8vOy//vB46FBybgvxILDCZi5ULQxp5+ahHAg CgRb5MnZxuUcX76vIpuROSbg3WQpPN1AKQmU5V2oGLlTjpyQR5CHThiilsNrgQr+zOxw eiXH50B6nzdY4/8PJl9jyduVvUukY2OBer/omMnSslW9jrxvybCaBne1vP+hBdsPrvnL 3Yu82hL0yssTduImh7QEKo5L63rYhBULhlQeG+VOJ3gTkBWPVskbcunnchSYaSn0UC/b jdDVGnb9x3B17R7/IInrX0uVhw4l7fS7jS6qJmEJ3j80bx2DzHty4l3Be21MpmFfKDaa ZW1g== X-Gm-Message-State: AOAM530Av8HSjjskqslaMxLmYktXK1zKqEm++8aMDjtZslAR1CbtzvGp CenekbO6E/4979GwUtLNUsw= X-Google-Smtp-Source: ABdhPJxVVozOpBEEgWs4P69bTOZGvztsoeGGpLFNgpMmLYNAAPfNWlwbql3XXH/LDQJ16YT5e0G7aw== X-Received: by 2002:ac2:4e09:: with SMTP id e9mr6154204lfr.657.1637067312567; Tue, 16 Nov 2021 04:55:12 -0800 (PST) Received: from fedora (dc73szyyyyyyyyyyyyycy-3.rev.dnainternet.fi. [2001:14ba:16ee:fa00::4]) by smtp.gmail.com with ESMTPSA id u10sm1754099lfb.209.2021.11.16.04.55.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Nov 2021 04:55:12 -0800 (PST) Date: Tue, 16 Nov 2021 14:55:05 +0200 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: lukas.bulwahn@gmail.com, Lee Jones , Rob Herring , Liam Girdwood , Mark Brown , Linus Walleij , Bartosz Golaszewski , Matti Vaittinen , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-power@fi.rohmeurope.com Subject: [PATCH RESEND 4/4] MAINTAINERS: bd70528: Drop ROHM BD70528 drivers Message-ID: <90b0565c0eb9429b0962f08d45292a5a9ebe5cea.1637066805.git.matti.vaittinen@fi.rohmeurope.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org The only known BD70528 use-cases are such that the PMIC is controlled from separate MCU which is not running Linux. I am not aware of any Linux driver users. Furthermore, it seems there is no demand for this IC. Ease the maintenance burden and drop the driver. Signed-off-by: Matti Vaittinen --- MAINTAINERS | 8 -------- 1 file changed, 8 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 7a2345ce8521..c3ebc417ba41 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -16445,27 +16445,19 @@ ROHM POWER MANAGEMENT IC DEVICE DRIVERS R: Matti Vaittinen L: linux-power@fi.rohmeurope.com S: Supported -F: Documentation/devicetree/bindings/mfd/rohm,bd70528-pmic.txt -F: Documentation/devicetree/bindings/regulator/rohm,bd70528-regulator.txt F: drivers/clk/clk-bd718x7.c -F: drivers/gpio/gpio-bd70528.c F: drivers/gpio/gpio-bd71815.c F: drivers/gpio/gpio-bd71828.c -F: drivers/mfd/rohm-bd70528.c F: drivers/mfd/rohm-bd71828.c F: drivers/mfd/rohm-bd718x7.c F: drivers/mfd/rohm-bd9576.c -F: drivers/power/supply/bd70528-charger.c -F: drivers/regulator/bd70528-regulator.c F: drivers/regulator/bd71815-regulator.c F: drivers/regulator/bd71828-regulator.c F: drivers/regulator/bd718x7-regulator.c F: drivers/regulator/bd9576-regulator.c F: drivers/regulator/rohm-regulator.c F: drivers/rtc/rtc-bd70528.c -F: drivers/watchdog/bd70528_wdt.c F: drivers/watchdog/bd9576_wdt.c -F: include/linux/mfd/rohm-bd70528.h F: include/linux/mfd/rohm-bd71815.h F: include/linux/mfd/rohm-bd71828.h F: include/linux/mfd/rohm-bd718x7.h