Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp4557179iog; Wed, 22 Jun 2022 00:51:39 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vnZN557b/QiuV4KDomCMpyDxvwt2qdZ7kJT9/4gi8Twj/DU1PYBwCrK2UAr6n3rBRkIMUZ X-Received: by 2002:a17:903:110d:b0:168:c610:9a80 with SMTP id n13-20020a170903110d00b00168c6109a80mr32818886plh.12.1655884299595; Wed, 22 Jun 2022 00:51:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655884299; cv=none; d=google.com; s=arc-20160816; b=tyfg4wUzeykDOJw58BVe++abOPuN1TU05kk1eW4zyjZR3OXolRbPkC5OxphZRXDqDu jJtXfiBYiqaOKcJYtpGFVTsYkANeFJIPn74jyliYfL2Tfsa9+iVIGZy3wt7f9if+zWvZ L0XxLItigtHcfrA5xu8SWDmW3p4hwTeQJ+WqklJBCCJqlRHprnZnO2n0tqLPYFiDaJhk rdq0SLnd/n81odx3kcZX6PzBE1rmK7lyAWhDTujFQuswFk4RMp2EKwwA/J8bEQTHGhze uS7rm7cb4fRIym3W9FGUSXJB6VUg/TDRyHDdqB6Obr3b+wqB0CuIRnDOG8rQLfCWtysS VYxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=RNYk4UBGUtNXwVtJjqkoxDLehd0DQef6Q3E9pMtrqrY=; b=t9qJOn1JRGfokQWK4QnPx82ptdCzb6GxgbL0Usq1DkM7x2nBienja3cP5ghenzN2EO 1uYqqwzik46SpeLV3NVPagQWXb2t8ebBDFjz/Yyke61zWA0wP7R5Tr/sL66Ct6BQCy4A REIj2X11BrgTeDUODki0412Q5at/lIhKbfI53cUld2jhFwn/KHcEMhYEiK3Gcz+NmwMW VnCbCeWE7ubRX1sPU9Pphf/a1vX3Mx/XRKlsqL850pLoUAfgKfMoaxbQS/SB3ETT2Dab kZw7w8KlRXimgOVhwwtDyqBvfWS8Ri3jFCNrilXutL4hWByWmsbVQT8NBknlNEk/Seb0 TEog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=EXoa0KMM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g6-20020a63ad06000000b00404395ad12asi4887228pgf.689.2022.06.22.00.51.27; Wed, 22 Jun 2022 00:51:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=EXoa0KMM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354053AbiFVHr1 (ORCPT + 99 others); Wed, 22 Jun 2022 03:47:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353834AbiFVHrQ (ORCPT ); Wed, 22 Jun 2022 03:47:16 -0400 Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7957837A1C for ; Wed, 22 Jun 2022 00:47:13 -0700 (PDT) Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25M5nidW032367; Wed, 22 Jun 2022 02:46:57 -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=RNYk4UBGUtNXwVtJjqkoxDLehd0DQef6Q3E9pMtrqrY=; b=EXoa0KMMlgw6zfYYJxEv1e12t+PCKDHso+qjtQ5uwHh3cEbiTMdTL4aKgrV36UlXPA+Y Z7rht0cWT4QzAA6v25FGcwPuDLP2E9HDf6DtWGKpMlVaOsjVHTy+bLPYQVI/HxnrZEi4 iW7rA2RVnAcDGhYXuUZjka2Zg86gir7WFYK51ep9/OxJdDfSCRX2yQr0HIEv2qRG+7F+ tklZkJAS2T2PnjpjRaZMYDgQlXUw9fHYOLujmT3GspKkmmk+3Eskx9Zb3HyEgWrg31SB 6tRzu38m4g3WjvvqRZ0DBqlrka/o32qeO/S7439YjTOXXMNBvCanXU2+8Hdbgy4LKN5P XA== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3gsc41cqh2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Wed, 22 Jun 2022 02:46:56 -0500 Received: from EDIEX01.ad.cirrus.com (198.61.84.80) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Wed, 22 Jun 2022 08:46:54 +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.1.2375.28 via Frontend Transport; Wed, 22 Jun 2022 08:46:54 +0100 Received: from vitaly-Legion-7-16ACHg6.ad.cirrus.com (unknown [198.90.238.175]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 880E6478; Wed, 22 Jun 2022 07:46:54 +0000 (UTC) From: Vitaly Rodionov To: Jaroslav Kysela , Takashi Iwai , Mark Brown CC: , , , Stefan Binding Subject: [PATCH v7 02/14] ALSA: hda: hda_cs_dsp_ctl: Add apis to write the controls directly Date: Wed, 22 Jun 2022 08:46:41 +0100 Message-ID: <20220622074653.179078-3-vitalyr@opensource.cirrus.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220622074653.179078-1-vitalyr@opensource.cirrus.com> References: <20220622074653.179078-1-vitalyr@opensource.cirrus.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: esAER2oeOn3cMVmogS318zXP7xBlXlL_ X-Proofpoint-ORIG-GUID: esAER2oeOn3cMVmogS318zXP7xBlXlL_ X-Proofpoint-Spam-Reason: safe X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stefan Binding DSP controls are exposed as ALSA controls, however, some of these controls are required to be accessed by the driver. Add apis which allow read/write of these controls. The write api will also notify the ALSA control on value change. Signed-off-by: Stefan Binding Signed-off-by: Vitaly Rodionov --- sound/pci/hda/hda_cs_dsp_ctl.c | 39 ++++++++++++++++++++++++++++++++++ sound/pci/hda/hda_cs_dsp_ctl.h | 4 ++++ 2 files changed, 43 insertions(+) diff --git a/sound/pci/hda/hda_cs_dsp_ctl.c b/sound/pci/hda/hda_cs_dsp_ctl.c index 0f4f02e0a538..91e37cb916dd 100644 --- a/sound/pci/hda/hda_cs_dsp_ctl.c +++ b/sound/pci/hda/hda_cs_dsp_ctl.c @@ -202,6 +202,45 @@ void hda_cs_dsp_control_remove(struct cs_dsp_coeff_ctl *cs_ctl) } EXPORT_SYMBOL_NS_GPL(hda_cs_dsp_control_remove, SND_HDA_CS_DSP_CONTROLS); +int hda_cs_dsp_write_ctl(struct cs_dsp *dsp, const char *name, int type, + unsigned int alg, const void *buf, size_t len) +{ + struct cs_dsp_coeff_ctl *cs_ctl; + struct hda_cs_dsp_coeff_ctl *ctl; + int ret; + + cs_ctl = cs_dsp_get_ctl(dsp, name, type, alg); + if (!cs_ctl) + return -EINVAL; + + ctl = cs_ctl->priv; + + ret = cs_dsp_coeff_write_ctrl(cs_ctl, 0, buf, len); + if (ret) + return ret; + + if (cs_ctl->flags & WMFW_CTL_FLAG_SYS) + return 0; + + snd_ctl_notify(ctl->card, SNDRV_CTL_EVENT_MASK_VALUE, &ctl->kctl->id); + + return 0; +} +EXPORT_SYMBOL_NS_GPL(hda_cs_dsp_write_ctl, SND_HDA_CS_DSP_CONTROLS); + +int hda_cs_dsp_read_ctl(struct cs_dsp *dsp, const char *name, int type, + unsigned int alg, void *buf, size_t len) +{ + struct cs_dsp_coeff_ctl *cs_ctl; + + cs_ctl = cs_dsp_get_ctl(dsp, name, type, alg); + if (!cs_ctl) + return -EINVAL; + + return cs_dsp_coeff_read_ctrl(cs_ctl, 0, buf, len); +} +EXPORT_SYMBOL_NS_GPL(hda_cs_dsp_read_ctl, SND_HDA_CS_DSP_CONTROLS); + MODULE_DESCRIPTION("CS_DSP ALSA Control HDA Library"); MODULE_AUTHOR("Stefan Binding, "); MODULE_LICENSE("GPL"); diff --git a/sound/pci/hda/hda_cs_dsp_ctl.h b/sound/pci/hda/hda_cs_dsp_ctl.h index 1c6d0fc9a2cc..c65bfd6878fd 100644 --- a/sound/pci/hda/hda_cs_dsp_ctl.h +++ b/sound/pci/hda/hda_cs_dsp_ctl.h @@ -29,5 +29,9 @@ struct hda_cs_dsp_ctl_info { int hda_cs_dsp_control_add(struct cs_dsp_coeff_ctl *cs_ctl, struct hda_cs_dsp_ctl_info *info); void hda_cs_dsp_control_remove(struct cs_dsp_coeff_ctl *cs_ctl); +int hda_cs_dsp_write_ctl(struct cs_dsp *dsp, const char *name, int type, + unsigned int alg, const void *buf, size_t len); +int hda_cs_dsp_read_ctl(struct cs_dsp *dsp, const char *name, int type, + unsigned int alg, void *buf, size_t len); #endif /*__HDA_CS_DSP_CTL_H__*/ -- 2.34.1