From patchwork Mon Apr 27 18:56:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dexter Travis X-Patchwork-Id: 192837 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B885C47247 for ; Thu, 30 Apr 2020 16:55:18 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5E2232082E for ; Thu, 30 Apr 2020 16:55:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="EXovP3t4"; dkim=pass (1024-bit key) header.d=precisionplanting.com header.i=@precisionplanting.com header.b="Cd6Y+Bf2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5E2232082E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=precisionplanting.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org 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 72F11168A; Thu, 30 Apr 2020 18:54:25 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 72F11168A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1588265715; bh=3nbzN8b/v6WOvQSfh5xDqWF0BlNAi4K2dvCxHPL0yLw=; h=From:Date:Subject:To:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=EXovP3t4ZTWqocMdRNDbY7GjZ8S/DOytxUESMjZSzCk5Sj9NxJC1I7KJ2hPEoXS65 yf2kBuPBS/P3g0813xNTXvfMTxZ2IBpT7QChHl9fFvPOOVpahT6gqhg2x8sxa5399E em8iPklNrfTfqE0qMlXM2a8GflJ1/+IJtQUtGsPA= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 2408CF801EB; Thu, 30 Apr 2020 18:53:46 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8722EF8022B; Mon, 27 Apr 2020 20:56:27 +0200 (CEST) Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) (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 1F319F8010A for ; Mon, 27 Apr 2020 20:56:23 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 1F319F8010A Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=precisionplanting.com header.i=@precisionplanting.com header.b="Cd6Y+Bf2" Received: by mail-lj1-x241.google.com with SMTP id b2so18734798ljp.4 for ; Mon, 27 Apr 2020 11:56:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=precisionplanting.com; s=google; h=mime-version:from:date:message-id:subject:to; bh=/n7qv9HbwDzkub85m1jyet2gduljAqZALR9QK1oMMUI=; b=Cd6Y+Bf2D+YN+MIt/MFA+DKzvbxqujv0waY0/nyHFiSsLSp8cuCfDHLBdJAzt3vymM s3pgFPyjBkjPIx3p2Mc5aXAgKp8g+JU/S5QbyRevuOCCJd6Cs1+Cv2mPrIwPVLi3L4JX V4w+l45x0YNUT4TXpIIvRnuVhU8n7MgiJ7+Gg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=/n7qv9HbwDzkub85m1jyet2gduljAqZALR9QK1oMMUI=; b=MYy/qFotW1dJqX1jt4wnecoXNyAaIseUFipYfEkzXROecbmj1D5adOF2SAoIjh83hc MhhMrSs638Q5qBX4whFb2jvucrUylkbPPUGqUF7Jr+DjZ1h8n1jyNxQIIt1v+tlPka2l Xs9pv+9BqHuv1DRKomXqocqNCLHRe6rWmiothLmig51ksJqMxmuEOh2xtr+36iX3/keU 1O8yDC+XOGeOe30p0pohF8KYaIY2XVE+m6AnRyt+4DIQ/EZwgAGbB6CfwXgDo4xJktHo gPuiuI15IA7nxJ6MngFOfGOC0YyFSw5O85zNd4x9IkGb3RLB8IeQVVkcJCDd+vLVfBJR A7vA== X-Gm-Message-State: AGi0PubAU17BU3eNOhwmQ0xTeIBRYslzx9hfzL8m4hKq80OA/Te4WGOf Mmm0xDpV4Senw34KW5ndk1aJESeW4QAI/Po6wgJlsPYksIcCBQ== X-Google-Smtp-Source: APiQypK2Y/pSSKPqB4N9EVHg/QmEzeliK59N2OuXTrkzjW3HXkffaqN9CpR38dqyWf8NRFDJXp0uZo792084nVzGACw= X-Received: by 2002:a2e:b4d0:: with SMTP id r16mr15287791ljm.129.1588013781600; Mon, 27 Apr 2020 11:56:21 -0700 (PDT) MIME-Version: 1.0 From: Dexter Travis Date: Mon, 27 Apr 2020 13:56:10 -0500 Message-ID: Subject: TLV320AIC31xx recovery after a SPKVDD power glitch To: alsa-devel@alsa-project.org X-Mailman-Approved-At: Thu, 30 Apr 2020 18:53:43 +0200 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" I have a production agriculture display system using a TLV320AIC3120 for sound output to a speaker built into the monitor. The primary processor is an NXP IMX6 Dual Plus. The system has an internal battery backup but not all voltage rails are backed by the battery. In particular SPKVDD the 5V rail to the TLV320AIC3120 is not backed up. The rest of the voltage rails to this device are backed by battery. After a power glitch we do not emit sound. Using dynamic debug and adding some additional messages to the log It appears the driver is working the same both before and after the power glitch. We developed this a few years ago using the Freescale/NXP (fsl) eureka-tlv320 (with slight modifications for the tlv320aic31xx) and tlv320aic31xx.c drivers. As an experiment i compiled both the eukrea-tlv320 and the tlv320aic31xx drivers as modules. This worked as expected before the glitch. After a glitch if I manually remove the modules and re-insert them sound can be restored. We have a user space application that can detect the power loss and if the loss is persistent will gracefully shutdown the system. When power is restored we would like to use this to tell the driver to perform some kind of restorative action. I have tried triggering through sysfs various resets to the tlv320aic3120 without success. So far only a full module remove of both eukrea and tlv320 will restore sound. remove and re-insert of either driver by itself does not work. I have a few questions and areas where I would like advice. 0) What am i missing or doing wrong? Should I be taking a different approach altogether to this problem? 1) Should I migrate to simple-audio-card instead of eukrea-tlv320? 2) Suggestions on what needs to be reset/restored after the power rail comes back? 3) Suggestions on how best to trigger the reset/restore from either user space or the kernel? Below is the relevant sections of our devicetree. sound { compatible = "eukrea,asoc-tlv320"; eukrea,model = "pp-gen3display-tlv320aic3120"; ssi-controller = <&ssi2>; fsl,mux-int-port = <2>; fsl,mux-ext-port = <3>; clocks = <&clks IMX6QDL_CLK_CKO>; }; &i2c1 { clock-frequency = <100000>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_i2c1>; status = "okay"; tlv320aic3120: tlv320aic3120@18 { reg = <0x18>; }; ... &ssi2 { codec-handle = <&tlv320aic3120>; status = "okay"; }; &audmux { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_audmux>; status = "okay"; }; pinctrl_audmux: audmuxgrp { fsl,pins = < MX6QDL_PAD_CSI0_DAT7__AUD3_RXD 0x130b0 MX6QDL_PAD_CSI0_DAT4__AUD3_TXC 0x130b0 MX6QDL_PAD_CSI0_DAT5__AUD3_TXD 0x110b0 MX6QDL_PAD_CSI0_DAT6__AUD3_TXFS 0x130b0 MX6QDL_PAD_GPIO_2__GPIO1_IO02 0x17059 MX6QDL_PAD_CSI0_MCLK__CCM_CLKO1 0x130b0 >; }; Attached is our changes to the eukrea driver to support the TLV320AIC31xx in our system. Thank you, Dexter Travis >From d68f0e9a8903667d19b9785d53095051071efccb Mon Sep 17 00:00:00 2001 From: Ryan Allgaier Date: Mon, 16 Jan 2017 11:15:19 -0600 Subject: [PATCH] Ongoing changes to support sound cherry-picked from 4.1 --- arch/arm/boot/dts/imx6q-pinfunc.h | 0 sound/soc/fsl/eukrea-tlv320.c | 26 +++++++++++++++++--------- 2 files changed, 17 insertions(+), 9 deletions(-) mode change 100644 => 100755 arch/arm/boot/dts/imx6q-pinfunc.h mode change 100644 => 100755 sound/soc/fsl/eukrea-tlv320.c diff --git a/arch/arm/boot/dts/imx6q-pinfunc.h b/arch/arm/boot/dts/imx6q-pinfunc.h old mode 100644 new mode 100755 diff --git a/sound/soc/fsl/eukrea-tlv320.c b/sound/soc/fsl/eukrea-tlv320.c old mode 100644 new mode 100755 index 84ef6385736c..64f139a04340 --- a/sound/soc/fsl/eukrea-tlv320.c +++ b/sound/soc/fsl/eukrea-tlv320.c @@ -22,17 +22,19 @@ #include #include #include +#include #include #include #include #include #include "../codecs/tlv320aic23.h" +#include "../codecs/tlv320aic31xx.h" #include "imx-ssi.h" #include "fsl_ssi.h" #include "imx-audmux.h" -#define CODEC_CLOCK 12000000 +#define CODEC_CLOCK 24000000 static int eukrea_tlv320_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) @@ -43,7 +45,7 @@ static int eukrea_tlv320_hw_params(struct snd_pcm_substream *substream, int ret; ret = snd_soc_dai_set_sysclk(codec_dai, 0, - CODEC_CLOCK, SND_SOC_CLOCK_OUT); + CODEC_CLOCK, SND_SOC_CLOCK_IN); if (ret) { dev_err(cpu_dai->dev, "Failed to set the codec sysclk.\n"); @@ -69,9 +71,9 @@ static const struct snd_soc_ops eukrea_tlv320_snd_ops = { }; static struct snd_soc_dai_link eukrea_tlv320_dai = { - .name = "tlv320aic23", - .stream_name = "TLV320AIC23", - .codec_dai_name = "tlv320aic23-hifi", + .name = "tlv320aic31xx", + .stream_name = "TLV320AIC31XX", + .codec_dai_name = "tlv320aic31xx-hifi", .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM, .ops = &eukrea_tlv320_snd_ops, @@ -89,6 +91,7 @@ static int eukrea_tlv320_probe(struct platform_device *pdev) int int_port = 0, ext_port; struct device_node *np = pdev->dev.of_node; struct device_node *ssi_np = NULL, *codec_np = NULL; + struct clk *codec_clk = NULL; eukrea_tlv320.dev = &pdev->dev; if (np) { @@ -140,7 +143,7 @@ static int eukrea_tlv320_probe(struct platform_device *pdev) } else { eukrea_tlv320_dai.cpu_dai_name = "imx-ssi.0"; eukrea_tlv320_dai.platform_name = "imx-ssi.0"; - eukrea_tlv320_dai.codec_name = "tlv320aic23-codec.0-001a"; + eukrea_tlv320_dai.codec_name = "tlv320aic31xx-codec.0-0018"; eukrea_tlv320.name = "cpuimx-audio"; } @@ -164,9 +167,6 @@ static int eukrea_tlv320_probe(struct platform_device *pdev) machine_is_eukrea_cpuimx35sd() || machine_is_eukrea_cpuimx51sd() || of_find_compatible_node(NULL, NULL, "fsl,imx31-audmux")) { - if (!np) - ext_port = machine_is_eukrea_cpuimx25sd() ? - 4 : 3; imx_audmux_v2_configure_port(int_port, IMX_AUDMUX_V2_PTCR_SYN | @@ -196,6 +196,14 @@ static int eukrea_tlv320_probe(struct platform_device *pdev) } } + codec_clk = clk_get(eukrea_tlv320.dev, NULL); + if (IS_ERR(codec_clk)) { + dev_err(eukrea_tlv320.dev, + "codec clock missing or invalid\n"); + } else { + clk_prepare_enable(codec_clk); + } + ret = snd_soc_register_card(&eukrea_tlv320); err: if (ret) -- 2.24.1