From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: [PATCH v3 1/7] ASoC: hda - add soc hda codec driver wrapper Date: Wed, 29 Apr 2015 13:59:33 +0200 Message-ID: References: <1430250870-3169-1-git-send-email-vinod.koul@intel.com> <1430250870-3169-2-git-send-email-vinod.koul@intel.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 6E8642604CA for ; Wed, 29 Apr 2015 13:59:34 +0200 (CEST) In-Reply-To: <1430250870-3169-2-git-send-email-vinod.koul@intel.com> 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 To: Vinod Koul Cc: liam.r.girdwood@linux.intel.com, patches.audio@intel.com, alsa-devel@alsa-project.org, broonie@kernel.org, Jeeja KP List-Id: alsa-devel@alsa-project.org At Wed, 29 Apr 2015 01:24:24 +0530, Vinod Koul wrote: > > From: Jeeja KP > > For ASoC HDA codecs we need to provide match function based on id_table and > driver register/unregister wrapper functions > > Signed-off-by: Jeeja KP > Signed-off-by: Vinod Koul > --- > sound/soc/Kconfig | 1 + > sound/soc/Makefile | 1 + > sound/soc/hda/Kconfig | 3 ++ > sound/soc/hda/Makefile | 3 ++ > sound/soc/hda/soc-hda-codec.c | 85 +++++++++++++++++++++++++++++++++++++++++ > sound/soc/hda/soc-hda-codec.h | 44 +++++++++++++++++++++ > 6 files changed, 137 insertions(+) > create mode 100644 sound/soc/hda/Kconfig > create mode 100644 sound/soc/hda/Makefile > create mode 100644 sound/soc/hda/soc-hda-codec.c > create mode 100644 sound/soc/hda/soc-hda-codec.h > > diff --git a/sound/soc/Kconfig b/sound/soc/Kconfig > index 3ba52da18bc6..d3903580cb10 100644 > --- a/sound/soc/Kconfig > +++ b/sound/soc/Kconfig > @@ -40,6 +40,7 @@ source "sound/soc/cirrus/Kconfig" > source "sound/soc/davinci/Kconfig" > source "sound/soc/dwc/Kconfig" > source "sound/soc/fsl/Kconfig" > +source "sound/soc/hda/Kconfig" > source "sound/soc/jz4740/Kconfig" > source "sound/soc/nuc900/Kconfig" > source "sound/soc/omap/Kconfig" > diff --git a/sound/soc/Makefile b/sound/soc/Makefile > index 974ba708b482..8741d6a38bf6 100644 > --- a/sound/soc/Makefile > +++ b/sound/soc/Makefile > @@ -21,6 +21,7 @@ obj-$(CONFIG_SND_SOC) += cirrus/ > obj-$(CONFIG_SND_SOC) += davinci/ > obj-$(CONFIG_SND_SOC) += dwc/ > obj-$(CONFIG_SND_SOC) += fsl/ > +obj-$(CONFIG_SND_SOC) += hda/ > obj-$(CONFIG_SND_SOC) += jz4740/ > obj-$(CONFIG_SND_SOC) += intel/ > obj-$(CONFIG_SND_SOC) += mxs/ > diff --git a/sound/soc/hda/Kconfig b/sound/soc/hda/Kconfig > new file mode 100644 > index 000000000000..815943360bc5 > --- /dev/null > +++ b/sound/soc/hda/Kconfig > @@ -0,0 +1,3 @@ > +config SND_SOC_HDA_CORE > + tristate > + select SND_HDA_CORE > diff --git a/sound/soc/hda/Makefile b/sound/soc/hda/Makefile > new file mode 100644 > index 000000000000..9585ab180a55 > --- /dev/null > +++ b/sound/soc/hda/Makefile > @@ -0,0 +1,3 @@ > +snd-soc-hda-core-objs := soc-hda-codec.o > + > +obj-$(CONFIG_SND_SOC_HDA_CORE) += snd-soc-hda-core.o > diff --git a/sound/soc/hda/soc-hda-codec.c b/sound/soc/hda/soc-hda-codec.c > new file mode 100644 > index 000000000000..caceb2136bba > --- /dev/null > +++ b/sound/soc/hda/soc-hda-codec.c > @@ -0,0 +1,85 @@ > +/* > + * soc-hda-codec.c ASoC High Definition Audio Codec interface Definitions > + * > + * Copyright (c) 2014-2015 Intel Corporation > + * > + * Author(s): Jeeja KP > + * > + * > + * This driver is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License as published by > + * the Free Software Foundation; either version 2 of the License, or > + * (at your option) any later version. > + * > + * This driver is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + */ > + > +#include > +#include > +#include "soc-hda-codec.h" > + > +/** > + * snd_soc_hda_get_device_id - gets the hdac device id entry > + * @hdev: HD-audio core bus Not a bus. > + * @drv: HD-audio core stream object to initialize Not a stream. > + * Compares the hdac device vendor_id and revision_id to the hdac_soc_codec > + * driver id_table and returns the matching device id entry. > + */ > +const struct soc_hda_device_id * > +snd_soc_hda_get_device_id( > + struct hdac_device *hdev, > + struct soc_hda_codec_driver *drv) The indentation looks a bid odd. > diff --git a/sound/soc/hda/soc-hda-codec.h b/sound/soc/hda/soc-hda-codec.h > new file mode 100644 > index 000000000000..f8a199a58926 > --- /dev/null > +++ b/sound/soc/hda/soc-hda-codec.h > @@ -0,0 +1,44 @@ > +/* > + * ASoC High Definition Audio Codec interface > + * > + * Copyright (c) 2014-2015 Intel Corporation > + * > + * Author(s): Jeeja KP > + * > + * This program is free software; you can redistribute it and/or modify it > + * under the terms of the GNU General Public License as published by the Free > + * Software Foundation; either version 2 of the License, or (at your option) > + * any later version. > + * > + * This program is distributed in the hope that it will be useful, but WITHOUT > + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or > + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for > + * more details. > + * > + */ > + > +#include > + > +/*HDA device table*/ > +#define HDA_NAME_SIZE 20 > +struct soc_hda_device_id { > + __u32 id; > + __u32 rev_id; > + char name[HDA_NAME_SIZE]; > + unsigned long driver_data; > +}; > + > +struct soc_hda_codec_driver { > + struct hdac_driver core; > + const struct soc_hda_device_id *id_table; > +}; > + > +#define to_hdac_driver(drv) (container_of((drv), \ > + struct hdac_driver, driver)) > +#define to_soc_hda_codec_driver(hdrv) (container_of((hdrv), \ > + struct soc_hda_codec_driver, core)) > + > +int snd_soc_hda_codec_driver_register(struct soc_hda_codec_driver *drv); > +void snd_soc_hda_codec_driver_unregister(struct soc_hda_codec_driver *drv); > +const struct soc_hda_device_id *snd_soc_hda_get_device_id( > + struct hdac_device *hdev, struct soc_hda_codec_driver *drv); The ifdef guard is missing. Takashi