Received: by 10.192.165.148 with SMTP id m20csp5095870imm; Tue, 1 May 2018 09:00:39 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpHMlC+CvZF0hKEpRzN5Ej0MKYU2sGuQkm3LhyZmR5jrGatjOKmPgdktI/OpIwJDmdVS4gT X-Received: by 2002:a17:902:8b82:: with SMTP id ay2-v6mr13596215plb.295.1525190439921; Tue, 01 May 2018 09:00:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525190439; cv=none; d=google.com; s=arc-20160816; b=KwGj1QOstmLcLJe4CoSCZ9s0iXnfuBNyq2jLJ60WimA2WBXrFjnTxYMNy/zJYxXnAb XhOV0LMx4ouLYTktC3RiLxBvSv2H4B23hFv9vi+W6LTNHTozgMgFWpP2IifdI0dpYvij mwzcGdxavHOiPToFIMvXP62Y8K2EZNetntQAX23UfRM1xU2M6ReyYxFRdTrfalO5QjEo zuIPuZmtVTmPO6d1+/NBhRk2BtWrexlhruwJATXvQV0jyvh5csfd6scYYDhwuBHsmLME /PZ3d9Yn+zJyy0O3gGZ9RfV+2TyjA1+Gc1seRuvEoFXC4b0kBGYYfAiBsL/U/empooAu qLow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=69SwHG8yJPyGKJfp4OmRXmwYSU351BTNhrY7WHAIBbE=; b=N29BL7LFJyI7Ihnrv8h1FgaABOiJjhytQukjk6gKSdSS44yO5IQsVs1sBHXZVTWxxQ hcjeKa8tk2iOEzqtuDwxe+g6v959JdiTj08O/1SoxbMYWjn5TxTYfDj/xEHeNoOUyx0W +rFCOoCz6YSnw1TVjEH1X/V4MNHkZiaNjM9rwHLeM8nCT0RnjBipkrjMrGuco1iCHoXu 5ChCWDuONZGq1XozK20wNZZknnMa9sYLnRSR40DsHP0T7X8k7w9951BVXj/UnZRHMjDD RjN5a1Ks+YbFNLN4ZcGgK55O8syXNFUWWmx2glJsuBvrByxXbvewFfkIwj2I6Typd27G 6nPA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i3-v6si9632820pld.189.2018.05.01.09.00.24; Tue, 01 May 2018 09:00:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755877AbeEAQAB (ORCPT + 99 others); Tue, 1 May 2018 12:00:01 -0400 Received: from mga03.intel.com ([134.134.136.65]:29623 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753851AbeEAQAA (ORCPT ); Tue, 1 May 2018 12:00:00 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 May 2018 08:59:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,351,1520924400"; d="scan'208";a="224882550" Received: from linux.intel.com ([10.54.29.200]) by fmsmga006.fm.intel.com with ESMTP; 01 May 2018 08:59:59 -0700 Received: from asdoosa-mobl.amr.corp.intel.com (unknown [10.254.76.150]) by linux.intel.com (Postfix) with ESMTP id 2131D580319; Tue, 1 May 2018 08:59:58 -0700 (PDT) Subject: Re: [alsa-devel] [PATCH v2] ASoC: da7219: read fmw property to get mclk for non-dts systems To: "Agrawal, Akshu" Cc: "moderated list:SOUND" , Support Opensource , Liam Girdwood , open list , Takashi Iwai , djkurtz@chromium.org, Mark Brown , Alexander.Deucher@amd.com, Adam.Thomson.Opensource@diasemi.com References: <1525080203-18947-1-git-send-email-akshu.agrawal@amd.com> <43c7939d-e30b-27eb-59e4-c0e16248dad1@amd.com> From: Pierre-Louis Bossart Message-ID: Date: Tue, 1 May 2018 10:59:57 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <43c7939d-e30b-27eb-59e4-c0e16248dad1@amd.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >>> --- >>> 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); >>> >>