From patchwork Wed Sep 13 19:37:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Jarzmik X-Patchwork-Id: 9951925 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 4B1F36038F for ; Wed, 13 Sep 2017 19:38:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3AE5028CCA for ; Wed, 13 Sep 2017 19:38:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2F7A328D6A; Wed, 13 Sep 2017 19:38:36 +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,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=unavailable 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 464FF28CEE for ; Wed, 13 Sep 2017 19:38:33 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 4BE66266F23; Wed, 13 Sep 2017 21:37:57 +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 E215F266FA2; Wed, 13 Sep 2017 21:37:55 +0200 (CEST) Received: from smtp.smtpout.orange.fr (smtp10.smtpout.orange.fr [80.12.242.132]) by alsa0.perex.cz (Postfix) with ESMTP id 1883B266986 for ; Wed, 13 Sep 2017 21:37:50 +0200 (CEST) Received: from belgarion.home ([90.55.206.157]) by mwinf5d86 with ME id 97de1w00E3QH74y037dk5o; Wed, 13 Sep 2017 21:37:50 +0200 X-ME-Helo: belgarion.home X-ME-Auth: amFyem1pay5yb2JlcnRAb3JhbmdlLmZy X-ME-Date: Wed, 13 Sep 2017 21:37:50 +0200 X-ME-IP: 90.55.206.157 From: Robert Jarzmik To: Dmitry Torokhov , Lee Jones , Jaroslav Kysela , Takashi Iwai , Liam Girdwood , Mark Brown , Daniel Mack , Haojian Zhuang , Robert Jarzmik , Lars-Peter Clausen , Charles Keepax Date: Wed, 13 Sep 2017 21:37:15 +0200 Message-Id: <20170913193723.16234-1-robert.jarzmik@free.fr> X-Mailer: git-send-email 2.11.0 Cc: alsa-devel@alsa-project.org, patches@opensource.wolfsonmicro.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-input@vger.kernel.org Subject: [alsa-devel] [PATCH v7 0/8] AC97 device/driver model revamp 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 Hi Lars, Mark, Charles, Lee, This is a revision for Lee and Charles, only targetted at wm97xx-core changes (second round) suggested by Lee and codecs remove path for Charles. I removed the leading 4 patches as Mark has already scheduled them. For easier spotting, I included in [1] the diff from the last serie. As before Charles, I think your ack is not granted anymore for codecs, could you have a look please ? Cheers. --- Robert Robert Jarzmik (8): Input: wm97xx: split out touchscreen registering mfd: wm97xx-core: core support for wm97xx Codec Input: wm97xx: add new AC97 bus support ASoC: wm9713: add ac97 new bus support ASoC: wm9712: add ac97 new bus support ASoC: wm9705: add private structure ASoC: wm9705: add ac97 new bus support ASoC: pxa: switch to new ac97 bus support drivers/input/touchscreen/Kconfig | 2 +- drivers/input/touchscreen/wm97xx-core.c | 252 +++++++++++++++------- drivers/mfd/Kconfig | 14 ++ drivers/mfd/Makefile | 1 + drivers/mfd/wm97xx-core.c | 366 ++++++++++++++++++++++++++++++++ include/linux/mfd/wm97xx.h | 25 +++ sound/arm/Kconfig | 1 - sound/soc/codecs/Kconfig | 9 +- sound/soc/codecs/wm9705.c | 66 ++++-- sound/soc/codecs/wm9712.c | 44 ++-- sound/soc/codecs/wm9713.c | 39 ++-- sound/soc/pxa/Kconfig | 5 +- sound/soc/pxa/pxa2xx-ac97.c | 46 ++-- 13 files changed, 712 insertions(+), 158 deletions(-) create mode 100644 drivers/mfd/wm97xx-core.c create mode 100644 include/linux/mfd/wm97xx.h diff --git a/drivers/mfd/wm97xx-core.c b/drivers/mfd/wm97xx-core.c index 66e477fffd43..4141ee52a70b 100644 --- a/drivers/mfd/wm97xx-core.c +++ b/drivers/mfd/wm97xx-core.c @@ -109,12 +109,8 @@ static const struct regmap_config wm9705_regmap_config = { }; static struct mfd_cell wm9705_cells[] = { - { - .name = "wm9705-codec", - }, - { - .name = "wm97xx-ts", - }, + { .name = "wm9705-codec", }, + { .name = "wm97xx-ts", }, }; static bool wm9712_volatile_reg(struct device *dev, unsigned int reg) @@ -181,12 +177,8 @@ static const struct regmap_config wm9712_regmap_config = { }; static struct mfd_cell wm9712_cells[] = { - { - .name = "wm9712-codec", - }, - { - .name = "wm97xx-ts", - }, + { .name = "wm9712-codec", }, + { .name = "wm97xx-ts", }, }; static const struct reg_default wm9713_reg_defaults[] = { @@ -256,12 +248,8 @@ static const struct regmap_config wm9713_regmap_config = { }; static struct mfd_cell wm9713_cells[] = { - { - .name = "wm9713-codec", - }, - { - .name = "wm97xx-ts", - }, + { .name = "wm9713-codec", }, + { .name = "wm97xx-ts", }, }; static int wm97xx_ac97_probe(struct ac97_codec_device *adev) @@ -270,7 +258,7 @@ static int wm97xx_ac97_probe(struct ac97_codec_device *adev) const struct regmap_config *config; struct wm97xx_platform_data *codec_pdata; struct mfd_cell *cells; - int ret = 0, nb_cells, i; + int ret = -ENODEV, nb_cells, i; struct wm97xx_pdata *pdata = snd_ac97_codec_get_platdata(adev); wm97xx = devm_kzalloc(ac97_codec_dev2dev(adev), @@ -309,7 +297,7 @@ static int wm97xx_ac97_probe(struct ac97_codec_device *adev) nb_cells = ARRAY_SIZE(wm9713_cells); break; default: - config = NULL; + goto err_free_compat; } for (i = 0; i < nb_cells; i++) { @@ -317,23 +305,22 @@ static int wm97xx_ac97_probe(struct ac97_codec_device *adev) cells[i].pdata_size = sizeof(*codec_pdata); } - if (config) { - codec_pdata->regmap = - devm_regmap_init_ac97(wm97xx->ac97, config); - if (IS_ERR(codec_pdata->regmap)) - ret = PTR_ERR(codec_pdata->regmap); - } else { - ret = -ENODEV; + codec_pdata->regmap = devm_regmap_init_ac97(wm97xx->ac97, config); + if (IS_ERR(codec_pdata->regmap)) { + ret = PTR_ERR(codec_pdata->regmap); + goto err_free_compat; } - if (!ret) - ret = devm_mfd_add_devices(wm97xx->dev, PLATFORM_DEVID_NONE, - cells, nb_cells, NULL, 0, NULL); - + ret = devm_mfd_add_devices(wm97xx->dev, PLATFORM_DEVID_NONE, + cells, nb_cells, NULL, 0, NULL); if (ret) - snd_ac97_compat_release(wm97xx->ac97); + goto err_free_compat; return ret; + +err_free_compat: + snd_ac97_compat_release(wm97xx->ac97); + return ret; } static int wm97xx_ac97_remove(struct ac97_codec_device *adev) diff --git a/sound/soc/codecs/wm9705.c b/sound/soc/codecs/wm9705.c index 46b5a77c53e4..68c204e3599f 100644 --- a/sound/soc/codecs/wm9705.c +++ b/sound/soc/codecs/wm9705.c @@ -354,11 +354,14 @@ static int wm9705_soc_probe(struct snd_soc_codec *codec) static int wm9705_soc_remove(struct snd_soc_codec *codec) { +#ifdef CONFIG_SND_SOC_AC97_BUS struct wm9705_priv *wm9705 = snd_soc_codec_get_drvdata(codec); - snd_soc_codec_exit_regmap(codec); - if (!wm9705->mfd_pdata) + if (!wm9705->mfd_pdata) { + snd_soc_codec_exit_regmap(codec); snd_soc_free_ac97_codec(wm9705->ac97); + } +#endif return 0; } diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c index 7ebbb48b18c5..1e228bf9f1ae 100644 --- a/sound/soc/codecs/wm9712.c +++ b/sound/soc/codecs/wm9712.c @@ -674,11 +674,14 @@ static int wm9712_soc_probe(struct snd_soc_codec *codec) static int wm9712_soc_remove(struct snd_soc_codec *codec) { +#ifdef CONFIG_SND_SOC_AC97_BUS struct wm9712_priv *wm9712 = snd_soc_codec_get_drvdata(codec); - snd_soc_codec_exit_regmap(codec); - if (!wm9712->mfd_pdata) + if (!wm9712->mfd_pdata) { + snd_soc_codec_exit_regmap(codec); snd_soc_free_ac97_codec(wm9712->ac97); + } +#endif return 0; } diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c index 3df2c01d751d..df7220656d98 100644 --- a/sound/soc/codecs/wm9713.c +++ b/sound/soc/codecs/wm9713.c @@ -1238,14 +1238,14 @@ static int wm9713_soc_probe(struct snd_soc_codec *codec) static int wm9713_soc_remove(struct snd_soc_codec *codec) { +#ifdef CONFIG_SND_SOC_AC97_BUS struct wm9713_priv *wm9713 = snd_soc_codec_get_drvdata(codec); if (!wm9713->mfd_pdata) { snd_soc_codec_exit_regmap(codec); -#ifdef CONFIG_SND_SOC_AC97_BUS snd_soc_free_ac97_codec(wm9713->ac97); -#endif } +#endif return 0; }