From nobody Sat Nov 23 17:52:08 2024 Received: from mail-m1973173.qiye.163.com (mail-m1973173.qiye.163.com [220.197.31.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5590020512A; Tue, 12 Nov 2024 03:09:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=220.197.31.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731381000; cv=none; b=BWFVz2nTXPKCzuJA8V0XKqJvwqgvS8P5fzwKmF4HMAztMxWxW5YyL59P/biME8UjnNWvEs7hPae9ooCRBrgVusF2N21uwU9n+LzQKlUF2gNhtXx8mVAHD7b5wJakJtEanNrB1rJxWJulg/qLdvOwgkE362lyDTTYkOSM0zVsnHY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731381000; c=relaxed/simple; bh=ANf6993tejPqzHmhVSsxoxdVhoMu/HJ3RWBKUAdLn9M=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qm+eO/Z6YbzTu8pBhMdFyqf3F03y6VCUqNRPLA0dG9vO80mIBB5C2ivVyzlyi9m2x+tmO2BhYhxJrsPujzO1T4zRN8IJ+9uZZYereFN6uVBZLJ/hEzXFCJdGvkFIOuM5N3x5TctzzSdtO7iu8RmQjSlytseyh1ej3c2mMvZ47Fw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rock-chips.com; spf=pass smtp.mailfrom=rock-chips.com; dkim=pass (1024-bit key) header.d=rock-chips.com header.i=@rock-chips.com header.b=f+N5aUGC; arc=none smtp.client-ip=220.197.31.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rock-chips.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rock-chips.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=rock-chips.com header.i=@rock-chips.com header.b="f+N5aUGC" Received: from rockchip.. (unknown [58.22.7.114]) by smtp.qiye.163.com (Hmail) with ESMTP id 275d3f1d; Tue, 12 Nov 2024 09:54:13 +0800 (GMT+08:00) From: Ye Zhang To: Ye Zhang , linus.walleij@linaro.org, brgl@bgdev.pl, heiko@sntech.de, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, mika.westerberg@linux.intel.com, andriy.shevchenko@linux.intel.com, tao.huang@rock-chips.com, finley.xiao@rock-chips.com, tim.chen@rock-chips.com, elaine.zhang@rock-chips.com, Sebastian Reichel Subject: [PATCH v5 1/4] gpio: rockchip: explan the format of the GPIO version ID Date: Tue, 12 Nov 2024 09:54:05 +0800 Message-Id: <20241112015408.3139996-2-ye.zhang@rock-chips.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241112015408.3139996-1-ye.zhang@rock-chips.com> References: <20241112015408.3139996-1-ye.zhang@rock-chips.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFDSUNOT01LS0k3V1ktWUFJV1kPCRoVCBIfWUFZGUkZHlZDGB0ZQ0gaGkhOGRhWFRQJFh oXVRMBExYaEhckFA4PWVdZGBILWUFZTkNVSUlVTFVKSk9ZV1kWGg8SFR0UWUFZT0tIVUpLSUhCSE NVSktLVUpCS0tZBg++ X-HM-Tid: 0a931e14163509d8kunm275d3f1d X-HM-MType: 1 X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6NQw6Sww5HDIoMBoWPysZSRpL Mw8aC0JVSlVKTEhKSExNT05PTkJIVTMWGhIXVQIeVQETGhUcOwkUGBBWGBMSCwhVGBQWRVlXWRIL WUFZTkNVSUlVTFVKSk9ZV1kIAVlBSkpDTjcG DKIM-Signature: a=rsa-sha256; b=f+N5aUGCj+VLxIOLvKP23n978ZTd+BlIfa0hCJ9vp5lR/8Zf/aiF7anhUIdCXdvaBUd3/3lj4o+EtKERejIfmr2T5G7zTzZUK1B4HBM3JgOzsQUvQo6J3/WY37/5j0uUHiyfKP86nDaa/YcS4hOTa0Ojl1Cv03hxjUi5yJkERaM=; s=default; c=relaxed/relaxed; d=rock-chips.com; v=1; bh=W3+qCrfZTihYEk4pDOtbMVILileo3xKIzptsJVcIneM=; h=date:mime-version:subject:message-id:from; Content-Type: text/plain; charset="utf-8" Remove redundant comments and provide a detailed explanation of the GPIO version ID. Signed-off-by: Ye Zhang Reviewed-by: Andy Shevchenko Reviewed-by: Sebastian Reichel --- drivers/gpio/gpio-rockchip.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpio-rockchip.c b/drivers/gpio/gpio-rockchip.c index 365ab947983c..702e711f9c23 100644 --- a/drivers/gpio/gpio-rockchip.c +++ b/drivers/gpio/gpio-rockchip.c @@ -26,9 +26,15 @@ #include "../pinctrl/core.h" #include "../pinctrl/pinctrl-rockchip.h" =20 +/* + * Version ID Register + * Bits [31:24] - Major Version + * Bits [23:16] - Minor Version + * Bits [15:0] - Revision Number + */ #define GPIO_TYPE_V1 (0) /* GPIO Version ID reserved */ -#define GPIO_TYPE_V2 (0x01000C2B) /* GPIO Version ID 0x01000C2B */ -#define GPIO_TYPE_V2_1 (0x0101157C) /* GPIO Version ID 0x0101157C */ +#define GPIO_TYPE_V2 (0x01000C2B) +#define GPIO_TYPE_V2_1 (0x0101157C) =20 static const struct rockchip_gpio_regs gpio_regs_v1 =3D { .port_dr =3D 0x00, --=20 2.34.1 From nobody Sat Nov 23 17:52:08 2024 Received: from mail-m121147.qiye.163.com (mail-m121147.qiye.163.com [115.236.121.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4033020495C; Tue, 12 Nov 2024 01:54:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.236.121.147 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731376469; cv=none; b=qrCimj/0WxpX8Vvh4uDT/dfDcTKIidkn8y24xRYliz53Qxc9gSozgzF/9OvoEbUptVLVIrJTCOAj36wY58Ye+ysr9eylTX1+T6NwMqiDPP8eessPt1gmbnffjyN0Z0Opon2gwLBY74fP6DbNscToP+cop/YH+nd/VxE45B6UxS4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731376469; c=relaxed/simple; bh=fE7zm9tjfVdPksokzMrpzgROw8rWpB41j1e8I07ChXY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=rwDXE+h+iYLjzI6rtdoL1R/60vE/gEhRy5uAPAvn4MRYo/UVh4w9ioE3HpDthm5kh46Bvjyvyhmb0cJ5vd8Ex2ATBNIs6B7+JUZTSDMhi7bJDEwGECrawsq/qqI6vq2KUtmU5M8L2v4lgWV87IT/BLt36vp9UkShIsJ0OMtd9v0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rock-chips.com; spf=pass smtp.mailfrom=rock-chips.com; dkim=pass (1024-bit key) header.d=rock-chips.com header.i=@rock-chips.com header.b=F3MHuWUS; arc=none smtp.client-ip=115.236.121.147 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rock-chips.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rock-chips.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=rock-chips.com header.i=@rock-chips.com header.b="F3MHuWUS" Received: from rockchip.. (unknown [58.22.7.114]) by smtp.qiye.163.com (Hmail) with ESMTP id 275d3f25; Tue, 12 Nov 2024 09:54:14 +0800 (GMT+08:00) From: Ye Zhang To: Ye Zhang , linus.walleij@linaro.org, brgl@bgdev.pl, heiko@sntech.de, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, mika.westerberg@linux.intel.com, andriy.shevchenko@linux.intel.com, tao.huang@rock-chips.com, finley.xiao@rock-chips.com, tim.chen@rock-chips.com, elaine.zhang@rock-chips.com, Sebastian Reichel Subject: [PATCH v5 2/4] gpio: rockchip: change the GPIO version judgment logic Date: Tue, 12 Nov 2024 09:54:06 +0800 Message-Id: <20241112015408.3139996-3-ye.zhang@rock-chips.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241112015408.3139996-1-ye.zhang@rock-chips.com> References: <20241112015408.3139996-1-ye.zhang@rock-chips.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFDSUNOT01LS0k3V1ktWUFJV1kPCRoVCBIfWUFZGUtKTlZJSBkaGUweGh8eSB9WFRQJFh oXVRMBExYaEhckFA4PWVdZGBILWUFZTkNVSUlVTFVKSk9ZV1kWGg8SFR0UWUFZT0tIVUpLSUhCSE NVSktLVUpCS0tZBg++ X-HM-Tid: 0a931e141c3309d8kunm275d3f25 X-HM-MType: 1 X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6MRA6FQw6PzIqDho4LzRNSRoO GklPFDFVSlVKTEhKSExNT05NSk1LVTMWGhIXVQIeVQETGhUcOwkUGBBWGBMSCwhVGBQWRVlXWRIL WUFZTkNVSUlVTFVKSk9ZV1kIAVlBSkhPTzcG DKIM-Signature: a=rsa-sha256; b=F3MHuWUS3d7N2TMf+DeNGtdsPILAIO8YupTzq3wteHiaqL+olK0mBrcHFnMpuC24nnfkMFmf9vzEWW1Gxl+n7X97MPwUR/6DY09A7rFs6Uafk8hKCVfY94VFNAo01nyQCTTnin82eB7UOhofz6rkiNHw5IQs4jjmF1o0bZLIOtE=; s=default; c=relaxed/relaxed; d=rock-chips.com; v=1; bh=02V1JqzOhH1cFyOmJm73EPScEZkCm2Urre1Jqg9gWPc=; h=date:mime-version:subject:message-id:from; Content-Type: text/plain; charset="utf-8" Have a list of valid IDs and default to -ENODEV. Signed-off-by: Ye Zhang Reviewed-by: Sebastian Reichel Reviewed-by: Andy Shevchenko --- drivers/gpio/gpio-rockchip.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/gpio-rockchip.c b/drivers/gpio/gpio-rockchip.c index 702e711f9c23..49eaefeed8fa 100644 --- a/drivers/gpio/gpio-rockchip.c +++ b/drivers/gpio/gpio-rockchip.c @@ -667,8 +667,9 @@ static int rockchip_get_bank_data(struct rockchip_pin_b= ank *bank) clk_prepare_enable(bank->clk); id =3D readl(bank->reg_base + gpio_regs_v2.version_id); =20 - /* If not gpio v2, that is default to v1. */ - if (id =3D=3D GPIO_TYPE_V2 || id =3D=3D GPIO_TYPE_V2_1) { + switch (id) { + case GPIO_TYPE_V2: + case GPIO_TYPE_V2_1: bank->gpio_regs =3D &gpio_regs_v2; bank->gpio_type =3D GPIO_TYPE_V2; bank->db_clk =3D of_clk_get(bank->of_node, 1); @@ -677,9 +678,14 @@ static int rockchip_get_bank_data(struct rockchip_pin_= bank *bank) clk_disable_unprepare(bank->clk); return -EINVAL; } - } else { + break; + case GPIO_TYPE_V1: bank->gpio_regs =3D &gpio_regs_v1; bank->gpio_type =3D GPIO_TYPE_V1; + break; + default: + dev_err(bank->dev, "unsupported version ID: 0x%08x\n", id); + return -ENODEV; } =20 return 0; --=20 2.34.1 From nobody Sat Nov 23 17:52:08 2024 Received: from mail-m127109.qiye.163.com (mail-m127109.qiye.163.com [115.236.127.109]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 02E7F433BE; Tue, 12 Nov 2024 02:09:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.236.127.109 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731377385; cv=none; b=rJlMrXRj4Lp0DDNEam5CmiqLWcswMP3uH80zBGUUyme0DOKk4trW97hxoDk8vFUhnOZwszAvW85VIIITOkc43ZDajdMubkhU/g6ZmCXsPYcakGfktjyz7cUBftdoAPnyE89fUyZM17Qx57d4Lkjop8lDIHg2jPnsmcL4IQFa4cU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731377385; c=relaxed/simple; bh=ahjzUqaMdUrAy2wp/VjVAPMXaYb2DOZSLGxot3Mi9ww=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=q8nG1uGcSPoubxl1gBJlb2mAfbYOPufPoFYPaaPa380yJBs7rMKu2nidmhSRCRRVrO5+M9JGu/K4WLZ4DhQO6tDlm/RFimJY/dtuD4U7ocHgLfi/cs+pkQIyKYWgbHy4TDJAiXDsopIdVYHzde1kLY7umy+dUcUoKkL22pEWOn0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rock-chips.com; spf=pass smtp.mailfrom=rock-chips.com; dkim=pass (1024-bit key) header.d=rock-chips.com header.i=@rock-chips.com header.b=fu2EHIOx; arc=none smtp.client-ip=115.236.127.109 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rock-chips.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rock-chips.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=rock-chips.com header.i=@rock-chips.com header.b="fu2EHIOx" Received: from rockchip.. (unknown [58.22.7.114]) by smtp.qiye.163.com (Hmail) with ESMTP id 275d3f2e; Tue, 12 Nov 2024 09:54:16 +0800 (GMT+08:00) From: Ye Zhang To: Ye Zhang , linus.walleij@linaro.org, brgl@bgdev.pl, heiko@sntech.de, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, mika.westerberg@linux.intel.com, andriy.shevchenko@linux.intel.com, tao.huang@rock-chips.com, finley.xiao@rock-chips.com, tim.chen@rock-chips.com, elaine.zhang@rock-chips.com, Sebastian Reichel Subject: [PATCH v5 3/4] gpio: rockchip: support new version GPIO Date: Tue, 12 Nov 2024 09:54:07 +0800 Message-Id: <20241112015408.3139996-4-ye.zhang@rock-chips.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241112015408.3139996-1-ye.zhang@rock-chips.com> References: <20241112015408.3139996-1-ye.zhang@rock-chips.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFDSUNOT01LS0k3V1ktWUFJV1kPCRoVCBIfWUFZGU4fTVZKTkpCGR9LS00eHh5WFRQJFh oXVRMBExYaEhckFA4PWVdZGBILWUFZTkNVSUlVTFVKSk9ZV1kWGg8SFR0UWUFZT0tIVUpLSUhCSE NVSktLVUpCS0tZBg++ X-HM-Tid: 0a931e14225209d8kunm275d3f2e X-HM-MType: 1 X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6NAw6GCo*CzIvPBorLzVJSSkK DwtPCj9VSlVKTEhKSExNT05MQ09OVTMWGhIXVQIeVQETGhUcOwkUGBBWGBMSCwhVGBQWRVlXWRIL WUFZTkNVSUlVTFVKSk9ZV1kIAVlBSkpLQjcG DKIM-Signature: a=rsa-sha256; b=fu2EHIOxhvP7wViWjo2YWfrsP9JuePzfDSPnG2LygmO3peRTME+AGx8WyAuLoKE6O6Fjzl/R5Gw97G+cJob66OkJe/KTTZRECzxPwv82N6HoyhpyuHy0Lg4gvdwkPSCXFTH/U+jqSClzdEVK7/2i9OJAUmC6M9TsWHp6/A1Vfbo=; s=default; c=relaxed/relaxed; d=rock-chips.com; v=1; bh=KJVrsNmQEFDEWaKv1z6mIltDd6uza/zB/f3D7dwvf3A=; h=date:mime-version:subject:message-id:from; Content-Type: text/plain; charset="utf-8" Support the next version GPIO controller on SoCs like rk3576. Signed-off-by: Ye Zhang Reviewed-by: Andy Shevchenko Reviewed-by: Sebastian Reichel --- drivers/gpio/gpio-rockchip.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpio/gpio-rockchip.c b/drivers/gpio/gpio-rockchip.c index 49eaefeed8fa..c090cac694bf 100644 --- a/drivers/gpio/gpio-rockchip.c +++ b/drivers/gpio/gpio-rockchip.c @@ -35,6 +35,7 @@ #define GPIO_TYPE_V1 (0) /* GPIO Version ID reserved */ #define GPIO_TYPE_V2 (0x01000C2B) #define GPIO_TYPE_V2_1 (0x0101157C) +#define GPIO_TYPE_V2_2 (0x010219C8) =20 static const struct rockchip_gpio_regs gpio_regs_v1 =3D { .port_dr =3D 0x00, @@ -670,6 +671,7 @@ static int rockchip_get_bank_data(struct rockchip_pin_b= ank *bank) switch (id) { case GPIO_TYPE_V2: case GPIO_TYPE_V2_1: + case GPIO_TYPE_V2_2: bank->gpio_regs =3D &gpio_regs_v2; bank->gpio_type =3D GPIO_TYPE_V2; bank->db_clk =3D of_clk_get(bank->of_node, 1); --=20 2.34.1 From nobody Sat Nov 23 17:52:08 2024 Received: from mail-m127206.xmail.ntesmail.com (mail-m127206.xmail.ntesmail.com [115.236.127.206]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2E3DD16630A; Tue, 12 Nov 2024 02:09:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.236.127.206 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731377381; cv=none; b=qrtDFhklsckauWrrnmq2Vh3D3I3Z3O/GYbzs45HHHToC32JfLKhNlD65AYviNzOlvEYb1j/CKfRHNvRdglmct5cHhH1ulvek3+OxdcmEXHEiea0za1PiwDT+PV/qfnaLLdOjh6IgFF1dRzEocMa1wNp+tU4IWvNgTqNzcJmqEVw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731377381; c=relaxed/simple; bh=ikDyrepRcR/GcMVOs1PYQ5moK8iBWkhxGfTp1TVD2ZE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=SzF4wpOxTURRP3IGx+qFMXh6igXSuuNhkiqNh7zXFTxYCUrbnKYJliT9VHd+Cl06FWw6MXGhmUULUKP9jJzfWSCd0t9ksqA29xEj8I4IfMxVthz3opojy68YfQ8PrJtWCRNhukV0O2q87NZaF6+DYZ8aQD4RJnBtJZAeh3bQVMs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rock-chips.com; spf=pass smtp.mailfrom=rock-chips.com; dkim=pass (1024-bit key) header.d=rock-chips.com header.i=@rock-chips.com header.b=B4BuOlL5; arc=none smtp.client-ip=115.236.127.206 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rock-chips.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rock-chips.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=rock-chips.com header.i=@rock-chips.com header.b="B4BuOlL5" Received: from rockchip.. (unknown [58.22.7.114]) by smtp.qiye.163.com (Hmail) with ESMTP id 275d3f37; Tue, 12 Nov 2024 09:54:17 +0800 (GMT+08:00) From: Ye Zhang To: Ye Zhang , linus.walleij@linaro.org, brgl@bgdev.pl, heiko@sntech.de, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, mika.westerberg@linux.intel.com, andriy.shevchenko@linux.intel.com, tao.huang@rock-chips.com, finley.xiao@rock-chips.com, tim.chen@rock-chips.com, elaine.zhang@rock-chips.com, Sebastian Reichel Subject: [PATCH v5 4/4] gpio: rockchip: Set input direction when request irq Date: Tue, 12 Nov 2024 09:54:08 +0800 Message-Id: <20241112015408.3139996-5-ye.zhang@rock-chips.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241112015408.3139996-1-ye.zhang@rock-chips.com> References: <20241112015408.3139996-1-ye.zhang@rock-chips.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFDSUNOT01LS0k3V1ktWUFJV1kPCRoVCBIfWUFZGU1PTFZIT0kZTRpCHUtJT09WFRQJFh oXVRMBExYaEhckFA4PWVdZGBILWUFZTkNVSUlVTFVKSk9ZV1kWGg8SFR0UWUFZT0tIVUpLSUhCSE NVSktLVUpCS0tZBg++ X-HM-Tid: 0a931e1428e409d8kunm275d3f37 X-HM-MType: 1 X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6NBQ6ISo5KTIqMBoQPzUSSSwj OUIKCjVVSlVKTEhKSExNT05CT0hCVTMWGhIXVQIeVQETGhUcOwkUGBBWGBMSCwhVGBQWRVlXWRIL WUFZTkNVSUlVTFVKSk9ZV1kIAVlBSktIQzcG DKIM-Signature: a=rsa-sha256; b=B4BuOlL5tsBqQdef+Wlc71JSyi354lSEC1mheLS2w85oIb4J0/jXCKWuyGD4Z1mjCVP08Eq7YemWzBZu+Xtoz6Rvb6c2rLe8I7osMBL6piJ7gjxf1r8+xGfHJ2JlnHlkF1k1QJkDv/i092IN/48D9N+WoOL67icrt/bPch0PtzM=; s=default; c=relaxed/relaxed; d=rock-chips.com; v=1; bh=mNEmQIXIeVppZTHWDm1sWax6s+N6SW3qLZo4jlaSVhk=; h=date:mime-version:subject:message-id:from; Content-Type: text/plain; charset="utf-8" Since the GPIO can only generate interrupts when its direction is set to input, it is set to input before requesting the interrupt resources. Signed-off-by: Ye Zhang Reviewed-by: Sebastian Reichel --- drivers/gpio/gpio-rockchip.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-rockchip.c b/drivers/gpio/gpio-rockchip.c index c090cac694bf..cdfdd5501a1e 100644 --- a/drivers/gpio/gpio-rockchip.c +++ b/drivers/gpio/gpio-rockchip.c @@ -476,8 +476,11 @@ static int rockchip_irq_reqres(struct irq_data *d) { struct irq_chip_generic *gc =3D irq_data_get_irq_chip_data(d); struct rockchip_pin_bank *bank =3D gc->private; + irq_hw_number_t hwirq =3D irqd_to_hwirq(d); =20 - return gpiochip_reqres_irq(&bank->gpio_chip, d->hwirq); + rockchip_gpio_direction_input(&bank->gpio_chip, hwirq); + + return gpiochip_reqres_irq(&bank->gpio_chip, hwirq); } =20 static void rockchip_irq_relres(struct irq_data *d) --=20 2.34.1