All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Cezary Rojewski <cezary.rojewski@intel.com>, alsa-devel@alsa-project.org
Cc: "Huajun Li" <huajun.li@intel.com>,
	tiwai@suse.de, "Péter Ujfalusi" <peter.ujfalusi@linux.intel.com>,
	"Nikolai Kostrigin" <nickel@altlinux.org>,
	broonie@kernel.org, "Mauro Carvalho Chehab" <mchehab@kernel.org>,
	"Bard Liao" <yung-chuan.liao@linux.intel.com>
Subject: Re: [PATCH 03/20] ASoC: SOF: Intel: hda: retrieve DMIC number for I2S boards
Date: Wed, 9 Mar 2022 11:10:16 -0600	[thread overview]
Message-ID: <d5228aa3-ea48-bc2b-6f62-d2ee81cbbb5f@linux.intel.com> (raw)
In-Reply-To: <6626d04b-1ad3-457f-1f45-296cb79672fb@intel.com>



On 3/9/22 10:49, Cezary Rojewski wrote:
> On 2022-03-08 8:25 PM, Pierre-Louis Bossart wrote:
>> We currently extract the DMIC number only for HDaudio or SoundWire
>> platforms. For I2S/TDM platforms, this wasn't necessary until now, but
>> with devices with ES8336 we need to find a solution to detect dmics
>> more reliably than with a DMI quirk.
> 
> ...
> 
>> @@ -644,24 +642,35 @@ static int hda_init(struct snd_sof_dev *sdev)
>>       return ret;
>>   }
>> -#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) || 
>> IS_ENABLED(CONFIG_SND_SOC_SOF_INTEL_SOUNDWIRE)
>> -
>> -static int check_nhlt_dmic(struct snd_sof_dev *sdev)
>> +static int check_dmic_num(struct snd_sof_dev *sdev)
>>   {
>>       struct nhlt_acpi_table *nhlt;
>> -    int dmic_num;
>> +    int dmic_num = 0;
> 
> 
> s/int/u32? (paired with question below)
> 
>>       nhlt = intel_nhlt_init(sdev->dev);
>>       if (nhlt) {
>>           dmic_num = intel_nhlt_get_dmic_geo(sdev->dev, nhlt);
>>           intel_nhlt_free(nhlt);
>> -        if (dmic_num >= 1 && dmic_num <= 4)
>> -            return dmic_num;
>>       }
>> -    return 0;
>> +    /* allow for module parameter override */
>> +    if (dmic_num_override != -1) {
>> +        dev_dbg(sdev->dev,
>> +            "overriding DMICs detected in NHLT tables %d by kernel 
>> param %d\n",
>> +            dmic_num, dmic_num_override);
>> +        dmic_num = dmic_num_override;
>> +    }
>> +
>> +    if (dmic_num < 0 || dmic_num > 4) {
> 
> How come dmic_num be negative?

static int dmic_num_override = -1;
module_param_named(dmic_num, dmic_num_override, int, 0444);
MODULE_PARM_DESC(dmic_num, "SOF HDA DMIC number");

The value is already negative by default, and we want to apply sanity 
checks on what the user or distributions sets.

This code has been in the kernel for several years now, we're just 
moving it around.

> 
>> +        dev_dbg(sdev->dev, "invalid dmic_number %d\n", dmic_num);
>> +        dmic_num = 0;
>> +    }
>> +
>> +    return dmic_num;
>>   }

  reply	other threads:[~2022-03-09 17:28 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-08 19:25 [PATCH 00/20] ALSA/ASoC/SOF/Intel: improve support for ES8336-based platforms Pierre-Louis Bossart
2022-03-08 19:25 ` [PATCH 01/20] ASoC: soc-acpi: fix kernel-doc descriptor Pierre-Louis Bossart
2022-03-08 19:25 ` [PATCH 02/20] ASoC: soc-acpi: add information on I2S/TDM link mask Pierre-Louis Bossart
2022-03-08 19:25 ` [PATCH 03/20] ASoC: SOF: Intel: hda: retrieve DMIC number for I2S boards Pierre-Louis Bossart
2022-03-09 16:49   ` Cezary Rojewski
2022-03-09 17:10     ` Pierre-Louis Bossart [this message]
2022-03-08 19:25 ` [PATCH 04/20] ALSA: intel-nhlt: add helper to detect SSP link mask Pierre-Louis Bossart
2022-03-09 10:03   ` Takashi Iwai
2022-03-09 17:01   ` Cezary Rojewski
2022-03-09 17:24     ` Pierre-Louis Bossart
2022-03-08 19:25 ` [PATCH 05/20] ASoC: SOF: Intel: hda: report SSP link mask to machine driver Pierre-Louis Bossart
2022-03-09 16:59   ` Cezary Rojewski
2022-03-09 17:16     ` Pierre-Louis Bossart
2022-03-08 19:25 ` [PATCH 06/20] ASoC: Intel: soc-acpi: quirk topology filename dynamically Pierre-Louis Bossart
2022-03-08 19:25 ` [PATCH 07/20] ALSA: intel-dsp-config: add more ACPI HIDs for ES83x6 devices Pierre-Louis Bossart
2022-03-09 10:04   ` Takashi Iwai
2022-03-08 19:25 ` [PATCH 08/20] ASoC: Intel: soc-acpi: " Pierre-Louis Bossart
2022-03-08 19:25 ` [PATCH 09/20] ALSA: intel-dspconfig: add ES8336 support for CNL Pierre-Louis Bossart
2022-03-09 10:04   ` Takashi Iwai
2022-03-08 19:26 ` [PATCH 10/20] ASoC: Intel: soc-acpi: add ESSX8336 support on Cannon Lake machines Pierre-Louis Bossart
2022-03-08 19:26 ` [PATCH 11/20] ASoC: Intel: sof_es8336: make gpio optional Pierre-Louis Bossart
2022-03-08 19:26 ` [PATCH 12/20] ASoC: Intel: sof_es8336: get codec device with ACPI instead of bus search Pierre-Louis Bossart
2022-03-08 19:26 ` [PATCH 13/20] ASoC: Intel: Revert "ASoC: Intel: sof_es8336: add quirk for Huawei D15 2021" Pierre-Louis Bossart
2022-03-08 19:26 ` [PATCH 14/20] ASoC: Intel: sof_es8336: use NHLT information to set dmic and SSP Pierre-Louis Bossart
2022-03-08 19:26 ` [PATCH 15/20] ASoC: Intel: sof_es8336: log all quirks Pierre-Louis Bossart
2022-03-08 19:26 ` [PATCH 16/20] ASoC: Intel: sof_es8336: move comment to the right place Pierre-Louis Bossart
2022-03-08 19:26 ` [PATCH 17/20] ASoC: Intel: sof_es8336: add support for JD inverted quirk Pierre-Louis Bossart
2022-03-08 19:26 ` [PATCH 18/20] ASoC: Intel: sof_es8336: extend machine driver to support ES8326 codec Pierre-Louis Bossart
2022-03-08 19:26 ` [PATCH 19/20] ASoC: Intel: sof_es8336: add cfg-dmics component for UCM support Pierre-Louis Bossart
2022-03-08 19:26 ` [PATCH 20/20] ASoC: Intel: bytcht_es8316: move comment to the right place Pierre-Louis Bossart
2022-03-10 11:35 ` [PATCH 00/20] ALSA/ASoC/SOF/Intel: improve support for ES8336-based platforms Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d5228aa3-ea48-bc2b-6f62-d2ee81cbbb5f@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=cezary.rojewski@intel.com \
    --cc=huajun.li@intel.com \
    --cc=mchehab@kernel.org \
    --cc=nickel@altlinux.org \
    --cc=peter.ujfalusi@linux.intel.com \
    --cc=tiwai@suse.de \
    --cc=yung-chuan.liao@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.