Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2758601pxb; Tue, 24 Aug 2021 07:01:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8s/uMYvm6LOke310jsRsuly7B7SuQpZc2Zqhfesa968UV2eBjtZkLhT1F7NHQYe6xNpAd X-Received: by 2002:a05:6602:2001:: with SMTP id y1mr24714244iod.97.1629813671408; Tue, 24 Aug 2021 07:01:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629813671; cv=none; d=google.com; s=arc-20160816; b=ho4XRVlfbcS6TMZUWDA+S+llC3IvlN/amwTpHAisjxwmwMJ0GAjySSGJUdbl4LbBNh mlOOLcJbQW5bEshC0XQMIalSHIJs4m/Qxz33qBCVZyXgYndwQ9pI6Pb5Z6kKWUsOvlT7 BWY7w3VMSxIQlXzTsZBUhzrWoR+gi9F0F2BK9tNNiF4JPhTTmu6odbXta/JzkYLGGR/V 0NiL4rbDZJqQmCbkhref9DYtVhDPW5RDlqMAKHcaXqZRxl3xvQI2neSD5JYd6OtAqCLY 2Xhi5NuHo7WlbckNt7Ank7gG52FuuDeM+NxGCxuiap5O+Xp2lDvrBu0qvSwFaiH9mlPf aTeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=qIrwo/B1zz4ofX30P0y4v2AOMtJgoN1UtaX8rv8cVjk=; b=zap0hudJ3mpJWPu8n/DzxH04qLA5ySY0h/hwtvkHcuD5NFCT5SvzA5gyj1Y9mFFmtd fuRtgHEg4vPpiQ5vTjj61sK6+196ZuI/vzE8Wky9JaXaYzwXTzGVLWx4XNlioZJc/9dv eZk8gxk0Pf7UpuEyt22Ej11+pfsrqw3IQvysz7gtSBXKEnNHANhyKpclnhPWGlMF4DNy rH0HXatS29UOVG5OVHc4CC9iVeshwAMEENvsmSh7pqcuVAlRG+7IhxC6OxUZkoaVx5kW 1Q+S2h1Ln5RvXcgB4QV7zsQUvyAcrdIeYYz1F1Ck/UDmQ9OCUeL+l3lpubdrwkIrlt0t LPVg== 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 y59si18682890jah.22.2021.08.24.07.00.58; Tue, 24 Aug 2021 07:01:11 -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 S237545AbhHXOAj (ORCPT + 99 others); Tue, 24 Aug 2021 10:00:39 -0400 Received: from mga06.intel.com ([134.134.136.31]:64109 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237503AbhHXOAh (ORCPT ); Tue, 24 Aug 2021 10:00:37 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10085"; a="278326142" X-IronPort-AV: E=Sophos;i="5.84,347,1620716400"; d="scan'208";a="278326142" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Aug 2021 06:59:53 -0700 X-IronPort-AV: E=Sophos;i="5.84,347,1620716400"; d="scan'208";a="535814629" Received: from crojewsk-mobl1.ger.corp.intel.com (HELO [10.213.4.79]) ([10.213.4.79]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Aug 2021 06:59:48 -0700 Subject: Re: [PATCH] [v2] ASoC: Intel: sof_rt5682: Add support for max98390 speaker amp To: Mark Hsieh , alsa-devel@alsa-project.org Cc: kai.vehmanen@linux.intel.com, pierre-louis.bossart@linux.intel.com, mac.chiang@intel.com, lance.hou@intel.com, broonie@kernel.org, brent.lu@intel.com, bard.liao@intel.com, liam.r.girdwood@linux.intel.com, yang.jie@linux.intel.com, perex@perex.cz, linux-kernel@vger.kernel.org, mark_hsieh@wistron.com References: <20210824132109.1392-1-mark_hsieh@wistron.corp-partner.google.com> From: Cezary Rojewski Message-ID: Date: Tue, 24 Aug 2021 15:59:44 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <20210824132109.1392-1-mark_hsieh@wistron.corp-partner.google.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-08-24 3:21 PM, Mark Hsieh wrote: > Configure adl_max98390_rt5682 to support the rt5682 headset codec and max98390 speaker > Unsure if line-length for commit messages has been extended to 100 as it was the case for code parts but this line certainly exceeds default. > BUG=b:191811888 > TEST=emerge-brya chromeos-kernel-5_10 > Are these two tags meaningful for upstream kernel? > Signed-off-by: Mark Hsieh > --- > sound/soc/intel/boards/Kconfig | 1 + > sound/soc/intel/boards/sof_maxim_common.c | 59 +++++++++++++++++++ > sound/soc/intel/boards/sof_maxim_common.h | 12 ++++ > sound/soc/intel/boards/sof_rt5682.c | 20 ++++++- > .../intel/common/soc-acpi-intel-adl-match.c | 13 ++++ > 5 files changed, 104 insertions(+), 1 deletion(-) > ... > +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 j; We usually start from 'i' when it comes to choosing iteration-variable names. > + > + for_each_rtd_codec_dais(rtd, j, codec_dai) { > + if (!strcmp(codec_dai->component->name, MAX_98390_DEV0_NAME)) { > + /* DEV0 tdm slot configuration */ > + snd_soc_dai_set_tdm_slot(codec_dai, 0x03, 3, 2, 16); > + } Suggesting to move comment one line up as you ideally want to explain the reasoning behind if-statement, not the actual execution statement. Once that is done, both parenthesis can be dropped. > + if (!strcmp(codec_dai->component->name, MAX_98390_DEV1_NAME)) { > + /* DEV1 tdm slot configuration */ > + snd_soc_dai_set_tdm_slot(codec_dai, 0x0C, 3, 2, 16); > + } Same applies here. > + } > + return 0; > +} > + ... > diff --git a/sound/soc/intel/boards/sof_rt5682.c b/sound/soc/intel/boards/sof_rt5682.c > index 39217223d50c..dc4966056b7d 100644 > --- a/sound/soc/intel/boards/sof_rt5682.c > +++ b/sound/soc/intel/boards/sof_rt5682.c > @@ -49,6 +49,7 @@ > #define SOF_RT1015P_SPEAKER_AMP_PRESENT BIT(16) > #define SOF_MAX98373_SPEAKER_AMP_PRESENT BIT(17) > #define SOF_MAX98360A_SPEAKER_AMP_PRESENT BIT(18) > +#define SOF_MAX98390_SPEAKER_AMP_PRESENT BIT(23) > > /* BT audio offload: reserve 3 bits for future */ > #define SOF_BT_OFFLOAD_SSP_SHIFT 19 > @@ -781,6 +782,13 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev, > } else if (sof_rt5682_quirk & > SOF_RT1011_SPEAKER_AMP_PRESENT) { > sof_rt1011_dai_link(&links[id]); > + } else if (sof_rt5682_quirk & > + SOF_MAX98390_SPEAKER_AMP_PRESENT) { Pretty sure this two lines could be combined - does not exceed 100character limit. > + links[id].codecs = max_98390_components; > + links[id].num_codecs = ARRAY_SIZE(max_98390_components); > + links[id].init = max_98373_spk_codec_init; > + links[id].ops = &max_98390_ops; > + links[id].dpcm_capture = 1; > } else { > max_98357a_dai_link(&links[id]); > } > @@ -917,7 +925,8 @@ static int sof_audio_probe(struct platform_device *pdev) > sof_rt1011_codec_conf(&sof_audio_card_rt5682); > 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) > + max_98390_set_codec_conf(&sof_audio_card_rt5682); > if (sof_rt5682_quirk & SOF_SSP_BT_OFFLOAD_PRESENT) > sof_audio_card_rt5682.num_links++; Please keep the newline between these two conditional blocks. A new if-statement usually translates to new thought and it is good to separate those. > > @@ -1043,6 +1052,15 @@ static const struct platform_device_id board_ids[] = { > SOF_RT5682_SSP_AMP(2) | > SOF_RT5682_NUM_HDMIDEV(4)), > }, > + { > + .name = "adl_max98390_rt5682", > + .driver_data = (kernel_ulong_t)(SOF_RT5682_MCLK_EN | > + SOF_RT5682_SSP_CODEC(0) | > + SOF_SPEAKER_AMP_PRESENT | > + SOF_MAX98390_SPEAKER_AMP_PRESENT | > + SOF_RT5682_SSP_AMP(2) | > + SOF_RT5682_NUM_HDMIDEV(4)), > + }, This indentation seems off. Though it seems the same applies for the rest of the array.. > { } > }; > MODULE_DEVICE_TABLE(platform, board_ids); > diff --git a/sound/soc/intel/common/soc-acpi-intel-adl-match.c b/sound/soc/intel/common/soc-acpi-intel-adl-match.c > index a0f6a69c7038..2db152998e4a 100644 > --- a/sound/soc/intel/common/soc-acpi-intel-adl-match.c > +++ b/sound/soc/intel/common/soc-acpi-intel-adl-match.c > @@ -280,6 +280,11 @@ static const struct snd_soc_acpi_codecs adl_max98357a_amp = { > .codecs = {"MX98357A"} > }; > > +static const struct snd_soc_acpi_codecs adl_max98390_amp = { > + .num_codecs = 1, > + .codecs = {"MX98390"} For 'forward compatibility' with possible changes to struct snd_soc_acpi_codecs, I'd advise appending comma at the end of the line. > +}; > + Regards, Czarek