Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp4230094iog; Tue, 21 Jun 2022 15:07:19 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t1N8rdrfyQImESa1Fkd+xNLV4uMXNc/xV9rHuES7GteACixB9rZNSPoQZLgXJeonMfSHsW X-Received: by 2002:a50:fc90:0:b0:435:6b30:f1b0 with SMTP id f16-20020a50fc90000000b004356b30f1b0mr265270edq.423.1655849239308; Tue, 21 Jun 2022 15:07:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655849239; cv=none; d=google.com; s=arc-20160816; b=WZEx1sCJiMgtdwZY9zBiW6FdUIckzYA3uD0MN7iU7yLRgi9Z/XVx5yGNqgKmTlAen3 nPtORyBuw9Sh6Q4y1GBnyzNPoDHqPYq6NePJ7/rSEs0bGUI/WZntPIc7+4apMd2ksrzt YRIt0Vk6hvnaBe/WrHPYietv0oRpP/Z1XueS13KED/lrp5zdcfHFroybtSYVmynfppRz UEx+HxykFYHfy3IkM4nf2e1f+HKD+DKKS4XVrXom6uUAK50cTWYCRfBS6TwPW3kx3fhO 42MpsMPXD3YU1gBvAi4yYwq5Mz3A/EkNllpG0En9H+AZ0W9svp/ZYxfnDbmyOL5+qMx4 6LmQ== 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=5NaYsp197WwOa77L6tURoFvuG4bhEpOmL/Xq11lqC5Y=; b=UcTA5KnFN70uEytu0LNPscy32NAl8sdP0fw9HPA6nU8HEfTlPFNCIjNDhXWK9yEve/ oEZrA2Iiqr0CQokQFot5IBJQftr4EoE1tIhSnEVgLETLQsMFVhM+AWi05qmCOoR7aUUn ZW+JHgRIFUXV7eQxUq9hCFgLJcGpz0nPddMazqSnKgzqX5SzvAe87/XZDFQoE038EhLA 2i2wk83ef4DtBRLljYeD1g5Xth+hDYdEyx7Yo04v1hwh/n5u7qnm3VUPSDiO6kZ0eMcR Cam9mSS7eGCK+edOH7vRBVtGvEmn8hK4kr5CV9EprR7EicmAHXhlJxylu4hgcuUuBPQq vc8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=Hqb8B0Nl; 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 nc4-20020a1709071c0400b00718c1dc9100si21072754ejc.786.2022.06.21.15.06.53; Tue, 21 Jun 2022 15:07:19 -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=Hqb8B0Nl; 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 S1353965AbiFUVi6 (ORCPT + 99 others); Tue, 21 Jun 2022 17:38:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355293AbiFUVi1 (ORCPT ); Tue, 21 Jun 2022 17:38:27 -0400 Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADA1A11A0A for ; Tue, 21 Jun 2022 14:38:26 -0700 (PDT) Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25LBDkxS018841; Tue, 21 Jun 2022 16:38:04 -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=5NaYsp197WwOa77L6tURoFvuG4bhEpOmL/Xq11lqC5Y=; b=Hqb8B0Nl7hHlscNuZdQT/1xENBSdco6hCgWYS5sP0pX56ybOK2n6agMf4dQfSi4nzNu+ 0IgnC3sBtcSk0z/bp/THfItHWNJmKlgsy9sCkjBhbAcZy4R46Dcx6FoCtzkhhX/SJagV lpI9qNkUtY81hjYV0wWKuqv9fodhOyHA5rin2Qzq8oGcJUUrV+XlH01NAAXQ6vTrWgth KplPOoEPKoxuTzhLl3n/i2dKBW4WgTFKVOXDM0WaMVyjlZfYMxwI9gVYxciuAl4hBOww Hksr89Wi728FrF3/mJPlAN7nx2ayEJTIOs6F2u3Kpce+RbW0ycYT7XCXGul8JMqxK1mA KA== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0b-001ae601.pphosted.com (PPS) with ESMTPS id 3gsb4p45ae-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Tue, 21 Jun 2022 16:38:04 -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; Tue, 21 Jun 2022 22:38:02 +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; Tue, 21 Jun 2022 22:38:02 +0100 Received: from vitaly-Legion-7-16ACHg6.ad.cirrus.com (unknown [198.90.238.175]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 5D01411D1; Tue, 21 Jun 2022 21:38:02 +0000 (UTC) From: Vitaly Rodionov To: Jaroslav Kysela , Takashi Iwai , Mark Brown CC: , , , Stefan Binding Subject: [PATCH v6 02/14] ALSA: hda: hda_cs_dsp_ctl: Add apis to write the controls directly Date: Tue, 21 Jun 2022 22:37:49 +0100 Message-ID: <20220621213801.2021097-3-vitalyr@opensource.cirrus.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220621213801.2021097-1-vitalyr@opensource.cirrus.com> References: <20220621213801.2021097-1-vitalyr@opensource.cirrus.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: 3AYs8vXyo5MWepcyTsOz-xUbfElfuHhL X-Proofpoint-ORIG-GUID: 3AYs8vXyo5MWepcyTsOz-xUbfElfuHhL 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 864299f98c69..6131fcfe21e5 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