Message ID | 20231018100055.140847-1-krzysztof.kozlowski@linaro.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4676962vqb; Wed, 18 Oct 2023 03:01:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEtI0cCnPztwqsUnrMiWJjE7J9PDIX/nIvOCeL8DKpcd1d+0c2jJ2BiDYhFJwyPRKXeuV1o X-Received: by 2002:a17:90b:4c11:b0:27d:193f:2130 with SMTP id na17-20020a17090b4c1100b0027d193f2130mr4992233pjb.3.1697623285425; Wed, 18 Oct 2023 03:01:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697623285; cv=none; d=google.com; s=arc-20160816; b=vbx8TEKfa6EA6RqHcT6vpdztidDyMeM842Hn1TW+xg1L6a9K3JTGBhYc2Btx2aL98R FoXOUNyi8GmPx05j60rkXK37SvIry6ge+ObQz/g6vM1Ot5XwXmsfwtutGRzRex7CQQbd pbjXsbTl+0ZnRTf+Aoh1hW7KJN9yo6glJgVgazh1h5hDxLiG5gUFxJnB6WmS9HnlKq7v DuKVfLLaZRnnThrroCWh/UY3zMOoIZObbnUn3bidNpd9lk4MdTSDRorWaouI6YSvJIg+ odEeMY9MQGuHduacJNwVeFLCwqbVY1o+xQf1ZZB6MRXHZOjx1EGsDqJslgjS6eZJfBY9 bT9Q== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=kvddIZrQnxFTAaEhVpmcGqWDKOvzXW76dSFcJDMbgGc=; fh=P4FsF2E2t/otXa1NHzW5EN7wQV7/XlrrVGu2g+hT6rU=; b=jBLKd8E6QRcEoy0/kBENCKAn8Dg9vHcUsCjgwZ47co/mr5RTR45dGe1klUPwiX6asY YUkRmlHzcUTv+QY2Q3uJJHJBRCFj6W6SG2ZsNW+BDh70dJvTpc54PL16gFM63Bgr7H/p GMkj+F5Biv9TBwn80PuNpgy3XuaczsNt7rcfYJkv6Y2bTF/NthcLlqcVB9sNVHM+48N4 jO/CTIO8f0MvznDjLBbr1TC27bTCAhLsFYYUkTaOXsT8vpes+C8XGs6nzk4Xs8/R6Rd+ oElTgR9y/JdUf0B26KdaFhQaGUe0t0uf1meWFkP3t6MPDgDy4zSGgsQWcNXkwA9L5d9I 3Kxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CSiOKeMR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id ne8-20020a17090b374800b002765eee2b6bsi1189168pjb.46.2023.10.18.03.01.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 03:01:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CSiOKeMR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 3729C8108356; Wed, 18 Oct 2023 03:01:23 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230351AbjJRKBL (ORCPT <rfc822;lkml4gm@gmail.com> + 24 others); Wed, 18 Oct 2023 06:01:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230465AbjJRKBD (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 18 Oct 2023 06:01:03 -0400 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65945FD for <linux-kernel@vger.kernel.org>; Wed, 18 Oct 2023 03:01:00 -0700 (PDT) Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-9c3aec5f326so681755366b.1 for <linux-kernel@vger.kernel.org>; Wed, 18 Oct 2023 03:01:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697623259; x=1698228059; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=kvddIZrQnxFTAaEhVpmcGqWDKOvzXW76dSFcJDMbgGc=; b=CSiOKeMRRNOgmyD+aN6EhYz5Fg9L5WZo6E7qAnbwZJGiIRo+GMIht+AdCcfS8NlN4t w2XHtvvLjyX1TioTOt7nnppWpvXdp64y4KODXKAQK3Umbqil85AzdXS3DAn0sAhIlzGq 0kOCTPimJYuCshARYjw6VB4jCS7kjIyMOzBaRc+XmxfY4MvpNRW2dX9e1C7Lm9D03Ak3 C+Vfs46I0F1DQrG223mu/OjlNFcHNj6zG2J4sW0146ta1MTRrwPlACQZGKi1Y0HCcgUN gb9PINNDHb5blk3qnEKHYsDUcNl0hjwhGgRYpG6eBdvHLwMGtrYyZbT7kNzTUQOvwDCP f3VQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697623259; x=1698228059; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=kvddIZrQnxFTAaEhVpmcGqWDKOvzXW76dSFcJDMbgGc=; b=TDfFlYqdAnsK2ZomhO39pA8jHcNkjakRlFdk5J6s6mJ+Larulby4WQTepvnaomNbf7 y8RwTpta7OOE6mdTVV91XzkHfKqB1JAc2RrkhTmdVWJ7FHB0cCgeb2Yz5xoBAs7IppU4 XK8TlIXfTfi7rnKHJiMc0ANLRPBA//Z/lPeUayuhnG7ncI9PKxYjAaRdt4i5kJGsTEga 0elcE7lHCRKQJJ+elyXFyJoaDwfL7p2wve0tYhwiZYdEX7D49SpH9Ri5mF5j0H99VU4e W7LQHgToBXYMzEJFeaNXzR6mYOr8IjyZyF3jCD5zRJHXZhRVLqHAinycLMJ1Pte/x2s2 pH5Q== X-Gm-Message-State: AOJu0YyzyQG3ki1Wh3el5EhDxgcPydx77HGbPdjVNVSD2IZxcuK8zmEn uQJvLm0+VBsPaRK2950wPX7iDuWv6DoXU2rgesg= X-Received: by 2002:a17:907:948d:b0:9be:85c9:43f1 with SMTP id dm13-20020a170907948d00b009be85c943f1mr4180282ejc.7.1697623258684; Wed, 18 Oct 2023 03:00:58 -0700 (PDT) Received: from krzk-bin.. ([178.197.219.154]) by smtp.gmail.com with ESMTPSA id bt10-20020a170906b14a00b0098884f86e41sm1310004ejb.123.2023.10.18.03.00.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 03:00:58 -0700 (PDT) From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>, Banajit Goswami <bgoswami@quicinc.com>, Liam Girdwood <lgirdwood@gmail.com>, Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Subject: [PATCH] ASoC: codecs: wsa884x: allow sharing reset GPIO Date: Wed, 18 Oct 2023 12:00:55 +0200 Message-Id: <20231018100055.140847-1-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 18 Oct 2023 03:01:23 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780087034193057248 X-GMAIL-MSGID: 1780087034193057248 |
Series |
ASoC: codecs: wsa884x: allow sharing reset GPIO
|
|
Commit Message
Krzysztof Kozlowski
Oct. 18, 2023, 10 a.m. UTC
On some boards with multiple WSA8840/WSA8845 speakers, the reset
(shutdown) GPIO is shared between two speakers. Request it as
GPIOD_FLAGS_BIT_NONEXCLUSIVE to allow such configurations.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
sound/soc/codecs/wsa884x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On 18/10/2023 11:00, Krzysztof Kozlowski wrote: > On some boards with multiple WSA8840/WSA8845 speakers, the reset > (shutdown) GPIO is shared between two speakers. Request it as > GPIOD_FLAGS_BIT_NONEXCLUSIVE to allow such configurations. > > Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> > --- Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> --srini > sound/soc/codecs/wsa884x.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sound/soc/codecs/wsa884x.c b/sound/soc/codecs/wsa884x.c > index 993d76b18b53..bee6e763c700 100644 > --- a/sound/soc/codecs/wsa884x.c > +++ b/sound/soc/codecs/wsa884x.c > @@ -1844,7 +1844,7 @@ static int wsa884x_probe(struct sdw_slave *pdev, > return ret; > > wsa884x->sd_n = devm_gpiod_get_optional(dev, "powerdown", > - GPIOD_OUT_HIGH); > + GPIOD_FLAGS_BIT_NONEXCLUSIVE | GPIOD_OUT_HIGH); > if (IS_ERR(wsa884x->sd_n)) > return dev_err_probe(dev, PTR_ERR(wsa884x->sd_n), > "Shutdown Control GPIO not found\n");
On Wed, Oct 18, 2023 at 12:00:55PM +0200, Krzysztof Kozlowski wrote: > On some boards with multiple WSA8840/WSA8845 speakers, the reset > (shutdown) GPIO is shared between two speakers. Request it as > GPIOD_FLAGS_BIT_NONEXCLUSIVE to allow such configurations. > wsa884x->sd_n = devm_gpiod_get_optional(dev, "powerdown", > - GPIOD_OUT_HIGH); > + GPIOD_FLAGS_BIT_NONEXCLUSIVE | GPIOD_OUT_HIGH); How do the speakers coordinate?
On 18/10/2023 14:35, Mark Brown wrote: > On Wed, Oct 18, 2023 at 12:00:55PM +0200, Krzysztof Kozlowski wrote: >> On some boards with multiple WSA8840/WSA8845 speakers, the reset >> (shutdown) GPIO is shared between two speakers. Request it as >> GPIOD_FLAGS_BIT_NONEXCLUSIVE to allow such configurations. > >> wsa884x->sd_n = devm_gpiod_get_optional(dev, "powerdown", >> - GPIOD_OUT_HIGH); >> + GPIOD_FLAGS_BIT_NONEXCLUSIVE | GPIOD_OUT_HIGH); > > How do the speakers coordinate? They don't and that's the generic problem of many Linux drivers. Not only this one, but others as well. Device unbind (remove()) or runtime suspend of one speaker will affect other speaker. I don't think any other drivers solved this, because this is rather core's GPIO issue, thus I am not solving it here either. :( Best regards, Krzysztof
On Wed, Oct 18, 2023 at 02:38:00PM +0200, Krzysztof Kozlowski wrote: > On 18/10/2023 14:35, Mark Brown wrote: > > How do the speakers coordinate? > They don't and that's the generic problem of many Linux drivers. Not > only this one, but others as well. > Device unbind (remove()) or runtime suspend of one speaker will affect > other speaker. I don't think any other drivers solved this, because this > is rather core's GPIO issue, thus I am not solving it here either. :( I'd expect that the GPIO users should coordiante directly rather than rely on the GPIO API to do the coordination for them - there aren't enough semantics in the GPIO itself to do much more except possibly provide discovery services (which would be nice). Look at how the regulator API manages multiple regulators sharing an enable GPIO for example, it adds an additional layer of reference counting when it identifies a shared GPIO.
On 18/10/2023 14:56, Mark Brown wrote: > On Wed, Oct 18, 2023 at 02:38:00PM +0200, Krzysztof Kozlowski wrote: >> On 18/10/2023 14:35, Mark Brown wrote: > >>> How do the speakers coordinate? > >> They don't and that's the generic problem of many Linux drivers. Not >> only this one, but others as well. > >> Device unbind (remove()) or runtime suspend of one speaker will affect >> other speaker. I don't think any other drivers solved this, because this >> is rather core's GPIO issue, thus I am not solving it here either. :( > > I'd expect that the GPIO users should coordiante directly rather than > rely on the GPIO API to do the coordination for them - there aren't > enough semantics in the GPIO itself to do much more except possibly > provide discovery services (which would be nice). Look at how the > regulator API manages multiple regulators sharing an enable GPIO for > example, it adds an additional layer of reference counting when it > identifies a shared GPIO. OK, it is still regulator core, though. Not individual drivers problem. Several other existing drivers have the same issue, so this should be solved in a generic or shared way. Best regards, Krzysztof
On Wed, Oct 18, 2023 at 02:57:59PM +0200, Krzysztof Kozlowski wrote: > On 18/10/2023 14:56, Mark Brown wrote: > > I'd expect that the GPIO users should coordiante directly rather than > > rely on the GPIO API to do the coordination for them - there aren't > > enough semantics in the GPIO itself to do much more except possibly > > provide discovery services (which would be nice). Look at how the > > regulator API manages multiple regulators sharing an enable GPIO for > > example, it adds an additional layer of reference counting when it > > identifies a shared GPIO. > OK, it is still regulator core, though. Not individual drivers problem. > Several other existing drivers have the same issue, so this should be > solved in a generic or shared way. Indeed.
diff --git a/sound/soc/codecs/wsa884x.c b/sound/soc/codecs/wsa884x.c index 993d76b18b53..bee6e763c700 100644 --- a/sound/soc/codecs/wsa884x.c +++ b/sound/soc/codecs/wsa884x.c @@ -1844,7 +1844,7 @@ static int wsa884x_probe(struct sdw_slave *pdev, return ret; wsa884x->sd_n = devm_gpiod_get_optional(dev, "powerdown", - GPIOD_OUT_HIGH); + GPIOD_FLAGS_BIT_NONEXCLUSIVE | GPIOD_OUT_HIGH); if (IS_ERR(wsa884x->sd_n)) return dev_err_probe(dev, PTR_ERR(wsa884x->sd_n), "Shutdown Control GPIO not found\n");