From patchwork Tue May 21 10:36:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Suvorov X-Patchwork-Id: 10953369 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 A8DC613AD for ; Tue, 21 May 2019 10:38:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 976BB289B4 for ; Tue, 21 May 2019 10:38:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8AE691FFF9; Tue, 21 May 2019 10:38:28 +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 2F3F31FFF9 for ; Tue, 21 May 2019 10:38:27 +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 59799165E; Tue, 21 May 2019 12:37:33 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 59799165E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1558435103; bh=1b/P5t1dUCRkhCIXBqyHBAqvD0+bXzvsm4MaSVu7OnA=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=tKn690PwlgVy/X3auFKi0FtfzQk+cWTbHfp1sCkbiiYG4UcMSGjGk3khhK+CfnmU4 uI+urYRHaY/hyqokc+2LCbLW46nMHAwsL/mY1Aiy6Ebw72DxG2DZ2c/egwhSc+kLQt sGkbGqYtLjg3wjwQ5YQuEFewxYnEInEDS3iPcEUs= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 0C277F89717; Tue, 21 May 2019 12:36:42 +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 1BED6F806E7; Tue, 21 May 2019 12:36:38 +0200 (CEST) Received: from mail-ed1-f68.google.com (mail-ed1-f68.google.com [209.85.208.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 30E65F806E7 for ; Tue, 21 May 2019 12:36:34 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 30E65F806E7 Received: by mail-ed1-f68.google.com with SMTP id p27so28699478eda.1 for ; Tue, 21 May 2019 03:36:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version; bh=g5+rFA36lwuazIudpaXXvHQFCY1jZEBw2F/UUKE3ovM=; b=JQqX+V2edjlPxJM5P0ytqg90RAW84ObPHpEf5x+HUa5SMzFQYeiEDzCZ/6VQbr4C7X QimzWbgYRJ6gL1D4vp6EkctMy2hyiiMCVUe5pP4BgB9PE56NF/lPO9ipx4THXVtU2z5y nKxv5sv/Dg7HTyvZkzXnQJr1RDNCqmeHZN3qMaAC29DWY0lGsK8kWFe1b5n1M7EPL6Cv CioNJMefJ8oMNNRQLaagH9GzuS7iwLLODw95v8mqqovd6osZa6mnfipBppptkDkdSSDr b4frwVe3sBTZ6ETpjYHaGcWQ5oeBA4rF98cJDA0JOQ6a7zMo8NLV2P/Q7Uq67VSbGBbj 0JNQ== X-Gm-Message-State: APjAAAUWBluQQddcbjQPXhuuug4jyAjb7CDIXhLpSOJRNj15aFkY7Qtx 6K49aiVJuKpGXC/47OxWEG9sgSOiPANXNbipZT66hm8b6ylGxxR3+bC8tH/meO2mmKI1bJlUkNQ nThoIfwEuu4tRIgk= X-Google-Smtp-Source: APXvYqxl2DSayF5AxGHApfnVwCqMXNZzKr/pm83PpOr142/+wqSpO8m+LjGWdsy0o8mJwheCqi8M9g== X-Received: by 2002:a50:a5fb:: with SMTP id b56mr81501952edc.262.1558434993795; Tue, 21 May 2019 03:36:33 -0700 (PDT) Received: from localhost ([194.105.145.90]) by smtp.gmail.com with ESMTPSA id c49sm6303644eda.58.2019.05.21.03.36.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 May 2019 03:36:33 -0700 (PDT) From: Oleksandr Suvorov To: Fabio Estevam Date: Tue, 21 May 2019 13:36:14 +0300 Message-Id: <20190521103619.4707-2-oleksandr.suvorov@toradex.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190521103619.4707-1-oleksandr.suvorov@toradex.com> References: <20190521103619.4707-1-oleksandr.suvorov@toradex.com> MIME-Version: 1.0 Cc: Marcel Ziswiler , Igor Opaniuk , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Oleksandr Suvorov Subject: [alsa-devel] [PATCH v1 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: Marcel Ziswiler --- sound/soc/codecs/sgtl5000.c | 2 +- sound/soc/codecs/sgtl5000.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git sound/soc/codecs/sgtl5000.c sound/soc/codecs/sgtl5000.c index a6a4748c97f9..5e49523ee0b6 100644 --- sound/soc/codecs/sgtl5000.c +++ 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 sound/soc/codecs/sgtl5000.h sound/soc/codecs/sgtl5000.h index 18cae08bbd3a..a4bf4bca95bf 100644 --- sound/soc/codecs/sgtl5000.h +++ 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 May 21 10:36:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Suvorov X-Patchwork-Id: 10953371 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 0DDE376 for ; Tue, 21 May 2019 10:39:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EECCC1FFF9 for ; Tue, 21 May 2019 10:39:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E1F7B289B6; Tue, 21 May 2019 10:39:10 +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 2F73A1FFF9 for ; Tue, 21 May 2019 10:39:10 +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 6EB1F167D; Tue, 21 May 2019 12:38:18 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 6EB1F167D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1558435148; bh=Wkg5TrDtao70VHvG+bcZ6X2cHYXmT0drCEJhlqHp7Dc=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=rgxYbCQgXgW30ojqqsjM7tlyiH8v7LpYNd7xXMa0U0eLy+bJhsn+o+Q9FLAK7BrHS Y+KWfVz/NxRggyEg7I/ba1Az7JJxBjnq8NEaTMlfJZgWokKcMCzrxBByh/HsRCWyTJ eOPDINfgXqKL9Nl7C8JdcVi8znM1a4ZRFN9QkBWQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 6E518F8972C; Tue, 21 May 2019 12:36:46 +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 3957FF89723; Tue, 21 May 2019 12:36:40 +0200 (CEST) Received: from mail-ed1-f65.google.com (mail-ed1-f65.google.com [209.85.208.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 38218F89715 for ; Tue, 21 May 2019 12:36:36 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 38218F89715 Received: by mail-ed1-f65.google.com with SMTP id b8so28604570edm.11 for ; Tue, 21 May 2019 03:36:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version; bh=odw0Br10pd/FID0oLpxhs9oyem6lxu+oPFxMjbKBkEQ=; b=JIBKcAvC4fUfkD0z7SQVP6BY23Ad1GDGy34Mt1sqqV3ICt9994pFzURrAp7Kd1zR8i QuwPT97GTsLRw1nxtMwR1WTXremrJ0rKZTs1uTRRVrFuefPYyu9i7xVbcePdOAKrPItL n6+3s8g/rvS2Dp60ugj4mlb6EstLfwTSJHWopWvdQl1Rv6YgwVCVohmEEEddouw9Y9tT iTdjTC2IFRbnOdF0G7ogS1+v0v4eqhwTuvqCKuNPEYGXytk+3N0SsPeRRjCWHLwcG5Nm bkEI4rP+GIzyUWjuf4M4xIpjatovHuO0NKC9ge+ic+k27eGwcI6ufyROu2TFlH4yOEfJ H92w== X-Gm-Message-State: APjAAAXT7/3vqO43xNnFbAZwSRKd/wOeAjHqlBVmRbPJsK2ruL4w8quT 1PQOH9T3gs+0K95Ektsun49FCFYGk0HrbBbhWyKGEWzdixAIV2ByVStDeKCNGZa0yT6j85T9Ou9 cmhmpwZUr/NvVTyM= X-Google-Smtp-Source: APXvYqybcyoaWgALzKgHnX9qkZKOL1y9QhO/tydUl9gFPtCPfkc2n+gdnaHhGjgsCSNAwAtctNFBuA== X-Received: by 2002:a17:906:90c6:: with SMTP id v6mr40526940ejw.111.1558434996456; Tue, 21 May 2019 03:36:36 -0700 (PDT) Received: from localhost ([194.105.145.90]) by smtp.gmail.com with ESMTPSA id ay6sm3507075ejb.20.2019.05.21.03.36.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 May 2019 03:36:35 -0700 (PDT) From: Oleksandr Suvorov To: Fabio Estevam Date: Tue, 21 May 2019 13:36:15 +0300 Message-Id: <20190521103619.4707-3-oleksandr.suvorov@toradex.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190521103619.4707-1-oleksandr.suvorov@toradex.com> References: <20190521103619.4707-1-oleksandr.suvorov@toradex.com> MIME-Version: 1.0 Cc: Marcel Ziswiler , Igor Opaniuk , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Oleksandr Suvorov Subject: [alsa-devel] [PATCH v1 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: Marcel Ziswiler --- sound/soc/codecs/sgtl5000.c | 1 + 1 file changed, 1 insertion(+) diff --git sound/soc/codecs/sgtl5000.c sound/soc/codecs/sgtl5000.c index 5e49523ee0b6..bb58c997c691 100644 --- sound/soc/codecs/sgtl5000.c +++ 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 May 21 10:36:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Suvorov X-Patchwork-Id: 10953373 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 D48B013AD for ; Tue, 21 May 2019 10:39:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C1E031FFF9 for ; Tue, 21 May 2019 10:39:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B4B90289B6; Tue, 21 May 2019 10:39:52 +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 0949B1FFF9 for ; Tue, 21 May 2019 10:39:52 +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 6538B1677; Tue, 21 May 2019 12:39:00 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 6538B1677 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1558435190; bh=DZC9hSRob0P0wlHlIo//j4wIJBctiQ9fuG2CowQWXUI=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=sfKUjgKxQUONr2yrZ1Bqwn7/PxuFBjtcjXU4F2lehRgv9ayIYCPEwmBr9a2WVT1rq 7nrAX1SVUnqDbvms0dyQ0tuKZxNAvPhE//QpkOZ4sL/NZfMJaKsgn78nqcRxoyfBTh h54j+jckXGa0GnRt0K7N7gxUTW+H8Z0sg/LCQAd4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 6BC61F89730; Tue, 21 May 2019 12:36:48 +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 60A83F89725; Tue, 21 May 2019 12:36:42 +0200 (CEST) Received: from mail-ed1-f65.google.com (mail-ed1-f65.google.com [209.85.208.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id E040AF89709 for ; Tue, 21 May 2019 12:36:38 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E040AF89709 Received: by mail-ed1-f65.google.com with SMTP id m4so28632914edd.8 for ; Tue, 21 May 2019 03:36:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version; bh=iCa3sIkXRS0MUvhZrMU0I1kSnN7S8DExfC/yTx1vxTA=; b=jt+nxCO7qy6GGh9Ib9nAMxuqGn2OoYVnzgXFUYftSYntmVpDb9MzesTlmNsu50dBmJ nOQY/IveCcxUsJHy4x/y41qjHUAKx7M4exGlAvdUE3b6YSqLP8YRXy9qlWRnAk6pAJdJ RY1foHFC/Kg1ur0TGaKMzQZWdUyQjdkw8ivW67F83hX/wfgPuqZX40sNj035VYZgUDSD KSuvuwj3zSp1ls7s8ENs9cRcqp+qw4msLvuYJLF0j+27JkVYluTASZduuJTqia2t0VSI yXo3VKorxf2gkUwn6ZuAJOXOQkjQLBnYusHxyNPRZYOfOHmf0lfCI3VqMMa99270TZ5x FxdA== X-Gm-Message-State: APjAAAUBmqGXopFt4nKQuEJ8RVjXKX/QAjCnuGvSGmjJ32Yckiq3SXY2 X4PxtHrITwMaFs0ZuqVuKFQMkPbJUCZ0Mso6kZDL2eyWOqVLVb5b+ZCo2kvz/XHNR7Nc5NLuHNa y4R5U5frjfL2eBOg= X-Google-Smtp-Source: APXvYqxeWQK82QeOi5z+lBMdAAErKeezVrdKlYCVRXGcKGYFNE9+MsqmQD8PS6/9oZTtpGtxLKg45A== X-Received: by 2002:a17:906:22d8:: with SMTP id q24mr62970353eja.261.1558434997802; Tue, 21 May 2019 03:36:37 -0700 (PDT) Received: from localhost ([194.105.145.90]) by smtp.gmail.com with ESMTPSA id e43sm6202423edb.38.2019.05.21.03.36.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 May 2019 03:36:37 -0700 (PDT) From: Oleksandr Suvorov To: Fabio Estevam Date: Tue, 21 May 2019 13:36:16 +0300 Message-Id: <20190521103619.4707-4-oleksandr.suvorov@toradex.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190521103619.4707-1-oleksandr.suvorov@toradex.com> References: <20190521103619.4707-1-oleksandr.suvorov@toradex.com> MIME-Version: 1.0 Cc: Marcel Ziswiler , Igor Opaniuk , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Oleksandr Suvorov Subject: [alsa-devel] [PATCH v1 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: Marcel Ziswiler --- sound/soc/codecs/sgtl5000.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git sound/soc/codecs/sgtl5000.c sound/soc/codecs/sgtl5000.c index bb58c997c691..e813a37910af 100644 --- sound/soc/codecs/sgtl5000.c +++ 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 May 21 10:36:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Suvorov X-Patchwork-Id: 10953375 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 A112C76 for ; Tue, 21 May 2019 10:40:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8FF5A28714 for ; Tue, 21 May 2019 10:40:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8278F28990; Tue, 21 May 2019 10:40:30 +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 C5F9C28714 for ; Tue, 21 May 2019 10:40:29 +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 06EE4167F; Tue, 21 May 2019 12:39:38 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 06EE4167F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1558435228; bh=QIXoo3JuxZSdgOyDDAcWhaeEzNYB8OpWzYGH9fl5FQg=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=NkHSnbl0BlAzVMx6f72dnArD/tB+tYUIpHeRI3YrvcyaZtv0X33qdZquj9UahvFwF BJ36VKNHeS62A7GMcZ3TdlrM0XUswavzdAw4Go+hfzjM2X2hOrqmygk0VSh7kIUD3E 7yUUf088HvT3uS5u3HGRlLEOPmM7H8z5rZLXJHgk= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 594F7F89733; Tue, 21 May 2019 12:36:50 +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 779C7F8972A; Tue, 21 May 2019 12:36:44 +0200 (CEST) Received: from mail-ed1-f67.google.com (mail-ed1-f67.google.com [209.85.208.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 1AD56F89715 for ; Tue, 21 May 2019 12:36:39 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 1AD56F89715 Received: by mail-ed1-f67.google.com with SMTP id w11so28617079edl.5 for ; Tue, 21 May 2019 03:36:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version; bh=8RfPufMa3HqwhdEyx05OxfiupMkKyekwoF0H9MJSyDg=; b=RwUwA7ntDFMODq5VXYvIgNQBnl8zOdgHsyjpt7229XsTw8oJGHyjEtNVqXoJYgwpr2 AHO9U3Hsk0su0ADXC9qUMIEcYzeJBgyCCmXiUTnWYySL/JCY37mjn+ldm/OkOcV0kEC4 uNlvVpGAeRh3jKu9IIJBpvLGapy9k8qpSIKHN+rThR/+SJNIU4BhFWJYYEiTBbHLBkvt V56kNY71jDYpGX39tPreAInnbwn8WLnkbtCpSCVRqUR4oAc/8OvaI//ZU8lTcAparCie qFWmw1dVRFDXgqjRRSKOU/dtiiINpQidFEIi+xCWrW6Sa8QWqhm29vbsVXyOxqAwjOeT 2aiA== X-Gm-Message-State: APjAAAW5dqxh3ZnHTYxpyaY/17OHtGtNOpYNAlu52Lc9A/q77PJ8fSxA XP7c1KJwgvMJBg/mrzX5PoMInLNvqoIb3bCeBWZnwRUT1O/B/ucJAvbkF4rq7kQVu3Kze6Xu7Mi RLfGofgkBIUiMgx8= X-Google-Smtp-Source: APXvYqzvSL/hShohKCzVE7yqXSTyYlRnEwlsVmuEB6NTByIayC3kwlFUvM+IPASXPZk8yT2yog7+ag== X-Received: by 2002:a17:906:eca3:: with SMTP id qh3mr31146094ejb.139.1558434999212; Tue, 21 May 2019 03:36:39 -0700 (PDT) Received: from localhost ([194.105.145.90]) by smtp.gmail.com with ESMTPSA id g11sm6207876eda.42.2019.05.21.03.36.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 May 2019 03:36:38 -0700 (PDT) From: Oleksandr Suvorov To: Fabio Estevam Date: Tue, 21 May 2019 13:36:17 +0300 Message-Id: <20190521103619.4707-5-oleksandr.suvorov@toradex.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190521103619.4707-1-oleksandr.suvorov@toradex.com> References: <20190521103619.4707-1-oleksandr.suvorov@toradex.com> MIME-Version: 1.0 Cc: Marcel Ziswiler , Igor Opaniuk , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Oleksandr Suvorov Subject: [alsa-devel] [PATCH v1 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: Marcel Ziswiler --- sound/soc/codecs/sgtl5000.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git sound/soc/codecs/sgtl5000.c sound/soc/codecs/sgtl5000.c index e813a37910af..ee1e4bf61322 100644 --- sound/soc/codecs/sgtl5000.c +++ 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 May 21 10:36:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Suvorov X-Patchwork-Id: 10953377 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 9ACAC13AD for ; Tue, 21 May 2019 10:41:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 87C89289B5 for ; Tue, 21 May 2019 10:41:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7C186289B8; Tue, 21 May 2019 10:41:05 +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 C9515289B5 for ; Tue, 21 May 2019 10:41:04 +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 31A9B167C; Tue, 21 May 2019 12:40:12 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 31A9B167C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1558435262; bh=kfkzZVKRcYGbsZobuOmDfvaZV/lzsYkl/rnA/0QA2A0=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=WOIeTe0Na4f8+pbSlvU/TUhCgphWwrOJSK8F3CoHckTPm0orn1XbmbuXX6gBevZrb nPz40viDPoVZqgkCN7FOUOX7w6Y1rwOZDynahSITW2WvjpXIWAar80hmzA+qJLIUaM budXJnyf6iwU1rj1ODQP3kf01S43gOqsZrziPNes= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id CBCB6F89739; Tue, 21 May 2019 12:36:51 +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 D9CCBF8972D; Tue, 21 May 2019 12:36:45 +0200 (CEST) Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 9FB95F89709 for ; Tue, 21 May 2019 12:36:41 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9FB95F89709 Received: by mail-ed1-f52.google.com with SMTP id w37so28654684edw.4 for ; Tue, 21 May 2019 03:36:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version; bh=WylUw4wo5vM+M15++6VSkI9SZq4ULyzzIp7SQ2Wc8DM=; b=tlDcOpuTb4zUGElMzJEz8U4U5qWsbB47+iHfxglp/4EoazJwcYs7bD2OP31Fg93uvq Gmygnv4aNeUJ7c9OjbQm+8w8k5s0JGK2DXX9h66Dm5sN+MxNeEkK1EPmRpTh7DTkcQqk 9C2Q44mRE8gOL7AXx4MDx3z36nk7OD4aRc3zrwWoLlpDGUAH7p/Ne9aoRRVftAw1MDk9 HGSiNnU/kESuDEGtiSmxej8g9n3dqadbMHUn9mYuADUAtmIe5A+pEQ/RRRDkKJcEIKoA QXg+3omNhXFziSOHNueSksRl0s/qleT9G2cTnsK2yG2FoP/3hJ6P8SLKwIda1LOTkye7 pr7w== X-Gm-Message-State: APjAAAV1QKKulYdy/scSj68vSv0Sm5e1OrSWoU0OoHXe52oa0UGTzPZW annwKCUVx7awSW4VIwQ5buw8taiT4Ieh27n2L93VzlNmWovChS5Mo6CMMPXTzUJpot0qSSCP7QK 2ZglWlG5xXeEuJM9x/4VC X-Google-Smtp-Source: APXvYqxSOa2oON0KK+1w6bVqEDQDP5+bCZW1+KQrM92fr0fjjSQ6TMlD8gJY8HRJghhdLjC22eCW/w== X-Received: by 2002:aa7:d381:: with SMTP id x1mr649159edq.251.1558435000706; Tue, 21 May 2019 03:36:40 -0700 (PDT) Received: from localhost ([194.105.145.90]) by smtp.gmail.com with ESMTPSA id z10sm6186868edl.35.2019.05.21.03.36.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 May 2019 03:36:40 -0700 (PDT) From: Oleksandr Suvorov To: Fabio Estevam Date: Tue, 21 May 2019 13:36:18 +0300 Message-Id: <20190521103619.4707-6-oleksandr.suvorov@toradex.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190521103619.4707-1-oleksandr.suvorov@toradex.com> References: <20190521103619.4707-1-oleksandr.suvorov@toradex.com> MIME-Version: 1.0 Cc: Igor Opaniuk , Marcel Ziswiler , Takashi Iwai , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Oleksandr Suvorov Subject: [alsa-devel] [PATCH v1 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: Marcel Ziswiler --- include/sound/soc-dapm.h | 2 ++ 1 file changed, 2 insertions(+) diff --git include/sound/soc-dapm.h include/sound/soc-dapm.h index c00a0b8ade08..6c6694160130 100644 --- include/sound/soc-dapm.h +++ 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 May 21 10:36:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Suvorov X-Patchwork-Id: 10953379 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 2EE3313AD for ; Tue, 21 May 2019 10:41:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1B1C2289B6 for ; Tue, 21 May 2019 10:41:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0F4A8289B9; Tue, 21 May 2019 10:41:56 +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 EBFC3289B6 for ; Tue, 21 May 2019 10:41:54 +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 4100B1684; Tue, 21 May 2019 12:41:03 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 4100B1684 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1558435313; bh=DuI2Chuwk7YKOlQ4PqUgEEkPYAbv/ybuc58BCHJNNL0=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=r1CkATOR4ZfgLfgkzGRMV9E5AszsS8fAy2hFyMAT/SbMknzaQWS3TMKO3m4Ivzwnk SGMtvHbqkie+INWp2LFKXsPu4GfRtlaL/xWgel5beG7wc67jLDsmFrcM996OpcC9V3 HMT1PKfbkdd3mA44Oqp8upxeXJXnEQTRDzLLSWCw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 1E381F89742; Tue, 21 May 2019 12:36:54 +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 5BF05F8972F; Tue, 21 May 2019 12:36:47 +0200 (CEST) Received: from mail-ed1-f68.google.com (mail-ed1-f68.google.com [209.85.208.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id A6012F89715 for ; Tue, 21 May 2019 12:36:43 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A6012F89715 Received: by mail-ed1-f68.google.com with SMTP id g57so28582939edc.12 for ; Tue, 21 May 2019 03:36:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version; bh=ih+G5+5xmK3laHPu3IW4bYDJd0PnWnJ1DIhtQ82Xn9o=; b=r6ZgjndwZ8Rn6IiJiz8N9z2EugHxgfjlQpDeixWeQx24BVmqV38kqV+XCEy7RdKpQc aTbzBEpzMNxVPmWgmIjRj/NgMfoPQ/pTwTh8Ycsdr1ZfgeYxr2IW6mdFo1j5v4sQ/eK6 VAI+nQZ5VpWgzuOXWoHf5OQmhkI7AW5+3IL/OGdMTx27HrMI5wklLofpSWannZHVxbuZ H9SZC/GjBjBkuyn8LLy8Q+SiWwDMkN6fu0UrX1vkBZojq94LlHT2+I+m5w7hCnyGYvBa srQDLS4HTkZtsZVImM2e/fzxSFPcfAhrFQng/AJCMXDEiaqIls2+K71tyPWafLdeCD7r raBg== X-Gm-Message-State: APjAAAW+wxj4CTD7x3TC0DR86M50GXjz/j3iJAE6sWD+CVbuY0OeVpCx 9eDIov6WDva3Ju9FfzWf2Dl8DcVvxQ/5cfydvH1Zc3j1ZGz960tikttEnOnAD6VVByOLgncmdn6 /MM/HOnMeaE0svvs= X-Google-Smtp-Source: APXvYqzBHu2dFZVYuawszloisc4WD7CU3XjtQYyuleGraJbN1gaGBje/O7IrW8UsGnRpK/kYwytFKA== X-Received: by 2002:a50:a7a5:: with SMTP id i34mr35365150edc.294.1558435002374; Tue, 21 May 2019 03:36:42 -0700 (PDT) Received: from localhost ([194.105.145.90]) by smtp.gmail.com with ESMTPSA id k12sm3456746eja.52.2019.05.21.03.36.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 May 2019 03:36:41 -0700 (PDT) From: Oleksandr Suvorov To: Fabio Estevam Date: Tue, 21 May 2019 13:36:19 +0300 Message-Id: <20190521103619.4707-7-oleksandr.suvorov@toradex.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190521103619.4707-1-oleksandr.suvorov@toradex.com> References: <20190521103619.4707-1-oleksandr.suvorov@toradex.com> MIME-Version: 1.0 Cc: Marcel Ziswiler , Igor Opaniuk , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Oleksandr Suvorov Subject: [alsa-devel] [PATCH v1 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 Reviewed-by: Marcel Ziswiler --- sound/soc/codecs/sgtl5000.c | 227 +++++++++++++++++++++++++++++++----- 1 file changed, 195 insertions(+), 32 deletions(-) diff --git sound/soc/codecs/sgtl5000.c sound/soc/codecs/sgtl5000.c index ee1e4bf61322..acfbd5cdf936 100644 --- sound/soc/codecs/sgtl5000.c +++ 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 */