Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp2316235ybe; Tue, 3 Sep 2019 11:01:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqy8hGpMIZRm9OMCLzyoiA0RXbiC1zENJFkIRFg2VtQssdLFOdnMrYKPy7p3iT96A7fG5YY5 X-Received: by 2002:a17:90a:ec12:: with SMTP id l18mr581053pjy.6.1567533710777; Tue, 03 Sep 2019 11:01:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567533710; cv=none; d=google.com; s=arc-20160816; b=MmHm0Q+sIz3+VoBlixUflCk08qhSnqI/WnBjcnmiBscdl22sE49rtPRgFgT/WklYHa kJw0ZuDlOeH/K2xBGfqU++9yjRq2mXpX1vI2fstWblTor3wsHhLfsZ1ktmOuNw3gyUX7 6q35+VeChQTq+NkDRSbUXUtcWvzaTF5RxDgSYmOv+y4bP7t8j7t9TA+8OgQafIwSZ+hw pEL0U5DfYuwNlVNedpFRfeigpSKI8ht2LvMYT4V3bKTOhTfiRxoA1+MaLW2m3YOXpwaK 8uRb87LSXW+qpstzTGhZDJ1MSE2xg9aZmaN6IeFUj18wYsmCSQwqYd8bk50NXdZQYPE0 EZkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:in-reply-to:subject:cc:to :from:dkim-signature; bh=CYvNu2cKcY4lT8gMAf5xfJU7mlv/HVixnNOL6VgZw80=; b=Qi6tzYRmonzr5M1NBk20P25PV8mnwnLOcDLn1zoabcYTnWcJ24yc19V2mFDFX9uPKX +JnoM94VB/8+2rYIGtUj/GxEmc82NARWjpxkFn1WVaW32F174W5uRJapUOURFJj8kDSK CeMvpIXHy2raHjJp+6jBU7lACpqQrgtsMtiT5EkRXGIFwpZb4D3LVBup9M/PgpdHokNl ysuO/k1ZFHQZXo4vXD5S+DXRG+UJ1uunn8/oVZR2LX+PZ26BZuaATGsWnierP5ZPS+CK 8zLSBLsbagkcuw18LE/MaGW+ZAhjkgavteBFHqyTDZa2vrFTQ2Ruih4qFUDE/9lmTLQT q11w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=mKZb8Shh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s38si15309408pgl.138.2019.09.03.11.01.28; Tue, 03 Sep 2019 11:01:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=mKZb8Shh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730214AbfICSAc (ORCPT + 99 others); Tue, 3 Sep 2019 14:00:32 -0400 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:40922 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729877AbfICSA3 (ORCPT ); Tue, 3 Sep 2019 14:00:29 -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=CYvNu2cKcY4lT8gMAf5xfJU7mlv/HVixnNOL6VgZw80=; b=mKZb8ShhW/Wa XlRY0/tZDWa+xfy9DsdTnvQJOnOxBeIji1CC93FzPJLs8bx7Rivo/4/d3SpWyw5pASUVu3Zhmknbb Mh1llsTWcIKxdc6pvXuxJ5t6sSm+qjsCmpmovy+xM/HgK082gO6x9gO6+Ao/jwWQpMNHPy3NkZOGP P4irE=; Received: from ypsilon.sirena.org.uk ([2001:470:1f1d:6b5::7]) by heliosphere.sirena.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1i5D6J-0000zW-0C; Tue, 03 Sep 2019 18:00:19 +0000 Received: by ypsilon.sirena.org.uk (Postfix, from userid 1000) id 6118D2740A97; Tue, 3 Sep 2019 19:00:18 +0100 (BST) From: Mark Brown To: Katsuhiro Suzuki Cc: alsa-devel@alsa-project.org, Daniel Drake , David Yang , Hans de Goede , linux-kernel@vger.kernel.org, Mark Brown Subject: Applied "ASoC: es8316: add clock control of MCLK" to the asoc tree In-Reply-To: <20190903165322.20791-2-katsuhiro@katsuster.net> X-Patchwork-Hint: ignore Message-Id: <20190903180018.6118D2740A97@ypsilon.sirena.org.uk> Date: Tue, 3 Sep 2019 19:00:18 +0100 (BST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch ASoC: es8316: add clock control of MCLK has been applied to the asoc tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.4 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 6dd567dc964878c04269a44114ef13693712edf1 Mon Sep 17 00:00:00 2001 From: Katsuhiro Suzuki Date: Wed, 4 Sep 2019 01:53:20 +0900 Subject: [PATCH] ASoC: es8316: add clock control of MCLK This patch introduce clock property for MCLK master freq control. Driver will set rate of MCLK master if set_sysclk is called and changing sysclk by board driver. [Modified slightly to apply without an earlier patch in the series due to context diffs -- broonie] Signed-off-by: Katsuhiro Suzuki Link: https://lore.kernel.org/r/20190903165322.20791-2-katsuhiro@katsuster.net Signed-off-by: Mark Brown --- sound/soc/codecs/es8316.c | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/es8316.c b/sound/soc/codecs/es8316.c index 6db002cc2058..6248b01ca049 100644 --- a/sound/soc/codecs/es8316.c +++ b/sound/soc/codecs/es8316.c @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -33,6 +34,7 @@ static const unsigned int supported_mclk_lrck_ratios[] = { struct es8316_priv { struct mutex lock; + struct clk *mclk; struct regmap *regmap; struct snd_soc_component *component; struct snd_soc_jack *jack; @@ -360,7 +362,7 @@ static int es8316_set_dai_sysclk(struct snd_soc_dai *codec_dai, { struct snd_soc_component *component = codec_dai->component; struct es8316_priv *es8316 = snd_soc_component_get_drvdata(component); - int i; + int i, ret; int count = 0; es8316->sysclk = freq; @@ -368,6 +370,12 @@ static int es8316_set_dai_sysclk(struct snd_soc_dai *codec_dai, if (freq == 0) return 0; + if (es8316->mclk) { + ret = clk_set_rate(es8316->mclk, freq); + if (ret) + return ret; + } + /* Limit supported sample rates to ones that can be autodetected * by the codec running in slave mode. */ @@ -697,9 +705,26 @@ static int es8316_set_jack(struct snd_soc_component *component, static int es8316_probe(struct snd_soc_component *component) { struct es8316_priv *es8316 = snd_soc_component_get_drvdata(component); + int ret; es8316->component = component; + es8316->mclk = devm_clk_get(component->dev, "mclk"); + if (PTR_ERR(es8316->mclk) == -EPROBE_DEFER) + return -EPROBE_DEFER; + if (IS_ERR(es8316->mclk)) { + dev_err(component->dev, "clock is invalid, ignored\n"); + es8316->mclk = NULL; + } + + if (es8316->mclk) { + ret = clk_prepare_enable(es8316->mclk); + if (ret) { + dev_err(component->dev, "unable to enable clock\n"); + return ret; + } + } + /* Reset codec and enable current state machine */ snd_soc_component_write(component, ES8316_RESET, 0x3f); usleep_range(5000, 5500); @@ -722,8 +747,17 @@ static int es8316_probe(struct snd_soc_component *component) return 0; } +static void es8316_remove(struct snd_soc_component *component) +{ + struct es8316_priv *es8316 = snd_soc_component_get_drvdata(component); + + if (es8316->mclk) + clk_disable_unprepare(es8316->mclk); +} + static const struct snd_soc_component_driver soc_component_dev_es8316 = { .probe = es8316_probe, + .remove = es8316_remove, .set_jack = es8316_set_jack, .controls = es8316_snd_controls, .num_controls = ARRAY_SIZE(es8316_snd_controls), -- 2.20.1