From patchwork Mon Jul 1 13:42:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolaus Voss X-Patchwork-Id: 11026039 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 98A2E746 for ; Mon, 1 Jul 2019 13:43:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 890E2286D4 for ; Mon, 1 Jul 2019 13:43:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7CD7C28715; Mon, 1 Jul 2019 13:43:22 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E8CAF286CC for ; Mon, 1 Jul 2019 13:43:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729165AbfGANnO (ORCPT ); Mon, 1 Jul 2019 09:43:14 -0400 Received: from mail.steuer-voss.de ([85.183.69.95]:53010 "EHLO mail.steuer-voss.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727268AbfGANnN (ORCPT ); Mon, 1 Jul 2019 09:43:13 -0400 X-Virus-Scanned: Debian amavisd-new at mail.steuer-voss.de X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" Received: from pc-niv.weinmann.com (localhost [127.0.0.1]) by mail.steuer-voss.de (Postfix) with ESMTP id 48E854D130; Mon, 1 Jul 2019 15:43:09 +0200 (CEST) From: Nikolaus Voss To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Andreas Dannenberg , "Andrew F. Davis" , Kate Stewart Cc: Nikolaus Voss , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, nv@vosn.de Subject: [PATCH v2 2/2] ASoC: tas5720.c: add ACPI enumeration support Date: Mon, 1 Jul 2019 15:42:52 +0200 Message-Id: <24afd89b00bfba84d31083e6455baf1f3ad3f362.1561988282.git.nikolaus.voss@loewensteinmedical.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: <20190628143037.GH5379@sirena.org.uk> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add ACPI IDs for tas5720 and tas5722 and use device match API to determine the variant. Signed-off-by: Nikolaus Voss --- sound/soc/codecs/tas5720.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/tas5720.c b/sound/soc/codecs/tas5720.c index b2e897f094b4..e3f85926cac4 100644 --- a/sound/soc/codecs/tas5720.c +++ b/sound/soc/codecs/tas5720.c @@ -7,6 +7,7 @@ * Author: Andreas Dannenberg */ +#include #include #include #include @@ -631,7 +632,9 @@ static int tas5720_probe(struct i2c_client *client, data->tas5720_client = client; - data->variant = (const struct tas5720_variant *)id->driver_data; + data->variant = device_get_match_data(&client->dev); + if (!data->variant) + data->variant = (const struct tas5720_variant *)id->driver_data; data->regmap = devm_regmap_init_i2c(client, data->variant->reg_config); if (IS_ERR(data->regmap)) { @@ -687,10 +690,20 @@ static const struct of_device_id tas5720_of_match[] = { MODULE_DEVICE_TABLE(of, tas5720_of_match); #endif +#if IS_ENABLED(CONFIG_ACPI) +static const struct acpi_device_id tas5720_acpi_match[] = { + { "10TI5720", (kernel_ulong_t)&tas5720 }, + { "10TI5722", (kernel_ulong_t)&tas5722 }, + { } +}; +MODULE_DEVICE_TABLE(acpi, tas5720_acpi_match); +#endif + static struct i2c_driver tas5720_i2c_driver = { .driver = { .name = "tas5720", .of_match_table = of_match_ptr(tas5720_of_match), + .acpi_match_table = ACPI_PTR(tas5720_acpi_match), }, .probe = tas5720_probe, .id_table = tas5720_id,