lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f72b3f60-7c9f-e89f-7907-61cc68ceebc6@linux.intel.com>
Date:   Tue, 1 May 2018 10:59:57 -0500
From:   Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
To:     "Agrawal, Akshu" <Akshu.Agrawal@....com>
Cc:     "moderated list:SOUND" <alsa-devel@...a-project.org>,
        Support Opensource <support.opensource@...semi.com>,
        Liam Girdwood <lgirdwood@...il.com>,
        open list <linux-kernel@...r.kernel.org>,
        Takashi Iwai <tiwai@...e.com>, djkurtz@...omium.org,
        Mark Brown <broonie@...nel.org>, Alexander.Deucher@....com,
        Adam.Thomson.Opensource@...semi.com
Subject: Re: [alsa-devel] [PATCH v2] ASoC: da7219: read fmw property to get
 mclk for non-dts systems

On 5/1/18 9:31 AM, Agrawal, Akshu wrote:
> 
> 
> On 4/30/2018 9:54 PM, Pierre-Louis Bossart wrote:
>> On 4/30/18 4:23 AM, Akshu Agrawal wrote:
>>> Non-dts based systems can use ACPI DSDT to pass on the mclk
>>> to da7219.
>>> This enables da7219 mclk to be linked to system clock.
>>> Enable/Disable of the mclk is already handled in the codec so
>>> platform drivers don't have to explicitly do handling of mclk.
>>>
>>> Signed-off-by: Akshu Agrawal <akshu.agrawal@....com>
>>> ---
>>> v2: Fixed kbuild error
>>>   include/sound/da7219.h    | 2 ++
>>>   sound/soc/codecs/da7219.c | 7 ++++++-
>>>   2 files changed, 8 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/include/sound/da7219.h b/include/sound/da7219.h
>>> index 1bfcb16..df7ddf4 100644
>>> --- a/include/sound/da7219.h
>>> +++ b/include/sound/da7219.h
>>> @@ -38,6 +38,8 @@ struct da7219_pdata {
>>>       const char *dai_clks_name;
>>> +    const char *mclk_name;
>>> +
>>>       /* Mic */
>>>       enum da7219_micbias_voltage micbias_lvl;
>>>       enum da7219_mic_amp_in_sel mic_amp_in_sel;
>>> diff --git a/sound/soc/codecs/da7219.c b/sound/soc/codecs/da7219.c
>>> index 980a6a8..aed68a4 100644
>>> --- a/sound/soc/codecs/da7219.c
>>> +++ b/sound/soc/codecs/da7219.c
>>> @@ -1624,6 +1624,8 @@ static struct da7219_pdata 
>>> *da7219_fw_to_pdata(struct snd_soc_component *compone
>>>           dev_warn(dev, "Using default clk name: %s\n",
>>>                pdata->dai_clks_name);
>>> +    device_property_read_string(dev, "dlg,mclk-name", 
>>> &pdata->mclk_name);
>>> +
>>>       if (device_property_read_u32(dev, "dlg,micbias-lvl", &of_val32) 
>>> >= 0)
>>>           pdata->micbias_lvl = da7219_fw_micbias_lvl(dev, of_val32);
>>>       else
>>> @@ -1905,7 +1907,10 @@ static int da7219_probe(struct 
>>> snd_soc_component *component)
>>>       da7219_handle_pdata(component);
>>>       /* Check if MCLK provided */
>>> -    da7219->mclk = devm_clk_get(component->dev, "mclk");
>>> +    if (da7219->pdata->mclk_name)
>>> +        da7219->mclk = clk_get(NULL, da7219->pdata->mclk_name);
>>> +    if (!da7219->mclk)
>>> +        da7219->mclk = devm_clk_get(component->dev, "mclk");
>>
>> this looks weird, why are you using different clk functions depending 
>> on the existence of a _DSD property? Why not just change the name and 
>> keep the same flow, e.g something like
>>
>> if(!da7219->pdata->mclk_name)
>>      da7219->pdata->mclk_name = "mclk";
>> da7219->mclk = devm_clk_get(component->dev, da7219->pdata->mclk_name);
>>
>>
> 
> We can't use devm_clk_get as the value of dev argument has to be NULL, 
> which can not be used with devm_clk_get.
> System clock which are linked to mclk are registered by a separate ACPI 
> device. And this exposing of DSD property is for all those platforms 
> which are non-dts based.

Alternatively you could modify clk_get to use device_property instead of 
of_property.

> 
>>>       if (IS_ERR(da7219->mclk)) {
>>>           if (PTR_ERR(da7219->mclk) != -ENOENT) {
>>>               ret = PTR_ERR(da7219->mclk);
>>>
>>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ