Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3749235imm; Sat, 25 Aug 2018 01:48:35 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdbfg1Y9mytX0+g6YYv7kZQr7WCGHBMwdR5WWZvSZoFWHAhiQ7Kj23LRigh63hOVodAO1l7L X-Received: by 2002:a62:174a:: with SMTP id 71-v6mr5459239pfx.217.1535186915245; Sat, 25 Aug 2018 01:48:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535186915; cv=none; d=google.com; s=arc-20160816; b=viyYUZlMeuimiBMm8U/77eIGLxgADlc2o2H9jrnYKDH6EB91p31b0kBVltJLUymiHF f2KaJd4BzWpacXoPPEga4ufwOF4gQta8V0NvkClK52irCYseirhKowh8xR1ApwdAPog9 sz52Pifsr17pvs/9GxJEWmT1nRDzUrafVBBkfqD+lPfxB/60pnWW8+O6e/CQfHZkga/F zP2BGRpqSnbTNm8ecerHkRhZcv+5q+RxD1JcOQZGBzHdTxTYV9e10CB33cp4vge4HBGs YNGepz6Tia8OBPz18pxFgoUJwQD0G4kT+EcO/KXNLR8evIDQEaKePdXBPLxUGVx5r2Vk eviQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=TUBhOI3FTifVWcVN5ssbDMKmeUMZSSIyLyVbNbeVd70=; b=pSUfdB9LNgM6khi5taxqcd0iBJF84k70qAQL1+XP71LXXWMssErQ02zv5bolinTsWE qIKl/GaH8bYnHwa64uNy8b9On7O9q95vjS5+9qRhNnpt/4uLyaIIKZbvKlFhbKTSQdzu hCkftXxVtMM411gu6DUIx8NwmqY+V3tBVdD9A+vLXXCOZyMjfp0undSlGoNAvmy3bvnD x+jpzPc/lvYXIWLOt40vIbXl/JkRgE3yvY+U7g1fbKm1IaMAqYhlzulyShuq32MDQAlc plO1U/v3ytzI7HwisEYjs8HYw0XRha972lfJL5G/9TQyDlf1TE5PTmGnJEQTDnSDtJbO z7jA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j124-v6si10290488pfb.191.2018.08.25.01.48.19; Sat, 25 Aug 2018 01:48:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726644AbeHYMYp (ORCPT + 99 others); Sat, 25 Aug 2018 08:24:45 -0400 Received: from smtp06.smtpout.orange.fr ([80.12.242.128]:29589 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725815AbeHYMYp (ORCPT ); Sat, 25 Aug 2018 08:24:45 -0400 Received: from belgarion.home ([90.89.234.36]) by mwinf5d41 with ME id TLmS1y0010nnJME03LmSMG; Sat, 25 Aug 2018 10:46:28 +0200 X-ME-Helo: belgarion.home X-ME-Auth: amFyem1pay5yb2JlcnRAb3JhbmdlLmZy X-ME-Date: Sat, 25 Aug 2018 10:46:28 +0200 X-ME-IP: 90.89.234.36 From: Robert Jarzmik To: Jaroslav Kysela , Takashi Iwai , Daniel Mack , Haojian Zhuang , Robert Jarzmik , Liam Girdwood , Mark Brown Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v9] ASoC: pxa: switch to new ac97 bus support Date: Sat, 25 Aug 2018 10:46:18 +0200 Message-Id: <20180825084618.13641-1-robert.jarzmik@free.fr> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Switch to the new ac97 bus support in sound/ac97 instead of the legacy snd_ac97 one. Signed-off-by: Robert Jarzmik --- Since v8: fixed the trivial compilation error v7 was in https://patchwork.kernel.org/patch/9951919/ --- sound/arm/Kconfig | 1 - sound/soc/pxa/Kconfig | 5 ++--- sound/soc/pxa/pxa2xx-ac97.c | 48 +++++++++++++++++++++++---------------------- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/sound/arm/Kconfig b/sound/arm/Kconfig index 5fbd47a9177e..28867732a318 100644 --- a/sound/arm/Kconfig +++ b/sound/arm/Kconfig @@ -31,7 +31,6 @@ endif # SND_ARM config SND_PXA2XX_LIB tristate - select SND_AC97_CODEC if SND_PXA2XX_LIB_AC97 select SND_DMAENGINE_PCM config SND_PXA2XX_LIB_AC97 diff --git a/sound/soc/pxa/Kconfig b/sound/soc/pxa/Kconfig index 776e148b0aa2..29f577e6dfc0 100644 --- a/sound/soc/pxa/Kconfig +++ b/sound/soc/pxa/Kconfig @@ -19,14 +19,13 @@ config SND_MMP_SOC config SND_PXA2XX_AC97 tristate - select SND_AC97_CODEC config SND_PXA2XX_SOC_AC97 tristate - select AC97_BUS + select AC97_BUS_NEW select SND_PXA2XX_LIB select SND_PXA2XX_LIB_AC97 - select SND_SOC_AC97_BUS + select SND_SOC_AC97_BUS_NEW config SND_PXA2XX_SOC_I2S select SND_PXA2XX_LIB diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c index 9f779657bc86..f8a3aa6c6d4e 100644 --- a/sound/soc/pxa/pxa2xx-ac97.c +++ b/sound/soc/pxa/pxa2xx-ac97.c @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -27,43 +28,35 @@ #include #include -static void pxa2xx_ac97_warm_reset(struct snd_ac97 *ac97) +static void pxa2xx_ac97_warm_reset(struct ac97_controller *adrv) { pxa2xx_ac97_try_warm_reset(); pxa2xx_ac97_finish_reset(); } -static void pxa2xx_ac97_cold_reset(struct snd_ac97 *ac97) +static void pxa2xx_ac97_cold_reset(struct ac97_controller *adrv) { pxa2xx_ac97_try_cold_reset(); pxa2xx_ac97_finish_reset(); } -static unsigned short pxa2xx_ac97_legacy_read(struct snd_ac97 *ac97, - unsigned short reg) +static int pxa2xx_ac97_read_actrl(struct ac97_controller *adrv, int slot, + unsigned short reg) { - int ret; - - ret = pxa2xx_ac97_read(ac97->num, reg); - if (ret < 0) - return 0; - else - return (unsigned short)(ret & 0xffff); + return pxa2xx_ac97_read(slot, reg); } -static void pxa2xx_ac97_legacy_write(struct snd_ac97 *ac97, - unsigned short reg, unsigned short val) +static int pxa2xx_ac97_write_actrl(struct ac97_controller *adrv, int slot, + unsigned short reg, unsigned short val) { - int ret; - - ret = pxa2xx_ac97_write(ac97->num, reg, val); + return pxa2xx_ac97_write(slot, reg, val); } -static struct snd_ac97_bus_ops pxa2xx_ac97_ops = { - .read = pxa2xx_ac97_legacy_read, - .write = pxa2xx_ac97_legacy_write, +static struct ac97_controller_ops pxa2xx_ac97_ops = { + .read = pxa2xx_ac97_read_actrl, + .write = pxa2xx_ac97_write_actrl, .warm_reset = pxa2xx_ac97_warm_reset, .reset = pxa2xx_ac97_cold_reset, }; @@ -233,6 +226,9 @@ MODULE_DEVICE_TABLE(of, pxa2xx_ac97_dt_ids); static int pxa2xx_ac97_dev_probe(struct platform_device *pdev) { int ret; + struct ac97_controller *ctrl; + pxa2xx_audio_ops_t *pdata = pdev->dev.platform_data; + void **codecs_pdata; if (pdev->id != -1) { dev_err(&pdev->dev, "PXA2xx has only one AC97 port.\n"); @@ -245,10 +241,14 @@ static int pxa2xx_ac97_dev_probe(struct platform_device *pdev) return ret; } - ret = snd_soc_set_ac97_ops(&pxa2xx_ac97_ops); - if (ret != 0) - return ret; + codecs_pdata = pdata ? pdata->codec_pdata : NULL; + ctrl = snd_ac97_controller_register(&pxa2xx_ac97_ops, &pdev->dev, + AC97_SLOTS_AVAILABLE_ALL, + codecs_pdata); + if (IS_ERR(ctrl)) + return PTR_ERR(ctrl); + platform_set_drvdata(pdev, ctrl); /* Punt most of the init to the SoC probe; we may need the machine * driver to do interesting things with the clocking to get us up * and running. @@ -259,8 +259,10 @@ static int pxa2xx_ac97_dev_probe(struct platform_device *pdev) static int pxa2xx_ac97_dev_remove(struct platform_device *pdev) { + struct ac97_controller *ctrl = platform_get_drvdata(pdev); + snd_soc_unregister_component(&pdev->dev); - snd_soc_set_ac97_ops(NULL); + snd_ac97_controller_unregister(ctrl); pxa2xx_ac97_hw_remove(pdev); return 0; } -- 2.11.0