Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2524021rdh; Wed, 27 Sep 2023 05:28:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGhnkTp+G1zzyqQwBPQ1XWRsT7dNkjxRKXGQNfHuLV84DL1F3Yq2+bDtz6/0xREmBGgVvym X-Received: by 2002:a17:902:e752:b0:1c5:f5a9:4ad6 with SMTP id p18-20020a170902e75200b001c5f5a94ad6mr1739697plf.1.1695817727635; Wed, 27 Sep 2023 05:28:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695817727; cv=none; d=google.com; s=arc-20160816; b=JQVZLsZxK7LU6J7n7LCK6l1gElwPdYE7zrHSp0p/SdnG4ni65b5QEi3trcHCeR+Pmv WI477p2OgrbzyRciuVwF7ELeMLfIcZo/+yb8kvMC10Tf7wc4x8uc9JmWcxBztAND8jza 8k37P8jOiIm+W5I6VMFR21iLMOdjiJ3z5EXMVnTb6JxDzIMpDvn4xHZ6YAwbPezOxASF N/ONpiniJV6Ic5xb58zUWQK7w4gKCFEecek9ADZGTTv6MMuHt7I3+dqTkiZdHCiNQ0br IL83aS6ahK41Dl7Nyd6wcYZROLz67JN+tv+skwBHYsaqvVYQgfsMcgGqX6FM0F2vm9/0 +gcg== 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=CzOlluDFXWTfqajX9MNREUhcWGpvMbdlybKFX7wLtyo=; fh=Y//E187zNF82iGdBGoJUuh8LAIX4Sxh1PPKSKYv3Mgk=; b=d+pMPsUNTmKDbPO/+Eyog8pvwckkAvGba7Qpo6ndriEywFIJwT3p+iQzIuePnEvnLP 2aE/KiMJGxJZvoDXkmx+ZuWcubg0UlLZjYuWNDcWSdB8FABP01Ts1YddxOgPsyfUbqgx DpCXSrPRV80qW5IpB2zHacoUy9LT3z+ZSMJLPZ8pgkKJTb7UcFul0PELzFxqd4zlscCX aMQfJrWACr7Re5XbXCGaZWioAC68ZxH4pWNhg8vVtsxTxQpQP534Ze/0CR8xba7b5/kL ARFhzUD+Ajw9Zf3JFXOYxnJWcaAvuVOE3XlxOj1Xaair8JjjGFP/hE+TEMIp8l0Hurpi kQcQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id o1-20020a170902d4c100b001c61a231d33si8152270plg.292.2023.09.27.05.28.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 05:28:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (Postfix) with ESMTP id D60CF805F4B5; Wed, 27 Sep 2023 05:18:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231685AbjI0MR3 (ORCPT + 99 others); Wed, 27 Sep 2023 08:17:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231661AbjI0MR1 (ORCPT ); Wed, 27 Sep 2023 08:17:27 -0400 Received: from out28-148.mail.aliyun.com (out28-148.mail.aliyun.com [115.124.28.148]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A36D91AC; Wed, 27 Sep 2023 05:17:22 -0700 (PDT) X-Alimail-AntiSpam: AC=CONTINUE;BC=0.06714142|-1;CH=green;DM=|CONTINUE|false|;DS=CONTINUE|ham_system_inform|0.0119606-0.00394247-0.984097;FP=0|0|0|0|0|-1|-1|-1;HT=ay29a033018047201;MF=wangweidong.a@awinic.com;NM=1;PH=DS;RN=29;RT=29;SR=0;TI=SMTPD_---.Upkf3Tl_1695817030; Received: from ubuntu-VirtualBox..(mailfrom:wangweidong.a@awinic.com fp:SMTPD_---.Upkf3Tl_1695817030) by smtp.aliyun-inc.com; Wed, 27 Sep 2023 20:17:18 +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, shumingf@realtek.com, rf@opensource.cirrus.com, herve.codina@bootlin.com, arnd@arndb.de, 13916275206@139.com, ryans.lee@analog.com, linus.walleij@linaro.org, ckeepax@opensource.cirrus.com, doug@schmorgal.com, fido_max@inbox.ru, harshit.m.mogalapalli@oracle.com, liweilei@awinic.com, yang.lee@linux.alibaba.com, u.kleine-koenig@pengutronix.de, yijiangtao@awinic.com, dan.carpenter@linaro.org, colin.i.king@gmail.com, trix@redhat.com, alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V5 4/8] ASoC: codecs: Modify the transmission method of parameters Date: Wed, 27 Sep 2023 20:16:30 +0800 Message-ID: <20230927121634.94822-5-wangweidong.a@awinic.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230927121634.94822-1-wangweidong.a@awinic.com> References: <20230927121634.94822-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 pete.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 (pete.vger.email [0.0.0.0]); Wed, 27 Sep 2023 05:18:01 -0700 (PDT) From: Weidong Wang Change the transmission mode of the "aw88395_dev_get_prof_name" function parameter and change the name of the i2c driver, this is to be consistent with the "awinic,aw88395.yaml" file Signed-off-by: Weidong Wang --- sound/soc/codecs/aw88395/aw88395.c | 9 ++++----- sound/soc/codecs/aw88395/aw88395.h | 2 +- sound/soc/codecs/aw88395/aw88395_device.c | 12 ++++++++---- sound/soc/codecs/aw88395/aw88395_device.h | 2 +- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/sound/soc/codecs/aw88395/aw88395.c b/sound/soc/codecs/aw88395/aw88395.c index 9dcd75dd799a..77227c8f01f6 100644 --- a/sound/soc/codecs/aw88395/aw88395.c +++ b/sound/soc/codecs/aw88395/aw88395.c @@ -175,9 +175,8 @@ static int aw88395_profile_info(struct snd_kcontrol *kcontrol, { struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); struct aw88395 *aw88395 = snd_soc_component_get_drvdata(codec); - const char *prof_name; - char *name; - int count; + char *prof_name, *name; + int count, ret; uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; uinfo->count = 1; @@ -196,8 +195,8 @@ static int aw88395_profile_info(struct snd_kcontrol *kcontrol, name = uinfo->value.enumerated.name; count = uinfo->value.enumerated.item; - prof_name = aw88395_dev_get_prof_name(aw88395->aw_pa, count); - if (!prof_name) { + ret = aw88395_dev_get_prof_name(aw88395->aw_pa, count, &prof_name); + if (ret) { strscpy(uinfo->value.enumerated.name, "null", strlen("null") + 1); return 0; diff --git a/sound/soc/codecs/aw88395/aw88395.h b/sound/soc/codecs/aw88395/aw88395.h index 8036ba27f68d..c2a4f0cb8cd5 100644 --- a/sound/soc/codecs/aw88395/aw88395.h +++ b/sound/soc/codecs/aw88395/aw88395.h @@ -16,7 +16,7 @@ #define AW88395_DSP_16_DATA_MASK (0x0000ffff) -#define AW88395_I2C_NAME "aw88395_smartpa" +#define AW88395_I2C_NAME "aw88395" #define AW88395_RATES (SNDRV_PCM_RATE_8000_48000 | \ SNDRV_PCM_RATE_96000) diff --git a/sound/soc/codecs/aw88395/aw88395_device.c b/sound/soc/codecs/aw88395/aw88395_device.c index 5ca4172cb788..fd1f67d5f22f 100644 --- a/sound/soc/codecs/aw88395/aw88395_device.c +++ b/sound/soc/codecs/aw88395/aw88395_device.c @@ -1296,7 +1296,9 @@ int aw88395_dev_fw_update(struct aw_device *aw_dev, bool up_dsp_fw_en, bool forc return -EPERM; } - prof_name = aw88395_dev_get_prof_name(aw_dev, aw_dev->prof_index); + ret = aw88395_dev_get_prof_name(aw_dev, aw_dev->prof_index, &prof_name); + if (ret) + return ret; dev_dbg(aw_dev->dev, "start update %s", prof_name); @@ -1644,7 +1646,7 @@ int aw88395_dev_set_profile_index(struct aw_device *aw_dev, int index) } EXPORT_SYMBOL_GPL(aw88395_dev_set_profile_index); -char *aw88395_dev_get_prof_name(struct aw_device *aw_dev, int index) +int aw88395_dev_get_prof_name(struct aw_device *aw_dev, int index, char **prof_name) { struct aw_prof_info *prof_info = &aw_dev->prof_info; struct aw_prof_desc *prof_desc; @@ -1652,12 +1654,14 @@ char *aw88395_dev_get_prof_name(struct aw_device *aw_dev, int index) if ((index >= aw_dev->prof_info.count) || (index < 0)) { dev_err(aw_dev->dev, "index[%d] overflow count[%d]", index, aw_dev->prof_info.count); - return NULL; + return -EINVAL; } prof_desc = &aw_dev->prof_info.prof_desc[index]; - return prof_info->prof_name_list[prof_desc->id]; + *prof_name = prof_info->prof_name_list[prof_desc->id]; + + return 0; } EXPORT_SYMBOL_GPL(aw88395_dev_get_prof_name); diff --git a/sound/soc/codecs/aw88395/aw88395_device.h b/sound/soc/codecs/aw88395/aw88395_device.h index d32d16c89509..791c8c106557 100644 --- a/sound/soc/codecs/aw88395/aw88395_device.h +++ b/sound/soc/codecs/aw88395/aw88395_device.h @@ -181,7 +181,7 @@ int aw88395_dev_fw_update(struct aw_device *aw_dev, bool up_dsp_fw_en, bool forc void aw88395_dev_set_volume(struct aw_device *aw_dev, unsigned short set_vol); int aw88395_dev_get_prof_data(struct aw_device *aw_dev, int index, struct aw_prof_desc **prof_desc); -char *aw88395_dev_get_prof_name(struct aw_device *aw_dev, int index); +int aw88395_dev_get_prof_name(struct aw_device *aw_dev, int index, char **prof_name); int aw88395_dev_set_profile_index(struct aw_device *aw_dev, int index); int aw88395_dev_get_profile_index(struct aw_device *aw_dev); int aw88395_dev_get_profile_count(struct aw_device *aw_dev); -- 2.41.0