From patchwork Sat May 14 21:09:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Rosin X-Patchwork-Id: 9095641 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 80BA3BF29F for ; Sat, 14 May 2016 21:17:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 960B220270 for ; Sat, 14 May 2016 21:17:07 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 4C492201FE for ; Sat, 14 May 2016 21:17:06 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 76D5A265930; Sat, 14 May 2016 23:17:05 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.8 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 9C5EA265703; Sat, 14 May 2016 23:15:25 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id B35CA265703; Sat, 14 May 2016 23:15:24 +0200 (CEST) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0125.outbound.protection.outlook.com [104.47.0.125]) by alsa0.perex.cz (Postfix) with ESMTP id E3424265716 for ; Sat, 14 May 2016 23:14:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axentiatech.onmicrosoft.com; s=selector1-axentia-se; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=KD8gOcNKoHr3ogE3PctN2+lG5Zo5tT18hxAUDPPWqPg=; b=CGEzzktpGFpgsScglat4zAmCabkxAQRV4quN+cfCkC5+Nylu2TEqCeAgc9IJ94okpIBqRF1FPiN366PMRnLV70e8OJ22LQhPBXCcOD0mpCpKIoGVeEnOctRS5yquqW2+a41ec6a0f4n8t6XvA+bIG/GiieqU4tM284EUV7srxU0= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=axentia.se; Received: from localhost.localdomain (217.210.101.82) by VI1PR02MB1311.eurprd02.prod.outlook.com (10.165.231.153) with Microsoft SMTP Server (TLS) id 15.1.497.12; Sat, 14 May 2016 21:14:52 +0000 From: Peter Rosin To: Date: Sat, 14 May 2016 23:09:41 +0200 Message-ID: <1463260181-21344-5-git-send-email-peda@axentia.se> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1463260181-21344-1-git-send-email-peda@axentia.se> References: <1463260181-21344-1-git-send-email-peda@axentia.se> MIME-Version: 1.0 X-Originating-IP: [217.210.101.82] X-ClientProxiedBy: DB3PR08CA0017.eurprd08.prod.outlook.com (10.161.51.155) To VI1PR02MB1311.eurprd02.prod.outlook.com (10.165.231.153) X-MS-Office365-Filtering-Correlation-Id: 57bddf43-af33-46ed-501c-08d37c3ccbe4 X-Microsoft-Exchange-Diagnostics: 1; VI1PR02MB1311; 2:Dp32FKL7L9xPV0zmzad+PU4mNnpcCejuHnXWBkKwGC4fDP82GTX/9oS4+Lq06ZaXndbGZM6mNYgCRXTFeL78x5UEzrWnbEQLnUULR4EevNKIItaj9Y4P6O0E+svAKJSWNWe4EemU4QW9mdTyjK5nHl98s3pvFBHMvfLy7F4/dZDdkGu7GIp2CfA8x5MEk3mC; 3:1+R+qdWq3CwNsTf1rqipjF6moH+6qsYKUJMmXguV6MtGxxOZP2X1IQuhx9rzZiItKrgO1K1yJIO6ZMED6wSTFyQo7JvY0YVZ3FoIEt08mYvmF+TJ6LQQWpa6kzU3V3K2; 25:JM+roMMSjm3AxhKHhdjME6vp6DlatRzkmYg4O4cFDmeuQUURCzjrHpB+VCop0qzwQ6jgBJRJRuwMdYRgaVjMhDvDazRr/2mPcdDghUQI1zbBBrC+JTU7p8qVwtMo5/WT2AX2XP/QypkvAIUhK0PIcjxZ9QjE3Ydff3hvmMhV4QIXGKUcmSwmmvoAzAPfvpMJk6R3YgXeZsxsN43g2G5yMpqmOMRlXElj0J3BjM7eXVyWRixksKXacnaRjIvw3iIJf8d0EPtaIdo1vr92xkFKXyO5PR0KJzZKQo19HQ7DRCzSY6VsrQHo32zIwtU0adU5sY4p+06jLNgSYGDOI3qANJ4sGbA0Spgs8AaqQBE9+Q1ud0hFYfTJBdOAeJbQ1bmi2X131Y79DfIqFIlqDV6F5CZR4cUauzzCruia3y0zq28= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:VI1PR02MB1311; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040130)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6041072)(6043046); SRVR:VI1PR02MB1311; BCL:0; PCL:0; RULEID:; SRVR:VI1PR02MB1311; X-Microsoft-Exchange-Diagnostics: 1; VI1PR02MB1311; 4:q/YXGF0Z3Nce7C5QjyceMfIc9L5SPbDXOjfYDJaqudWgPbVZg4gmAtWguqUj+cGnaumNbshtRjwfRmqihPjX/pCdorYfDFf8kI8NUrYEXnuFoKQSdBicxFj0YPvSw6laI9WWT9dq3+bX8dHJl11yF6BDUmJzzmO/YoWQBOqQ3sqxHwv9e/azzV5cJ7U3QaaDFL2wf+nYLp0KMbVGORr82ID7YnIFNK/VZSzcTx8ZXicrB38gI200q3W/UM2UwGrfXGsuXK02/8hylz92JnsD7tVFrHTw3wYGXbIC59Cq5DsvmxAqCZHHkgcHgdVV2mhEB6qnxlBmmGZtwcqvihNviBJqY6WdI21GD3ejaOYE1w1XbfLMymIEJivtKXtG4wjivsLUuittWi76ca8Ax1LO3bO6o2wUvwo9KaDDUthmOiU= X-Forefront-PRVS: 094213BFEA X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(6069001)(19580405001)(189998001)(48376002)(586003)(15975445007)(6116002)(3846002)(5003940100001)(50986999)(76176999)(2950100001)(5004730100002)(77096005)(110136002)(42186005)(4326007)(33646002)(5008740100001)(50466002)(66066001)(74482002)(36756003)(47776003)(2906002)(92566002)(19580395003)(8676002)(229853001)(2351001)(81166006)(50226002)(86362001)(575784001)(42262002); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR02MB1311; H:localhost.localdomain; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR02MB1311; 23:x64q5dmLvsP8XJnNnfyC+CoFM87SYuR3LO0uRqYcI?= =?us-ascii?Q?NXgO5fvgSU7+WLiL7aYiaryHWsyFRlrQ1H5JWEO4/ilH8SxPzUxMRlURF0w+?= =?us-ascii?Q?iIU2YR0QjnzU0IsBKWzHwuLXQJWIQy32qJ0+xGVhHQjy+AHnNXTp/ltLzlG5?= =?us-ascii?Q?gKb7+nEyy+kgcEMMs/K5X5Svd0PzEiTWTcNPPuPrmnXStlfFEl2CxVqpKl9s?= =?us-ascii?Q?demUDdMEs3SH1VGURCez1ttYj69MRj87KA4q4ntLHlQloIBRTiAvzQ7Vzio0?= =?us-ascii?Q?WRsBljTnIfuo0JRtUfW0gdFfJ4mPtJcx3I8OLveRRpa1ZOCSMjU4ZVOZwSQA?= =?us-ascii?Q?Vpn3L7AWy7FYcV0eIBamH9miq22a+ffDGsKPO58ctx2s19B0qXYPdTYOp4L8?= =?us-ascii?Q?v2sVAWrCrX8q1rOR1UMGCcBZ+bk3bfuz9wcoE+SzJttDBiPwesGKO2DgTASN?= =?us-ascii?Q?SEndXfYjOpBEiR8HK3lL9yAmNJOSmDX3H07fen3nCszupRqo9UL4sScFbsh+?= =?us-ascii?Q?i+YgplCvIBjlldek96nVZfxJ1WkM8mooXo0KWRqvtIpcaKDpgsrA9KwD6Wcb?= =?us-ascii?Q?paXVOXExgIBtiL0GBv0XiiFocCFKU8DMPLCfinEuehpPatGIbEw4k0/j4Nu3?= =?us-ascii?Q?41wQP/He7/qztM28La93V+eHk4IfSKb2SJQHR5SFQfxBzuxOKfKERBSo1VXW?= =?us-ascii?Q?9kWS1o7caOHCtf/mfIpQjUHwZu7ELyVbBrw7jxTfqZ7MNySzqFGgYI4SHDMx?= =?us-ascii?Q?4kFyfKL0bItdWfhPmay3qeEfzVrx8qOXWFE+81587wXioOD7SG46OsqFbIUX?= =?us-ascii?Q?uljaJNLHcW8V+P5CvSvZzXRINhSHMnSrW/M7usnri4S/xCfXpbZKcGPd0Zmt?= =?us-ascii?Q?BZDSSsYDdcGRtvyNC4Z1vd5ubFacxK3VGLm/x9LjAt1PO8vT3BSRedVkeAHv?= =?us-ascii?Q?kxfxKpGj379uHKVUghd/PKhuQL6YVV5Kyz71Yhvgyh7u82dHMKnZPbrwODAO?= =?us-ascii?Q?34dNvQj1jWdiVTAGG6yc/8t?= X-Microsoft-Exchange-Diagnostics: 1; VI1PR02MB1311; 5:56OPhQxYymCDfsm3DF4AEcWLY+mMg9twWEJhBORrrPEqKtwisvXrsHwas48+38w/ibGjiZAxGepyRDy+g+rZURkpnBgq5or4zlGA5Vyb3qCBxjB403GBd7pYsmTpaD38QfbM20UVLVAJ28Al4hZ//Q==; 24:jVkKr47pBU6t3LR7pCtYsDin5gERVccyUOtjXU/AQ2kthF0FO/RH1jfszhHujioCzD+rme0h9Qd4BUdTbXVsfpNHVg5p8DDwgcJ8aMcz9mw=; 7:OboT7/TzaKDmKVLG5Zm5f4RYckrIB5HoCjyqeo70q8iBqjb2mzdNxp/qzxP6BnAuUpWUjgQSJeaKl0h5zs+RZpNyENHwCIzJ2TJi0Vq1NmciekNLC1GC/O9clYxESK3hKWMROXXHQXMAKGbL7COUfjyMSTmy1+KHwtnAETgzyQissRPxeedF4kelqcMecVCB SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 May 2016 21:14:52.0457 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR02MB1311 Cc: Mark Rutland , devicetree@vger.kernel.org, alsa-devel@alsa-project.org, Pawel Moll , Ian Campbell , Mark Brown , Takashi Iwai , Liam Girdwood , Rob Herring , Misbah Ullah Khan , Kumar Gala , Peter Rosin Subject: [alsa-devel] [PATCH v4 4/4] ASoC: MAX9860: add sidetone mixer control X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Peter Rosin --- sound/soc/codecs/max9860.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/sound/soc/codecs/max9860.c b/sound/soc/codecs/max9860.c index 2b0dd6a18dad..8d257cc20ef7 100644 --- a/sound/soc/codecs/max9860.c +++ b/sound/soc/codecs/max9860.c @@ -3,9 +3,6 @@ * * https://datasheets.maximintegrated.com/en/ds/MAX9860.pdf * - * The driver does not support sidetone since the DVST register field is - * backwards with the mute near the maximum level instead of the minimum. - * * Author: Peter Rosin * Copyright 2016 Axentia Technologies * @@ -135,6 +132,10 @@ const struct regmap_config max9860_regmap = { static const DECLARE_TLV_DB_SCALE(dva_tlv, -9100, 100, 1); static const DECLARE_TLV_DB_SCALE(dvg_tlv, 0, 600, 0); static const DECLARE_TLV_DB_SCALE(adc_tlv, -1200, 100, 0); +/* The dvst field has its mute in the wrong end. Sigh. */ +static const DECLARE_TLV_DB_RANGE(dvst_tlv, + 0, MAX9860_DVST_MIN - 1, TLV_DB_SCALE_ITEM(-6000, 200, 0), + MAX9860_DVST_MIN, MAX9860_DVST_MIN, TLV_DB_SCALE_ITEM(0, 0, 1)); static const DECLARE_TLV_DB_RANGE(pam_tlv, 0, MAX9860_PAM_MAX - 1, TLV_DB_SCALE_ITEM(-2000, 2000, 1), MAX9860_PAM_MAX, MAX9860_PAM_MAX, TLV_DB_SCALE_ITEM(3000, 0, 0)); @@ -214,6 +215,11 @@ SOC_ENUM("ADC Filter", avflt_enum), SOC_ENUM("DAC Filter", dvflt_enum), }; +static const struct snd_kcontrol_new max9860_mixer_controls[] = { +SOC_DAPM_SINGLE_TLV("Sidetone Volume", MAX9860_DACGAIN, + MAX9860_DVST_SHIFT, MAX9860_DVST_MIN, 1, dvst_tlv), +}; + static const struct snd_soc_dapm_widget max9860_dapm_widgets[] = { SND_SOC_DAPM_INPUT("MICL"), SND_SOC_DAPM_INPUT("MICR"), @@ -224,6 +230,10 @@ SND_SOC_DAPM_ADC("ADCR", NULL, MAX9860_PWRMAN, MAX9860_ADCREN_SHIFT, 0), SND_SOC_DAPM_AIF_OUT("AIFOUTL", "Capture", 0, SND_SOC_NOPM, 0, 0), SND_SOC_DAPM_AIF_OUT("AIFOUTR", "Capture", 1, SND_SOC_NOPM, 0, 0), +SND_SOC_DAPM_MIXER("Mixer", SND_SOC_NOPM, 0, 0, + max9860_mixer_controls, + ARRAY_SIZE(max9860_mixer_controls)), + SND_SOC_DAPM_AIF_IN("AIFINL", "Playback", 0, SND_SOC_NOPM, 0, 0), SND_SOC_DAPM_AIF_IN("AIFINR", "Playback", 1, SND_SOC_NOPM, 0, 0), @@ -244,8 +254,10 @@ static const struct snd_soc_dapm_route max9860_dapm_routes[] = { { "AIFOUTL", NULL, "ADCL" }, { "AIFOUTR", NULL, "ADCR" }, - { "DAC", NULL, "AIFINL" }, - { "DAC", NULL, "AIFINR" }, + { "Mixer", NULL, "AIFINL" }, + { "Mixer", NULL, "AIFINR" }, + { "Mixer", "Sidetone Volume", "ADCL" }, + { "DAC", NULL, "Mixer" }, { "OUT", NULL, "DAC" }, { "Supply", NULL, "AVDD" },