From patchwork Thu Sep 6 12:12:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 1413731 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 3F57740220 for ; Thu, 6 Sep 2012 12:14:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753637Ab2IFMNu (ORCPT ); Thu, 6 Sep 2012 08:13:50 -0400 Received: from na3sys009aog116.obsmtp.com ([74.125.149.240]:36494 "EHLO na3sys009aog116.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754339Ab2IFMMs (ORCPT ); Thu, 6 Sep 2012 08:12:48 -0400 Received: from mail-ob0-f174.google.com ([209.85.214.174]) (using TLSv1) by na3sys009aob116.postini.com ([74.125.148.12]) with SMTP ID DSNKUEiTP1NssSFYFVTEyyCEXx1ssoIFxgXm@postini.com; Thu, 06 Sep 2012 05:12:47 PDT Received: by obbuo13 with SMTP id uo13so2297414obb.19 for ; Thu, 06 Sep 2012 05:12:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=0RS8yQ5bqMo5hEpP8QhC0yLcD/NBqlCOBD0MBn7/uxQ=; b=lLq7rIvXbDk42VZdY8h5IJnjpT0774rHImqPCZy6e/7MYjWCxuyOK232GGb9yNjfYz NSR3ucDXTzHGetLx5CBIF3I5cg0UYjWk/s9fX5SRATd2kzP/RisoPjoHmzg5o5X1P2yT DZs/jFUOnq04Tp6YoJ1qcj/l/Bf8geflrgx5uHufzmBt9QsHfwKIfy4sQJkU+EFGtncu gaulOzpDfge6rMWkOFGzShdEsAWz7iAQcxLnywk0bVAFLakDOzFLftSQc7ZIgu3CBF6t 45b1fu0Ktwpxt/t8bKKbfCf18IxV1Y9+mKnX8nS9q/AlPpDK69VpXWKh0AojBNUi1gZn xlbQ== Received: by 10.60.170.105 with SMTP id al9mr1589376oec.136.1346933567065; Thu, 06 Sep 2012 05:12:47 -0700 (PDT) Received: from barack.emea.dhcp.ti.com (dragon.ti.com. [192.94.94.33]) by mx.google.com with ESMTPS id zn9sm1795856obb.23.2012.09.06.05.12.43 (version=SSLv3 cipher=OTHER); Thu, 06 Sep 2012 05:12:46 -0700 (PDT) From: Peter Ujfalusi To: Mark Brown , Liam Girdwood , Tony Lindgren , Samuel Ortiz , Dmitry Torokhov , Grant Likely , Rob Herring Cc: Tero Kristo , alsa-devel@alsa-project.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree-discuss@lists.ozlabs.org, Benoit Cousson , linux-kernel@vger.kernel.org Subject: [PATCH v3 13/14] ASoC: twl4030: Add pointer to pdata within the private data Date: Thu, 6 Sep 2012 15:12:20 +0300 Message-Id: <1346933541-21547-14-git-send-email-peter.ujfalusi@ti.com> X-Mailer: git-send-email 1.7.12 In-Reply-To: <1346933541-21547-1-git-send-email-peter.ujfalusi@ti.com> References: <1346933541-21547-1-git-send-email-peter.ujfalusi@ti.com> X-Gm-Message-State: ALoCoQljrZ0s2Zw4rWzEXLyYZa4+tDHj12kaOfqxe0SqFLEQS02xXKigVT9StrBpLP7nadIYEmwl Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Access the pdata via a pointer within the twl4030_priv structure. In preparation for DeviceTree support. Signed-off-by: Peter Ujfalusi --- sound/soc/codecs/twl4030.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c index 413e698..8b13d50 100644 --- a/sound/soc/codecs/twl4030.c +++ b/sound/soc/codecs/twl4030.c @@ -153,8 +153,7 @@ struct twl4030_priv { u8 predrivel_enabled, predriver_enabled; u8 carkitl_enabled, carkitr_enabled; - /* Delay needed after enabling the digimic interface */ - unsigned int digimic_delay; + struct twl4030_codec_data *pdata; }; /* @@ -348,7 +347,7 @@ static void twl4030_init_chip(struct snd_soc_codec *codec) if (!pdata) return; - twl4030->digimic_delay = pdata->digimic_delay; + twl4030->pdata = pdata; reg = twl4030_read_reg_cache(codec, TWL4030_REG_HS_POPN_SET); reg &= ~TWL4030_RAMP_DELAY; @@ -749,9 +748,9 @@ static int aif_event(struct snd_soc_dapm_widget *w, static void headset_ramp(struct snd_soc_codec *codec, int ramp) { - struct twl4030_codec_data *pdata = codec->dev->platform_data; unsigned char hs_gain, hs_pop; struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec); + struct twl4030_codec_data *pdata = twl4030->pdata; /* Base values for ramp delay calculation: 2^19 - 2^26 */ unsigned int ramp_base[] = {524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864}; @@ -864,9 +863,10 @@ static int digimic_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(w->codec); + struct twl4030_codec_data *pdata = twl4030->pdata; - if (twl4030->digimic_delay) - twl4030_wait_ms(twl4030->digimic_delay); + if (pdata && pdata->digimic_delay) + twl4030_wait_ms(pdata->digimic_delay); return 0; } @@ -2248,8 +2248,8 @@ static int twl4030_soc_probe(struct snd_soc_codec *codec) static int twl4030_soc_remove(struct snd_soc_codec *codec) { - struct twl4030_codec_data *pdata = dev_get_platdata(codec->dev); struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec); + struct twl4030_codec_data *pdata = twl4030->pdata; /* Reset registers to their chip default before leaving */ twl4030_reset_registers(codec);