From patchwork Mon Sep 10 10:46:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 1431331 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id BAF25E0000 for ; Mon, 10 Sep 2012 10:47:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757358Ab2IJKq6 (ORCPT ); Mon, 10 Sep 2012 06:46:58 -0400 Received: from na3sys009aog119.obsmtp.com ([74.125.149.246]:57297 "EHLO na3sys009aog119.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757346Ab2IJKqy (ORCPT ); Mon, 10 Sep 2012 06:46:54 -0400 Received: from mail-oa0-f46.google.com ([209.85.219.46]) (using TLSv1) by na3sys009aob119.postini.com ([74.125.148.12]) with SMTP ID DSNKUE3FHYHRELTW1Hoe5uiVcbzRU/kF4ipS@postini.com; Mon, 10 Sep 2012 03:46:54 PDT Received: by oago6 with SMTP id o6so444605oag.19 for ; Mon, 10 Sep 2012 03:46:53 -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=SY4U3waOOvBmElfmF6GUmfgJhSiqbwiE5wJ3zV2Ipqd36WHeNZdO0QFQLDW7H2HVZ4 52fNk+pbnvSejFXUL24w8fKdhYBlpRrxfTbYfdKUVSrKMZoUPbAdgZU219TfwABTOVsg 6g5fgX8KZEyrGZpQVXrj0PCLVAuzkudMYl6IOZA7o0otOZ/FaXc7Xic9yOBk1fBmPTKT eGQB4VDoNa7cUAs+lE/f0j1DgiY2Di0zzHFoz8voeLZMYq0Ri7VeE85cw0SFA2Vg8w+K WX2K52iqXfc79I2I5WFS2jjanybxdmXT4tOhsLvmfn07sNkFassbMYo6JP0BwxvG3Ww5 LAyA== Received: by 10.60.22.169 with SMTP id e9mr13443672oef.124.1347274013276; Mon, 10 Sep 2012 03:46:53 -0700 (PDT) Received: from barack.emea.dhcp.ti.com (dragon.ti.com. [192.94.94.33]) by mx.google.com with ESMTPS id 5sm8888098oeq.4.2012.09.10.03.46.48 (version=SSLv3 cipher=OTHER); Mon, 10 Sep 2012 03:46:52 -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 v4 13/14] ASoC: twl4030: Add pointer to pdata within the private data Date: Mon, 10 Sep 2012 13:46:31 +0300 Message-Id: <1347273992-9107-14-git-send-email-peter.ujfalusi@ti.com> X-Mailer: git-send-email 1.7.12 In-Reply-To: <1347273992-9107-1-git-send-email-peter.ujfalusi@ti.com> References: <1347273992-9107-1-git-send-email-peter.ujfalusi@ti.com> X-Gm-Message-State: ALoCoQlXk1J7AQwGTOyw2jO3XJUNkYZOnc+5nHMJDH2hsFdQ5w161Lly4KA4yjNVDmYVef0n9h+x 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);