From patchwork Fri Jan 12 01:31:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 10159315 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 327F8602D8 for ; Fri, 12 Jan 2018 02:19:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 19491289CD for ; Fri, 12 Jan 2018 02:19:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0D827289CF; Fri, 12 Jan 2018 02:19:53 +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 97037289CD for ; Fri, 12 Jan 2018 02:19:51 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 1C17F267BC4; Fri, 12 Jan 2018 03:19:49 +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 DE25F267BE2; Fri, 12 Jan 2018 03:19:47 +0100 (CET) Received: from relmlie2.idc.renesas.com (relmlor3.renesas.com [210.160.252.173]) by alsa0.perex.cz (Postfix) with ESMTP id 3138B267BC4 for ; Fri, 12 Jan 2018 02:31:40 +0100 (CET) Received: from unknown (HELO relmlir1.idc.renesas.com) ([10.200.68.151]) by relmlie2.idc.renesas.com with ESMTP; 12 Jan 2018 10:31:39 +0900 Received: from relmlii1.idc.renesas.com (relmlii1.idc.renesas.com [10.200.68.65]) by relmlir1.idc.renesas.com (Postfix) with ESMTP id 9A7826D5FF; Fri, 12 Jan 2018 10:31:39 +0900 (JST) X-IronPort-AV: E=Sophos;i="5.46,346,1511794800"; d="scan'208";a="268008934" Received: from mail-pu1apc01lp0017.outbound.protection.outlook.com (HELO APC01-PU1-obe.outbound.protection.outlook.com) ([65.55.88.17]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-GCM-SHA384; 12 Jan 2018 10:31:38 +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=p42NIfpWz+yfvodWqTl1NgCPAD7dWMElyR4TFJpWIX0=; b=RoxiOmI4ZupXQnh/VLtOEsuCAqfLpqNH3n54s2/munO6JXtHkpF7ACJaYKiiZkLD3tzsyiKgCB4sDkodlB1T/h7j98hDYF1VbWgUwR3t+drPN6p2utq67GyrsjsUCTEbCdyc9A9E4nJRdc+oTNPp/Y2E7icoF3hQpNXeXaNhfEQ= 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 KL1PR0601MB1878.apcprd06.prod.outlook.com (2603:1096:802:7::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.386.5; Fri, 12 Jan 2018 01:31:37 +0000 Message-ID: <87373bamoa.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: <87bmhzevk9.wl%kuninori.morimoto.gx@renesas.com> References: <87bmhzevk9.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Date: Fri, 12 Jan 2018 01:31:37 +0000 X-Originating-IP: [211.11.155.138] X-ClientProxiedBy: TY1PR01CA0162.jpnprd01.prod.outlook.com (2603:1096:402::14) To KL1PR0601MB1878.apcprd06.prod.outlook.com (2603:1096:802:7::23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e93cd1fe-9078-4fcd-faa5-08d5595c3939 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020074)(4652020)(5600026)(4604075)(48565401081)(2017052603307)(7153060)(7193020); SRVR:KL1PR0601MB1878; X-Microsoft-Exchange-Diagnostics: 1; KL1PR0601MB1878; 3:Lm8vBv61SuMK8Nt8qVDZCD+GL5r6uyLN93tMgdjbYbVhRhHY6kt/hbC/txD+jty76l7+59hRfxwGMuR0BWSZPhtqhvg93BplLa3QRio9VP+tbSvw92FoIoRiOgFPacMsjkD83TG8NeXsGBpBIdmuDhU6L7/hOZsmnWG+yCQ3e+zxGwvfavdzSFJTDtHLInnMOqGZohiOUDMoWbEDnKutG95clCo/+o9Hwy+rwXgDbVfl27F7GzLt4i56hbPU3awd; 25:UI1og5EFSPkexEO2PY4YI+1Yj6Tnez6hTTtO2c6WMWe2ooFLNvXcFwKNS4SsJZUdGGvWGERxVMARmrzIluVqv2JarZHpk26i4P0brlKMcqo7YzLPXx9UsjuTRR3wj0aOmxcaIDTormBiJ0EUGxtzCh9MITn3P3ZV+yM3K5zDXBrJZpiWcYwC5e09LJZDMocBjlCkbN+rTthQlz+9wCGopZmzik4htfYxAnSh/D4wVEdhtD7D2MsWfTaorhBWlcd1J3GnXI26qntzPlP6/snMnRAOuqSeE1fyCivSPmXloQp7Kh6TY+rGohI+VNeQfldzOTKimMgKOUAeiWRhqOJdLA==; 31:MquQaWWkkwvEHNjPAC4X/rwBfgkIykLlb6teQdEyLjaMs/0+E/Jlax8ABwWPSJ7kUmOREhZOzJESD7apcU9nVAn+83VASUVMCdJXmy3wPU/AC2JqznxBqz6mv4MRtSlVsZshO5BNuHzxEdUlF9VXSRD9wrycLhCQwoi+yiyE1qpe2rnxjAWGDCNZ0NOr7/vJHDJcRyIpCvZbyG9zr/tNEDuHK1wmVS8zjPB3Xq0ldHo= X-MS-TrafficTypeDiagnostic: KL1PR0601MB1878: X-Microsoft-Exchange-Diagnostics: 1; KL1PR0601MB1878; 20:LnwwSVptWPbFV7ntd0x9Y4c4rRzVEXMuCIrRgJHZ6lmnNf/j4bhiagScML/xBeVfp8G5fuUn6XzcyvrGT4pSPq01FBiCRbzJY0Kob/TdCqrYdimAoW9x9eCelHd+XIjU07UYUxucG6TcABAynJjmaCKh1UfuFOG0/Wp9v/0CNH0+nRIPI2urfBBQlphF2Zl1XiQWPzrkITwGB501GQLHFOA95yTpbIfd20LWbRtTj4gUgxLrsCygyUykmlxVl5/svphvl6Go4C1vtlvCjfsELE77OZFwfgsR8qfjMNnvpNnC3tpFipWJbUh4mn20MbXnfUBFymhCLW8rPYRc36VpaM585yIilGVVmGzfrmdFp51LPmw7UpT8d+vG41DD8aSpdP+ZJFXAxoKuiyaqSFiREWZ6dODlHohYkxNKa6nk5MQNkgBbaEcKN6szrvTQD/OAFHyo2YnQOKSJwtAGl7XypyYKYPSsggXmMXFOLTuZrH5bU9iTGrSrujrkR7N24mZI; 4:lcxTPZsFu9NoodqehsNS6iobeBZkmukBRxq+TR2AKIZ/0QEy/azQE3uSZCBluKG2v6AZXcmqAHI+Y/C/5KjlUVotGAeneK18LpVIJMI69yN/63YdAvymD0qfsNk6cc/Ye3PU2csSRhF5X3I8gaIweY28keGFiiXmJpb/oHFrQ9bk27IeBFVrcL1fo6Y2BnASk+Qc8BFFq5YRahum6oZlhVFJrfxFERafL9RKJ+yjErzaev/0CdsJUUHMUkG7vAMPdqjWsSmskS8oZDFOoeurzlzxW652dPWe9CgBoUUU7VI2L2gJ0X7N8vH6mQ3ioC4+ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(788757137089); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(3231023)(944501138)(93006095)(93001095)(10201501046)(3002001)(6055026)(6041268)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(6072148)(201708071742011); SRVR:KL1PR0601MB1878; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:KL1PR0601MB1878; X-Forefront-PRVS: 0550778858 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(396003)(376002)(39380400002)(366004)(346002)(39860400002)(189003)(199004)(7736002)(36756003)(23726003)(53416004)(5660300001)(6116002)(69596002)(386003)(2950100002)(76176011)(7696005)(6916009)(52116002)(66066001)(47776003)(305945005)(59450400001)(106356001)(3846002)(2906002)(105586002)(25786009)(6486002)(68736007)(8676002)(81166006)(50466002)(54906003)(16586007)(83506002)(4326008)(97736004)(16526018)(58126008)(53936002)(81156014)(316002)(478600001)(86362001)(8936002)(21314002)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:KL1PR0601MB1878; 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; KL1PR0601MB1878; 23:8rB63uGFQ+gZrPMBPMrLRQbN+KTOp1IhGKzafBA?= =?us-ascii?Q?X9uCwOjKD934yzG5w+PmsTj4U3aU6fKqZkvSzVDeq2MI0HwLNHrb2iTWGiTC?= =?us-ascii?Q?rnCEB1plCCURvw06p8XVXc6a3MrwUEQEmTZyRx+hwTvVeQfQ+PM+nYeRBoAk?= =?us-ascii?Q?pu+THDu+FFH1cEGPGnjzH5jrzNUTHlgLDNF6eG5P4OEG6hmTxYqhBsWREYos?= =?us-ascii?Q?ukK6UN+deMlx6Odr9bB68qIvwWLsG47pe6GmMrzIqhhUTHFfgEknOhklRnmF?= =?us-ascii?Q?ltxRTEHXlAeIosoYpcWadLsrwW6HsOEklS+NG9MjhKARY7Kacfk1mXPxARES?= =?us-ascii?Q?X3PGXgUJXu5Gs/yTD0yGrCm/1WdouxU4bQ94X+HAEjS+42k7bgIXb+U2Onim?= =?us-ascii?Q?XBkG6Tpccvc1dWbIxJne9LSk39jS6gueGUTe3C63QUZaCEEaqtFfRNlkLpHE?= =?us-ascii?Q?J+RSjRXTokY6Id8M7fWs8xqwcGyrQKFuudE03qoT50Z6JziStmQqBQn3w17Q?= =?us-ascii?Q?5o02v1MDRZCgN43rAkL+g/8xdYQOHqH4uwkf2t2HJgGEXQC3wQ3gV2VctQQh?= =?us-ascii?Q?Ga7dNbVtceDCD+P2eI8UFvGIK5JTbEZJd9Qlp/f25I9uTga8vHR7HUyhKhM/?= =?us-ascii?Q?Toz8V32A97Hk1dmAJSH2DUOykotYcKMdFfplyLFdz+xS9e+ll1hMK9pF98Tj?= =?us-ascii?Q?rZFyBfHIqMV0IpCBGwEi1QEVdd7Hgak4NQiy2Tz+QCx5Zux/WcTggSfjODcG?= =?us-ascii?Q?CxMAslG5ZxszSGwY/3lr3ZRycwSIe05Si844MWwxb4hVWnjeHDEjkYPlMwq4?= =?us-ascii?Q?nYLPgCMarGlwjFTvlhsrRJGRskKjSffImIHsCNMSv0uVSPe3G8maJI8vzvUV?= =?us-ascii?Q?xaUVYFhhcZZA2w7SJSUQHHH6VWpzHG3DlO/dE2oN1Lp7MP4bz8XN2U85jH1z?= =?us-ascii?Q?R4NJ0SMcNduAgbN/rpU1AzPR8qEPr80ICmzGivm51UqwQuZJCsTam5QBUasY?= =?us-ascii?Q?p+RD9VPiFpiqf3XBfBThR/1pwfXDOe/Tdlm8Lqr0BQ4JZcrWSr9rOzFi7Bhf?= =?us-ascii?Q?XXA+dkGF3FwXJ1lGTbPGw8dmY4M9NQlwA8Xoj0AKe6azc7gvCDlCjApdGJTy?= =?us-ascii?Q?u032rCxXv9z5Yq4t14zycaCuX3vYtRDd5FHxRzEwh8oRiGyin68WnQw=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1; KL1PR0601MB1878; 6:ojc2tdjdilqotxpQsQU6aIPPgyLHlT6hL9iFER8Aw3DfbVbJ13UEbAitkMnTaNVlVAot14T+5reY84NYejo77XZEDnwkgpBr24DBByx9AfSy3WkTRAPHndSp+4Tbi/1qhQlPHa3patk5kWejkmqY0VIR44e+CPhmJxZy6mf6oaJNwj43yJVPBR5HBBsenrOSfs+wQIkbLAq30n/5GYDbIq4OAhGAy8bfuZ1wLjlfdGv9QC3ovRi+/K9VDvA/dFQoaZ9gxav+OqZC7WTP0ft7ojI4iFNWkG6/zHAjtpiukKDuxJcCnZiqCuQlHTYA0L8QqyWvoXo98zxzTZ08GwsLC3PCy/torhMEu2kYqr97l40=; 5:zgGEEi3UyZjPa1Wh1l32uRmeaYNX8u1Ne1cQ+19K3EY3rtTLAw/USmERzYe5YrJjXkmA6FGx19edSOpQ38xbDrlEG8EcRvIhUhEwz+Q/s4TWg6cXBIpGFzxw+5/U/cEChkeuDO4rjnsljhSYHSnU3u3tUEdhbr7fTuxDwBltJkg=; 24:Z/KQu27oMg1F02ubTz46JsHUb+/kSvMEa6V5p9L4BoDghMIQt9/+Phgm0zzgM9DCzZdVDhfFiRn8jSBSjPNG5JNH/fhpv5KY/18IINkperA=; 7:HcejoxcXiwMmr/xuq37k8A7b5sPyw3Zg18jwDpnBjH5y1LseYWeIa5OQr3gOoCJz7Z7RJEsyjIZTVzZE99wNhUJLsZErK6QUBR6k3+mIOpv/RSREhHx8qLgX6GWzsmZyakkMixwrajskZUbM2p90J9Hqgkob0R6e//zzfThqClI7GZykFy6IFQDoR5I3hTx6r9J1rjUh9/l3lqcp7OmmEU9it5MPcSOAqtaPj+PUYY2LjSuNLafu64NrFU+UQEVJ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; KL1PR0601MB1878; 20:zpJL0b3oDtLsF2RIfPLZFlILNDUayRgk3VfWtRFbWGMSUgNISM6hf440Ne8Y3XUXqqxgDffmiU2kfwlXdsgZSUXDHdV5qdx92/5dyUPTvoOnCYtlvP2UKpNPE2dY4FsL/KRF2v7879ulR3VUF8tsvc9p3BAkHBH1389H7z0N49s= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2018 01:31:37.0070 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e93cd1fe-9078-4fcd-faa5-08d5595c3939 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR0601MB1878 Cc: Linux-ALSA , Simon Subject: [alsa-devel] [PATCH 082/187] ASoC: cs42l51: 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 -> .pmdown_time = 1 - -> .endianness = 1 - -> .non_legacy_dai_naming = 1 Signed-off-by: Kuninori Morimoto --- sound/soc/codecs/cs42l51-i2c.c | 8 ----- sound/soc/codecs/cs42l51.c | 81 +++++++++++++++++++++--------------------- 2 files changed, 41 insertions(+), 48 deletions(-) diff --git a/sound/soc/codecs/cs42l51-i2c.c b/sound/soc/codecs/cs42l51-i2c.c index 9bad478..4b5731a 100644 --- a/sound/soc/codecs/cs42l51-i2c.c +++ b/sound/soc/codecs/cs42l51-i2c.c @@ -35,20 +35,12 @@ static int cs42l51_i2c_probe(struct i2c_client *i2c, return cs42l51_probe(&i2c->dev, devm_regmap_init_i2c(i2c, &config)); } -static int cs42l51_i2c_remove(struct i2c_client *i2c) -{ - snd_soc_unregister_codec(&i2c->dev); - - return 0; -} - static struct i2c_driver cs42l51_i2c_driver = { .driver = { .name = "cs42l51", .of_match_table = cs42l51_of_match, }, .probe = cs42l51_i2c_probe, - .remove = cs42l51_i2c_remove, .id_table = cs42l51_i2c_id, }; diff --git a/sound/soc/codecs/cs42l51.c b/sound/soc/codecs/cs42l51.c index f8072f1..95de47c 100644 --- a/sound/soc/codecs/cs42l51.c +++ b/sound/soc/codecs/cs42l51.c @@ -54,8 +54,8 @@ struct cs42l51_private { static int cs42l51_get_chan_mix(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); - unsigned long value = snd_soc_read(codec, CS42L51_PCM_MIXER)&3; + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + unsigned long value = snd_soc_component_read32(component, CS42L51_PCM_MIXER)&3; switch (value) { default: @@ -82,7 +82,7 @@ static int cs42l51_get_chan_mix(struct snd_kcontrol *kcontrol, static int cs42l51_set_chan_mix(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); unsigned char val; switch (ucontrol->value.enumerated.item[0]) { @@ -98,7 +98,7 @@ static int cs42l51_set_chan_mix(struct snd_kcontrol *kcontrol, break; } - snd_soc_write(codec, CS42L51_PCM_MIXER, val); + snd_soc_component_write(component, CS42L51_PCM_MIXER, val); return 1; } @@ -153,17 +153,17 @@ static int cs42l51_set_chan_mix(struct snd_kcontrol *kcontrol, static int cs42l51_pdn_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { - struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); switch (event) { case SND_SOC_DAPM_PRE_PMD: - snd_soc_update_bits(codec, CS42L51_POWER_CTL1, + snd_soc_component_update_bits(component, CS42L51_POWER_CTL1, CS42L51_POWER_CTL1_PDN, CS42L51_POWER_CTL1_PDN); break; default: case SND_SOC_DAPM_POST_PMD: - snd_soc_update_bits(codec, CS42L51_POWER_CTL1, + snd_soc_component_update_bits(component, CS42L51_POWER_CTL1, CS42L51_POWER_CTL1_PDN, 0); break; } @@ -263,8 +263,8 @@ static SOC_ENUM_SINGLE_DECL(cs42l51_adcr_mux_enum, static int cs42l51_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int format) { - struct snd_soc_codec *codec = codec_dai->codec; - struct cs42l51_private *cs42l51 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = codec_dai->component; + struct cs42l51_private *cs42l51 = snd_soc_component_get_drvdata(component); switch (format & SND_SOC_DAIFMT_FORMAT_MASK) { case SND_SOC_DAIFMT_I2S: @@ -273,7 +273,7 @@ static int cs42l51_set_dai_fmt(struct snd_soc_dai *codec_dai, cs42l51->audio_mode = format & SND_SOC_DAIFMT_FORMAT_MASK; break; default: - dev_err(codec->dev, "invalid DAI format\n"); + dev_err(component->dev, "invalid DAI format\n"); return -EINVAL; } @@ -285,7 +285,7 @@ static int cs42l51_set_dai_fmt(struct snd_soc_dai *codec_dai, cs42l51->func = MODE_SLAVE_AUTO; break; default: - dev_err(codec->dev, "Unknown master/slave configuration\n"); + dev_err(component->dev, "Unknown master/slave configuration\n"); return -EINVAL; } @@ -326,8 +326,8 @@ struct cs42l51_ratios { static int cs42l51_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 cs42l51_private *cs42l51 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = codec_dai->component; + struct cs42l51_private *cs42l51 = snd_soc_component_get_drvdata(component); cs42l51->mclk = freq; return 0; @@ -337,8 +337,8 @@ static int cs42l51_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 cs42l51_private *cs42l51 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct cs42l51_private *cs42l51 = snd_soc_component_get_drvdata(component); int ret; unsigned int i; unsigned int rate; @@ -370,12 +370,12 @@ static int cs42l51_hw_params(struct snd_pcm_substream *substream, if (i == nr_ratios) { /* We did not find a matching ratio */ - dev_err(codec->dev, "could not find matching ratio\n"); + dev_err(component->dev, "could not find matching ratio\n"); return -EINVAL; } - intf_ctl = snd_soc_read(codec, CS42L51_INTF_CTL); - power_ctl = snd_soc_read(codec, CS42L51_MIC_POWER_CTL); + intf_ctl = snd_soc_component_read32(component, CS42L51_INTF_CTL); + power_ctl = snd_soc_component_read32(component, CS42L51_MIC_POWER_CTL); intf_ctl &= ~(CS42L51_INTF_CTL_MASTER | CS42L51_INTF_CTL_ADC_I2S | CS42L51_INTF_CTL_DAC_FORMAT(7)); @@ -418,24 +418,24 @@ static int cs42l51_hw_params(struct snd_pcm_substream *substream, fmt = CS42L51_DAC_DIF_RJ24; break; default: - dev_err(codec->dev, "unknown format\n"); + dev_err(component->dev, "unknown format\n"); return -EINVAL; } intf_ctl |= CS42L51_INTF_CTL_DAC_FORMAT(fmt); break; default: - dev_err(codec->dev, "unknown format\n"); + dev_err(component->dev, "unknown format\n"); return -EINVAL; } if (ratios[i].mclk) power_ctl |= CS42L51_MIC_POWER_CTL_MCLK_DIV2; - ret = snd_soc_write(codec, CS42L51_INTF_CTL, intf_ctl); + ret = snd_soc_component_write(component, CS42L51_INTF_CTL, intf_ctl); if (ret < 0) return ret; - ret = snd_soc_write(codec, CS42L51_MIC_POWER_CTL, power_ctl); + ret = snd_soc_component_write(component, CS42L51_MIC_POWER_CTL, power_ctl); if (ret < 0) return ret; @@ -444,18 +444,18 @@ static int cs42l51_hw_params(struct snd_pcm_substream *substream, static int cs42l51_dai_mute(struct snd_soc_dai *dai, int mute) { - struct snd_soc_codec *codec = dai->codec; + struct snd_soc_component *component = dai->component; int reg; int mask = CS42L51_DAC_OUT_CTL_DACA_MUTE|CS42L51_DAC_OUT_CTL_DACB_MUTE; - reg = snd_soc_read(codec, CS42L51_DAC_OUT_CTL); + reg = snd_soc_component_read32(component, CS42L51_DAC_OUT_CTL); if (mute) reg |= mask; else reg &= ~mask; - return snd_soc_write(codec, CS42L51_DAC_OUT_CTL, reg); + return snd_soc_component_write(component, CS42L51_DAC_OUT_CTL, reg); } static const struct snd_soc_dai_ops cs42l51_dai_ops = { @@ -484,7 +484,7 @@ static int cs42l51_dai_mute(struct snd_soc_dai *dai, int mute) .ops = &cs42l51_dai_ops, }; -static int cs42l51_codec_probe(struct snd_soc_codec *codec) +static int cs42l51_component_probe(struct snd_soc_component *component) { int ret, reg; @@ -497,24 +497,25 @@ static int cs42l51_codec_probe(struct snd_soc_codec *codec) */ reg = CS42L51_DAC_CTL_DATA_SEL(1) | CS42L51_DAC_CTL_AMUTE | CS42L51_DAC_CTL_DACSZ(0); - ret = snd_soc_write(codec, CS42L51_DAC_CTL, reg); + ret = snd_soc_component_write(component, CS42L51_DAC_CTL, reg); if (ret < 0) return ret; return 0; } -static const struct snd_soc_codec_driver soc_codec_device_cs42l51 = { - .probe = cs42l51_codec_probe, - - .component_driver = { - .controls = cs42l51_snd_controls, - .num_controls = ARRAY_SIZE(cs42l51_snd_controls), - .dapm_widgets = cs42l51_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(cs42l51_dapm_widgets), - .dapm_routes = cs42l51_routes, - .num_dapm_routes = ARRAY_SIZE(cs42l51_routes), - }, +static const struct snd_soc_component_driver soc_component_device_cs42l51 = { + .probe = cs42l51_component_probe, + .controls = cs42l51_snd_controls, + .num_controls = ARRAY_SIZE(cs42l51_snd_controls), + .dapm_widgets = cs42l51_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(cs42l51_dapm_widgets), + .dapm_routes = cs42l51_routes, + .num_dapm_routes = ARRAY_SIZE(cs42l51_routes), + .idle_bias_on = 1, + .pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; const struct regmap_config cs42l51_regmap = { @@ -555,8 +556,8 @@ int cs42l51_probe(struct device *dev, struct regmap *regmap) dev_info(dev, "Cirrus Logic CS42L51, Revision: %02X\n", val & CS42L51_CHIP_REV_MASK); - ret = snd_soc_register_codec(dev, - &soc_codec_device_cs42l51, &cs42l51_dai, 1); + ret = devm_snd_soc_register_component(dev, + &soc_component_device_cs42l51, &cs42l51_dai, 1); error: return ret; }