From patchwork Tue Jun 30 10:25:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kimmo Saarela X-Patchwork-Id: 6694971 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5D624C05AC for ; Tue, 30 Jun 2015 10:27:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8324720532 for ; Tue, 30 Jun 2015 10:27:05 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id D77AD2055C for ; Tue, 30 Jun 2015 10:27:02 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id F319C260590; Tue, 30 Jun 2015 12:27:01 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, NO_DNS_FOR_FROM, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 35A892604AA; Tue, 30 Jun 2015 12:25:51 +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 C56EC260462; Tue, 30 Jun 2015 12:25:48 +0200 (CEST) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com [209.85.215.41]) by alsa0.perex.cz (Postfix) with ESMTP id 6098E26046B for ; Tue, 30 Jun 2015 12:25:40 +0200 (CEST) Received: by lagx9 with SMTP id x9so7427053lag.1 for ; Tue, 30 Jun 2015 03:25:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=OBT7NatxgzyyfBIEJFYochXtuV0v7eNk+1maORQ7W/o=; b=B5hoGFK+XXoysIA1AwKELGutoEVLN1b0IPSmZRByX3s3EB3WpDt7AP+NBUJB5KFasZ LKd1wukxOEUJQ0zyADifL5uhFS1uEixFKqvC0WZG5vIXheY7RRoszW6VBOzHkXc4egsM nY7A5VEwSAeCysosv76njbUeBICWXyaeqx323a/opmh+F3ebLjgddP1prQPa3oHFQ2O2 nqqYcykHTiG0E8RDgSUVV28UARAJRmcTjXHmw97CuCcr/vvrIeg6anDbmE4G+2syYoXX BwyHYaQFG8JRfHbtqp+Rs5pBVN6VJTyB/fgjSQPKBsChqqFkmv2hh85tdr+8fvoPxRYv ooRw== X-Received: by 10.152.204.7 with SMTP id ku7mr18812212lac.38.1435659940082; Tue, 30 Jun 2015 03:25:40 -0700 (PDT) Received: from localhost.localdomain (85-76-111-162-nat.elisa-mobile.fi. [85.76.111.162]) by mx.google.com with ESMTPSA id bm5sm11553431lbc.45.2015.06.30.03.25.39 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 30 Jun 2015 03:25:39 -0700 (PDT) From: Kimmo Saarela To: Jaroslav Kysela , Takashi Iwai Date: Tue, 30 Jun 2015 13:25:10 +0300 Message-Id: X-Mailer: git-send-email 1.9.1 In-Reply-To: References: In-Reply-To: References: Cc: Kimmo Saarela , devicetree@vger.kernel.org, alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH 2/5] ASoC: tlv320aic32x4: Make mclk optional 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 X-Virus-Scanned: ClamAV using ClamSMTP In case mclk is not given, assume that HW works without it, only print warning instead of error for missing mclk. Signed-off-by: Kimmo Saarela --- sound/soc/codecs/tlv320aic32x4.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/sound/soc/codecs/tlv320aic32x4.c b/sound/soc/codecs/tlv320aic32x4.c index ad6cb90..ce0972f 100644 --- a/sound/soc/codecs/tlv320aic32x4.c +++ b/sound/soc/codecs/tlv320aic32x4.c @@ -500,13 +500,14 @@ static int aic32x4_set_bias_level(struct snd_soc_codec *codec, switch (level) { case SND_SOC_BIAS_ON: - /* Switch on master clock */ - ret = clk_prepare_enable(aic32x4->mclk); - if (ret) { - dev_err(codec->dev, "Failed to enable master clock\n"); - return ret; + if (aic32x4->mclk) { + /* Switch on master clock */ + ret = clk_prepare_enable(aic32x4->mclk); + if (ret) { + dev_err(codec->dev, "Failed to enable master clock\n"); + return ret; + } } - /* Switch on PLL */ snd_soc_update_bits(codec, AIC32X4_PLLPR, AIC32X4_PLLEN, AIC32X4_PLLEN); @@ -558,8 +559,10 @@ static int aic32x4_set_bias_level(struct snd_soc_codec *codec, snd_soc_update_bits(codec, AIC32X4_PLLPR, AIC32X4_PLLEN, 0); - /* Switch off master clock */ - clk_disable_unprepare(aic32x4->mclk); + if (aic32x4->mclk) { + /* Switch off master clock */ + clk_disable_unprepare(aic32x4->mclk); + } break; case SND_SOC_BIAS_OFF: break; @@ -816,8 +819,8 @@ static int aic32x4_i2c_probe(struct i2c_client *i2c, aic32x4->mclk = devm_clk_get(&i2c->dev, "mclk"); if (IS_ERR(aic32x4->mclk)) { - dev_err(&i2c->dev, "Failed getting the mclk. The current implementation does not support the usage of this codec without mclk\n"); - return PTR_ERR(aic32x4->mclk); + dev_warn(&i2c->dev, "Failed getting the mclk.\n"); + aic32x4->mclk = NULL; } if (gpio_is_valid(aic32x4->rstn_gpio)) {