From patchwork Wed Aug 26 08:24:42 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Chiu X-Patchwork-Id: 2292507 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hVHlp04Rjz1xxf for ; Wed, 26 Aug 2026 18:25:41 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1wz8wp-00071D-A2; Wed, 26 Aug 2026 08:25:27 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1wz8wn-00070o-NE for kernel-team@lists.ubuntu.com; Wed, 26 Aug 2026 08:25:25 +0000 Received: from mail-yw1-f197.google.com (mail-yw1-f197.google.com [209.85.128.197]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 8A22D3F71B for ; Wed, 26 Aug 2026 08:25:25 +0000 (UTC) Received: by mail-yw1-f197.google.com with SMTP id 00721157ae682-836c2b00bbaso21311597b3.0 for ; Wed, 26 Aug 2026 01:25:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787732724; x=1788337524; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=hVYjZk+Iqlfq2MV1Xf5+hcEfELcFI8ZvnhJEMXipDhc=; b=SDjpXvxrPPRdCR1psGN0+ffONcauMUQqiCMOO2JpnTWGTGNFBl/xfC94nnAuCche0n MyQCczDpRI90a55zXZ3UEIsexS3axiB1e/uJ+7eQ8lLkK431AdeOX8dzCoBOP+XFlj1G yu9LrAXlAV7WpRii4/lsXtTxxAAktk/zgK0upKbwEACNTCXv78J4XZ3t7k8wu8jU2thV dd41TEsxOzEq/KLB79wGYVpGF9DGCo7VrvR7XhiUfSkwLfSRdLHOgNq4r5Kx6BXw98/b sPAJV6xfTEBT1l+Z6u3ah/a/wyXI62K9AjiZ1JvOKKsbLjAFHQG+K30gK5eRz36rp49+ qO8Q== X-Gm-Message-State: AFuF++njZG7CxOFMSf2HJHWx9LKEKhy+CN2JS2NkG12HafGSuWtDKEOr gWlDJtVZNMGZvD7gpud7vclZjdFB7n3qjbxiMuebimsVUQqk5F0ojVW6ofd46+Sdf0kYcL2aCgw X7XS4zFrLMwwXGGZHworwi+V6LVnQRfgpIM3a8bbLWFJMKfTARg5+0Auyz81htUUYTGmFZeJnRS qHth7HBG7J0Gu7aiZz X-Gm-Gg: AR+sD13c9+6AwAsjKTqmrP6XUA9azDXGRdSRUaZxHgroizn+lsmov/y5nP1wfpvU6zh Iam1w3tDLo3iM36xGjLno/5XBaNTFSMWuQvduqrhAAFLEimN+g1LShd1FbzZSX1SCex4WEjWcb3 tfCOiVX0IsLTUOUGlCCGTddKyZGhjLj3WR+l6c9Xwv/6i51aKnD2Zr5oyZjMiEoKnf6L9j/HKS7 asW8iI6zN7FVz8pNgnZTHp4FfdJXJ19WxqynYIkgMIjNMVESQgbi7vAxiIS5W/caq33A+4hqkId iULyc/98B0rBnyj8FIksKkSO+vgdoqqSanKEVU5kMEHIGEgEOa/c1NYCMUqFeli/i6gLx2R6Sxy 1wYCya3kRFg== X-Received: by 2002:a05:690c:888:b0:845:2054:2374 with SMTP id 00721157ae682-85741726ba7mr22494327b3.31.1787732724435; Wed, 26 Aug 2026 01:25:24 -0700 (PDT) X-Received: by 2002:a05:690c:888:b0:845:2054:2374 with SMTP id 00721157ae682-85741726ba7mr22494197b3.31.1787732723978; Wed, 26 Aug 2026 01:25:23 -0700 (PDT) Received: from localhost.localdomain ([2001:67c:1560:8007::aac:c1a2]) by smtp.gmail.com with ESMTPSA id 00721157ae682-8570d620433sm11913387b3.42.2026.08.26.01.25.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Aug 2026 01:25:23 -0700 (PDT) To: kernel-team@lists.ubuntu.com Subject: [SRU][R][PATCH v2 01/14] ASoC: SDCA: Add correct masks whilst reporting SDCA jack status Date: Wed, 26 Aug 2026 16:24:42 +0800 Message-ID: <20260826082456.892463-2-chris.chiu@canonical.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260826082456.892463-1-chris.chiu@canonical.com> References: <20260826082456.892463-1-chris.chiu@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Chris Chiu via kernel-team From: Chris Chiu Reply-To: Chris Chiu Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Charles Keepax BugLink: https://bugs.launchpad.net/bugs/2163215 Currently, all SDCA jacks simply report against a mask of 0xFFFF. This works fine for system with a single SDCA jack control as the status reflects that single control at all times. However, if two SDCA jack controls exist in the system, such as a separate representation for input and output, then the second control can cancel reports from the other since it will only report its relevant bits and zero in all other slots. This is exactly what the mask is for. Build up a mask using all the possible states for an SCDA jack control at registration time and use that mask when reporting a particular jack. It is worth noting this still doesn't handle cases such as two headphone jacks as that would require separate ALSA jacks to report to. Reviewed-by: Pierre-Louis Bossart Signed-off-by: Charles Keepax Link: https://patch.msgid.link/20260430150931.2025953-2-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown (cherry picked from commit cb3c257e08248521b22c67259d50ebb18574d1a1) Signed-off-by: Chris Chiu --- include/sound/sdca_jack.h | 3 ++ sound/soc/sdca/sdca_jack.c | 75 ++++++++++++++++++++++---------------- 2 files changed, 47 insertions(+), 31 deletions(-) diff --git a/include/sound/sdca_jack.h b/include/sound/sdca_jack.h index 3ec22046d3eb..181541f0f4d8 100644 --- a/include/sound/sdca_jack.h +++ b/include/sound/sdca_jack.h @@ -18,10 +18,13 @@ struct snd_soc_jack; * struct jack_state - Jack state structure to keep data between interrupts * @kctl: Pointer to the ALSA control attached to this jack * @jack: Pointer to the ASoC jack struct for this jack + * @mask: Possible reported jack status bits for this jack */ struct jack_state { struct snd_kcontrol *kctl; struct snd_soc_jack *jack; + + unsigned int mask; }; int sdca_jack_alloc_state(struct sdca_interrupt *interrupt); diff --git a/sound/soc/sdca/sdca_jack.c b/sound/soc/sdca/sdca_jack.c index 49d317d3b8c8..a2d95b124b78 100644 --- a/sound/soc/sdca/sdca_jack.c +++ b/sound/soc/sdca/sdca_jack.c @@ -145,6 +145,32 @@ int sdca_jack_alloc_state(struct sdca_interrupt *interrupt) } EXPORT_SYMBOL_NS_GPL(sdca_jack_alloc_state, "SND_SOC_SDCA"); +static int type_get_mask(enum sdca_terminal_type type) +{ + switch (type) { + case SDCA_TERM_TYPE_LINEIN_STEREO: + case SDCA_TERM_TYPE_LINEIN_FRONT_LR: + case SDCA_TERM_TYPE_LINEIN_CENTER_LFE: + case SDCA_TERM_TYPE_LINEIN_SURROUND_LR: + case SDCA_TERM_TYPE_LINEIN_REAR_LR: + return SND_JACK_LINEIN; + case SDCA_TERM_TYPE_LINEOUT_STEREO: + case SDCA_TERM_TYPE_LINEOUT_FRONT_LR: + case SDCA_TERM_TYPE_LINEOUT_CENTER_LFE: + case SDCA_TERM_TYPE_LINEOUT_SURROUND_LR: + case SDCA_TERM_TYPE_LINEOUT_REAR_LR: + return SND_JACK_LINEOUT; + case SDCA_TERM_TYPE_MIC_JACK: + return SND_JACK_MICROPHONE; + case SDCA_TERM_TYPE_HEADPHONE_JACK: + return SND_JACK_HEADPHONE; + case SDCA_TERM_TYPE_HEADSET_JACK: + return SND_JACK_HEADSET; + default: + return 0; + } +} + /** * sdca_jack_set_jack - attach an ASoC jack to SDCA * @info: SDCA interrupt information. @@ -154,7 +180,8 @@ EXPORT_SYMBOL_NS_GPL(sdca_jack_alloc_state, "SND_SOC_SDCA"); */ int sdca_jack_set_jack(struct sdca_interrupt_info *info, struct snd_soc_jack *jack) { - int i, ret; + int i, j; + int ret; guard(mutex)(&info->irq_lock); @@ -162,6 +189,7 @@ int sdca_jack_set_jack(struct sdca_interrupt_info *info, struct snd_soc_jack *ja struct sdca_interrupt *interrupt = &info->irqs[i]; struct sdca_control *control = interrupt->control; struct sdca_entity *entity = interrupt->entity; + struct sdca_control_range *range; struct jack_state *jack_state; if (!interrupt->irq) @@ -169,6 +197,20 @@ int sdca_jack_set_jack(struct sdca_interrupt_info *info, struct snd_soc_jack *ja switch (SDCA_CTL_TYPE(entity->type, control->sel)) { case SDCA_CTL_TYPE_S(GE, DETECTED_MODE): + range = sdca_selector_find_range(interrupt->dev, entity, + SDCA_CTL_GE_SELECTED_MODE, + SDCA_SELECTED_MODE_NCOLS, 0); + if (!range) + return -EINVAL; + + for (j = 0; j < range->rows; j++) { + enum sdca_terminal_type type; + + type = sdca_range(range, SDCA_SELECTED_MODE_TERM_TYPE, j); + + jack_state->mask |= type_get_mask(type); + } + jack_state = interrupt->priv; jack_state->jack = jack; @@ -191,7 +233,6 @@ int sdca_jack_report(struct sdca_interrupt *interrupt) struct jack_state *jack_state = interrupt->priv; struct sdca_control_range *range; enum sdca_terminal_type type; - unsigned int report = 0; unsigned int reg, val; int ret; @@ -213,35 +254,7 @@ int sdca_jack_report(struct sdca_interrupt *interrupt) type = sdca_range_search(range, SDCA_SELECTED_MODE_INDEX, val, SDCA_SELECTED_MODE_TERM_TYPE); - switch (type) { - case SDCA_TERM_TYPE_LINEIN_STEREO: - case SDCA_TERM_TYPE_LINEIN_FRONT_LR: - case SDCA_TERM_TYPE_LINEIN_CENTER_LFE: - case SDCA_TERM_TYPE_LINEIN_SURROUND_LR: - case SDCA_TERM_TYPE_LINEIN_REAR_LR: - report = SND_JACK_LINEIN; - break; - case SDCA_TERM_TYPE_LINEOUT_STEREO: - case SDCA_TERM_TYPE_LINEOUT_FRONT_LR: - case SDCA_TERM_TYPE_LINEOUT_CENTER_LFE: - case SDCA_TERM_TYPE_LINEOUT_SURROUND_LR: - case SDCA_TERM_TYPE_LINEOUT_REAR_LR: - report = SND_JACK_LINEOUT; - break; - case SDCA_TERM_TYPE_MIC_JACK: - report = SND_JACK_MICROPHONE; - break; - case SDCA_TERM_TYPE_HEADPHONE_JACK: - report = SND_JACK_HEADPHONE; - break; - case SDCA_TERM_TYPE_HEADSET_JACK: - report = SND_JACK_HEADSET; - break; - default: - break; - } - - snd_soc_jack_report(jack_state->jack, report, 0xFFFF); + snd_soc_jack_report(jack_state->jack, type_get_mask(type), jack_state->mask); return 0; } From patchwork Wed Aug 26 08:24:43 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Chiu X-Patchwork-Id: 2292511 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hVHlp0Xwsz1y9Q for ; Wed, 26 Aug 2026 18:25:41 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1wz8wr-000735-Qo; Wed, 26 Aug 2026 08:25:29 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1wz8wp-00071o-Sk for kernel-team@lists.ubuntu.com; Wed, 26 Aug 2026 08:25:27 +0000 Received: from mail-yw1-f197.google.com (mail-yw1-f197.google.com [209.85.128.197]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id C49DD3FC3D for ; Wed, 26 Aug 2026 08:25:27 +0000 (UTC) Received: by mail-yw1-f197.google.com with SMTP id 00721157ae682-81ea59b5979so21856917b3.3 for ; Wed, 26 Aug 2026 01:25:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787732727; x=1788337527; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=ai077wPcEnB0+00oYlv8oNnwTRxHP9Zgfd5u9jjDOvc=; b=AHG5Bjgt29fltZD7Ii3GBAqHisvWoiYjSPkr/vGGeNahQCBHZ64U8wSn6ZhbIb41uH f8hnDAKTZp7YI0N2LgcUQCybNSyJ00mC4Mf21otguQY4UFgPo4V8NdNnaj/NmPA7pMYL msyLLJyPFqy+bVCKL925acCZBcUz5FhpRXh5un4h+GMq3ouUbKix21cdWzTBZ/jzcJjM u+rB6YmX6zt9/et2HFi8WZb7OZN//Kya9ThY2sEeRJ1nEyrS9yYgfIKppkyPtv859X+Y l3KjZwqMHw7+TWr6k6sVgepv6cspkIwpwnGSh9/A3H/OhOC7/fZyOCX/AQlbm1v4pQzQ 6Srg== X-Gm-Message-State: AFuF++l57djZHsXGDryJ778OpgHPA9ChKSIKea1G/L1oIKJAJI5XsD1+ q6bRLubqMPma7JmcN6uji3+EfX7/tLjdZHzrSa79xSR7XfJoh037/TV7xjMHQOoy7JrtDWkl64a nVCgz9c3Y/bRctkW+odY1qns2Jjnglo9pFNo3KhvMqrTIwbekba8J5fTEyWDvYmT4j8vdQTmdq5 +/69JPknqCdcENcK7F X-Gm-Gg: AR+sD10j2OsHPz1DPHc6vNYVhY1B2oWCGtESJJ1TeGGqQa0IudTXRBKwcbUKnizqQ6A E5y9LMUQ+B1iH28c49lYZPwf5l4NFWzcs2gBbya15Ah78XwPSzm+RnK81+SaTnDBHfKSDiK5Lvw ERfNhH1yxjKzXOrjwnvZHPGPZSANWK1Xkg2asqJJ11hm1bBi4G2/UQzCyB98bu6RAhWBOGhpGI3 N1EtayQeWUGmBruJ5YJeMgpuLnuuQrA8b6NDwhnhXZQ78fNPyGdLQWUTNWc4auffSLIemslal+f XGh95m0damDZ0mUAed2a9MdWDIBqZgwv1oyhIl0ZBv96/sPms8V2jWvVG5VaHdCXOkUqNbJoChP DSnKXUqoSsg== X-Received: by 2002:a05:690c:c3a5:b0:81e:6c2e:f0f5 with SMTP id 00721157ae682-8574124c22fmr16664247b3.28.1787732726770; Wed, 26 Aug 2026 01:25:26 -0700 (PDT) X-Received: by 2002:a05:690c:c3a5:b0:81e:6c2e:f0f5 with SMTP id 00721157ae682-8574124c22fmr16664177b3.28.1787732726317; Wed, 26 Aug 2026 01:25:26 -0700 (PDT) Received: from localhost.localdomain ([2001:67c:1560:8007::aac:c1a2]) by smtp.gmail.com with ESMTPSA id 00721157ae682-8570d620433sm11913387b3.42.2026.08.26.01.25.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Aug 2026 01:25:25 -0700 (PDT) To: kernel-team@lists.ubuntu.com Subject: [SRU][R][PATCH v2 02/14] ASoC: SDCA: Fix bad move of jack_state initialisation Date: Wed, 26 Aug 2026 16:24:43 +0800 Message-ID: <20260826082456.892463-3-chris.chiu@canonical.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260826082456.892463-1-chris.chiu@canonical.com> References: <20260826082456.892463-1-chris.chiu@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Chris Chiu via kernel-team From: Chris Chiu Reply-To: Chris Chiu Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Charles Keepax BugLink: https://bugs.launchpad.net/bugs/2163215 The initialisation of jack_state was accidentally moved until after its use, correct this. Fixes: cb3c257e0824 ("ASoC: SDCA: Add correct masks whilst reporting SDCA jack status") Signed-off-by: Charles Keepax Link: https://patch.msgid.link/20260505090811.3697153-1-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown (cherry picked from commit 36c543cc51008fbc9ebfaf1e58c34425b7997c88) Signed-off-by: Chris Chiu --- sound/soc/sdca/sdca_jack.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/soc/sdca/sdca_jack.c b/sound/soc/sdca/sdca_jack.c index a2d95b124b78..ae9636622a84 100644 --- a/sound/soc/sdca/sdca_jack.c +++ b/sound/soc/sdca/sdca_jack.c @@ -203,6 +203,8 @@ int sdca_jack_set_jack(struct sdca_interrupt_info *info, struct snd_soc_jack *ja if (!range) return -EINVAL; + jack_state = interrupt->priv; + for (j = 0; j < range->rows; j++) { enum sdca_terminal_type type; @@ -211,7 +213,6 @@ int sdca_jack_set_jack(struct sdca_interrupt_info *info, struct snd_soc_jack *ja jack_state->mask |= type_get_mask(type); } - jack_state = interrupt->priv; jack_state->jack = jack; /* Report initial state in case IRQ was already handled */ From patchwork Wed Aug 26 08:24:44 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Chiu X-Patchwork-Id: 2292509 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hVHlp06K4z1xyG for ; Wed, 26 Aug 2026 18:25:41 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1wz8wt-00075E-RV; Wed, 26 Aug 2026 08:25:31 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1wz8ws-00073X-E6 for kernel-team@lists.ubuntu.com; Wed, 26 Aug 2026 08:25:30 +0000 Received: from mail-yx1-f69.google.com (mail-yx1-f69.google.com [74.125.224.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 1D13A3F71B for ; Wed, 26 Aug 2026 08:25:30 +0000 (UTC) Received: by mail-yx1-f69.google.com with SMTP id 956f58d0204a3-66c70d28b78so1947217d50.0 for ; Wed, 26 Aug 2026 01:25:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787732729; x=1788337529; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=DLO8GfXw0vpg79xkvUU+KiUlLOlWMRyFZ0NBV1e810Y=; b=WkiH1m3j5GsR9ll2lvR0R4HcYkOef51j1R3wozk63zVKEKAiWNlxpVR4QCZWqzCDBc Dj6PldzWETKELqrwYdJ19Yk1EADd6w9++ANhV/d9Lpqf0F1z4QPuJG874EB9LgxVPTt1 Fkew8cIxyhUVeRK9LRm6AQ2OOweCNXuLulLxPaz7rps2vSL1hgxpIw0Bk9gH8KgBhst/ df9Rh9hdL9DwcFMe33ZF3eHwY4qrx5072DEclhXLlIfvn6Yp3+jkQ4slFqYGxPTizW6y ysMxrlm3ervSMXjJXoW76EA37HPRV8XE6fgnNUvQ0tVyrk/rMy+vmYJOw28iEkeUj/5m AYoA== X-Gm-Message-State: AFuF++lM0Y0j9KyQ3y4BVXlQk0a+u0wRuM8cs/FZKqxccuj2JiwrOhzB 5AduNq6YoBO/BhifuSZ6ZQfJhqcskTqPWZEssejNIMEqHS0CqO3C/vrnY/AsqBgkt/ALLaY3tI2 vD49I7mb0L7k7bWQ8B21AaRWBYJ8qsw09bpfcszNENgnzHxzw/dGWLIlbDlLGNrNlT4xm0lUCQq fzxChbcq0qW31hj+f2 X-Gm-Gg: AR+sD11GTJLDQc5yuIfpqOIjJt8c0W/seCq6dX+ygVtfaFnIvDNKMDWkyGd8ixT9AIb jszSKDSrXhz3IC7VFhqk0IByVJ3qSBDS2mgmZ6lwRqF3tt3gc6R1hpNacWIOBHGKckUuCokgPAb UyX1c0BtWeTVQr5WVMpK3jo80tzrTawj8nbrsiaTl7YzZK/sdX20bqTg7Id29WMQULFdUaSBEfD N9Y0bxtfbYu1ix8GgdPDdGePrJcQ/wqX1gq7Dc4Z0TUsKGjo6y3bbQ3cwYb3G8zKiGGqrsFBwpu TZ69MyUTv+5ijUiYtpu7xPnGebWDsGRaTO/X9ZIn9EoD6sqAf9oR/ileBwMSq2dTanDP4mnmM/b RrQ6uLSe+EA== X-Received: by 2002:a05:690e:1687:b0:668:1414:e9bd with SMTP id 956f58d0204a3-66d257e33bcmr1584942d50.38.1787732729028; Wed, 26 Aug 2026 01:25:29 -0700 (PDT) X-Received: by 2002:a05:690e:1687:b0:668:1414:e9bd with SMTP id 956f58d0204a3-66d257e33bcmr1584929d50.38.1787732728533; Wed, 26 Aug 2026 01:25:28 -0700 (PDT) Received: from localhost.localdomain ([2001:67c:1560:8007::aac:c1a2]) by smtp.gmail.com with ESMTPSA id 00721157ae682-8570d620433sm11913387b3.42.2026.08.26.01.25.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Aug 2026 01:25:28 -0700 (PDT) To: kernel-team@lists.ubuntu.com Subject: [SRU][R][PATCH v2 03/14] soundwire: Add a helper function to wait for device initialisation Date: Wed, 26 Aug 2026 16:24:44 +0800 Message-ID: <20260826082456.892463-4-chris.chiu@canonical.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260826082456.892463-1-chris.chiu@canonical.com> References: <20260826082456.892463-1-chris.chiu@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Chris Chiu via kernel-team From: Chris Chiu Reply-To: Chris Chiu Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Charles Keepax BugLink: https://bugs.launchpad.net/bugs/2163215 Add a new helper function to wait for the device to enumerate and be initialised by the SoundWire core. Most of the SoundWire drivers have very similar boiler plate code in their runtime resume, and that boiler plate tends to access various internals of the SoundWire structs which is a mild layering violation. Adding a new core helper function greatly eases both of these issues. Acked-by: Vinod Koul Signed-off-by: Charles Keepax Link: https://patch.msgid.link/20260512103022.1154645-2-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown (cherry picked from commit 3492e8b494c18028044d4a2e03db5c7331fbd789) Signed-off-by: Chris Chiu --- drivers/soundwire/bus.c | 31 +++++++++++++++++++++++++++++++ include/linux/soundwire/sdw.h | 8 ++++++++ 2 files changed, 39 insertions(+) diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c index fe5316d93fef..ea3a24f805c0 100644 --- a/drivers/soundwire/bus.c +++ b/drivers/soundwire/bus.c @@ -1372,6 +1372,37 @@ int sdw_slave_get_current_bank(struct sdw_slave *slave) } EXPORT_SYMBOL_GPL(sdw_slave_get_current_bank); +/** + * sdw_slave_wait_for_init - Wait for device initialisation + * @slave: Pointer to the SoundWire peripheral. + * @timeout_ms: Timeout in milliseconds. + * + * Wait for a peripheral device to enumerate and be initialised by the + * SoundWire core. + * + * Return: Zero on success, and a negative error code on failure. + */ +int sdw_slave_wait_for_init(struct sdw_slave *slave, int timeout_ms) +{ + unsigned long time; + + if (!slave->unattach_request) + return 0; + + time = wait_for_completion_timeout(&slave->initialization_complete, + msecs_to_jiffies(timeout_ms)); + if (!time) { + dev_err(&slave->dev, "Initialization not complete\n"); + sdw_show_ping_status(slave->bus, true); + return -ETIMEDOUT; + } + + slave->unattach_request = 0; + + return 0; +} +EXPORT_SYMBOL_GPL(sdw_slave_wait_for_init); + static int sdw_slave_set_frequency(struct sdw_slave *slave) { int scale_index; diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h index f462717acf20..e2180afa7f98 100644 --- a/include/linux/soundwire/sdw.h +++ b/include/linux/soundwire/sdw.h @@ -1093,6 +1093,8 @@ int sdw_slave_get_current_bank(struct sdw_slave *sdev); int sdw_slave_get_scale_index(struct sdw_slave *slave, u8 *base); +int sdw_slave_wait_for_init(struct sdw_slave *slave, int timeout_ms); + /* messaging and data APIs */ int sdw_read(struct sdw_slave *slave, u32 addr); int sdw_write(struct sdw_slave *slave, u32 addr, u8 value); @@ -1136,6 +1138,12 @@ static inline int sdw_slave_get_current_bank(struct sdw_slave *sdev) return -EINVAL; } +static inline int sdw_slave_wait_for_init(struct sdw_slave *slave, int timeout_ms) +{ + WARN_ONCE(1, "SoundWire API is disabled"); + return -EINVAL; +} + /* messaging and data APIs */ static inline int sdw_read(struct sdw_slave *slave, u32 addr) { From patchwork Wed Aug 26 08:24:45 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Chiu X-Patchwork-Id: 2292510 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hVHlp07vpz1xyq for ; Wed, 26 Aug 2026 18:25:41 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1wz8ww-00078a-9Z; Wed, 26 Aug 2026 08:25:34 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1wz8wu-000764-Ka for kernel-team@lists.ubuntu.com; Wed, 26 Aug 2026 08:25:32 +0000 Received: from mail-yw1-f197.google.com (mail-yw1-f197.google.com [209.85.128.197]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 5AF533FC3D for ; Wed, 26 Aug 2026 08:25:32 +0000 (UTC) Received: by mail-yw1-f197.google.com with SMTP id 00721157ae682-8461ade272bso22334747b3.1 for ; Wed, 26 Aug 2026 01:25:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787732731; x=1788337531; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=edyAx8xsOkG1GjFjm/tstyv6KEjdtjjQhAhA5K4Qp/U=; b=iY1slrU2wIdT2GYADGLoAQnTkWVtH0oY6Raf1UVd/pPiEgKSzmn+dK/UOthrbAFdfA wlsGz+opvalujZrb6OgCjcfKiy8eA0sgImozQrRs3NwPV8pjBydh0EvEic6b+kWcUeJ3 hRKgCRIfO88TLV2HHMJ8BH/Sgb+JFdf9JH61+Qma1lqky+Z+6BTBO2c/D7qia18Bp90O ry12mX3JHhwsKaEjn5RtLEjbsNuF4sUvZ5nLVsDnatVKJYRwGeJxUhrJ4esbBd8zPnNm P6G/Ht5cq+cgo+BVlOMMuMwL2ZSl0yBLXkaSFUOatqzYAIESUx6Wjq7+9hd3Za7Xpqjd wUOw== X-Gm-Message-State: AFuF++mkQi3VkWC74WStmVK+kBT5FZKrBWWG6/ec+Yl9lGaRY+JPYjKI etG5OzgfpG+yuXKjwxKpm4UKI0k0ykXfa/pxkE2Rcjqn1Tkpc7bvLL/tsYHoeRraGsQ2g60VNDE ZhZK29aV9NyZxstjfcY/GiIVEv6kMRrhHUOchnC3TIxFhbrpFri7LErLkuqiyuk6KFMqbWuST9o SRHY3omYGDk+K8FGxU X-Gm-Gg: AR+sD105yxW2tIF9ohq6OAW6btvDA80woG+v10mN/QpG5x/F0HQ9YJ8IXlJHLfF49IH 4grUIleiR033CI2re4uXKrM9i6HdrbDhKFRsz6Mrv2GMJkoMHM14r+9Fn7cvX0Pdu/1KCKbPHg+ VaiSNlIJ7fQ0blWWKiicS3RHZ2CHrgW6UJHZoesZsoSvlPbICihBe/+4LxXPoOeWrZ+zEuZNGqR DWOvRZEyAnFHJCTT33P9zh66fOaWtESx9rNaCsGIlTARUcwJ50ER+P1spMCoZfNZRiAvC7rgakH jM8WGKRXgYcHCWlji+1iqcS7/i8lwfn1XNKUbN0ufR8EKka4W/3DfvwJBTbrbqyMw1Ac+z1XAOm 3QHYcmwfsEg== X-Received: by 2002:a05:690c:39d:b0:81e:c500:c6d0 with SMTP id 00721157ae682-8546950b0a0mr48365527b3.0.1787732731242; Wed, 26 Aug 2026 01:25:31 -0700 (PDT) X-Received: by 2002:a05:690c:39d:b0:81e:c500:c6d0 with SMTP id 00721157ae682-8546950b0a0mr48365377b3.0.1787732730820; Wed, 26 Aug 2026 01:25:30 -0700 (PDT) Received: from localhost.localdomain ([2001:67c:1560:8007::aac:c1a2]) by smtp.gmail.com with ESMTPSA id 00721157ae682-8570d620433sm11913387b3.42.2026.08.26.01.25.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Aug 2026 01:25:30 -0700 (PDT) To: kernel-team@lists.ubuntu.com Subject: [SRU][R][PATCH v2 04/14] soundwire: Always wait for initialisation of unattached devices Date: Wed, 26 Aug 2026 16:24:45 +0800 Message-ID: <20260826082456.892463-5-chris.chiu@canonical.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260826082456.892463-1-chris.chiu@canonical.com> References: <20260826082456.892463-1-chris.chiu@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Chris Chiu via kernel-team From: Chris Chiu Reply-To: Chris Chiu Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Charles Keepax BugLink: https://bugs.launchpad.net/bugs/2163215 Currently in sdw_slave_wait_for_init() the waiting can be skipped if unattach_request is not set. Doing so was added in [1] likely because the core used to do a complete() on the completion so waiting in the case an unattach hadn't actually happened would block for the full timeout. However patch [2] updated the core to use complete_all() which means that the wait_for_completion() will now simply return if the device is already attached skipping the completion doesn't add much. Additionally, unattach_request is only set if the host initiates a bus reset. However, the host doing a bus reset is not the only reason a device may be unattached from the bus. Other options could include the driver probing before the device enumerates, a sync-loss, or the device itself powering down. Removing the skip using unattached_request, doesn't cost much in terms of efficiency and allows the sdw_slave_wait_for_init() helper to be used outside of runtime resume. [1] b2bd75f806c4 ("soundwire: sdw_slave: track unattach_request to handle all init sequences") [2] c40d6b3249b1 ("soundwire: fix enumeration completion") Acked-by: Vinod Koul Signed-off-by: Charles Keepax Link: https://patch.msgid.link/20260608102714.2503120-2-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown (cherry picked from commit 5677a551f45820ddd69f11559394bb79669271ca) Signed-off-by: Chris Chiu --- drivers/soundwire/bus.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c index ea3a24f805c0..b7bdf19ebb42 100644 --- a/drivers/soundwire/bus.c +++ b/drivers/soundwire/bus.c @@ -1386,9 +1386,6 @@ int sdw_slave_wait_for_init(struct sdw_slave *slave, int timeout_ms) { unsigned long time; - if (!slave->unattach_request) - return 0; - time = wait_for_completion_timeout(&slave->initialization_complete, msecs_to_jiffies(timeout_ms)); if (!time) { From patchwork Wed Aug 26 08:24:46 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Chiu X-Patchwork-Id: 2292512 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hVHlq5PCGz1xtN for ; Wed, 26 Aug 2026 18:25:43 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1wz8wy-0007CY-Lc; Wed, 26 Aug 2026 08:25:36 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1wz8wx-00079E-1M for kernel-team@lists.ubuntu.com; Wed, 26 Aug 2026 08:25:35 +0000 Received: from mail-yw1-f198.google.com (mail-yw1-f198.google.com [209.85.128.198]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id C91DC3FC3D for ; Wed, 26 Aug 2026 08:25:34 +0000 (UTC) Received: by mail-yw1-f198.google.com with SMTP id 00721157ae682-836cfb589a3so21263517b3.1 for ; Wed, 26 Aug 2026 01:25:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787732734; x=1788337534; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=maf7E4qFa4f0ksLP8Lg78XDJe0+1v6JhAdyg3VD/fH4=; b=sXp4El5fViY1L/q//ADLkwPBqlBm8YhOhWrNVEaxbHIGD5dEokHKyBsNMoJdqfGlOk ffjyPe1Dhh23onngO4xRN0R7W2ZD03sgYNv8dyicLTL3WoD3IDuAC2hq+X2nsGFdLqfk 2+Iyyw0CQhueSHJCotR71qU1oC2fbIuNqeBGM2v1Uq+4UqhM4YgBTk8YduMleDmZodh8 O9e8GenAs9RU6r1V0u5OoIIL8pIxEdniykaAS9KJlpGhbU/DE/AEND0AM+TspR85lfWd iAtz4dEP9/Dhl+mw+eHUfrniaF8tK3cWZ06galnd5MNdJMsqnpRWcns7R+JXJQLcryKa qmUg== X-Gm-Message-State: AFuF++nZ0OOIUZFXs72483D1yZ/7gZOV07KKJyODXR/wBTxwIg439/jy jsfB7PS4N9l9DmEKj2Ui2YKo64dLrdVi+j7jrO3AqF0oetS1M/LYbe28iwXyMbW5PGTKXHagtP6 ICaLO/sO84oJGq/W6yoaeEkuP88PgzPyD/6CwCNwfToS0ISPsa/aMubwohmVsczt76mHG+Imie7 unmPpnpKtuYncWT3GH X-Gm-Gg: AR+sD12inxh8bYx7++ZxQIm/PXa5pFy8uiSAb588FA5GYF1Lhzq264lw9TOrCYaxWwH Vigvb9U/gV1OFtecldRGIdN2i0errjlXNaBuXQTqTuxfiK2VVpbf6CIurO9BFxJSaHwwGWFnpLy 78gcojnuSjaY0O4dFYff+GbI7nhwIjtOFIHIz61oY4bNTa2HfCMKeuK8HRFyZhQPaulSRcVdxd2 Q82pnyNAjzJCjrfnpsc2Qju/2PsZ2EW8AtjqXLYWeSgq0FDJQPZW+2yuguJJtCSOuvLSJpe8Zvz /+1bgEuMSmdrmgPrEKdXqA67K+MNZAgUhL3dV+h3zqc7L2bNiHlOf+ktgHwgiTKOw1nwBVjXvjE plfW/A9xUYw== X-Received: by 2002:a05:690c:a648:b0:845:cc1a:af70 with SMTP id 00721157ae682-8573c2fdcdamr20762997b3.2.1787732733647; Wed, 26 Aug 2026 01:25:33 -0700 (PDT) X-Received: by 2002:a05:690c:a648:b0:845:cc1a:af70 with SMTP id 00721157ae682-8573c2fdcdamr20762767b3.2.1787732733201; Wed, 26 Aug 2026 01:25:33 -0700 (PDT) Received: from localhost.localdomain ([2001:67c:1560:8007::aac:c1a2]) by smtp.gmail.com with ESMTPSA id 00721157ae682-8570d620433sm11913387b3.42.2026.08.26.01.25.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Aug 2026 01:25:32 -0700 (PDT) To: kernel-team@lists.ubuntu.com Subject: [SRU][R][PATCH v2 05/14] ASoC: SDCA: Use new SoundWire enumeration helper Date: Wed, 26 Aug 2026 16:24:46 +0800 Message-ID: <20260826082456.892463-6-chris.chiu@canonical.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260826082456.892463-1-chris.chiu@canonical.com> References: <20260826082456.892463-1-chris.chiu@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Chris Chiu via kernel-team From: Chris Chiu Reply-To: Chris Chiu Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Charles Keepax BugLink: https://bugs.launchpad.net/bugs/2163215 Now the new wait for SoundWire enumeration helper no longer depends on unattach_request it is safe to use from probe time. Update the driver to use the new core helper. Signed-off-by: Charles Keepax Reviewed-by: Srinivas Kandagatla Tested-by: Srinivas Kandagatla Link: https://patch.msgid.link/20260608102714.2503120-10-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown (cherry picked from commit 90a49e0f16529719fd695c8856324702ed281f82) Signed-off-by: Chris Chiu --- sound/soc/sdca/sdca_class.c | 53 ++++--------------------------------- sound/soc/sdca/sdca_class.h | 3 --- 2 files changed, 5 insertions(+), 51 deletions(-) diff --git a/sound/soc/sdca/sdca_class.c b/sound/soc/sdca/sdca_class.c index 5def6ae2d99f..e37bbc8d3e2e 100644 --- a/sound/soc/sdca/sdca_class.c +++ b/sound/soc/sdca/sdca_class.c @@ -38,35 +38,8 @@ static int class_read_prop(struct sdw_slave *sdw) return 0; } -static int class_sdw_update_status(struct sdw_slave *sdw, enum sdw_slave_status status) -{ - struct sdca_class_drv *drv = dev_get_drvdata(&sdw->dev); - - switch (status) { - case SDW_SLAVE_ATTACHED: - dev_dbg(drv->dev, "device attach\n"); - - drv->attached = true; - - complete(&drv->device_attach); - break; - case SDW_SLAVE_UNATTACHED: - dev_dbg(drv->dev, "device detach\n"); - - drv->attached = false; - - reinit_completion(&drv->device_attach); - break; - default: - break; - } - - return 0; -} - static const struct sdw_slave_ops class_sdw_ops = { .read_prop = class_read_prop, - .update_status = class_sdw_update_status, }; static void class_regmap_lock(void *data) @@ -83,24 +56,6 @@ static void class_regmap_unlock(void *data) mutex_unlock(lock); } -static int class_wait_for_attach(struct sdca_class_drv *drv) -{ - if (!drv->attached) { - unsigned long timeout = msecs_to_jiffies(CLASS_SDW_ATTACH_TIMEOUT_MS); - unsigned long time; - - time = wait_for_completion_timeout(&drv->device_attach, timeout); - if (!time) { - dev_err(drv->dev, "timed out waiting for device re-attach\n"); - return -ETIMEDOUT; - } - } - - regcache_cache_only(drv->dev_regmap, false); - - return 0; -} - static bool class_dev_regmap_volatile(struct device *dev, unsigned int reg) { switch (reg) { @@ -151,10 +106,12 @@ static void class_boot_work(struct work_struct *work) boot_work); int ret; - ret = class_wait_for_attach(drv); + ret = sdw_slave_wait_for_init(drv->sdw, CLASS_SDW_ATTACH_TIMEOUT_MS); if (ret) goto err; + regcache_cache_only(drv->dev_regmap, false); + drv->irq_info = sdca_irq_allocate(drv->dev, drv->dev_regmap, drv->sdw->irq); if (IS_ERR(drv->irq_info)) @@ -213,7 +170,6 @@ static int class_sdw_probe(struct sdw_slave *sdw, const struct sdw_device_id *id dev_set_drvdata(drv->dev, drv); INIT_WORK(&drv->boot_work, class_boot_work); - init_completion(&drv->device_attach); dev_config->lock_arg = &drv->regmap_lock; @@ -297,10 +253,11 @@ static int class_runtime_resume(struct device *dev) struct sdca_class_drv *drv = dev_get_drvdata(dev); int ret; - ret = class_wait_for_attach(drv); + ret = sdw_slave_wait_for_init(drv->sdw, CLASS_SDW_ATTACH_TIMEOUT_MS); if (ret) goto err; + regcache_cache_only(drv->dev_regmap, false); regcache_mark_dirty(drv->dev_regmap); ret = regcache_sync(drv->dev_regmap); diff --git a/sound/soc/sdca/sdca_class.h b/sound/soc/sdca/sdca_class.h index 6f24ea2bbd38..c151c73dcb09 100644 --- a/sound/soc/sdca/sdca_class.h +++ b/sound/soc/sdca/sdca_class.h @@ -31,9 +31,6 @@ struct sdca_class_drv { /* Serialise function initialisations */ struct mutex init_lock; struct work_struct boot_work; - struct completion device_attach; - - bool attached; }; #endif /* __SDCA_CLASS_H__ */ From patchwork Wed Aug 26 08:24:47 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Chiu X-Patchwork-Id: 2292513 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hVHlt20YPz1xtN for ; Wed, 26 Aug 2026 18:25:46 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1wz8x1-0007H3-6C; Wed, 26 Aug 2026 08:25:39 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1wz8wz-0007DY-6K for kernel-team@lists.ubuntu.com; Wed, 26 Aug 2026 08:25:37 +0000 Received: from mail-yw1-f199.google.com (mail-yw1-f199.google.com [209.85.128.199]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 18A303F71B for ; Wed, 26 Aug 2026 08:25:37 +0000 (UTC) Received: by mail-yw1-f199.google.com with SMTP id 00721157ae682-81ea59b5979so21860567b3.3 for ; Wed, 26 Aug 2026 01:25:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787732736; x=1788337536; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=6/JYhF6xG74jEh0kpZSgUYhb1uVgmPqPyjhpnW6tc70=; b=f2UzfDAdrvKiv/2zc6iFjDaOhNT9cqR5d3IJo5NTHuPyrUcTL0yJ9MDF05nKnnWJdg k0jOOX+W+V4TKcXjQejjPFghQdjniIXGS1ywZtKYtI8XiHc11agYr8AaVAoeKYeA5oLC WCIa4f/otRZxmQ588vKnHhMhG+ET8VgUJoFFD9+pIJjJYpWEL8ZsgwW/PLeVkVrBl8C8 hgEx6Y3789oV39VM17oP2JU/UHQ3y0j6gqBYbUzN81R/vFZWiEpO5xuIBWUhYubd8EQI +QWZzT54h3UJvMg3McqScuYLqhuVoAYTIN9+Ye4TQvDxU6CYSUkfhuUYQmL+iY6iYTli XqUw== X-Gm-Message-State: AFuF++mq/hBiHsqKWRiahpvqwnTOP2HDASOxeZXOkQN3BHuHHsB7RrBu sU30dUtQ6JhS58eZftP8X3ueOFXYduHhl17qZUDhYD0c3JAGNU2RqhR8p8YAbKqGkuN1gWWhi9j aNcKnwmDDinWAlnXXuntV7ZRBwzDJV8G1hEf0L51zOymmzdxvhCEp6pOApMKGZUyCuZoSdH4PE2 t/imocpPFcBesNs0cZ X-Gm-Gg: AR+sD11QXOzcb4mZS9LTN2ashdcBPti7H6DJKqTiUR4x0xvg3algtq0+wjXqixOGIGH KWTBt1ctLGWt8atk/eubJcRIB9tirXYbuPo0WXCcv1scY93tvk9bayIOsV4wu0qpnoKx+jJuVbR fAGrZsLvC6eTjis0Goaa1GnpPzBp/RTA4x6VIDQ4rOwDC34cHuUTALxmAMCtJnZ9x/Bkj8uHHH4 yRCY8gF94LvyudHkKpB509CEckUK7o5v3HGGDeqSND+E/Wh8vmGG514rVhQHUAtBJ3vAJUUrGgY KObmc1Wi8qHKUTGXPRpUbyiquUUWBH9z15Qh4P5n39tLsDXWyLuxWd/msQD41iZB3EwHNp/2LZw dNb4NcRc59g== X-Received: by 2002:a05:690c:c603:b0:853:eac5:ced2 with SMTP id 00721157ae682-8573fdbf42bmr17996157b3.20.1787732735937; Wed, 26 Aug 2026 01:25:35 -0700 (PDT) X-Received: by 2002:a05:690c:c603:b0:853:eac5:ced2 with SMTP id 00721157ae682-8573fdbf42bmr17995997b3.20.1787732735480; Wed, 26 Aug 2026 01:25:35 -0700 (PDT) Received: from localhost.localdomain ([2001:67c:1560:8007::aac:c1a2]) by smtp.gmail.com with ESMTPSA id 00721157ae682-8570d620433sm11913387b3.42.2026.08.26.01.25.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Aug 2026 01:25:35 -0700 (PDT) To: kernel-team@lists.ubuntu.com Subject: [SRU][R][PATCH v2 06/14] ASoC: SDCA: Rename sdca_irq_allocate() to include devm Date: Wed, 26 Aug 2026 16:24:47 +0800 Message-ID: <20260826082456.892463-7-chris.chiu@canonical.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260826082456.892463-1-chris.chiu@canonical.com> References: <20260826082456.892463-1-chris.chiu@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Chris Chiu via kernel-team From: Chris Chiu Reply-To: Chris Chiu Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Charles Keepax BugLink: https://bugs.launchpad.net/bugs/2163215 Make it more clear sdca_irq_allocate() uses devm allocations by adding it into the name. Signed-off-by: Charles Keepax Link: https://patch.msgid.link/20260721143636.361814-2-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown (cherry picked from commit 4ecef577d1ceddaa906720c71c06672433aba318) Signed-off-by: Chris Chiu --- include/sound/sdca_interrupts.h | 5 +++-- sound/soc/sdca/sdca_class.c | 4 ++-- sound/soc/sdca/sdca_interrupts.c | 8 ++++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/include/sound/sdca_interrupts.h b/include/sound/sdca_interrupts.h index a515cc3df097..28fd44eb9334 100644 --- a/include/sound/sdca_interrupts.h +++ b/include/sound/sdca_interrupts.h @@ -86,8 +86,9 @@ int sdca_irq_populate(struct sdca_function_data *function, void sdca_irq_cleanup(struct device *dev, struct sdca_function_data *function, struct sdca_interrupt_info *info); -struct sdca_interrupt_info *sdca_irq_allocate(struct device *dev, - struct regmap *regmap, int irq); + +struct sdca_interrupt_info *devm_sdca_irq_allocate(struct device *dev, + struct regmap *regmap, int irq); void sdca_irq_enable_early(struct sdca_function_data *function, struct sdca_interrupt_info *info); diff --git a/sound/soc/sdca/sdca_class.c b/sound/soc/sdca/sdca_class.c index e37bbc8d3e2e..0c022337f02c 100644 --- a/sound/soc/sdca/sdca_class.c +++ b/sound/soc/sdca/sdca_class.c @@ -112,8 +112,8 @@ static void class_boot_work(struct work_struct *work) regcache_cache_only(drv->dev_regmap, false); - drv->irq_info = sdca_irq_allocate(drv->dev, drv->dev_regmap, - drv->sdw->irq); + drv->irq_info = devm_sdca_irq_allocate(drv->dev, drv->dev_regmap, + drv->sdw->irq); if (IS_ERR(drv->irq_info)) goto err; diff --git a/sound/soc/sdca/sdca_interrupts.c b/sound/soc/sdca/sdca_interrupts.c index 5cdabf8ae9da..8a8d0c061053 100644 --- a/sound/soc/sdca/sdca_interrupts.c +++ b/sound/soc/sdca/sdca_interrupts.c @@ -583,7 +583,7 @@ void sdca_irq_cleanup(struct device *dev, EXPORT_SYMBOL_NS_GPL(sdca_irq_cleanup, "SND_SOC_SDCA"); /** - * sdca_irq_allocate - allocate an SDCA interrupt structure for a device + * devm_sdca_irq_allocate - allocate an SDCA interrupt structure for a device * @sdev: Device pointer against which things should be allocated. * @regmap: regmap to be used for accessing the SDCA IRQ registers. * @irq: The interrupt number. @@ -595,8 +595,8 @@ EXPORT_SYMBOL_NS_GPL(sdca_irq_cleanup, "SND_SOC_SDCA"); * Return: A pointer to the allocated sdca_interrupt_info struct, or an * error code. */ -struct sdca_interrupt_info *sdca_irq_allocate(struct device *sdev, - struct regmap *regmap, int irq) +struct sdca_interrupt_info *devm_sdca_irq_allocate(struct device *sdev, + struct regmap *regmap, int irq) { struct sdca_interrupt_info *info; int ret, i; @@ -625,7 +625,7 @@ struct sdca_interrupt_info *sdca_irq_allocate(struct device *sdev, return info; } -EXPORT_SYMBOL_NS_GPL(sdca_irq_allocate, "SND_SOC_SDCA"); +EXPORT_SYMBOL_NS_GPL(devm_sdca_irq_allocate, "SND_SOC_SDCA"); static void irq_enable_flags(struct sdca_function_data *function, struct sdca_interrupt_info *info, bool early) From patchwork Wed Aug 26 08:24:48 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Chiu X-Patchwork-Id: 2292514 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hVHly4l6vz1xtN for ; Wed, 26 Aug 2026 18:25:50 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1wz8x3-0007Le-RM; Wed, 26 Aug 2026 08:25:41 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1wz8x1-0007Hd-JG for kernel-team@lists.ubuntu.com; Wed, 26 Aug 2026 08:25:39 +0000 Received: from mail-yw1-f198.google.com (mail-yw1-f198.google.com [209.85.128.198]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 6A6FF3F71B for ; Wed, 26 Aug 2026 08:25:39 +0000 (UTC) Received: by mail-yw1-f198.google.com with SMTP id 00721157ae682-81e6bb29581so23063747b3.2 for ; Wed, 26 Aug 2026 01:25:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787732738; x=1788337538; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=bYujn94WSzZmKV6InY6Lb/SxeyZeJQfaedYpLS8UMJI=; b=brgmd/JUlzlrZYPNMA9EqAaxM7ReblVX1VlgNP05w0uuKi16RzbuGNnY+a9VScgDEH rMR9O01EQdZo2qua5UtytnlHiSEIr3RLAvj+7m/R/TrxwNLBFkgS72Bs9Sy+PRk+eV/q lcJoIG43JI8Y5sdWTiy4qrUPAxTYCKbpdc9OIO6A3I6syLtK56YHw+KyYin3LqNe1xg8 EYKXvOv7bGg9T0vByZfzeWzE0mYSzmmgo+rYaoRw2JfkFoxwLvX6WduP8WfUh4yQ0isn vqF0SmIQHEuCPMJQpalyOtowvoWfo2mlx75JEw/aiIqrTTvZeA/l2A+bGhpTRIr/y1JT etMw== X-Gm-Message-State: AFuF++m4lzLf5Y55nYcKUBi6YqbzIfI20EX4YtY8YuA6Iubv4Q7EDDcc mvKRZL+I6CXTPsXCOJ3W58Accnhq48iCR3kAd2YKHH3TaNJgHsJ9EZMxwADjco/hmU8GFPrWxak nQ+kYPTKJK0kxkjldld4XVdvwen3otmcVe4/MTUsS4p7+Mt7EMXufSvsGkdJVSDsDtx2sX/imQ4 9BtK6C1GdcB98U4g4W X-Gm-Gg: AR+sD12ddWa0ChPvfoaj3Lmq/kk/Z0czHh/70W/XKJTWELSrevjgsdCLAItdZBZmDwo vow9KzXnlxOZCTKZ5/NYX5sX+N5D74XnDSqKoLtTznhY6qt8ycGU0rGoXY4xHLs/FjjvLy3zt0u Q6nAMhQvZxuGW7QehqrlA/xPwOJLjFFDdcm0XG8CPJtHQzKVj+Yc8eyl9D5ariQIHtlk081Otdr O6epvcgG6+0GGpt6dK7nWeaBA3KXZ17de758Di8VFUF8S5FEi/+ydmClaeTC7d+yk4Axh69u5/0 qPoLGaPt0aP3qFT16aHz0J7IBzi6vMvbdWo34I8wD5mRxc9YzKpLQka6wVGnmN/BCk5tv1LIzZM cPG7fzHZsoA== X-Received: by 2002:a05:690c:7:b0:809:ae5:1d2f with SMTP id 00721157ae682-8573cfb1604mr20535447b3.9.1787732738322; Wed, 26 Aug 2026 01:25:38 -0700 (PDT) X-Received: by 2002:a05:690c:7:b0:809:ae5:1d2f with SMTP id 00721157ae682-8573cfb1604mr20535337b3.9.1787732737955; Wed, 26 Aug 2026 01:25:37 -0700 (PDT) Received: from localhost.localdomain ([2001:67c:1560:8007::aac:c1a2]) by smtp.gmail.com with ESMTPSA id 00721157ae682-8570d620433sm11913387b3.42.2026.08.26.01.25.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Aug 2026 01:25:37 -0700 (PDT) To: kernel-team@lists.ubuntu.com Subject: [SRU][R][PATCH v2 07/14] ASoC: SDCA: Correct kernel doc for sdca_irq_cleanup() Date: Wed, 26 Aug 2026 16:24:48 +0800 Message-ID: <20260826082456.892463-8-chris.chiu@canonical.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260826082456.892463-1-chris.chiu@canonical.com> References: <20260826082456.892463-1-chris.chiu@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Chris Chiu via kernel-team From: Chris Chiu Reply-To: Chris Chiu Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Charles Keepax BugLink: https://bugs.launchpad.net/bugs/2163215 Fix typo of function argument name in the kernel doc. Fixes: 0b8757b220f9 ("ASoC: SDCA: Unregister IRQ handlers on module remove") Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202604090800.koxM6j6O-lkp@intel.com/ Signed-off-by: Charles Keepax Link: https://patch.msgid.link/20260409164328.3999434-2-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown (cherry picked from commit c271b0815f45078342bc4e778683c86fdc45fde7) Signed-off-by: Chris Chiu --- sound/soc/sdca/sdca_interrupts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/sdca/sdca_interrupts.c b/sound/soc/sdca/sdca_interrupts.c index 8a8d0c061053..a202e0b33fd5 100644 --- a/sound/soc/sdca/sdca_interrupts.c +++ b/sound/soc/sdca/sdca_interrupts.c @@ -555,7 +555,7 @@ EXPORT_SYMBOL_NS_GPL(sdca_irq_populate, "SND_SOC_SDCA"); /** * sdca_irq_cleanup - Free all the individual IRQs for an SDCA Function - * @sdev: Device pointer against which the sdca_interrupt_info was allocated. + * @dev: Device pointer against which the sdca_interrupt_info was allocated. * @function: Pointer to the SDCA Function. * @info: Pointer to the SDCA interrupt info for this device. * From patchwork Wed Aug 26 08:24:49 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Chiu X-Patchwork-Id: 2292515 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hVHm16xgBz1xtN for ; Wed, 26 Aug 2026 18:25:53 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1wz8x6-0007U1-Mj; Wed, 26 Aug 2026 08:25:44 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1wz8x4-0007Md-1b for kernel-team@lists.ubuntu.com; Wed, 26 Aug 2026 08:25:42 +0000 Received: from mail-yw1-f200.google.com (mail-yw1-f200.google.com [209.85.128.200]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id D60413F71B for ; Wed, 26 Aug 2026 08:25:41 +0000 (UTC) Received: by mail-yw1-f200.google.com with SMTP id 00721157ae682-8461ade272bso22339167b3.1 for ; Wed, 26 Aug 2026 01:25:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787732741; x=1788337541; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=q4+WxuYnqNQca5VtbJs48ROMSG4mu0KzuJlnq2QNr1g=; b=KZ9MS9HXPELPgdrdX8DE4DErAiqdB04oq5oUgacSn9za2hU9bAfUQtTGGtQYGxLSA3 eXmsz2Vv46Jdmu3Cx4JVaJo0B4aSL2Ay/j0oe2mSANVCKsfrYW+MIed6hFhwg1Hj6y66 jxsYSzHTpnM0nxcPQhT1cULuqM+kpSl+R0q3nc5UB3EfL8f/nhXnFZfZYer1YcWhnQ3/ FMq9Es8CBpDUFyWTRyAyUl0udl2Tsq/M0IszYWG35efNfg/DipgUXgIz3x57bntZXMRL B3PGjLqWbMeiZt0VG5lmprmzbMtjcgfXysz/tDRKPx6l5Hn+PWvdS3n8q7/7U5hqOFOz LWxQ== X-Gm-Message-State: AFuF++lnbiShUKKQKcXH15hCibrIjcJcUnzEMzvjicNJlDRDOSCZwJSS ++04Jae7pcDe31Lb2lLvuFDBcEm9wvWL4q3ABzh7lHMLPRQg0ntAtISp0QFOOvn4gCwA97Gq23f fFJ+oiv8BDS2jH1MeC1dB5owyaGhAXA3F+2Fk9RgYfpn1iBIP82bzms1cRErzJy49M5bS9G7sD4 ux8fOcmwRwcJpstMfQ X-Gm-Gg: AR+sD1218jEAOxYDdPU41CsL9FTKbmHPr/jD0TkAnVXZ+IvhjGfsc3jEG6b6FW2gci2 uElsPWTKcyK0alXcDLVGYp1HP2DlzalbgAdo4aqFhc/DmQpRXW8CfEg+OzbS44RyvLjCy0DKVJi 4KmgGSuTR22mas5bhqdBCjEwUwnhKSXkw1ySWjtpnunF4mq09xWIG2vvCJZFMR9gefQkvKTbjd+ shI5CMfzhkMUMVv/l+Qw8B0eiaAQTTsUzKpyw+RMAP1dkb2AZWR/Xrm3IUcCoKpCNklOKZQanFE OL/NCXMQLvRYIdTSgwR03JmumokwHA+mQ/poS54cqrKTRmjmGPOao9Awzow9U/Ipawn4tyRWTu1 7AWoBgDqwKQ== X-Received: by 2002:a05:690c:7013:b0:7f0:38f7:6ca6 with SMTP id 00721157ae682-854708ff95bmr64349877b3.5.1787732740687; Wed, 26 Aug 2026 01:25:40 -0700 (PDT) X-Received: by 2002:a05:690c:7013:b0:7f0:38f7:6ca6 with SMTP id 00721157ae682-854708ff95bmr64349727b3.5.1787732740173; Wed, 26 Aug 2026 01:25:40 -0700 (PDT) Received: from localhost.localdomain ([2001:67c:1560:8007::aac:c1a2]) by smtp.gmail.com with ESMTPSA id 00721157ae682-8570d620433sm11913387b3.42.2026.08.26.01.25.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Aug 2026 01:25:39 -0700 (PDT) To: kernel-team@lists.ubuntu.com Subject: [SRU][R][PATCH v2 08/14] ASoC: SDCA: Add sdca_irq_cleanup_late() Date: Wed, 26 Aug 2026 16:24:49 +0800 Message-ID: <20260826082456.892463-9-chris.chiu@canonical.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260826082456.892463-1-chris.chiu@canonical.com> References: <20260826082456.892463-1-chris.chiu@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Chris Chiu via kernel-team From: Chris Chiu Reply-To: Chris Chiu Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Charles Keepax BugLink: https://bugs.launchpad.net/bugs/2163215 The SDCA IRQs are split into two groups, those registered at bus probe time (basically just FDL) and those registered at component time. There currently exists only a single cleanup function, if the FDL IRQ is freed at component time, then nothing would re-register it if the component is probed again. But the IRQs depending on a component need to be freed if the card is destroyed so they can't use stale components. Split the clean up into two functions one for the component level and one for the bus level. Signed-off-by: Charles Keepax Link: https://patch.msgid.link/20260721143636.361814-3-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown (cherry picked from commit f18e97fa7f125e0e7da130b4d0ff1edd48d7510a) Signed-off-by: Chris Chiu --- include/sound/sdca_interrupts.h | 5 +++ sound/soc/sdca/sdca_class_function.c | 2 +- sound/soc/sdca/sdca_interrupts.c | 53 ++++++++++++++++++++++------ 3 files changed, 48 insertions(+), 12 deletions(-) diff --git a/include/sound/sdca_interrupts.h b/include/sound/sdca_interrupts.h index 28fd44eb9334..38c6c58c2cc7 100644 --- a/include/sound/sdca_interrupts.h +++ b/include/sound/sdca_interrupts.h @@ -33,6 +33,7 @@ struct sdca_function_data; * @priv: Pointer to private data for use by the handler. * @irq: IRQ number allocated to this interrupt, also used internally to track * the IRQ being assigned. + * @early_request: Flag to indicate this IRQ was requested at bus probe time. */ struct sdca_interrupt { const char *name; @@ -48,6 +49,7 @@ struct sdca_interrupt { void *priv; int irq; + bool early_request; }; /** @@ -86,6 +88,9 @@ int sdca_irq_populate(struct sdca_function_data *function, void sdca_irq_cleanup(struct device *dev, struct sdca_function_data *function, struct sdca_interrupt_info *info); +void sdca_irq_cleanup_late(struct device *dev, + struct sdca_function_data *function, + struct sdca_interrupt_info *info); struct sdca_interrupt_info *devm_sdca_irq_allocate(struct device *dev, struct regmap *regmap, int irq); diff --git a/sound/soc/sdca/sdca_class_function.c b/sound/soc/sdca/sdca_class_function.c index 730103120514..2f9bbe6a9b51 100644 --- a/sound/soc/sdca/sdca_class_function.c +++ b/sound/soc/sdca/sdca_class_function.c @@ -415,7 +415,7 @@ static void class_function_remove(struct auxiliary_device *auxdev) { struct class_function_drv *drv = auxiliary_get_drvdata(auxdev); - sdca_irq_cleanup(drv->dev, drv->function, drv->core->irq_info); + sdca_irq_cleanup_late(drv->dev, drv->function, drv->core->irq_info); } static int class_function_runtime_suspend(struct device *dev) diff --git a/sound/soc/sdca/sdca_interrupts.c b/sound/soc/sdca/sdca_interrupts.c index a202e0b33fd5..6ff0a0a12755 100644 --- a/sound/soc/sdca/sdca_interrupts.c +++ b/sound/soc/sdca/sdca_interrupts.c @@ -447,6 +447,8 @@ int sdca_irq_populate_early(struct device *dev, struct regmap *regmap, if (ret) return ret; + interrupt->early_request = true; + ret = sdca_fdl_alloc_state(interrupt); if (ret) return ret; @@ -553,17 +555,10 @@ int sdca_irq_populate(struct sdca_function_data *function, } EXPORT_SYMBOL_NS_GPL(sdca_irq_populate, "SND_SOC_SDCA"); -/** - * sdca_irq_cleanup - Free all the individual IRQs for an SDCA Function - * @dev: Device pointer against which the sdca_interrupt_info was allocated. - * @function: Pointer to the SDCA Function. - * @info: Pointer to the SDCA interrupt info for this device. - * - * Typically this would be called from the driver for a single SDCA Function. - */ -void sdca_irq_cleanup(struct device *dev, - struct sdca_function_data *function, - struct sdca_interrupt_info *info) +static void sdca_irq_cleanup_flags(struct device *dev, + struct sdca_function_data *function, + struct sdca_interrupt_info *info, + bool late_cleanup) { int i; @@ -575,13 +570,49 @@ void sdca_irq_cleanup(struct device *dev, if (interrupt->function != function || !interrupt->irq) continue; + if (interrupt->early_request && !late_cleanup) + continue; + sdca_irq_free_locked(dev, info, i, interrupt->name, interrupt); kfree(interrupt->name); } } + +/** + * sdca_irq_cleanup - Free the regular IRQs for an SDCA Function + * @dev: Device pointer against which the sdca_interrupt_info was allocated. + * @function: Pointer to the SDCA Function. + * @info: Pointer to the SDCA interrupt info for this device. + * + * Typically this would be called from the driver for a single SDCA Function + * from component remove. + */ +void sdca_irq_cleanup(struct device *dev, + struct sdca_function_data *function, + struct sdca_interrupt_info *info) +{ + sdca_irq_cleanup_flags(dev, function, info, false); +} EXPORT_SYMBOL_NS_GPL(sdca_irq_cleanup, "SND_SOC_SDCA"); +/** + * sdca_irq_cleanup_late - Free the early IRQs for an SDCA Function + * @dev: Device pointer against which the sdca_interrupt_info was allocated. + * @function: Pointer to the SDCA Function. + * @info: Pointer to the SDCA interrupt info for this device. + * + * Typically this would be called from the driver for a single SDCA Function + * from bus remove. + */ +void sdca_irq_cleanup_late(struct device *dev, + struct sdca_function_data *function, + struct sdca_interrupt_info *info) +{ + sdca_irq_cleanup_flags(dev, function, info, true); +} +EXPORT_SYMBOL_NS_GPL(sdca_irq_cleanup_late, "SND_SOC_SDCA"); + /** * devm_sdca_irq_allocate - allocate an SDCA interrupt structure for a device * @sdev: Device pointer against which things should be allocated. From patchwork Wed Aug 26 08:24:50 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Chiu X-Patchwork-Id: 2292516 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hVHm40bvdz1xtN for ; Wed, 26 Aug 2026 18:25:56 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1wz8x9-0007as-7w; Wed, 26 Aug 2026 08:25:47 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1wz8x6-0007Sr-Eh for kernel-team@lists.ubuntu.com; Wed, 26 Aug 2026 08:25:44 +0000 Received: from mail-yw1-f198.google.com (mail-yw1-f198.google.com [209.85.128.198]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 175163F71B for ; Wed, 26 Aug 2026 08:25:44 +0000 (UTC) Received: by mail-yw1-f198.google.com with SMTP id 00721157ae682-836cfd56077so10541387b3.1 for ; Wed, 26 Aug 2026 01:25:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787732743; x=1788337543; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=TP9MUaBuwNC+IsF/siyES9u2PW1adPpZOspJel1PUkY=; b=DS8o3pkS4GDM52mqgAYrp/smh5SAeoC+xYooPj33RA5kkot/tvWDpD+TfSFoComAgP 4IUGesNzZqm0xWJaq5gSyZqOtQ3N5bhKCvzXjbGpktQ+uIucsaHJa6280MbO3Hvs7Mx7 Ns0LDxGAiSShlZvyUngpIYu9dOYbZ0ABJVWMzDv3VeO/cjDxBeTYh83/otnr7bKJ+8Az tJ2M6Nd1Il9amIqh1VM9HAkG9XKRrMddUhiG19cUFobSGKOTi/+duSXg1jJv11xaED/n ST1u+Oem1YWooPHwCY4ZISEQXEBaWbznmao9zwyoShEfrMilqRSLAq14x+c2zyfzTIz0 6WMg== X-Gm-Message-State: AFuF++mm3QFD0fhnsnhlYt1PQkrfeWBBoL2my68VTMC6B2NdPwoFV6jT qTEXd+e0ljQX5kFXXWPJaY1S3+BuenlbJDQrJBrFKR/SIt6rT8trLIIZlhL3edBtImV9Ry/AIwj hP7OOHZzy7eO+SWsxNA8/fj9h9ZZp7r4XpHO9vPL4SAGNgAnR6Yzl7Ly5FPaSMcjTiC0mp7K9zV uofLWeczHBXvFyzO6y X-Gm-Gg: AR+sD10Uo1W/ukyigu/Pt98NIbKgISQCzDcx/qYEp1m+vPTjZC8cDj09y7zoY89CSTH BrxNZ5Sk2AcLYGA0HdnCrVpv6saOpCdm/GfWFwJLMk5lPYuBCZRbaTZsc+w9/Vs7CB0xYMeVDYF cidHCpHjUva643LprPT1wm4VZXQ/luudRtpjMAz97XW/hTT8Dc2GeAl7kDRZbQJKPkTRSW4OF/I GyXkWGqEU/q1vSttIBkqzRCOz4ZDYb9rCXbzgfiIBYZjS5+8wL24DjiShtUj/1pQcr/1RiRX3m0 eUy6qb7Kl1D+3YP3JXN8bF5eebUM9EfkBrLa8xbLs2VEPkmUsLTWheJMx3PCiTXj3Htg3WtWv/u JfIEd91r8jg== X-Received: by 2002:a05:690c:1a:b0:845:1064:5c03 with SMTP id 00721157ae682-8573fadc903mr23811147b3.23.1787732742966; Wed, 26 Aug 2026 01:25:42 -0700 (PDT) X-Received: by 2002:a05:690c:1a:b0:845:1064:5c03 with SMTP id 00721157ae682-8573fadc903mr23810987b3.23.1787732742562; Wed, 26 Aug 2026 01:25:42 -0700 (PDT) Received: from localhost.localdomain ([2001:67c:1560:8007::aac:c1a2]) by smtp.gmail.com with ESMTPSA id 00721157ae682-8570d620433sm11913387b3.42.2026.08.26.01.25.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Aug 2026 01:25:42 -0700 (PDT) To: kernel-team@lists.ubuntu.com Subject: [SRU][R][PATCH v2 09/14] ASoC: SDCA: Remove devm from primary IRQ cleanup Date: Wed, 26 Aug 2026 16:24:50 +0800 Message-ID: <20260826082456.892463-10-chris.chiu@canonical.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260826082456.892463-1-chris.chiu@canonical.com> References: <20260826082456.892463-1-chris.chiu@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Chris Chiu via kernel-team From: Chris Chiu Reply-To: Chris Chiu Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Charles Keepax BugLink: https://bugs.launchpad.net/bugs/2163215 To provide greater flexibility on when the IRQs are requested for client drivers don't use devm for the primary IRQ request/cleanup helper functions. Signed-off-by: Charles Keepax Link: https://patch.msgid.link/20260721143636.361814-4-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown (cherry picked from commit 0880082c27b6251cc3fea307dffa6899ad163e8b) Signed-off-by: Chris Chiu --- include/sound/sdca_fdl.h | 2 ++ include/sound/sdca_interrupts.h | 2 ++ include/sound/sdca_jack.h | 2 ++ sound/soc/sdca/sdca_fdl.c | 13 +++++++++++-- sound/soc/sdca/sdca_interrupts.c | 8 ++++++++ sound/soc/sdca/sdca_jack.c | 13 +++++++++++-- 6 files changed, 36 insertions(+), 4 deletions(-) diff --git a/include/sound/sdca_fdl.h b/include/sound/sdca_fdl.h index fbaf4b384c8a..dc33927b82bd 100644 --- a/include/sound/sdca_fdl.h +++ b/include/sound/sdca_fdl.h @@ -67,6 +67,8 @@ struct fdl_state { #if IS_ENABLED(CONFIG_SND_SOC_SDCA_FDL) int sdca_fdl_alloc_state(struct sdca_interrupt *interrupt); +void sdca_fdl_free_state(struct sdca_interrupt *interrupt); + int sdca_fdl_process(struct sdca_interrupt *interrupt); int sdca_fdl_sync(struct device *dev, struct sdca_function_data *function, struct sdca_interrupt_info *info); diff --git a/include/sound/sdca_interrupts.h b/include/sound/sdca_interrupts.h index 38c6c58c2cc7..8a44c19e917c 100644 --- a/include/sound/sdca_interrupts.h +++ b/include/sound/sdca_interrupts.h @@ -31,6 +31,7 @@ struct sdca_function_data; * @entity: Pointer to the Entity that the interrupt is associated with. * @control: Pointer to the Control that the interrupt is associated with. * @priv: Pointer to private data for use by the handler. + * @free_priv: Pointer to a function that can be used to free the priv data. * @irq: IRQ number allocated to this interrupt, also used internally to track * the IRQ being assigned. * @early_request: Flag to indicate this IRQ was requested at bus probe time. @@ -47,6 +48,7 @@ struct sdca_interrupt { struct sdca_control *control; void *priv; + void (*free_priv)(struct sdca_interrupt *interrupt); int irq; bool early_request; diff --git a/include/sound/sdca_jack.h b/include/sound/sdca_jack.h index 181541f0f4d8..59de40b7d7d0 100644 --- a/include/sound/sdca_jack.h +++ b/include/sound/sdca_jack.h @@ -28,6 +28,8 @@ struct jack_state { }; int sdca_jack_alloc_state(struct sdca_interrupt *interrupt); +void sdca_jack_free_state(struct sdca_interrupt *interrupt); + int sdca_jack_process(struct sdca_interrupt *interrupt); int sdca_jack_set_jack(struct sdca_interrupt_info *info, struct snd_soc_jack *jack); int sdca_jack_report(struct sdca_interrupt *interrupt); diff --git a/sound/soc/sdca/sdca_fdl.c b/sound/soc/sdca/sdca_fdl.c index 994821a6df61..82e09d960c12 100644 --- a/sound/soc/sdca/sdca_fdl.c +++ b/sound/soc/sdca/sdca_fdl.c @@ -481,10 +481,9 @@ EXPORT_SYMBOL_NS_GPL(sdca_fdl_process, "SND_SOC_SDCA"); */ int sdca_fdl_alloc_state(struct sdca_interrupt *interrupt) { - struct device *dev = interrupt->dev; struct fdl_state *fdl_state; - fdl_state = devm_kzalloc(dev, sizeof(*fdl_state), GFP_KERNEL); + fdl_state = kzalloc_obj(*fdl_state); if (!fdl_state) return -ENOMEM; @@ -499,3 +498,13 @@ int sdca_fdl_alloc_state(struct sdca_interrupt *interrupt) return 0; } EXPORT_SYMBOL_NS_GPL(sdca_fdl_alloc_state, "SND_SOC_SDCA"); + +/** + * sdca_fdl_free_state - free state for an FDL interrupt + * @interrupt: SDCA interrupt structure. + */ +void sdca_fdl_free_state(struct sdca_interrupt *interrupt) +{ + kfree(interrupt->priv); +} +EXPORT_SYMBOL_NS_GPL(sdca_fdl_free_state, "SND_SOC_SDCA"); diff --git a/sound/soc/sdca/sdca_interrupts.c b/sound/soc/sdca/sdca_interrupts.c index 6ff0a0a12755..0e721306f3cf 100644 --- a/sound/soc/sdca/sdca_interrupts.c +++ b/sound/soc/sdca/sdca_interrupts.c @@ -448,6 +448,7 @@ int sdca_irq_populate_early(struct device *dev, struct regmap *regmap, return ret; interrupt->early_request = true; + interrupt->free_priv = sdca_fdl_free_state; ret = sdca_fdl_alloc_state(interrupt); if (ret) @@ -521,6 +522,8 @@ int sdca_irq_populate(struct sdca_function_data *function, handler = function_status_handler; break; case SDCA_CTL_TYPE_S(GE, DETECTED_MODE): + interrupt->free_priv = sdca_jack_free_state; + ret = sdca_jack_alloc_state(interrupt); if (ret) return ret; @@ -528,6 +531,8 @@ int sdca_irq_populate(struct sdca_function_data *function, handler = detected_mode_handler; break; case SDCA_CTL_TYPE_S(XU, FDL_CURRENTOWNER): + interrupt->free_priv = sdca_fdl_free_state; + ret = sdca_fdl_alloc_state(interrupt); if (ret) return ret; @@ -575,6 +580,9 @@ static void sdca_irq_cleanup_flags(struct device *dev, sdca_irq_free_locked(dev, info, i, interrupt->name, interrupt); + if (interrupt->free_priv) + interrupt->free_priv(interrupt); + kfree(interrupt->name); } } diff --git a/sound/soc/sdca/sdca_jack.c b/sound/soc/sdca/sdca_jack.c index ae9636622a84..ffa870964924 100644 --- a/sound/soc/sdca/sdca_jack.c +++ b/sound/soc/sdca/sdca_jack.c @@ -132,10 +132,9 @@ EXPORT_SYMBOL_NS_GPL(sdca_jack_process, "SND_SOC_SDCA"); */ int sdca_jack_alloc_state(struct sdca_interrupt *interrupt) { - struct device *dev = interrupt->dev; struct jack_state *jack_state; - jack_state = devm_kzalloc(dev, sizeof(*jack_state), GFP_KERNEL); + jack_state = kzalloc_obj(*jack_state); if (!jack_state) return -ENOMEM; @@ -145,6 +144,16 @@ int sdca_jack_alloc_state(struct sdca_interrupt *interrupt) } EXPORT_SYMBOL_NS_GPL(sdca_jack_alloc_state, "SND_SOC_SDCA"); +/** + * sdca_jack_free_state - free state for a jack interrupt + * @interrupt: SDCA interrupt structure. + */ +void sdca_jack_free_state(struct sdca_interrupt *interrupt) +{ + kfree(interrupt->priv); +} +EXPORT_SYMBOL_NS_GPL(sdca_jack_free_state, "SND_SOC_SDCA"); + static int type_get_mask(enum sdca_terminal_type type) { switch (type) { From patchwork Wed Aug 26 08:24:51 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Chiu X-Patchwork-Id: 2292517 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hVHm53CXlz1xtN for ; Wed, 26 Aug 2026 18:25:57 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1wz8xC-0007jC-85; Wed, 26 Aug 2026 08:25:50 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1wz8x8-0007a6-Uf for kernel-team@lists.ubuntu.com; Wed, 26 Aug 2026 08:25:47 +0000 Received: from mail-yw1-f200.google.com (mail-yw1-f200.google.com [209.85.128.200]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id AE8EC3F71B for ; Wed, 26 Aug 2026 08:25:46 +0000 (UTC) Received: by mail-yw1-f200.google.com with SMTP id 00721157ae682-836c416b236so23369947b3.0 for ; Wed, 26 Aug 2026 01:25:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787732745; x=1788337545; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=TdZ4tx55ga7Y8Snxs/ypw6DWAwIu6sazsTPVAeBjSSg=; b=EgSNFg5Os7rmQKpAUuHg+txzaMbRgQolqwkAx9sgNp8adzAX+x+yr+0b1WmcpHszUt 4Ozgu/HOQtE17ggFg3i1wlG53ZbGIyL6mbQJaVJ9xzFIraQfpKRKnQxzAM3RliRSek7N b0woiqQ/JQgZRHTaQ/6KtHvM7P21ZSLLOiwQzfolirea/YnabOVJROqw+0n97NpqKH+Z uFitE1JKWwdKVaFPh7P4rBFvil+hhnprv1+b6zGZ7/WoEg6tnWiZF17sIxJX6SyzbsXd VTkUNFieYaomrjQ7UdMdqVeVqi6JDPUDw0azm05SPcl35c1ebKbbXl6Jn3/AasV7bwqr ypcQ== X-Gm-Message-State: AFuF++klIWz7/8mlaSb3SLoAERmQ/c5kFtEGUtZms3NzyjvbQId6CBdY 4WQ9Sn1Mq4DdrEbvNHvlucpY1DSMfNcHcN6uTdWkE312/rEnrdFwLKf5LkWwcuFty+eUWzu8Lld EMB4D/0Itx7sguczHFIO+TWyl8/DzKlFteBCeQZXDLAWtOllkbxlst5+hzgx0NHCdiwrR4JFHzU E+1u9/BjJ0/ajZEM7c X-Gm-Gg: AR+sD11Ix84Jb2VCSXASKUys2dXFLN8F4A4FUGUHQBGLyzpnRE3gmGWHKfT4ZBAg6gW PmC3TXnYFZ4NelgWAQrdhnaUyuJbNamUFMHGRpfRdaGmU8oEL6tfK16HDbF9/b+uUiEKdGe6tSB 19Dt3pUfAUU7QG50BV8w8aniYUyCHgtNP7ectfTTSzr9zVHdiOYa8rkRrNXwhidVqKjgPKKbcvp xHG2fWq5cSv4r0wFFstBjLacHP0AhJdOi8CvvPctqAaM3R0fm5fVUMJPYYS0fUPT4Wlwi/w9m1K t+BvBZi6o4q5Lwsjxe3ISjKzoz034mwXxEZWA0QSpgSpBa7h/u+NviBCCfzkEx9KscusSvEBW7Z jSFDTBjd0Iw== X-Received: by 2002:a05:690c:6602:b0:81c:eca8:dbaf with SMTP id 00721157ae682-85749dcd353mr21198927b3.31.1787732745267; Wed, 26 Aug 2026 01:25:45 -0700 (PDT) X-Received: by 2002:a05:690c:6602:b0:81c:eca8:dbaf with SMTP id 00721157ae682-85749dcd353mr21198767b3.31.1787732744861; Wed, 26 Aug 2026 01:25:44 -0700 (PDT) Received: from localhost.localdomain ([2001:67c:1560:8007::aac:c1a2]) by smtp.gmail.com with ESMTPSA id 00721157ae682-8570d620433sm11913387b3.42.2026.08.26.01.25.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Aug 2026 01:25:44 -0700 (PDT) To: kernel-team@lists.ubuntu.com Subject: [SRU][R][PATCH v2 10/14] ASoC: SDCA: Add missing stub for sdca_fdl_free_state() Date: Wed, 26 Aug 2026 16:24:51 +0800 Message-ID: <20260826082456.892463-11-chris.chiu@canonical.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260826082456.892463-1-chris.chiu@canonical.com> References: <20260826082456.892463-1-chris.chiu@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Chris Chiu via kernel-team From: Chris Chiu Reply-To: Chris Chiu Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Charles Keepax BugLink: https://bugs.launchpad.net/bugs/2163215 There should be a stub for sdca_fdl_free_state() for the case FDL support isn't built into the kernel. Add the missing stub. Fixes: 0880082c27b6 ("ASoC: SDCA: Remove devm from primary IRQ cleanup") Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202607291304.FE3mOcJF-lkp@intel.com/ Signed-off-by: Charles Keepax Link: https://patch.msgid.link/20260730130602.3747053-1-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown (cherry picked from commit f6970d8535a95c137f05e9ca825072de3b217b88) Signed-off-by: Chris Chiu --- include/sound/sdca_fdl.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/sound/sdca_fdl.h b/include/sound/sdca_fdl.h index dc33927b82bd..bc3600cdd2ec 100644 --- a/include/sound/sdca_fdl.h +++ b/include/sound/sdca_fdl.h @@ -83,6 +83,10 @@ static inline int sdca_fdl_alloc_state(struct sdca_interrupt *interrupt) return 0; } +static inline void sdca_fdl_free_state(struct sdca_interrupt *interrupt) +{ +} + static inline int sdca_fdl_process(struct sdca_interrupt *interrupt) { return 0; From patchwork Wed Aug 26 08:24:52 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Chiu X-Patchwork-Id: 2292518 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hVHm71NjXz1xtN for ; Wed, 26 Aug 2026 18:25:59 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1wz8xD-0007mr-OL; Wed, 26 Aug 2026 08:25:51 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1wz8xB-0007gC-0r for kernel-team@lists.ubuntu.com; Wed, 26 Aug 2026 08:25:49 +0000 Received: from mail-yw1-f197.google.com (mail-yw1-f197.google.com [209.85.128.197]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id CBDB23FC9A for ; Wed, 26 Aug 2026 08:25:48 +0000 (UTC) Received: by mail-yw1-f197.google.com with SMTP id 00721157ae682-7f5b54da461so11059997b3.3 for ; Wed, 26 Aug 2026 01:25:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787732748; x=1788337548; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=UbWd+csa40v1dN32UIJarCEihHE5cYM4K4O7XZk3Wp4=; b=GjEsZQVCtyiNz74u+uDqyMeUYznXWB2eyiImRKCKqpbozeV2G6PjNdgLUi9hTczxTT GnQVlX+QyyLKWlqV7NKDCSXQnCHyBg78WntIt2t6furOSd+fw1dWYJSySJZ715XLyJ6u QkpCoqF7nQKgRx8kvu99alLQhSvHlfpvtv7248ZGROHLkI0FWnjV8gXFSrmMKMWgF//f mR+yQ7ulP9Qg9X+uCoxQQgPb6t3gMRe4/IDtMrTxmBin54DAfVwtDaWtcOahd5tvTjhP so5GOB1/FPhzjat3dfZ0ihsPbKN7+MMo6OU3+og4wdaWWmB/XD/q1xbvq704DQ0aA826 M47A== X-Gm-Message-State: AFuF++mIsHbfZwvLoDrTIliXIItEqwwoCklY3jLe8Bv+c03ZjTJDimWr 40sTX+b1bpQnp8ia59FftwhIaBzVw0hGk1FXvtWHryHX3ctaRui4dtnpBhvHbebniAQb7YVuqSC qCpAO1WzqiCERKtBRUOwZ148egaXUe7F+cyLpOnzO/vBwjvQxIAT3DC2gQ2aEeCNpjOEj9NvxEA mL8IxnvneyQadEkscw X-Gm-Gg: AR+sD13nzCLEYLbviQqqJuZXT4kpj8UAHXVrS4AxCxsJYM/lgFIqUcayJ9EuDTTjDED rRb50UBCLPwUrOb7Omf1I2pVtS+uCXRIl6z6fKYkj607BZn1KmA0g0lsziDiP36/YALkRQbMVpv I0yv8btbP2fEkGwCT6dzyAH2hPkrCxajbBWtGaeUYwwnzj5L8foa0bAo2Ycjvd0BRS2HQ13pbWL sKnqQNDWGcQiWmhL/thjzdSjEuE3Q7UV2NNMK8j33MkQjhtfTsB6bAyFAt1i24P9mEMN9LuASFT UOXbU/Cow6O9R0geXggoir60VyHShaH54xEoqwJTWhFFxaoEE2QQDxToIj8xxLoloVY7KopPMfG HKNgDToyfrA== X-Received: by 2002:a05:690c:a4d2:b0:834:fadf:6085 with SMTP id 00721157ae682-8573be1eb0bmr19184017b3.4.1787732747592; Wed, 26 Aug 2026 01:25:47 -0700 (PDT) X-Received: by 2002:a05:690c:a4d2:b0:834:fadf:6085 with SMTP id 00721157ae682-8573be1eb0bmr19183927b3.4.1787732747136; Wed, 26 Aug 2026 01:25:47 -0700 (PDT) Received: from localhost.localdomain ([2001:67c:1560:8007::aac:c1a2]) by smtp.gmail.com with ESMTPSA id 00721157ae682-8570d620433sm11913387b3.42.2026.08.26.01.25.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Aug 2026 01:25:46 -0700 (PDT) To: kernel-team@lists.ubuntu.com Subject: [SRU][R][PATCH v2 11/14] ASoC: SDCA: Populate IRQ data earlier Date: Wed, 26 Aug 2026 16:24:52 +0800 Message-ID: <20260826082456.892463-12-chris.chiu@canonical.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260826082456.892463-1-chris.chiu@canonical.com> References: <20260826082456.892463-1-chris.chiu@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Chris Chiu via kernel-team From: Chris Chiu Reply-To: Chris Chiu Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Charles Keepax BugLink: https://bugs.launchpad.net/bugs/2163215 Currently, the IRQ data (attached Entity/Control/etc) is populated as the IRQ is requested. However, this can cause issues as occasionally the setup process wants to access specifics of an IRQ before the IRQ is actually enabled. To facilitate this cache all the IRQ data during sdca_irq_populate_early() and make sdca_irq_populate() simply request the outstanding IRQs. This also has the advantage that sdca_irq_populate() can now just iterate through the IRQ array which is much smaller/faster than going through every Entity in the Function for Controls. Signed-off-by: Charles Keepax Link: https://patch.msgid.link/20260721143636.361814-5-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown (cherry picked from commit 050406cbd676615ba71081bce69df710754d27e4) Signed-off-by: Chris Chiu --- include/sound/sdca_interrupts.h | 2 + sound/soc/sdca/sdca_interrupts.c | 115 ++++++++++++------------------- 2 files changed, 47 insertions(+), 70 deletions(-) diff --git a/include/sound/sdca_interrupts.h b/include/sound/sdca_interrupts.h index 8a44c19e917c..3b30146e21db 100644 --- a/include/sound/sdca_interrupts.h +++ b/include/sound/sdca_interrupts.h @@ -30,6 +30,7 @@ struct sdca_function_data; * @function: Pointer to the Function that the interrupt is associated with. * @entity: Pointer to the Entity that the interrupt is associated with. * @control: Pointer to the Control that the interrupt is associated with. + * @handler: Handler function to be called for the IRQ. * @priv: Pointer to private data for use by the handler. * @free_priv: Pointer to a function that can be used to free the priv data. * @irq: IRQ number allocated to this interrupt, also used internally to track @@ -46,6 +47,7 @@ struct sdca_interrupt { struct sdca_function_data *function; struct sdca_entity *entity; struct sdca_control *control; + irq_handler_t handler; void *priv; void (*free_priv)(struct sdca_interrupt *interrupt); diff --git a/sound/soc/sdca/sdca_interrupts.c b/sound/soc/sdca/sdca_interrupts.c index 0e721306f3cf..79a17d827f99 100644 --- a/sound/soc/sdca/sdca_interrupts.c +++ b/sound/soc/sdca/sdca_interrupts.c @@ -412,7 +412,8 @@ static struct sdca_interrupt *get_interrupt_data(struct device *dev, int irq, * * This is intended to be used as part of the Function boot process. It * can be called before the soundcard is registered (ie. doesn't depend - * on component) and will register the FDL interrupts. + * on component) and will populate all the required IRQ data, as well as + * registering the FDL interrupts to start booting the device. * * Return: Zero on success, and a negative error code on failure. */ @@ -439,24 +440,36 @@ int sdca_irq_populate_early(struct device *dev, struct regmap *regmap, else if (!interrupt) continue; + ret = sdca_irq_data_populate(dev, regmap, NULL, function, + entity, control, interrupt); + if (ret) + return ret; + switch (SDCA_CTL_TYPE(entity->type, control->sel)) { - case SDCA_CTL_TYPE_S(XU, FDL_CURRENTOWNER): - ret = sdca_irq_data_populate(dev, regmap, NULL, - function, entity, - control, interrupt); + case SDCA_CTL_TYPE_S(ENTITY_0, FUNCTION_STATUS): + interrupt->handler = function_status_handler; + break; + case SDCA_CTL_TYPE_S(GE, DETECTED_MODE): + interrupt->handler = detected_mode_handler; + interrupt->free_priv = sdca_jack_free_state; + + ret = sdca_jack_alloc_state(interrupt); if (ret) return ret; - - interrupt->early_request = true; + break; + case SDCA_CTL_TYPE_S(XU, FDL_CURRENTOWNER): + interrupt->handler = fdl_owner_handler; interrupt->free_priv = sdca_fdl_free_state; ret = sdca_fdl_alloc_state(interrupt); if (ret) return ret; + interrupt->early_request = true; + ret = sdca_irq_request_locked(dev, info, irq, interrupt->name, - fdl_owner_handler, + interrupt->handler, interrupt); if (ret) { dev_err(dev, "failed to request irq %s: %d\n", @@ -464,7 +477,11 @@ int sdca_irq_populate_early(struct device *dev, struct regmap *regmap, return ret; } break; + case SDCA_CTL_TYPE_S(HIDE, HIDTX_CURRENTOWNER): + interrupt->handler = hid_handler; + break; default: + interrupt->handler = base_handler; break; } } @@ -489,70 +506,26 @@ int sdca_irq_populate(struct sdca_function_data *function, struct sdca_interrupt_info *info) { struct device *dev = component->dev; - int i, j; + int i, ret; guard(mutex)(&info->irq_lock); - for (i = 0; i < function->num_entities; i++) { - struct sdca_entity *entity = &function->entities[i]; - - for (j = 0; j < entity->num_controls; j++) { - struct sdca_control *control = &entity->controls[j]; - int irq = control->interrupt_position; - struct sdca_interrupt *interrupt; - irq_handler_t handler; - int ret; - - interrupt = get_interrupt_data(dev, irq, info); - if (IS_ERR(interrupt)) - return PTR_ERR(interrupt); - else if (!interrupt) - continue; - - ret = sdca_irq_data_populate(dev, NULL, component, - function, entity, control, - interrupt); - if (ret) - return ret; - - handler = base_handler; - - switch (SDCA_CTL_TYPE(entity->type, control->sel)) { - case SDCA_CTL_TYPE_S(ENTITY_0, FUNCTION_STATUS): - handler = function_status_handler; - break; - case SDCA_CTL_TYPE_S(GE, DETECTED_MODE): - interrupt->free_priv = sdca_jack_free_state; - - ret = sdca_jack_alloc_state(interrupt); - if (ret) - return ret; - - handler = detected_mode_handler; - break; - case SDCA_CTL_TYPE_S(XU, FDL_CURRENTOWNER): - interrupt->free_priv = sdca_fdl_free_state; + for (i = 0; i < SDCA_MAX_INTERRUPTS; i++) { + struct sdca_interrupt *interrupt = &info->irqs[i]; + int irq; - ret = sdca_fdl_alloc_state(interrupt); - if (ret) - return ret; + if (interrupt->function != function || interrupt->irq) + continue; - handler = fdl_owner_handler; - break; - case SDCA_CTL_TYPE_S(HIDE, HIDTX_CURRENTOWNER): - handler = hid_handler; - break; - default: - break; - } + interrupt->component = component; - ret = sdca_irq_request_locked(dev, info, irq, interrupt->name, - handler, interrupt); - if (ret) { - dev_err(dev, "failed to request irq %s: %d\n", - interrupt->name, ret); - return ret; - } + irq = interrupt->control->interrupt_position; + ret = sdca_irq_request_locked(dev, info, irq, interrupt->name, + interrupt->handler, interrupt); + if (ret) { + dev_err(dev, "failed to request irq %s: %d\n", + interrupt->name, ret); + return ret; } } @@ -572,13 +545,15 @@ static void sdca_irq_cleanup_flags(struct device *dev, for (i = 0; i < SDCA_MAX_INTERRUPTS; i++) { struct sdca_interrupt *interrupt = &info->irqs[i]; - if (interrupt->function != function || !interrupt->irq) + if (interrupt->function != function || + (interrupt->early_request && !late_cleanup)) continue; - if (interrupt->early_request && !late_cleanup) - continue; + if (interrupt->irq) + sdca_irq_free_locked(dev, info, i, interrupt->name, interrupt); - sdca_irq_free_locked(dev, info, i, interrupt->name, interrupt); + if (!late_cleanup) + continue; if (interrupt->free_priv) interrupt->free_priv(interrupt); From patchwork Wed Aug 26 08:24:53 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Chiu X-Patchwork-Id: 2292519 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hVHm90gdwz1xtN for ; Wed, 26 Aug 2026 18:26:01 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1wz8xF-0007ry-Av; Wed, 26 Aug 2026 08:25:53 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1wz8xD-0007lc-4j for kernel-team@lists.ubuntu.com; Wed, 26 Aug 2026 08:25:51 +0000 Received: from mail-yw1-f197.google.com (mail-yw1-f197.google.com [209.85.128.197]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id E00B03F71B for ; Wed, 26 Aug 2026 08:25:50 +0000 (UTC) Received: by mail-yw1-f197.google.com with SMTP id 00721157ae682-81eddfe28b4so21436847b3.3 for ; Wed, 26 Aug 2026 01:25:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787732750; x=1788337550; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=MHsxF+pJVW9LTnadfClcxpO69G8/wnKh0iT0F82Tusw=; b=JWtt5eYrkDYWwe6AxTEUUS0zUymG7oGx7NOyNpukWnDthv7POReYeJMSkCK7PdwLAL 8RChA9gbZ3Xr4k9BzA4GwxvFoCcrY6Ncv6zZ4rxiHufQa9dyz+Ad5UV2ERC6smEpYP8N qq5BbGCi2c1assWbyDqDYlGtDvV6hiXdxs7K32iVj8OB7MIpAxGTR5/KRcAnsfU1BzQt TDc8ejxhaGryVtdMjRKetrNmQig880ceIkuqxkZ/k/86hrc9bmLV2ikyETZKwW0TPeh/ fOBRvEV8u0iEoN/cJdaZcMTpg1wnv67omeATI0f2796o8dENqKWJ8cYGUwD8F7wuSpsU eRTA== X-Gm-Message-State: AFuF++mrURfoA9/4ynYUC+MghSvNx8UYftc1Ef1w7hJbB115UAMJlqwJ YDGFdatsK/foytmcx8CqF0kzcRztb32dzBc3mZPNtyQyEaLvtDkbFqMV5OJr9McPbrolhlRQCbx e5yNz+qR8odOZgjx9OJ9yAahE47Pxzch4w4dbSnm+i/CAlWZS4rWanOHyVDe4kILo7+4Rmz4kCo 5fbSUUBISX/D8PrT70 X-Gm-Gg: AR+sD127+FP8DozKrPWg3isug/9hssf0NIrf0tQ8brRzfnZPZEI7ThLcc8uynKeGvBh lu89Ps8vDISre0VFZnxV+IIVNXo/KtGde4y28lJJyLsIZLbNudnok0WKzzkt6Dv/3UHf+uKUWtj SW2QdzTXYvpJ40d5yarAtf6nCSg28nDkII8jFFrups1PceXdsmiI1BV1wnE3FLu17m8GjyycrkZ wrBOp1qwG0y6T2xDcXD5vf3C9638u+oSdvKwh4lZWYIwHZgRUNK25Nlx/IPeFpxdeyrQuKd7VDz 0EJSQmY9+vZs2kPoOANorEd9XxeJlvR5l4+HjMusPglc2boKG5xme9arQTlNnohukNbYkC6NxzA Ipf/TDDbsqA== X-Received: by 2002:a53:d053:0:10b0:667:ba34:51e2 with SMTP id 956f58d0204a3-66d2569129fmr1559023d50.13.1787732749825; Wed, 26 Aug 2026 01:25:49 -0700 (PDT) X-Received: by 2002:a53:d053:0:10b0:667:ba34:51e2 with SMTP id 956f58d0204a3-66d2569129fmr1559015d50.13.1787732749383; Wed, 26 Aug 2026 01:25:49 -0700 (PDT) Received: from localhost.localdomain ([2001:67c:1560:8007::aac:c1a2]) by smtp.gmail.com with ESMTPSA id 00721157ae682-8570d620433sm11913387b3.42.2026.08.26.01.25.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Aug 2026 01:25:49 -0700 (PDT) To: kernel-team@lists.ubuntu.com Subject: [SRU][R][PATCH v2 12/14] ASoC: Add a component fixup_controls callback Date: Wed, 26 Aug 2026 16:24:53 +0800 Message-ID: <20260826082456.892463-13-chris.chiu@canonical.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260826082456.892463-1-chris.chiu@canonical.com> References: <20260826082456.892463-1-chris.chiu@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Chris Chiu via kernel-team From: Chris Chiu Reply-To: Chris Chiu Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Charles Keepax BugLink: https://bugs.launchpad.net/bugs/2163215 A card level fixup_controls callback was added in: commit df4d27b19b89 ("ASoC: Introduce 'fixup_controls' card method") This allowed the machine driver to take actions after all the card controls have been added. However, there are times when a codec driver would also want to do things like obtain references to controls for later use, which require all the controls to be present. Add a component level fixup_controls callback, echoing the card level option. Signed-off-by: Charles Keepax Link: https://patch.msgid.link/20260721143636.361814-6-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown (cherry picked from commit 3e81e2fb216327a73510a7aa5318023c379d479a) Signed-off-by: Chris Chiu --- include/sound/soc-component.h | 2 ++ sound/soc/soc-component.c | 10 ++++++++++ sound/soc/soc-core.c | 5 +++++ 3 files changed, 17 insertions(+) diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h index 0435ba376369..972d0475b355 100644 --- a/include/sound/soc-component.h +++ b/include/sound/soc-component.h @@ -76,6 +76,7 @@ struct snd_soc_component_driver { unsigned int num_dapm_routes; int (*probe)(struct snd_soc_component *component); + int (*fixup_controls)(struct snd_soc_component *component); void (*remove)(struct snd_soc_component *component); int (*suspend)(struct snd_soc_component *component); int (*resume)(struct snd_soc_component *component); @@ -384,6 +385,7 @@ void snd_soc_component_suspend(struct snd_soc_component *component); void snd_soc_component_resume(struct snd_soc_component *component); int snd_soc_component_is_suspended(struct snd_soc_component *component); int snd_soc_component_probe(struct snd_soc_component *component); +int snd_soc_component_fixup_controls(struct snd_soc_component *component); void snd_soc_component_remove(struct snd_soc_component *component); int snd_soc_component_of_xlate_dai_id(struct snd_soc_component *component, struct device_node *ep); diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c index 77ad33383974..7fa4b1bc10ed 100644 --- a/sound/soc/soc-component.c +++ b/sound/soc/soc-component.c @@ -310,6 +310,16 @@ int snd_soc_component_probe(struct snd_soc_component *component) return soc_component_ret(component, ret); } +int snd_soc_component_fixup_controls(struct snd_soc_component *component) +{ + int ret = 0; + + if (component->driver->fixup_controls) + ret = component->driver->fixup_controls(component); + + return soc_component_ret(component, ret); +} + void snd_soc_component_remove(struct snd_soc_component *component) { if (component->driver->remove) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 054bdd642ac5..21ddd7540864 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2306,6 +2306,11 @@ static int snd_soc_bind_card(struct snd_soc_card *card) goto probe_end; snd_soc_dapm_new_widgets(card); + for_each_card_components(card, component) { + ret = snd_soc_component_fixup_controls(component); + if (ret < 0) + goto probe_end; + } snd_soc_card_fixup_controls(card); ret = snd_card_register(card->snd_card); From patchwork Wed Aug 26 08:24:54 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Chiu X-Patchwork-Id: 2292520 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hVHmC3nZ1z1xtN for ; Wed, 26 Aug 2026 18:26:03 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1wz8xH-00082Y-TI; Wed, 26 Aug 2026 08:25:55 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1wz8xF-0007sQ-Ea for kernel-team@lists.ubuntu.com; Wed, 26 Aug 2026 08:25:53 +0000 Received: from mail-yw1-f198.google.com (mail-yw1-f198.google.com [209.85.128.198]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 397E03F71B for ; Wed, 26 Aug 2026 08:25:53 +0000 (UTC) Received: by mail-yw1-f198.google.com with SMTP id 00721157ae682-7f582244e9eso21454307b3.3 for ; Wed, 26 Aug 2026 01:25:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787732752; x=1788337552; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=ZZIvZhph7DLFhAp1f5wmW4HSDm+a7+pJDCOS3pIx3t4=; b=LsZN5vl6xsG/aC571FMHoHzi1ElZ/ktf5gDjL6XeNMJrzy6wwqlXE3sd8fUPgW29eM Cs+rELcsEhuQySl6sS1qwbPwI0vpozqCfgtiVwwt+IHB9uA+EznPOWg5T66CstTZzwLo T7WOb5QvAu9gZ/usvkp2y1+eZGoyZTKxlbzky/xs6k1UFN2qsxnlpqsSoX/u+j8nESYA ltDhyNeb4b3w1yj7DFsFl6wQma4eAa58+2+nmhk45R4tbUqaECTfatlrFslfmlpP13Lu Egu5ZLgHXGytThVxB6BwUJLtpN5NO3Zrj8iDjiBPMLzMsU6IxQOyRsQaVBe6r5Sznq4j wzvA== X-Gm-Message-State: AFuF++lXrRx5pn8pwc/QmaIIZYvOEc/z/BC6MjwuXwOBU7kvpbsEsBAh bfKdgoP6E4E5MyLduK5jU7RP3fbr/zPEfn0sS2vNtUf+Spu5FKpvKWNRQAM4qE8pCtBmW1s6gfg r965228i4qrajxn44Rc8dRa/UwZAbXWDV28mbdo4BnxR009yXHCWbJsw4G5AyM12o3PtfJVrLQy D4u9IxnIW8AcqKPYwl X-Gm-Gg: AR+sD13DX6Qbl6/mxMQo+H43TGDOVnkI4nSWJ3if2z2UAOxZ1TNV7iC922dDCBuHg0D p9eIE0vSXGClc2ld32vAzjliBR6Q60PCg4uOz8RprNgW2nSIkflK9eZmzpFe2Gtm5bRBfeg2js8 OmWZbt9d4tL/PYctCKpp6nyCPpJt9fnzTvHtstmNzHUdX1C6diwwwNkX6Gd77JWhXDHONo7GU/f vrTGpJImaMBYGRnaI52IK/3ZYHCNWqzYGDX0dhJMDMuKH+SuoIix1wTBlqDlNDkwexOEoBNU6Az QbEhgKky3SivAAb7795uq/JUh0wXwd00DXaH+1w0hAeSqSVcxeocA9OURzOzc+4aztMGvXmfH49 pVd5h2OHPWw== X-Received: by 2002:a05:690c:c424:b0:7ff:1399:9317 with SMTP id 00721157ae682-8573cacfc91mr19125487b3.11.1787732752091; Wed, 26 Aug 2026 01:25:52 -0700 (PDT) X-Received: by 2002:a05:690c:c424:b0:7ff:1399:9317 with SMTP id 00721157ae682-8573cacfc91mr19125417b3.11.1787732751667; Wed, 26 Aug 2026 01:25:51 -0700 (PDT) Received: from localhost.localdomain ([2001:67c:1560:8007::aac:c1a2]) by smtp.gmail.com with ESMTPSA id 00721157ae682-8570d620433sm11913387b3.42.2026.08.26.01.25.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Aug 2026 01:25:51 -0700 (PDT) To: kernel-team@lists.ubuntu.com Subject: [SRU][R][PATCH v2 13/14] ASoC: SDCA: Switch to fixup_controls callback for IRQ registration Date: Wed, 26 Aug 2026 16:24:54 +0800 Message-ID: <20260826082456.892463-14-chris.chiu@canonical.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260826082456.892463-1-chris.chiu@canonical.com> References: <20260826082456.892463-1-chris.chiu@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Chris Chiu via kernel-team From: Chris Chiu Reply-To: Chris Chiu Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Charles Keepax BugLink: https://bugs.launchpad.net/bugs/2163215 Currently there are some race conditions around the boot of SDCA jack detection. The core creates DAPM widgets/routes quite a long time before it creates the associated ALSA control, and the jack detection IRQ is currently registered in component probe. At the time of component probe, the DAPM widgets exist, shortly after this the DAPM routes are added. At the time the DAPM routes are added the register value for the control is checked and the appropriate path is connected. The existing handling in the SDCA jack IRQ handles the case the control doesn't exist and updates the registers directly, which works until the DAPM routes are added. After the routes are added the DAPM graph has already set connected on a particular DAPM path, which will not be updated until an IRQ is received when the control is present. Thus those updates are usually not reflected in the resulting DAPM graph which can lead to the audio path being erroneously powered on/off. Switch to the new fixup_controls callback to register the IRQs, this is guaranteed to run after all the controls have been created. Which means we can avoid the aforementioned race condition and as a bonus no longer need to concern ourselves with a case where the IRQ handler runs and the ALSA control is unavailable. Signed-off-by: Charles Keepax Link: https://patch.msgid.link/20260721143636.361814-7-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown (cherry picked from commit b8f71f16134fadc287fbb14be2a42b707efb7a30) Signed-off-by: Chris Chiu --- sound/soc/sdca/sdca_class_function.c | 4 +-- sound/soc/sdca/sdca_jack.c | 44 ++++++++++++---------------- 2 files changed, 21 insertions(+), 27 deletions(-) diff --git a/sound/soc/sdca/sdca_class_function.c b/sound/soc/sdca/sdca_class_function.c index 2f9bbe6a9b51..c12f60f30ad9 100644 --- a/sound/soc/sdca/sdca_class_function.c +++ b/sound/soc/sdca/sdca_class_function.c @@ -190,7 +190,7 @@ static const struct snd_soc_dai_ops class_function_sdw_ops = { .hw_free = class_function_sdw_remove_peripheral, }; -static int class_function_component_probe(struct snd_soc_component *component) +static int class_function_component_fixup_controls(struct snd_soc_component *component) { struct class_function_drv *drv = snd_soc_component_get_drvdata(component); struct sdca_class_drv *core = drv->core; @@ -216,7 +216,7 @@ static int class_function_set_jack(struct snd_soc_component *component, } static const struct snd_soc_component_driver class_function_component_drv = { - .probe = class_function_component_probe, + .fixup_controls = class_function_component_fixup_controls, .remove = class_function_component_remove, .endianness = 1, }; diff --git a/sound/soc/sdca/sdca_jack.c b/sound/soc/sdca/sdca_jack.c index ffa870964924..3c84d17244a2 100644 --- a/sound/soc/sdca/sdca_jack.c +++ b/sound/soc/sdca/sdca_jack.c @@ -41,6 +41,7 @@ int sdca_jack_process(struct sdca_interrupt *interrupt) struct jack_state *state = interrupt->priv; struct snd_kcontrol *kctl = state->kctl; struct snd_ctl_elem_value *ucontrol __free(kfree) = NULL; + struct soc_enum *soc_enum; unsigned int reg, val; int ret; @@ -55,10 +56,12 @@ int sdca_jack_process(struct sdca_interrupt *interrupt) return -ENOMEM; kctl = snd_soc_component_get_kcontrol(component, name); - if (!kctl) - dev_dbg(dev, "control not found: %s\n", name); - else - state->kctl = kctl; + if (!kctl) { + dev_err(dev, "control not found: %s\n", name); + return -ENODEV; + } + + state->kctl = kctl; } reg = SDW_SDCA_CTL(interrupt->function->desc->adr, interrupt->entity->id, @@ -96,30 +99,21 @@ int sdca_jack_process(struct sdca_interrupt *interrupt) dev_dbg(dev, "%s: %#x\n", interrupt->name, val); - if (kctl) { - struct soc_enum *soc_enum = (struct soc_enum *)kctl->private_value; - - ucontrol = kzalloc_obj(*ucontrol); - if (!ucontrol) - return -ENOMEM; - - ucontrol->value.enumerated.item[0] = snd_soc_enum_val_to_item(soc_enum, val); + ucontrol = kzalloc_obj(*ucontrol); + if (!ucontrol) + return -ENOMEM; - ret = snd_soc_dapm_put_enum_double(kctl, ucontrol); - if (ret < 0) { - dev_err(dev, "failed to update selected mode: %d\n", ret); - return ret; - } + soc_enum = (struct soc_enum *)kctl->private_value; + ucontrol->value.enumerated.item[0] = snd_soc_enum_val_to_item(soc_enum, val); - snd_ctl_notify(card->snd_card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id); - } else { - ret = regmap_write(interrupt->function_regmap, reg, val); - if (ret) { - dev_err(dev, "failed to write selected mode: %d\n", ret); - return ret; - } + ret = snd_soc_dapm_put_enum_double(kctl, ucontrol); + if (ret < 0) { + dev_err(dev, "failed to update selected mode: %d\n", ret); + return ret; } + snd_ctl_notify(card->snd_card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id); + return sdca_jack_report(interrupt); } EXPORT_SYMBOL_NS_GPL(sdca_jack_process, "SND_SOC_SDCA"); @@ -201,7 +195,7 @@ int sdca_jack_set_jack(struct sdca_interrupt_info *info, struct snd_soc_jack *ja struct sdca_control_range *range; struct jack_state *jack_state; - if (!interrupt->irq) + if (!interrupt->dev) continue; switch (SDCA_CTL_TYPE(entity->type, control->sel)) { From patchwork Wed Aug 26 08:24:55 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Chiu X-Patchwork-Id: 2292521 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hVHmF0Dhwz1xtN for ; Wed, 26 Aug 2026 18:26:05 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1wz8xJ-00087Z-B0; Wed, 26 Aug 2026 08:25:57 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1wz8xH-00080s-IR for kernel-team@lists.ubuntu.com; Wed, 26 Aug 2026 08:25:55 +0000 Received: from mail-yw1-f197.google.com (mail-yw1-f197.google.com [209.85.128.197]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 6D6813F8AE for ; Wed, 26 Aug 2026 08:25:55 +0000 (UTC) Received: by mail-yw1-f197.google.com with SMTP id 00721157ae682-81eddfe28b4so21438377b3.3 for ; Wed, 26 Aug 2026 01:25:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787732754; x=1788337554; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=dbYN1354bH3KDGMQhZc/zg+viluR8omS0EQm61jT8PQ=; b=SYZZzBZoiI+0RxJRD3rXlvG+eYcRiPubBNS09Pve0lsgydko+zJnMsLmpwHCrk+1jP DsZdw/DmL5DjZajxsxyWNsheL+bGDvPvpes6oggOZV2Bt+oGRJHShueqTo1kBU+1Ga6p d1hhiIdrOfpG2/sHD10dViQx5b9XdCuMpfNVWk0FfY56hw+8kMza66CwoJK7Wp0yR+k3 z4ZxmOtlmMWR9QDbSHEBJs2ykDVlVQRWaAubqpM/K5yQ6KzoN7wJLlr/AV/znShhs6m9 2+TIMNZkAxMqbTqXNgQpsyw3DtjqKfa0jkYkq0ad90f7G2qSO8FbEf9MtAI7wo5VPIc2 DXnw== X-Gm-Message-State: AFuF++ktMekGrudk5MnRLnGmsx0jnGYQSTVG1o2EP8in7yvfbb/L2bvX BreKteclnI/2GvEXLyQRQHCz2ycEVEh1lhmDtDiSdbtEx8gaWJF7TqGbTn7h+TNhbDrsSlyBeU4 xoltwEeoLWq9k6B0el/zLV7C6jpj5epLarSaFwv2aEUdZD4aDEEEBRzgiNkUniBxvpZ4Hzyn8lm 9N9kLiesPwnoTID8Fa X-Gm-Gg: AR+sD12pf823XvWKpoBzZxhxv47Pzoz30zMJqJrn93S2GMzg/Mc5Hi9UmGg9Ng1n3ir SxHyvpgJlhwcQJv8IrdS8bUvgv9iB4vRc74kle7bnaWopoFSq6OTvowHHTaeTxoyP2YKvaIm1Zl 8gpCaJhZk1HuEHGyW2jqbcjSJgQBkSXS5PKQQUxxolqlcUgR8hYxejvUAy8KRBGvI8hEKASkMfz HM80JWf2wwmR+pyHExswdEDRpN1ym10cqEUioOPua57KFCbePyZRAYlfKN8JoSWJKpmjZSB4EGS yW7Mi5I38hwfpgSv3OiI5+ILf8ZT3kTg3EKp5/zzz+ZOaleqZW8US2hKLglFqs8oy33hk6wSdwd PKqpLmDos3w== X-Received: by 2002:a05:690c:4027:b0:81e:b981:3eb5 with SMTP id 00721157ae682-8573f8e35e2mr17742917b3.23.1787732754318; Wed, 26 Aug 2026 01:25:54 -0700 (PDT) X-Received: by 2002:a05:690c:4027:b0:81e:b981:3eb5 with SMTP id 00721157ae682-8573f8e35e2mr17742857b3.23.1787732753914; Wed, 26 Aug 2026 01:25:53 -0700 (PDT) Received: from localhost.localdomain ([2001:67c:1560:8007::aac:c1a2]) by smtp.gmail.com with ESMTPSA id 00721157ae682-8570d620433sm11913387b3.42.2026.08.26.01.25.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Aug 2026 01:25:53 -0700 (PDT) To: kernel-team@lists.ubuntu.com Subject: [SRU][R][PATCH v2 14/14] ASoC: SDCA: Move kcontrol search out of IRQ Date: Wed, 26 Aug 2026 16:24:55 +0800 Message-ID: <20260826082456.892463-15-chris.chiu@canonical.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260826082456.892463-1-chris.chiu@canonical.com> References: <20260826082456.892463-1-chris.chiu@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Chris Chiu via kernel-team From: Chris Chiu Reply-To: Chris Chiu Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Charles Keepax BugLink: https://bugs.launchpad.net/bugs/2163215 Now that the IRQs are always registered after all the ALSA controls are created it is possible to search for the control at the point the IRQ is requested. Move the control search out of the IRQ handler and do it at IRQ request time. This also fixes a potential issue when the card was torn down and reprobed without destroying the codec device, the kctl pointer stored by the IRQ handler would not be updated to the new control on the second probe. Signed-off-by: Charles Keepax Link: https://patch.msgid.link/20260721143636.361814-8-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown (cherry picked from commit bf1b7821f85383a8804441f8fd5165be148f3ec8) Signed-off-by: Chris Chiu --- include/sound/sdca_jack.h | 1 + sound/soc/sdca/sdca_interrupts.c | 12 +++++++++ sound/soc/sdca/sdca_jack.c | 43 +++++++++++++++++++------------- 3 files changed, 39 insertions(+), 17 deletions(-) diff --git a/include/sound/sdca_jack.h b/include/sound/sdca_jack.h index 59de40b7d7d0..871ba2d8146a 100644 --- a/include/sound/sdca_jack.h +++ b/include/sound/sdca_jack.h @@ -28,6 +28,7 @@ struct jack_state { }; int sdca_jack_alloc_state(struct sdca_interrupt *interrupt); +int sdca_jack_init_state(struct sdca_interrupt *interrupt); void sdca_jack_free_state(struct sdca_interrupt *interrupt); int sdca_jack_process(struct sdca_interrupt *interrupt); diff --git a/sound/soc/sdca/sdca_interrupts.c b/sound/soc/sdca/sdca_interrupts.c index 79a17d827f99..15da7c2aea50 100644 --- a/sound/soc/sdca/sdca_interrupts.c +++ b/sound/soc/sdca/sdca_interrupts.c @@ -512,6 +512,8 @@ int sdca_irq_populate(struct sdca_function_data *function, for (i = 0; i < SDCA_MAX_INTERRUPTS; i++) { struct sdca_interrupt *interrupt = &info->irqs[i]; + struct sdca_control *control = interrupt->control; + struct sdca_entity *entity = interrupt->entity; int irq; if (interrupt->function != function || interrupt->irq) @@ -519,6 +521,16 @@ int sdca_irq_populate(struct sdca_function_data *function, interrupt->component = component; + switch (SDCA_CTL_TYPE(entity->type, control->sel)) { + case SDCA_CTL_TYPE_S(GE, DETECTED_MODE): + ret = sdca_jack_init_state(interrupt); + if (ret) + return ret; + break; + default: + break; + } + irq = interrupt->control->interrupt_position; ret = sdca_irq_request_locked(dev, info, irq, interrupt->name, interrupt->handler, interrupt); diff --git a/sound/soc/sdca/sdca_jack.c b/sound/soc/sdca/sdca_jack.c index 3c84d17244a2..73f8067906a9 100644 --- a/sound/soc/sdca/sdca_jack.c +++ b/sound/soc/sdca/sdca_jack.c @@ -47,23 +47,6 @@ int sdca_jack_process(struct sdca_interrupt *interrupt) guard(rwsem_write)(rwsem); - if (!kctl) { - const char *name __free(kfree) = kasprintf(GFP_KERNEL, "%s %s", - interrupt->entity->label, - SDCA_CTL_SELECTED_MODE_NAME); - - if (!name) - return -ENOMEM; - - kctl = snd_soc_component_get_kcontrol(component, name); - if (!kctl) { - dev_err(dev, "control not found: %s\n", name); - return -ENODEV; - } - - state->kctl = kctl; - } - reg = SDW_SDCA_CTL(interrupt->function->desc->adr, interrupt->entity->id, interrupt->control->sel, 0); @@ -148,6 +131,32 @@ void sdca_jack_free_state(struct sdca_interrupt *interrupt) } EXPORT_SYMBOL_NS_GPL(sdca_jack_free_state, "SND_SOC_SDCA"); +/** + * sdca_jack_init_state - Initialise transient state for a jack interrupt + * @interrupt: SDCA interrupt structure. + * + * Return: Zero on success or a negative error code. + */ +int sdca_jack_init_state(struct sdca_interrupt *interrupt) +{ + struct jack_state *jack_state = interrupt->priv; + const char *name __free(kfree) = kasprintf(GFP_KERNEL, "%s %s", + interrupt->entity->label, + SDCA_CTL_SELECTED_MODE_NAME); + + if (!name) + return -ENOMEM; + + jack_state->kctl = snd_soc_component_get_kcontrol(interrupt->component, name); + if (!jack_state->kctl) { + dev_err(interrupt->dev, "control not found: %s\n", name); + return -ENODEV; + } + + return 0; +} +EXPORT_SYMBOL_NS_GPL(sdca_jack_init_state, "SND_SOC_SDCA"); + static int type_get_mask(enum sdca_terminal_type type) { switch (type) {