From patchwork Sun Jun 17 10:50:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Jarzmik X-Patchwork-Id: 10468779 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C7BE36029B for ; Sun, 17 Jun 2018 10:50:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BECCE2894C for ; Sun, 17 Jun 2018 10:50:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B35FE289B9; Sun, 17 Jun 2018 10:50:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3D1042894C for ; Sun, 17 Jun 2018 10:50:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=FSXv+m3uQuIvoqGUvyaSelR5Zt72Z8+UDHA3CPpF5Yo=; b=l6/IDrDr5v0s7ddVG2tSKWGpuY O+wuERVZJvrI+X9TW1WwCDQbgf/A9QI0/ZLc7OZDC15eawuE2/safwyv9bfNJkT+VB8ti6magalJC OsEyD/NLdnSD3t8Hjb+O6nY2HwXyoGy8EMT3Yn0ux+hFBxkJpcDSVXowCKLkYWE8PgoCeG1Pb1M4b BJ1+CC71u/PZVT7vmOb9mPgb0pGP/YBqCmUFJjrAJShCm1gcss8KWv+LdgP3Og/+INxnEZMzSSJ+s du4kS5agKGjlcxr1cQNpdcfdIBxxXdnN0bBf3DgzOjJtB62CmFid18kNRt26SYbbubu5CdaKSKnQD MNdXtyCQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fUVGo-0003MP-79; Sun, 17 Jun 2018 10:50:54 +0000 Received: from smtp09.smtpout.orange.fr ([80.12.242.131] helo=smtp.smtpout.orange.fr) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fUVGN-00039c-RJ for linux-arm-kernel@lists.infradead.org; Sun, 17 Jun 2018 10:50:30 +0000 Received: from belgarion.home ([90.55.203.186]) by mwinf5d18 with ME id zmq51x00141oiFu03mqCzU; Sun, 17 Jun 2018 12:50:13 +0200 X-ME-Helo: belgarion.home X-ME-Auth: amFyem1pay5yb2JlcnRAb3JhbmdlLmZy X-ME-Date: Sun, 17 Jun 2018 12:50:13 +0200 X-ME-IP: 90.55.203.186 From: Robert Jarzmik To: Liam Girdwood , Mark Brown , Rob Herring , Mark Rutland , Daniel Mack , Haojian Zhuang , Robert Jarzmik , Jaroslav Kysela , Takashi Iwai Subject: [PATCH v2 2/2] ASoC: pxa: add devicetree support Date: Sun, 17 Jun 2018 12:50:01 +0200 Message-Id: <20180617105001.17784-2-robert.jarzmik@free.fr> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180617105001.17784-1-robert.jarzmik@free.fr> References: <20180617105001.17784-1-robert.jarzmik@free.fr> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180617_035028_384606_C2A76AEC X-CRM114-Status: GOOD ( 15.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add the devicetree support, so that the driver can be used in a devictree platform. Signed-off-by: Robert Jarzmik --- Since v1: changed compatible string to pxa250-ac97, pxa270-ac97... --- sound/arm/pxa2xx-ac97-lib.c | 12 ++++++++++++ sound/soc/pxa/pxa2xx-ac97.c | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/sound/arm/pxa2xx-ac97-lib.c b/sound/arm/pxa2xx-ac97-lib.c index 5950a9e218d9..8eafd3d3dff6 100644 --- a/sound/arm/pxa2xx-ac97-lib.c +++ b/sound/arm/pxa2xx-ac97-lib.c @@ -19,6 +19,7 @@ #include #include #include +#include #include @@ -337,6 +338,17 @@ int pxa2xx_ac97_hw_probe(struct platform_device *dev) dev_err(&dev->dev, "Invalid reset GPIO %d\n", pdata->reset_gpio); } + } else if (!pdata && dev->dev.of_node) { + pdata = devm_kzalloc(&dev->dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) + return -ENOMEM; + pdata->reset_gpio = of_get_named_gpio(dev->dev.of_node, + "reset-gpios", 0); + if (pdata->reset_gpio == -ENOENT) + pdata->reset_gpio = -1; + else if (pdata->reset_gpio < 0) + return pdata->reset_gpio; + reset_gpio = pdata->reset_gpio; } else { if (cpu_is_pxa27x()) reset_gpio = 113; diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c index bd36578ceb86..d6be323a13ec 100644 --- a/sound/soc/pxa/pxa2xx-ac97.c +++ b/sound/soc/pxa/pxa2xx-ac97.c @@ -231,6 +231,17 @@ static const struct snd_soc_component_driver pxa_ac97_component = { .name = "pxa-ac97", }; +#ifdef CONFIG_OF +static const struct of_device_id pxa2xx_ac97_dt_ids[] = { + { .compatible = "marvell,pxa250-ac97", }, + { .compatible = "marvell,pxa270-ac97", }, + { .compatible = "marvell,pxa300-ac97", }, + { } +}; +MODULE_DEVICE_TABLE(of, pxa2xx_ac97_dt_ids); + +#endif + static int pxa2xx_ac97_dev_probe(struct platform_device *pdev) { int ret; @@ -298,6 +309,7 @@ static struct platform_driver pxa2xx_ac97_driver = { #ifdef CONFIG_PM_SLEEP .pm = &pxa2xx_ac97_pm_ops, #endif + .of_match_table = of_match_ptr(pxa2xx_ac97_dt_ids), }, };