Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2231513pxj; Sat, 5 Jun 2021 18:06:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxlvS4ybIMN4kWuP7+Ftf6315lFl/8nSBMlk+yAbc4sXR2/Dv11nkrl9Gcgua6cXAIV5Kw4 X-Received: by 2002:a05:6402:1590:: with SMTP id c16mr12822278edv.7.1622941592502; Sat, 05 Jun 2021 18:06:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622941592; cv=none; d=google.com; s=arc-20160816; b=UgsgSuWAYrUYiGgSaTfl8Fnc5aeYW70A0KRSyHyyVzAIIBqAsSaXIl+ITYX21G3VW6 N66V2qav9wlxnbjVabgKFTkvXKjT2VK7NWC90MqZj/sMwocxUcjwPApNbWJP9sAcPizd Rl9/you6YklE7C87e5XerhTlJI1vzeC0f2m5GAw0EpCiTwv5Ns7otJAQs4qyte+AqqC/ XT3rG6XfspTPBk59LCz8BI9QL2+BH55M47fnJrulwZTf8zZVAK5TtUpIgV1haeHoaWOX COe0zUT5X9gdWa3NSDDg67QUcq7OVPJtJ8SMW2u9dsjkvsxUWxXY5fZYQ4qvmagLL0Dl b9Dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:ironport-sdr:ironport-sdr; bh=JoM9qAGTktgnuTZ7+WLCvN0JZDnsM6+5peZKKHh18vs=; b=fDnHJOZqCofmABOjaHyZMSXNlhLfONsEyBb1q/9cZEodVBzffgbKsXnQCU620zr+Cw aro4IK3ZXSoJd51eiUCmmfC6c9TihzX6rzeiMt7kZF80VN3asTAbgmcTD1+TzMYLECx5 BsG1oWMzJkCCH/0s2EAMn8mnEoyRu8myog6zFe7WPSFGODcJd1tyMWnOSMh7UJoczKpQ CFHz1YsrH5PapBmKCCHY2lEPERY6kazfVQ6HYi3gYkzqeiGwYgoIfMRNAzbTYydHmGEx 7fBS9bGe9YWCt18dIMXRN9UsL77tpEBAvhkrrJCUf/9zmGqiLZQiYeFbmBnnouiHNMpG 2epg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e19si8670498ejb.113.2021.06.05.18.06.10; Sat, 05 Jun 2021 18:06:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230212AbhFFBDQ (ORCPT + 99 others); Sat, 5 Jun 2021 21:03:16 -0400 Received: from mga02.intel.com ([134.134.136.20]:36539 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230025AbhFFBDQ (ORCPT ); Sat, 5 Jun 2021 21:03:16 -0400 IronPort-SDR: HC4km0np955Igp3pCazvq7Qm7NE524qbck1MPQkChiVLACLvQQsSAg6T8LZw+nEOx3LjFCZvmk qOguxhT/tFsA== X-IronPort-AV: E=McAfee;i="6200,9189,10006"; a="191581122" X-IronPort-AV: E=Sophos;i="5.83,252,1616482800"; d="scan'208";a="191581122" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2021 18:01:27 -0700 IronPort-SDR: qCxbjzj00kvKamMklQ45s+KiN4Rps4R1WK9Exhuo/fMfLZ620izV+ASq4ynv9HqIFsyav+xrZD tA7fg5vqgztg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,252,1616482800"; d="scan'208";a="412724649" Received: from brentlu-desk0.itwn.intel.com ([10.5.253.32]) by fmsmga007.fm.intel.com with ESMTP; 05 Jun 2021 18:01:23 -0700 From: Brent Lu To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Pierre-Louis Bossart , Liam Girdwood , Jie Yang , Mark Brown , Jaroslav Kysela , Takashi Iwai , Brent Lu , Rander Wang , Guennadi Liakhovetski , linux-kernel@vger.kernel.org, Ranjani Sridharan , Kai Vehmanen , Dharageswari R , Sathyanarayana Nujella , Bard Liao , Kuninori Morimoto , Naveen Manohar , Yong Zhi , Vamshi Krishna Gopal , Fred Oh , Tzung-Bi Shih Subject: [PATCH 2/4] ASoC: Intel: maxim-common: support max98360a Date: Sun, 6 Jun 2021 08:41:00 +0800 Message-Id: <20210606004102.26190-3-brent.lu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210606004102.26190-1-brent.lu@intel.com> References: <20210606004102.26190-1-brent.lu@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Move max98360a code to this common module so it could be shared between multiple SOF machine drivers. MAX98357A and MAX98360A are sharing same codec driver so here we also share some function and structures. Signed-off-by: Brent Lu --- sound/soc/intel/boards/sof_maxim_common.c | 17 ++++++++++++++++- sound/soc/intel/boards/sof_maxim_common.h | 4 +++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/sound/soc/intel/boards/sof_maxim_common.c b/sound/soc/intel/boards/sof_maxim_common.c index e9c52f8b6428..e66dfe666915 100644 --- a/sound/soc/intel/boards/sof_maxim_common.c +++ b/sound/soc/intel/boards/sof_maxim_common.c @@ -134,7 +134,7 @@ void max_98373_set_codec_conf(struct snd_soc_card *card) EXPORT_SYMBOL_NS(max_98373_set_codec_conf, SND_SOC_INTEL_SOF_MAXIM_COMMON); /* - * Maxim MAX98357A + * Maxim MAX98357A/MAX98360A */ static const struct snd_kcontrol_new max_98357a_kcontrols[] = { SOC_DAPM_PIN_SWITCH("Spk"), @@ -156,6 +156,13 @@ static struct snd_soc_dai_link_component max_98357a_components[] = { } }; +static struct snd_soc_dai_link_component max_98360a_components[] = { + { + .name = MAX_98360A_DEV0_NAME, + .dai_name = MAX_98357A_CODEC_DAI, + } +}; + static int max_98357a_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_card *card = rtd->card; @@ -193,5 +200,13 @@ void max_98357a_dai_link(struct snd_soc_dai_link *link) } EXPORT_SYMBOL_NS(max_98357a_dai_link, SND_SOC_INTEL_SOF_MAXIM_COMMON); +void max_98360a_dai_link(struct snd_soc_dai_link *link) +{ + link->codecs = max_98360a_components; + link->num_codecs = ARRAY_SIZE(max_98360a_components); + link->init = max_98357a_init; +} +EXPORT_SYMBOL_NS(max_98360a_dai_link, SND_SOC_INTEL_SOF_MAXIM_COMMON); + MODULE_DESCRIPTION("ASoC Intel SOF Maxim helpers"); MODULE_LICENSE("GPL"); diff --git a/sound/soc/intel/boards/sof_maxim_common.h b/sound/soc/intel/boards/sof_maxim_common.h index 2674f1e373ef..3ff5e8fec4de 100644 --- a/sound/soc/intel/boards/sof_maxim_common.h +++ b/sound/soc/intel/boards/sof_maxim_common.h @@ -25,11 +25,13 @@ void max_98373_set_codec_conf(struct snd_soc_card *card); int max_98373_trigger(struct snd_pcm_substream *substream, int cmd); /* - * Maxim MAX98357A + * Maxim MAX98357A/MAX98360A */ #define MAX_98357A_CODEC_DAI "HiFi" #define MAX_98357A_DEV0_NAME "MX98357A:00" +#define MAX_98360A_DEV0_NAME "MX98360A:00" void max_98357a_dai_link(struct snd_soc_dai_link *link); +void max_98360a_dai_link(struct snd_soc_dai_link *link); #endif /* __SOF_MAXIM_COMMON_H */ -- 2.17.1