Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4799244ybv; Wed, 26 Feb 2020 03:19:09 -0800 (PST) X-Google-Smtp-Source: APXvYqxgRbjyK4YNNsxMJZi1fcy0984mG6ttAFaedj0WJjVBZ611wRaDwC67NhDqSbwqNC1uPGjU X-Received: by 2002:aca:190a:: with SMTP id l10mr2794119oii.56.1582715949763; Wed, 26 Feb 2020 03:19:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582715949; cv=none; d=google.com; s=arc-20160816; b=sPkuhxpGfa0mInJDEPCPwxNK0L+FixGBrDEc7eYDThqT8MoT1AzjebRZ8Pbfypy75F VeVjoBo0jJmsL3kVbCoaboqqIDyiz6tH1pgnniGYN5Tqecbn6eR3wDVWaySAX4kfIUhO 9Rtt6oB+XhMh+5XJLJ7QdIMlaotyROqx2pD3nwRHAIKm57Kz6anBJsyzvcJuEBOQz9uZ V+rkSfi4iIMqIIzKZzHBPBUAD0hbIs/d5Wc941hzAQ/4ZXKd0Gnki12vRv3m52JCZJ76 TpcrRGdW+ROd9Hz6rHYbrLlNJjwpdf8njBJex81BwOIuGHaLbuF5mzGriWZn63UuncUv hIEA== 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:mime-version :user-agent:references:message-id:in-reply-to:subject:cc:to:from :date:ironport-sdr:dkim-signature; bh=Hv403MB3fJ/nudFxpKI8mhxgcwJ2vMWrIa/zuMIGGwQ=; b=rgt1DrtfMcuRIUzE0VA61jzQ0fiX4qGBiY/5YPFGl8lAcE5nZobb6QX6fn/yZ3dhMs gWvZcqEoTucJJLlBwHS/ajxXBtH7+sAHSmDngx57PjFut69p3yFov/NkDc//v1Ed8Xwo GfbmAf9gzXOwMKZrEjjcFbAageDBQJtYCoTx4TMw4b5XMB/v3e5n+pGQzX6O2IQyKQnJ Y8kZMfaAd/dYyL9TI0LL6ZQl6UaIa6rt5GAXZ1S+cFpHjYYzMxM05BL/1J3lv+Je1SIk qtIxBX0BE/cfZ8xgXWp5VLSEP/qvP1Cm7QZFT0rebvOvg59sp6PrU22A0qFpJZJMd7k6 +C5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@axis.com header.s=axis-central1 header.b=ZLSvvco2; 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=NONE sp=NONE dis=NONE) header.from=axis.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b25si976717otp.212.2020.02.26.03.18.57; Wed, 26 Feb 2020 03:19:09 -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 (test mode) header.i=@axis.com header.s=axis-central1 header.b=ZLSvvco2; 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=NONE sp=NONE dis=NONE) header.from=axis.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728122AbgBZLSh (ORCPT + 99 others); Wed, 26 Feb 2020 06:18:37 -0500 Received: from smtp2.axis.com ([195.60.68.18]:31005 "EHLO smtp2.axis.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726555AbgBZLSh (ORCPT ); Wed, 26 Feb 2020 06:18:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; l=3583; q=dns/txt; s=axis-central1; t=1582715916; x=1614251916; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version:content-transfer-encoding; bh=Hv403MB3fJ/nudFxpKI8mhxgcwJ2vMWrIa/zuMIGGwQ=; b=ZLSvvco2ULTf10kshrs5pdnLQy39p4REh9rG7WPUIU/iUNhpbHjPD9fm ofelPUeVlkr2pgIZILF6ZywcgZM/4RPbNTZi1p+7VXdKkysu53198CmZW HZCNumb3F/uFzH35w2Fii8TSF2Mbs+6gAk7hdPHPUVUkxYPWkO0jAsu6N +QO7SqEHyd1Ju09+oMO/lb6eD6g+18Q8CMCEx1lVL/zYL6ps6xPo97VG+ w6DURvauBdBoWA6ahRBfYAKi8ktsPS36H757IilDf7TIQMU8ibB0FDX42 Oa8o0yDtNDgo2ZTjRUoSAoTfmYM8+yMMMoRx/f1ZXTIIQzkl3m8Dw4M42 A==; IronPort-SDR: xNdLtj/Y/Zx3jbKBFF2d3A3R47JOypJ8M83BBv6Q9VLihj3+LMJOEhD/UN9Cj1efQMcpEgvUde DuhCA4VfSOoVk4G3yy/SMaEI0kWPvHaSasS+yaCt30UJFACCWfCcYlqscgK1VfTGbnQsyCFqME XXmqEqad0PyAqXjmQvzucku77Z7FqdkE3nP404btD1qxtt53E/Mco/Gm+pcCx0CyYxIbtU8xvQ IEPUVo8hQY9cRlJvBFi5m9PCaTC8lGnnFMH5QSecqwpukYq8G/MJ85gSEr6MRI3GvjtIjU99zD xEg= X-IronPort-AV: E=Sophos;i="5.70,487,1574118000"; d="scan'208";a="5677792" Date: Wed, 26 Feb 2020 12:18:29 +0100 From: Ricard Wanderlof X-X-Sender: ricardw@lnxricardw1.se.axis.com To: Dan Murphy CC: "lgirdwood@gmail.com" , "broonie@kernel.org" , "perex@perex.cz" , "tiwai@suse.com" , "alsa-devel@alsa-project.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v3 2/2] ASoC: tlv320adcx140: Add the tlv320adcx140 codec driver family In-Reply-To: <20200219125942.22013-3-dmurphy@ti.com> Message-ID: References: <20200219125942.22013-1-dmurphy@ti.com> <20200219125942.22013-3-dmurphy@ti.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: 8BIT X-Originating-IP: [10.0.5.60] X-ClientProxiedBy: XBOX02.axis.com (10.0.5.16) To XBOX03.axis.com (10.0.5.17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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). > +?????????????? 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. > +?????????????? dev_err(adcx140->dev, "Mic Bias source value is invalid\n"); Error text does not reflect the actual error, suggest "VREF value is invalid". > +?????????????? return -EINVAL; > +?????? } > + > +?????? bias_source |= vref_source; > + > +?????? ret = adcx140_reset(adcx140); > +?????? if (ret) > +?????????????? goto out; > + > +?????? if(adcx140->supply_areg == NULL) > +?????????????? sleep_cfg_val |= ADCX140_AREG_INTERNAL; > + > +?????? ret = regmap_write(adcx140->regmap, ADCX140_SLEEP_CFG, > sleep_cfg_val); > +?????? if (ret) { > +?????????????? dev_err(adcx140->dev, "setting sleep config failed %d\n", > ret); > +?????????????? goto out; > +?????? } > -- > 2.25.0 > > > /Ricard -- Ricard Wolf Wanderlof ricardw(at)axis.com Axis Communications AB, Lund, Sweden www.axis.com Phone +46 46 272 2016 Fax +46 46 13 61 30