From patchwork Wed Jan 25 11:05:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 646778 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32790C27C76 for ; Wed, 25 Jan 2023 11:06:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235332AbjAYLGj (ORCPT ); Wed, 25 Jan 2023 06:06:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235255AbjAYLGh (ORCPT ); Wed, 25 Jan 2023 06:06:37 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E93DF1CAC6 for ; Wed, 25 Jan 2023 03:05:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674644755; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Gvq9E3r+IZUlNMEwdsv/mQuOuvjAe/wZlrgN1AmIzow=; b=EcRwqDXBr8QissJnym9bbH5Z5v424H0VHpjBJ1Ur2HUD7gyYjAHuEO9UsDGCMOPESXDVKf YC7H+SGW8u1eDSYPgL+DNy8lV1ZW5259hlQquDOGBds2tAj/NP0crng0ojVziY82ybDNLZ nWM8zqt5BQEx6mRqV3xApl1LNNcDrB4= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-16-VAfJITeUNnWcvn-cuoW9fw-1; Wed, 25 Jan 2023 06:05:51 -0500 X-MC-Unique: VAfJITeUNnWcvn-cuoW9fw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7241B85C064; Wed, 25 Jan 2023 11:05:51 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.193.104]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3B738492B00; Wed, 25 Jan 2023 11:05:50 +0000 (UTC) From: Hans de Goede To: Bartosz Golaszewski , Linus Walleij Cc: Hans de Goede , Daniel Scally , Andy Shevchenko , Sakari Ailus , Kate Hsuan , linux-gpio@vger.kernel.org Subject: [PATCH v2 resend 1/2] gpio: tps68470: Fix tps68470_gpio_get() reading from the wrong register Date: Wed, 25 Jan 2023 12:05:46 +0100 Message-Id: <20230125110547.18093-2-hdegoede@redhat.com> In-Reply-To: <20230125110547.18093-1-hdegoede@redhat.com> References: <20230125110547.18093-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org For the regular GPIO pins the value should be read from TPS68470_REG_GPDI, so that the actual value of the pin is read, rather than the value the pin would output when put in output mode. Fixes: 275b13a65547 ("gpio: Add support for TPS68470 GPIOs") Reviewed-by: Daniel Scally Tested-by: Daniel Scally Reviewed-by: Sakari Ailus Signed-off-by: Hans de Goede --- Changes in v2: - Add Fixes tag --- drivers/gpio/gpio-tps68470.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-tps68470.c b/drivers/gpio/gpio-tps68470.c index aaddcabe9b35..778a72cf800c 100644 --- a/drivers/gpio/gpio-tps68470.c +++ b/drivers/gpio/gpio-tps68470.c @@ -30,7 +30,7 @@ static int tps68470_gpio_get(struct gpio_chip *gc, unsigned int offset) { struct tps68470_gpio_data *tps68470_gpio = gpiochip_get_data(gc); struct regmap *regmap = tps68470_gpio->tps68470_regmap; - unsigned int reg = TPS68470_REG_GPDO; + unsigned int reg = TPS68470_REG_GPDI; int val, ret; if (offset >= TPS68470_N_REGULAR_GPIO) { From patchwork Wed Jan 25 11:05:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 646777 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97CF0C27C76 for ; Wed, 25 Jan 2023 11:06:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235383AbjAYLGr (ORCPT ); Wed, 25 Jan 2023 06:06:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235336AbjAYLGq (ORCPT ); Wed, 25 Jan 2023 06:06:46 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9827A3F2A6 for ; Wed, 25 Jan 2023 03:05:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674644757; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=n5qm8P0JsQd5Owi7O2JfGZus7IqmfxLWRnRacW5aPkM=; b=fRvuIKP+53k5zYKD42fUzPbMguGnMFhhfKBmPQw+rlgTK+8PBFu2B46bLtc1R4TNcSbOjW 8zklYCkbMuiRFjuqetivyWRyYvLfYPjBpyo2ljCO6sFP1ybxJZT35MmjLVmsrao0b2iLui Qswf7OH4WphvTRI09t3Qmk9h5uev3cg= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-494-Uz4rKV6aMSCwH8rViEOnzw-1; Wed, 25 Jan 2023 06:05:53 -0500 X-MC-Unique: Uz4rKV6aMSCwH8rViEOnzw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EA0873C10EC3; Wed, 25 Jan 2023 11:05:52 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.193.104]) by smtp.corp.redhat.com (Postfix) with ESMTP id AA93F492B02; Wed, 25 Jan 2023 11:05:51 +0000 (UTC) From: Hans de Goede To: Bartosz Golaszewski , Linus Walleij Cc: Hans de Goede , Daniel Scally , Andy Shevchenko , Sakari Ailus , Kate Hsuan , linux-gpio@vger.kernel.org Subject: [PATCH v2 resend 2/2] gpio: tps68470: Make tps68470_gpio_output() always set the initial value Date: Wed, 25 Jan 2023 12:05:47 +0100 Message-Id: <20230125110547.18093-3-hdegoede@redhat.com> In-Reply-To: <20230125110547.18093-1-hdegoede@redhat.com> References: <20230125110547.18093-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Make tps68470_gpio_output() call tps68470_gpio_set() for output-only pins too, so that the initial value passed to gpiod_direction_output() is honored for these pins too. Fixes: 275b13a65547 ("gpio: Add support for TPS68470 GPIOs") Reviewed-by: Andy Shevchenko Reviewed-by: Daniel Scally Tested-by: Daniel Scally Reviewed-by: Sakari Ailus Signed-off-by: Hans de Goede --- Changes in v2: - Add Fixes tag - Add Andy's Reviewed-by --- drivers/gpio/gpio-tps68470.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/gpio-tps68470.c b/drivers/gpio/gpio-tps68470.c index 778a72cf800c..2ca86fbe1d84 100644 --- a/drivers/gpio/gpio-tps68470.c +++ b/drivers/gpio/gpio-tps68470.c @@ -91,13 +91,13 @@ static int tps68470_gpio_output(struct gpio_chip *gc, unsigned int offset, struct tps68470_gpio_data *tps68470_gpio = gpiochip_get_data(gc); struct regmap *regmap = tps68470_gpio->tps68470_regmap; + /* Set the initial value */ + tps68470_gpio_set(gc, offset, value); + /* rest are always outputs */ if (offset >= TPS68470_N_REGULAR_GPIO) return 0; - /* Set the initial value */ - tps68470_gpio_set(gc, offset, value); - return regmap_update_bits(regmap, TPS68470_GPIO_CTL_REG_A(offset), TPS68470_GPIO_MODE_MASK, TPS68470_GPIO_MODE_OUT_CMOS);