From patchwork Thu Jul 5 10:08:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 939809 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=devicetree-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sirena.org.uk header.i=@sirena.org.uk header.b="pVP+rsOu"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 41LtqF0v1Fz9s1B for ; Thu, 5 Jul 2018 20:08:40 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753155AbeGEKIj (ORCPT ); Thu, 5 Jul 2018 06:08:39 -0400 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:34138 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753194AbeGEKIi (ORCPT ); Thu, 5 Jul 2018 06:08:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=tB+A8aVS8ag1DcSwPOuI9cKRl6vyA4DGKxOh+DawarE=; b=pVP+rsOuPnTm dfQjmK3RD+SdX0/gQtg+WVpsHRRDvGpG/EbA33c2Q9UAa4ZC8IoRFEE9O7TQNNPYO+ALdSGsA6y4C wsnV1mfij1Cfitx55miyt8FIF8hHaoHqZWwWj5OWEMQY0xbNzo8I21b4qjamgNCBFJFWoYUG6VxFw HI4Cw=; Received: from debutante.sirena.org.uk ([2001:470:1f1d:6b5::3] helo=debutante) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1fb1Bk-0008HB-Eq; Thu, 05 Jul 2018 10:08:36 +0000 Received: from broonie by debutante with local (Exim 4.91) (envelope-from ) id 1fb1Bj-0002sd-KD; Thu, 05 Jul 2018 11:08:35 +0100 From: Mark Brown To: Daniel Mack Cc: Mark Brown , broonie@kernel.org, robh+dt@kernel.org, devicetree@vger.kernel.org, alsa-devel@alsa-project.org, lgirdwood@gmail.com, haojian.zhuang@gmail.com, robert.jarzmik@free.fr, alsa-devel@alsa-project.org Subject: Applied "ASoC: pxa-ssp: add support for an external clock in devicetree" to the asoc tree In-Reply-To: <20180702151100.28999-1-daniel@zonque.org> Message-Id: Date: Thu, 05 Jul 2018 11:08:35 +0100 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org The patch ASoC: pxa-ssp: add support for an external clock in devicetree has been applied to the asoc tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark >From 90eb6b59d311e6facd040124cb5b659a865125b8 Mon Sep 17 00:00:00 2001 From: Daniel Mack Date: Mon, 2 Jul 2018 17:11:00 +0200 Subject: [PATCH] ASoC: pxa-ssp: add support for an external clock in devicetree Allow setting a clock called 'extclk' in the device of the ssp-dai device. If specified, this clock will be set to the mclk rate from the DAI's .set_sysclk() callback. The DAI will also configure itself to use that external clock. Signed-off-by: Daniel Mack Signed-off-by: Mark Brown --- .../bindings/sound/mrvl,pxa-ssp.txt | 8 ++++++ sound/soc/pxa/pxa-ssp.c | 25 +++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/mrvl,pxa-ssp.txt b/Documentation/devicetree/bindings/sound/mrvl,pxa-ssp.txt index 74c9ba6c2823..93b982e9419f 100644 --- a/Documentation/devicetree/bindings/sound/mrvl,pxa-ssp.txt +++ b/Documentation/devicetree/bindings/sound/mrvl,pxa-ssp.txt @@ -5,6 +5,14 @@ Required properties: compatible Must be "mrvl,pxa-ssp-dai" port A phandle reference to a PXA ssp upstream device +Optional properties: + + clock-names + clocks Through "clock-names" and "clocks", external clocks + can be configured. If a clock names "extclk" exists, + it will be set to the mclk rate of the audio stream + and be used as clock provider of the DAI. + Example: /* upstream device */ diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c index ff1e0bd8d407..69033e1a84e6 100644 --- a/sound/soc/pxa/pxa-ssp.c +++ b/sound/soc/pxa/pxa-ssp.c @@ -41,6 +41,7 @@ */ struct ssp_priv { struct ssp_device *ssp; + struct clk *extclk; unsigned long ssp_clk; unsigned int sysclk; unsigned int dai_fmt; @@ -205,6 +206,21 @@ static int pxa_ssp_set_dai_sysclk(struct snd_soc_dai *cpu_dai, u32 sscr0 = pxa_ssp_read_reg(ssp, SSCR0) & ~(SSCR0_ECS | SSCR0_NCS | SSCR0_MOD | SSCR0_ACS); + if (priv->extclk) { + int ret; + + /* + * For DT based boards, if an extclk is given, use it + * here and configure PXA_SSP_CLK_EXT. + */ + + ret = clk_set_rate(priv->extclk, freq); + if (ret < 0) + return ret; + + clk_id = PXA_SSP_CLK_EXT; + } + dev_dbg(&ssp->pdev->dev, "pxa_ssp_set_dai_sysclk id: %d, clk_id %d, freq %u\n", cpu_dai->id, clk_id, freq); @@ -774,6 +790,15 @@ static int pxa_ssp_probe(struct snd_soc_dai *dai) ret = -ENODEV; goto err_priv; } + + priv->extclk = devm_clk_get(dev, "extclk"); + if (IS_ERR(priv->extclk)) { + ret = PTR_ERR(priv->extclk); + if (ret == -EPROBE_DEFER) + return ret; + + priv->extclk = NULL; + } } else { priv->ssp = pxa_ssp_request(dai->id + 1, "SoC audio"); if (priv->ssp == NULL) {