From patchwork Wed Feb 7 18:01:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charles Perry X-Patchwork-Id: 198031 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp2421365dyb; Wed, 7 Feb 2024 10:23:07 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUQ2NNFava78DFgF6Ym0kHEasvnXmP45NcXcb+0XN7XkMLctlO1UqIOU2CDG54JOCy6t3+FO+JArz/QuFtf57ESciOSzw== X-Google-Smtp-Source: AGHT+IHdVF7oaR6UqhJxK74jSFL4d4ywBpBDWH6KBloAJ3k45pasTu9+oGocRKaRpNOFn/A2zrAz X-Received: by 2002:a05:6e02:160d:b0:363:bfef:66d2 with SMTP id t13-20020a056e02160d00b00363bfef66d2mr8297055ilu.16.1707330187445; Wed, 07 Feb 2024 10:23:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707330187; cv=pass; d=google.com; s=arc-20160816; b=VizvkTIgW1fwmtSKGHAbuedMkOZnrso2+yY/5L8P+hLq0WUzXff+CF3hjdD2k+hXqb 17FJd7ADRSJi5kLqLEO5XhmMIX3t9hOJJD6IKLe462J+WGdxQ5838aeNstMwP8knRSUf xZMThuqMTQE5k/rkwxhUBsWKx8L/frnmoThSyfrIp6G/T9XFmvoCyIeD2fOQfNcsj0eY u7uHAmwdmOWjTNVAhfvSyrgeAQXO2U/ldDOjEVC8RcmZQ6YAcFAtpyY9B9xrfKwPXlIF bHLA/euy9hy2+PX/2z+T0oy2HrnWen6uDlsJLKzW83CmBQ39V/L84iBv7sYkPq+wLVQ7 uetQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature:dkim-filter; bh=wV6mjwfrwD5VGN0XS4xudNMb5yOVG7KLDPWvun2sA0c=; fh=q6EdrehuPRLyTjsRNG6Yvr3PjfoTZ+oa8zzI/V30eu0=; b=r3XNl8+NfT0IFOOnoszG6mFVP4/wxmjWCL/xXlCw4hqtnTNevD8x76wb5uc2dC9iGZ TSTCPQj0sMt0nLOGM80pfzqGhbCJ9jwl7u2s2hCeV9XnUZ2b2h3FXaXpFaBjCotrJIiu Hvphg48o2NMISj4kwRtEbn967BC8rpmRoibT18LPR5f+akIYz1UlSNcCpPD4sMHn+Ahg TPospl89qk31lZXiuH4cLBifSv23HHcTkm0osBihd3rWjX0CO8Lx2eZcJAO5XrpTevFp 2p1cWoaa53LXRpIi5nLL5ckzqdbB0sAQ8JXcPM3FjzzXIZsBqusqG4DXrquZv0CQW5RY muVw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@savoirfairelinux.com header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=RZxTyRA6; arc=pass (i=1 spf=pass spfdomain=savoirfairelinux.com dkim=pass dkdomain=savoirfairelinux.com); spf=pass (google.com: domain of linux-kernel+bounces-56883-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56883-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCW2zyuxRd6VanF7CzLIeI7eDKk7RW2ikBxGBINDBJVDBwKun0rstPHzp3s3w+/6a3VTK5bstc7jZ0OceNdcXj8aShNVjw== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id e26-20020a65689a000000b005d8af0b2061si1948763pgt.591.2024.02.07.10.23.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 10:23:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-56883-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@savoirfairelinux.com header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=RZxTyRA6; arc=pass (i=1 spf=pass spfdomain=savoirfairelinux.com dkim=pass dkdomain=savoirfairelinux.com); spf=pass (google.com: domain of linux-kernel+bounces-56883-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56883-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id EF221B29F9C for ; Wed, 7 Feb 2024 18:11:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BF38186149; Wed, 7 Feb 2024 18:02:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=savoirfairelinux.com header.i=@savoirfairelinux.com header.b="RZxTyRA6" Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) (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 8E5EA82D96; Wed, 7 Feb 2024 18:02:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=208.88.110.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707328954; cv=none; b=qt9ZGABWJdo+IOX9yB8v4f6Rhhrwz50E6XpMXDICWYHt2Joy5Kb8OURI2x6KsCgQBUsb64+ur6DEeEHdHkdDaN0VULahnlFJ+dwFbmiCul1wpeSn4vxllDmggYQte7tVHka5RCjAM2hGhwtjqWo5AU7C8Y11SoZ/EHogJUVrfsI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707328954; c=relaxed/simple; bh=77uzNKLxV1R6k1YJfFpxFNDKxAoJvkjdZ28kaV1uqXk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=l/W4E7kNLR64PXf6ls1cPvxiFN6AK9V7MoGJ6E+IQImKCJj5hwflOjVcNFouZe1G4LgnoMerZSVFMJHlcdX6svY/kVII/ulGyJeshZmU9WimHUCpml1SJRSDCiPT4skaDU2TLZ+hpwvqxx5+V4/diXjHeW5whmdVjclT7FOfgH4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=savoirfairelinux.com; spf=pass smtp.mailfrom=savoirfairelinux.com; dkim=pass (2048-bit key) header.d=savoirfairelinux.com header.i=@savoirfairelinux.com header.b=RZxTyRA6; arc=none smtp.client-ip=208.88.110.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=savoirfairelinux.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=savoirfairelinux.com Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 5F69D9C46C5; Wed, 7 Feb 2024 13:02:31 -0500 (EST) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10032) with ESMTP id swXEbVmF0ocO; Wed, 7 Feb 2024 13:02:30 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id DF2B49C48BD; Wed, 7 Feb 2024 13:02:30 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com DF2B49C48BD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1707328950; bh=wV6mjwfrwD5VGN0XS4xudNMb5yOVG7KLDPWvun2sA0c=; h=From:To:Date:Message-ID:MIME-Version; b=RZxTyRA6g8UC73Rf6FIZdvzMThfOk/DX7bGAkBzR8SrsxApXOAvjs5OkoJr+hPpkH yH2stvhnQYMXAADYXdJf7mPXp9yf1Rcm0pAjleVMHwgLmTwuA6WZEYruYWtcL215MT eMOvoTueTLtOSPWorm5CnWpNxtlrodPO2TzKiSlXG6294K+aFMjqW3lFm4BKeejS0g zZnaypPbKaFmxd1w+UmlHi1XycMJz06MFojyB4UvsNP1cFldu58xZyJ2kE6bcbTdNR 03amLILuS366/Jr0vMt5+4wZZIBT/l22giiJVoPonJyx+AJxWOsE3dN2AFHbibHKTH xtW4qTrquHtYQ== X-Virus-Scanned: amavis at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10026) with ESMTP id lwfgIO3Vw8bY; Wed, 7 Feb 2024 13:02:30 -0500 (EST) Received: from pcperry.mtl.sfl (unknown [192.168.51.254]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id B8A2A9C46C5; Wed, 7 Feb 2024 13:02:30 -0500 (EST) From: Charles Perry To: mdf@kernel.org Cc: avandiver@markem-imaje.com, bcody@markem-imaje.com, Charles Perry , Wu Hao , Xu Yilun , Tom Rix , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Michal Simek , kishore Manne , linux-fpga@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 3/5] fpga: xilinx-core: rename "prog_b" and "init-b" gpios Date: Wed, 7 Feb 2024 13:01:26 -0500 Message-ID: <20240207180142.79625-4-charles.perry@savoirfairelinux.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240207180142.79625-1-charles.perry@savoirfairelinux.com> References: <20240207180142.79625-1-charles.perry@savoirfairelinux.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790265458834577105 X-GMAIL-MSGID: 1790265458834577105 New bindings use "prog" and "init". The legacy name is used as a fallback. Signed-off-by: Charles Perry Reviewed-by: Krzysztof Kozlowski --- drivers/fpga/xilinx-core.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/drivers/fpga/xilinx-core.c b/drivers/fpga/xilinx-core.c index 597e8b7a530b7..4d2416e71d59c 100644 --- a/drivers/fpga/xilinx-core.c +++ b/drivers/fpga/xilinx-core.c @@ -171,6 +171,28 @@ static int xilinx_core_write_complete(struct fpga_manager *mgr, return -ETIMEDOUT; } +/** + * xilinx_core_devm_gpiod_get - Obtain a resource-managed GPIO using a + * legacy consumer name fallback. + * + * @dev: Device managing the GPIO + * @con_id: Consumer id + * @legacy_con_id: Legacy consumer id + * @flags: optional GPIO initialization flags + */ +static inline struct gpio_desc * +xilinx_core_devm_gpiod_get(struct device *dev, const char *con_id, + const char *legacy_con_id, enum gpiod_flags flags) +{ + struct gpio_desc *desc; + + desc = devm_gpiod_get(dev, con_id, flags); + if (IS_ERR(desc) && PTR_ERR(desc) == -ENOENT) + desc = devm_gpiod_get(dev, legacy_con_id, flags); + + return desc; +} + static const struct fpga_manager_ops xilinx_core_ops = { .state = xilinx_core_state, .write_init = xilinx_core_write_init, @@ -186,12 +208,14 @@ int xilinx_core_probe(struct xilinx_fpga_core *core) return -EINVAL; /* PROGRAM_B is active low */ - core->prog_b = devm_gpiod_get(core->dev, "prog_b", GPIOD_OUT_LOW); + core->prog_b = xilinx_core_devm_gpiod_get(core->dev, "prog", "prog_b", + GPIOD_OUT_LOW); if (IS_ERR(core->prog_b)) return dev_err_probe(core->dev, PTR_ERR(core->prog_b), "Failed to get PROGRAM_B gpio\n"); - core->init_b = devm_gpiod_get_optional(core->dev, "init-b", GPIOD_IN); + core->init_b = xilinx_core_devm_gpiod_get(core->dev, "init", "init-b", + GPIOD_IN); if (IS_ERR(core->init_b)) return dev_err_probe(core->dev, PTR_ERR(core->init_b), "Failed to get INIT_B gpio\n");