Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3152740rdh; Thu, 28 Sep 2023 04:27:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEua7nJGZ6QTcX8jj1Hi2CJOJuPTdG7O9QL30ejsWZN/DGvUe36XQwVoOJyJI6OpP/wYUBV X-Received: by 2002:a05:6870:c1cc:b0:1d6:97:bd7d with SMTP id i12-20020a056870c1cc00b001d60097bd7dmr959513oad.34.1695900479436; Thu, 28 Sep 2023 04:27:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695900479; cv=none; d=google.com; s=arc-20160816; b=vGNbJ2ViK/1B40BMkn26vgJI61dvd2jxtYToHZc+gzfCYdVCAHyXqWDGztgz93CxUd qmB94PiN/mAEKqKHEzXnl8bP3n1mzF4SVSWMtnaF5pQziRTUD02P6R09bpu4fFDIkTpa ZMLbmuT0BUxUYYuphIKtOj68S1tzh/Xje1YJjovaTMC/rLZIkud9qq0tBC2N2UcgOAKC Ow8Qg8xzf+ihyqh7xYupn+62eS2T0LuIjmuI9FRiVvOqZNqkiDp08GVEfFir0v63w0iA GGXqMawIeyy7JtaL2q3PGhPpMPfqCGZdGteJcQBcWFUhEtI3WemlYeabwdxZRWn8v++Y JzGQ== 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=gTcc6HrffB2i5odb+Apmi0fmMCkBY+21MJkZd6PoEUw=; fh=uAHJyyPUpn6IrkkiorP+jZGHnZM9HKgISwDYoF12jww=; b=v4oxf+MUIh83du8n7gYcXb54iFgKPylsJpIRYN0nUjJsKK8U9UbEdktZKrQILBSMF/ MO9qnSxHZduwC6LlNkuFaHryCIjvGDPnITI8dCMnl/7X2p6rLrMVaXojJdIFdmaUyz6k h/S09VY2w0ZPSKV89opHVrzN5vnaBIB9+oAArxm6t+J1uh+8KhZ/RhVYUg/EAaYXytHE 34jKs19brpzkXe1g3PZCB+7+DbMuDMNxYCnuIBSS7ieKkA04fekjfdkeRtRfmt7q1Ooi tGFFVCeZ247NRwFg9fiI3PmmSQJNWMFLAOUAAfIZ5LYXlj0pTW2k0oeMEvLf/bZSjmlT lPCw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id v1-20020a654601000000b00578b9d0c272si18152688pgq.770.2023.09.28.04.27.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 04:27:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (Postfix) with ESMTP id 944DE80A280F; Thu, 28 Sep 2023 03:59:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231819AbjI1K6w (ORCPT + 99 others); Thu, 28 Sep 2023 06:58:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231851AbjI1K6t (ORCPT ); Thu, 28 Sep 2023 06:58:49 -0400 Received: from out28-173.mail.aliyun.com (out28-173.mail.aliyun.com [115.124.28.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CDC51B4; Thu, 28 Sep 2023 03:58:42 -0700 (PDT) X-Alimail-AntiSpam: AC=CONTINUE;BC=0.06715943|-1;CH=green;DM=|CONTINUE|false|;DS=CONTINUE|ham_system_inform|0.0068788-0.000217375-0.992904;FP=9863284613152526578|1|1|20|0|-1|-1|-1;HT=ay29a033018047203;MF=wangweidong.a@awinic.com;NM=1;PH=DS;RN=30;RT=30;SR=0;TI=SMTPD_---.UqYH948_1695898710; Received: from ubuntu-VirtualBox..(mailfrom:wangweidong.a@awinic.com fp:SMTPD_---.UqYH948_1695898710) by smtp.aliyun-inc.com; Thu, 28 Sep 2023 18:58:38 +0800 From: wangweidong.a@awinic.com To: girdwood@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, shumingf@realtek.com, herve.codina@bootlin.com, rdunlap@infradead.org, 13916275206@139.com, ryans.lee@analog.com, linus.walleij@linaro.org, ckeepax@opensource.cirrus.com, doug@schmorgal.com, ajye_huang@compal.corp-partner.google.com, harshit.m.mogalapalli@oracle.com, arnd@arndb.de, yang.lee@linux.alibaba.com, u.kleine-koenig@pengutronix.de, liweilei@awinic.com, yijiangtao@awinic.com, trix@redhat.com, dan.carpenter@linaro.org, colin.i.king@gmail.com, alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V6 07/10] ASoC: codecs: Add code for bin parsing compatible with aw87390 Date: Thu, 28 Sep 2023 18:57:24 +0800 Message-ID: <20230928105727.47273-8-wangweidong.a@awinic.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230928105727.47273-1-wangweidong.a@awinic.com> References: <20230928105727.47273-1-wangweidong.a@awinic.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email 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 (groat.vger.email [0.0.0.0]); Thu, 28 Sep 2023 03:59:02 -0700 (PDT) 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 | 25 +++++++++++++++---------- sound/soc/codecs/aw88395/aw88395_reg.h | 1 + 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/sound/soc/codecs/aw88395/aw88395_lib.c b/sound/soc/codecs/aw88395/aw88395_lib.c index 87dd0ccade4c..a0a429ca9768 100644 --- a/sound/soc/codecs/aw88395/aw88395_lib.c +++ b/sound/soc/codecs/aw88395/aw88395_lib.c @@ -456,10 +456,12 @@ 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!"); - ret = -EINVAL; - 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 = @@ -581,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; @@ -623,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; @@ -703,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; @@ -801,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)) && @@ -841,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