From patchwork Tue Oct 25 01:21:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 9393939 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 96B7C60762 for ; Tue, 25 Oct 2016 04:04:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6B57C292BB for ; Tue, 25 Oct 2016 04:04:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4964D292D2; Tue, 25 Oct 2016 04:04:56 +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 2CEC8292BB for ; Tue, 25 Oct 2016 04:04:54 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 76B00266E5E; Tue, 25 Oct 2016 06:04:53 +0200 (CEST) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 4F1F8266E28; Tue, 25 Oct 2016 06:02:35 +0200 (CEST) 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 93D57266DF7; Tue, 25 Oct 2016 03:21:38 +0200 (CEST) Received: from relmlie1.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa0.perex.cz (Postfix) with ESMTP id A4E20266C4B for ; Tue, 25 Oct 2016 03:21:31 +0200 (CEST) Received: from unknown (HELO relmlir1.idc.renesas.com) ([10.200.68.151]) by relmlie1.idc.renesas.com with ESMTP; 25 Oct 2016 10:21:30 +0900 Received: from relmlac3.idc.renesas.com (relmlac3.idc.renesas.com [10.200.69.23]) by relmlir1.idc.renesas.com (Postfix) with ESMTP id 52E7544B06; Tue, 25 Oct 2016 10:21:30 +0900 (JST) Received: by relmlac3.idc.renesas.com (Postfix, from userid 0) id 48B1618070; Tue, 25 Oct 2016 10:21:30 +0900 (JST) Received: from relmlac3.idc.renesas.com (localhost [127.0.0.1]) by relmlac3.idc.renesas.com (Postfix) with ESMTP id 40D241806F; Tue, 25 Oct 2016 10:21:30 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac3.idc.renesas.com with ESMTP id LAX07984; Tue, 25 Oct 2016 10:21:30 +0900 X-IronPort-AV: E=Sophos;i="5.22,559,1449500400"; d="scan'";a="223279084" Received: from mail-sg2apc01lp0242.outbound.protection.outlook.com (HELO APC01-SG2-obe.outbound.protection.outlook.com) ([65.55.88.242]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA; 25 Oct 2016 10:21:29 +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=iLk/wMTSRUqsrKw0f/31Fik8a1eun8IzVDGr0kIKjsc=; b=pt4nVv+0iHW7Xcmc9uww9LKL1qxr8RRukgCopLYBSuGimwR8czvrJ4vV/xEMFZv00Yy9w5uUrZ0oEIsrf7UGwKC0eECdLhKBeikGOgH2auQR6ZFBUB18LC07LfzUHHf4cCFxIZx11FnNUJqAOrGblCyVhdYMPa9q29KGBz0jfjs= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=kuninori.morimoto.gx@renesas.com; Received: from morimoto-PC.renesas.com (211.11.155.144) by PS1PR0601MB1450.apcprd06.prod.outlook.com (10.165.210.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.16; Tue, 25 Oct 2016 01:21:24 +0000 Message-ID: <87shrlb5bg.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 To: Mark Brown , Lars-Peter In-Reply-To: <87vawhb5el.wl%kuninori.morimoto.gx@renesas.com> References: <87vawhb5el.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Date: Tue, 25 Oct 2016 01:21:24 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: OS2PR0101CA0027.jpnprd01.prod.outlook.com (10.167.173.165) To PS1PR0601MB1450.apcprd06.prod.outlook.com (10.165.210.154) X-MS-Office365-Filtering-Correlation-Id: 1468defe-1a39-4c3e-3699-08d3fc753d01 X-Microsoft-Exchange-Diagnostics: 1; PS1PR0601MB1450; 2:O65k838PvQm12Sw2xW6VIZCtcJv4ur9nGUDycaej4Emu5UrJunOqS3y11UIIW1VHyEJHZdkZlkhQ0AMKXV39KfKJ84jH1bffHnwnJ/AP1hHH4DT2s+m+Tjdr4Otlw0YNqcGHUlTcKT2UhpG+0qxUo3373yER2LO2SMqLzo39gjXvQzgcV9XvIHSUvc9s2+vx3zyjqRkFsU+VHgq22/Lhkw==; 3:mpwSto9LVCGgB/N5L72xwCcOcnto3+Q941vf0Fdn2Dt3MXzDXoYtg+JhjzuHgztZ75BpDTAj/Av7NRDLjmGlo2bylQH6q0Nmw4dlchrKVl7FF/EdNUUU3M93IPk6y4ylD1p9IkQgT6I3Kka8pwRdlQ== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:PS1PR0601MB1450; X-Microsoft-Exchange-Diagnostics: 1; PS1PR0601MB1450; 25:uw8BBogvOshQKQYNY3R8CvmKcEek5LGQaDnBFOTbVnqOo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hGfK02OYvr+Qusq/OA3sVevw1Bi4GVC/DED2nIrbHgo6QnWSJBGTnpLvuu3wzp79wD9Gf7CAHsVirjtDT+DanhnY98KY+omvVwf+ptfH6NKRGG6uQdJt+xJ9KYMGlUpI5WZ+Q43xI83P98S/N+UrMlKNsqLEEubw7AdpyvBvF6Vchq6oyea8yoDC62NrOzJBVQ3XVuYJeQfV0xcniGSauN1R1c2mKRWjXsZ+47+RRniE0xcnTv+0nUwJ4u/2hnkanlGMEy75HD/1Sy4PHAUT3VTxKflry+GBAwxEyEQa6jw2P71KqSTJo/FgPDUCYJsM6uBObPk+uJNwUO7j+8kkokOt9UMCnND3trXVq+ASMu5DaokTQxh7yno/tY3bl8WAXrrrSeA7MUI0WGTJKGXFpQmcgaIKLSx9sJr/uCAD55nfiE9ktr2zs9yKkrphR8wa4wCDYo91rNZbH4Q7LLx3pLY9LjLeQQp/ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:PS1PR0601MB1450; BCL:0; PCL:0; RULEID:; SRVR:PS1PR0601MB1450; X-Microsoft-Exchange-Diagnostics: 1; PS1PR0601MB1450; 4:CuohY6hn7CQlwl4ENc35jmsqvLl1Z8f5nu0Tf7Vg6O2rO+VA+x8Gzsz4p736rjayTN4UfVgFtmabevhVRtuxC273DsgaVf6wVfKCE3xoK1axIKbmj3OJUhluKpWb/onNVjH/M6Z+TKIFCz/3Lq5Pd30FFdqE6gh5DHrFfa8fJXtzP5MewOLrcq/KdncYm3jpyvb4QHXleBlY211a4HL4FNQ4ZtX/8qfCwiXMrSuw7AHNEIEdK0SnS6JN3NEJ3xMI198KCpERuT0Qb8uEgJjmdMO/rmlbzznfnleQ5eFbHIbwGD3GZN3ty20IwD4FKSwUoMPBSUuLZwoTaGK/CTQPhxIFEjnF2riSue2Mwstv/qfVINWZdNi851cDxzn3tx4uTUQYxmko8lGsD144BjLwhqhlkfP/OltJ8GVhc4V7p8c= X-Forefront-PRVS: 01068D0A20 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(7916002)(189002)(199003)(229853001)(97736004)(5001770100001)(4001350100001)(47776003)(15650500001)(68736007)(66066001)(81156014)(7846002)(305945005)(83506001)(36756003)(42186005)(81166006)(19580395003)(19580405001)(7736002)(2950100002)(8676002)(77096005)(69596002)(5660300001)(189998001)(101416001)(50986999)(50466002)(2906002)(4326007)(76176999)(86362001)(54356999)(105586002)(33646002)(106356001)(31430400001)(92566002)(6116002)(586003)(3846002)(23726003)(53416004)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:PS1PR0601MB1450; H:morimoto-PC.renesas.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; PS1PR0601MB1450; 23:zPw7OOPNIRUrnsIinjKhjvfeeW+EhoU4UH05h4+?= =?us-ascii?Q?lqUEX+7+7usBlTw0paneW7HcV+2du+MgXxqFTSztuDuznvSMZA1ExNSmBPAt?= =?us-ascii?Q?KOwogFC1GVvS4kOm9ZSwt4xD2lMAZv2NROtAh/2+VCLKPL+0kiRtGmakSWnO?= =?us-ascii?Q?OHtdxuZI6McPKNwwyxxDUFiBUbQ1b8uU+hF5RFEiaMuMueD7RZY40VBPwqIy?= =?us-ascii?Q?aadlaSYcl5a4kZei+HTbvJTYbfgfAYAwcA3pkgTUwkyld138cfUqccCCqdXk?= =?us-ascii?Q?14EWIxcmsAjj4pKODBuRNsJQMbeITuCCqhjhERojS+OjRBxCL25HcI6OFKLl?= =?us-ascii?Q?m7tCoessJzEQjGNP1g5GgCR0eD8y8MGt+tSaZMZ6pAcykHO4TYkQOec7waEM?= =?us-ascii?Q?9K5h4Xy4RPvl+6stPjk2j4Oo+n1eF/LUyTFaEoqcANJtI7pb/jCsgkV72zuJ?= =?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UIpXE9RuYRUOm9S/Fd0REgo2wjqLx3EJINX+nZlA8uRYxcDAv/+pXqIr6lyy2cMmdBNjJJhV/QNwFEm+qLi5ys2wh0vy/VH6BLhu0= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2016 01:21:24.9811 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: PS1PR0601MB1450 Cc: Linux-ALSA , Simon Subject: [alsa-devel] [PATCH 2/2] ASoC: add Component level suspend/resume 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 In current ALSA SoC, Codec only has suspend/resume feature. But it should be supported on Component level. This patch adds it. This patch replaces current codec_dev_list to component_dev_list. Signed-off-by: Kuninori Morimoto --- include/sound/soc.h | 9 ++-- sound/soc/intel/boards/broadwell.c | 10 +++-- sound/soc/intel/boards/cht_bsw_rt5672.c | 10 +++-- sound/soc/soc-core.c | 73 +++++++++++++++++++-------------- 4 files changed, 59 insertions(+), 43 deletions(-) diff --git a/include/sound/soc.h b/include/sound/soc.h index 69f2ebf..430bf77 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -782,6 +782,8 @@ struct snd_soc_component_driver { int (*probe)(struct snd_soc_component *); void (*remove)(struct snd_soc_component *); + int (*suspend)(struct snd_soc_component *); + int (*resume)(struct snd_soc_component *); /* DT */ int (*of_xlate_dai_name)(struct snd_soc_component *component, @@ -808,6 +810,7 @@ struct snd_soc_component { unsigned int ignore_pmdown_time:1; /* pmdown_time is ignored at stop */ unsigned int registered_as_component:1; unsigned int has_auxiliary:1; /* for auxiliary component of the card */ + unsigned int suspended:1; /* is in suspend PM state */ struct list_head list; struct list_head card_list; @@ -853,6 +856,8 @@ struct snd_soc_component { int (*probe)(struct snd_soc_component *); void (*remove)(struct snd_soc_component *); + int (*suspend)(struct snd_soc_component *); + int (*resume)(struct snd_soc_component *); /* machine specific init */ int (*init)(struct snd_soc_component *component); @@ -869,11 +874,9 @@ struct snd_soc_codec { const struct snd_soc_codec_driver *driver; struct list_head list; - struct list_head card_list; /* runtime */ unsigned int cache_bypass:1; /* Suppress access to the cache */ - unsigned int suspended:1; /* Codec is in suspend PM state */ unsigned int cache_init:1; /* codec cache has been initialized */ /* codec IO */ @@ -1170,7 +1173,6 @@ struct snd_soc_card { struct work_struct deferred_resume_work; /* lists of probed devices belonging to this card */ - struct list_head codec_dev_list; struct list_head component_dev_list; struct list_head widgets; @@ -1541,7 +1543,6 @@ static inline void *snd_soc_platform_get_drvdata(struct snd_soc_platform *platfo static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card) { - INIT_LIST_HEAD(&card->codec_dev_list); INIT_LIST_HEAD(&card->widgets); INIT_LIST_HEAD(&card->paths); INIT_LIST_HEAD(&card->dapm_list); diff --git a/sound/soc/intel/boards/broadwell.c b/sound/soc/intel/boards/broadwell.c index 7486a00..aea8816 100644 --- a/sound/soc/intel/boards/broadwell.c +++ b/sound/soc/intel/boards/broadwell.c @@ -220,9 +220,10 @@ static int broadwell_rtd_init(struct snd_soc_pcm_runtime *rtd) }; static int broadwell_suspend(struct snd_soc_card *card){ - struct snd_soc_codec *codec; + struct snd_soc_component *component; - list_for_each_entry(codec, &card->codec_dev_list, card_list) { + list_for_each_entry(component, &card->component_dev_list, card_list) { + struct snd_soc_codec *codec = snd_soc_component_to_codec(component); if (!strcmp(codec->component.name, "i2c-INT343A:00")) { dev_dbg(codec->dev, "disabling jack detect before going to suspend.\n"); rt286_mic_detect(codec, NULL); @@ -233,9 +234,10 @@ static int broadwell_suspend(struct snd_soc_card *card){ } static int broadwell_resume(struct snd_soc_card *card){ - struct snd_soc_codec *codec; + struct snd_soc_component *component; - list_for_each_entry(codec, &card->codec_dev_list, card_list) { + list_for_each_entry(component, &card->component_dev_list, card_list) { + struct snd_soc_codec *codec = snd_soc_component_to_codec(component); if (!strcmp(codec->component.name, "i2c-INT343A:00")) { dev_dbg(codec->dev, "enabling jack detect for resume.\n"); rt286_mic_detect(codec, &broadwell_headset); diff --git a/sound/soc/intel/boards/cht_bsw_rt5672.c b/sound/soc/intel/boards/cht_bsw_rt5672.c index df9d254..cfadc2e 100644 --- a/sound/soc/intel/boards/cht_bsw_rt5672.c +++ b/sound/soc/intel/boards/cht_bsw_rt5672.c @@ -292,9 +292,10 @@ static int cht_aif1_startup(struct snd_pcm_substream *substream) static int cht_suspend_pre(struct snd_soc_card *card) { - struct snd_soc_codec *codec; + struct snd_soc_component *component; - list_for_each_entry(codec, &card->codec_dev_list, card_list) { + list_for_each_entry(component, &card->component_dev_list, card_list) { + struct snd_soc_codec *codec = snd_soc_component_to_codec(component); if (!strcmp(codec->component.name, "i2c-10EC5670:00")) { dev_dbg(codec->dev, "disabling jack detect before going to suspend.\n"); rt5670_jack_suspend(codec); @@ -306,9 +307,10 @@ static int cht_suspend_pre(struct snd_soc_card *card) static int cht_resume_post(struct snd_soc_card *card) { - struct snd_soc_codec *codec; + struct snd_soc_component *component; - list_for_each_entry(codec, &card->codec_dev_list, card_list) { + list_for_each_entry(component, &card->component_dev_list, card_list) { + struct snd_soc_codec *codec = snd_soc_component_to_codec(component); if (!strcmp(codec->component.name, "i2c-10EC5670:00")) { dev_dbg(codec->dev, "enabling jack detect for resume.\n"); rt5670_jack_resume(codec); diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 2a00b5e..41e70f1 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -626,7 +626,7 @@ static void codec2codec_close_delayed_work(struct work_struct *work) int snd_soc_suspend(struct device *dev) { struct snd_soc_card *card = dev_get_drvdata(dev); - struct snd_soc_codec *codec; + struct snd_soc_component *component; struct snd_soc_pcm_runtime *rtd; int i; @@ -702,39 +702,39 @@ int snd_soc_suspend(struct device *dev) dapm_mark_endpoints_dirty(card); snd_soc_dapm_sync(&card->dapm); - /* suspend all CODECs */ - list_for_each_entry(codec, &card->codec_dev_list, card_list) { - struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); + /* suspend all COMPONENTs */ + list_for_each_entry(component, &card->component_dev_list, card_list) { + struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); - /* If there are paths active then the CODEC will be held with + /* If there are paths active then the COMPONENT will be held with * bias _ON and should not be suspended. */ - if (!codec->suspended) { + if (!component->suspended) { switch (snd_soc_dapm_get_bias_level(dapm)) { case SND_SOC_BIAS_STANDBY: /* - * If the CODEC is capable of idle + * If the COMPONENT is capable of idle * bias off then being in STANDBY * means it's doing something, * otherwise fall through. */ if (dapm->idle_bias_off) { - dev_dbg(codec->dev, + dev_dbg(component->dev, "ASoC: idle_bias_off CODEC on over suspend\n"); break; } case SND_SOC_BIAS_OFF: - if (codec->driver->suspend) - codec->driver->suspend(codec); - codec->suspended = 1; - if (codec->component.regmap) - regcache_mark_dirty(codec->component.regmap); + if (component->suspend) + component->suspend(component); + component->suspended = 1; + if (component->regmap) + regcache_mark_dirty(component->regmap); /* deactivate pins to sleep state */ - pinctrl_pm_select_sleep_state(codec->dev); + pinctrl_pm_select_sleep_state(component->dev); break; default: - dev_dbg(codec->dev, - "ASoC: CODEC is on over suspend\n"); + dev_dbg(component->dev, + "ASoC: COMPONENT is on over suspend\n"); break; } } @@ -768,7 +768,7 @@ static void soc_resume_deferred(struct work_struct *work) struct snd_soc_card *card = container_of(work, struct snd_soc_card, deferred_resume_work); struct snd_soc_pcm_runtime *rtd; - struct snd_soc_codec *codec; + struct snd_soc_component *component; int i; /* our power state is still SNDRV_CTL_POWER_D3hot from suspend time, @@ -794,11 +794,11 @@ static void soc_resume_deferred(struct work_struct *work) cpu_dai->driver->resume(cpu_dai); } - list_for_each_entry(codec, &card->codec_dev_list, card_list) { - if (codec->suspended) { - if (codec->driver->resume) - codec->driver->resume(codec); - codec->suspended = 0; + list_for_each_entry(component, &card->component_dev_list, card_list) { + if (component->suspended) { + if (component->resume) + component->resume(component); + component->suspended = 0; } } @@ -1072,10 +1072,6 @@ static void soc_remove_component(struct snd_soc_component *component) if (!component->card) return; - /* This is a HACK and will be removed soon */ - if (component->codec) - list_del(&component->codec->card_list); - list_del(&component->card_list); if (component->remove) @@ -1445,11 +1441,6 @@ static int soc_probe_component(struct snd_soc_card *card, component->num_dapm_routes); list_add(&dapm->list, &card->dapm_list); - - /* This is a HACK and will be removed soon */ - if (component->codec) - list_add(&component->codec->card_list, &card->codec_dev_list); - list_add(&component->card_list, &card->component_dev_list); return 0; @@ -2937,6 +2928,8 @@ static int snd_soc_component_initialize(struct snd_soc_component *component, component->driver = driver; component->probe = component->driver->probe; component->remove = component->driver->remove; + component->suspend = component->driver->suspend; + component->resume = component->driver->resume; dapm = &component->dapm; dapm->dev = dev; @@ -3286,6 +3279,20 @@ static void snd_soc_codec_drv_remove(struct snd_soc_component *component) codec->driver->remove(codec); } +static int snd_soc_codec_drv_suspend(struct snd_soc_component *component) +{ + struct snd_soc_codec *codec = snd_soc_component_to_codec(component); + + return codec->driver->suspend(codec); +} + +static int snd_soc_codec_drv_resume(struct snd_soc_component *component) +{ + struct snd_soc_codec *codec = snd_soc_component_to_codec(component); + + return codec->driver->resume(codec); +} + static int snd_soc_codec_drv_write(struct snd_soc_component *component, unsigned int reg, unsigned int val) { @@ -3347,6 +3354,10 @@ int snd_soc_register_codec(struct device *dev, codec->component.probe = snd_soc_codec_drv_probe; if (codec_drv->remove) codec->component.remove = snd_soc_codec_drv_remove; + if (codec_drv->suspend) + codec->component.suspend = snd_soc_codec_drv_suspend; + if (codec_drv->resume) + codec->component.resume = snd_soc_codec_drv_resume; if (codec_drv->write) codec->component.write = snd_soc_codec_drv_write; if (codec_drv->read)