From patchwork Thu Apr 17 15:53:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 4009761 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0AED3BFF02 for ; Thu, 17 Apr 2014 15:58:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3B159203AA for ; Thu, 17 Apr 2014 15:58:14 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 009FE2038E for ; Thu, 17 Apr 2014 15:58:13 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id D5BD826171F; Thu, 17 Apr 2014 17:58:11 +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.9 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id CE9A3261785; Thu, 17 Apr 2014 17:57:15 +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 ABEB4265516; Thu, 17 Apr 2014 17:57:14 +0200 (CEST) Received: from vps0.lunn.ch (vps0.lunn.ch [178.209.37.122]) by alsa0.perex.cz (Postfix) with ESMTP id 8F052261734 for ; Thu, 17 Apr 2014 17:56:01 +0200 (CEST) Received: from lunn by vps0.lunn.ch with local (Exim 4.80) (envelope-from ) id 1Waocv-0006VU-Mk; Thu, 17 Apr 2014 17:53:25 +0200 From: Andrew Lunn To: Jason Cooper , broonie@kernel.org Date: Thu, 17 Apr 2014 17:53:10 +0200 Message-Id: <1397749994-24983-2-git-send-email-andrew@lunn.ch> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1397749994-24983-1-git-send-email-andrew@lunn.ch> References: <1397749994-24983-1-git-send-email-andrew@lunn.ch> Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux ARM , Andrew Lunn Subject: [alsa-devel] [PATCH 1/5] ASoC: alc5623: Add device tree binding 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 Let the ALC5623 codec be instantiated from DT. Add a simple binding for the additional control register and the jack detect register. Signed-off-by: Andrew Lunn --- I followed the example of the WM8903 binding which allows register values to be placed into DT. --- .../devicetree/bindings/sound/alc5623.txt | 23 ++++++++++++++++++++++ sound/soc/codecs/alc5623.c | 13 ++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/alc5623.txt diff --git a/Documentation/devicetree/bindings/sound/alc5623.txt b/Documentation/devicetree/bindings/sound/alc5623.txt new file mode 100644 index 000000000000..f7f71346e338 --- /dev/null +++ b/Documentation/devicetree/bindings/sound/alc5623.txt @@ -0,0 +1,23 @@ +ALC5621/ALC5622/ALC5623 audio Codec + +Required properties: + + - compatible: "realtek,alc5623" + - reg: the I2C address of the device. + +Optional properties: + + - add-ctrl: Default register value for Reg-40h, Additional Control Register. + If absent, the default is 0. + + - jack-det-ctrl: Default register value for Reg-5Ah, Jack Detect + Control Register. If absent, the default is 0. + +Example: + + alc5621: alc5621@1a { + compatible = "alc5621"; + reg = <0x1a>; + add-ctrl = <0x3700>; + jack-det-ctrl = <0x4810>; + }; diff --git a/sound/soc/codecs/alc5623.c b/sound/soc/codecs/alc5623.c index 2acf82f4a08a..1f9273d20b39 100644 --- a/sound/soc/codecs/alc5623.c +++ b/sound/soc/codecs/alc5623.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -998,8 +999,10 @@ static int alc5623_i2c_probe(struct i2c_client *client, { struct alc5623_platform_data *pdata; struct alc5623_priv *alc5623; + struct device_node *np; unsigned int vid1, vid2; int ret; + u32 val32; alc5623 = devm_kzalloc(&client->dev, sizeof(struct alc5623_priv), GFP_KERNEL); @@ -1040,6 +1043,16 @@ static int alc5623_i2c_probe(struct i2c_client *client, if (pdata) { alc5623->add_ctrl = pdata->add_ctrl; alc5623->jack_det_ctrl = pdata->jack_det_ctrl; + } else { + if (client->dev.of_node) { + np = client->dev.of_node; + ret = of_property_read_u32(np, "add-ctrl", &val32); + if (ret >= 0) + alc5623->add_ctrl = val32; + ret = of_property_read_u32(np, "jack-det-ctrl", &val32); + if (ret >= 0) + alc5623->jack_det_ctrl = val32; + } } alc5623->id = vid2;