Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4889721ybv; Wed, 26 Feb 2020 04:50:48 -0800 (PST) X-Google-Smtp-Source: APXvYqyHxzKOIU8DE2LflaKr53dZljhyuEX/rib8wyv0X4AxUHPX4JRNXB+rgMcLTooSREUNo7zz X-Received: by 2002:aca:458:: with SMTP id 85mr3059492oie.56.1582721448082; Wed, 26 Feb 2020 04:50:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582721448; cv=none; d=google.com; s=arc-20160816; b=Y+ri26l6WEwUQfiVmW+xi8IKuhBuxhEw8j5hbCVtBPhWkBp7fpw0my3v9dLmnxtnB5 hjqwzKpmAiLNfI5z/0wQOSV7H7V0U/fgZd9s8HeG6vBjcokyE2SIXgtaFtSrQ1A+DThc 6l+z46Ci3mTCrO32zSAaonESRGtb3lAUi2qBo/unUquMKH6Ms++AWyOEL5kDj7jaVi4U wtEkTZWEz8ntHoIIC0lRZRHVsCxrexb7q6Vma141fd6mEH3bmb+kx1s9gCjlco2Abvxj gGINArAb0y0a80FzTo4V/xhMhK83S5dTh/VZdGF/Son4c7DeLNKCYBuJA2v9RNZq1OjO Nezw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=qYQrOZJn5DkQX/MgteHrOqOgtCv5LvbVJDJqYH5KvWA=; b=K6xcEyZlLzuIzgmtIsEl7461GS/zU0MQIqBJYfa9eeVQUr8Kl5aBnL4y/nfM51TFar sICgQd1xSU+QJve9sEuue1YH9Nmbjkc/Ck4cjdzZ+gQSaapgRjFGuga5y0RnW2nkbsFm itX73ItLz68tniim8wYoHLycDcXuSUE/+lxM2mimcuabiS2MiDy33DdFJRfIpBKIOowi fbeT/4DgdgddPM6KHTXQS07YtqMPeU1uUDef3XvL3i1Wfk5MtHRjZfRhXSAjJzzH+/xR 1x6nROpxKxLd+PEm3GtG04PfJOSMzLajv3+beLvkJTFkTyPYGygtI9rKlD0ZEpqPl98I ++OA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=lnuYzxX5; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 65si1208334oif.14.2020.02.26.04.50.35; Wed, 26 Feb 2020 04:50:48 -0800 (PST) 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; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=lnuYzxX5; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726671AbgBZMta (ORCPT + 99 others); Wed, 26 Feb 2020 07:49:30 -0500 Received: from fllv0016.ext.ti.com ([198.47.19.142]:35416 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726452AbgBZMta (ORCPT ); Wed, 26 Feb 2020 07:49:30 -0500 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 01QCmZSG092302; Wed, 26 Feb 2020 06:48:35 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1582721315; bh=qYQrOZJn5DkQX/MgteHrOqOgtCv5LvbVJDJqYH5KvWA=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=lnuYzxX5dli5VPGe/9GbcvvVESpz8K/mX656tRgSJI7oWHR14eOmqJ62B3rymIWA3 QXz1tp+AicYaIK1lPI3dIEH2GVq5E/RZ2EWoWzTBmXtbw0F26C2IoDGrDzbgJ/Ac6A I71s7IlJSn1NML1WhPUgXPGzblldmwVzYqwvyAr0= Received: from DFLE109.ent.ti.com (dfle109.ent.ti.com [10.64.6.30]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 01QCmZjq006680 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 26 Feb 2020 06:48:35 -0600 Received: from DFLE114.ent.ti.com (10.64.6.35) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Wed, 26 Feb 2020 06:48:34 -0600 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3 via Frontend Transport; Wed, 26 Feb 2020 06:48:34 -0600 Received: from [10.250.65.13] (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 01QCmYN7040385; Wed, 26 Feb 2020 06:48:34 -0600 Subject: Re: [PATCH v3 2/2] ASoC: tlv320adcx140: Add the tlv320adcx140 codec driver family To: Ricard Wanderlof CC: "lgirdwood@gmail.com" , "broonie@kernel.org" , "perex@perex.cz" , "tiwai@suse.com" , "alsa-devel@alsa-project.org" , "linux-kernel@vger.kernel.org" References: <20200219125942.22013-1-dmurphy@ti.com> <20200219125942.22013-3-dmurphy@ti.com> From: Dan Murphy Message-ID: <62c9be55-7ca7-eeaa-52e6-2b93783769a1@ti.com> Date: Wed, 26 Feb 2020 06:43:21 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="iso-8859-15"; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Richard On 2/26/20 5:18 AM, Ricard Wanderlof wrote: > On Wed, 19 Feb 2020, Dan Murphy wrote: > >> Add the tlv320adcx140 codec driver family. >> > ... > >> + >> +static int adcx140_set_dai_fmt(struct snd_soc_dai *codec_dai, >> +????????????????????????????? unsigned int fmt) >> +{ >> +?????? struct snd_soc_component *component = codec_dai->component; >> +?????? struct adcx140_priv *adcx140 = >> snd_soc_component_get_drvdata(component); >> +?????? u8 iface_reg1 = 0; >> +?????? u8 iface_reg2 = 0; >> + >> +?????? /* set master/slave audio interface */ >> +?????? switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { >> +?????? case SND_SOC_DAIFMT_CBM_CFM: >> +?????????????? iface_reg2 |= ADCX140_BCLK_FSYNC_MASTER; > Although this sets up the codec to be I2S master, there doesn't seem to be > a way of actually configuring the master clock frequency in master mode, > as there is no .set_sysclk member in adcx140_dai_ops (and the > corresponding register field appears never to be touched by the driver). Thanks for the comments.? The driver was written for the device to be in slave mode with auto clock configuration set. I will look into adding the master mode clock settings. > >> +?????????????? break; >> +?????? case SND_SOC_DAIFMT_CBS_CFS: >> +?????????????? break; >> +?????? case SND_SOC_DAIFMT_CBS_CFM: >> +?????? case SND_SOC_DAIFMT_CBM_CFS: >> +?????? default: >> +?????????????? dev_err(component->dev, "Invalid DAI master/slave interface\n"); >> +?????????????? return -EINVAL; >> +?????? } > ... > >> + >> +static int adcx140_codec_probe(struct snd_soc_component *component) >> +{ >> +?????? struct adcx140_priv *adcx140 = >> snd_soc_component_get_drvdata(component); >> +?????? int sleep_cfg_val = ADCX140_WAKE_DEV; >> +?????? u8 bias_source; >> +?????? u8 vref_source; >> +?????? int ret; >> + >> +?????? ret = device_property_read_u8(adcx140->dev, "ti,mic-bias-source", >> +???????????????????????????????????? &bias_source); >> +?????? if (ret) >> +?????????????? bias_source = ADCX140_MIC_BIAS_VAL_VREF; >> + >> +?????? if (bias_source != ADCX140_MIC_BIAS_VAL_VREF && >> +?????????? bias_source != ADCX140_MIC_BIAS_VAL_VREF_1096 && >> +?????????? bias_source != ADCX140_MIC_BIAS_VAL_AVDD) { >> +?????????????? dev_err(adcx140->dev, "Mic Bias source value is invalid\n"); >> +?????????????? return -EINVAL; >> +?????? } >> + >> +?????? ret = device_property_read_u8(adcx140->dev, "ti,vref-source", >> +???????????????????????????????????? &vref_source); >> +?????? if (ret) >> +?????????????? vref_source = ADCX140_MIC_BIAS_VREF_275V; >> + >> +?????? if (vref_source != ADCX140_MIC_BIAS_VREF_275V && >> +?????????? vref_source != ADCX140_MIC_BIAS_VREF_25V && >> +?????????? vref_source != ADCX140_MIC_BIAS_VREF_1375V) { > According to the data sheet, this setting controls the ADC full scale > setting and has nothing to do with the mic bias voltage, hence using > MIC_BIAS as part of the macro name is misleaading. > These are not macros they are #defines but in any event I can change the names as they are all local to the c and h files. >> +?????????????? dev_err(adcx140->dev, "Mic Bias source value is invalid\n"); > Error text does not reflect the actual error, suggest "VREF value is > invalid". Ack Dan