From patchwork Tue Sep 25 14:23:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Marco Felsch X-Patchwork-Id: 147457 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp794458lji; Tue, 25 Sep 2018 07:24:22 -0700 (PDT) X-Google-Smtp-Source: ACcGV63qFKJBQHW5dw9LsGyq4Y91HJ6ekQQinJZJdz6gnPCHRynvYuKLiLwPOQAsdXXjaAdVCaKC X-Received: by 2002:a17:902:9a82:: with SMTP id w2-v6mr1498922plp.109.1537885462735; Tue, 25 Sep 2018 07:24:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537885462; cv=none; d=google.com; s=arc-20160816; b=TPIRJAr8PaT7AjqWm69VN3xdJwLxZCAu1mxeg2yffgxxpp33dTFjo7TjswRcWN+14L Yo1dHmBXPos81yd+UtvLxhRHXVifwGakFlEMpaP6jsREiyELaT0Z+I9ngVod+Mt86lsL U+w6JKb6+BmGj3V28fgiAkDySuhngoNgcFELR0w9bemMVZkxOFF3wOTqkIK5qwEf4KKm s+W2Qgo46y2NgoLw8XZrkT+Mci7v6Eyh1uMGnvyuCURHH3ZuT2uTsf0lasYovTrBV1Yi Svi6dJLvhYs53Fwgzl2bEtbjINA51jZF0EmkbvxSJP/EjRo054WStoTvcvqsww3E9ER1 TsJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=SgD6pU7AFdYtqkGUdDZo85xnqDiSti+osHaEIYMffA8=; b=Jkih9Iqhe5Ty5vMDXrpk3GZvcPAisGI8NTgxuulRmPt1VOpYjOsJU7qUZvKYCz9il8 UQYUmWxqDSGccTV6pFql7HyP5mcLAb20s06mp7KtHsdWJSEUhrCBTWaIrrvl2BNDtfBI a7H5tJdvSfcnkmGysa8uAU5XqetzkjmrH9QAk6q3iSXurtR5Jonl64UJXY1uPlmcIkdf A6piWPtgic5SoQcPsD/pv0xb+Vulayv6h59gskMjMVALfbCrahkwOC2IT8OzjiWhYsJ6 HEtmNe4HUC1/0IdV0oiLFTnDxngg5ax0PpJQSQq/Smv1/jXct4DBwMxNrhkrgYupTC4P HnLA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w6-v6si2463333pgp.42.2018.09.25.07.24.22; Tue, 25 Sep 2018 07:24:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729266AbeIYUcG (ORCPT + 6 others); Tue, 25 Sep 2018 16:32:06 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:56107 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729124AbeIYUcG (ORCPT ); Tue, 25 Sep 2018 16:32:06 -0400 Received: from dude.hi.pengutronix.de ([2001:67c:670:100:1d::7]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1g4oG7-0004Hm-VJ; Tue, 25 Sep 2018 16:24:15 +0200 Received: from mfe by dude.hi.pengutronix.de with local (Exim 4.91) (envelope-from ) id 1g4oG7-0001LC-2j; Tue, 25 Sep 2018 16:24:15 +0200 From: Marco Felsch To: lgirdwood@gmail.com, broonie@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com Cc: alsa-devel@alsa-project.org, devicetree@vger.kernel.org, =?utf-8?q?And?= =?utf-8?q?reas_F=C3=A4rber?= , kernel@pengutronix.de Subject: [PATCH 1/5] ASoC: dt-bindings: add max98088 audio codec Date: Tue, 25 Sep 2018 16:23:48 +0200 Message-Id: <20180925142352.24106-2-m.felsch@pengutronix.de> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180925142352.24106-1-m.felsch@pengutronix.de> References: <20180925142352.24106-1-m.felsch@pengutronix.de> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::7 X-SA-Exim-Mail-From: mfe@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: devicetree@vger.kernel.org Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Andreas Färber This patch adds the bindings for maxim max98088/9 audio codec. Signed-off-by: Andreas Färber [m.felsch@pengutronix.de: adapt commit message] [m.felsch@pengutronix.de: adapt formatting] Signed-off-by: Marco Felsch --- .../devicetree/bindings/sound/maxim,max98088.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/maxim,max98088.txt -- 2.19.0 diff --git a/Documentation/devicetree/bindings/sound/maxim,max98088.txt b/Documentation/devicetree/bindings/sound/maxim,max98088.txt new file mode 100644 index 000000000000..a79ad5c7af88 --- /dev/null +++ b/Documentation/devicetree/bindings/sound/maxim,max98088.txt @@ -0,0 +1,15 @@ +MAX98088 audio CODEC + +This device supports I2C only. + +Required properties: + +- compatible: "maxim,max98088" or "maxim,max98089". +- reg: The I2C address of the device. + +Example: + +max98089: codec@10 { + compatible = "maxim,max98089"; + reg = <0x10>; +}; From patchwork Tue Sep 25 14:23:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Marco Felsch X-Patchwork-Id: 147459 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp794499lji; Tue, 25 Sep 2018 07:24:25 -0700 (PDT) X-Google-Smtp-Source: ACcGV60PAgH2+X+RjDOfff8uhopg3DIUiiFfy5XFLlcgogcaVH1erOSbaRBhz9pXybDy80iDBwev X-Received: by 2002:a63:5b63:: with SMTP id l35-v6mr1380020pgm.50.1537885465100; Tue, 25 Sep 2018 07:24:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537885465; cv=none; d=google.com; s=arc-20160816; b=oVRhM5AP1V7JwMbFItruKiePBYn7GAmauIbMwUuTonP4i9CpHG1mD0nJrUmi9rHTtD H/IBl6Ozc+xOO6/0ylc2EoTOQihbVwTkq+zxtgCvwM5GrE9Vl/aLEy60kBeChinFEKq9 hSkHvZrx9KMY1u1u351kPMFlLdlKRJh1drB9pDo6JX15JG63FMjQxmM9XhgGcy33kafp 5c5SV+yKmgfxSqGKORD7AwY2nJSZO2GBpOsI+DTPlG34+rsmbNqCsutEPS3tlTKx6Lrw EDXAuGUtBQNT4LtIk5guNpjI/8ItXb4Hur9bzvIZVPnC9raE/5ccpkhHV4+6oTRLya/w 9I8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=KyS9anY598bsTiJx4lgrSmSW+H4CV8ZVGoQJcjR9/bo=; b=hwfoFEHbC4jiK3k08PBK+a11c3bvQhVUyzaXLbQ5niahlXmuNR1C/fA/UhcGvv4tmx 3lHTsYvFWMmEVQrk7ONf0VRUe0E3QsfWrNFCf4kQSMj+Z4/0nWS+QxhobCiZ1lUhIf4t n63TnwXjX3PGuISBhTlgb0cwSr/mDSLqsu4EJMQFH2cd6sb4omCKdrPJlf9ogio1vrlv bINywlNO31xzi8Ugxj59wDYzR0Q4/YsmYOpzgSZRgrOMRRJGjM/jqyCJE6bdrRPkIVtl Ca1hDxMvEGtB4RJYpHB/fV2diEvrSoo7P0wzoY027sZSZp1DaZ2pOZT4jcLZJbdmp5j7 q4Fw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w6-v6si2463333pgp.42.2018.09.25.07.24.24; Tue, 25 Sep 2018 07:24:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729332AbeIYUcI (ORCPT + 6 others); Tue, 25 Sep 2018 16:32:08 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:38909 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729124AbeIYUcI (ORCPT ); Tue, 25 Sep 2018 16:32:08 -0400 Received: from dude.hi.pengutronix.de ([2001:67c:670:100:1d::7]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1g4oG8-0004JS-UE; Tue, 25 Sep 2018 16:24:16 +0200 Received: from mfe by dude.hi.pengutronix.de with local (Exim 4.91) (envelope-from ) id 1g4oG8-0001LF-Lp; Tue, 25 Sep 2018 16:24:16 +0200 From: Marco Felsch To: lgirdwood@gmail.com, broonie@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com Cc: alsa-devel@alsa-project.org, devicetree@vger.kernel.org, =?utf-8?q?And?= =?utf-8?q?reas_F=C3=A4rber?= , kernel@pengutronix.de Subject: [PATCH 2/5] ASoC: max98088: add OF support Date: Tue, 25 Sep 2018 16:23:49 +0200 Message-Id: <20180925142352.24106-3-m.felsch@pengutronix.de> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180925142352.24106-1-m.felsch@pengutronix.de> References: <20180925142352.24106-1-m.felsch@pengutronix.de> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::7 X-SA-Exim-Mail-From: mfe@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: devicetree@vger.kernel.org Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Andreas Färber MAX98088 is an older version of the MAX98089 device. Signed-off-by: Andreas Färber [m.felsch@pengutronix.de: add CONFIG_OF compile switch] [m.felsch@pengutronix.de: adapt commit message] Signed-off-by: Marco Felsch --- sound/soc/codecs/max98088.c | 10 ++++++++++ 1 file changed, 10 insertions(+) -- 2.19.0 diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c index fb515aaa54fc..9450d5d9c492 100644 --- a/sound/soc/codecs/max98088.c +++ b/sound/soc/codecs/max98088.c @@ -1742,9 +1742,19 @@ static const struct i2c_device_id max98088_i2c_id[] = { }; MODULE_DEVICE_TABLE(i2c, max98088_i2c_id); +#if defined(CONFIG_OF) +static const struct of_device_id max98088_of_match[] = { + { .compatible = "maxim,max98088" }, + { .compatible = "maxim,max98089" }, + { } +}; +MODULE_DEVICE_TABLE(of, max98088_of_match); +#endif + static struct i2c_driver max98088_i2c_driver = { .driver = { .name = "max98088", + .of_match_table = of_match_ptr(max98088_of_match), }, .probe = max98088_i2c_probe, .id_table = max98088_i2c_id, From patchwork Tue Sep 25 14:23:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Marco Felsch X-Patchwork-Id: 147460 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp794658lji; Tue, 25 Sep 2018 07:24:34 -0700 (PDT) X-Google-Smtp-Source: ACcGV62uXpxdFgu2Vu8zOcv+jKXrj7wQntsl4E9zQy6VlmnPVaqF/uYNH0wwT8k1qZq/VinvP344 X-Received: by 2002:a63:720e:: with SMTP id n14-v6mr1332241pgc.193.1537885474023; Tue, 25 Sep 2018 07:24:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537885474; cv=none; d=google.com; s=arc-20160816; b=BpiYd1Sf/9+F93B1njngNQTdkCMHf6ZQIFkezFmTTkqruFcFyEEioAn0/KlPIc4DAM E/H0W5tKop3GbX/PAc2b0sGBKaZVr9ynW5HzUhUC10q6IEW5jKklJd4Rf/ps8pHmPQuV G/fKDrZDeKUkkxbIYFWzpebkBhOgS9IdnXiwiFGIGCmIj0vMZ+HNQ0qSzxSUWdnyp18H zX8giIQT9PpChJ5JHALrXKVcfgpXtAJal2S+cdNH/R/0E5Olcttk6EohlNYImMCW5e4S OHrYAzSumvQI6B7obGETtxlmXkbsMHOzIWFQDueEPnKWDw0uw6B/klNUNC7muqRWlSqe 1arA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=TMF2EqBuQSeYG+qKxwDQBpMuKcEIyY0F6AeaEi23G9A=; b=z3BDeOKoJlnp2yfBzav3xmXVc5Qyvv7AZzhweikShjk11hO0CEBqK8B4AnTWxbXe+S uYsEclUDpGoVPAAJXEGZMhDgO0xz0o7ndWpekzpBGvM8sKfg4S7VoaepbQWwFu5aNdrw vHgpYalxdIwmRjSZbqeiBj/uG/trrplQuEfgA7MHu4SRFozgQmO1qlNTaBb1awAIq0mM fLEjHODm2GT7o4BEPmid2eQJEwrU1/amUweq8BGD3vFt+lnvCSpZl9b9+yRS76rgG5kU XaE6p7J6GXzCBv8cHsbcFfC/4b1u7TONZ0I9ZLzyA2FzdkrZQk3/ta6x7+7lw5EOUR8t 5phA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w6-v6si2463333pgp.42.2018.09.25.07.24.33; Tue, 25 Sep 2018 07:24:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729317AbeIYUcR (ORCPT + 6 others); Tue, 25 Sep 2018 16:32:17 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:49027 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729124AbeIYUcR (ORCPT ); Tue, 25 Sep 2018 16:32:17 -0400 Received: from dude.hi.pengutronix.de ([2001:67c:670:100:1d::7]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1g4oGJ-0004PU-7G; Tue, 25 Sep 2018 16:24:27 +0200 Received: from mfe by dude.hi.pengutronix.de with local (Exim 4.91) (envelope-from ) id 1g4oGI-0001Ls-DJ; Tue, 25 Sep 2018 16:24:26 +0200 From: Marco Felsch To: lgirdwood@gmail.com, broonie@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com Cc: alsa-devel@alsa-project.org, devicetree@vger.kernel.org, =?utf-8?q?And?= =?utf-8?q?reas_F=C3=A4rber?= , kernel@pengutronix.de, Tushar Behera , Javier Martinez Canillas Subject: [PATCH 4/5] ASoC: max98088: Add master clock handling Date: Tue, 25 Sep 2018 16:23:51 +0200 Message-Id: <20180925142352.24106-5-m.felsch@pengutronix.de> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180925142352.24106-1-m.felsch@pengutronix.de> References: <20180925142352.24106-1-m.felsch@pengutronix.de> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::7 X-SA-Exim-Mail-From: mfe@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: devicetree@vger.kernel.org Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Andreas Färber If master clock is provided through device tree, then update the master clock frequency during set_sysclk. Cc: Tushar Behera Cc: Javier Martinez Canillas Signed-off-by: Andreas Färber Acked-by: Tushar Behera Reviewed-by: Javier Martinez Canillas [m.felsch@pengutronix.de: move mclk request to i2c_probe] [m.felsch@pengutronix.de: make use of snd_soc_component_get_bias_level()] Signed-off-by: Marco Felsch --- sound/soc/codecs/max98088.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) -- 2.19.0 diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c index 9450d5d9c492..01f1ea0af9c1 100644 --- a/sound/soc/codecs/max98088.c +++ b/sound/soc/codecs/max98088.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -42,6 +43,7 @@ struct max98088_priv { struct regmap *regmap; enum max98088_type devtype; struct max98088_pdata *pdata; + struct clk *mclk; unsigned int sysclk; struct max98088_cdata dai[2]; int eq_textcnt; @@ -1103,6 +1105,11 @@ static int max98088_dai_set_sysclk(struct snd_soc_dai *dai, if (freq == max98088->sysclk) return 0; + if (!IS_ERR(max98088->mclk)) { + freq = clk_round_rate(max98088->mclk, freq); + clk_set_rate(max98088->mclk, freq); + } + /* Setup clocks for slave mode, and using the PLL * PSCLK = 0x01 (when master clk is 10MHz to 20MHz) * 0x02 (when master clk is 20MHz to 30MHz).. @@ -1310,6 +1317,20 @@ static int max98088_set_bias_level(struct snd_soc_component *component, break; case SND_SOC_BIAS_PREPARE: + /* + * SND_SOC_BIAS_PREPARE is called while preparing for a + * transition to ON or away from ON. If current bias_level + * is SND_SOC_BIAS_ON, then it is preparing for a transition + * away from ON. Disable the clock in that case, otherwise + * enable it. + */ + if (!IS_ERR(max98088->mclk)) { + if (snd_soc_component_get_bias_level(component) == + SND_SOC_BIAS_ON) + clk_disable_unprepare(max98088->mclk); + else + clk_prepare_enable(max98088->mclk); + } break; case SND_SOC_BIAS_STANDBY: @@ -1725,6 +1746,14 @@ static int max98088_i2c_probe(struct i2c_client *i2c, if (IS_ERR(max98088->regmap)) return PTR_ERR(max98088->regmap); + max98088->mclk = devm_clk_get(&i2c->dev, "mclk"); + if (IS_ERR(max98088->mclk)) { + if (PTR_ERR(max98088->mclk) == -EPROBE_DEFER) + return -EPROBE_DEFER; + dev_err(&i2c->dev, "Invalid MCLK\n"); + return -EINVAL; + } + max98088->devtype = id->driver_data; i2c_set_clientdata(i2c, max98088);