From nobody Mon Feb 9 00:25:39 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90110EB64DD for ; Fri, 21 Jul 2023 15:19:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231971AbjGUPTz (ORCPT ); Fri, 21 Jul 2023 11:19:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231922AbjGUPTY (ORCPT ); Fri, 21 Jul 2023 11:19:24 -0400 Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9086135B7 for ; Fri, 21 Jul 2023 08:18:57 -0700 (PDT) Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 36LDppwo011284; Fri, 21 Jul 2023 10:18:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= PODMain02222019; bh=j37nKlnAnDmdNfGe63dPvdzAmcVymWBIePqBc5RtyJg=; b= bagMmyJje8RFK8jdOHL5xxSxlBSUqS3nYhNhZXKD0F7zaus68XfLkNfZcvIBCr+M u0xnAR5Aaz51OTeHftodNy1aAbdtWodYvrUZW6xU9Eg5X9nQkGYsp86FaOqWW5RZ 8L2CrWdpP+FWgfU6Iox1YUOVHmQpVaLlkNVBPB34TclWYub7FLfnqKRSw2xRO4HE vUjW4LePI6N3tUo2BaJ23l1Q8axCT9e4GR4FZngZPvn+GBvJW6KJE+zfcn39Krbp 6J6jDsk3nhXwGzfRur1l/2NKLce3bbqNnIX9E5wg57avy3t7l8Babp9IxfjSUI5D 058Tm/Z9zxrGiJIDbdqjnQ== Received: from ediex02.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3rus62y8g5-8 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jul 2023 10:18:34 -0500 (CDT) Received: from ediex01.ad.cirrus.com (198.61.84.80) by ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.30; Fri, 21 Jul 2023 16:18:27 +0100 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.2.1118.30 via Frontend Transport; Fri, 21 Jul 2023 16:18:27 +0100 Received: from sbinding-cirrus-dsktp2.ad.cirrus.com (unknown [198.90.238.219]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 3BA843572; Fri, 21 Jul 2023 15:18:27 +0000 (UTC) From: Stefan Binding To: Mark Brown , Jaroslav Kysela , Takashi Iwai CC: , , , Stefan Binding Subject: [PATCH v2 07/11] ALSA: hda: hda_component: Add pre and post playback hooks to hda_component Date: Fri, 21 Jul 2023 16:18:12 +0100 Message-ID: <20230721151816.2080453-8-sbinding@opensource.cirrus.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230721151816.2080453-1-sbinding@opensource.cirrus.com> References: <20230721151816.2080453-1-sbinding@opensource.cirrus.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: oPQdapLMK4Vngyeds10t5We7SIv8YL7k X-Proofpoint-ORIG-GUID: oPQdapLMK4Vngyeds10t5We7SIv8YL7k X-Proofpoint-Spam-Reason: safe Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" These hooks can be used to add callbacks that would be run before and after the main playback hooks. These hooks would be called for all amps, before moving on to the next hook, i.e. pre_playback_hook would be called for all amps, before the playback_hook is called for all amps, then finally the post_playback_hook is called for all amps. Signed-off-by: Stefan Binding --- sound/pci/hda/hda_component.h | 2 ++ sound/pci/hda/patch_realtek.c | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/sound/pci/hda/hda_component.h b/sound/pci/hda/hda_component.h index 534e845b9cd1d..f170aec967c18 100644 --- a/sound/pci/hda/hda_component.h +++ b/sound/pci/hda/hda_component.h @@ -15,5 +15,7 @@ struct hda_component { struct device *dev; char name[HDA_MAX_NAME_SIZE]; struct hda_codec *codec; + void (*pre_playback_hook)(struct device *dev, int action); void (*playback_hook)(struct device *dev, int action); + void (*post_playback_hook)(struct device *dev, int action); }; diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 52ea7d757d6ad..a6585afb77071 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -6716,9 +6716,17 @@ static void comp_generic_playback_hook(struct hda_pc= m_stream *hinfo, struct hda_ int i; =20 for (i =3D 0; i < HDA_MAX_COMPONENTS; i++) { - if (spec->comps[i].dev) + if (spec->comps[i].dev && spec->comps[i].pre_playback_hook) + spec->comps[i].pre_playback_hook(spec->comps[i].dev, action); + } + for (i =3D 0; i < HDA_MAX_COMPONENTS; i++) { + if (spec->comps[i].dev && spec->comps[i].playback_hook) spec->comps[i].playback_hook(spec->comps[i].dev, action); } + for (i =3D 0; i < HDA_MAX_COMPONENTS; i++) { + if (spec->comps[i].dev && spec->comps[i].post_playback_hook) + spec->comps[i].post_playback_hook(spec->comps[i].dev, action); + } } =20 struct cs35l41_dev_name { --=20 2.34.1