From patchwork Thu Jul 20 09:26:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brent Lu X-Patchwork-Id: 122948 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp2825079vqt; Wed, 19 Jul 2023 18:55:41 -0700 (PDT) X-Google-Smtp-Source: APBJJlGXG6KIBqtc2i7Lhskdd1QV8rYUToF0iQiYHj14h1ayZ487UrrBWK2RthD4CJMNlSw7zGBU X-Received: by 2002:a17:907:7290:b0:994:4e16:d430 with SMTP id dt16-20020a170907729000b009944e16d430mr4536455ejc.20.1689818141229; Wed, 19 Jul 2023 18:55:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689818141; cv=none; d=google.com; s=arc-20160816; b=X1T7AztGx8UXvDefy27SZBgInlMfTbeGPLJyr2ZJzYD8H+Dilk7MJum3iH2MWp26GW RH6Smqf0XHOVJSkLRG4ho+RyFjR9goubfRra386nKC7Pm70J/zDt0F/Z9joD5FnATtGp fXcTv3Vs96omASCFbQ2nxtpCbgycutWyxMGEgn0kbOAcQDHB1VKYyPb39ZWxFHUG9J/n eSVTFXmh8uNZzZiqy+INIKweH+GOlr4PKdtzARvN2OviEh/i8viX086S8W0rYUspujw7 K1BAIvOs7eo9STgRrovYR3r35vSdxvtVXrRq5cetaPAhzWEvXVdcBjJTSmfu97xRe6XK kjTA== 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=mNmqXel4J86eyZn78/Ha5C6EMny8caHbiQjP+Qbrwjo=; fh=d5kaFi490xhtCCJ3TerUmGkycRMyMY6ISVyskXPOS9g=; b=SJgMrcSUI3WxuWUwRMQTx5CNn661Yl52P8ooFIvpV6zr9LMOKj5ERm89yzeWewzGF5 HwbZCR+9YMBvftgtO0nGF++2REaFm2VZTlsv6ZUZJcWM3h20EqJ7hvfl9/F9SzuVJoEs tkzvugyF2bQiYex1E3eIy72xCqbPEDCen1DNdFYh6Bqsh73TGeX1UkUuq1gnBjchCTGZ NNXG3s5UKPZMW6bMtG3POtzz3Ml9H9AnE8nfYCJhq3GcaM74RG4h8SS01C/3IcYcVt2g 7r5itZ3hr9rsFG2K5uWGA1Ohw7IYHdq7P6iIPt33GREK0AycCqPY8dxX/CddgoWhrwJj zu4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BZx465XH; 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=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lc12-20020a170906f90c00b009886c3287e0si3784610ejb.536.2023.07.19.18.55.10; Wed, 19 Jul 2023 18:55:41 -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=@intel.com header.s=Intel header.b=BZx465XH; 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=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229835AbjGTBcs (ORCPT + 99 others); Wed, 19 Jul 2023 21:32:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229789AbjGTBcr (ORCPT ); Wed, 19 Jul 2023 21:32:47 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C3982106 for ; Wed, 19 Jul 2023 18:32:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689816765; x=1721352765; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jW1HloUIo7O6SDgsEvQybPl5isnE0/1NyJehhwwyQWs=; b=BZx465XHZSUDtiF/z3i1EF2VCPXvoVyU3XXivYn/GvnCMVMJrHaYSUiT BBiDNpStzz99N6Dgt1DmjN/s+jBwh0+AZNMLRsmEk+FgnbiRHjKVLAYWG 6FxUuwSYQeQ2c8u9mGnpLgtpOuA5YV31wzHnq03IaNJbcMp6BYBlcsZJN pCEB4bdkIPT4mkLFGDH6YCZfFbJrVTqEgYNONE0nfgWopvKV0mBCFI6I1 qi9zo7XFDa/+KCAKC4TWBcPWMuQWiyqIbl4PTg2bJiSeccvLTOq/qdUCE jYUO5sXDTBTr6b7Lsdn6JRysyTJi7mPArFpNZFzfcJNKr84Vho90T4KEB Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10776"; a="364067943" X-IronPort-AV: E=Sophos;i="6.01,216,1684825200"; d="scan'208";a="364067943" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jul 2023 18:32:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.01,202,1684825200"; d="scan'208";a="867681286" Received: from brentlu-desktop.itwn.intel.com ([10.5.252.92]) by fmsmga001.fm.intel.com with ESMTP; 19 Jul 2023 18:32:42 -0700 From: Brent Lu To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Pierre-Louis Bossart , Liam Girdwood , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Kai Vehmanen , Mark Brown , Jaroslav Kysela , Takashi Iwai , Brent Lu , linux-kernel@vger.kernel.org, Yong Zhi , Ajye Huang , Uday M Bhat , Terry Cheong , Mac Chiang , "Dharageswari . R" , Kuninori Morimoto Subject: [PATCH 1/2] ASoC: Intel: maxim-common: get codec number from ACPI Date: Thu, 20 Jul 2023 17:26:27 +0800 Message-Id: <20230720092628.758834-2-brent.lu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230720092628.758834-1-brent.lu@intel.com> References: <20230720092628.758834-1-brent.lu@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DATE_IN_FUTURE_06_12, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE,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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771902747437648253 X-GMAIL-MSGID: 1771902747437648253 Implement a helper function to get number of codecs from ACPI subsystem to remove the need of quirk flag in machine driver. Signed-off-by: Brent Lu --- sound/soc/intel/boards/sof_maxim_common.c | 174 +++++++++++++--------- sound/soc/intel/boards/sof_maxim_common.h | 21 ++- 2 files changed, 113 insertions(+), 82 deletions(-) diff --git a/sound/soc/intel/boards/sof_maxim_common.c b/sound/soc/intel/boards/sof_maxim_common.c index 112e89951da0..f8b44a81fec1 100644 --- a/sound/soc/intel/boards/sof_maxim_common.c +++ b/sound/soc/intel/boards/sof_maxim_common.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -11,6 +12,21 @@ #include #include "sof_maxim_common.h" +/* helper function to get the number of specific codec */ +static int get_num_codecs(const char *hid) +{ + struct acpi_device *adev = NULL; + int dev_num = 0; + + do { + adev = acpi_dev_get_next_match_dev(adev, hid, NULL, -1); + if (adev) + dev_num++; + } while (adev != NULL); + + return dev_num; +} + #define MAX_98373_PIN_NAME 16 const struct snd_soc_dapm_route max_98373_dapm_routes[] = { @@ -168,17 +184,6 @@ static struct snd_soc_codec_conf max_98390_codec_conf[] = { .dlc = COMP_CODEC_CONF(MAX_98390_DEV1_NAME), .name_prefix = "Left", }, -}; - -static struct snd_soc_codec_conf max_98390_4spk_codec_conf[] = { - { - .dlc = COMP_CODEC_CONF(MAX_98390_DEV0_NAME), - .name_prefix = "Right", - }, - { - .dlc = COMP_CODEC_CONF(MAX_98390_DEV1_NAME), - .name_prefix = "Left", - }, { .dlc = COMP_CODEC_CONF(MAX_98390_DEV2_NAME), .name_prefix = "Tweeter Right", @@ -189,19 +194,7 @@ static struct snd_soc_codec_conf max_98390_4spk_codec_conf[] = { }, }; -struct snd_soc_dai_link_component max_98390_components[] = { - { - .name = MAX_98390_DEV0_NAME, - .dai_name = MAX_98390_CODEC_DAI, - }, - { - .name = MAX_98390_DEV1_NAME, - .dai_name = MAX_98390_CODEC_DAI, - }, -}; -EXPORT_SYMBOL_NS(max_98390_components, SND_SOC_INTEL_SOF_MAXIM_COMMON); - -struct snd_soc_dai_link_component max_98390_4spk_components[] = { +static struct snd_soc_dai_link_component max_98390_components[] = { { .name = MAX_98390_DEV0_NAME, .dai_name = MAX_98390_CODEC_DAI, @@ -219,62 +212,56 @@ struct snd_soc_dai_link_component max_98390_4spk_components[] = { .dai_name = MAX_98390_CODEC_DAI, }, }; -EXPORT_SYMBOL_NS(max_98390_4spk_components, SND_SOC_INTEL_SOF_MAXIM_COMMON); + +static const struct { + unsigned int tx; + unsigned int rx; +} max_98390_tdm_mask[] = { + {.tx = 0x01, .rx = 0x3}, + {.tx = 0x02, .rx = 0x3}, + {.tx = 0x04, .rx = 0x3}, + {.tx = 0x08, .rx = 0x3}, +}; static int max_98390_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); struct snd_soc_dai *codec_dai; - int i; + int i, ret = 0; for_each_rtd_codec_dais(rtd, i, codec_dai) { - if (i >= ARRAY_SIZE(max_98390_4spk_components)) { + if (i >= ARRAY_SIZE(max_98390_tdm_mask)) { dev_err(codec_dai->dev, "invalid codec index %d\n", i); return -ENODEV; } - if (!strcmp(codec_dai->component->name, MAX_98390_DEV0_NAME)) { - /* DEV0 tdm slot configuration Right */ - snd_soc_dai_set_tdm_slot(codec_dai, 0x01, 3, 4, 32); - } - if (!strcmp(codec_dai->component->name, MAX_98390_DEV1_NAME)) { - /* DEV1 tdm slot configuration Left */ - snd_soc_dai_set_tdm_slot(codec_dai, 0x02, 3, 4, 32); - } - - if (!strcmp(codec_dai->component->name, MAX_98390_DEV2_NAME)) { - /* DEVi2 tdm slot configuration Tweeter Right */ - snd_soc_dai_set_tdm_slot(codec_dai, 0x04, 3, 4, 32); - } - if (!strcmp(codec_dai->component->name, MAX_98390_DEV3_NAME)) { - /* DEV3 tdm slot configuration Tweeter Left */ - snd_soc_dai_set_tdm_slot(codec_dai, 0x08, 3, 4, 32); + ret = snd_soc_dai_set_tdm_slot(codec_dai, max_98390_tdm_mask[i].tx, + max_98390_tdm_mask[i].rx, 4, + params_width(params)); + if (ret < 0) { + dev_err(codec_dai->dev, "fail to set tdm slot, ret %d\n", + ret); + return ret; } } return 0; } -int max_98390_spk_codec_init(struct snd_soc_pcm_runtime *rtd) +static int max_98390_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_card *card = rtd->card; + int num_codecs = get_num_codecs(MAX_98390_ACPI_HID); int ret; - /* add regular speakers dapm route */ - ret = snd_soc_dapm_add_routes(&card->dapm, max_98390_dapm_routes, - ARRAY_SIZE(max_98390_dapm_routes)); - if (ret) { - dev_err(rtd->dev, "unable to add Left/Right Speaker dapm, ret %d\n", ret); - return ret; - } - - /* add widgets/controls/dapm for tweeter speakers */ - if (acpi_dev_present("MX98390", "3", -1)) { + switch (num_codecs) { + case 4: + /* add widgets/controls/dapm for tweeter speakers */ ret = snd_soc_dapm_new_controls(&card->dapm, max_98390_tt_dapm_widgets, ARRAY_SIZE(max_98390_tt_dapm_widgets)); - if (ret) { - dev_err(rtd->dev, "unable to add tweeter dapm controls, ret %d\n", ret); + dev_err(rtd->dev, "unable to add tweeter dapm widgets, ret %d\n", + ret); /* Don't need to add routes if widget addition failed */ return ret; } @@ -282,33 +269,80 @@ int max_98390_spk_codec_init(struct snd_soc_pcm_runtime *rtd) ret = snd_soc_add_card_controls(card, max_98390_tt_kcontrols, ARRAY_SIZE(max_98390_tt_kcontrols)); if (ret) { - dev_err(rtd->dev, "unable to add tweeter card controls, ret %d\n", ret); + dev_err(rtd->dev, "unable to add tweeter controls, ret %d\n", + ret); return ret; } ret = snd_soc_dapm_add_routes(&card->dapm, max_98390_tt_dapm_routes, ARRAY_SIZE(max_98390_tt_dapm_routes)); - if (ret) - dev_err(rtd->dev, - "unable to add Tweeter Left/Right Speaker dapm, ret %d\n", ret); + if (ret) { + dev_err(rtd->dev, "unable to add tweeter dapm routes, ret %d\n", + ret); + return ret; + } + + fallthrough; + case 2: + /* add regular speakers dapm route */ + ret = snd_soc_dapm_add_routes(&card->dapm, max_98390_dapm_routes, + ARRAY_SIZE(max_98390_dapm_routes)); + if (ret) { + dev_err(rtd->dev, "unable to add dapm routes, ret %d\n", + ret); + return ret; + } + break; + default: + dev_err(rtd->dev, "invalid codec number %d\n", num_codecs); + ret = -EINVAL; + break; } + return ret; } -EXPORT_SYMBOL_NS(max_98390_spk_codec_init, SND_SOC_INTEL_SOF_MAXIM_COMMON); -const struct snd_soc_ops max_98390_ops = { +static const struct snd_soc_ops max_98390_ops = { .hw_params = max_98390_hw_params, }; -EXPORT_SYMBOL_NS(max_98390_ops, SND_SOC_INTEL_SOF_MAXIM_COMMON); -void max_98390_set_codec_conf(struct snd_soc_card *card, int ch) +void max_98390_dai_link(struct snd_soc_dai_link *link) +{ + int num_codecs = get_num_codecs(MAX_98390_ACPI_HID); + + link->codecs = max_98390_components; + + switch (num_codecs) { + case 2: + case 4: + link->num_codecs = num_codecs; + break; + default: + pr_err("invalid codec number %d for %s\n", num_codecs, + MAX_98390_ACPI_HID); + break; + } + + link->init = max_98390_init; + link->ops = &max_98390_ops; +} +EXPORT_SYMBOL_NS(max_98390_dai_link, SND_SOC_INTEL_SOF_MAXIM_COMMON); + +void max_98390_set_codec_conf(struct snd_soc_card *card) { - if (ch == ARRAY_SIZE(max_98390_4spk_codec_conf)) { - card->codec_conf = max_98390_4spk_codec_conf; - card->num_configs = ARRAY_SIZE(max_98390_4spk_codec_conf); - } else { - card->codec_conf = max_98390_codec_conf; - card->num_configs = ARRAY_SIZE(max_98390_codec_conf); + int num_codecs = get_num_codecs(MAX_98390_ACPI_HID); + + card->codec_conf = max_98390_codec_conf; + + switch (num_codecs) { + case 2: + case 4: + card->num_configs = num_codecs; + break; + default: + pr_err("invalid codec number %d for %s\n", num_codecs, + MAX_98390_ACPI_HID); + break; } } EXPORT_SYMBOL_NS(max_98390_set_codec_conf, SND_SOC_INTEL_SOF_MAXIM_COMMON); diff --git a/sound/soc/intel/boards/sof_maxim_common.h b/sound/soc/intel/boards/sof_maxim_common.h index 7a8c53049e4d..a3676d68cc12 100644 --- a/sound/soc/intel/boards/sof_maxim_common.h +++ b/sound/soc/intel/boards/sof_maxim_common.h @@ -27,18 +27,15 @@ int max_98373_trigger(struct snd_pcm_substream *substream, int cmd); /* * Maxim MAX98390 */ -#define MAX_98390_CODEC_DAI "max98390-aif1" -#define MAX_98390_DEV0_NAME "i2c-MX98390:00" -#define MAX_98390_DEV1_NAME "i2c-MX98390:01" -#define MAX_98390_DEV2_NAME "i2c-MX98390:02" -#define MAX_98390_DEV3_NAME "i2c-MX98390:03" - -extern struct snd_soc_dai_link_component max_98390_components[2]; -extern struct snd_soc_dai_link_component max_98390_4spk_components[4]; -extern const struct snd_soc_ops max_98390_ops; - -void max_98390_set_codec_conf(struct snd_soc_card *card, int ch); -int max_98390_spk_codec_init(struct snd_soc_pcm_runtime *rtd); +#define MAX_98390_ACPI_HID "MX98390" +#define MAX_98390_CODEC_DAI "max98390-aif1" +#define MAX_98390_DEV0_NAME "i2c-MX98390:00" +#define MAX_98390_DEV1_NAME "i2c-MX98390:01" +#define MAX_98390_DEV2_NAME "i2c-MX98390:02" +#define MAX_98390_DEV3_NAME "i2c-MX98390:03" + +void max_98390_dai_link(struct snd_soc_dai_link *link); +void max_98390_set_codec_conf(struct snd_soc_card *card); /* * Maxim MAX98357A/MAX98360A From patchwork Thu Jul 20 09:26:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brent Lu X-Patchwork-Id: 122950 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp2829928vqt; Wed, 19 Jul 2023 19:07:59 -0700 (PDT) X-Google-Smtp-Source: APBJJlFzk37COtRQtz1gEUunPDvWjihfNajBfGj6psgf7+ASXhy0a2O4EnGrcgS1PG7Ce7A7lefr X-Received: by 2002:a17:906:76d5:b0:992:a618:c3c4 with SMTP id q21-20020a17090676d500b00992a618c3c4mr4419045ejn.66.1689818879638; Wed, 19 Jul 2023 19:07:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689818879; cv=none; d=google.com; s=arc-20160816; b=bLbrkXJbszL4T0/5PVcmya0qn1tT1HafjWqj20ISp2IkudDvDa2MrjRiPeVgAGtJCj tBtVHm+8mHSKMBuzkQ90j+1n9FB+dS96Lv+nYmcHQGYWgepUNo5Z7b5t1dtDD5cGrF4P +tihusC5gu6Eeh0wXRY8TEV+/+zkZ0M0nyTDH3iEF22LxrdlhL6i6iXp0dzNzYrBu65A C8aY5Utc+ylLMTo8I8yCElptk7fplR2Myw18Slq3TbsWbf+37K3dWil9ZEq6NgQrSjRf +EHVhclDKxXiYEESEHG/71v4s3umkKlnFyVoUXKSZSIYyzHazVSvsF55zJNKv26m1P8S GVYA== 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=kF2iX/bSBTpreQwLz3uE+KaLQ5pa1Xxt/mwXS67wkBk=; fh=d5kaFi490xhtCCJ3TerUmGkycRMyMY6ISVyskXPOS9g=; b=X2YXhQg6IC/1DLUvcRY/jgqJ9fRqAaa4MCDp5Ep5lh4kJW5pI/tB5q7syMLGdX0sD/ cLc6tUv7pn/LFbk5XLUqo4tWfcjikIOXi29R4dgifeyW6kO93kGc6OW1oUvlAUaQEXEc B6Ma14WJeQub1B7RHbo7kie4yZHmrmh9ILiy0Xcq4APt+riCrfY/+W/ODuvpgjmjTc2M Mgweh/v8LrTG9h4ZhbTXufT5KaEQ+lsB+1ICJS+q817TyxnHNOank72RcsgLEbJCn8Mz XrpTl16Ck0U0TsRW+WL/ruM7HtZRze9FuJ0v+sH9qwQKelAAQWIa6wNVYBWgMuTX91Bw F4FA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=P3lJJemm; 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=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u11-20020a1709060b0b00b0098d373fa9d9si3876830ejg.149.2023.07.19.19.07.35; Wed, 19 Jul 2023 19:07:59 -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=@intel.com header.s=Intel header.b=P3lJJemm; 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=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229884AbjGTBdD (ORCPT + 99 others); Wed, 19 Jul 2023 21:33:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229890AbjGTBcv (ORCPT ); Wed, 19 Jul 2023 21:32:51 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B96FB2123 for ; Wed, 19 Jul 2023 18:32:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689816769; x=1721352769; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zeA33BKa8/o/DKqLCyRftnCpl8+VLyzMwsQTIM5tBwo=; b=P3lJJemmyFlZbzIuSR9r4szClslk0QEp8mMeB5Y/kvLw4DrGIQ+nIfJa YTSHr9C5ahW5FXl6xM9Y009DG53lo2D56LwfvA4hp/wJoZ+zu1ZEtoihs H1cTXx4uXXE2hWq3eePuDntrXF1YIEn5m5y/67wmjRIebUhD7QkyXr/lq AKg2BqIB6TGI3wiFHQzFBmyqe1EeLtadStHHI00eB3AX4cDcPLpMoidKS RoJ+KTerW4jNI7NE7jQd4AEWJgrzc/hr2baHT7G0l4XhvAi/vwdbPMx8b s32Ojrxa0xQU6nS46rBJalXgGRIMUUMPaJpIGOzRqAEm0u0ymwbX7f3je g==; X-IronPort-AV: E=McAfee;i="6600,9927,10776"; a="364067964" X-IronPort-AV: E=Sophos;i="6.01,216,1684825200"; d="scan'208";a="364067964" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jul 2023 18:32:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.01,202,1684825200"; d="scan'208";a="867681304" Received: from brentlu-desktop.itwn.intel.com ([10.5.252.92]) by fmsmga001.fm.intel.com with ESMTP; 19 Jul 2023 18:32:46 -0700 From: Brent Lu To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Pierre-Louis Bossart , Liam Girdwood , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Kai Vehmanen , Mark Brown , Jaroslav Kysela , Takashi Iwai , Brent Lu , linux-kernel@vger.kernel.org, Yong Zhi , Ajye Huang , Uday M Bhat , Terry Cheong , Mac Chiang , "Dharageswari . R" , Kuninori Morimoto Subject: [PATCH 2/2] ASoC: Intel: sof_rt5682: remove SOF_MAX98390_TWEETER_SPEAKER_PRESENT flag Date: Thu, 20 Jul 2023 17:26:28 +0800 Message-Id: <20230720092628.758834-3-brent.lu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230720092628.758834-1-brent.lu@intel.com> References: <20230720092628.758834-1-brent.lu@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DATE_IN_FUTURE_06_12, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE,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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771903521544035476 X-GMAIL-MSGID: 1771903521544035476 Remove the SOF_MAX98390_TWEETER_SPEAKER_PRESENT flag from driver since the number of amplifiers could be queried from ACPI by counting the device instance. Signed-off-by: Brent Lu --- sound/soc/intel/boards/sof_rt5682.c | 37 ++--------------------------- 1 file changed, 2 insertions(+), 35 deletions(-) diff --git a/sound/soc/intel/boards/sof_rt5682.c b/sound/soc/intel/boards/sof_rt5682.c index b4f07bdcf8b4..9116f4df4752 100644 --- a/sound/soc/intel/boards/sof_rt5682.c +++ b/sound/soc/intel/boards/sof_rt5682.c @@ -59,7 +59,6 @@ #define SOF_SSP_BT_OFFLOAD_PRESENT BIT(22) #define SOF_RT5682S_HEADPHONE_CODEC_PRESENT BIT(23) #define SOF_MAX98390_SPEAKER_AMP_PRESENT BIT(24) -#define SOF_MAX98390_TWEETER_SPEAKER_PRESENT BIT(25) #define SOF_RT1019_SPEAKER_AMP_PRESENT BIT(26) #define SOF_RT5650_HEADPHONE_CODEC_PRESENT BIT(27) @@ -195,23 +194,6 @@ static const struct dmi_system_id sof_rt5682_quirk_table[] = { SOF_RT5682_SSP_AMP(2) | SOF_RT5682_NUM_HDMIDEV(4)), }, - { - .callback = sof_rt5682_quirk_cb, - .matches = { - DMI_MATCH(DMI_PRODUCT_FAMILY, "Google_Brya"), - DMI_MATCH(DMI_OEM_STRING, "AUDIO-MAX98390_ALC5682I_I2S_4SPK"), - }, - .driver_data = (void *)(SOF_RT5682_MCLK_EN | - SOF_RT5682_SSP_CODEC(0) | - SOF_SPEAKER_AMP_PRESENT | - SOF_MAX98390_SPEAKER_AMP_PRESENT | - SOF_MAX98390_TWEETER_SPEAKER_PRESENT | - SOF_RT5682_SSP_AMP(1) | - SOF_RT5682_NUM_HDMIDEV(4) | - SOF_BT_OFFLOAD_SSP(2) | - SOF_SSP_BT_OFFLOAD_PRESENT), - - }, { .callback = sof_rt5682_quirk_cb, .matches = { @@ -850,17 +832,7 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev, sof_rt1011_dai_link(&links[id]); } else if (sof_rt5682_quirk & SOF_MAX98390_SPEAKER_AMP_PRESENT) { - if (sof_rt5682_quirk & - SOF_MAX98390_TWEETER_SPEAKER_PRESENT) { - links[id].codecs = max_98390_4spk_components; - links[id].num_codecs = ARRAY_SIZE(max_98390_4spk_components); - } else { - links[id].codecs = max_98390_components; - links[id].num_codecs = ARRAY_SIZE(max_98390_components); - } - links[id].init = max_98390_spk_codec_init; - links[id].ops = &max_98390_ops; - + max_98390_dai_link(&links[id]); } else if (sof_rt5682_quirk & SOF_RT5650_HEADPHONE_CODEC_PRESENT) { links[id].codecs = &rt5650_components[1]; links[id].num_codecs = 1; @@ -1019,12 +991,7 @@ static int sof_audio_probe(struct platform_device *pdev) else if (sof_rt5682_quirk & SOF_RT1015P_SPEAKER_AMP_PRESENT) sof_rt1015p_codec_conf(&sof_audio_card_rt5682); else if (sof_rt5682_quirk & SOF_MAX98390_SPEAKER_AMP_PRESENT) { - if (sof_rt5682_quirk & SOF_MAX98390_TWEETER_SPEAKER_PRESENT) - max_98390_set_codec_conf(&sof_audio_card_rt5682, - ARRAY_SIZE(max_98390_4spk_components)); - else - max_98390_set_codec_conf(&sof_audio_card_rt5682, - ARRAY_SIZE(max_98390_components)); + max_98390_set_codec_conf(&sof_audio_card_rt5682); } if (sof_rt5682_quirk & SOF_SSP_BT_OFFLOAD_PRESENT)