From patchwork Sat Apr 26 06:57:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Shiyan X-Patchwork-Id: 4067491 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 764279F1F4 for ; Sat, 26 Apr 2014 06:57:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7CD9D2037F for ; Sat, 26 Apr 2014 06:57:39 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 273412034C for ; Sat, 26 Apr 2014 06:57:38 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 621D72610B0; Sat, 26 Apr 2014 08:57:36 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_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 14A24260824; Sat, 26 Apr 2014 08:57:25 +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 4026826084D; Sat, 26 Apr 2014 08:57:23 +0200 (CEST) Received: from smtp48.i.mail.ru (smtp48.i.mail.ru [94.100.177.108]) by alsa0.perex.cz (Postfix) with ESMTP id 3F9B0260818 for ; Sat, 26 Apr 2014 08:57:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail2; h=Message-Id:Date:Subject:Cc:To:From; bh=X/tv9u529VsHgOFHSuWxGy0YjIau93ePrSGiClzUHUI=; b=uo3X7Mn0tmx+v9Gd0/+n3QtIj4QAjxt/3NFIK8se+X307BVBA4RoqKN8//Z3iE200Ad0M7/bFscbjmSQtsqX+wwhmzfYdRza+4hLps+iwnLq42smuTdWsevU4SwtTPJF20QH8oZqMBSNaysRrZFSqvHotJry5iuSY48j3BIK6QU=; Received: from [5.18.98.0] (port=64873 helo=shc.zet) by smtp48.i.mail.ru with esmtpa (envelope-from ) id 1WdwXx-0002Fj-7Y; Sat, 26 Apr 2014 10:57:13 +0400 From: Alexander Shiyan To: alsa-devel@alsa-project.org Date: Sat, 26 Apr 2014 10:57:03 +0400 Message-Id: <1398495423-2223-1-git-send-email-shc_work@mail.ru> X-Mailer: git-send-email 1.8.3.2 X-Spam: Not detected X-Mras: Ok Cc: devicetree@vger.kernel.org, Samuel Ortiz , Alexander Shiyan , Takashi Iwai , Liam Girdwood , Mark Brown , Lee Jones Subject: [alsa-devel] [PATCH] ASoC: mc13783: Add devicetree support 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 This patch adds devicetree support for mc13783-codec. Signed-off-by: Alexander Shiyan --- Documentation/devicetree/bindings/mfd/mc13xxx.txt | 3 +++ drivers/mfd/mc13xxx-core.c | 10 +++++++--- sound/soc/codecs/mc13783.c | 14 +++++++++++++- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/mfd/mc13xxx.txt b/Documentation/devicetree/bindings/mfd/mc13xxx.txt index 1413f39..8aba488 100644 --- a/Documentation/devicetree/bindings/mfd/mc13xxx.txt +++ b/Documentation/devicetree/bindings/mfd/mc13xxx.txt @@ -10,6 +10,9 @@ Optional properties: - fsl,mc13xxx-uses-touch : Indicate the touchscreen controller is being used Sub-nodes: +- codec: Contain the Audio Codec node. + - adc-port: Contain PMIC SSI port number used for ADC. + - dac-port: Contain PMIC SSI port number used for DAC. - leds : Contain the led nodes and initial register values in property "led-control". Number of register depends of used IC, for MC13783 is 6, for MC13892 is 4, for MC34708 is 1. See datasheet for bits definitions of diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c index 06e64b6..0c6c21c 100644 --- a/drivers/mfd/mc13xxx-core.c +++ b/drivers/mfd/mc13xxx-core.c @@ -673,9 +673,13 @@ int mc13xxx_common_init(struct device *dev) if (mc13xxx->flags & MC13XXX_USE_ADC) mc13xxx_add_subdevice(mc13xxx, "%s-adc"); - if (mc13xxx->flags & MC13XXX_USE_CODEC) - mc13xxx_add_subdevice_pdata(mc13xxx, "%s-codec", - pdata->codec, sizeof(*pdata->codec)); + if (mc13xxx->flags & MC13XXX_USE_CODEC) { + if (pdata) + mc13xxx_add_subdevice_pdata(mc13xxx, "%s-codec", + pdata->codec, sizeof(*pdata->codec)); + else + mc13xxx_add_subdevice(mc13xxx, "%s-codec"); + } if (mc13xxx->flags & MC13XXX_USE_RTC) mc13xxx_add_subdevice(mc13xxx, "%s-rtc"); diff --git a/sound/soc/codecs/mc13783.c b/sound/soc/codecs/mc13783.c index 0b0a4ca..9965277 100644 --- a/sound/soc/codecs/mc13783.c +++ b/sound/soc/codecs/mc13783.c @@ -22,6 +22,7 @@ */ #include #include +#include #include #include #include @@ -748,6 +749,7 @@ static int __init mc13783_codec_probe(struct platform_device *pdev) { struct mc13783_priv *priv; struct mc13xxx_codec_platform_data *pdata = pdev->dev.platform_data; + struct device_node *np; int ret; priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); @@ -758,7 +760,17 @@ static int __init mc13783_codec_probe(struct platform_device *pdev) priv->adc_ssi_port = pdata->adc_ssi_port; priv->dac_ssi_port = pdata->dac_ssi_port; } else { - return -ENOSYS; + np = of_get_child_by_name(pdev->dev.parent->of_node, "codec"); + if (!np) + return -ENOSYS; + + ret = of_property_read_u32(np, "adc-port", &priv->adc_ssi_port); + if (ret) + return ret; + + ret = of_property_read_u32(np, "dac-port", &priv->dac_ssi_port); + if (ret) + return ret; } dev_set_drvdata(&pdev->dev, priv);