Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp154062lqr; Wed, 5 Jun 2024 01:47:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUfYTX87u7YiFBj9iDIlPr6qA3LrRwkYvIesdsK1xvq1QB6VVmCkilz4LYZWy3anl07VEo8xnWd0za7DV2yAU74gYJhjxKUkM9lph0Pcw== X-Google-Smtp-Source: AGHT+IEyf5JJ8hGycVhpKt0MrEhAdJ6BUsyD8guxq5ccCnBhTD+J27WSZDywZZzFRS4GeuFTMgWF X-Received: by 2002:a05:6871:2882:b0:250:6a57:1088 with SMTP id 586e51a60fabf-251220077c6mr2198866fac.44.1717577277488; Wed, 05 Jun 2024 01:47:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717577277; cv=pass; d=google.com; s=arc-20160816; b=iLPDyqiOReZtjHYMfk+FRoNuoeuE4q2Paw+Iif2cCgvFa8ZO6Vf3q2/s8YmojZZ9Ef 9X58p8UkTcQeSfQ/+nRuLJ+HDFA6q20pe8aux6u2HkzIFWr/Zrwn4iVIKOI5Ac6E0CFc Xy/eYn9kUajiyAdrx9Sq6JXLo+hFOFhKaKnBNToRunH6C3d15v9zTxmaT6oSzqeFTle1 jrKiHloAwpK6KWf/Fa/Rg/b57gI2zPSQCWPbWy/+81vsG+heq/3lJq31UCohePkFtsUc RdsVngVC0PuYkDTptC93pw58GSUBosh2JMhf9Lsvtjli4jMrTTn7z1/26BirOG3Gu5x8 5WOg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=nPra9VnPeBiNtl2fHAj/AHY/htZJd5zpefm5z/7mvlE=; fh=7ElvkIiwPbexRDA5qhmgJagFmyglIjVMsmtWLwjoCaU=; b=tx5NHStV7QAzocb4EtepbuEdzvSpHWiPjx+9AYLGbxmucSp6opaYp/xKBtcEfwUx7E p76h14vqm94IQLqoQQQ8FyM36c5Ik/OFwp52IHBCxxGn2r4lpyhMnfU3Abcvrn3qktuH nby2pqV2Y9w1R/NSHKpuXr5qVUrti5PgGjq3rFt5Xo3J7okN5F0oqYnRyoOt1vZTrA1H 5J9Qd1Pn+4AWgkSPc5Ch9wo+TwpbOalJc9UcKGzzenGdrOjMoKeJ9Tgq32vDgcWw0rpn qFOkvIbdULBplMmoUcM5N+fqVxiJs4bWwSWyoSf090PFqXvJVTeRkr/3hpKktu9s0JdW zWzA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=yzvJC92G; arc=pass (i=1 dkim=pass dkdomain=bgdev-pl.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-wireless+bounces-8523-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-8523-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-702651e1227si2264429b3a.215.2024.06.05.01.47.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 01:47:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-8523-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=yzvJC92G; arc=pass (i=1 dkim=pass dkdomain=bgdev-pl.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-wireless+bounces-8523-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-8523-linux.lists.archive=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 10691281975 for ; Wed, 5 Jun 2024 08:47:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 810BF18C348; Wed, 5 Jun 2024 08:47:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="yzvJC92G" X-Original-To: linux-wireless@vger.kernel.org Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 774BC49656 for ; Wed, 5 Jun 2024 08:47:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717577267; cv=none; b=TFYGvwUnmPXOxK+sAqK74TJUrtr/iuXmrWVePrP/LbAHxWJECHRGs9PkiH0mE6aplw3EeKGsb4zKKnjxE39hEF9nlW1DPh5WchRG5Qv/c+HCeFQxoD1PclDAB242k1wXn85Ga7/1UoKTVrgN7zfBEvAEFzFehdfVCVUELQdRAGw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717577267; c=relaxed/simple; bh=uSKkoIGoa2SrkckhNzNgT8KTYQPaLTtB710iSC/tAE0=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=ReZVw4uiKPJ5gqQbQR44VwZ6IC0pKb/NwC1eEoOF5d6PDnTre1taCL4usD4GeAODwnFwgGMr4btxrD6ZoJYRqD5jXwDn1XMM7DUV9QRSY0PVXh5O8iHNvRFiJgVnBwAJy6kSxF5P5qDCgmHH8WdfNx/Wxly7DhDopAM+pTN48sQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl; spf=none smtp.mailfrom=bgdev.pl; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b=yzvJC92G; arc=none smtp.client-ip=209.85.208.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Received: by mail-lj1-f174.google.com with SMTP id 38308e7fff4ca-2eaa80cb550so25653601fa.0 for ; Wed, 05 Jun 2024 01:47:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1717577264; x=1718182064; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=nPra9VnPeBiNtl2fHAj/AHY/htZJd5zpefm5z/7mvlE=; b=yzvJC92GX+CnQx7m4LPXyXYsNpBvK/idur5bYDpywh8Go7jQHrXy2gFaqm1K9hDcp+ RxJgnqtVk1pwaF88JnMjI68vVZuPrK3wPVivjqPPQrjHbPT8EqHKLt+7THl2eNqqUtku A3Xz6vhJGFl1D+NVsA+4ugRneDGyK/wDAjILU/Trg1wqc9c4y+tcvmoD0PJuKKNqmoWY NHoh1GL1anfB2oaJlnMuNZsi1syUrrgOdDe3NRxMe08Q+pd1IsXVryykPVrFCVT0avuf W3WSu/oCgsVzfqKlx+V4PK4jmd6hAlfYSzFa5murwfQd4FvoqTlDsVOdCC6wTyvn3YGq qpsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717577264; x=1718182064; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nPra9VnPeBiNtl2fHAj/AHY/htZJd5zpefm5z/7mvlE=; b=iwbHt0jJWkCQKhxCIH06+JMGcemAPyaVUIS6u0sdmQtosJk9PqKV4HTSuQr+KgdtMr Z68r5f4D1VfWYXbaYnMJl3DocsGs7Dc3V9qadpTO0PYNwxTk3pAv0L/ITZWb3QyzkRcB ZFiyu1wfXtqWtJ2XT016uYGW1kvh3JzVIXQxluYoYjOkCq5MAVZqp1FbKXsQEwLJhr26 etRzD1/HrxLPwaZn8HoZFNVdJrpCZunShNIz/Db0+ybiTRf3y8ra89V/Hbrr/Y+OT63o 5nIJHDozUfR/ttA/aaQt542kLafqdfDiLPiB3bN/zCma0m+fW/i+6wTdcCl7hG8Qyzce ZZZA== X-Forwarded-Encrypted: i=1; AJvYcCW/lvSc+s7ObmZN3Hapo7n8hF50xFzca2E2FLe0MbXrsmhePlb1EBX3KH1ohy/rx/yw+0/11TuTVrOgabDNjwuJ83xArJ0TTPACtNwcN3U= X-Gm-Message-State: AOJu0YxJDZaaubB7cKk9XKsVAJ0+kKHv4U/A0DLEXJM2nK2H66ORkA9r iU8ju2hkzYpPWVqP6ZhFiQo/H83cDB+vbJA/LCX3PEzpOhqm9QEsC4DmYoe32OojIZrqMnEstXt HgVynptKA2yOhi38kDFeShlXdG3+XTaRl175AgQ== X-Received: by 2002:a2e:7a0a:0:b0:2da:b59c:a94b with SMTP id 38308e7fff4ca-2eac7a2299fmr11245531fa.25.1717577263571; Wed, 05 Jun 2024 01:47:43 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240605021346.GA746121@bhelgaas> In-Reply-To: <20240605021346.GA746121@bhelgaas> From: Bartosz Golaszewski Date: Wed, 5 Jun 2024 10:47:32 +0200 Message-ID: Subject: Re: [PATCH v8 16/17] PCI/pwrctl: add a PCI power control driver for power sequenced devices To: Bjorn Helgaas Cc: Dmitry Baryshkov , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Marcel Holtmann , Luiz Augusto von Dentz , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Balakrishna Godavarthi , Rocky Liao , Kalle Valo , Jeff Johnson , Bjorn Andersson , Konrad Dybcio , Bjorn Helgaas , Srini Kandagatla , Elliot Berman , Caleb Connolly , Neil Armstrong , Alex Elder , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, Jeff Johnson , ath12k@lists.infradead.org, linux-pm@vger.kernel.org, linux-pci@vger.kernel.org, Bartosz Golaszewski , kernel@quicinc.com, Amit Pundir Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Jun 5, 2024 at 4:13=E2=80=AFAM Bjorn Helgaas w= rote: > > On Wed, Jun 05, 2024 at 02:34:52AM +0300, Dmitry Baryshkov wrote: > > On Wed, 5 Jun 2024 at 02:23, Bjorn Helgaas wrote: > > > > > > On Tue, May 28, 2024 at 09:03:24PM +0200, Bartosz Golaszewski wrote: > > > > From: Bartosz Golaszewski > > > > > > > > Add a PCI power control driver that's capable of correctly powering= up > > > > devices using the power sequencing subsystem. The first users of th= is > > > > driver are the ath11k module on QCA6390 and ath12k on WCN7850. > > > > > +static const struct of_device_id pci_pwrctl_pwrseq_of_match[] =3D = { > > > > + { > > > > + /* ATH11K in QCA6390 package. */ > > > > + .compatible =3D "pci17cb,1101", > > > > + .data =3D "wlan", > > > > + }, > > > > + { > > > > + /* ATH12K in WCN7850 package. */ > > > > + .compatible =3D "pci17cb,1107", > > > > + .data =3D "wlan", > > > > + }, > > > > > > IIUC, "pci17cb,1101" and "pci17cb,1107" exist partly so we can check > > > that a DTS conforms to the schema, e.g., a "pci17cb,1101" node > > > contains all the required regulators. For that use, we obviously nee= d > > > a very specific "compatible" string. > > > > > > Is there any opportunity to add a more generic "compatible" string in > > > addition to those so this list doesn't have to be updated for every > > > PMU? The .data here is "wlan" in both cases, and for this purpose, w= e > > > don't care whether it's "pci17cb,1101" or "pci17cb,1107". > > > > These two devices have different set of regulators and different > > requirements to power them on. > > Right, but I don't think pci_pwrctl_pwrseq_probe() knows about those > different sets. It basically looks like: > > pci_pwrctl_pwrseq_probe(struct platform_device *pdev) > { > struct pci_pwrctl_pwrseq_data *data; > struct device *dev =3D &pdev->dev; > > data->pwrseq =3D devm_pwrseq_get(dev, of_device_get_match_data(dev)); > pwrseq_power_on(data->pwrseq); > data->ctx.dev =3D dev; > devm_pci_pwrctl_device_set_ready(dev, &data->ctx); > } > > I think of_device_get_match_data(dev) will return "wlan" for both > "pci17cb,1101" and "pci17cb,1107", so devm_pwrseq_get(), > pwrseq_power_on(), and devm_pci_pwrctl_device_set_ready() don't see > the distinction between them. > These are only the first two users of this generic driver. We may end up adding more that will use different targets or even extend the match data with additional fields. > Of course, they also get "dev", so they can find the device-specifc > stuff that way, but I think that's on the drivers/power/sequencing/ > side, not in this pci-pwrctl-pwrseq driver itself. > > So what if there were a more generic "compatible" string, e.g., if the > DT contained something like this: > > wifi@0 { > compatible =3D "pci17cb,1101", "wlan-pwrseq"; What even is "pwrseq" in the context of the hardware description? DT maintainers would like to have a word with you. :) > ... > } > > and pci_pwrctl_pwrseq_of_match[] had this: > > { .compatible =3D "wlan-pwrseq", .data =3D "wlan", } > > Wouldn't this pci-pwrctl-pwrseq driver work the same? I'm not a DT > whiz, so likely I'm missing something, but it would be nice if we > didn't have to update this very generic-looking driver to add every > device that needs it. > Device-tree describes hardware, not the implementation. You can see elsewhere in this series that we have the PMU described as a PMIC on the device tree but we never register with the regulator subsystem nor do we create actual regulators in C. The HW description does not have to match the C implementation 1:1 but has to be accurate. There's not such HW component as "wlan-pwrseq". If you want a good example of such generic fallback - it'll be the C45 ethernet PHYs as they actually exist: there's a HW definition of what a broader C45 PHY is, even though it can be extended in concrete HW designs. I'd leave this as is. Bart