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: 9951949 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 0119A603F4 for ; Wed, 13 Sep 2017 19:38:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E5BF928C55 for ; Wed, 13 Sep 2017 19:38:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DA4D328C54; Wed, 13 Sep 2017 19:38:45 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5660628C50 for ; Wed, 13 Sep 2017 19:38:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=p2Av3Zz41JJ/OcC5NkDvMa1orWDe5t90d5paiZyhDdY=; b=FC/ 8awXxUnFWLJb0jaUECp/PfNrR1m2XcoRtbiyk7V88OTD+WafYEGh8/TVz6bytHx7e1jR7KYhIvx7A GOiAHu65L3P0SHlzRyYBcDZdfbPpRfMah5qzFzkim7f6vuLQVsTVgP/XWzmjvTPy7dXW0j/ob4RjJ RneSSPtW73Y04MhyFVmOfs/QgIXqshCGCBikHANlMQUMAi1kbg7FM8XpgL7DfiMRHdwRtwNd7sBzx 7Dxw9YYuFKZO7uniUnOhv0pG749g4pOiJPjkvyqq5Vm8zF6lP/ZiwcDGRlzvUAmsLs/zG1hWWGsGF Q30SxOj3OV0cPkpiqs4MqJRRd1pdibA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dsDUe-00026k-BK; Wed, 13 Sep 2017 19:38:40 +0000 Received: from smtp10.smtpout.orange.fr ([80.12.242.132] helo=smtp.smtpout.orange.fr) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dsDUH-0001lw-AW for linux-arm-kernel@lists.infradead.org; Wed, 13 Sep 2017 19:38:20 +0000 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 Subject: [PATCH v7 0/8] AC97 device/driver model revamp 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170913_123817_826272_9B715918 X-CRM114-Status: GOOD ( 20.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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; }