Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp144508rdb; Thu, 1 Feb 2024 04:51:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IHBxBDFpdBx5vpNccuILhPp3VuRWmG94yg3l1jdlMECNGsqRA616YFiGzr+sJmtsefU4EQn X-Received: by 2002:ad4:5aa5:0:b0:68c:360e:cd with SMTP id u5-20020ad45aa5000000b0068c360e00cdmr5443640qvg.4.1706791904174; Thu, 01 Feb 2024 04:51:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706791904; cv=pass; d=google.com; s=arc-20160816; b=yCg3wSG6u9++2TVQVTYhbMAexzY4G/VFv+8Vhg4r7Hx1Mbu23bEAA5FNz3/i2fS2D9 TTzJXTfeuN5QdnII3TXQb92GdYk9XywaTXP9uk28S6ZHnd0h8bMemmaRwdMzpTaYu3ZP piJtYezrRwSfoxzJa4PJId8H2o78o01jWRWi5wuaHRgensu4cYpLPq+p5bBiWijpxEKM jMtYuGi3b/TQuMKGi2sxuVPiCID/9sUCYz/6lpv+gTngP2LAGVK/wLkRfT+C34Uag18V 8cg49CnVgyVc2pUyqsUuHyr0ORt4NcB2mxOkuBp2rUW4CuH2KllceHrpfOHwnimX5LEg gxBQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:message-id:in-reply-to:date:references:subject:cc:to :from:dkim-signature; bh=N/h2NJggoVZrhRYIoecIuJcQY/eQqf+MHCTaSOpv2BY=; fh=fEWpbSCn/fMkGOEv+FyonmSgeP4zxUoQChEUxPjm9oI=; b=1CpvbjbaINP77AOON7ihUYUfnqudmU5SQSV5xvIB01YfA/Zb2NtgasfFfIa7xEkih+ oGFqYQvyiCM695m29+m59QUp/lEZW8nqbjrh2YyQThte9q5TCG4Pgk8F9rEktSg3KHng 3h5I6xH/fyGeDGHwH6JpQZlf0dQombIzPOU05nfAqyKGutR1SYFh+5b/VIf43EMlfocv WOLExuvWtIZ+6fVEWhsIFYHThSp96XSRg8EDmaC5u7XVY+JRER2EYCJ1VPYssVQLF7ou aW44W2GqCgsdK+VhzNsyauNttPGu5sWT2im6wRLQCmNwejTlm1b+GosiX+fcevtMej10 Oe+g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=S5mIdJ2D; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-wireless+bounces-2942-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-2942-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCX/MPg8qbnr+1mCs9GOx1vJhQLNJO95pyjT4wng1IYtE1oHFCCXofPeFd0PFRD6MdygZdBUN0aiiEnOAvESnuwtyk24Y+QZyGmlxs3XiA== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id j15-20020a0ceb0f000000b0068c77810855si1778288qvp.556.2024.02.01.04.51.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 04:51:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-2942-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=S5mIdJ2D; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-wireless+bounces-2942-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-2942-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id D7A351C23B93 for ; Thu, 1 Feb 2024 12:51:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 14ACC8664F; Thu, 1 Feb 2024 12:51:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="S5mIdJ2D" X-Original-To: linux-wireless@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 E103A86645; Thu, 1 Feb 2024 12:51:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706791888; cv=none; b=YaJnhVeZAG2OydCyxKYXGZR/q0D9f2vpSFdzYmb4OsM4FnfwDS8F9EeWPc/hRt0WdFKHVBe2lhgc4RF5aeB899/ap+qMefO5ZglGLBr/Ynt8z0qD0nhlrLegx/QWzxNQFUIkcHLa+GkR+lI5nZoxw7zoKDBEMbeABIcNSOjdxk8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706791888; c=relaxed/simple; bh=b3tY4mt/lB4gO7ArhC4Qq2/scszVusvI4m/x+JRTHtc=; h=From:To:Cc:Subject:References:Date:In-Reply-To:Message-ID: MIME-Version:Content-Type; b=UnbKGh/Y6Np5xfFQwi3LjbyJwHSjnWPCqM72jK5C93TsthxNQHDWdHaSblcMCnKDeVNfAchk3zkDXCVtmzGL/CABOi3I6S28FNsSTQYEZj5THxwSRQC0afXgv71n2zsAXSUg3m/sHnsDHkwKsW/ZgQIP/IWfRIUHtyQjkZjvBzw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=S5mIdJ2D; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6465C433C7; Thu, 1 Feb 2024 12:51:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706791887; bh=b3tY4mt/lB4gO7ArhC4Qq2/scszVusvI4m/x+JRTHtc=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=S5mIdJ2DTmRcdefesWcvtN0+XhsW1YFimKKjIJJ6As9JxWh3H0PlhU35SQlnfASvW b5EOGpLIxpy5YHO0k+gcNFM3rwzV5LFO/YFsm2arMPtcBzC4KGYE35Gvolv7sDUlFG lCGAk3XH+llnyzNpopP8O2gCcXk60ABFvZ5ZkR5suoui7872r1f9pts3iPJDlAzl36 E8zVGIiqEJCoXwAjJOAgJDMD6qvIO78Bnx8+m2B5N2O8AKptsEeo9Fd1dW4afQq4yY RnCxGt0wQzYFSY7AWK5DHv8YaGeaWiN3jLo2UBv52abGp8BUo7SYY93RSIqGdwttPn 5gOExDJchKS0A== From: Kalle Valo To: Andy Shevchenko Cc: Linus Walleij , Toke =?utf-8?Q?H=C3=B8iland?= =?utf-8?Q?-J=C3=B8rgensen?= , Arend van Spriel , Franky Lin , Hante Meuleman , Arnd Bergmann , Lee Jones , Brian Norris , Srinivasan Raju , linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com Subject: Re: [PATCH 1/6] wifi: ath9k: Obtain system GPIOS from descriptors References: <20240131-descriptors-wireless-v1-0-e1c7c5d68746@linaro.org> <20240131-descriptors-wireless-v1-1-e1c7c5d68746@linaro.org> Date: Thu, 01 Feb 2024 14:51:23 +0200 In-Reply-To: (Andy Shevchenko's message of "Thu, 1 Feb 2024 13:40:07 +0200") Message-ID: <878r44uz3o.fsf@kernel.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Andy Shevchenko writes: > On Wed, Jan 31, 2024 at 11:37:20PM +0100, Linus Walleij wrote: > >> The ath9k has an odd use of system-wide GPIOs: if the chip >> does not have internal GPIO capability, it will try to obtain a >> GPIO line from the system GPIO controller: >> >> if (BIT(gpio) & ah->caps.gpio_mask) >> ath9k_hw_gpio_cfg_wmac(...); >> else if (AR_SREV_SOC(ah)) >> ath9k_hw_gpio_cfg_soc(ah, gpio, out, label); >> >> Where ath9k_hw_gpio_cfg_soc() will attempt to issue >> gpio_request_one() passing the local GPIO number of the controller >> (0..31) to gpio_request_one(). >> >> This is somewhat peculiar and possibly even dangerous: there is >> nowadays no guarantee of the numbering of these system-wide >> GPIOs, and assuming that GPIO 0..31 as used by ath9k would >> correspond to GPIOs 0..31 on the system as a whole seems a bit >> wild. >> >> My best guess is that everyone actually using this driver has >> support for the local (custom) GPIO API and the bit in >> h->caps.gpio_mask is always set for any GPIO the driver may >> try to obtain, so this facility to use system-wide GPIOs is >> actually unused and could be deleted. >> >> Anyway: I cannot know if this is really the case, so implement >> a fallback handling using GPIO descriptors obtained from the >> ah->dev device indexed 0..31. These can for example be passed >> in the device tree, ACPI or through board files. I doubt that >> anyone will use them, but this makes it possible to obtain a >> system-wide GPIO for any of the 0..31 GPIOs potentially >> requested by the driver. > > ... > >> + /* Obtains a system specific GPIO descriptor from another GPIO controller */ >> + gpiod = devm_gpiod_get_index(ah->dev, NULL, gpio, flags); > >> + > > Unnecessary blank line, please don't add it. I can fix that in the pending branch, no need to resend because of this. -- https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches