From patchwork Fri Oct 25 13:05:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 177744 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp3671681ill; Fri, 25 Oct 2019 06:05:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqwNrWv9c/EN4MwQN4iiOgKYBGrmj98FPHeqP9frzms37qI+pEbKTsoVgewcSrgaK49j19yP X-Received: by 2002:adf:a506:: with SMTP id i6mr2878884wrb.159.1572008727827; Fri, 25 Oct 2019 06:05:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572008727; cv=none; d=google.com; s=arc-20160816; b=GDoqOPfeNl89vZ+YuDGAKyfC2VkRZtJlvw4fBQW7yU9BlTqBJhpNxqYDTExus4yoPO fu/2F89AftgRWaYKkdwHCHC/1mW8A5zUsYoUYqbf/LoZ4wSpwE0aC2Om261iFJEYrHat ZHYJFQpMypTMS9N/wJqQlNlyX2TvrPZOA0HFxmIwcN78RPwMIcNR1YO84r+w2gF0xUli bBx/4saOm+dNT6WcZ1mfIO2PbxaD5z+Htl/ugn87uIuwRNkLH0r4SiRawTW8EvTS0jbe sB40avTSqtXJ98YVjGq6kPgE5ULpHB2FLhoAks9XSVcee3GqnUh8KazmkALBROpJX1Ln nlBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :cc:mime-version:message-id:date:to:from:dkim-signature:dkim-filter :delivered-to:dkim-signature:dkim-filter; bh=wNpw9IJVNTe/9WEZvzGk+ha0LM7q0SkUAs8boDbF/iM=; b=BWRmNkNPPASXdLUKsLxNesLwh0ZAuXZYo/f2BZAkkZtazHrY+nDPu8Tl791h+BI3sK ahcD4BZFzdleMHw3rxRuUAid4ubmsA4oml5i485S3AvzthrDKecY7VDGFVfFclf4VCng darIMjRm+z/+Bsx0ocfltd1uJgcw9Dn+YT3iRt/LOiplALqeBtz47Cs/YqPg/Ivo97zC ARy84Yi87Q/hcojT7PGs29S55+IP5qq42OIWW6vpVh+/I4htsdC7MnCqVxN0CkNBrdd4 zhOYaqjyckOGOV48phSeYtrSVxFEvsltPgJRAv4dCIWAW6q3lQNTX/jA6ix+9yuPmEIi pqvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alsa-project.org header.s=default header.b=pzOKuMqt; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=h+WU6R17; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTPS id v16si1952975wrp.352.2019.10.25.06.05.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Oct 2019 06:05:27 -0700 (PDT) Received-SPF: pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) client-ip=77.48.224.243; Authentication-Results: mx.google.com; dkim=pass header.i=@alsa-project.org header.s=default header.b=pzOKuMqt; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=h+WU6R17; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com 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 EC0D517C9; Fri, 25 Oct 2019 15:04:36 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz EC0D517C9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1572008727; bh=kN0Nc9POSTcAdfsjgk4QFJMdxtRcjnV3laSl3kSFlh8=; h=From:To:Date:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=pzOKuMqtpj05JkGobHMtXNKzcZBbSwcS1WQhSsAZXPUaOPe9aTNtElRhYKvgyIM5Y JOm8mPhXLzbtgL1PaSEy3EVQut02uxo+00obBHVwHPtBocnnnK2c1a7GYWWXBtttxS X5Knj92VxZ4xUzjrmtiop5OGT5nI1na6mDT2/trI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 7F81CF802A0; Fri, 25 Oct 2019 15:04:36 +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 151C2F80368; Fri, 25 Oct 2019 15:04:35 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, PRX_BODY_78, SPF_HELO_NONE, SPF_PASS, SURBL_BLOCKED, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) (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 5BB96F80112 for ; Fri, 25 Oct 2019 15:04:30 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5BB96F80112 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="h+WU6R17" Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x9PD4Sdu038853; Fri, 25 Oct 2019 08:04:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1572008668; bh=P8Jbxp8qjaqsqyxiwg7v1ZgSDea+4jE9jJMRCXAvkR8=; h=From:To:CC:Subject:Date; b=h+WU6R17jWYt97uthCjwtEBlE6p9TDWiUn3OhVRcJ3b/kYR65sxmZDdlWORQo8q46 1Pz4yw3CEalTdcYUTkkCDUK9N9GUnMPW++/eGhl+RX3DK/NatL4M4Co+JjacXMl6p4 rH640bY7xGvpas4sudRPlgzFDuFBOwYoYKslfEpI= Received: from DLEE105.ent.ti.com (dlee105.ent.ti.com [157.170.170.35]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x9PD4SWD082929 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 25 Oct 2019 08:04:28 -0500 Received: from DLEE112.ent.ti.com (157.170.170.23) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Fri, 25 Oct 2019 08:04:17 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Fri, 25 Oct 2019 08:04:17 -0500 Received: from feketebors.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id x9PD4PfJ092315; Fri, 25 Oct 2019 08:04:25 -0500 From: Peter Ujfalusi To: , , Date: Fri, 25 Oct 2019 16:05:28 +0300 Message-ID: <20191025130528.3556-1-peter.ujfalusi@ti.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Cc: tony@atomide.com, hns@goldelico.com, alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH v2] ASoC: ti: omap-mcpdm: Add support for pdmclk clock handling 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" McPDM module receives it's functional clock from external source. This clock is the pdmclk provided by the twl6040 audio IC. If the clock is not available all register accesses to McPDM fails and the module is not operational. Signed-off-by: Peter Ujfalusi Acked-by: Jarkko Nikula --- Hi, this has been lurking in my next-wip branch for some time... It might not needed anymore as I have not heard about issues with McPDM for a while. It was dropped back then because some core parts were not picked in time and this caused some issues, but can not find the exact reason Regards, Peter sound/soc/ti/omap-mcpdm.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) -- Peter Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/sound/soc/ti/omap-mcpdm.c b/sound/soc/ti/omap-mcpdm.c index b8c8290265c7..2c536947b69f 100644 --- a/sound/soc/ti/omap-mcpdm.c +++ b/sound/soc/ti/omap-mcpdm.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -42,6 +43,7 @@ struct omap_mcpdm { int irq; struct pm_qos_request pm_qos_req; int latency[2]; + struct clk *pdmclk; struct mutex mutex; @@ -416,6 +418,10 @@ static int omap_mcpdm_probe(struct snd_soc_dai *dai) struct omap_mcpdm *mcpdm = snd_soc_dai_get_drvdata(dai); int ret; + ret = clk_prepare_enable(mcpdm->pdmclk); + if (ret) + return ret; + pm_runtime_enable(mcpdm->dev); /* Disable lines while request is ongoing */ @@ -454,6 +460,7 @@ static int omap_mcpdm_remove(struct snd_soc_dai *dai) if (pm_qos_request_active(&mcpdm->pm_qos_req)) pm_qos_remove_request(&mcpdm->pm_qos_req); + clk_disable_unprepare(mcpdm->pdmclk); return 0; } @@ -473,12 +480,19 @@ static int omap_mcpdm_suspend(struct snd_soc_dai *dai) mcpdm->pm_active_count++; } + clk_disable_unprepare(mcpdm->pdmclk); + return 0; } static int omap_mcpdm_resume(struct snd_soc_dai *dai) { struct omap_mcpdm *mcpdm = snd_soc_dai_get_drvdata(dai); + int ret; + + ret = clk_prepare_enable(mcpdm->pdmclk); + if (ret) + return ret; if (mcpdm->pm_active_count) { while (mcpdm->pm_active_count--) @@ -573,6 +587,15 @@ static int asoc_mcpdm_probe(struct platform_device *pdev) mcpdm->dev = &pdev->dev; + mcpdm->pdmclk = devm_clk_get(&pdev->dev, "pdmclk"); + if (IS_ERR(mcpdm->pdmclk)) { + if (PTR_ERR(mcpdm->pdmclk) == -EPROBE_DEFER) + return -EPROBE_DEFER; + dev_warn(&pdev->dev, "Error getting pdmclk (%ld)!\n", + PTR_ERR(mcpdm->pdmclk)); + mcpdm->pdmclk = NULL; + } + ret = devm_snd_soc_register_component(&pdev->dev, &omap_mcpdm_component, &omap_mcpdm_dai, 1);