From patchwork Mon Jan 29 03:50:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 10189011 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 D157460388 for ; Mon, 29 Jan 2018 04:27:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB60328783 for ; Mon, 29 Jan 2018 04:27:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ADE2E28786; Mon, 29 Jan 2018 04:27:27 +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 205F628783 for ; Mon, 29 Jan 2018 04:27:26 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 95D2C267935; Mon, 29 Jan 2018 05:24:04 +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 A3D2E26792D; Mon, 29 Jan 2018 05:24:02 +0100 (CET) Received: from relmlie1.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa0.perex.cz (Postfix) with ESMTP id 187A0267736 for ; Mon, 29 Jan 2018 04:50:37 +0100 (CET) Received: from unknown (HELO relmlir2.idc.renesas.com) ([10.200.68.152]) by relmlie1.idc.renesas.com with ESMTP; 29 Jan 2018 12:50:31 +0900 Received: from relmlii2.idc.renesas.com (relmlii2.idc.renesas.com [10.200.68.66]) by relmlir2.idc.renesas.com (Postfix) with ESMTP id 158CC69E2B; Mon, 29 Jan 2018 12:50:31 +0900 (JST) X-IronPort-AV: E=Sophos;i="5.46,429,1511794800"; d="scan'208";a="270912169" Received: from mail-hk2apc01lp0207.outbound.protection.outlook.com (HELO APC01-HK2-obe.outbound.protection.outlook.com) ([65.55.88.207]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA256; 29 Jan 2018 12:50:30 +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=B/pdhjIL67s6VyG1N40U+C1KjUfjPdkztD5GkXv4YRY=; b=AKh3INYvrEU78/g4VVlH3gVoIQLDhsF5/LDo5Xn3NwZF+OUsdM1UO6UOQcHEmkCQYUwdE3kScaO2NcXiAm6K2uAznbFoZ5Z/j30aX4WlIGsYsH7OPTobZejDVN0/gblfPG2duSmmph18CArXFT/lZZnEKNzwOD1gGrx5SaF4Z+4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=kuninori.morimoto.gx@renesas.com; Received: from morimoto-PC.renesas.com (211.11.155.138) by SG2PR0601MB1888.apcprd06.prod.outlook.com (2603:1096:3:9::21) 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 03:50:28 +0000 Message-ID: <87po5t1g0i.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 03:50:28 +0000 X-Originating-IP: [211.11.155.138] X-ClientProxiedBy: KAWPR01CA0090.jpnprd01.prod.outlook.com (2603:1096:402:c::26) To SG2PR0601MB1888.apcprd06.prod.outlook.com (2603:1096:3:9::21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 2b05fbf4-baef-41ee-f3ee-08d566cb701f X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:SG2PR0601MB1888; X-Microsoft-Exchange-Diagnostics: 1; SG2PR0601MB1888; 3:dzu46VarbqlPLYMXn+csi0ZsiR2D7MKfNwQvXRE3Rv2JrnNRaaYb+6Cb9vYOiUj0Xdy4Hac5TP/69gs95DgVm75bkTyWpmjF4Ue+LOX+VVG491xXDUuA11V+ekSDOhKoEYNn3YQS2h8aWzhZ6NHxaI2f6a6IUoruzJY1v50P8QWDJ/LIgmjekxB9abKvaSeqTMqlV+b1kigbpeazgIbi4o0K1OP8VwY9MEHAUZJO1vVDvj6U5Wgx4YVxwGYqDoZZ; 25:aTE02keQq+BeSEV2uXalHZEtDascSY4qWSS3N6DaGiJwKsJ+p0DbOJTWuQerQBpgOpfczfs3S2LF8GemnN4x20LBZThUVP4iledGnZZOQLu2czTEqq0826lNVtLGUoY3sPSIQLXpbj8rr/6yLMlLD2NCiSlG5WXD8fuK8kTXJzeGiXz0ON88KU09zNe4KZ12MVfVH9FwJQR7thNOUKSNUeHZDd2Y5FCvxMYLVEQXCjxK8CojL9pRq+t5oQiqe58MFVrWq8jjULfMyD0VjY4ZTCJ7gOwev9zpRGZFYJzrBn/k1ZbwFsDF1ywIYWhIy8M5afmwi5Vk2tstckRjqavw6g==; 31:ae6MUkx0+Hchm4Dwo1CJnDzBQ2dRcFL8s8prNJLWh7zslZjcK5a3YcalGiuoqQckUNlkDV+UvTHzCXBpUsK+fvbGNfwyRaNqVmZvt0Qt+HzGYrivEUpzpaAh30MQLQqUqq+WLb6Rf+xM62BYhlG66Znzf48bELv1EceGGizB9xulctCpKRN9IprovXLKx50SQpZBAEnVSWSm0AwxixJ6/yNnuDh+57YeBfFytze7EKA= X-MS-TrafficTypeDiagnostic: SG2PR0601MB1888: X-Microsoft-Exchange-Diagnostics: 1; SG2PR0601MB1888; 20:sOoIGXLMWEGgJ8Wmij99H0VbQAkWQ5Hm8ZRJciguBn+TNopkau8hadTLXk8qzowZPRvAFqa4zQ8N6VsHd/ORwvdMly9IXHaMA8FOIwopUOIfhMpjUiX/b2tPkDB3JyTeSVbhX/IjAJvevCMMGtl+pgYzb5bb1BsuU71bxLUzzGlwtsaN10/IVpBhjJZKjgpba/EzR9EqopXqx6/yN0AKiaRNpK0WHoT8/Zzmcrgq+oT+xzPUgpjdJj599U/6++Xgao+3t8vRmBkOy513C4ld3airdRkErg8BHmK1f06whVmyJY79taemtOqkhin81H5xea1Z7ing+o2ihUythcRUGFSy5FVQXEq/O0KZl1iEXJeMt88Tnhd0Iqcf8w+B4w55VvKMezR39QaWxggRhoCRZ7MJBv28Wct0OMf2ev7iphzk9zxuusR1n8gVHVTrqJvfNJA/R187PWS69swSiMF627YEUqSzdl5W1MKblBjSE9Bx14bltx5RX+FNw3mLs/+r; 4:XkTfC11tUAmFhWZMjOT7WMExOMHUXLvkHz1CWDF5o+jSqt2tmjLVitttN0YX2n/YGdJ+vl+wqJSRtN/a42gVknnC0a6pHgT4dXSBW+GOTg9Q0+z3JbfECiGrRHvSc1/suocYChIXlttRumdsUcrOeVf2ZNVGJlHZC0zziFxLW0yCotA02dcktNK0xuKGTtf9HM4OniHDubs3ZqTWm/3mXrlkClAUQl41z5Q3uGmbfvSiWG+Iy+O4wAuxh7TwDoUW/88Lii0z97qgtb/TgkKugxcpRSMLgqeQ2a1BjILUUCa8v1IykeSzpxsok2lrA6/4 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(788757137089); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(5005006)(8121501046)(3002001)(10201501046)(3231101)(944501161)(93006095)(93001095)(6055026)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(6072148)(201708071742011); SRVR:SG2PR0601MB1888; BCL:0; PCL:0; RULEID:; SRVR:SG2PR0601MB1888; X-Forefront-PRVS: 0567A15835 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(396003)(376002)(346002)(39380400002)(39860400002)(366004)(189003)(199004)(52116002)(7696005)(2950100002)(25786009)(76176011)(4326008)(58126008)(316002)(83506002)(59450400001)(386003)(36756003)(69596002)(86362001)(16586007)(5660300001)(6916009)(26005)(6486002)(53936002)(105586002)(23726003)(106356001)(47776003)(50466002)(3846002)(6116002)(68736007)(66066001)(8676002)(186003)(7736002)(305945005)(81166006)(81156014)(8936002)(478600001)(2906002)(16526019)(53416004)(97736004)(21314002)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:SG2PR0601MB1888; H:morimoto-PC.renesas.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A: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; SG2PR0601MB1888; 23:5lmdIJmACZ5aEBh9PXDdjsz1mfGYUOsOHnUqq0Q?= =?us-ascii?Q?GNSO5wXEfIrlF3inDAoODbRB++/EqzW2N3GRgjkKWo+NEets8gbY4u9oHMXh?= =?us-ascii?Q?dSB4INswH2NDPqi54Vwks5YPZbEygw1hfWWktiG5k+avQklmDt/eM13mys+w?= =?us-ascii?Q?pxdUVJ3JjQSmaPTChXGfetoyO/tTPw9mdQRJLtGoe0FAC8nGZ5yDgL2H7HqS?= =?us-ascii?Q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iagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SG2PR0601MB1888; 20:0wX5Z1R/tjCmiEvzG6DlKLKQO2Q+sDJSfxRuquXpTXjIQu5lPN0MClVGk6WlEuWWs8CWapV7wrGgPBSeLiOksFz/vzOGHS2/Tpe4DcSWvQA7L98HFkLhG7p7zKGM/dlbjlpiBNxosvPN2enC328o7lfrxIIBaP4JUP7+pqjjyhg= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jan 2018 03:50:28.4892 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2b05fbf4-baef-41ee-f3ee-08d566cb701f X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: SG2PR0601MB1888 Cc: Linux-ALSA Subject: [alsa-devel] [PATCH v2 070/186] ASoC: cs4271: 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 Signed-off-by: Kuninori Morimoto --- sound/soc/codecs/cs4271-i2c.c | 7 --- sound/soc/codecs/cs4271-spi.c | 7 --- sound/soc/codecs/cs4271.c | 105 +++++++++++++++++++++--------------------- 3 files changed, 52 insertions(+), 67 deletions(-) diff --git a/sound/soc/codecs/cs4271-i2c.c b/sound/soc/codecs/cs4271-i2c.c index dcb3223..ff73730 100644 --- a/sound/soc/codecs/cs4271-i2c.c +++ b/sound/soc/codecs/cs4271-i2c.c @@ -33,12 +33,6 @@ static int cs4271_i2c_probe(struct i2c_client *client, devm_regmap_init_i2c(client, &config)); } -static int cs4271_i2c_remove(struct i2c_client *client) -{ - snd_soc_unregister_codec(&client->dev); - return 0; -} - static const struct i2c_device_id cs4271_i2c_id[] = { { "cs4271", 0 }, { } @@ -51,7 +45,6 @@ static int cs4271_i2c_remove(struct i2c_client *client) .of_match_table = of_match_ptr(cs4271_dt_ids), }, .probe = cs4271_i2c_probe, - .remove = cs4271_i2c_remove, .id_table = cs4271_i2c_id, }; module_i2c_driver(cs4271_i2c_driver); diff --git a/sound/soc/codecs/cs4271-spi.c b/sound/soc/codecs/cs4271-spi.c index 1ff5f52..217f6dc 100644 --- a/sound/soc/codecs/cs4271-spi.c +++ b/sound/soc/codecs/cs4271-spi.c @@ -33,19 +33,12 @@ static int cs4271_spi_probe(struct spi_device *spi) return cs4271_probe(&spi->dev, devm_regmap_init_spi(spi, &config)); } -static int cs4271_spi_remove(struct spi_device *spi) -{ - snd_soc_unregister_codec(&spi->dev); - return 0; -} - static struct spi_driver cs4271_spi_driver = { .driver = { .name = "cs4271", .of_match_table = of_match_ptr(cs4271_dt_ids), }, .probe = cs4271_spi_probe, - .remove = cs4271_spi_remove, }; module_spi_driver(cs4271_spi_driver); diff --git a/sound/soc/codecs/cs4271.c b/sound/soc/codecs/cs4271.c index 49a80627..849fdb2 100644 --- a/sound/soc/codecs/cs4271.c +++ b/sound/soc/codecs/cs4271.c @@ -206,8 +206,8 @@ struct cs4271_private { static int cs4271_set_dai_sysclk(struct snd_soc_dai *codec_dai, int clk_id, unsigned int freq, int dir) { - struct snd_soc_codec *codec = codec_dai->codec; - struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = codec_dai->component; + struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component); cs4271->mclk = freq; return 0; @@ -216,8 +216,8 @@ static int cs4271_set_dai_sysclk(struct snd_soc_dai *codec_dai, static int cs4271_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int format) { - struct snd_soc_codec *codec = codec_dai->codec; - struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = codec_dai->component; + struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component); unsigned int val = 0; int ret; @@ -230,7 +230,7 @@ static int cs4271_set_dai_fmt(struct snd_soc_dai *codec_dai, val |= CS4271_MODE1_MASTER; break; default: - dev_err(codec->dev, "Invalid DAI format\n"); + dev_err(component->dev, "Invalid DAI format\n"); return -EINVAL; } @@ -250,7 +250,7 @@ static int cs4271_set_dai_fmt(struct snd_soc_dai *codec_dai, return ret; break; default: - dev_err(codec->dev, "Invalid DAI format\n"); + dev_err(component->dev, "Invalid DAI format\n"); return -EINVAL; } @@ -263,9 +263,9 @@ static int cs4271_set_dai_fmt(struct snd_soc_dai *codec_dai, static int cs4271_deemph[] = {0, 44100, 48000, 32000}; -static int cs4271_set_deemph(struct snd_soc_codec *codec) +static int cs4271_set_deemph(struct snd_soc_component *component) { - struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); + struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component); int i, ret; int val = CS4271_DACCTL_DEM_DIS; @@ -289,8 +289,8 @@ static int cs4271_set_deemph(struct snd_soc_codec *codec) static int cs4271_get_deemph(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); - struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component); ucontrol->value.integer.value[0] = cs4271->deemph; return 0; @@ -299,11 +299,11 @@ static int cs4271_get_deemph(struct snd_kcontrol *kcontrol, static int cs4271_put_deemph(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); - struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component); cs4271->deemph = ucontrol->value.integer.value[0]; - return cs4271_set_deemph(codec); + return cs4271_set_deemph(component); } struct cs4271_clk_cfg { @@ -349,8 +349,8 @@ static int cs4271_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) { - struct snd_soc_codec *codec = dai->codec; - struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component); int i, ret; unsigned int ratio, val; @@ -399,7 +399,7 @@ static int cs4271_hw_params(struct snd_pcm_substream *substream, break; if (i == CS4171_NR_RATIOS) { - dev_err(codec->dev, "Invalid sample rate\n"); + dev_err(component->dev, "Invalid sample rate\n"); return -EINVAL; } @@ -410,13 +410,13 @@ static int cs4271_hw_params(struct snd_pcm_substream *substream, if (ret < 0) return ret; - return cs4271_set_deemph(codec); + return cs4271_set_deemph(component); } static int cs4271_mute_stream(struct snd_soc_dai *dai, int mute, int stream) { - struct snd_soc_codec *codec = dai->codec; - struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component); int ret; int val_a = 0; int val_b = 0; @@ -493,9 +493,9 @@ static int cs4271_mute_stream(struct snd_soc_dai *dai, int mute, int stream) .symmetric_rates = 1, }; -static int cs4271_reset(struct snd_soc_codec *codec) +static int cs4271_reset(struct snd_soc_component *component) { - struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); + struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component); if (gpio_is_valid(cs4271->gpio_nreset)) { gpio_direction_output(cs4271->gpio_nreset, 0); @@ -508,10 +508,10 @@ static int cs4271_reset(struct snd_soc_codec *codec) } #ifdef CONFIG_PM -static int cs4271_soc_suspend(struct snd_soc_codec *codec) +static int cs4271_soc_suspend(struct snd_soc_component *component) { int ret; - struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); + struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component); /* Set power-down bit */ ret = regmap_update_bits(cs4271->regmap, CS4271_MODE2, @@ -525,20 +525,20 @@ static int cs4271_soc_suspend(struct snd_soc_codec *codec) return 0; } -static int cs4271_soc_resume(struct snd_soc_codec *codec) +static int cs4271_soc_resume(struct snd_soc_component *component) { int ret; - struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); + struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component); ret = regulator_bulk_enable(ARRAY_SIZE(cs4271->supplies), cs4271->supplies); if (ret < 0) { - dev_err(codec->dev, "Failed to enable regulators: %d\n", ret); + dev_err(component->dev, "Failed to enable regulators: %d\n", ret); return ret; } /* Do a proper reset after power up */ - cs4271_reset(codec); + cs4271_reset(component); /* Restore codec state */ ret = regcache_sync(cs4271->regmap); @@ -567,20 +567,20 @@ static int cs4271_soc_resume(struct snd_soc_codec *codec) EXPORT_SYMBOL_GPL(cs4271_dt_ids); #endif -static int cs4271_codec_probe(struct snd_soc_codec *codec) +static int cs4271_component_probe(struct snd_soc_component *component) { - struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); - struct cs4271_platform_data *cs4271plat = codec->dev->platform_data; + struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component); + struct cs4271_platform_data *cs4271plat = component->dev->platform_data; int ret; bool amutec_eq_bmutec = false; #ifdef CONFIG_OF - if (of_match_device(cs4271_dt_ids, codec->dev)) { - if (of_get_property(codec->dev->of_node, + if (of_match_device(cs4271_dt_ids, component->dev)) { + if (of_get_property(component->dev->of_node, "cirrus,amutec-eq-bmutec", NULL)) amutec_eq_bmutec = true; - if (of_get_property(codec->dev->of_node, + if (of_get_property(component->dev->of_node, "cirrus,enable-soft-reset", NULL)) cs4271->enable_soft_reset = true; } @@ -589,7 +589,7 @@ static int cs4271_codec_probe(struct snd_soc_codec *codec) ret = regulator_bulk_enable(ARRAY_SIZE(cs4271->supplies), cs4271->supplies); if (ret < 0) { - dev_err(codec->dev, "Failed to enable regulators: %d\n", ret); + dev_err(component->dev, "Failed to enable regulators: %d\n", ret); return ret; } @@ -599,7 +599,7 @@ static int cs4271_codec_probe(struct snd_soc_codec *codec) } /* Reset codec */ - cs4271_reset(codec); + cs4271_reset(component); ret = regcache_sync(cs4271->regmap); if (ret < 0) @@ -625,9 +625,9 @@ static int cs4271_codec_probe(struct snd_soc_codec *codec) return 0; } -static int cs4271_codec_remove(struct snd_soc_codec *codec) +static void cs4271_component_remove(struct snd_soc_component *component) { - struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); + struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component); if (gpio_is_valid(cs4271->gpio_nreset)) /* Set codec to the reset state */ @@ -635,24 +635,23 @@ static int cs4271_codec_remove(struct snd_soc_codec *codec) regcache_mark_dirty(cs4271->regmap); regulator_bulk_disable(ARRAY_SIZE(cs4271->supplies), cs4271->supplies); - - return 0; }; -static const struct snd_soc_codec_driver soc_codec_dev_cs4271 = { - .probe = cs4271_codec_probe, - .remove = cs4271_codec_remove, +static const struct snd_soc_component_driver soc_component_dev_cs4271 = { + .probe = cs4271_component_probe, + .remove = cs4271_component_remove, .suspend = cs4271_soc_suspend, .resume = cs4271_soc_resume, - - .component_driver = { - .controls = cs4271_snd_controls, - .num_controls = ARRAY_SIZE(cs4271_snd_controls), - .dapm_widgets = cs4271_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(cs4271_dapm_widgets), - .dapm_routes = cs4271_dapm_routes, - .num_dapm_routes = ARRAY_SIZE(cs4271_dapm_routes), - }, + .controls = cs4271_snd_controls, + .num_controls = ARRAY_SIZE(cs4271_snd_controls), + .dapm_widgets = cs4271_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(cs4271_dapm_widgets), + .dapm_routes = cs4271_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(cs4271_dapm_routes), + .idle_bias_on = 1, + .use_pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; static int cs4271_common_probe(struct device *dev, @@ -721,8 +720,8 @@ int cs4271_probe(struct device *dev, struct regmap *regmap) dev_set_drvdata(dev, cs4271); cs4271->regmap = regmap; - return snd_soc_register_codec(dev, &soc_codec_dev_cs4271, &cs4271_dai, - 1); + return devm_snd_soc_register_component(dev, &soc_component_dev_cs4271, + &cs4271_dai, 1); } EXPORT_SYMBOL_GPL(cs4271_probe);