Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1623591rwl; Fri, 31 Mar 2023 14:08:47 -0700 (PDT) X-Google-Smtp-Source: AKy350Y6PAQbCdyL7Q4Zl4ttIo9fYOI45IDz/kKQ1Hu49MPg0Wp1BWu+1TnVPSWrQLgSSCDqrd6f X-Received: by 2002:a17:906:74c3:b0:944:4d7:d3d9 with SMTP id z3-20020a17090674c300b0094404d7d3d9mr5413876ejl.2.1680296926892; Fri, 31 Mar 2023 14:08:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680296926; cv=none; d=google.com; s=arc-20160816; b=pApNYqShMuVMpbi06uEbMlUT7IznJ2cu6o42mTBTWwtZ/eKFGlbwYGur8Ibp46upGY sqwl4ky1FupgsdLcuKg8S/YV9EPYf4XQ8IIk6Xx5BTbSmFJgVjlzdlGc5sF83LhCPu72 Mj74oKZ6VEySMAn6Hs0cSB1UMSLdfSE8rqGWPT6S9dj0bwbBGtrgjb6ifAWLj73YXwgE ijJI12ydIOPgbmmxeFlQXxi4rd/w87t7mvmmS4m2fUY1huMc4s1D6ylZaWfS5bWbCvan YFrAb6wGMyAT+xyF51PtPXFz1c+a2wTPa1SQCeFdCEyxJXCKG7Vk0aHup0Q66ImSnVBw rN4g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KlccS8PuhgiaZf91f27SabAjxszuRJsMXVMDszCbILs=; b=Mx2k1UuT5LlAzk1QJPRLXXBpkBpO66gOm6D3a/d2FAVEECuaOn0whMVQDKQW2EtFho ZZrNE6f44z35h6CbdshDT2uk5g/7/ZTz7qcXc1QWOdvN+lpM9n3rX9r+EjegloI7zOHF Vd8Fp/FDTiZPu6KK1DZpIjj48WGTbW/szKKrOb/HziUEpMbAf5xfEIAk70Hier+IcyHY UDIcKKDMYzO47+8M05NjbserFd+OHlmGY0JgNqk/wk+UOTjb/EnGELe2+fAj7/CL7pJJ NP5XEFkiZTqJfvzFcup/H6swW0xibkbjlQMFgNgtKZYBHLkMbOIbJ6OcthPTpV7LVo35 tLkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hJtRlMwE; 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 m26-20020a1709066d1a00b009309c7f5650si2668821ejr.23.2023.03.31.14.08.22; Fri, 31 Mar 2023 14:08:46 -0700 (PDT) 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=hJtRlMwE; 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 S233128AbjCaVGC (ORCPT + 99 others); Fri, 31 Mar 2023 17:06:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232990AbjCaVFx (ORCPT ); Fri, 31 Mar 2023 17:05:53 -0400 Received: from mail-yw1-x1131.google.com (mail-yw1-x1131.google.com [IPv6:2607:f8b0:4864:20::1131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F6BD22E90 for ; Fri, 31 Mar 2023 14:05:51 -0700 (PDT) Received: by mail-yw1-x1131.google.com with SMTP id 00721157ae682-545cb3c9898so363128497b3.7 for ; Fri, 31 Mar 2023 14:05:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680296750; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KlccS8PuhgiaZf91f27SabAjxszuRJsMXVMDszCbILs=; b=hJtRlMwEdV+FXGwi9QXe+mRxKskphkSscXmkBxcqM+bWcwHHBS1W35qX1vFNWcIewr n+qT5fFFCIxE9ghL4tTc+OsPY+ksiDDolMVsTIwafsGYFC/npAgeJrMcHNChfCqBG1CG iKbmuLKKi4B4keXb1IYOJKdMYznFljMIZMFQVvhBerpFivChNNdFhG6cQv4cln4iWpnZ UymjGn8P137BiEoL1ZIIJ9ENpRq165as3/hQIXLh3bUXoewMZZyuxlbcNjMT7XY9ZBCz XotLRkFb9pA+6hNMeAVzCKvuDBBek808UPv8ncntcU2NFbOnTMcrt0SYMKKQ0jmf6yYH WTIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680296750; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KlccS8PuhgiaZf91f27SabAjxszuRJsMXVMDszCbILs=; b=01L112jSTsxay59Akp/Xaz4CTTXkToku52qlVdVmQPdUHS7jFFe7GupxhkN/CkFZTW DO4I6iAnjjeMmvD9XMla5ayMWcJL9tp2b36575kfdwNUODqC5J7zXmOr8tv2Q7YCIy4G EhtD5YVLo3N7piC1Akw5zBgW9tnxtU9rf+2u5pnp/jaIZkjx0zpjFDgOoSEjyRniK+Co tqnenjRfQdOac97W5hAKWRtVNt2HSopFP8VcKvfqrauuBxUqFeHflCH9zdyyu4I9YEXw UU1E7h5czrCRzGUCJQqCJLlKZMHoCfuVAsUJaaei/279nssUBKi5xiWe7oLBHAICfcwA WR6g== X-Gm-Message-State: AAQBX9dHPDLSMInIwr915F/QFuBRpmNdJ1LC19ppSJclt83uHfC3XLwx v8TSoUKmg+6kFVpkxwSZ/I7UgierAR7ZOgAVcSE+ZA== X-Received: by 2002:a81:a209:0:b0:545:91c2:d5eb with SMTP id w9-20020a81a209000000b0054591c2d5ebmr25732254ywg.28.1680296750352; Fri, 31 Mar 2023 14:05:50 -0700 (PDT) Received: from fedora.attlocal.net (69-109-179-158.lightspeed.dybhfl.sbcglobal.net. [69.109.179.158]) by smtp.gmail.com with ESMTPSA id q70-20020a81b249000000b0054601ee157fsm751990ywh.114.2023.03.31.14.05.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Mar 2023 14:05:50 -0700 (PDT) From: William Breathitt Gray To: Linus Walleij , Bartosz Golaszewski Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Andy Shevchenko , William Breathitt Gray Subject: [PATCH v4 4/4] gpio: idio-16: Remove unused legacy interface Date: Fri, 31 Mar 2023 17:05:26 -0400 Message-Id: <3d77e0b3dd3b3d3f7dad53222a755459b5e2aa57.1680296343.git.william.gray@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 All idio-16 library consumers have migrated to the new interface leveraging the gpio-regmap API. Legacy interface functions and code are removed as no longer needed. Reviewed-by: Andy Shevchenko Signed-off-by: William Breathitt Gray --- Changes in v4: none drivers/gpio/gpio-idio-16.c | 131 +----------------------------------- drivers/gpio/gpio-idio-16.h | 65 ------------------ 2 files changed, 1 insertion(+), 195 deletions(-) diff --git a/drivers/gpio/gpio-idio-16.c b/drivers/gpio/gpio-idio-16.c index f9349e8d7fdc..53b1eb876a12 100644 --- a/drivers/gpio/gpio-idio-16.c +++ b/drivers/gpio/gpio-idio-16.c @@ -3,15 +3,13 @@ * GPIO library for the ACCES IDIO-16 family * Copyright (C) 2022 William Breathitt Gray */ -#include +#include #include #include #include #include -#include #include #include -#include #include #include "gpio-idio-16.h" @@ -169,133 +167,6 @@ int devm_idio_16_regmap_register(struct device *const dev, } EXPORT_SYMBOL_GPL(devm_idio_16_regmap_register); -/** - * idio_16_get - get signal value at signal offset - * @reg: ACCES IDIO-16 device registers - * @state: ACCES IDIO-16 device state - * @offset: offset of signal to get - * - * Returns the signal value (0=low, 1=high) for the signal at @offset. - */ -int idio_16_get(struct idio_16 __iomem *const reg, - struct idio_16_state *const state, const unsigned long offset) -{ - const unsigned long mask = BIT(offset); - - if (offset < IDIO_16_NOUT) - return test_bit(offset, state->out_state); - - if (offset < 24) - return !!(ioread8(®->in0_7) & (mask >> IDIO_16_NOUT)); - - if (offset < 32) - return !!(ioread8(®->in8_15) & (mask >> 24)); - - return -EINVAL; -} -EXPORT_SYMBOL_GPL(idio_16_get); - -/** - * idio_16_get_multiple - get multiple signal values at multiple signal offsets - * @reg: ACCES IDIO-16 device registers - * @state: ACCES IDIO-16 device state - * @mask: mask of signals to get - * @bits: bitmap to store signal values - * - * Stores in @bits the values (0=low, 1=high) for the signals defined by @mask. - */ -void idio_16_get_multiple(struct idio_16 __iomem *const reg, - struct idio_16_state *const state, - const unsigned long *const mask, - unsigned long *const bits) -{ - unsigned long flags; - const unsigned long out_mask = GENMASK(IDIO_16_NOUT - 1, 0); - - spin_lock_irqsave(&state->lock, flags); - - bitmap_replace(bits, bits, state->out_state, &out_mask, IDIO_16_NOUT); - if (*mask & GENMASK(23, 16)) - bitmap_set_value8(bits, ioread8(®->in0_7), 16); - if (*mask & GENMASK(31, 24)) - bitmap_set_value8(bits, ioread8(®->in8_15), 24); - - spin_unlock_irqrestore(&state->lock, flags); -} -EXPORT_SYMBOL_GPL(idio_16_get_multiple); - -/** - * idio_16_set - set signal value at signal offset - * @reg: ACCES IDIO-16 device registers - * @state: ACCES IDIO-16 device state - * @offset: offset of signal to set - * @value: value of signal to set - * - * Assigns output @value for the signal at @offset. - */ -void idio_16_set(struct idio_16 __iomem *const reg, - struct idio_16_state *const state, const unsigned long offset, - const unsigned long value) -{ - unsigned long flags; - - if (offset >= IDIO_16_NOUT) - return; - - spin_lock_irqsave(&state->lock, flags); - - __assign_bit(offset, state->out_state, value); - if (offset < 8) - iowrite8(bitmap_get_value8(state->out_state, 0), ®->out0_7); - else - iowrite8(bitmap_get_value8(state->out_state, 8), ®->out8_15); - - spin_unlock_irqrestore(&state->lock, flags); -} -EXPORT_SYMBOL_GPL(idio_16_set); - -/** - * idio_16_set_multiple - set signal values at multiple signal offsets - * @reg: ACCES IDIO-16 device registers - * @state: ACCES IDIO-16 device state - * @mask: mask of signals to set - * @bits: bitmap of signal output values - * - * Assigns output values defined by @bits for the signals defined by @mask. - */ -void idio_16_set_multiple(struct idio_16 __iomem *const reg, - struct idio_16_state *const state, - const unsigned long *const mask, - const unsigned long *const bits) -{ - unsigned long flags; - - spin_lock_irqsave(&state->lock, flags); - - bitmap_replace(state->out_state, state->out_state, bits, mask, - IDIO_16_NOUT); - if (*mask & GENMASK(7, 0)) - iowrite8(bitmap_get_value8(state->out_state, 0), ®->out0_7); - if (*mask & GENMASK(15, 8)) - iowrite8(bitmap_get_value8(state->out_state, 8), ®->out8_15); - - spin_unlock_irqrestore(&state->lock, flags); -} -EXPORT_SYMBOL_GPL(idio_16_set_multiple); - -/** - * idio_16_state_init - initialize idio_16_state structure - * @state: ACCES IDIO-16 device state - * - * Initializes the ACCES IDIO-16 device @state for use in idio-16 library - * functions. - */ -void idio_16_state_init(struct idio_16_state *const state) -{ - spin_lock_init(&state->lock); -} -EXPORT_SYMBOL_GPL(idio_16_state_init); - MODULE_AUTHOR("William Breathitt Gray"); MODULE_DESCRIPTION("ACCES IDIO-16 GPIO Library"); MODULE_LICENSE("GPL"); diff --git a/drivers/gpio/gpio-idio-16.h b/drivers/gpio/gpio-idio-16.h index 255bd8504ed7..93b08ad73065 100644 --- a/drivers/gpio/gpio-idio-16.h +++ b/drivers/gpio/gpio-idio-16.h @@ -3,9 +3,6 @@ #ifndef _IDIO_16_H_ #define _IDIO_16_H_ -#include -#include - struct device; struct regmap; struct regmap_irq; @@ -30,68 +27,6 @@ struct idio_16_regmap_config { bool filters; }; -/** - * struct idio_16 - IDIO-16 registers structure - * @out0_7: Read: FET Drive Outputs 0-7 - * Write: FET Drive Outputs 0-7 - * @in0_7: Read: Isolated Inputs 0-7 - * Write: Clear Interrupt - * @irq_ctl: Read: Enable IRQ - * Write: Disable IRQ - * @filter_ctl: Read: Activate Input Filters 0-15 - * Write: Deactivate Input Filters 0-15 - * @out8_15: Read: FET Drive Outputs 8-15 - * Write: FET Drive Outputs 8-15 - * @in8_15: Read: Isolated Inputs 8-15 - * Write: Unused - * @irq_status: Read: Interrupt status - * Write: Unused - */ -struct idio_16 { - u8 out0_7; - u8 in0_7; - u8 irq_ctl; - u8 filter_ctl; - u8 out8_15; - u8 in8_15; - u8 irq_status; -}; - -#define IDIO_16_NOUT 16 - -/** - * struct idio_16_state - IDIO-16 state structure - * @lock: synchronization lock for accessing device state - * @out_state: output signals state - */ -struct idio_16_state { - spinlock_t lock; - DECLARE_BITMAP(out_state, IDIO_16_NOUT); -}; - -/** - * idio_16_get_direction - get the I/O direction for a signal offset - * @offset: offset of signal to get direction - * - * Returns the signal direction (0=output, 1=input) for the signal at @offset. - */ -static inline int idio_16_get_direction(const unsigned long offset) -{ - return (offset >= IDIO_16_NOUT) ? 1 : 0; -} - -int idio_16_get(struct idio_16 __iomem *reg, struct idio_16_state *state, - unsigned long offset); -void idio_16_get_multiple(struct idio_16 __iomem *reg, - struct idio_16_state *state, - const unsigned long *mask, unsigned long *bits); -void idio_16_set(struct idio_16 __iomem *reg, struct idio_16_state *state, - unsigned long offset, unsigned long value); -void idio_16_set_multiple(struct idio_16 __iomem *reg, - struct idio_16_state *state, - const unsigned long *mask, const unsigned long *bits); -void idio_16_state_init(struct idio_16_state *state); - int devm_idio_16_regmap_register(struct device *dev, const struct idio_16_regmap_config *config); #endif /* _IDIO_16_H_ */ -- 2.39.2