Received: by 2002:a05:7412:f584:b0:e2:908c:2ebd with SMTP id eh4csp1927536rdb; Tue, 5 Sep 2023 09:03:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHP+v2orJ7v4R0tOXcxi4Ek1lIAkB5dMtogBtUeN4T9iwqVLsKKZlFskH9VSJGA9RMLMfq8 X-Received: by 2002:a17:906:101a:b0:9a5:a44a:86f3 with SMTP id 26-20020a170906101a00b009a5a44a86f3mr224462ejm.25.1693929811010; Tue, 05 Sep 2023 09:03:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693929810; cv=none; d=google.com; s=arc-20160816; b=ofaVeArLiTQQA0qFl9CGaLm8uFafVD1khcwEYKsHxcoT1+aYb5DRLuBY2SAqZlN04E ccJnoTagjW8MUNHZet9YIceDgJewumRAnwnjM5IHksOLheCqKZk8PL91dMj+uxcpJ7aN yalt551AUPXXLTwm0DjxOWNDOasSIplApQFz18MGw5JBE17qXTTPUySyyOtAFk05iDx9 xeNa29whxPlFyuNjzBOwlB2IMNuU6xMefsCPt3HYvWWDfVVl/y74UTkwPNIIqrbDvCkq CNve20zvbOZZBvfeWJrsw3zFbHCzfIhhdn2SwYL2ghM5HZQXVE7P+cX86VwzoS3c6prj xKXA== 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; bh=dmWDkfUmj4qJkHHWnX/ykGlV4dURZEHqHQf0Zecn9sQ=; fh=fxtmxr3CENBh0aSSNvL1D8rQWmxjQ9KtxVQ23y+1J1c=; b=zBca21V5EXTS2aNq1Y4Qu4bwQ2nxWOVMbrvRO6BuGOtZCSgQ8+1HzahO8dAHwTN2rA 1/SOsXMhK763eUxAKfYqq9rnBksE9+pQdXCZp7xBkbkS/3mVU6j9OnB2zHiNX8zUJCXH VIYEoXXn6LDA7DYFRqyLHn0++ndhvmIoif0Xwi0DfylCx59dR5NPDhubwUzbsMamRIJ1 0lU0/EBtQUtp2uAXLLUB9iyZbyl8FTWhrt2XWp2658/3cvrMX3nvYniKi3emfKBD9RJW i1dn2lObdpmYqwnELDJXfKZArRyoHpRRX+0QwOmDusv81Wx2d+rDai2s85hwv37+P90C SYYg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qp25-20020a170907207900b0099df733c29dsi7691624ejb.285.2023.09.05.09.03.24; Tue, 05 Sep 2023 09:03:30 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235166AbjIDLqz (ORCPT + 19 others); Mon, 4 Sep 2023 07:46:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343693AbjIDLqy (ORCPT ); Mon, 4 Sep 2023 07:46:54 -0400 Received: from out28-124.mail.aliyun.com (out28-124.mail.aliyun.com [115.124.28.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBD5BE6; Mon, 4 Sep 2023 04:46:49 -0700 (PDT) X-Alimail-AntiSpam: AC=CONTINUE;BC=0.06717187|-1;CH=green;DM=|CONTINUE|false|;DS=CONTINUE|ham_system_inform|0.00695684-0.000218789-0.992824;FP=0|0|0|0|0|-1|-1|-1;HT=ay29a033018047198;MF=wangweidong.a@awinic.com;NM=1;PH=DS;RN=24;RT=24;SR=0;TI=SMTPD_---.UXIjstE_1693827998; Received: from ubuntu-VirtualBox..(mailfrom:wangweidong.a@awinic.com fp:SMTPD_---.UXIjstE_1693827998) by smtp.aliyun-inc.com; Mon, 04 Sep 2023 19:46:46 +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, rf@opensource.cirrus.com, wangweidong.a@awinic.com, herve.codina@bootlin.com, shumingf@realtek.com, rdunlap@infradead.org, 13916275206@139.com, ryans.lee@analog.com, linus.walleij@linaro.org, ckeepax@opensource.cirrus.com, yijiangtao@awinic.com, liweilei@awinic.com, colin.i.king@gmail.com, trix@redhat.com, alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: zhangjianming@awinic.com Subject: [PATCH V1 2/3] ASoC: codecs: Add code for bin parsing compatible with aw87390 Date: Mon, 4 Sep 2023 19:46:20 +0800 Message-ID: <20230904114621.4457-3-wangweidong.a@awinic.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230904114621.4457-1-wangweidong.a@awinic.com> References: <20230904114621.4457-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 From: Weidong Wang Add aw87390 compatible code to the aw88395_lib.c file so that it can parse aw87390's bin file. Signed-off-by: Weidong Wang --- sound/soc/codecs/aw88395/aw88395_lib.c | 23 ++++++++++++++--------- sound/soc/codecs/aw88395/aw88395_reg.h | 1 + 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/sound/soc/codecs/aw88395/aw88395_lib.c b/sound/soc/codecs/aw88395/aw88395_lib.c index 8ee1baa03269..9d561ae27feb 100644 --- a/sound/soc/codecs/aw88395/aw88395_lib.c +++ b/sound/soc/codecs/aw88395/aw88395_lib.c @@ -455,9 +455,11 @@ static int aw_dev_parse_reg_bin_with_hdr(struct aw_device *aw_dev, 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!"); + goto parse_bin_failed; + } } prof_desc->sec_desc[AW88395_DATA_TYPE_REG].data = @@ -579,9 +581,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 +623,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 +703,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 +802,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 +843,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