From patchwork Thu May 5 10:53:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Thomson X-Patchwork-Id: 9023461 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CB731BF29F for ; Thu, 5 May 2016 10:54:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DA87120395 for ; Thu, 5 May 2016 10:54:30 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 483DF202E9 for ; Thu, 5 May 2016 10:54:29 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 2C91326658B; Thu, 5 May 2016 12:54:28 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 801FF266168; Thu, 5 May 2016 12:53:21 +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 31C69266085; Thu, 5 May 2016 12:53:19 +0200 (CEST) Received: from mail1.bemta14.messagelabs.com (mail1.bemta14.messagelabs.com [193.109.254.108]) by alsa0.perex.cz (Postfix) with ESMTP id 2442D265E23 for ; Thu, 5 May 2016 12:53:10 +0200 (CEST) Received: from [85.158.140.211] by server-4.bemta-14.messagelabs.com id 9B/95-03277-5162B275; Thu, 05 May 2016 10:53:09 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrAIsWRWlGSWpSXmKPExsUSt3Opsa6omna 4QdtSJYsrFw8xWUx9+ITN4tuVDiaLy7vmsFl07upntVj9ZgGLxYbvaxkd2D02fG5i89g56y67 x+I9L5k8Nq3qZPPY93YZm8f6LVdZPD5vkgtgj2LNzEvKr0hgzdg55StrQbdUxby22YwNjAvEu hi5OIQE1jFKNH18y9bFyAnkVEicajrC3MXIwcErkCnROaEKJMwp4C5x4N8XFogSN4k1TWfAyt kELCQmn3gAZrMIqEjsuv+EEcQWFrCW+D/hORvIfBGBLkaJ1a8es4M4zAKbGSV2r1nCClLFKyA ocXLmE7CpzAISEgdfvGCG2GAgcXpBI1hcQsBeYvr7q2AHSQjoSzQei4UIG0p8n/UNqsRc4tqb PawTGAVnIZk6C8nUBYxMqxjVi1OLylKLdI30kooy0zNKchMzc3QNDU30clOLixPTU3MSk4r1k vNzNzECY4IBCHYwtsxxPsQoycGkJMq7XUk7XIgvKT+lMiOxOCO+qDQntfgQowwHh5IE72cVoJ xgUWp6akVaZg4wOmHSEhw8SiK8R0DSvMUFibnFmekQqVOMilLivByqQAkBkERGaR5cGywhXGK UlRLmZQQ6RIinILUoN7MEVf4VozgHo5Iw7xmQ8TyZeSVw018BLWYCWvx+ribI4pJEhJRUA+Oh A7K6k5LMg1c1fSmOvJ2g2DJpaXypsNP5wwv5eJsT/ogziZ+Ztu2csu1sxS2Ji/kW873+/vjN3 Hcuy/uKKgq7bH7s2W3gHqq6tD9r+s/U7hOPyjY1PWz5MEH+z8oz267+j3jYuiHIgfn3p3dH78 5n3P6Ied/p6AqR6T/0fxz5yeI3uZBBmeeoEktxRqKhFnNRcSIAOAEP4wMDAAA= X-Env-Sender: Adam.Thomson.Opensource@diasemi.com X-Msg-Ref: server-14.tower-194.messagelabs.com!1462445586!34338820!1 X-Originating-IP: [94.185.165.51] X-StarScan-Received: X-StarScan-Version: 8.34; banners=-,-,- X-VirusChecked: Checked Received: (qmail 28524 invoked from network); 5 May 2016 10:53:09 -0000 Received: from mailrelay2.diasemi.com (HELO sw-ex-cashub01.diasemi.com) (94.185.165.51) by server-14.tower-194.messagelabs.com with AES128-SHA encrypted SMTP; 5 May 2016 10:53:09 -0000 Received: from swsrvapps-01.diasemi.com (10.20.28.141) by SW-EX-CASHUB01.diasemi.com (10.20.16.140) with Microsoft SMTP Server id 14.3.248.2; Thu, 5 May 2016 11:53:05 +0100 Received: by swsrvapps-01.diasemi.com (Postfix, from userid 22379) id B0A813FB2C; Thu, 5 May 2016 11:53:05 +0100 (BST) Message-ID: In-Reply-To: References: From: Adam Thomson Date: Thu, 5 May 2016 11:53:05 +0100 To: Mark Brown , Liam Girdwood , Jaroslav Kysela , Takashi Iwai MIME-Version: 1.0 X-KSE-AttachmentFiltering-Interceptor-Info: protection disabled X-KSE-ServerInfo: sw-ex-cashub01.diasemi.com, 9 X-KSE-Antivirus-Interceptor-Info: scan successful X-KSE-Antivirus-Info: Clean, bases: 05/05/2016 08:40:00 Cc: Sathyanarayana Nujella , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Support Opensource Subject: [alsa-devel] [PATCH 2/3] ASoC: da7219: Add ACPI parsing 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP This update allows for parsing of ACPI, in addition to existing DT support. Signed-off-by: Adam Thomson Tested-by: Sathyanarayana Nujella --- sound/soc/codecs/da7219-aad.c | 32 ++++++++++++++++++++++++++++---- sound/soc/codecs/da7219.c | 7 ++++--- 2 files changed, 32 insertions(+), 7 deletions(-) -- 1.9.3 diff --git a/sound/soc/codecs/da7219-aad.c b/sound/soc/codecs/da7219-aad.c index c4853a8..e04ee4f 100644 --- a/sound/soc/codecs/da7219-aad.c +++ b/sound/soc/codecs/da7219-aad.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -27,7 +28,6 @@ #include "da7219.h" #include "da7219-aad.h" - /* * Detection control */ @@ -383,7 +383,7 @@ static irqreturn_t da7219_aad_irq_thread(int irq, void *data) } /* - * DT to pdata conversion + * DT/ACPI to pdata conversion */ static enum da7219_aad_micbias_pulse_lvl @@ -539,6 +539,26 @@ static enum da7219_aad_adc_1bit_rpt } } +#ifdef CONFIG_ACPI +static inline bool da7219_aad_of_acpi_node_matched(struct fwnode_handle *child, + const char *name) +{ + struct acpi_data_node *acpi_node = to_acpi_data_node(child); + + if (strcmp(acpi_node->name, name) == 0) + return true; + else + return false; +} +#else +static inline bool da7219_aad_of_acpi_node_matched(struct fwnode_handle *child, + const char *name) +{ + return false; +} + +#endif /* CONFIG_ACPI */ + static struct fwnode_handle *da7219_aad_of_named_fwhandle(struct device *dev, const char *name) { @@ -551,6 +571,9 @@ static struct fwnode_handle *da7219_aad_of_named_fwhandle(struct device *dev, of_node = to_of_node(child); if (of_node_cmp(of_node->name, name) == 0) return child; + } else if (is_acpi_data_node(child)) { + if (da7219_aad_of_acpi_node_matched(child, name)) + return child; } } @@ -787,8 +810,9 @@ int da7219_aad_init(struct snd_soc_codec *codec) da7219->aad = da7219_aad; da7219_aad->codec = codec; - /* Handle any DT/platform data */ - if ((codec->dev->of_node) && (da7219->pdata)) + /* Handle any DT/ACPI/platform data */ + if (((codec->dev->of_node) || is_acpi_node(codec->dev->fwnode)) && + (da7219->pdata)) da7219->pdata->aad_pdata = da7219_aad_of_to_pdata(codec); da7219_aad_handle_pdata(codec); diff --git a/sound/soc/codecs/da7219.c b/sound/soc/codecs/da7219.c index 6c6c8db..bc32322 100644 --- a/sound/soc/codecs/da7219.c +++ b/sound/soc/codecs/da7219.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -1418,7 +1419,7 @@ static struct snd_soc_dai_driver da7219_dai = { /* - * DT + * DT/ACPI */ static const struct of_device_id da7219_of_match[] = { @@ -1656,8 +1657,8 @@ static int da7219_probe(struct snd_soc_codec *codec) break; } - /* Handle DT/Platform data */ - if (codec->dev->of_node) + /* Handle DT/ACPI/Platform data */ + if (codec->dev->of_node || is_acpi_node(codec->dev->fwnode)) da7219->pdata = da7219_of_to_pdata(codec); else da7219->pdata = dev_get_platdata(codec->dev);