Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp570934rdb; Tue, 19 Sep 2023 04:16:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF8WBM/+sk63E7Uyu2AOanT/kmooKtk4KwkSETd1y07dYbfUSqPeSs70LEh2v1dxQ0y8kKf X-Received: by 2002:a05:6a21:a585:b0:14c:ad99:22a9 with SMTP id gd5-20020a056a21a58500b0014cad9922a9mr13227862pzc.32.1695122173969; Tue, 19 Sep 2023 04:16:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695122173; cv=none; d=google.com; s=arc-20160816; b=wqilME6bDUO1aGVpr87rDQ4CaagfrV62NgOuebTV9IKnYZD7MIeDLPAXYOOCovkxEk bRPNMd/W6Cb/rMqSPN11hKzVTE8adLkAhCg/HREJ0jQ5OF8QJhKQQ7ZXy+q+FEOXEZfM e2O+YyBncy7VjNvEDfGfckXRl51sunXQIjkgLYMg9KQGhgyp8vi8YTrWw+53o9u7Itz7 iErF81OYNy1QxHPXZR/y+LOq+68OAHs7zzcuflyflE/ZCaojoAv7Ds0p/KYrviKp46Fp Vm3YxExssyUNUMZ9uQHVYC/Ixlq51s0G7akcqDDnl+prEoHDW2XwYDeOUnqor2anX1O1 sxFg== 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:to:from; bh=cSfB3abTzcq8B6SYjYmFNWP8P9uHVMmkE4YamVuZuC8=; fh=rioInmhNI0g92MWJzQJenTvoQfMaIAPqpLNlOWDlntk=; b=y3PJ6OeCHdHAaGvFbeVq/KPxFZfwmyXBt540td0s/563nSLBXOCDZK07GfGhKE/eCD ORvq2wICTBckx+8EuL1AmCpUcHZd56Yvgd049PACxEMeQKj4wCN4Aed9YfLPYqPRP0cA R4MpKFNF/drmTokRus94bVRh0p6VRkcWS9QBc7rUgMQ1TklMyMUFyDEc7S+0gzUYkaSI 8CiYYYmN98gYRoJGGi08K+jPsUKJHkuFiKKRtBotXfXbL3Z5PBjkfL3miSE+9BPwywtJ sEngIh7+YYa6imi8PUKLAerF8dZLBPPuBR7UUgOasV2wjoDcKhS2l8qHvS7fzaxzdZ/m PtSQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id h22-20020a056a00171600b0068a3a7f88f9si9565388pfc.128.2023.09.19.04.16.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 04:16:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 6F87A81BDDD4; Tue, 19 Sep 2023 04:06:12 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232170AbjISLGC (ORCPT + 99 others); Tue, 19 Sep 2023 07:06:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232163AbjISLFn (ORCPT ); Tue, 19 Sep 2023 07:05:43 -0400 Received: from out28-149.mail.aliyun.com (out28-149.mail.aliyun.com [115.124.28.149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36DB11B8; Tue, 19 Sep 2023 03:58:08 -0700 (PDT) X-Alimail-AntiSpam: AC=CONTINUE;BC=0.06718782|-1;CH=green;DM=|CONTINUE|false|;DS=CONTINUE|ham_system_inform|0.00716367-0.000217502-0.992619;FP=0|0|0|0|0|-1|-1|-1;HT=ay29a033018047213;MF=wangweidong.a@awinic.com;NM=1;PH=DS;RN=27;RT=27;SR=0;TI=SMTPD_---.Uj4ESB5_1695121077; Received: from ubuntu-VirtualBox..(mailfrom:wangweidong.a@awinic.com fp:SMTPD_---.Uj4ESB5_1695121077) by smtp.aliyun-inc.com; Tue, 19 Sep 2023 18:58:04 +0800 From: wangweidong.a@awinic.com To: lgirdwood@gmail.com, broonie@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, perex@perex.cz, tiwai@suse.com, wangweidong.a@awinic.com, rf@opensource.cirrus.com, herve.codina@bootlin.com, shumingf@realtek.com, ryans.lee@analog.com, 13916275206@139.com, linus.walleij@linaro.org, ckeepax@opensource.cirrus.com, povik+lin@cutebit.org, harshit.m.mogalapalli@oracle.com, arnd@arndb.de, yijiangtao@awinic.com, yang.lee@linux.alibaba.com, liweilei@awinic.com, u.kleine-koenig@pengutronix.de, colin.i.king@gmail.com, trix@redhat.com, alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V4 4/7] ASoC: codecs: Add code for bin parsing compatible with aw87390 Date: Tue, 19 Sep 2023 18:57:21 +0800 Message-ID: <20230919105724.105624-5-wangweidong.a@awinic.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230919105724.105624-1-wangweidong.a@awinic.com> References: <20230919105724.105624-1-wangweidong.a@awinic.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 19 Sep 2023 04:06:12 -0700 (PDT) From: Weidong Wang Add aw87390 compatible code to the aw88395_lib.c file so that it can parse aw87390's bin file Modify the function return value Signed-off-by: Weidong Wang --- sound/soc/codecs/aw88395/aw88395_lib.c | 25 ++++++++++++++++--------- sound/soc/codecs/aw88395/aw88395_reg.h | 1 + 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/sound/soc/codecs/aw88395/aw88395_lib.c b/sound/soc/codecs/aw88395/aw88395_lib.c index 8ee1baa03269..a0a429ca9768 100644 --- a/sound/soc/codecs/aw88395/aw88395_lib.c +++ b/sound/soc/codecs/aw88395/aw88395_lib.c @@ -452,12 +452,16 @@ static int aw_dev_parse_reg_bin_with_hdr(struct aw_device *aw_dev, if ((aw_bin->all_bin_parse_num != 1) || (aw_bin->header_info[0].bin_data_type != DATA_TYPE_REGISTER)) { dev_err(aw_dev->dev, "bin num or type error"); + ret = -EINVAL; goto parse_bin_failed; } - if (aw_bin->header_info[0].valid_data_len % 4) { - dev_err(aw_dev->dev, "bin data len get error!"); - goto parse_bin_failed; + if (aw_dev->chip_id == AW88261_CHIP_ID) { + if (aw_bin->header_info[0].valid_data_len % 4) { + dev_err(aw_dev->dev, "bin data len get error!"); + ret = -EINVAL; + goto parse_bin_failed; + } } prof_desc->sec_desc[AW88395_DATA_TYPE_REG].data = @@ -579,9 +583,9 @@ static int aw_dev_parse_dev_default_type(struct aw_device *aw_dev, } static int aw88261_dev_cfg_get_valid_prof(struct aw_device *aw_dev, - struct aw_all_prof_info all_prof_info) + struct aw_all_prof_info *all_prof_info) { - struct aw_prof_desc *prof_desc = all_prof_info.prof_desc; + struct aw_prof_desc *prof_desc = all_prof_info->prof_desc; struct aw_prof_info *prof_info = &aw_dev->prof_info; int num = 0; int i; @@ -621,9 +625,9 @@ static int aw88261_dev_cfg_get_valid_prof(struct aw_device *aw_dev, } static int aw88395_dev_cfg_get_valid_prof(struct aw_device *aw_dev, - struct aw_all_prof_info all_prof_info) + struct aw_all_prof_info *all_prof_info) { - struct aw_prof_desc *prof_desc = all_prof_info.prof_desc; + struct aw_prof_desc *prof_desc = all_prof_info->prof_desc; struct aw_prof_info *prof_info = &aw_dev->prof_info; struct aw_sec_data_desc *sec_desc; int num = 0; @@ -701,12 +705,13 @@ static int aw_dev_load_cfg_by_hdr(struct aw_device *aw_dev, switch (aw_dev->chip_id) { case AW88395_CHIP_ID: - ret = aw88395_dev_cfg_get_valid_prof(aw_dev, *all_prof_info); + ret = aw88395_dev_cfg_get_valid_prof(aw_dev, all_prof_info); if (ret < 0) goto exit; break; case AW88261_CHIP_ID: - ret = aw88261_dev_cfg_get_valid_prof(aw_dev, *all_prof_info); + case AW87390_CHIP_ID: + ret = aw88261_dev_cfg_get_valid_prof(aw_dev, all_prof_info); if (ret < 0) goto exit; break; @@ -799,6 +804,7 @@ static int aw_get_dev_scene_count_v1(struct aw_device *aw_dev, struct aw_contain ret = 0; break; case AW88261_CHIP_ID: + case AW87390_CHIP_ID: for (i = 0; i < cfg_hdr->ddt_num; ++i) { if (((cfg_dde[i].data_type == ACF_SEC_TYPE_REG) || (cfg_dde[i].data_type == ACF_SEC_TYPE_HDR_REG)) && @@ -839,6 +845,7 @@ static int aw_get_default_scene_count_v1(struct aw_device *aw_dev, ret = 0; break; case AW88261_CHIP_ID: + case AW87390_CHIP_ID: for (i = 0; i < cfg_hdr->ddt_num; ++i) { if (((cfg_dde[i].data_type == ACF_SEC_TYPE_REG) || (cfg_dde[i].data_type == ACF_SEC_TYPE_HDR_REG)) && diff --git a/sound/soc/codecs/aw88395/aw88395_reg.h b/sound/soc/codecs/aw88395/aw88395_reg.h index e7a7c02efaf3..d0a273387313 100644 --- a/sound/soc/codecs/aw88395/aw88395_reg.h +++ b/sound/soc/codecs/aw88395/aw88395_reg.h @@ -97,6 +97,7 @@ enum aw88395_id { AW88395_CHIP_ID = 0x2049, AW88261_CHIP_ID = 0x2113, + AW87390_CHIP_ID = 0x76, }; #define AW88395_REG_MAX (0x7D) -- 2.41.0