From patchwork Thu May 1 06:49:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Shiyan X-Patchwork-Id: 344445 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id AEA55140113 for ; Thu, 1 May 2014 16:49:33 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752595AbaEAGtc (ORCPT ); Thu, 1 May 2014 02:49:32 -0400 Received: from smtp17.mail.ru ([94.100.176.154]:57509 "EHLO smtp17.mail.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750871AbaEAGtc (ORCPT ); Thu, 1 May 2014 02:49:32 -0400 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=vkZg3gPoDUJxcrKQAfIv6/GKD7ASE05Zqn01rTdd2RM=; b=Qg/60xYvlu53pL4WESZsdPWjLWCTlQfKSLfsqVonerO3EKMH/SC3Yn7ejYJJJC2YzNb8LsaH+WCzVDjQ5piglfCf4iMWSUW+xOk4BzCZ9JgPY8po1sCJNNosD98BxQpS5FvtmIyh2LLxt+tU3K7XfHGHJ+A59LUaFooeah3WfPU=; Received: from [5.18.98.0] (port=57834 helo=shc.zet) by smtp17.mail.ru with esmtpa (envelope-from ) id 1WfkoC-0001Md-OA; Thu, 01 May 2014 10:49:29 +0400 From: Alexander Shiyan To: linux-kernel@vger.kernel.org Cc: alsa-devel@alsa-project.org, devicetree@vger.kernel.org, Samuel Ortiz , Lee Jones , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Alexander Shiyan Subject: [PATCH 2/2] ASoC: mc13783: Add devicetree support Date: Thu, 1 May 2014 10:49:12 +0400 Message-Id: <1398926952-21820-1-git-send-email-shc_work@mail.ru> X-Mailer: git-send-email 1.8.3.2 X-Spam: Not detected X-Mras: Ok Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This patch adds devicetree support for mc13783-codec. Signed-off-by: Alexander Shiyan --- Documentation/devicetree/bindings/mfd/mc13xxx.txt | 3 +++ sound/soc/codecs/mc13783.c | 14 +++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) 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/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);