[{"id":1760725,"web_url":"http://patchwork.ozlabs.org/comment/1760725/","msgid":"<ca5e6705-47e7-12bd-6391-b22156aa31d7@ti.com>","list_archive_url":null,"date":"2017-08-31T08:06:05","subject":"Re: [PATCH] ASoC: tlv320aic3x: Support for OCMV configuration","submitter":{"id":9142,"url":"http://patchwork.ozlabs.org/api/people/9142/","name":"Peter Ujfalusi","email":"peter.ujfalusi@ti.com"},"content":"﻿\n\n\nTexas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki\n\nOn 2017-08-31 11:00, Peter Ujfalusi wrote:\n> In aic3x class of devices Output Common-Mode Voltage can be configured for\n> better analog performance.\n> The OCMV value depends on the Analog and digital domain power supply\n> voltage configuration.\n> \n> The default OCMV of 1.35V gives best performance when AVDD is around 2.7V\n> and DVDD is 1.525V, but for higher AVDD/DVDD higher OCMV setting is\n> recommended.\n> \n> The patch gives an automatic way of guessing the best OCMV which can be\n> overwritten by a DT parameter if needed.\n> \n> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>\n> ---\n>  .../devicetree/bindings/sound/tlv320aic3x.txt      |  5 +++\n>  sound/soc/codecs/tlv320aic3x.c                     | 45 ++++++++++++++++++++++\n>  sound/soc/codecs/tlv320aic3x.h                     |  8 ++++\n>  3 files changed, 58 insertions(+)\n> \n> diff --git a/Documentation/devicetree/bindings/sound/tlv320aic3x.txt b/Documentation/devicetree/bindings/sound/tlv320aic3x.txt\n> +static void aic3x_configure_ocmv(struct i2c_client *client)\n> +{\n> +\tstruct device_node *np = client->dev.of_node;\n> +\tstruct aic3x_priv *aic3x = i2c_get_clientdata(client);\n> +\tu32 value;\n> +\tint dvdd, avdd;\n> +\n> +\tif (np && !of_property_read_u32(np, \"ai3x-ocmv\", &value)) {\n> +\t\t/* OCMV setting is forced by DT */\n> +\t\tif (value <= 3) {\n> +\t\t\taic3x->ocmv = value;\n> +\t\t\treturn;\n> +\t\t}\n> +\t}\n> +\n> +\tdvdd = regulator_get_voltage(aic3x->supplies[1].consumer);\n> +\tavdd = regulator_get_voltage(aic3x->supplies[2].consumer);\n> +\n> +\tif (avdd > 3600000 || dvdd > 1950000) {\n> +\t\tdev_warn(&client->dev,\n> +\t\t\t \"Too high supply voltage(s) AVDD: %d, DVDD: %d\\n\",\n> +\t\t\t avdd, dvdd);\n> +\t} else if (avdd == 3600000 && dvdd == 1950000) {\n> +\t\taic3x->ocmv = HPOUT_SC_OCMV_1_8V;\n> +\t} else if (avdd > 3300000 && dvdd > 1800000) {\n> +\t\taic3x->ocmv = HPOUT_SC_OCMV_1_65V;\n> +\t} else if (avdd > 3000000 && dvdd > 1650000) {\n> +\t\taic3x->ocmv = HPOUT_SC_OCMV_1_5V;\n> +\t} else if (avdd > 2700000 && dvdd > 1525000) {\n\nthis should have been:\n} else if (avdd >= 2700000 && dvdd >= 1525000) {\n\nas AVDD 2.7V and DVDD 1.525V is the lowest supported supply voltages.\n\n> +\t\taic3x->ocmv = HPOUT_SC_OCMV_1_35V;\n> +\t} else {\n> +\t\tdev_warn(&client->dev,\n> +\t\t\t \"Invalid supply voltage(s) AVDD: %d, DVDD: %d\\n\",\n> +\t\t\t avdd, dvdd);\n> +\t}\n> +}\n> +\n>  /*\n>   * AIC3X 2 wire address can be up to 4 devices with device addresses\n>   * 0x18, 0x19, 0x1A, 0x1B\n> @@ -1816,6 +1859,8 @@ static int aic3x_i2c_probe(struct i2c_client *i2c,\n>  \t\tgoto err_gpio;\n>  \t}\n>  \n> +\taic3x_configure_ocmv(i2c);\n> +\n>  \tif (aic3x->model == AIC3X_MODEL_3007) {\n>  \t\tret = regmap_register_patch(aic3x->regmap, aic3007_class_d,\n>  \t\t\t\t\t    ARRAY_SIZE(aic3007_class_d));\n> diff --git a/sound/soc/codecs/tlv320aic3x.h b/sound/soc/codecs/tlv320aic3x.h\n> index 89fa692df206..34c35196aa0d 100644\n> --- a/sound/soc/codecs/tlv320aic3x.h\n> +++ b/sound/soc/codecs/tlv320aic3x.h\n> @@ -243,6 +243,14 @@\n>  #define MICBIAS_LEVEL_SHIFT\t(6)\n>  #define MICBIAS_LEVEL_MASK\t(3 << 6)\n>  \n> +/* HPOUT_SC */\n> +#define HPOUT_SC_OCMV_MASK\t(3 << 6)\n> +#define HPOUT_SC_OCMV_SHIFT\t(6)\n> +#define HPOUT_SC_OCMV_1_35V\t0\n> +#define HPOUT_SC_OCMV_1_5V\t1\n> +#define HPOUT_SC_OCMV_1_65V\t2\n> +#define HPOUT_SC_OCMV_1_8V\t3\n> +\n>  /* headset detection / button API */\n>  \n>  /* The AIC3x supports detection of stereo headsets (GND + left + right signal)\n> \n\n- Péter\n\n--\nTo unsubscribe from this list: send the line \"unsubscribe devicetree\" in\nthe body of a message to majordomo@vger.kernel.org\nMore majordomo info at  http://vger.kernel.org/majordomo-info.html","headers":{"Return-Path":"<devicetree-owner@vger.kernel.org>","X-Original-To":"incoming-dt@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-dt@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=devicetree-owner@vger.kernel.org; receiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ti.com header.i=@ti.com header.b=\"aOsA3uvL\"; \n\tdkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xjZhb4X7Yz9sQl\n\tfor <incoming-dt@patchwork.ozlabs.org>;\n\tThu, 31 Aug 2017 18:06:39 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1750897AbdHaIGg (ORCPT\n\t<rfc822;incoming-dt@patchwork.ozlabs.org>);\n\tThu, 31 Aug 2017 04:06:36 -0400","from fllnx209.ext.ti.com ([198.47.19.16]:14648 \"EHLO\n\tfllnx209.ext.ti.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1750783AbdHaIGd (ORCPT\n\t<rfc822; devicetree@vger.kernel.org>); Thu, 31 Aug 2017 04:06:33 -0400","from dflxv15.itg.ti.com ([128.247.5.124])\n\tby fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id v7V85mrq001987; \n\tThu, 31 Aug 2017 03:05:48 -0500","from DLEE102.ent.ti.com (dlee102.ent.ti.com [157.170.170.32])\n\tby dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v7V85htd022287;\n\tThu, 31 Aug 2017 03:05:43 -0500","from DLEE113.ent.ti.com (157.170.170.24) by DLEE102.ent.ti.com\n\t(157.170.170.32) with Microsoft SMTP Server (version=TLS1_2,\n\tcipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34;\n\tThu, 31 Aug 2017 03:05:42 -0500","from dlep33.itg.ti.com (157.170.170.75) by DLEE113.ent.ti.com\n\t(157.170.170.24) with Microsoft SMTP Server (version=TLS1_0,\n\tcipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend\n\tTransport; Thu, 31 Aug 2017 03:05:42 -0500","from [192.168.2.6] (ileax41-snat.itg.ti.com [10.172.224.153])\n\tby dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id v7V85fRR031625;\n\tThu, 31 Aug 2017 03:05:41 -0500"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com;\n\ts=ti-com-17Q1; t=1504166748;\n\tbh=7xM3wAbP04lAYEJewerGR8A3mlsJPtjgTW6TdIP6cgo=;\n\th=Subject:To:References:CC:From:Date:In-Reply-To;\n\tb=aOsA3uvLdqDaswDTMOs1wfcgEFjTKocVOYE2seGhvMIBXv+7Etvjc7mm1sDlKUaAl\n\tF7TZXSVF2uRlz+2FjOyJIn+GyGBRAUNAxEt5yYrH/6F74twTLyVu9L9Xj+SnGMeugD\n\tar6zrW9ONfimT0TD2luS8lhi8ClJWOjJqrQApeZc=","Subject":"Re: [PATCH] ASoC: tlv320aic3x: Support for OCMV configuration","To":"<broonie@kernel.org>, <lgirdwood@gmail.com>, <robh+dt@kernel.org>","References":"<20170831080045.28999-1-peter.ujfalusi@ti.com>","CC":"<alsa-devel@alsa-project.org>, <devicetree@vger.kernel.org>","From":"Peter Ujfalusi <peter.ujfalusi@ti.com>","Message-ID":"<ca5e6705-47e7-12bd-6391-b22156aa31d7@ti.com>","Date":"Thu, 31 Aug 2017 11:06:05 +0300","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101\n\tThunderbird/45.8.0","MIME-Version":"1.0","In-Reply-To":"<20170831080045.28999-1-peter.ujfalusi@ti.com>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"quoted-printable","X-EXCLAIMER-MD-CONFIG":"e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180","Sender":"devicetree-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<devicetree.vger.kernel.org>","X-Mailing-List":"devicetree@vger.kernel.org"}}]