From patchwork Mon Jan 29 02:58:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 10188811 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 0003560388 for ; Mon, 29 Jan 2018 03:00:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E07DE1FF40 for ; Mon, 29 Jan 2018 03:00:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D4D7F2860F; Mon, 29 Jan 2018 03:00:07 +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.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=no 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 943712860F for ; Mon, 29 Jan 2018 03:00:05 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 2563526731A; Mon, 29 Jan 2018 03:59:29 +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 872C2267282; Mon, 29 Jan 2018 03:59:25 +0100 (CET) Received: from relmlie1.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa0.perex.cz (Postfix) with ESMTP id 1C8292672AF for ; Mon, 29 Jan 2018 03:58:28 +0100 (CET) Received: from unknown (HELO relmlir1.idc.renesas.com) ([10.200.68.151]) by relmlie1.idc.renesas.com with ESMTP; 29 Jan 2018 11:58:27 +0900 Received: from relmlii2.idc.renesas.com (relmlii2.idc.renesas.com [10.200.68.66]) by relmlir1.idc.renesas.com (Postfix) with ESMTP id 7276374218; Mon, 29 Jan 2018 11:58:27 +0900 (JST) X-IronPort-AV: E=Sophos;i="5.46,429,1511794800"; d="scan'208";a="270906750" Received: from mail-sg2apc01lp0240.outbound.protection.outlook.com (HELO APC01-SG2-obe.outbound.protection.outlook.com) ([65.55.88.240]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA256; 29 Jan 2018 11:58:26 +0900 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesasgroup.onmicrosoft.com; s=selector1-renesas-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=CmuQvJ69kcs6vdkNr0SspJ2RjR8yYuj9sJBKNtNiLgM=; b=nrBCJ8GkNwS2v1yGVquPU6wdSMucU+ZLH3ZED2Wkq/o5YqL1cNhdIwExLykgm4eSEMPeDXm33wWbFnxxiK0Pfy8nSxJH21Q/1BVquHDjmWLFev5KUq2zQfa5eQUMnX25BSQltJ/naDDCVdpNIzv9p5SauoKPGl1PCfRuvmLygPg= Received: from morimoto-PC.renesas.com (211.11.155.138) by KL1PR0601MB1877.apcprd06.prod.outlook.com (2603:1096:802:7::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.444.14; Mon, 29 Jan 2018 02:58:25 +0000 Message-ID: <87fu6p5q4m.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 To: Mark Brown In-Reply-To: <87inbl5q6q.wl%kuninori.morimoto.gx@renesas.com> References: <87607l8k9i.wl%kuninori.morimoto.gx@renesas.com> <87inbl5q6q.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Date: Mon, 29 Jan 2018 02:58:25 +0000 X-Originating-IP: [211.11.155.138] X-ClientProxiedBy: OS2PR0101CA0020.jpnprd01.prod.outlook.com (2603:1096:600:3::30) To KL1PR0601MB1877.apcprd06.prod.outlook.com (2603:1096:802:7::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 3ad26648-7a33-4d14-84cc-08d566c42a79 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:KL1PR0601MB1877; X-Microsoft-Exchange-Diagnostics: 1; KL1PR0601MB1877; 3:gOijLsUwCc9yy64I1CrAvSmoDPXietCJSyQozPFXkNR1IypvD155OyIzHRjKRNkzDfS9j2pocX0VX+vjX6DWoalmxo+HTH88N3v3KCQgEMQU4OxZB4iIwFdMEvjiWICClxn5mf6tuBAp2+L14K28ksTuJxeyuybI/3UgcsjSopcgNHZORsfSnKbGrLbl3jwY8lumPoJU8OeoKiRm0YlnxZAbgRao/YXPtLGXquW0WdJvZQfx6iGn2y3pozxAegSR; 25:uixhJ5oK+nEycC0PWafUjQEHKkfjqwVxKttVDkyphrWHNhIBRMqLeCQ46gvs6asszj1xbdmO28SrzUjPgovq+uF3vNiMdQOe7gDBGRhlrEKkpFEC/8LoZnhPPJzCfscAWSYhu3xDntA/UOYuQ0ni3P5zCuj4Trq4IdWQCISoUnBxGCR/Dl4uP7okhCCQ8gzBfflIGvXMpWpc4HvwEy5DQAuP9lTgegjt5M7jDhZPHryqiwlNjWE6UfU3wIkyVXPiEqkA/NIcAKYyXhARLMuhUWKGgi4YDdI2/UyPfoHhFRKViJ7eQHZrIF+c88YbBJYgpk9A9m0I8wgKz8JNv/0WGQ==; 31:/QdmETqHBgDXrh+5/B+bDkdUXBR8pFsvf/jJOnbDK2+NX4uV5CvL1C/xnZ2t8/4HdVGgQa5lB6C/yEEp7LdMUD83nK+dJCsLyUkKarCJTQIuXD5iIyaMFJN9n4wMmnScstH0Y60KSMW6WqcizlM/ApxhOuQC+pGETGWEf6P3lGejwvEZK/LWXJvi8pnG4QLvbAdrtWq1k5YDn2RSpWpvk0SqakjhsvvhM7DigVyPOGo= X-MS-TrafficTypeDiagnostic: KL1PR0601MB1877: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=kuninori.morimoto.gx@renesas.com; X-Microsoft-Exchange-Diagnostics: 1; KL1PR0601MB1877; 20:LUH5LHT1puNkm8qQgyQQY8hokwDpHRFR2kbJgmZuozNVF4CHUUCnccxw0AZvAyNRD2OYQl3K4+/7xQOgiwcO9YgqNW5k4s+Qa5YAVhjLjBCL+kcz1tRVzBF2Mk3nevL9YsqYHjh9czkkKMVBNsqG6gFHoi04DsJ24dOEigOB2PcpjepOY4nHIDF6L4SZ/j31ZCmNvzMsMY6TFXoTI56j59aW2NIpecT+kPeqV94suQI4LSdv1UEB7HcYXumfRZaaISds8bwGNo2vDeW10cAAfia9LFrEqx3GHEFiXP8gl2hzJIZaAYh2IHdBGh7rhaElEY5LEPWeMwLDU2EWKJVGhY2Db0jSS5BuVNpNvLrMMnaQAcVrQKW6XNtJw9ZIHpn44PTnZpQyVPmS7Zabo0wb0gYSWRP7GxU7q4SiUINh0JPE6dghVag30X9N8Ft7HW7FVTAxhh61oBN8fHzyROd0GUU60pbECqLyzeNbnW7QkcvAnZN0/9x9S31qE8dO/BtG; 4:dqYmRk6v72JwIOIUkuNzZOdKAcV0lNslk78v2fIQxuyrbBnIJNke1gVd6Rmu+TH6vbynvD1zZi2ijdnH3Jo7rJRDXfcyLtCyv4tD/159Mduyt0uM4Hjr4jcyZbkL+YsjbqQoxZvcACv/aXApE39hcY8mxhSeFBxuh2sf32AgjKp1/gw0PHi41hoOalJOUdlOSyN8Wf4xwvJnzSlcUzg4ADsu/li3eiFP7QiBknF4+8ZfuFfkDd/HU2L5keBzK7Edr7cURHP25OxF1ORtedaThzTOeaSgkE9AaKfL5atJ+6ij1Rn+VlxLuyLiINw+uLos X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(788757137089); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231101)(944501161)(10201501046)(3002001)(6055026)(6041288)(20161123564045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(6072148)(201708071742011); SRVR:KL1PR0601MB1877; BCL:0; PCL:0; RULEID:; SRVR:KL1PR0601MB1877; X-Forefront-PRVS: 0567A15835 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(396003)(39380400002)(39860400002)(346002)(366004)(376002)(199004)(189003)(25786009)(478600001)(3846002)(6116002)(6486002)(23726003)(105586002)(4326008)(53936002)(36756003)(53416004)(97736004)(106356001)(2906002)(7736002)(305945005)(83506002)(66066001)(68736007)(8676002)(26005)(47776003)(59450400001)(5660300001)(386003)(76176011)(6916009)(7696005)(69596002)(8936002)(86362001)(52116002)(81166006)(50466002)(2950100002)(16586007)(81156014)(186003)(16526019)(316002)(58126008)(21314002)(16060500001)(309714004); DIR:OUT; SFP:1102; SCL:1; SRVR:KL1PR0601MB1877; H:morimoto-PC.renesas.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: renesas.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; KL1PR0601MB1877; 23:I6FUpDVv+YrbMu8zoWeaHVucuZ+faZ9yxMPzlIm?= =?us-ascii?Q?SpmZkQ6qKJwAiEDuXTzfudpqR7EuaxGxihEmyDDxr2bkmssqEsyluQOwZY+g?= =?us-ascii?Q?vhhaA6rwnQbJpRAqFJFMzahm8Vrawc0toi5M3Y6oJCIYEWEqLjNqV4a2qKEJ?= =?us-ascii?Q?0yuIT3YlmsgbCfKbA9imKnEjwQfXw5Oh8+q07Jq2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2ShosAGLAqB/FtHpBLJV8Ybn4YUCxDP7IZoKms5rkAEnoy3DxlH0JSnQk0w+utcBo9LNU4UoXtBK6q SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; KL1PR0601MB1877; 20:W1Dl3diykzxoPv9gvm+wn6WffznLTwvUIuLKVQi/hYH2/N6lECNNwAMmteGWKf/V3CkpvDikKOM2bFS9BuKTJFdfTCmggIsxXDxe2tuTE7nIje5rpUUnbZMjXVtK6quEA+WP/0NTk6UP8SiN6qiCvf4yv5OEWXn5MoXSgv/GxLM= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jan 2018 02:58:25.0648 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3ad26648-7a33-4d14-84cc-08d566c42a79 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR0601MB1877 Cc: Linux-ALSA Subject: [alsa-devel] [PATCH v2 002/186] ASoC: ac97: replace codec to component 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 From: Kuninori Morimoto Now we can replace Codec to Component. Let's do it. Note: xxx_codec_xxx() -> xxx_component_xxx() .idle_bias_off = 0 -> .idle_bias_on = 1 .ignore_pmdown_time = 0 -> .use_pmdown_time = 1 - -> .endianness = 1 - -> .non_legacy_dai_naming = 1 To keep compatibilty, this patch adds snd_soc_xxx_ac97_codec() macro. These will be removed when all codec code was removed. Signed-off-by: Kuninori Morimoto --- include/sound/soc.h | 13 ++++++-- sound/soc/codecs/ac97.c | 46 +++++++++++++-------------- sound/soc/soc-ac97.c | 84 ++++++++++++++++++++++++++----------------------- 3 files changed, 77 insertions(+), 66 deletions(-) diff --git a/include/sound/soc.h b/include/sound/soc.h index 747fd58..6a11b02 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -586,10 +586,17 @@ int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned int reg, unsigned int mask, unsigned int value); #ifdef CONFIG_SND_SOC_AC97_BUS -struct snd_ac97 *snd_soc_alloc_ac97_codec(struct snd_soc_codec *codec); -struct snd_ac97 *snd_soc_new_ac97_codec(struct snd_soc_codec *codec, +#define snd_soc_alloc_ac97_codec(codec) \ + snd_soc_alloc_ac97_component(&codec->component) +#define snd_soc_new_ac97_codec(codec, id, id_mask) \ + snd_soc_new_ac97_component(&codec->component, id, id_mask) +#define snd_soc_free_ac97_codec(ac97) \ + snd_soc_free_ac97_component(ac97) + +struct snd_ac97 *snd_soc_alloc_ac97_component(struct snd_soc_component *component); +struct snd_ac97 *snd_soc_new_ac97_component(struct snd_soc_component *component, unsigned int id, unsigned int id_mask); -void snd_soc_free_ac97_codec(struct snd_ac97 *ac97); +void snd_soc_free_ac97_component(struct snd_ac97 *ac97); int snd_soc_set_ac97_ops(struct snd_ac97_bus_ops *ops); int snd_soc_set_ac97_ops_of_reset(struct snd_ac97_bus_ops *ops, diff --git a/sound/soc/codecs/ac97.c b/sound/soc/codecs/ac97.c index 440b4ce..02b4d01 100644 --- a/sound/soc/codecs/ac97.c +++ b/sound/soc/codecs/ac97.c @@ -36,8 +36,8 @@ static int ac97_prepare(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { - struct snd_soc_codec *codec = dai->codec; - struct snd_ac97 *ac97 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct snd_ac97 *ac97 = snd_soc_component_get_drvdata(component); int reg = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? AC97_PCM_FRONT_DAC_RATE : AC97_PCM_LR_ADC_RATE; @@ -65,7 +65,7 @@ static int ac97_prepare(struct snd_pcm_substream *substream, .ops = &ac97_dai_ops, }; -static int ac97_soc_probe(struct snd_soc_codec *codec) +static int ac97_soc_probe(struct snd_soc_component *component) { struct snd_ac97 *ac97; struct snd_ac97_bus *ac97_bus; @@ -73,7 +73,7 @@ static int ac97_soc_probe(struct snd_soc_codec *codec) int ret; /* add codec as bus device for standard ac97 */ - ret = snd_ac97_bus(codec->component.card->snd_card, 0, soc_ac97_ops, + ret = snd_ac97_bus(component->card->snd_card, 0, soc_ac97_ops, NULL, &ac97_bus); if (ret < 0) return ret; @@ -83,25 +83,25 @@ static int ac97_soc_probe(struct snd_soc_codec *codec) if (ret < 0) return ret; - snd_soc_codec_set_drvdata(codec, ac97); + snd_soc_component_set_drvdata(component, ac97); return 0; } #ifdef CONFIG_PM -static int ac97_soc_suspend(struct snd_soc_codec *codec) +static int ac97_soc_suspend(struct snd_soc_component *component) { - struct snd_ac97 *ac97 = snd_soc_codec_get_drvdata(codec); + struct snd_ac97 *ac97 = snd_soc_component_get_drvdata(component); snd_ac97_suspend(ac97); return 0; } -static int ac97_soc_resume(struct snd_soc_codec *codec) +static int ac97_soc_resume(struct snd_soc_component *component) { - struct snd_ac97 *ac97 = snd_soc_codec_get_drvdata(codec); + struct snd_ac97 *ac97 = snd_soc_component_get_drvdata(component); snd_ac97_resume(ac97); @@ -112,28 +112,28 @@ static int ac97_soc_resume(struct snd_soc_codec *codec) #define ac97_soc_resume NULL #endif -static const struct snd_soc_codec_driver soc_codec_dev_ac97 = { - .probe = ac97_soc_probe, - .suspend = ac97_soc_suspend, - .resume = ac97_soc_resume, - - .component_driver = { - .dapm_widgets = ac97_widgets, - .num_dapm_widgets = ARRAY_SIZE(ac97_widgets), - .dapm_routes = ac97_routes, - .num_dapm_routes = ARRAY_SIZE(ac97_routes), - }, +static const struct snd_soc_component_driver soc_component_dev_ac97 = { + .probe = ac97_soc_probe, + .suspend = ac97_soc_suspend, + .resume = ac97_soc_resume, + .dapm_widgets = ac97_widgets, + .num_dapm_widgets = ARRAY_SIZE(ac97_widgets), + .dapm_routes = ac97_routes, + .num_dapm_routes = ARRAY_SIZE(ac97_routes), + .idle_bias_on = 1, + .use_pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; static int ac97_probe(struct platform_device *pdev) { - return snd_soc_register_codec(&pdev->dev, - &soc_codec_dev_ac97, &ac97_dai, 1); + return devm_snd_soc_register_component(&pdev->dev, + &soc_component_dev_ac97, &ac97_dai, 1); } static int ac97_remove(struct platform_device *pdev) { - snd_soc_unregister_codec(&pdev->dev); return 0; } diff --git a/sound/soc/soc-ac97.c b/sound/soc/soc-ac97.c index 36dae41..3f424f2 100644 --- a/sound/soc/soc-ac97.c +++ b/sound/soc/soc-ac97.c @@ -44,7 +44,7 @@ struct snd_ac97_gpio_priv { struct gpio_chip gpio_chip; #endif unsigned int gpios_set; - struct snd_soc_codec *codec; + struct snd_soc_component *component; }; static struct snd_ac97_bus soc_ac97_bus = { @@ -57,11 +57,11 @@ static void soc_ac97_device_release(struct device *dev) } #ifdef CONFIG_GPIOLIB -static inline struct snd_soc_codec *gpio_to_codec(struct gpio_chip *chip) +static inline struct snd_soc_component *gpio_to_component(struct gpio_chip *chip) { struct snd_ac97_gpio_priv *gpio_priv = gpiochip_get_data(chip); - return gpio_priv->codec; + return gpio_priv->component; } static int snd_soc_ac97_gpio_request(struct gpio_chip *chip, unsigned offset) @@ -75,20 +75,22 @@ static int snd_soc_ac97_gpio_request(struct gpio_chip *chip, unsigned offset) static int snd_soc_ac97_gpio_direction_in(struct gpio_chip *chip, unsigned offset) { - struct snd_soc_codec *codec = gpio_to_codec(chip); + struct snd_soc_component *component = gpio_to_component(chip); - dev_dbg(codec->dev, "set gpio %d to output\n", offset); - return snd_soc_update_bits(codec, AC97_GPIO_CFG, + dev_dbg(component->dev, "set gpio %d to output\n", offset); + return snd_soc_component_update_bits(component, AC97_GPIO_CFG, 1 << offset, 1 << offset); } static int snd_soc_ac97_gpio_get(struct gpio_chip *chip, unsigned offset) { - struct snd_soc_codec *codec = gpio_to_codec(chip); + struct snd_soc_component *component = gpio_to_component(chip); int ret; - ret = snd_soc_read(codec, AC97_GPIO_STATUS); - dev_dbg(codec->dev, "get gpio %d : %d\n", offset, + if (snd_soc_component_read(component, AC97_GPIO_STATUS, &ret) < 0) + ret = -1; + + dev_dbg(component->dev, "get gpio %d : %d\n", offset, ret < 0 ? ret : ret & (1 << offset)); return ret < 0 ? ret : !!(ret & (1 << offset)); @@ -98,22 +100,24 @@ static void snd_soc_ac97_gpio_set(struct gpio_chip *chip, unsigned offset, int value) { struct snd_ac97_gpio_priv *gpio_priv = gpiochip_get_data(chip); - struct snd_soc_codec *codec = gpio_to_codec(chip); + struct snd_soc_component *component = gpio_to_component(chip); gpio_priv->gpios_set &= ~(1 << offset); gpio_priv->gpios_set |= (!!value) << offset; - snd_soc_write(codec, AC97_GPIO_STATUS, gpio_priv->gpios_set); - dev_dbg(codec->dev, "set gpio %d to %d\n", offset, !!value); + snd_soc_component_write(component, AC97_GPIO_STATUS, + gpio_priv->gpios_set); + dev_dbg(component->dev, "set gpio %d to %d\n", offset, !!value); } static int snd_soc_ac97_gpio_direction_out(struct gpio_chip *chip, unsigned offset, int value) { - struct snd_soc_codec *codec = gpio_to_codec(chip); + struct snd_soc_component *component = gpio_to_component(chip); - dev_dbg(codec->dev, "set gpio %d to output\n", offset); + dev_dbg(component->dev, "set gpio %d to output\n", offset); snd_soc_ac97_gpio_set(chip, offset, value); - return snd_soc_update_bits(codec, AC97_GPIO_CFG, 1 << offset, 0); + return snd_soc_component_update_bits(component, AC97_GPIO_CFG, + 1 << offset, 0); } static const struct gpio_chip snd_soc_ac97_gpio_chip = { @@ -128,24 +132,24 @@ static int snd_soc_ac97_gpio_direction_out(struct gpio_chip *chip, }; static int snd_soc_ac97_init_gpio(struct snd_ac97 *ac97, - struct snd_soc_codec *codec) + struct snd_soc_component *component) { struct snd_ac97_gpio_priv *gpio_priv; int ret; - gpio_priv = devm_kzalloc(codec->dev, sizeof(*gpio_priv), GFP_KERNEL); + gpio_priv = devm_kzalloc(component->dev, sizeof(*gpio_priv), GFP_KERNEL); if (!gpio_priv) return -ENOMEM; ac97->gpio_priv = gpio_priv; - gpio_priv->codec = codec; + gpio_priv->component = component; gpio_priv->gpio_chip = snd_soc_ac97_gpio_chip; gpio_priv->gpio_chip.ngpio = AC97_NUM_GPIOS; - gpio_priv->gpio_chip.parent = codec->dev; + gpio_priv->gpio_chip.parent = component->dev; gpio_priv->gpio_chip.base = -1; ret = gpiochip_add_data(&gpio_priv->gpio_chip, gpio_priv); if (ret != 0) - dev_err(codec->dev, "Failed to add GPIOs: %d\n", ret); + dev_err(component->dev, "Failed to add GPIOs: %d\n", ret); return ret; } @@ -155,7 +159,7 @@ static void snd_soc_ac97_free_gpio(struct snd_ac97 *ac97) } #else static int snd_soc_ac97_init_gpio(struct snd_ac97 *ac97, - struct snd_soc_codec *codec) + struct snd_soc_component *component) { return 0; } @@ -166,8 +170,8 @@ static void snd_soc_ac97_free_gpio(struct snd_ac97 *ac97) #endif /** - * snd_soc_alloc_ac97_codec() - Allocate new a AC'97 device - * @codec: The CODEC for which to create the AC'97 device + * snd_soc_alloc_ac97_component() - Allocate new a AC'97 device + * @component: The COMPONENT for which to create the AC'97 device * * Allocated a new snd_ac97 device and intializes it, but does not yet register * it. The caller is responsible to either call device_add(&ac97->dev) to @@ -175,7 +179,7 @@ static void snd_soc_ac97_free_gpio(struct snd_ac97 *ac97) * * Returns: A snd_ac97 device or a PTR_ERR in case of an error. */ -struct snd_ac97 *snd_soc_alloc_ac97_codec(struct snd_soc_codec *codec) +struct snd_ac97 *snd_soc_alloc_ac97_component(struct snd_soc_component *component) { struct snd_ac97 *ac97; @@ -187,26 +191,26 @@ struct snd_ac97 *snd_soc_alloc_ac97_codec(struct snd_soc_codec *codec) ac97->num = 0; ac97->dev.bus = &ac97_bus_type; - ac97->dev.parent = codec->component.card->dev; + ac97->dev.parent = component->card->dev; ac97->dev.release = soc_ac97_device_release; dev_set_name(&ac97->dev, "%d-%d:%s", - codec->component.card->snd_card->number, 0, - codec->component.name); + component->card->snd_card->number, 0, + component->name); device_initialize(&ac97->dev); return ac97; } -EXPORT_SYMBOL(snd_soc_alloc_ac97_codec); +EXPORT_SYMBOL(snd_soc_alloc_ac97_component); /** - * snd_soc_new_ac97_codec - initailise AC97 device - * @codec: audio codec + * snd_soc_new_ac97_component - initailise AC97 device + * @component: audio component * @id: The expected device ID * @id_mask: Mask that is applied to the device ID before comparing with @id * - * Initialises AC97 codec resources for use by ad-hoc devices only. + * Initialises AC97 component resources for use by ad-hoc devices only. * * If @id is not 0 this function will reset the device, then read the ID from * the device and check if it matches the expected ID. If it doesn't match an @@ -214,20 +218,20 @@ struct snd_ac97 *snd_soc_alloc_ac97_codec(struct snd_soc_codec *codec) * * Returns: A PTR_ERR() on failure or a valid snd_ac97 struct on success. */ -struct snd_ac97 *snd_soc_new_ac97_codec(struct snd_soc_codec *codec, +struct snd_ac97 *snd_soc_new_ac97_component(struct snd_soc_component *component, unsigned int id, unsigned int id_mask) { struct snd_ac97 *ac97; int ret; - ac97 = snd_soc_alloc_ac97_codec(codec); + ac97 = snd_soc_alloc_ac97_component(component); if (IS_ERR(ac97)) return ac97; if (id) { ret = snd_ac97_reset(ac97, false, id, id_mask); if (ret < 0) { - dev_err(codec->dev, "Failed to reset AC97 device: %d\n", + dev_err(component->dev, "Failed to reset AC97 device: %d\n", ret); goto err_put_device; } @@ -237,7 +241,7 @@ struct snd_ac97 *snd_soc_new_ac97_codec(struct snd_soc_codec *codec, if (ret) goto err_put_device; - ret = snd_soc_ac97_init_gpio(ac97, codec); + ret = snd_soc_ac97_init_gpio(ac97, component); if (ret) goto err_put_device; @@ -247,22 +251,22 @@ struct snd_ac97 *snd_soc_new_ac97_codec(struct snd_soc_codec *codec, put_device(&ac97->dev); return ERR_PTR(ret); } -EXPORT_SYMBOL_GPL(snd_soc_new_ac97_codec); +EXPORT_SYMBOL_GPL(snd_soc_new_ac97_component); /** - * snd_soc_free_ac97_codec - free AC97 codec device + * snd_soc_free_ac97_component - free AC97 component device * @ac97: snd_ac97 device to be freed * - * Frees AC97 codec device resources. + * Frees AC97 component device resources. */ -void snd_soc_free_ac97_codec(struct snd_ac97 *ac97) +void snd_soc_free_ac97_component(struct snd_ac97 *ac97) { snd_soc_ac97_free_gpio(ac97); device_del(&ac97->dev); ac97->bus = NULL; put_device(&ac97->dev); } -EXPORT_SYMBOL_GPL(snd_soc_free_ac97_codec); +EXPORT_SYMBOL_GPL(snd_soc_free_ac97_component); static struct snd_ac97_reset_cfg snd_ac97_rst_cfg;