From patchwork Fri Oct 19 12:27:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 149267 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp3241966lji; Fri, 19 Oct 2018 05:27:42 -0700 (PDT) X-Google-Smtp-Source: ACcGV61CYXpZn18ZIXbKkpqroqrs12j/Yd3j+pPljAH4/ijFky5ODlry8wJMaS1s5zisGrtz7qSH X-Received: by 2002:adf:a387:: with SMTP id l7-v6mr36474818wrb.1.1539952062168; Fri, 19 Oct 2018 05:27:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539952062; cv=none; d=google.com; s=arc-20160816; b=BPgRgvbAA42burB+Nr8ikIC5xM2MCgLvObGK7bSPIyuXq8e4W+r1uoBbzqK+CIqmwF ww8zNsP1yzd//WXWA6xtsRSfJfZzLqi764i5QjXdv/DgxT5+KBkbH3CundoyfrpTDpqL 2ZpqCxLAYwQPypXa98bATp2jAK+8qlsaI9lIaP+I4DsLVxCcU//52uyEmNWKMpWI+4eP KrWOwey5c/GKUXTEihZJ98k/R9XP8L/DDEmEH1J0mxLj+e+NPfn0pK5xE0krvFQlLa0S t2QVmJqP5xdzsP4BcNNeC+Uny3qwo1B/C2k5Yt3UYf+dJh7miIw9eCxYmv4ktpJC7vzD BYRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:date:message-id:in-reply-to:to:from :dkim-signature:delivered-to; bh=HQRG5FmbV2PFWx2w+GZBhEAsIeY8vR2aurFPcMpxlPo=; b=yWCi+amb42j3uDXLRDPOXNQq04gu8zk3z6NwadY5HEJZ4PuxafJJH69G7kus9pYdBb eRlXQDFwOOcMrTgSQ77ZzgHx9tk7XloH56oYL0+RW84dv9uJWz3ndzTTnRucWqdMITW6 bZ6B4BoJ4VLnjpTRY98WQaoUWyxiTKHpzfQiS5kYdRZ8bapvzn0rMd03+BJZmNrYjbjL 3fPNKpFhuGpU1rW/Sy6uj+6qLGodQclcOQxq0BFOe1TwWUuZgfJW0T6MTy9jzN0hhj9W Yjq8om7jqBuUY7Ch0tfwj9D4MuGTp/iLnYRLGqjlWJ4NwX1nIajRpLkK47OjovHc5nwb VZIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=xXW8CCCl; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTP id e7-v6si2988414wmf.185.2018.10.19.05.27.41; Fri, 19 Oct 2018 05:27:42 -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=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=xXW8CCCl; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id BA0282679A5; Fri, 19 Oct 2018 14:27:33 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 15ACD2679F8; Fri, 19 Oct 2018 14:27:31 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE autolearn=disabled version=3.4.0 Received: from heliosphere.sirena.org.uk (heliosphere.sirena.org.uk [172.104.155.198]) by alsa0.perex.cz (Postfix) with ESMTP id 070C32679B1 for ; Fri, 19 Oct 2018 14:27:27 +0200 (CEST) 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=z4xOk0Uira2zzXVUISk2neDOHml2VvCHbhF0WeveRQE=; b=xXW8CCClRy8v 7bM43aC0gZiq0qxSBq+eTvu9h9GJT1fLm69di4pUSjDLazhSk7lM5R37X9xk0Y52QjHVUEAal6Fux U0Qb8fr0Et+RdILY984pBbl3ewS0uoI1dkAfb1m9o/V0YYuBbwHxwy0CZQ7mAXKUkOpzHZ5bL79OL 61Ywo=; Received: from cpc102320-sgyl38-2-0-cust46.18-2.cable.virginm.net ([82.37.168.47] helo=debutante.sirena.org.uk) by heliosphere.sirena.org.uk with esmtpa (Exim 4.89) (envelope-from ) id 1gDTsF-0008Vo-L3; Fri, 19 Oct 2018 12:27:27 +0000 Received: by debutante.sirena.org.uk (Postfix, from userid 1000) id 5E7891122548; Fri, 19 Oct 2018 13:27:27 +0100 (BST) From: Mark Brown To: Daniel Mack In-Reply-To: Message-Id: <20181019122727.5E7891122548@debutante.sirena.org.uk> Date: Fri, 19 Oct 2018 13:27:27 +0100 (BST) Cc: alsa-devel@alsa-project.org, Mark Brown Subject: [alsa-devel] Applied "ASoC: sta32x: Add support for XTI clock" to the asoc tree X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org The patch ASoC: sta32x: Add support for XTI clock 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 fce9ec954a8af7e04cbf5b9daa8bec9c1df5cfe6 Mon Sep 17 00:00:00 2001 From: Daniel Mack Date: Wed, 17 Oct 2018 13:37:03 +0200 Subject: [PATCH] ASoC: sta32x: Add support for XTI clock The STA32x chips feature an XTI clock input that needs to be stable before the reset signal is released. Therefore, the chip driver needs to get a handle to the clock. Instead of relying on other parts of the system to enable the clock, let the codec driver grab a handle itself. In order to keep existing boards working, clock support is made optional. Signed-off-by: Daniel Mack Signed-off-by: Mark Brown --- .../devicetree/bindings/sound/st,sta32x.txt | 6 ++++ sound/soc/codecs/sta32x.c | 28 +++++++++++++++++++ 2 files changed, 34 insertions(+) -- 2.19.0.rc2 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/Documentation/devicetree/bindings/sound/st,sta32x.txt b/Documentation/devicetree/bindings/sound/st,sta32x.txt index ff4a685a4303..52265fb757c5 100644 --- a/Documentation/devicetree/bindings/sound/st,sta32x.txt +++ b/Documentation/devicetree/bindings/sound/st,sta32x.txt @@ -19,6 +19,10 @@ Required properties: Optional properties: + - clocks, clock-names: Clock specifier for XTI input clock. + If specified, the clock will be enabled when the codec is probed, + and disabled when it is removed. The 'clock-names' must be set to 'xti'. + - st,output-conf: number, Selects the output configuration: 0: 2-channel (full-bridge) power, 2-channel data-out 1: 2 (half-bridge). 1 (full-bridge) on-board power @@ -79,6 +83,8 @@ Example: codec: sta32x@38 { compatible = "st,sta32x"; reg = <0x1c>; + clocks = <&clock>; + clock-names = "xti"; reset-gpios = <&gpio1 19 0>; power-down-gpios = <&gpio1 16 0>; st,output-conf = /bits/ 8 <0x3>; // set output to 2-channel diff --git a/sound/soc/codecs/sta32x.c b/sound/soc/codecs/sta32x.c index 22de1593443c..f753d2db0a5a 100644 --- a/sound/soc/codecs/sta32x.c +++ b/sound/soc/codecs/sta32x.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -142,6 +143,7 @@ static const char *sta32x_supply_names[] = { /* codec private data */ struct sta32x_priv { struct regmap *regmap; + struct clk *xti_clk; struct regulator_bulk_data supplies[ARRAY_SIZE(sta32x_supply_names)]; struct snd_soc_component *component; struct sta32x_platform_data *pdata; @@ -879,6 +881,18 @@ static int sta32x_probe(struct snd_soc_component *component) struct sta32x_priv *sta32x = snd_soc_component_get_drvdata(component); struct sta32x_platform_data *pdata = sta32x->pdata; int i, ret = 0, thermal = 0; + + sta32x->component = component; + + if (sta32x->xti_clk) { + ret = clk_prepare_enable(sta32x->xti_clk); + if (ret != 0) { + dev_err(component->dev, + "Failed to enable clock: %d\n", ret); + return ret; + } + } + ret = regulator_bulk_enable(ARRAY_SIZE(sta32x->supplies), sta32x->supplies); if (ret != 0) { @@ -981,6 +995,9 @@ static void sta32x_remove(struct snd_soc_component *component) sta32x_watchdog_stop(sta32x); regulator_bulk_disable(ARRAY_SIZE(sta32x->supplies), sta32x->supplies); + + if (sta32x->xti_clk) + clk_disable_unprepare(sta32x->xti_clk); } static const struct snd_soc_component_driver sta32x_component = { @@ -1097,6 +1114,17 @@ static int sta32x_i2c_probe(struct i2c_client *i2c, } #endif + /* Clock */ + sta32x->xti_clk = devm_clk_get(dev, "xti"); + if (IS_ERR(sta32x->xti_clk)) { + ret = PTR_ERR(sta32x->xti_clk); + + if (ret == -EPROBE_DEFER) + return ret; + + sta32x->xti_clk = NULL; + } + /* GPIOs */ sta32x->gpiod_nreset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);