From patchwork Tue Feb 27 21:24:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Myl=C3=A8ne_Josserand?= X-Patchwork-Id: 10250991 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 CE79460211 for ; Thu, 1 Mar 2018 11:17:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD17128429 for ; Thu, 1 Mar 2018 11:17:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B1EC82844B; Thu, 1 Mar 2018 11:17:50 +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 259EC28429 for ; Thu, 1 Mar 2018 11:17:49 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id BDB7826771B; Thu, 1 Mar 2018 12:17:40 +0100 (CET) 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 25366267736; Tue, 27 Feb 2018 22:25:10 +0100 (CET) Received: from mail.bootlin.com (mail.bootlin.com [62.4.15.54]) by alsa0.perex.cz (Postfix) with ESMTP id 24D84267734 for ; Tue, 27 Feb 2018 22:25:08 +0100 (CET) Received: by mail.bootlin.com (Postfix, from userid 110) id 624102091C; Tue, 27 Feb 2018 22:25:06 +0100 (CET) Received: from dell-desktop.home (vol75-h03-176-137-37-244.dsl.sta.abo.bbox.fr [176.137.37.244]) by mail.bootlin.com (Postfix) with ESMTPSA id 7DBF32036E; Tue, 27 Feb 2018 22:24:55 +0100 (CET) From: =?UTF-8?q?Myl=C3=A8ne=20Josserand?= To: lgirdwood@gmail.com, broonie@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com, perex@perex.cz, tiwai@suse.com Date: Tue, 27 Feb 2018 22:24:30 +0100 Message-Id: <20180227212433.2189-2-mylene.josserand@bootlin.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180227212433.2189-1-mylene.josserand@bootlin.com> References: <20180227212433.2189-1-mylene.josserand@bootlin.com> MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 01 Mar 2018 12:17:35 +0100 Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, alexandre.belloni@bootlin.com, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, mylene.josserand@bootlin.com Subject: [alsa-devel] [PATCH v1 1/4] ASoC: codecs: pcm179x: Add PCM1789 id 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 To prepare the support for the PCM1789, add a new compatible and use the i2c_id to handle, later, the differences between these two DACs even if they are pretty similar. Signed-off-by: Mylène Josserand --- Documentation/devicetree/bindings/sound/pcm179x.txt | 2 +- sound/soc/codecs/pcm179x-i2c.c | 6 ++++-- sound/soc/codecs/pcm179x.c | 3 ++- sound/soc/codecs/pcm179x.h | 8 +++++++- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Documentation/devicetree/bindings/sound/pcm179x.txt b/Documentation/devicetree/bindings/sound/pcm179x.txt index 436c2b247693..bf725d302958 100644 --- a/Documentation/devicetree/bindings/sound/pcm179x.txt +++ b/Documentation/devicetree/bindings/sound/pcm179x.txt @@ -4,7 +4,7 @@ This driver supports both the I2C and SPI bus. Required properties: - - compatible: "ti,pcm1792a" + - compatible: "ti,pcm1792a" or "ti,pcm1789" For required properties on SPI, please consult Documentation/devicetree/bindings/spi/spi-bus.txt diff --git a/sound/soc/codecs/pcm179x-i2c.c b/sound/soc/codecs/pcm179x-i2c.c index 03747966c6bc..795a0657c097 100644 --- a/sound/soc/codecs/pcm179x-i2c.c +++ b/sound/soc/codecs/pcm179x-i2c.c @@ -36,17 +36,19 @@ static int pcm179x_i2c_probe(struct i2c_client *client, return ret; } - return pcm179x_common_init(&client->dev, regmap); + return pcm179x_common_init(&client->dev, regmap, id->driver_data); } static const struct of_device_id pcm179x_of_match[] = { { .compatible = "ti,pcm1792a", }, + { .compatible = "ti,pcm1789", }, { } }; MODULE_DEVICE_TABLE(of, pcm179x_of_match); static const struct i2c_device_id pcm179x_i2c_ids[] = { - { "pcm179x", 0 }, + { "pcm179x", PCM179X }, + { "pcm1789", PCM1789 }, { } }; MODULE_DEVICE_TABLE(i2c, pcm179x_i2c_ids); diff --git a/sound/soc/codecs/pcm179x.c b/sound/soc/codecs/pcm179x.c index 4b311c06f97d..81cbf09319f6 100644 --- a/sound/soc/codecs/pcm179x.c +++ b/sound/soc/codecs/pcm179x.c @@ -218,7 +218,8 @@ static const struct snd_soc_component_driver soc_component_dev_pcm179x = { .non_legacy_dai_naming = 1, }; -int pcm179x_common_init(struct device *dev, struct regmap *regmap) +int pcm179x_common_init(struct device *dev, struct regmap *regmap, + enum pcm17xx_type type) { struct pcm179x_private *pcm179x; diff --git a/sound/soc/codecs/pcm179x.h b/sound/soc/codecs/pcm179x.h index cf8681c9a373..8c08689e3b8b 100644 --- a/sound/soc/codecs/pcm179x.h +++ b/sound/soc/codecs/pcm179x.h @@ -17,11 +17,17 @@ #ifndef __PCM179X_H__ #define __PCM179X_H__ +enum pcm17xx_type { + PCM179X, + PCM1789, +}; + #define PCM1792A_FORMATS (SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_S24_LE | \ SNDRV_PCM_FMTBIT_S16_LE) extern const struct regmap_config pcm179x_regmap_config; -int pcm179x_common_init(struct device *dev, struct regmap *regmap); +int pcm179x_common_init(struct device *dev, struct regmap *regmap, + enum pcm17xx_type type); #endif