From patchwork Mon Jan 29 04:20:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 10189123 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 F3C786020C for ; Mon, 29 Jan 2018 04:46:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE7BF2013C for ; Mon, 29 Jan 2018 04:46:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D2F89201B0; Mon, 29 Jan 2018 04:46:00 +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 EBF1F2013C for ; Mon, 29 Jan 2018 04:45:58 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id E0BD1267C47; Mon, 29 Jan 2018 05:27: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 2175B267C77; Mon, 29 Jan 2018 05:27:00 +0100 (CET) Received: from relmlie3.idc.renesas.com (relmlor4.renesas.com [210.160.252.174]) by alsa0.perex.cz (Postfix) with ESMTP id 044C326790D for ; Mon, 29 Jan 2018 05:20:13 +0100 (CET) Received: from unknown (HELO relmlir4.idc.renesas.com) ([10.200.68.154]) by relmlie3.idc.renesas.com with ESMTP; 29 Jan 2018 13:20:12 +0900 Received: from relmlii2.idc.renesas.com (relmlii2.idc.renesas.com [10.200.68.66]) by relmlir4.idc.renesas.com (Postfix) with ESMTP id 408D8684EF; Mon, 29 Jan 2018 13:20:12 +0900 (JST) X-IronPort-AV: E=Sophos;i="5.46,429,1511794800"; d="scan'208";a="270915548" Received: from mail-hk2apc01lp0213.outbound.protection.outlook.com (HELO APC01-HK2-obe.outbound.protection.outlook.com) ([65.55.88.213]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA256; 29 Jan 2018 13:20:11 +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=GMQcl8t2mkExr0kQ+EYcnkwi7iCl8AFmGjHIhV/wE+k=; b=KVzTbesT72Xs5HmHslcG1oXYcsgQj9LLv90ffG/4gHQcSM4ia8ajDAC4GYAf7IxyhcGzh3WDvv8xaY2/32NyOq/6bx8Uc2S0D5dhLCxRIIZQ4luu2b+ZCsJO4vNFUfiO7mFflXMHtTX+oy1tuXGEVi3Qt8mk1R3bpt5RTcwWPpQ= 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 04:20:09 +0000 Message-ID: <87lgghxpp9.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 04:20:09 +0000 X-Originating-IP: [211.11.155.138] X-ClientProxiedBy: KAXPR01CA0005.jpnprd01.prod.outlook.com (2603:1096:402:19::15) 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: acc2416c-6041-45bc-daaf-08d566cf95b5 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:o94mTP21u3AnAWLQW/zhG9aODkFaL+e+bVDdaKPkvMVKeb/9MSflFLDbdrHOeVVG96UZVSwQ5xatqcrYskRp60Jn4ihpIHElsqeEB3sukyzrESgBZYYdUkpSbztc1XcEj/TTq+WpAU7/SADrIaYGOzcq8/c9pLac5rp7rr3GpVw3tqq7R81NFIQiIaq5BGAm1yWoDxDc7rZ+mupg3CYcaOFTMZPucugDuTM+FKp77zqfegDri78aZZUw0l95sQq9; 25:a215ew22VK430bJwtUO9B11IiP2o9WFY61vcAjpl6tovyUVxb//eFfPs9edROZgaE5QBRxMwb6wyroilQGCA4bhPJbAnmdqWZ3R25wMSmwl8KA1vPRZYcfS9rKIiPsJA57pqHO358laGvC+JZBOkOf4zePqCzFTasovcQSxnB4E2F4qqpH1uqmBdOOZcDsReZzytwK898LU61+cou6VdmQxN/U3Hv/qZ/oGoW+znRG1GrO8tCEulitFdYczFOjrgP/57Wa5MzSx52dsyPVrJ1Dz6gxpau0Oax/OC8ezXELUw3h5NnRfoPzTwip4wv4Gs7qEvM5nKxSfsSbm5LLdJmw==; 31:p+MiQpK4UcgmdMJ11US1CpN0V+pSbDosXV7I/Pml1oJ40PXNW7XS9THfo59GWAsZun0JXoGdymehIs+THuCOPVrAbLknHDVIObwxQ/RRZioxpYhtPIz+TTS5qyyrtO853XfntOZdw+Or/zXrX583/znwuFosQyONlxPfGQEKaeascizKBzIYsPbrocSnNquQL2NDQUkHS3BfPwzvAqf8Kf/v1zFiUSdnSBAIyOjZ6Tk= 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:pp5o4rZy0wM+D43EdriBwSKUt8xheFHV9kuHz+m+btm19bo8bsUSuyNRKB+4SsYcm5GudG6yXyG8g5moGhJRU4MIy3MZZRL6Pg3M0+UeLIAtaZ5aWM4STkxC7CBO97LIeJ7ehoCiPJQxCalNQmXcSX9XmptM8r3bKh5XiJuaIWa3vhJ/BLazEDDYBlIySgWY3XSfVxEUV9d/idM3CfuoR4zoyBdGGbnkveuWFok7WpSZ2wN8yib5xSaD91BRV9ZxdoPRb0UlqrdOfHvJk9nB+woUA4U4gmkMvXjhZ/E7FnhPx+K0ZG74vJtzElolLjSYY7KWpC4ulRsE/0ir/0aFbD+NP925G/oy9EXT2wCRNFAbUH8/yHsPEQD5vvd83UVJzK1qmb8qdenPnsCovpEqYtayaCgDVnRVMbGE560q0t9MnIsqqcyKHtRvf68N6O6beE5s020PrgwoBGytfDjL638shvegufgCvuxQoYHuqJ8euKSLv60Qiz0NXQX9jEg+; 4:qCWt09I598+mZuH5awYSm34RLMxjG8tAyIOU9JUzhE2XNkPHVCqrErzty8NAszuNAZYXDr/BNqQBA6r6uitPdq5t988wkwrbtqxCOKYjlIJIzrCTMDtorPo+NrAxPC2PYs6CABx9rZVY/0vg+FrUqBIH3/B57kTlYucb8/Cdcy7npcQPqSzD4+BpwVV54uc2kICQ+v4PeN00MSxUN/vOrms1ej72vqVVevOexxYxOTtKB3RGjG2tlgIMExwmdzjfFbmL0xJuEFB2XswWDwsZwQlnkOqOEDa0JxBZfitEEtqaLWamtWFhgZ/Z3bUIG3IO2eyCRL88x9OP1swWdLEWKw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(788757137089)(277106579953875); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(5005006)(8121501046)(3002001)(10201501046)(3231101)(944501161)(93006095)(93001095)(6055026)(6041288)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(6072148)(201708071742011); SRVR:KL1PR0601MB1877; BCL:0; PCL:0; RULEID:; SRVR:KL1PR0601MB1877; X-Forefront-PRVS: 0567A15835 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(376002)(346002)(366004)(396003)(39380400002)(39860400002)(189003)(199004)(47776003)(26005)(8676002)(68736007)(386003)(76176011)(59450400001)(5660300001)(66066001)(83506002)(7736002)(305945005)(16586007)(2950100002)(16526019)(575784001)(58126008)(316002)(81156014)(186003)(52116002)(69596002)(8936002)(6916009)(7696005)(50466002)(81166006)(86362001)(6116002)(4326008)(105586002)(25786009)(2906002)(23726003)(478600001)(6486002)(3846002)(106356001)(97736004)(53936002)(36756003)(53416004)(21314002)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:KL1PR0601MB1877; 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; KL1PR0601MB1877; 23:PByEsbrIqXrW2hqRAY3hUffGdL4cVEw2xuIAQpv?= =?us-ascii?Q?+NcqsGEwrCPFKxYBSbXQXfoaEr5xQIwBUcAkFKKOjIeOXK8+RBLoX450xqEq?= =?us-ascii?Q?42Qr3grjOMnVggYDa81j28jQE1s0j6QV9W6BLqTMpJG0HVGmpHIY05Bmcz3P?= =?us-ascii?Q?21RTlinlRbV/qAyOJLRrDcv9FIfXVNhyz2FhLO/0WhiW3efB3aQ1l8CRYYfW?= =?us-ascii?Q?4joZUnSZJmvhZ7xaTyNOvwsdNl6kwFy7slW6auuTOD0QKAaIMDURtJb6uEXL?= =?us-ascii?Q?PV6YGYHdXH/alAIGw0bUa561vsdTxcjWUcHSIHufstU/uTiCGm3WlsxGd8EC?= =?us-ascii?Q?q4GlEJ7A4zPhxHtCx/hQD/hAyV/L9lVsXTE//pA/YtwnVA3lFdzLpUVsBofA?= =?us-ascii?Q?yTxW2TbUwQ5/CYiSWnoXbEORtpVah138KNXoMxXvG/k32qYWrqXum+lyKp9I?= =?us-ascii?Q?hR4VUesCMpgG2s4kzO0uYRqlRCWXnQkKVgfVjQc8Fu/CaQdLhuiIvQaUk+mG?= =?us-ascii?Q?yEjVg1K3BP5+4mdRRBGIAPRPzTSz4RH/sx796LjJOhNHUoVZUgCmf1Sy8/G6?= =?us-ascii?Q?dpR2eqjmQFiPUBQwNeYNTFCFMFfEwaCjP/HBPd6aUEdOgQ8mcqQvhsHNaHw7?= =?us-ascii?Q?3wUWwL2xt/Ksz1Nk07GgOu+ksggPekLwUYZaPsMHJkM5i0SECUdfJd3qQlDu?= =?us-ascii?Q?gL3MfQ+S/bjdILEGVwJxzGwkqhHkpKO73PWCEtF+msBFll68Hu+Uyj4RkkV8?= =?us-ascii?Q?R4EW6ht9cZdTCTdAcqiJfTttgWJup99NYNm1tB28M0o2Z5djC6oFHFuFn1l6?= =?us-ascii?Q?MrXv1dlNUCqpbz+8lgWSRaZityMZyBOXohsPYB+8J2vCmwiRfeHR8PYgqGM/?= =?us-ascii?Q?w/9t8i8jhccfIpatunigp5MuuK1na8ghwYNi3ICSr3xhdbNYypUqkZ2gpupC?= =?us-ascii?Q?Z5oaSE5kWgE+jc+X6dNh7DCnho1Tk2VrF3cGuSb8rdmm1j5ozP4+meUghlMQ?= =?us-ascii?Q?fKg7xdTvhTViYmvuNFXyYVgQKFqtEvvSV/nxkgpxLSg2AMiePzqWFlDsBw9g?= =?us-ascii?Q?mtsHNz93y0RSHcvjNmyBYBLlS/dL8fqGOGE0A4unU4qtCnAYV2o7oPFlV428?= =?us-ascii?Q?ZVFX1wNJyGt1/kyPX8wdYHOyFUPgdv+0Y1B7ciwjYfxiFmuVi9UhUbBYuNU+?= =?us-ascii?Q?DytbtFiGcwBfDJbqGolQwx83vqk9qqL6OP891?= X-Microsoft-Exchange-Diagnostics: 1; KL1PR0601MB1877; 6:t6j4s7ajb9mv6SsLW/FHUMfb5lFIrujmR/CIKE1pJTfsIVtxT/GLsfI/ZYGrMYXWl23Y+DfhwPLLLFTo7o0BSFr9ZwVpgpfQL79M5TWiieVRy+PXBeCgrpIz7HbBRuhAn1gWlk1BTXX5WXM5awg+NSs1KIpoi2mlyVWo5hPL+a7f2H//2s37SptV01A0yZFnvv0wXPe0jPQbwUNh/yCFqOAfNA5VLmvWwr3HPuIeN57ZGSC9qyzc6TnC/YbMny3jUQh4kZZLRWgzH7/IVOCK2m1v5uAxivmr+38pSKsCGUovTFRIRdPJKRI+qfGPQl7gI+2bOglaAv6lt7V8mLiwaML6k2Y5ZkY+pRmlVO737e4=; 5:abPeqFdRqtcmwLbQG9y+YEjpFGNWWab9awa6FE6HlotvI4fmyAEbk831CuInN8oYrciAh9LPlIaE0UZlKQv1rFvjduYZvRUfTUDIdc5xiJ5f4fhqISAKGJZqAXvMNPd3GEVVtuVkPsUaaoYRhXKRUy/v3tdGYTKDtn4ISk1QYfo=; 24:OJrWeOkc6acQRGeZ/T31ypmTkWjRq6wsuaFYqgEPy/JiB2v/MtDy6FyYGpWioLm5tslzNleLuDi4pSV/NWiqIv7Ygn2pWprG+ho/TYLNq68=; 7:mQtLZd+pM7friQL14b8wKhNNGpjdXbb7aIW0RivQwHe86Qkw+uN9jFWd2uYRuqU9eMtiRhMmnk7597oShbglS8Vdfx4WmQ2+b7NglNUpszGP/iZISUk6jD0WPCyRHdjopk9QwA98kmTleWpcMazDgLOF7HZyoXspyllDj0AZHm6zMDVDFLsFGIYs6NoUHWNGgcWB2hQu61pTXYasiWK4ZAjYzRNV3whM3eqLfxfydyp9TM/KlcWi5PLGJihfwj5g SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; KL1PR0601MB1877; 20:UQKYPdMEBO0i510HHi0rFxJoZPBjN0qqVpPW8SygWWfiJ8ZYOgJB9NpmQEJojxSlOJ9lubz42ZeJhVM5DgV3hK6Bbg7OYAIJpVa5s5mLoNUiodndBBh0q70ui9vuSqhr1N7Ka4PId8TifmFzTIuJEImOFr3i23Gaseq5GtqN8gw= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jan 2018 04:20:09.5186 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: acc2416c-6041-45bc-daaf-08d566cf95b5 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 122/186] ASoC: twl6040: 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 = 1 -> .use_pmdown_time = 0 - -> .endianness = 1 - -> .non_legacy_dai_naming = 1 Signed-off-by: Kuninori Morimoto --- sound/soc/codecs/twl6040.c | 269 ++++++++++++++++++-------------------- sound/soc/codecs/twl6040.h | 10 +- sound/soc/omap/omap-abe-twl6040.c | 8 +- 3 files changed, 139 insertions(+), 148 deletions(-) diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c index 573a523..9bf23f8 100644 --- a/sound/soc/codecs/twl6040.c +++ b/sound/soc/codecs/twl6040.c @@ -76,7 +76,7 @@ struct twl6040_data { unsigned int clk_in; unsigned int sysclk; struct twl6040_jack_data hs_jack; - struct snd_soc_codec *codec; + struct snd_soc_component *component; struct mutex mutex; }; @@ -106,12 +106,12 @@ struct twl6040_data { { .count = ARRAY_SIZE(hp_rates), .list = hp_rates, }, }; -#define to_twl6040(codec) dev_get_drvdata((codec)->dev->parent) +#define to_twl6040(component) dev_get_drvdata((component)->dev->parent) -static unsigned int twl6040_read(struct snd_soc_codec *codec, unsigned int reg) +static unsigned int twl6040_read(struct snd_soc_component *component, unsigned int reg) { - struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); - struct twl6040 *twl6040 = to_twl6040(codec); + struct twl6040_data *priv = snd_soc_component_get_drvdata(component); + struct twl6040 *twl6040 = to_twl6040(component); u8 value; if (reg >= TWL6040_CACHEREGNUM) @@ -133,10 +133,10 @@ static unsigned int twl6040_read(struct snd_soc_codec *codec, unsigned int reg) return value; } -static bool twl6040_can_write_to_chip(struct snd_soc_codec *codec, +static bool twl6040_can_write_to_chip(struct snd_soc_component *component, unsigned int reg) { - struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); + struct twl6040_data *priv = snd_soc_component_get_drvdata(component); switch (reg) { case TWL6040_REG_HSLCTL: @@ -152,10 +152,10 @@ static bool twl6040_can_write_to_chip(struct snd_soc_codec *codec, } } -static inline void twl6040_update_dl12_cache(struct snd_soc_codec *codec, +static inline void twl6040_update_dl12_cache(struct snd_soc_component *component, u8 reg, u8 value) { - struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); + struct twl6040_data *priv = snd_soc_component_get_drvdata(component); switch (reg) { case TWL6040_REG_HSLCTL: @@ -170,54 +170,54 @@ static inline void twl6040_update_dl12_cache(struct snd_soc_codec *codec, } } -static int twl6040_write(struct snd_soc_codec *codec, +static int twl6040_write(struct snd_soc_component *component, unsigned int reg, unsigned int value) { - struct twl6040 *twl6040 = to_twl6040(codec); + struct twl6040 *twl6040 = to_twl6040(component); if (reg >= TWL6040_CACHEREGNUM) return -EIO; - twl6040_update_dl12_cache(codec, reg, value); - if (twl6040_can_write_to_chip(codec, reg)) + twl6040_update_dl12_cache(component, reg, value); + if (twl6040_can_write_to_chip(component, reg)) return twl6040_reg_write(twl6040, reg, value); else return 0; } -static void twl6040_init_chip(struct snd_soc_codec *codec) +static void twl6040_init_chip(struct snd_soc_component *component) { - twl6040_read(codec, TWL6040_REG_TRIM1); - twl6040_read(codec, TWL6040_REG_TRIM2); - twl6040_read(codec, TWL6040_REG_TRIM3); - twl6040_read(codec, TWL6040_REG_HSOTRIM); - twl6040_read(codec, TWL6040_REG_HFOTRIM); + twl6040_read(component, TWL6040_REG_TRIM1); + twl6040_read(component, TWL6040_REG_TRIM2); + twl6040_read(component, TWL6040_REG_TRIM3); + twl6040_read(component, TWL6040_REG_HSOTRIM); + twl6040_read(component, TWL6040_REG_HFOTRIM); /* Change chip defaults */ /* No imput selected for microphone amplifiers */ - twl6040_write(codec, TWL6040_REG_MICLCTL, 0x18); - twl6040_write(codec, TWL6040_REG_MICRCTL, 0x18); + twl6040_write(component, TWL6040_REG_MICLCTL, 0x18); + twl6040_write(component, TWL6040_REG_MICRCTL, 0x18); /* * We need to lower the default gain values, so the ramp code * can work correctly for the first playback. * This reduces the pop noise heard at the first playback. */ - twl6040_write(codec, TWL6040_REG_HSGAIN, 0xff); - twl6040_write(codec, TWL6040_REG_EARCTL, 0x1e); - twl6040_write(codec, TWL6040_REG_HFLGAIN, 0x1d); - twl6040_write(codec, TWL6040_REG_HFRGAIN, 0x1d); - twl6040_write(codec, TWL6040_REG_LINEGAIN, 0); + twl6040_write(component, TWL6040_REG_HSGAIN, 0xff); + twl6040_write(component, TWL6040_REG_EARCTL, 0x1e); + twl6040_write(component, TWL6040_REG_HFLGAIN, 0x1d); + twl6040_write(component, TWL6040_REG_HFRGAIN, 0x1d); + twl6040_write(component, TWL6040_REG_LINEGAIN, 0); } /* set headset dac and driver power mode */ -static int headset_power_mode(struct snd_soc_codec *codec, int high_perf) +static int headset_power_mode(struct snd_soc_component *component, int high_perf) { int hslctl, hsrctl; int mask = TWL6040_HSDRVMODE | TWL6040_HSDACMODE; - hslctl = twl6040_read(codec, TWL6040_REG_HSLCTL); - hsrctl = twl6040_read(codec, TWL6040_REG_HSRCTL); + hslctl = twl6040_read(component, TWL6040_REG_HSLCTL); + hsrctl = twl6040_read(component, TWL6040_REG_HSRCTL); if (high_perf) { hslctl &= ~mask; @@ -227,8 +227,8 @@ static int headset_power_mode(struct snd_soc_codec *codec, int high_perf) hsrctl |= mask; } - twl6040_write(codec, TWL6040_REG_HSLCTL, hslctl); - twl6040_write(codec, TWL6040_REG_HSRCTL, hsrctl); + twl6040_write(component, TWL6040_REG_HSLCTL, hslctl); + twl6040_write(component, TWL6040_REG_HSRCTL, hsrctl); return 0; } @@ -236,7 +236,7 @@ static int headset_power_mode(struct snd_soc_codec *codec, int high_perf) static int twl6040_hs_dac_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); u8 hslctl, hsrctl; /* @@ -244,8 +244,8 @@ static int twl6040_hs_dac_event(struct snd_soc_dapm_widget *w, * Both HS DAC need to be turned on (before the HS driver) and off at * the same time. */ - hslctl = twl6040_read(codec, TWL6040_REG_HSLCTL); - hsrctl = twl6040_read(codec, TWL6040_REG_HSRCTL); + hslctl = twl6040_read(component, TWL6040_REG_HSLCTL); + hsrctl = twl6040_read(component, TWL6040_REG_HSRCTL); if (SND_SOC_DAPM_EVENT_ON(event)) { hslctl |= TWL6040_HSDACENA; hsrctl |= TWL6040_HSDACENA; @@ -253,8 +253,8 @@ static int twl6040_hs_dac_event(struct snd_soc_dapm_widget *w, hslctl &= ~TWL6040_HSDACENA; hsrctl &= ~TWL6040_HSDACENA; } - twl6040_write(codec, TWL6040_REG_HSLCTL, hslctl); - twl6040_write(codec, TWL6040_REG_HSRCTL, hsrctl); + twl6040_write(component, TWL6040_REG_HSLCTL, hslctl); + twl6040_write(component, TWL6040_REG_HSRCTL, hsrctl); msleep(1); return 0; @@ -263,17 +263,17 @@ static int twl6040_hs_dac_event(struct snd_soc_dapm_widget *w, static int twl6040_ep_drv_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 twl6040_data *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + struct twl6040_data *priv = snd_soc_component_get_drvdata(component); int ret = 0; if (SND_SOC_DAPM_EVENT_ON(event)) { /* Earphone doesn't support low power mode */ priv->hs_power_mode_locked = 1; - ret = headset_power_mode(codec, 1); + ret = headset_power_mode(component, 1); } else { priv->hs_power_mode_locked = 0; - ret = headset_power_mode(codec, priv->hs_power_mode); + ret = headset_power_mode(component, priv->hs_power_mode); } msleep(1); @@ -281,16 +281,16 @@ static int twl6040_ep_drv_event(struct snd_soc_dapm_widget *w, return ret; } -static void twl6040_hs_jack_report(struct snd_soc_codec *codec, +static void twl6040_hs_jack_report(struct snd_soc_component *component, struct snd_soc_jack *jack, int report) { - struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); + struct twl6040_data *priv = snd_soc_component_get_drvdata(component); int status; mutex_lock(&priv->mutex); /* Sync status */ - status = twl6040_read(codec, TWL6040_REG_STATUS); + status = twl6040_read(component, TWL6040_REG_STATUS); if (status & TWL6040_PLUGCOMP) snd_soc_jack_report(jack, report, report); else @@ -299,16 +299,16 @@ static void twl6040_hs_jack_report(struct snd_soc_codec *codec, mutex_unlock(&priv->mutex); } -void twl6040_hs_jack_detect(struct snd_soc_codec *codec, +void twl6040_hs_jack_detect(struct snd_soc_component *component, struct snd_soc_jack *jack, int report) { - struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); + struct twl6040_data *priv = snd_soc_component_get_drvdata(component); struct twl6040_jack_data *hs_jack = &priv->hs_jack; hs_jack->jack = jack; hs_jack->report = report; - twl6040_hs_jack_report(codec, hs_jack->jack, hs_jack->report); + twl6040_hs_jack_report(component, hs_jack->jack, hs_jack->report); } EXPORT_SYMBOL_GPL(twl6040_hs_jack_detect); @@ -316,17 +316,17 @@ static void twl6040_accessory_work(struct work_struct *work) { struct twl6040_data *priv = container_of(work, struct twl6040_data, hs_jack.work.work); - struct snd_soc_codec *codec = priv->codec; + struct snd_soc_component *component = priv->component; struct twl6040_jack_data *hs_jack = &priv->hs_jack; - twl6040_hs_jack_report(codec, hs_jack->jack, hs_jack->report); + twl6040_hs_jack_report(component, hs_jack->jack, hs_jack->report); } /* audio interrupt handler */ static irqreturn_t twl6040_audio_handler(int irq, void *data) { - struct snd_soc_codec *codec = data; - struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = data; + struct twl6040_data *priv = snd_soc_component_get_drvdata(component); queue_delayed_work(system_power_efficient_wq, &priv->hs_jack.work, msecs_to_jiffies(200)); @@ -337,12 +337,12 @@ static irqreturn_t twl6040_audio_handler(int irq, void *data) static int twl6040_soc_dapm_put_vibra_enum(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_codec *codec = snd_soc_dapm_kcontrol_codec(kcontrol); + struct snd_soc_component *component = snd_soc_dapm_kcontrol_component(kcontrol); struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; unsigned int val; /* Do not allow changes while Input/FF efect is running */ - val = twl6040_read(codec, e->reg); + val = twl6040_read(component, e->reg); if (val & TWL6040_VIBENA && !(val & TWL6040_VIBSEL)) return -EBUSY; @@ -486,8 +486,8 @@ static SOC_ENUM_SINGLE_EXT_DECL(twl6040_power_mode_enum, static int twl6040_headset_power_get_enum(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); - struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct twl6040_data *priv = snd_soc_component_get_drvdata(component); ucontrol->value.enumerated.item[0] = priv->hs_power_mode; @@ -497,13 +497,13 @@ static int twl6040_headset_power_get_enum(struct snd_kcontrol *kcontrol, static int twl6040_headset_power_put_enum(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); - struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct twl6040_data *priv = snd_soc_component_get_drvdata(component); int high_perf = ucontrol->value.enumerated.item[0]; int ret = 0; if (!priv->hs_power_mode_locked) - ret = headset_power_mode(codec, high_perf); + ret = headset_power_mode(component, high_perf); if (!ret) priv->hs_power_mode = high_perf; @@ -514,8 +514,8 @@ static int twl6040_headset_power_put_enum(struct snd_kcontrol *kcontrol, static int twl6040_pll_get_enum(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); - struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct twl6040_data *priv = snd_soc_component_get_drvdata(component); ucontrol->value.enumerated.item[0] = priv->pll_power_mode; @@ -525,17 +525,17 @@ static int twl6040_pll_get_enum(struct snd_kcontrol *kcontrol, static int twl6040_pll_put_enum(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); - struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct twl6040_data *priv = snd_soc_component_get_drvdata(component); priv->pll_power_mode = ucontrol->value.enumerated.item[0]; return 0; } -int twl6040_get_dl1_gain(struct snd_soc_codec *codec) +int twl6040_get_dl1_gain(struct snd_soc_component *component) { - struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); + struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); if (snd_soc_dapm_get_pin_status(dapm, "EP")) return -1; /* -1dB */ @@ -543,7 +543,7 @@ int twl6040_get_dl1_gain(struct snd_soc_codec *codec) if (snd_soc_dapm_get_pin_status(dapm, "HSOR") || snd_soc_dapm_get_pin_status(dapm, "HSOL")) { - u8 val = twl6040_read(codec, TWL6040_REG_HSLCTL); + u8 val = twl6040_read(component, TWL6040_REG_HSLCTL); if (val & TWL6040_HSDACMODE) /* HSDACL in LP mode */ return -8; /* -8dB */ @@ -555,26 +555,26 @@ int twl6040_get_dl1_gain(struct snd_soc_codec *codec) } EXPORT_SYMBOL_GPL(twl6040_get_dl1_gain); -int twl6040_get_clk_id(struct snd_soc_codec *codec) +int twl6040_get_clk_id(struct snd_soc_component *component) { - struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); + struct twl6040_data *priv = snd_soc_component_get_drvdata(component); return priv->pll_power_mode; } EXPORT_SYMBOL_GPL(twl6040_get_clk_id); -int twl6040_get_trim_value(struct snd_soc_codec *codec, enum twl6040_trim trim) +int twl6040_get_trim_value(struct snd_soc_component *component, enum twl6040_trim trim) { if (unlikely(trim >= TWL6040_TRIM_INVAL)) return -EINVAL; - return twl6040_read(codec, TWL6040_REG_TRIM1 + trim); + return twl6040_read(component, TWL6040_REG_TRIM1 + trim); } EXPORT_SYMBOL_GPL(twl6040_get_trim_value); -int twl6040_get_hs_step_size(struct snd_soc_codec *codec) +int twl6040_get_hs_step_size(struct snd_soc_component *component) { - struct twl6040 *twl6040 = to_twl6040(codec); + struct twl6040 *twl6040 = to_twl6040(component); if (twl6040_get_revid(twl6040) < TWL6040_REV_ES1_3) /* For ES under ES_1.3 HS step is 2 mV */ @@ -829,11 +829,11 @@ int twl6040_get_hs_step_size(struct snd_soc_codec *codec) {"VIBRAR", NULL, "Vibra Right Driver"}, }; -static int twl6040_set_bias_level(struct snd_soc_codec *codec, +static int twl6040_set_bias_level(struct snd_soc_component *component, enum snd_soc_bias_level level) { - struct twl6040 *twl6040 = to_twl6040(codec); - struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); + struct twl6040 *twl6040 = to_twl6040(component); + struct twl6040_data *priv = snd_soc_component_get_drvdata(component); int ret = 0; switch (level) { @@ -856,7 +856,7 @@ static int twl6040_set_bias_level(struct snd_soc_codec *codec, priv->codec_powered = 1; /* Set external boost GPO */ - twl6040_write(codec, TWL6040_REG_GPOCTL, 0x02); + twl6040_write(component, TWL6040_REG_GPOCTL, 0x02); break; case SND_SOC_BIAS_OFF: if (!priv->codec_powered) @@ -873,8 +873,8 @@ static int twl6040_set_bias_level(struct snd_soc_codec *codec, static int twl6040_startup(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { - struct snd_soc_codec *codec = dai->codec; - struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct twl6040_data *priv = snd_soc_component_get_drvdata(component); snd_pcm_hw_constraint_list(substream->runtime, 0, SNDRV_PCM_HW_PARAM_RATE, @@ -887,8 +887,8 @@ static int twl6040_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 twl6040_data *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct twl6040_data *priv = snd_soc_component_get_drvdata(component); int rate; rate = params_rate(params); @@ -899,7 +899,7 @@ static int twl6040_hw_params(struct snd_pcm_substream *substream, case 88200: /* These rates are not supported when HPPLL is in use */ if (unlikely(priv->pll == TWL6040_SYSCLK_SEL_HPPLL)) { - dev_err(codec->dev, "HPPLL does not support rate %d\n", + dev_err(component->dev, "HPPLL does not support rate %d\n", rate); return -EINVAL; } @@ -913,7 +913,7 @@ static int twl6040_hw_params(struct snd_pcm_substream *substream, priv->sysclk = 19200000; break; default: - dev_err(codec->dev, "unsupported rate %d\n", rate); + dev_err(component->dev, "unsupported rate %d\n", rate); return -EINVAL; } @@ -923,20 +923,20 @@ static int twl6040_hw_params(struct snd_pcm_substream *substream, static int twl6040_prepare(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { - struct snd_soc_codec *codec = dai->codec; - struct twl6040 *twl6040 = to_twl6040(codec); - struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct twl6040 *twl6040 = to_twl6040(component); + struct twl6040_data *priv = snd_soc_component_get_drvdata(component); int ret; if (!priv->sysclk) { - dev_err(codec->dev, + dev_err(component->dev, "no mclk configured, call set_sysclk() on init\n"); return -EINVAL; } ret = twl6040_set_pll(twl6040, priv->pll, priv->clk_in, priv->sysclk); if (ret) { - dev_err(codec->dev, "Can not set PLL (%d)\n", ret); + dev_err(component->dev, "Can not set PLL (%d)\n", ret); return -EPERM; } @@ -946,8 +946,8 @@ static int twl6040_prepare(struct snd_pcm_substream *substream, static int twl6040_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 twl6040_data *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = codec_dai->component; + struct twl6040_data *priv = snd_soc_component_get_drvdata(component); switch (clk_id) { case TWL6040_SYSCLK_SEL_LPPLL: @@ -956,26 +956,26 @@ static int twl6040_set_dai_sysclk(struct snd_soc_dai *codec_dai, priv->clk_in = freq; break; default: - dev_err(codec->dev, "unknown clk_id %d\n", clk_id); + dev_err(component->dev, "unknown clk_id %d\n", clk_id); return -EINVAL; } return 0; } -static void twl6040_mute_path(struct snd_soc_codec *codec, enum twl6040_dai_id id, +static void twl6040_mute_path(struct snd_soc_component *component, enum twl6040_dai_id id, int mute) { - struct twl6040 *twl6040 = to_twl6040(codec); - struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); + struct twl6040 *twl6040 = to_twl6040(component); + struct twl6040_data *priv = snd_soc_component_get_drvdata(component); int hslctl, hsrctl, earctl; int hflctl, hfrctl; switch (id) { case TWL6040_DAI_DL1: - hslctl = twl6040_read(codec, TWL6040_REG_HSLCTL); - hsrctl = twl6040_read(codec, TWL6040_REG_HSRCTL); - earctl = twl6040_read(codec, TWL6040_REG_EARCTL); + hslctl = twl6040_read(component, TWL6040_REG_HSLCTL); + hsrctl = twl6040_read(component, TWL6040_REG_HSRCTL); + earctl = twl6040_read(component, TWL6040_REG_EARCTL); if (mute) { /* Power down drivers and DACs */ @@ -991,8 +991,8 @@ static void twl6040_mute_path(struct snd_soc_codec *codec, enum twl6040_dai_id i priv->dl1_unmuted = !mute; break; case TWL6040_DAI_DL2: - hflctl = twl6040_read(codec, TWL6040_REG_HFLCTL); - hfrctl = twl6040_read(codec, TWL6040_REG_HFRCTL); + hflctl = twl6040_read(component, TWL6040_REG_HFLCTL); + hfrctl = twl6040_read(component, TWL6040_REG_HFRCTL); if (mute) { /* Power down drivers and DACs */ @@ -1015,12 +1015,12 @@ static int twl6040_digital_mute(struct snd_soc_dai *dai, int mute) { switch (dai->id) { case TWL6040_DAI_LEGACY: - twl6040_mute_path(dai->codec, TWL6040_DAI_DL1, mute); - twl6040_mute_path(dai->codec, TWL6040_DAI_DL2, mute); + twl6040_mute_path(dai->component, TWL6040_DAI_DL1, mute); + twl6040_mute_path(dai->component, TWL6040_DAI_DL2, mute); break; case TWL6040_DAI_DL1: case TWL6040_DAI_DL2: - twl6040_mute_path(dai->codec, dai->id, mute); + twl6040_mute_path(dai->component, dai->id, mute); break; default: break; @@ -1107,23 +1107,23 @@ static int twl6040_digital_mute(struct snd_soc_dai *dai, int mute) }, }; -static int twl6040_probe(struct snd_soc_codec *codec) +static int twl6040_probe(struct snd_soc_component *component) { struct twl6040_data *priv; - struct platform_device *pdev = to_platform_device(codec->dev); + struct platform_device *pdev = to_platform_device(component->dev); int ret = 0; - priv = devm_kzalloc(codec->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc(component->dev, sizeof(*priv), GFP_KERNEL); if (priv == NULL) return -ENOMEM; - snd_soc_codec_set_drvdata(codec, priv); + snd_soc_component_set_drvdata(component, priv); - priv->codec = codec; + priv->component = component; priv->plug_irq = platform_get_irq(pdev, 0); if (priv->plug_irq < 0) { - dev_err(codec->dev, "invalid irq: %d\n", priv->plug_irq); + dev_err(component->dev, "invalid irq: %d\n", priv->plug_irq); return priv->plug_irq; } @@ -1134,64 +1134,55 @@ static int twl6040_probe(struct snd_soc_codec *codec) ret = request_threaded_irq(priv->plug_irq, NULL, twl6040_audio_handler, IRQF_NO_SUSPEND | IRQF_ONESHOT, - "twl6040_irq_plug", codec); + "twl6040_irq_plug", component); if (ret) { - dev_err(codec->dev, "PLUG IRQ request failed: %d\n", ret); + dev_err(component->dev, "PLUG IRQ request failed: %d\n", ret); return ret; } - snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_STANDBY); - twl6040_init_chip(codec); + snd_soc_component_force_bias_level(component, SND_SOC_BIAS_STANDBY); + twl6040_init_chip(component); return 0; } -static int twl6040_remove(struct snd_soc_codec *codec) +static void twl6040_remove(struct snd_soc_component *component) { - struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); + struct twl6040_data *priv = snd_soc_component_get_drvdata(component); - free_irq(priv->plug_irq, codec); - - return 0; + free_irq(priv->plug_irq, component); } -static const struct snd_soc_codec_driver soc_codec_dev_twl6040 = { - .probe = twl6040_probe, - .remove = twl6040_remove, - .read = twl6040_read, - .write = twl6040_write, - .set_bias_level = twl6040_set_bias_level, - .suspend_bias_off = true, - .ignore_pmdown_time = true, - - .component_driver = { - .controls = twl6040_snd_controls, - .num_controls = ARRAY_SIZE(twl6040_snd_controls), - .dapm_widgets = twl6040_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(twl6040_dapm_widgets), - .dapm_routes = intercon, - .num_dapm_routes = ARRAY_SIZE(intercon), - }, +static const struct snd_soc_component_driver soc_component_dev_twl6040 = { + .probe = twl6040_probe, + .remove = twl6040_remove, + .read = twl6040_read, + .remove = twl6040_remove, + .set_bias_level = twl6040_set_bias_level, + .controls = twl6040_snd_controls, + .num_controls = ARRAY_SIZE(twl6040_snd_controls), + .dapm_widgets = twl6040_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(twl6040_dapm_widgets), + .dapm_routes = intercon, + .num_dapm_routes = ARRAY_SIZE(intercon), + .suspend_bias_off = 1, + .idle_bias_on = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; static int twl6040_codec_probe(struct platform_device *pdev) { - return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_twl6040, + return devm_snd_soc_register_component(&pdev->dev, + &soc_component_dev_twl6040, twl6040_dai, ARRAY_SIZE(twl6040_dai)); } -static int twl6040_codec_remove(struct platform_device *pdev) -{ - snd_soc_unregister_codec(&pdev->dev); - return 0; -} - static struct platform_driver twl6040_codec_driver = { .driver = { .name = "twl6040-codec", }, .probe = twl6040_codec_probe, - .remove = twl6040_codec_remove, }; module_platform_driver(twl6040_codec_driver); diff --git a/sound/soc/codecs/twl6040.h b/sound/soc/codecs/twl6040.h index 0611406c..3d9f957 100644 --- a/sound/soc/codecs/twl6040.h +++ b/sound/soc/codecs/twl6040.h @@ -34,11 +34,11 @@ enum twl6040_trim { #define TWL6040_HSF_TRIM_LEFT(x) (x & 0x0f) #define TWL6040_HSF_TRIM_RIGHT(x) ((x >> 4) & 0x0f) -int twl6040_get_dl1_gain(struct snd_soc_codec *codec); -void twl6040_hs_jack_detect(struct snd_soc_codec *codec, +int twl6040_get_dl1_gain(struct snd_soc_component *component); +void twl6040_hs_jack_detect(struct snd_soc_component *component, struct snd_soc_jack *jack, int report); -int twl6040_get_clk_id(struct snd_soc_codec *codec); -int twl6040_get_trim_value(struct snd_soc_codec *codec, enum twl6040_trim trim); -int twl6040_get_hs_step_size(struct snd_soc_codec *codec); +int twl6040_get_clk_id(struct snd_soc_component *component); +int twl6040_get_trim_value(struct snd_soc_component *component, enum twl6040_trim trim); +int twl6040_get_hs_step_size(struct snd_soc_component *component); #endif /* End of __TWL6040_H__ */ diff --git a/sound/soc/omap/omap-abe-twl6040.c b/sound/soc/omap/omap-abe-twl6040.c index 614b18d..15ccbf4 100644 --- a/sound/soc/omap/omap-abe-twl6040.c +++ b/sound/soc/omap/omap-abe-twl6040.c @@ -52,7 +52,7 @@ static int omap_abe_hw_params(struct snd_pcm_substream *substream, int clk_id, freq; int ret; - clk_id = twl6040_get_clk_id(rtd->codec); + clk_id = twl6040_get_clk_id(codec_dai->component); if (clk_id == TWL6040_SYSCLK_SEL_HPPLL) freq = priv->mclk_freq; else if (clk_id == TWL6040_SYSCLK_SEL_LPPLL) @@ -166,7 +166,7 @@ static int omap_abe_dmic_hw_params(struct snd_pcm_substream *substream, static int omap_abe_twl6040_init(struct snd_soc_pcm_runtime *rtd) { - struct snd_soc_codec *codec = rtd->codec; + struct snd_soc_component *component = rtd->codec_dai->component; struct snd_soc_card *card = rtd->card; struct abe_twl6040 *priv = snd_soc_card_get_drvdata(card); int hs_trim; @@ -176,7 +176,7 @@ static int omap_abe_twl6040_init(struct snd_soc_pcm_runtime *rtd) * Configure McPDM offset cancellation based on the HSOTRIM value from * twl6040. */ - hs_trim = twl6040_get_trim_value(codec, TWL6040_TRIM_HSOTRIM); + hs_trim = twl6040_get_trim_value(component, TWL6040_TRIM_HSOTRIM); omap_mcpdm_configure_dn_offsets(rtd, TWL6040_HSF_TRIM_LEFT(hs_trim), TWL6040_HSF_TRIM_RIGHT(hs_trim)); @@ -189,7 +189,7 @@ static int omap_abe_twl6040_init(struct snd_soc_pcm_runtime *rtd) if (ret) return ret; - twl6040_hs_jack_detect(codec, &hs_jack, SND_JACK_HEADSET); + twl6040_hs_jack_detect(component, &hs_jack, SND_JACK_HEADSET); } return 0;