From patchwork Tue Jun 25 07:49:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Suvorov X-Patchwork-Id: 11014985 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DEAE16C5 for ; Tue, 25 Jun 2019 07:59:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D203C288EA for ; Tue, 25 Jun 2019 07:59:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C6613289F0; Tue, 25 Jun 2019 07:59:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4E0EF28990 for ; Tue, 25 Jun 2019 07:59:44 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 59FF31665; Tue, 25 Jun 2019 09:50:50 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 59FF31665 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1561449100; bh=4BT7WavZUcYMxxkz9gdUkNPrOzXQgAzcmd3ibFs6tyo=; h=From:To:Date:References:In-Reply-To:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=oXDDplYxmSZ1hz3Ue2wLpZVLG7+UAoNsaUpxe+oreRMWaSoANGrlrh59V8k3UIM1k /pRZSXUjExuzj0k52W5mjipo1W3QHwXLM1gOz+4SNokJYoCBfWAP/Y+wfBa/2tJjiH a0rCr9NYqSdkQsW7teRN4KRn2x7U6IxadyDOMJQ4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 30492F8972F; Tue, 25 Jun 2019 09:49:58 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2F928F896FC; Tue, 25 Jun 2019 09:49:54 +0200 (CEST) Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40102.outbound.protection.outlook.com [40.107.4.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 466E4F8071F for ; Tue, 25 Jun 2019 09:49:51 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 466E4F8071F Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=toradex.com header.i=@toradex.com header.b="FCjkUYP3" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toradex.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Q1s9YIQjrFEXLpr6/0iaQWEqmYN/FBkd2qBsYzcdpxE=; b=FCjkUYP3RpZjxCfd/W/WQvT5Crf0X0S/CAi4E+gDdYXJpYsWoCu3Nef5J5qfy4jHXyQNGTTsaNlaMM4dPTytxdU4fKVWNWT+U7oKpi/P4rhC01k8WUrpymvbq/1All7aVbNmt/2pW9nHxMatINjw1ohyim/1+mbDE3uXKod2Spw= Received: from AM6PR05MB6535.eurprd05.prod.outlook.com (20.179.18.16) by AM6PR05MB4150.eurprd05.prod.outlook.com (52.135.161.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2008.16; Tue, 25 Jun 2019 07:49:47 +0000 Received: from AM6PR05MB6535.eurprd05.prod.outlook.com ([fe80::2c23:fdba:9ce4:7397]) by AM6PR05MB6535.eurprd05.prod.outlook.com ([fe80::2c23:fdba:9ce4:7397%7]) with mapi id 15.20.2008.007; Tue, 25 Jun 2019 07:49:47 +0000 From: Oleksandr Suvorov To: Fabio Estevam Thread-Topic: [PATCH v2 1/6] ASoC: sgtl5000: Fix definition of VAG Ramp Control Thread-Index: AQHVKyqP9Y3ACmV7XEOmUoCTUILA2w== Date: Tue, 25 Jun 2019 07:49:47 +0000 Message-ID: <20190625074937.2621-2-oleksandr.suvorov@toradex.com> References: <20190625074937.2621-1-oleksandr.suvorov@toradex.com> In-Reply-To: <20190625074937.2621-1-oleksandr.suvorov@toradex.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM0PR06CA0081.eurprd06.prod.outlook.com (2603:10a6:208:fa::22) To AM6PR05MB6535.eurprd05.prod.outlook.com (2603:10a6:20b:71::16) authentication-results: spf=none (sender IP is ) smtp.mailfrom=oleksandr.suvorov@toradex.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-originating-ip: [194.105.145.90] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 08f1a194-789a-4bd8-ce0b-08d6f941b1a4 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:AM6PR05MB4150; x-ms-traffictypediagnostic: AM6PR05MB4150: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2276; x-forefront-prvs: 0079056367 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(396003)(366004)(39850400004)(136003)(346002)(376002)(189003)(199004)(6436002)(86362001)(8936002)(6116002)(3846002)(186003)(6486002)(81166006)(81156014)(446003)(102836004)(6506007)(386003)(26005)(486006)(2616005)(11346002)(478600001)(44832011)(8676002)(476003)(305945005)(71190400001)(7736002)(6512007)(54906003)(2906002)(316002)(4326008)(68736007)(71200400001)(66066001)(53936002)(25786009)(50226002)(66946007)(36756003)(73956011)(64756008)(66446008)(14454004)(66556008)(1076003)(66476007)(6916009)(5660300002)(52116002)(76176011)(99286004)(256004)(14444005)(1411001); DIR:OUT; SFP:1102; SCL:1; SRVR:AM6PR05MB4150; H:AM6PR05MB6535.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: toradex.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: Tz43gHLNDwL32L7ZqIsn8e5q6Jhow0zPPsSkt21XGKydP+IVjqzJ6upamSpydx6C7G0QWzlIjDHFInq+LiWw/e8aUKrqAe9eUbWorrqeDqZe/+I0iZYTGXeS21vkN/tH5qLFwD59I0AAbMPtvhDLc7xDqoF6g6XbM1Gmz0b/4d7o5nAufZDRj1r1OK7afcXcaKQFIKRAV1lrBkhRY9WeLJ/1H0TgzjjUjyxiTcvyOl2QtRiT33ak3+t8+6clsGm7B2AF05AEPgKFwD34uk0KYR/Mn2W07hMREkOW1CZ8PRcvznA3mIABz9t7gikSqnVzRiPOXDzw35x1zXsBgBBdjoVewPhcjUObzBXmEnDGNqviMLGbRh2YbtPv+cxG0C33v1OzBcfBviUfBmlc2KOKrmC/TrNlHFFr21osqY+rrgg= MIME-Version: 1.0 X-OriginatorOrg: toradex.com X-MS-Exchange-CrossTenant-Network-Message-Id: 08f1a194-789a-4bd8-ce0b-08d6f941b1a4 X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Jun 2019 07:49:47.1810 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: d9995866-0d9b-4251-8315-093f062abab4 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: oleksandr.suvorov@toradex.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB4150 Cc: Igor Opaniuk , Liam Girdwood , Marcel Ziswiler , Takashi Iwai , "alsa-devel@alsa-project.org" , "linux-kernel@vger.kernel.org" , Oleksandr Suvorov , Mark Brown Subject: [alsa-devel] [PATCH v2 1/6] ASoC: sgtl5000: Fix definition of VAG Ramp Control X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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" X-Virus-Scanned: ClamAV using ClamSMTP SGTL5000_SMALL_POP is a bit mask, not a value. Usage of correct definition makes device probing code more clear. Signed-off-by: Oleksandr Suvorov Reviewed-by: Igor Opaniuk --- sound/soc/codecs/sgtl5000.c | 2 +- sound/soc/codecs/sgtl5000.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index a6a4748c97f9d..5e49523ee0b67 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c @@ -1296,7 +1296,7 @@ static int sgtl5000_probe(struct snd_soc_component *component) /* enable small pop, introduce 400ms delay in turning off */ snd_soc_component_update_bits(component, SGTL5000_CHIP_REF_CTRL, - SGTL5000_SMALL_POP, 1); + SGTL5000_SMALL_POP, SGTL5000_SMALL_POP); /* disable short cut detector */ snd_soc_component_write(component, SGTL5000_CHIP_SHORT_CTRL, 0); diff --git a/sound/soc/codecs/sgtl5000.h b/sound/soc/codecs/sgtl5000.h index 18cae08bbd3a6..a4bf4bca95bf7 100644 --- a/sound/soc/codecs/sgtl5000.h +++ b/sound/soc/codecs/sgtl5000.h @@ -273,7 +273,7 @@ #define SGTL5000_BIAS_CTRL_MASK 0x000e #define SGTL5000_BIAS_CTRL_SHIFT 1 #define SGTL5000_BIAS_CTRL_WIDTH 3 -#define SGTL5000_SMALL_POP 1 +#define SGTL5000_SMALL_POP 0x0001 /* * SGTL5000_CHIP_MIC_CTRL From patchwork Tue Jun 25 07:49:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Suvorov X-Patchwork-Id: 11014981 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D030E14B6 for ; Tue, 25 Jun 2019 07:59:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C4EF6288EA for ; Tue, 25 Jun 2019 07:59:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B966F28A0A; Tue, 25 Jun 2019 07:59:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7B18A289F0 for ; Tue, 25 Jun 2019 07:59:44 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 646DE1675; Tue, 25 Jun 2019 09:51:36 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 646DE1675 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1561449146; bh=D/O/9rJjjloxgHwd3zy898TAv2f5qsD/JcxjcTKXNjY=; h=From:To:Date:References:In-Reply-To:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=sD6BSNFmAkLQ6KyK9aA8DKq2RRU6aAmyFEATUNYewt3PL5BDP2oGPXFzPeotn0fCJ JN4bj5OH7PPHCPDupDetLzTw6tJSmcCDzPZQDxkjP10ACvh9SYPKzudpeNdMdtfc5B XOswSk9MwO51nugxjx1FdRoXuNYaz8HWEu1ARE0c= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id B90C4F8071F; Tue, 25 Jun 2019 09:50:01 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 821DAF89719; Tue, 25 Jun 2019 09:49:55 +0200 (CEST) Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40102.outbound.protection.outlook.com [40.107.4.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 9FBEDF896F0 for ; Tue, 25 Jun 2019 09:49:52 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9FBEDF896F0 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=toradex.com header.i=@toradex.com header.b="tByNCMOR" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toradex.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tA6JBJb6oWxZQN8cj41AYPnn1HGbKv2UuwLOigCxT4o=; b=tByNCMORj3IF9EmbsjewuOMAK0+noyH8RLinZ/J2aVzTxlMze+AfnkE5SHabH9JZBomM5dQT8g5kRf2NoQBenjTtnunmx6w+PH4T8pqfp+Rm/xoKlYguS6pgFjnMvDHeraVKF7XnxKrxIZOtKZq2HUqTeoT0eOtPjfdNZJjyWho= Received: from AM6PR05MB6535.eurprd05.prod.outlook.com (20.179.18.16) by AM6PR05MB4150.eurprd05.prod.outlook.com (52.135.161.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2008.16; Tue, 25 Jun 2019 07:49:50 +0000 Received: from AM6PR05MB6535.eurprd05.prod.outlook.com ([fe80::2c23:fdba:9ce4:7397]) by AM6PR05MB6535.eurprd05.prod.outlook.com ([fe80::2c23:fdba:9ce4:7397%7]) with mapi id 15.20.2008.007; Tue, 25 Jun 2019 07:49:49 +0000 From: Oleksandr Suvorov To: Fabio Estevam Thread-Topic: [PATCH v2 2/6] ASoC: sgtl5000: add ADC mute control Thread-Index: AQHVKyqRcZ04ncDZBUW/bJGcuQuzmw== Date: Tue, 25 Jun 2019 07:49:49 +0000 Message-ID: <20190625074937.2621-3-oleksandr.suvorov@toradex.com> References: <20190625074937.2621-1-oleksandr.suvorov@toradex.com> In-Reply-To: <20190625074937.2621-1-oleksandr.suvorov@toradex.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM0PR0402CA0035.eurprd04.prod.outlook.com (2603:10a6:208:15::48) To AM6PR05MB6535.eurprd05.prod.outlook.com (2603:10a6:20b:71::16) authentication-results: spf=none (sender IP is ) smtp.mailfrom=oleksandr.suvorov@toradex.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-originating-ip: [194.105.145.90] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 1e6064a5-867d-4716-0659-08d6f941b35a x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:AM6PR05MB4150; x-ms-traffictypediagnostic: AM6PR05MB4150: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:669; x-forefront-prvs: 0079056367 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(396003)(366004)(39850400004)(136003)(346002)(376002)(189003)(199004)(6436002)(86362001)(8936002)(6116002)(3846002)(186003)(6486002)(81166006)(81156014)(446003)(102836004)(6506007)(386003)(26005)(486006)(2616005)(11346002)(478600001)(44832011)(8676002)(476003)(305945005)(71190400001)(7736002)(6512007)(54906003)(2906002)(316002)(4326008)(68736007)(71200400001)(66066001)(53936002)(25786009)(50226002)(66946007)(36756003)(73956011)(64756008)(66446008)(14454004)(66556008)(1076003)(66476007)(4744005)(6916009)(5660300002)(52116002)(76176011)(99286004)(256004)(1411001); DIR:OUT; SFP:1102; SCL:1; SRVR:AM6PR05MB4150; H:AM6PR05MB6535.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: toradex.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: FgKBrGWsHlyXSjqSkXA2jhegJfKn/kQMLHPhSyaMQ9eXlnh0boGHHZQINXzmmIFJcrZBx6hf4H1b88GUc0MMP1AS00sxXz1oBnnDUYwQZy9CfHUqTK8gAfdOGeEkpg8glzN1AuyCbHXDy6eMAtCLQq0jMBRehn+nIsL66yO/qsasCxHxOZLlh2nP++AW1tt0ihpCYft7C+yZFzess0D+eF3UzWiQFGZEezlimCDjQ0jSHkpmvlN/zSNUFDkQm59FoCoTgntmfgIF0isTmleogsMWhwyHloAGQM+xRti3z4hVHyI1GpG+uLQvL77dSJXQi2vPhpu5DBm1wJkr/bN5Qh9QxfFIcDcSjSF5PgpDfmISmNFXTY0VF+FSMtJHE2GE/NVaL5FGXdgNqS+SQDIpajrTl8bV3hAiQs77ILt16Pg= MIME-Version: 1.0 X-OriginatorOrg: toradex.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1e6064a5-867d-4716-0659-08d6f941b35a X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Jun 2019 07:49:49.9374 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: d9995866-0d9b-4251-8315-093f062abab4 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: oleksandr.suvorov@toradex.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB4150 Cc: Igor Opaniuk , Liam Girdwood , Marcel Ziswiler , Takashi Iwai , "alsa-devel@alsa-project.org" , "linux-kernel@vger.kernel.org" , Oleksandr Suvorov , Mark Brown Subject: [alsa-devel] [PATCH v2 2/6] ASoC: sgtl5000: add ADC mute control X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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" X-Virus-Scanned: ClamAV using ClamSMTP This control mute/unmute the ADC input of SGTL5000 using its CHIP_ANA_CTRL register. Signed-off-by: Oleksandr Suvorov Reviewed-by: Igor Opaniuk --- sound/soc/codecs/sgtl5000.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index 5e49523ee0b67..bb58c997c6914 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c @@ -556,6 +556,7 @@ static const struct snd_kcontrol_new sgtl5000_snd_controls[] = { SGTL5000_CHIP_ANA_ADC_CTRL, 8, 1, 0, capture_6db_attenuate), SOC_SINGLE("Capture ZC Switch", SGTL5000_CHIP_ANA_CTRL, 1, 1, 0), + SOC_SINGLE("Capture Switch", SGTL5000_CHIP_ANA_CTRL, 0, 1, 1), SOC_DOUBLE_TLV("Headphone Playback Volume", SGTL5000_CHIP_ANA_HP_CTRL, From patchwork Tue Jun 25 07:49:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Suvorov X-Patchwork-Id: 11014979 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8D6F86C5 for ; Tue, 25 Jun 2019 07:59:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 81D65288EA for ; Tue, 25 Jun 2019 07:59:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7443B28A0A; Tue, 25 Jun 2019 07:59:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 48F9D288EA for ; Tue, 25 Jun 2019 07:59:44 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 9627F1668; Tue, 25 Jun 2019 09:52:23 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 9627F1668 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1561449193; bh=tZcYVxVnyqf3CEHqnMgx2Xx7bALIteHoUB5fNb4/WNM=; h=From:To:Date:References:In-Reply-To:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=pvS0nBwPDQN5krejRO2KVy2KtOtJqzfCcxnt+th17ma5WwjCkKpglac6El3c+IHYL kPqxomDq4tePnaP6ZJdwxhXmp7H9p40FSO9S6sXoHF8SWrv9UQ/P5BmIPU2XFbVIYS NzjoSXLTlAyfExtWyer582LtFefRdQLy8vuNIEpI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id D1105F89732; Tue, 25 Jun 2019 09:50:03 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id EB503F89721; Tue, 25 Jun 2019 09:49:56 +0200 (CEST) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140137.outbound.protection.outlook.com [40.107.14.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id D845EF896FD for ; Tue, 25 Jun 2019 09:49:53 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D845EF896FD Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=toradex.com header.i=@toradex.com header.b="JBO9nOnr" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toradex.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gf5nvvR9LrPigaH67L4LIaaoXletuhguZISx8ggsOa4=; b=JBO9nOnrs8rDGBf8WFyddXyiP5G7Qmq4MkiF7LViPV7c1S1UCHHtbj5/dTBaUqA9/97BC/fzXrXzo468HphNjNrbdq7L3QAj5KgJYfVTPM6rm8QosmkT22M6REyajduoZ4umxMltNhkowPenRxgUoDwWRmQM96QG6TVWZdA18I0= Received: from AM6PR05MB6535.eurprd05.prod.outlook.com (20.179.18.16) by AM6PR05MB5352.eurprd05.prod.outlook.com (20.177.197.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2008.13; Tue, 25 Jun 2019 07:49:51 +0000 Received: from AM6PR05MB6535.eurprd05.prod.outlook.com ([fe80::2c23:fdba:9ce4:7397]) by AM6PR05MB6535.eurprd05.prod.outlook.com ([fe80::2c23:fdba:9ce4:7397%7]) with mapi id 15.20.2008.007; Tue, 25 Jun 2019 07:49:51 +0000 From: Oleksandr Suvorov To: Fabio Estevam Thread-Topic: [PATCH v2 3/6] ASoC: sgtl5000: Fix of unmute outputs on probe Thread-Index: AQHVKyqRNsGfUx+RZUSiM76rxvu/oA== Date: Tue, 25 Jun 2019 07:49:51 +0000 Message-ID: <20190625074937.2621-4-oleksandr.suvorov@toradex.com> References: <20190625074937.2621-1-oleksandr.suvorov@toradex.com> In-Reply-To: <20190625074937.2621-1-oleksandr.suvorov@toradex.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM0PR0402CA0005.eurprd04.prod.outlook.com (2603:10a6:208:15::18) To AM6PR05MB6535.eurprd05.prod.outlook.com (2603:10a6:20b:71::16) authentication-results: spf=none (sender IP is ) smtp.mailfrom=oleksandr.suvorov@toradex.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-originating-ip: [194.105.145.90] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 16ec7df5-ea4b-435a-04af-08d6f941b42c x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:AM6PR05MB5352; x-ms-traffictypediagnostic: AM6PR05MB5352: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2657; x-forefront-prvs: 0079056367 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(366004)(346002)(396003)(136003)(39850400004)(376002)(199004)(189003)(26005)(5660300002)(1076003)(54906003)(71190400001)(1411001)(71200400001)(2906002)(36756003)(305945005)(86362001)(53936002)(6486002)(8676002)(478600001)(6512007)(25786009)(50226002)(14454004)(6436002)(6116002)(3846002)(7736002)(316002)(68736007)(44832011)(486006)(476003)(2616005)(66556008)(81166006)(4326008)(6916009)(256004)(66476007)(81156014)(64756008)(66446008)(8936002)(66946007)(73956011)(14444005)(386003)(102836004)(6506007)(52116002)(11346002)(446003)(76176011)(99286004)(186003)(66066001); DIR:OUT; SFP:1102; SCL:1; SRVR:AM6PR05MB5352; H:AM6PR05MB6535.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: toradex.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: e8vGEqrjFDSxcrrFXRbFXdP2cYQe2SN4412HMLbTB5ISTREtw9IBGmAS7ohwtUF/otKOACXlgphI7blzcHRmyKFhJwY03MqJMe9WxylMW6GHHdPbw1BuQi/LshaA2uYTbzx6/R9wmiqxSQIWlZaEUW7j21Lwg6CV0bzFlZ2G2MbN0R7sGOTAWXkPZceGJwVpzJLcKB/eB70KuNf/1iqiOpAdsTGjSFUqiit0gzxraA6hI/iKaXY2Lj0FyzINrUFazT/+74qIIBBbue3vdSntXk5X/JTyT+Wdi/gxo7PqUm6OOUIBA4XrSXQ6C17lesQk5itDMU+cveLSV/14IfkgActqTQSUV19ODWNiYPPb+7J1iauvyJNElEdlgS/u8iJhm3LH/v8Gsvl6vsDkD6Dwh81pam2ogbXxSd4qjPpg1nU= MIME-Version: 1.0 X-OriginatorOrg: toradex.com X-MS-Exchange-CrossTenant-Network-Message-Id: 16ec7df5-ea4b-435a-04af-08d6f941b42c X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Jun 2019 07:49:51.2326 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: d9995866-0d9b-4251-8315-093f062abab4 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: oleksandr.suvorov@toradex.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB5352 Cc: Igor Opaniuk , Liam Girdwood , Marcel Ziswiler , Takashi Iwai , "alsa-devel@alsa-project.org" , "linux-kernel@vger.kernel.org" , Oleksandr Suvorov , Mark Brown Subject: [alsa-devel] [PATCH v2 3/6] ASoC: sgtl5000: Fix of unmute outputs on probe X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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" X-Virus-Scanned: ClamAV using ClamSMTP To enable "zero cross detect" for ADC/HP, change HP_ZCD_EN/ADC_ZCD_EN bits only instead of writing the whole CHIP_ANA_CTRL register. Signed-off-by: Oleksandr Suvorov Reviewed-by: Igor Opaniuk --- sound/soc/codecs/sgtl5000.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index bb58c997c6914..e813a37910af4 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c @@ -1289,6 +1289,7 @@ static int sgtl5000_probe(struct snd_soc_component *component) int ret; u16 reg; struct sgtl5000_priv *sgtl5000 = snd_soc_component_get_drvdata(component); + unsigned int zcd_mask = SGTL5000_HP_ZCD_EN | SGTL5000_ADC_ZCD_EN; /* power up sgtl5000 */ ret = sgtl5000_set_power_regs(component); @@ -1316,9 +1317,8 @@ static int sgtl5000_probe(struct snd_soc_component *component) 0x1f); snd_soc_component_write(component, SGTL5000_CHIP_PAD_STRENGTH, reg); - snd_soc_component_write(component, SGTL5000_CHIP_ANA_CTRL, - SGTL5000_HP_ZCD_EN | - SGTL5000_ADC_ZCD_EN); + snd_soc_component_update_bits(component, SGTL5000_CHIP_ANA_CTRL, + zcd_mask, zcd_mask); snd_soc_component_update_bits(component, SGTL5000_CHIP_MIC_CTRL, SGTL5000_BIAS_R_MASK, From patchwork Tue Jun 25 07:49:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Suvorov X-Patchwork-Id: 11014993 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 762F814BB for ; Tue, 25 Jun 2019 08:04:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 687AE28686 for ; Tue, 25 Jun 2019 08:04:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5873828A0A; Tue, 25 Jun 2019 08:04:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9D35B28686 for ; Tue, 25 Jun 2019 08:04:45 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 9593F1687; Tue, 25 Jun 2019 09:53:09 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 9593F1687 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1561449239; bh=MMyF+KnAxgDefkjjLRTQsaIbVUxJGB4dQRhqUqw/PXo=; h=From:To:Date:References:In-Reply-To:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ZUvDrNDW4pefDFbwxlUhPNpmSC6htC+9+NFLxlGCuonSOBA0IlBDmCCarI1KAGZfE LrAdw9TroM1ftEfGuKUITGRGc5jumkx5xkHAbp7qiPNowvBNdow+YgwmUchQ2U7fdc UghfYh3Wv4oXJSzCHRdDvArgs6SUBGnXeDBBvc0k= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 42B5CF8973E; Tue, 25 Jun 2019 09:50:06 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3154BF89730; Tue, 25 Jun 2019 09:49:58 +0200 (CEST) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140137.outbound.protection.outlook.com [40.107.14.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 38705F896F9 for ; Tue, 25 Jun 2019 09:49:55 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 38705F896F9 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=toradex.com header.i=@toradex.com header.b="tdIt9xu7" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toradex.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LRYYtmonHvUYBlSVfDtQqNr2C/uSAPqA/UDX95NWOc0=; b=tdIt9xu7f1hdMGuCMugHWpx5ZSReOxSQjZbo+DO0pRpSkVveytxvI2CcTbkInN2nhwZmibr2Qf7TWFRLutLf9Ontms22uF8p/U3kVkAOw1jYFYB2Tq87nr8ocnWDZJgoD7i/KNF5blHERsVdC0eogqhDnDk9HccYkVm6MLqQoOQ= Received: from AM6PR05MB6535.eurprd05.prod.outlook.com (20.179.18.16) by AM6PR05MB5352.eurprd05.prod.outlook.com (20.177.197.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2008.13; Tue, 25 Jun 2019 07:49:53 +0000 Received: from AM6PR05MB6535.eurprd05.prod.outlook.com ([fe80::2c23:fdba:9ce4:7397]) by AM6PR05MB6535.eurprd05.prod.outlook.com ([fe80::2c23:fdba:9ce4:7397%7]) with mapi id 15.20.2008.007; Tue, 25 Jun 2019 07:49:53 +0000 From: Oleksandr Suvorov To: Fabio Estevam Thread-Topic: [PATCH v2 4/6] ASoC: sgtl5000: Fix charge pump source assignment Thread-Index: AQHVKyqSr5wMwMJHy0K1cP447Sh3EA== Date: Tue, 25 Jun 2019 07:49:52 +0000 Message-ID: <20190625074937.2621-5-oleksandr.suvorov@toradex.com> References: <20190625074937.2621-1-oleksandr.suvorov@toradex.com> In-Reply-To: <20190625074937.2621-1-oleksandr.suvorov@toradex.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM0PR06CA0078.eurprd06.prod.outlook.com (2603:10a6:208:fa::19) To AM6PR05MB6535.eurprd05.prod.outlook.com (2603:10a6:20b:71::16) authentication-results: spf=none (sender IP is ) smtp.mailfrom=oleksandr.suvorov@toradex.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-originating-ip: [194.105.145.90] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: d3bb7b01-6c20-4153-cfed-08d6f941b52e x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:AM6PR05MB5352; x-ms-traffictypediagnostic: AM6PR05MB5352: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2276; x-forefront-prvs: 0079056367 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(366004)(346002)(396003)(136003)(39850400004)(376002)(199004)(189003)(26005)(5660300002)(1076003)(54906003)(71190400001)(1411001)(71200400001)(2906002)(36756003)(305945005)(86362001)(53936002)(6486002)(8676002)(478600001)(6512007)(25786009)(50226002)(14454004)(6436002)(6116002)(3846002)(7736002)(316002)(68736007)(44832011)(486006)(476003)(2616005)(66556008)(81166006)(4326008)(6916009)(256004)(66476007)(81156014)(64756008)(66446008)(8936002)(66946007)(73956011)(386003)(102836004)(6506007)(52116002)(11346002)(446003)(76176011)(99286004)(186003)(66066001); DIR:OUT; SFP:1102; SCL:1; SRVR:AM6PR05MB5352; H:AM6PR05MB6535.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: toradex.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: ef6ANZ1qvLppuojL7sNZv/S8kWvL1O5Fp95SpeRnmj6Sn5WLDYOuX16l0hcZoX0dY+AjFFNP18xMa+Nm2b2gmbuhsNd5bbM6GwYPzUkxAdnIWBoiQ1SHeJ/pj3TfYENOdtNsJF8/ZOm1N3JReNJ9IUuUcRWH7BebYIfDVW/n9U3cwwFlaAHYI/65cXUh6vJ/wto8WTEhIzEaxMH11rQwhAAdFhfd70v1jSTtgSYFEt6LBCru1DC2yvnJRoG3q+uJqgAEzwvd/Pt2NuEpTrsrWWT1ynA6wzRKwAzrYeNMAugKdMhCUO5WJSt2vbUqzMPsarpxtYVBUWOaXt7yE5Y0pUg7uvhPiqJx798fKMSfdloBiEyL+kOTLKnisE7yitLVC/KWMrC2uPlm08bMJEtKpU3hJMDSQQAR9fcFr36oeUQ= MIME-Version: 1.0 X-OriginatorOrg: toradex.com X-MS-Exchange-CrossTenant-Network-Message-Id: d3bb7b01-6c20-4153-cfed-08d6f941b52e X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Jun 2019 07:49:52.9587 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: d9995866-0d9b-4251-8315-093f062abab4 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: oleksandr.suvorov@toradex.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB5352 Cc: Igor Opaniuk , Liam Girdwood , Marcel Ziswiler , Takashi Iwai , "alsa-devel@alsa-project.org" , "linux-kernel@vger.kernel.org" , Oleksandr Suvorov , Mark Brown Subject: [alsa-devel] [PATCH v2 4/6] ASoC: sgtl5000: Fix charge pump source assignment X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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" X-Virus-Scanned: ClamAV using ClamSMTP If VDDA != VDDIO and any of them is greater than 3.1V, charge pump source can be assigned automatically. Signed-off-by: Oleksandr Suvorov Reviewed-by: Igor Opaniuk --- sound/soc/codecs/sgtl5000.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index e813a37910af4..ee1e4bf613227 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c @@ -1174,12 +1174,16 @@ static int sgtl5000_set_power_regs(struct snd_soc_component *component) SGTL5000_INT_OSC_EN); /* Enable VDDC charge pump */ ana_pwr |= SGTL5000_VDDC_CHRGPMP_POWERUP; - } else if (vddio >= 3100 && vdda >= 3100) { + } else { ana_pwr &= ~SGTL5000_VDDC_CHRGPMP_POWERUP; - /* VDDC use VDDIO rail */ - lreg_ctrl |= SGTL5000_VDDC_ASSN_OVRD; - lreg_ctrl |= SGTL5000_VDDC_MAN_ASSN_VDDIO << - SGTL5000_VDDC_MAN_ASSN_SHIFT; + /* if vddio == vdda the source of charge pump should be + * assigned manually to VDDIO + */ + if (vddio == vdda) { + lreg_ctrl |= SGTL5000_VDDC_ASSN_OVRD; + lreg_ctrl |= SGTL5000_VDDC_MAN_ASSN_VDDIO << + SGTL5000_VDDC_MAN_ASSN_SHIFT; + } } snd_soc_component_write(component, SGTL5000_CHIP_LINREG_CTRL, lreg_ctrl); From patchwork Tue Jun 25 07:49:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Suvorov X-Patchwork-Id: 11014997 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B1623924 for ; Tue, 25 Jun 2019 08:04:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A495F28686 for ; Tue, 25 Jun 2019 08:04:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9932428A04; Tue, 25 Jun 2019 08:04:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9D479289B4 for ; Tue, 25 Jun 2019 08:04:45 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 322779F6; Tue, 25 Jun 2019 09:53:41 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 322779F6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1561449271; bh=j6+q1dOr0DHiY+JDNp0oUhLhvLjOYoZKKOLbmrOUWs0=; h=From:To:Date:References:In-Reply-To:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Z3HTsAGAJvc2LtieE1iXeCsY5pJdxlBNH2OUszyj10IaAXbe4i2cu7zW7gsXeDygA 4coo8V0iJXj6WL1apKhDGIRrUsyLWya/ykjhLb+yfy40aTlWnKyKQOPojJbUjgSxWB rN/k4lEuhIjp8Eg086Fn7bH1KP4eCE/NaRvA+ir4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 14714F89745; Tue, 25 Jun 2019 09:50:08 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 7D091F89731; Tue, 25 Jun 2019 09:49:59 +0200 (CEST) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140137.outbound.protection.outlook.com [40.107.14.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 83CA5F89716 for ; Tue, 25 Jun 2019 09:49:56 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 83CA5F89716 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=toradex.com header.i=@toradex.com header.b="CPcPXxyr" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toradex.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dlrYSI6NJNMzc5F5VtbWjDtAr+NLewjZB+1Lvsa2+kE=; b=CPcPXxyrd8YvBJmlSclq/cOfzrZG7qj8kIldUHV/tJBn+r87zfULZe3Xic8bp82q2s4DuWH7wWX1qf/DsW5HnnnYPh1YQN2r8QTB1nDaa6nqwzpo9xm9BY/XVI8uH6H3Y4NEX4fLMFybkdzc0+HmiFpEkdW3zOp6M5+E7lPn8PI= Received: from AM6PR05MB6535.eurprd05.prod.outlook.com (20.179.18.16) by AM6PR05MB5352.eurprd05.prod.outlook.com (20.177.197.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2008.13; Tue, 25 Jun 2019 07:49:54 +0000 Received: from AM6PR05MB6535.eurprd05.prod.outlook.com ([fe80::2c23:fdba:9ce4:7397]) by AM6PR05MB6535.eurprd05.prod.outlook.com ([fe80::2c23:fdba:9ce4:7397%7]) with mapi id 15.20.2008.007; Tue, 25 Jun 2019 07:49:54 +0000 From: Oleksandr Suvorov To: Fabio Estevam Thread-Topic: [PATCH v2 5/6] ASoC: Define a set of DAPM pre/post-up events Thread-Index: AQHVKyqTBIBQWMm3EkqLR+kyuDcDbg== Date: Tue, 25 Jun 2019 07:49:54 +0000 Message-ID: <20190625074937.2621-6-oleksandr.suvorov@toradex.com> References: <20190625074937.2621-1-oleksandr.suvorov@toradex.com> In-Reply-To: <20190625074937.2621-1-oleksandr.suvorov@toradex.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM0PR06CA0099.eurprd06.prod.outlook.com (2603:10a6:208:fa::40) To AM6PR05MB6535.eurprd05.prod.outlook.com (2603:10a6:20b:71::16) authentication-results: spf=none (sender IP is ) smtp.mailfrom=oleksandr.suvorov@toradex.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-originating-ip: [194.105.145.90] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 6672e5bf-c7e1-4735-05fe-08d6f941b60b x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:AM6PR05MB5352; x-ms-traffictypediagnostic: AM6PR05MB5352: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1227; x-forefront-prvs: 0079056367 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(366004)(346002)(396003)(136003)(39850400004)(376002)(199004)(189003)(26005)(5660300002)(1076003)(54906003)(71190400001)(1411001)(71200400001)(2906002)(4744005)(36756003)(305945005)(86362001)(53936002)(6486002)(8676002)(478600001)(6512007)(25786009)(50226002)(14454004)(6436002)(6116002)(3846002)(7736002)(316002)(68736007)(44832011)(486006)(476003)(2616005)(66556008)(81166006)(4326008)(6916009)(256004)(66476007)(81156014)(64756008)(66446008)(8936002)(66946007)(73956011)(386003)(102836004)(6506007)(52116002)(11346002)(446003)(76176011)(99286004)(186003)(66066001); DIR:OUT; SFP:1102; SCL:1; SRVR:AM6PR05MB5352; H:AM6PR05MB6535.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: toradex.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: zmoKYidnks2WQtSDY0VwOyWRoB89F5I0H60ctVz4NnORnDeZRkS9onWfGrRrwS/ZkN+w+B6Y1zcI2lqTV1EqNWn/H2XJ6PDIxSGrVAczs1chq/xOsXIaWQY0jhZFOIXGFHZekDUr2vgju2XW4+mrTx96d3YvZ5OEJoJgTCmPDUJX8WhQoDPZpswA8oYycFvRC51LGlXOMn/wunBJEabrObO6W45XPig7yB47eeVtZQmMaTTT6NSeCIL5VsdmClsYUWM/6ZGFrO9wAL8+etZG8c+HZzvIQE5MTmDghFGt/jgLQ22HcvPUmny1bU3zWby5hdHyb9Jk4gtj95sHhQs8xBIc6ZGewW+50W5wDmgLVhXEuJNDfkLa3D/7v2VLv+1YSQbJH5iwdQju0EP/fiw2Pbg43O5JZBFwEZbVO9z4kOM= MIME-Version: 1.0 X-OriginatorOrg: toradex.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6672e5bf-c7e1-4735-05fe-08d6f941b60b X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Jun 2019 07:49:54.3629 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: d9995866-0d9b-4251-8315-093f062abab4 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: oleksandr.suvorov@toradex.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB5352 Cc: Igor Opaniuk , Liam Girdwood , Marcel Ziswiler , Takashi Iwai , "alsa-devel@alsa-project.org" , "linux-kernel@vger.kernel.org" , Oleksandr Suvorov , Mark Brown Subject: [alsa-devel] [PATCH v2 5/6] ASoC: Define a set of DAPM pre/post-up events X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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" X-Virus-Scanned: ClamAV using ClamSMTP Prepare to use SND_SOC_DAPM_PRE_POST_PMU definition to reduce coming code size and make it more readable. Signed-off-by: Oleksandr Suvorov Reviewed-by: Igor Opaniuk --- include/sound/soc-dapm.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index c00a0b8ade086..6c66941601307 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h @@ -353,6 +353,8 @@ struct device; #define SND_SOC_DAPM_WILL_PMD 0x80 /* called at start of sequence */ #define SND_SOC_DAPM_PRE_POST_PMD \ (SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD) +#define SND_SOC_DAPM_PRE_POST_PMU \ + (SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU) /* convenience event type detection */ #define SND_SOC_DAPM_EVENT_ON(e) \ From patchwork Tue Jun 25 07:49:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Suvorov X-Patchwork-Id: 11014995 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1DFEE14B6 for ; Tue, 25 Jun 2019 08:04:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0FBAE28686 for ; Tue, 25 Jun 2019 08:04:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0393128A06; Tue, 25 Jun 2019 08:04:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7A9A728A04 for ; Tue, 25 Jun 2019 08:04:45 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 802E1166A; Tue, 25 Jun 2019 09:54:12 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 802E1166A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1561449302; bh=Gppt+nMHSI/LHNFXw5SlgK6t74mZVKtwdgILfObt5iU=; h=From:To:Date:References:In-Reply-To:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=mA04bEUvUg8ORBYuzI8nw3oKH3Qb8GdwM8Vz+BX5QXtJQG+PmysJXscGRAOIb/H4V 7Y5UXlhsP3ZxIXfc6vbPJGZWOisVyzB6eCtY+qTI501vRK1hfGAzk7sdC2OPV+NwaZ gbY/IbOnBtbz9g8M1TGUtTfCPClADtUmxmPCmHUw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id A6B2EF8974A; Tue, 25 Jun 2019 09:50:09 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3DEB4F89731; Tue, 25 Jun 2019 09:50:01 +0200 (CEST) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140137.outbound.protection.outlook.com [40.107.14.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C5E4EF89719 for ; Tue, 25 Jun 2019 09:49:57 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C5E4EF89719 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=toradex.com header.i=@toradex.com header.b="Zl6qnbqt" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toradex.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KxFY9FFtPp2Oc06t8dNQ4Sc83o+ecTZNPFSLh8StZao=; b=Zl6qnbqtlGZInjf42AE5UyVNbPxgT7Cl6vdWW6kOpS+L9Ol5wOcxSpPINd/gyrNHnmBzGDZibOsK4H7RG0bcg3Z99go3kVmXpYH1tyNC9Mq+3q80jewixoI6RlfBkob0HXBBUG8uf4yeW9ng2stIbJD3sHIay0Tj0EELaIf58Qc= Received: from AM6PR05MB6535.eurprd05.prod.outlook.com (20.179.18.16) by AM6PR05MB5352.eurprd05.prod.outlook.com (20.177.197.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2008.13; Tue, 25 Jun 2019 07:49:56 +0000 Received: from AM6PR05MB6535.eurprd05.prod.outlook.com ([fe80::2c23:fdba:9ce4:7397]) by AM6PR05MB6535.eurprd05.prod.outlook.com ([fe80::2c23:fdba:9ce4:7397%7]) with mapi id 15.20.2008.007; Tue, 25 Jun 2019 07:49:56 +0000 From: Oleksandr Suvorov To: Fabio Estevam Thread-Topic: [PATCH v2 6/6] ASoC: sgtl5000: Improve VAG power and mute control Thread-Index: AQHVKyqUql0vzju0UkSHkCtX1cvVEg== Date: Tue, 25 Jun 2019 07:49:55 +0000 Message-ID: <20190625074937.2621-7-oleksandr.suvorov@toradex.com> References: <20190625074937.2621-1-oleksandr.suvorov@toradex.com> In-Reply-To: <20190625074937.2621-1-oleksandr.suvorov@toradex.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM0PR06CA0080.eurprd06.prod.outlook.com (2603:10a6:208:fa::21) To AM6PR05MB6535.eurprd05.prod.outlook.com (2603:10a6:20b:71::16) authentication-results: spf=none (sender IP is ) smtp.mailfrom=oleksandr.suvorov@toradex.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-originating-ip: [194.105.145.90] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: db2b49b0-66a4-4cf3-3fe8-08d6f941b6ee x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:AM6PR05MB5352; x-ms-traffictypediagnostic: AM6PR05MB5352: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-forefront-prvs: 0079056367 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(366004)(346002)(396003)(136003)(39850400004)(376002)(199004)(189003)(26005)(5660300002)(1076003)(54906003)(71190400001)(1411001)(71200400001)(2906002)(36756003)(305945005)(86362001)(53936002)(6486002)(8676002)(478600001)(6512007)(25786009)(50226002)(14454004)(6436002)(6116002)(3846002)(7736002)(316002)(68736007)(44832011)(486006)(476003)(2616005)(66556008)(81166006)(4326008)(6916009)(256004)(66476007)(81156014)(64756008)(66446008)(8936002)(66946007)(73956011)(14444005)(386003)(102836004)(6506007)(52116002)(11346002)(446003)(76176011)(99286004)(186003)(66066001); DIR:OUT; SFP:1102; SCL:1; SRVR:AM6PR05MB5352; H:AM6PR05MB6535.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: toradex.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: fh69sYwzs+ldoR7MrDlolLqEk4Csuq88k98xfSJxGnriMEHZ61qv5Iv1VxheREF0OiuEnf1gurPSuFYe5wgEfWFPVY4UTLv0+NGVLzTkXEH9kVyGL6C0DYRQPzOgIEDLqYN6PfNBJjDl0pIpmYuhvR92mqmDA+8lNT/iDcDhL2aJ27gVMH342/KOXTBScR6L2IBu+Qjm2fVxNkDtiE8RPmDW07+6A3aUfWi6WE3nvaW0/BpG/C1v+D6PU2rP/Af2pbdJxM8/4790AEgFYGtPJcjceKZ+61R60CTBRLApw6ohdShNzovZxyTcM4VQUVm9zj/nKEV0hvd77Eld3zXDBQ44S/+grp5AV80TiyQ1WIDCLwnhyBW+Lv1nqliGGCJiQWxDiVxfG2XIx2gHq1ZnGKk7xZC8eO2uX0T6yHLfc9I= MIME-Version: 1.0 X-OriginatorOrg: toradex.com X-MS-Exchange-CrossTenant-Network-Message-Id: db2b49b0-66a4-4cf3-3fe8-08d6f941b6ee X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Jun 2019 07:49:55.8760 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: d9995866-0d9b-4251-8315-093f062abab4 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: oleksandr.suvorov@toradex.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB5352 Cc: Igor Opaniuk , Liam Girdwood , Marcel Ziswiler , Takashi Iwai , "alsa-devel@alsa-project.org" , "linux-kernel@vger.kernel.org" , Oleksandr Suvorov , Mark Brown Subject: [alsa-devel] [PATCH v2 6/6] ASoC: sgtl5000: Improve VAG power and mute control X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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" X-Virus-Scanned: ClamAV using ClamSMTP Change VAG power on/off control according to the following algorithm: - turn VAG power ON on the 1st incoming event. - keep it ON if there is any active VAG consumer (ADC/DAC/HP/Line-In). - turn VAG power OFF when there is the latest consumer's pre-down event come. - always delay after VAG power OFF to avoid pop. - delay after VAG power ON if the initiative consumer is Line-In, this prevents pop during line-in muxing. Also, according to the manual, to avoid any pops/clicks, the outputs should be muted during input/output routing changes. Signed-off-by: Oleksandr Suvorov --- sound/soc/codecs/sgtl5000.c | 227 +++++++++++++++++++++++++++++++----- 1 file changed, 195 insertions(+), 32 deletions(-) diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index ee1e4bf613227..acfbd5cdf936e 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c @@ -31,6 +31,13 @@ #define SGTL5000_DAP_REG_OFFSET 0x0100 #define SGTL5000_MAX_REG_OFFSET 0x013A +/* Delay for the VAG ramp up */ +#define SGTL5000_VAG_POWERUP_DELAY 500 /* ms */ +/* Delay for the VAG ramp down */ +#define SGTL5000_VAG_POWERDOWN_DELAY 500 /* ms */ + +#define SGTL5000_OUTPUTS_MUTE (SGTL5000_HP_MUTE | SGTL5000_LINE_OUT_MUTE) + /* default value of sgtl5000 registers */ static const struct reg_default sgtl5000_reg_defaults[] = { { SGTL5000_CHIP_DIG_POWER, 0x0000 }, @@ -123,6 +130,18 @@ enum { I2S_SCLK_STRENGTH_HIGH, }; +enum { + HP_POWER_EVENT, + DAC_POWER_EVENT, + ADC_POWER_EVENT +}; + +struct sgtl5000_mute_state { + u16 hp_event; + u16 dac_event; + u16 adc_event; +}; + /* sgtl5000 private structure in codec */ struct sgtl5000_priv { int sysclk; /* sysclk rate */ @@ -137,8 +156,109 @@ struct sgtl5000_priv { u8 micbias_voltage; u8 lrclk_strength; u8 sclk_strength; + struct sgtl5000_mute_state mute_state; }; +static inline int hp_sel_input(struct snd_soc_component *component) +{ + return (snd_soc_component_read32(component, SGTL5000_CHIP_ANA_CTRL) & + SGTL5000_HP_SEL_MASK) >> SGTL5000_HP_SEL_SHIFT; +} + +static inline u16 mute_output(struct snd_soc_component *component, + u16 mute_mask) +{ + u16 mute_reg = snd_soc_component_read32(component, + SGTL5000_CHIP_ANA_CTRL); + + snd_soc_component_update_bits(component, SGTL5000_CHIP_ANA_CTRL, + mute_mask, mute_mask); + return mute_reg; +} + +static inline void restore_output(struct snd_soc_component *component, + u16 mute_mask, u16 mute_reg) +{ + snd_soc_component_update_bits(component, SGTL5000_CHIP_ANA_CTRL, + mute_mask, mute_reg); +} + +static void vag_power_on(struct snd_soc_component *component, u32 source) +{ + if (snd_soc_component_read32(component, SGTL5000_CHIP_ANA_POWER) & + SGTL5000_VAG_POWERUP) + return; + + snd_soc_component_update_bits(component, SGTL5000_CHIP_ANA_POWER, + SGTL5000_VAG_POWERUP, SGTL5000_VAG_POWERUP); + + /* When VAG powering on to get local loop from Line-In, the sleep + * is required to avoid loud pop. + */ + if (hp_sel_input(component) == SGTL5000_HP_SEL_LINE_IN && + source == HP_POWER_EVENT) + msleep(SGTL5000_VAG_POWERUP_DELAY); +} + +static int vag_power_consumers(struct snd_soc_component *component, + u16 ana_pwr_reg, u32 source) +{ + int consumers = 0; + + /* count dac/adc consumers unconditional */ + if (ana_pwr_reg & SGTL5000_DAC_POWERUP) + consumers++; + if (ana_pwr_reg & SGTL5000_ADC_POWERUP) + consumers++; + + /* + * If the event comes from HP and Line-In is selected, + * current action is 'DAC to be powered down'. + * As HP_POWERUP is not set when HP muxed to line-in, + * we need to keep VAG power ON. + */ + if (source == HP_POWER_EVENT) { + if (hp_sel_input(component) == SGTL5000_HP_SEL_LINE_IN) + consumers++; + } else { + if (ana_pwr_reg & SGTL5000_HP_POWERUP) + consumers++; + } + + return consumers; +} + +static void vag_power_off(struct snd_soc_component *component, u32 source) +{ + u16 ana_pwr = snd_soc_component_read32(component, + SGTL5000_CHIP_ANA_POWER); + + if (!(ana_pwr & SGTL5000_VAG_POWERUP)) + return; + + /* + * This function calls when any of VAG power consumers is disappearing. + * Thus, if there is more than one consumer at the moment, as minimum + * one consumer will definitely stay after the end of the current + * event. + * Don't clear VAG_POWERUP if 2 or more consumers of VAG present: + * - LINE_IN (for HP events) / HP (for DAC/ADC events) + * - DAC + * - ADC + * (the current consumer is disappearing right now) + */ + if (vag_power_consumers(component, ana_pwr, source) >= 2) + return; + + snd_soc_component_update_bits(component, SGTL5000_CHIP_ANA_POWER, + SGTL5000_VAG_POWERUP, 0); + /* In power down case, we need wait 400-1000 ms + * when VAG fully ramped down. + * As longer we wait, as smaller pop we've got. + */ + msleep(SGTL5000_VAG_POWERDOWN_DELAY); +} + /* * mic_bias power on/off share the same register bits with * output impedance of mic bias, when power on mic bias, we @@ -170,40 +290,79 @@ static int mic_bias_event(struct snd_soc_dapm_widget *w, return 0; } -/* - * As manual described, ADC/DAC only works when VAG powerup, - * So enabled VAG before ADC/DAC up. - * In power down case, we need wait 400ms when vag fully ramped down. - */ -static int power_vag_event(struct snd_soc_dapm_widget *w, - struct snd_kcontrol *kcontrol, int event) +static void vag_and_mute_control(struct snd_soc_component *component, + int event, int event_source, + u16 mute_mask, u16 *mute_reg) { - struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); - const u32 mask = SGTL5000_DAC_POWERUP | SGTL5000_ADC_POWERUP; - switch (event) { - case SND_SOC_DAPM_POST_PMU: - snd_soc_component_update_bits(component, SGTL5000_CHIP_ANA_POWER, - SGTL5000_VAG_POWERUP, SGTL5000_VAG_POWERUP); - msleep(400); + case SND_SOC_DAPM_PRE_PMU: + *mute_reg = mute_output(component, mute_mask); + break; + case SND_SOC_DAPM_POST_PMU: + vag_power_on(component, event_source); + restore_output(component, mute_mask, *mute_reg); break; - case SND_SOC_DAPM_PRE_PMD: - /* - * Don't clear VAG_POWERUP, when both DAC and ADC are - * operational to prevent inadvertently starving the - * other one of them. - */ - if ((snd_soc_component_read32(component, SGTL5000_CHIP_ANA_POWER) & - mask) != mask) { - snd_soc_component_update_bits(component, SGTL5000_CHIP_ANA_POWER, - SGTL5000_VAG_POWERUP, 0); - msleep(400); - } + *mute_reg = mute_output(component, mute_mask); + vag_power_off(component, event_source); + break; + case SND_SOC_DAPM_POST_PMD: + restore_output(component, mute_mask, *mute_reg); break; default: break; } +} + +/* + * Mute Headphone when power it up/down. + * Control VAG power on HP power path. + */ +static int headphone_pga_event(struct snd_soc_dapm_widget *w, + struct snd_kcontrol *kcontrol, int event) +{ + struct snd_soc_component *component = + snd_soc_dapm_to_component(w->dapm); + struct sgtl5000_priv *sgtl5000 = + snd_soc_component_get_drvdata(component); + + vag_and_mute_control(component, event, HP_POWER_EVENT, + SGTL5000_HP_MUTE, + &sgtl5000->mute_state.hp_event); + + return 0; +} + +/* As manual describes, ADC/DAC powering up/down requires + * to mute outputs to avoid pops. + * Control VAG power on ADC/DAC power path. + */ +static int adc_updown_depop(struct snd_soc_dapm_widget *w, + struct snd_kcontrol *kcontrol, int event) +{ + struct snd_soc_component *component = + snd_soc_dapm_to_component(w->dapm); + struct sgtl5000_priv *sgtl5000 = + snd_soc_component_get_drvdata(component); + + vag_and_mute_control(component, event, ADC_POWER_EVENT, + SGTL5000_OUTPUTS_MUTE, + &sgtl5000->mute_state.adc_event); + + return 0; +} + +static int dac_updown_depop(struct snd_soc_dapm_widget *w, + struct snd_kcontrol *kcontrol, int event) +{ + struct snd_soc_component *component = + snd_soc_dapm_to_component(w->dapm); + struct sgtl5000_priv *sgtl5000 = + snd_soc_component_get_drvdata(component); + + vag_and_mute_control(component, event, DAC_POWER_EVENT, + SGTL5000_OUTPUTS_MUTE, + &sgtl5000->mute_state.dac_event); return 0; } @@ -280,7 +439,10 @@ static const struct snd_soc_dapm_widget sgtl5000_dapm_widgets[] = { mic_bias_event, SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), - SND_SOC_DAPM_PGA("HP", SGTL5000_CHIP_ANA_POWER, 4, 0, NULL, 0), + SND_SOC_DAPM_PGA_E("HP", SGTL5000_CHIP_ANA_POWER, 4, 0, NULL, 0, + headphone_pga_event, + SND_SOC_DAPM_PRE_POST_PMU | + SND_SOC_DAPM_PRE_POST_PMD), SND_SOC_DAPM_PGA("LO", SGTL5000_CHIP_ANA_POWER, 0, 0, NULL, 0), SND_SOC_DAPM_MUX("Capture Mux", SND_SOC_NOPM, 0, 0, &adc_mux), @@ -301,11 +463,12 @@ static const struct snd_soc_dapm_widget sgtl5000_dapm_widgets[] = { 0, SGTL5000_CHIP_DIG_POWER, 1, 0), - SND_SOC_DAPM_ADC("ADC", "Capture", SGTL5000_CHIP_ANA_POWER, 1, 0), - SND_SOC_DAPM_DAC("DAC", "Playback", SGTL5000_CHIP_ANA_POWER, 3, 0), - - SND_SOC_DAPM_PRE("VAG_POWER_PRE", power_vag_event), - SND_SOC_DAPM_POST("VAG_POWER_POST", power_vag_event), + SND_SOC_DAPM_ADC_E("ADC", "Capture", SGTL5000_CHIP_ANA_POWER, 1, 0, + adc_updown_depop, SND_SOC_DAPM_PRE_POST_PMU | + SND_SOC_DAPM_PRE_POST_PMD), + SND_SOC_DAPM_DAC_E("DAC", "Playback", SGTL5000_CHIP_ANA_POWER, 3, 0, + dac_updown_depop, SND_SOC_DAPM_PRE_POST_PMU | + SND_SOC_DAPM_PRE_POST_PMD), }; /* routes for sgtl5000 */