From patchwork Tue Apr 4 19:26:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 9662517 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 F2422602BA for ; Tue, 4 Apr 2017 19:40:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E08A428569 for ; Tue, 4 Apr 2017 19:40:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D213E2856D; Tue, 4 Apr 2017 19:40:58 +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=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0A68328569 for ; Tue, 4 Apr 2017 19:40:58 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 9B1BE266F30; Tue, 4 Apr 2017 21:27:04 +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 B2AA0266F2B; Tue, 4 Apr 2017 21:27:02 +0200 (CEST) Received: from osg.samsung.com (ec2-52-27-115-49.us-west-2.compute.amazonaws.com [52.27.115.49]) by alsa0.perex.cz (Postfix) with ESMTP id 5CE84266F16 for ; Tue, 4 Apr 2017 21:26:58 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by osg.samsung.com (Postfix) with ESMTP id E766DA05F2; Tue, 4 Apr 2017 19:27:21 +0000 (UTC) X-Virus-Scanned: amavisd-new at osg.samsung.com Received: from osg.samsung.com ([127.0.0.1]) by localhost (s-opensource.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mCA1qpBad-Uc; Tue, 4 Apr 2017 19:27:20 +0000 (UTC) Received: from localhost.localdomain (unknown [181.121.164.133]) by osg.samsung.com (Postfix) with ESMTPSA id 98D16A05F1; Tue, 4 Apr 2017 19:27:17 +0000 (UTC) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Date: Tue, 4 Apr 2017 15:26:27 -0400 Message-Id: <20170404192630.11408-4-javier@osg.samsung.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170404192630.11408-1-javier@osg.samsung.com> References: <20170404192630.11408-1-javier@osg.samsung.com> Cc: alsa-devel@alsa-project.org, Kuninori Morimoto , Liam Girdwood , Takashi Iwai , Javier Martinez Canillas , Mark Brown Subject: [alsa-devel] [PATCH 3/6] ASoC: sta529: Add OF device ID table 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP The driver doesn't have a struct of_device_id table but supported devices are registered via Device Trees. This is working on the assumption that a I2C device registered via OF will always match a legacy I2C device ID and that the MODALIAS reported will always be of the form i2c:. But this could change in the future so the correct approach is to have an OF device ID table if the devices are registered via OF. Before this patch: $ modinfo sound/soc/codecs/snd-soc-sta529.ko | grep alias alias: i2c:sta529 After this patch: $ modinfo sound/soc/codecs/snd-soc-sta529.ko | grep alias alias: of:N*T*Cst,sta529C* alias: of:N*T*Cst,sta529 alias: i2c:sta529 Signed-off-by: Javier Martinez Canillas --- sound/soc/codecs/sta529.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sound/soc/codecs/sta529.c b/sound/soc/codecs/sta529.c index d4b384e4b266..660734359bf3 100644 --- a/sound/soc/codecs/sta529.c +++ b/sound/soc/codecs/sta529.c @@ -375,9 +375,16 @@ static const struct i2c_device_id sta529_i2c_id[] = { }; MODULE_DEVICE_TABLE(i2c, sta529_i2c_id); +static const struct of_device_id sta529_of_match[] = { + { .compatible = "st,sta529", }, + { } +}; +MODULE_DEVICE_TABLE(of, sta529_of_match); + static struct i2c_driver sta529_i2c_driver = { .driver = { .name = "sta529", + .of_match_table = sta529_of_match, }, .probe = sta529_i2c_probe, .remove = sta529_i2c_remove,