Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp252672pxb; Mon, 13 Sep 2021 18:26:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPLJvoVojuAjuRr8F+HCKS4yiXSw1k/X9CEq2loGWzYJ7GZdQWc3f5m5NzA0qKAXhd04hJ X-Received: by 2002:a05:6e02:1112:: with SMTP id u18mr10583251ilk.75.1631582766650; Mon, 13 Sep 2021 18:26:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631582766; cv=none; d=google.com; s=arc-20160816; b=jeGwtt5D59kdJJP10FVTcHmZgVOlWCTz8l+RrMHs2BHMryckfb7/gNdl9tLqvNV36M PM2mSYMfQrQ7KMmlhb+ztqTLbK2sC2uIwWClWElV+TnZSnxOVsdalbKLhXrakOHmK29Y al+yZpP+suJ2dcMSVwj6syJgr9Ds/xAuqageI/G9i302mc/64kppQz0R/YwzXED+nn+L CuE1N3fhZf9wiyNYOJVFe5PLm6hJT1v7JwWlNjRb5eq6UnzA3n6WmhYVKy4/zzhspkgy g5gpbOky5gUYTZEKdGkFu1YM47aYxHr9V9GyEM6sJERMEQIwTwxIoK7877wH+ItuwNJ0 uyTw== 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; bh=hkD1lE+bDekOsk3f04purS2ppNnIOq0/tPO8bVUdjAA=; b=Ib7vTxOa7AyzLpUu9LnugFtD3sqyN0buqwNfFL4h7Q4KeTpvVl36G+8xhlYcS2wRJ0 9nWI5HLzzDofN+Y39RPfR0czjslIL989dzcu+g6blds5hd1iTv54JiMfXnqrg5456WMg 6ZqPfFyauFGfF3raRC/KwNndfZCA0WduTvateAfYOtt+KEZ8a/KGQAvtUjvvQi5utzwF j1X91C9NJpb5Wvp8yATR+DwZsk6jewUmADuQwX9MWvN2GqD02lHutl9ORGL0igUEt7Cj XqB596mWJYct+gcr3sn7xCKt1xOrtOSR3+Tt4eaph2NdDQnOiMkAfgVZKhDgjZrwyFdT ecWw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d16si8121945ile.94.2021.09.13.18.25.55; Mon, 13 Sep 2021 18:26:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245756AbhIMWyo (ORCPT + 99 others); Mon, 13 Sep 2021 18:54:44 -0400 Received: from gloria.sntech.de ([185.11.138.130]:51180 "EHLO gloria.sntech.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349676AbhIMWvB (ORCPT ); Mon, 13 Sep 2021 18:51:01 -0400 Received: from ip5f5a6e92.dynamic.kabel-deutschland.de ([95.90.110.146] helo=localhost.localdomain) by gloria.sntech.de with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mPulW-0003SX-2U; Tue, 14 Sep 2021 00:49:30 +0200 From: Heiko Stuebner To: linus.walleij@linaro.org, bgolaszewski@baylibre.com Cc: heiko@sntech.de, jay.xu@rock-chips.com, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/4] gpio/rockchip: extended debounce support is only available on v2 Date: Tue, 14 Sep 2021 00:49:23 +0200 Message-Id: <20210913224926.1260726-2-heiko@sntech.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210913224926.1260726-1-heiko@sntech.de> References: <20210913224926.1260726-1-heiko@sntech.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The gpio driver runs into issues on v1 gpio blocks, as the db_clk and the whole extended debounce support is only ever defined on v2. So checking for the IS_ERR on the db_clk is not enough, as it will be NULL on v1. Fix this by adding the needed condition for v2 first before checking the existence of the db_clk. This caused my rk3288-veyron-pinky to enter a reboot loop when it tried to enable the power-key as adc-key device. Fixes: 3bcbd1a85b68 ("gpio/rockchip: support next version gpio controller") Signed-off-by: Heiko Stuebner --- drivers/gpio/gpio-rockchip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-rockchip.c b/drivers/gpio/gpio-rockchip.c index 036b2d959503..16d9bf7188e3 100644 --- a/drivers/gpio/gpio-rockchip.c +++ b/drivers/gpio/gpio-rockchip.c @@ -195,7 +195,7 @@ static int rockchip_gpio_set_debounce(struct gpio_chip *gc, unsigned int cur_div_reg; u64 div; - if (!IS_ERR(bank->db_clk)) { + if (bank->gpio_type == GPIO_TYPE_V2 && !IS_ERR(bank->db_clk)) { div_debounce_support = true; freq = clk_get_rate(bank->db_clk); max_debounce = (GENMASK(23, 0) + 1) * 2 * 1000000 / freq; -- 2.29.2