Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2762187imm; Sun, 17 Jun 2018 03:50:57 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI/K+n9LmBbxyYYMkRncpIjBnj2fabGCdgsj9JlR/LOv3kxVGni+ICsJyCq4nzr+YLUsBsQ X-Received: by 2002:a17:902:b285:: with SMTP id u5-v6mr9848552plr.183.1529232657722; Sun, 17 Jun 2018 03:50:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529232657; cv=none; d=google.com; s=arc-20160816; b=inxk4Vn8121dKs9t/eoqiS/zzDoF+35N69840o8gKAcagfTjD6EypkkDZLcilFplPs xR24d92cy455JrW0RONQFlvFfsM6RwFEUCvBtNtF6x33wQTdggWSX3MSAkYbX48T2pDG Gs17R6pb18a9QhRnbX/wJPrH9ZCoX6BL11G4CJMPAujnbqHWOchDV7R/9caPSgxSuAwg 83gZvPskloVqy85Bb5dY5o1/dpLbN3+NJzv3RjPE96juZsfl+yi7cFycBMuQZHVjJA9n r157sfndeqJt7UBmpk+K3NrGZJl/1/uBGXqxkimWX2vObU9ddJ35RZuCkshFTdcy5B5V gLNQ== 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=93o1eY5Eile9bXRNJgc5AN7W9qEI+SQvBRn5eVivO7U=; b=Z8X+7giB3iBAF7e0X9AGElB+MwQnw1NQ5WpSDwd2sfoallk4vxKLoozu8Nnhfws9rV bsrEM8sFzJfR5F3xGWuxvC6XmTeaOP/asLpiDEaqr3lA0cWPyhGXCkZ3rEE8RP6NM2vF fTaNwqH/fs79oyme6ZuQPbHvmOPDsCjBO/MFBxWznmVf32XxDog1ZWnJFgcBapPwx6s+ m+VE4YKvDwrW+1KqMZJNNdLJ1quw0ihKpIvlxEAhu0xuJ60Z3u00Vrdq+Y/tpVhBsrlY oeeC9kMUF0QkpVemOAxgEyfotdE2/iomt/+b5uwZ8hoF2pGoVkK1vkjmDts6sBGAdlMn EPLQ== 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 l21-v6si12688252pfk.321.2018.06.17.03.50.43; Sun, 17 Jun 2018 03:50:57 -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 S933742AbeFQKuS (ORCPT + 99 others); Sun, 17 Jun 2018 06:50:18 -0400 Received: from smtp09.smtpout.orange.fr ([80.12.242.131]:33214 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933069AbeFQKuP (ORCPT ); Sun, 17 Jun 2018 06:50:15 -0400 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 Cc: alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org 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> 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 --- 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), }, }; -- 2.11.0