From patchwork Thu Apr 30 01:43:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yang.a.fang@intel.com X-Patchwork-Id: 6299521 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 89770BEEE1 for ; Thu, 30 Apr 2015 01:45:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B7CC22017D for ; Thu, 30 Apr 2015 01:45:28 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id B046820160 for ; Thu, 30 Apr 2015 01:45:26 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id AC40C26548F; Thu, 30 Apr 2015 03:45:25 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 1C3FA2612AC; Thu, 30 Apr 2015 03:44:54 +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 7A0642608B4; Thu, 30 Apr 2015 03:44:51 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by alsa0.perex.cz (Postfix) with ESMTP id A6D662608CD for ; Thu, 30 Apr 2015 03:44:40 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP; 29 Apr 2015 18:44:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,674,1422950400"; d="scan'208";a="564023265" Received: from mocha.sc.intel.com ([143.183.245.87]) by orsmga003.jf.intel.com with ESMTP; 29 Apr 2015 18:44:40 -0700 From: yang.a.fang@intel.com To: broonie@kernel.org, lgirdwood@gmail.com Date: Wed, 29 Apr 2015 18:43:57 -0700 Message-Id: <1430358238-74659-3-git-send-email-yang.a.fang@intel.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1430358238-74659-1-git-send-email-yang.a.fang@intel.com> References: <1430358238-74659-1-git-send-email-yang.a.fang@intel.com> Cc: alsa-devel@alsa-project.org, vinod.koul@intel.com, praveen.k.jain@intel.com, praveen.diwakar@intel.com, denny.iriawan@intel.com, "Fang, Yang A" , kevin.strasser@linux.intel.com, dgreid@chromium.org Subject: [alsa-devel] [PATCH 3/4] ASoC: ts3a227e: add platform data for ts3a227e driver 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Fang, Yang A" make irq flag part of platform data Signed-off-by: Fang, Yang A --- include/sound/ts3a227e.h | 19 +++++++++++++++++++ sound/soc/codecs/ts3a227e.c | 9 ++++++++- sound/soc/codecs/ts3a227e.h | 2 ++ 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 include/sound/ts3a227e.h diff --git a/include/sound/ts3a227e.h b/include/sound/ts3a227e.h new file mode 100644 index 0000000..c005084 --- /dev/null +++ b/include/sound/ts3a227e.h @@ -0,0 +1,19 @@ +/* + * Platform data for TS3A227E + * + * Copyright (C) 2015 Google, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#ifndef __LINUX_SND_TS3A227E_H +#define __LINUX_SND_TS3A227E_H + +struct ts3a227e_platform_data { + + unsigned long irqflag; +}; + +#endif diff --git a/sound/soc/codecs/ts3a227e.c b/sound/soc/codecs/ts3a227e.c index 9fd80ac..422f66f 100644 --- a/sound/soc/codecs/ts3a227e.c +++ b/sound/soc/codecs/ts3a227e.c @@ -25,6 +25,7 @@ struct ts3a227e { struct regmap *regmap; struct snd_soc_jack *jack; + struct ts3a227e_platform_data pdata; bool plugged; bool mic_present; unsigned int buttons_held; @@ -274,6 +275,7 @@ static int ts3a227e_i2c_probe(struct i2c_client *i2c, { struct ts3a227e *ts3a227e; struct device *dev = &i2c->dev; + struct ts3a227e_platform_data *pdata = dev_get_platdata(&i2c->dev); int ret; unsigned int acc_reg; @@ -283,6 +285,11 @@ static int ts3a227e_i2c_probe(struct i2c_client *i2c, i2c_set_clientdata(i2c, ts3a227e); + ts3a227e->pdata.irqflag = IRQF_TRIGGER_LOW | IRQF_ONESHOT; + + if (pdata) + ts3a227e->pdata = *pdata; + ts3a227e->regmap = devm_regmap_init_i2c(i2c, &ts3a227e_regmap_config); if (IS_ERR(ts3a227e->regmap)) return PTR_ERR(ts3a227e->regmap); @@ -296,7 +303,7 @@ static int ts3a227e_i2c_probe(struct i2c_client *i2c, } ret = devm_request_threaded_irq(dev, i2c->irq, NULL, ts3a227e_interrupt, - IRQF_TRIGGER_LOW | IRQF_ONESHOT, + ts3a227e->pdata.irqflag, "TS3A227E", ts3a227e); if (ret) { dev_err(dev, "Cannot request irq %d (%d)\n", i2c->irq, ret); diff --git a/sound/soc/codecs/ts3a227e.h b/sound/soc/codecs/ts3a227e.h index e2acf9c..a587a72 100644 --- a/sound/soc/codecs/ts3a227e.h +++ b/sound/soc/codecs/ts3a227e.h @@ -11,6 +11,8 @@ #ifndef _TS3A227E_H #define _TS3A227E_H +#include + int ts3a227e_enable_jack_detect(struct snd_soc_component *component, struct snd_soc_jack *jack);