Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4545280imm; Mon, 11 Jun 2018 14:21:30 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKj/oILqsqiALYZHMDJ7vhlQhkWQPGZ0WxdsBGEs3cS8cP4CKiUcbAsXuAtNhoblX2abuEu X-Received: by 2002:aa7:854e:: with SMTP id y14-v6mr774026pfn.165.1528752089950; Mon, 11 Jun 2018 14:21:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528752089; cv=none; d=google.com; s=arc-20160816; b=OxUia0aq68f7+mdZ4XX6hpce6HRW2jygioGRUPYWSEKbCiOZCXwW0ztEIm1tZVW48A oymio/OXG6JYy0XyHcdCi3atBhObjqXd2vnL2pk4qsMbOPm9h0g4QqA8CgdZVuy4T8Mi y5HGeHmG2pFAHYwsn7X91DnQUouONMw/uUsH5n3h1T1fsT29hO1SNKfas/ZI5XPKuWp5 Taa5G9geB3a13hPNanJPYQryMa2N+oKbL7zvXWVa+6WeHeGjMXPjt6AgsCgl9KTDP8sQ KdLJVUcr4CQDTtZFvxavyK85t6qcZVEFun7s3ByxaW71PqAQHq0hZ6yR6uB4wxJrrq4m tquA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=y9s+s/jlb1wIuyAzjWGxA4ihza+fcW9Lh/Dy+5LgNsY=; b=D+u+Hjsc5M3CFmztYgOXnpN95hbZFgxanxSUEF3JWwTVSoaCiHZOXgX4ygiV53uJTl KiczS7iPCRKdAsQetjHFt8qovLnuKtc6g93jqQ9s0f/jKE9KzEVUgCfH9hXjai6eo1fH A9TURjwcsvCdiOkjpNULSCVPie1RSRSgRSQNHnP4HHGq1QiP8zZ7LQb5ZtJGz8z1elT8 8oDXeYKW1Yb1w7FyZLdsyUiwm1R9c0pZEpPBkHivvzwIZWtcLnhWto2RYYyMwD2xH13t zLHVHfr8AIzD9/z0Fb1cqlUtPOi5LHmWO1N/VPvLKOUodLZKDCf/yCTrzmfhe0tIGKgm s4tQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 f28-v6si29321269pfk.107.2018.06.11.14.21.15; Mon, 11 Jun 2018 14:21:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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 linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933963AbeFKUWf (ORCPT + 99 others); Mon, 11 Jun 2018 16:22:35 -0400 Received: from smtp13.smtpout.orange.fr ([80.12.242.135]:60940 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933789AbeFKUWa (ORCPT ); Mon, 11 Jun 2018 16:22:30 -0400 Received: from belgarion.home ([90.55.202.35]) by mwinf5d72 with ME id xYNJ1x0040mKt3N03YNTSD; Mon, 11 Jun 2018 22:22:29 +0200 X-ME-Helo: belgarion.home X-ME-Auth: amFyem1pay5yb2JlcnRAb3JhbmdlLmZy X-ME-Date: Mon, 11 Jun 2018 22:22:29 +0200 X-ME-IP: 90.55.202.35 From: Robert Jarzmik To: Liam Girdwood , Mark Brown , Rob Herring , Mark Rutland , Daniel Mack , Haojian Zhuang , Robert Jarzmik , Jaroslav Kysela , Takashi Iwai Cc: alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/2] ASoC: pxa: add devicetree support Date: Mon, 11 Jun 2018 22:22:11 +0200 Message-Id: <20180611202211.15501-2-robert.jarzmik@free.fr> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180611202211.15501-1-robert.jarzmik@free.fr> References: <20180611202211.15501-1-robert.jarzmik@free.fr> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add the devicetree support, so that the driver can be used in a devictree platform. Signed-off-by: Robert Jarzmik --- sound/arm/pxa2xx-ac97-lib.c | 11 +++++++++++ sound/soc/pxa/pxa2xx-ac97.c | 10 ++++++++++ 2 files changed, 21 insertions(+) diff --git a/sound/arm/pxa2xx-ac97-lib.c b/sound/arm/pxa2xx-ac97-lib.c index 5950a9e218d9..17c3f26b92b9 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,16 @@ 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-gpio", 0); + if (pdata->reset_gpio == -ENOENT) + pdata->reset_gpio = -1; + else if (pdata->reset_gpio < 0) + return 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..8fda29262ef1 100644 --- a/sound/soc/pxa/pxa2xx-ac97.c +++ b/sound/soc/pxa/pxa2xx-ac97.c @@ -231,6 +231,15 @@ 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,pxa2xx-ac97", }, + { } +}; +MODULE_DEVICE_TABLE(of, pxa2xx_ac97_dt_ids); + +#endif + static int pxa2xx_ac97_dev_probe(struct platform_device *pdev) { int ret; @@ -298,6 +307,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), }, }; -- 2.11.0