From patchwork Tue Jul 14 06:51:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Boichat X-Patchwork-Id: 6783951 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 622859F380 for ; Tue, 14 Jul 2015 06:53:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8C371207A5 for ; Tue, 14 Jul 2015 06:53:43 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 628F7207A2 for ; Tue, 14 Jul 2015 06:53:42 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 701C52651DC; Tue, 14 Jul 2015 08:53:41 +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.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 38FAC2651F0; Tue, 14 Jul 2015 08:52:44 +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 3486C2651DB; Tue, 14 Jul 2015 08:52:41 +0200 (CEST) Received: from mail-pd0-f179.google.com (mail-pd0-f179.google.com [209.85.192.179]) by alsa0.perex.cz (Postfix) with ESMTP id 2CC102650F2 for ; Tue, 14 Jul 2015 08:52:09 +0200 (CEST) Received: by pdjr16 with SMTP id r16so629375pdj.3 for ; Mon, 13 Jul 2015 23:52:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ti2bqngy3+5PWsAZKXY5vemHY1HzPKkQmDuPjwAhbTA=; b=nfTtOA77RogYfddBJ1KdR/nJZNM+oDgxyTdt/4nJRJYs78gZoSePtmnLRzVtGOVGpx QhsNEZwsGFwaxCecs4PcX2odaVqMnbkeoPTnqCChFhXuCIS3vaH1G+DnebqZ8OPU1+1j CYEwWls2iEUAGUMg9q1/8+PA6gosM8g1TK23M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ti2bqngy3+5PWsAZKXY5vemHY1HzPKkQmDuPjwAhbTA=; b=QBzvK3zjpaKUKK4siYcNbRYWUaoGmAP08oZLNksH/hC2Ln8NFxH5EFcDVrEcw4FhNG KU4/vBH3gCt0SszJJfazeZJeSJ/qCLSzmqmfA1PUSLWuZsJ2rSmuoqxR9OJf5/D0KyYd 91+NNdDS9yBOe4MXiz+P3P2eSa61ZVss5mkMPYDoz2CiJjnxOHgweem0orehZnXnIlnA tPUTiGW9OO8DiZrcNl3WcmP9O4ds51XLJawj2DA2PqybS4R37xX9p2oy37YaIm79lCQh 47Kukrq2Q7SpYNHDGtqbpIWu3e9l+HmrgK7+UhjdeSWfDcE91yPzHyVALPSe5pawxlnO 7fEQ== X-Gm-Message-State: ALoCoQnMwFLQb2ehQeW1M92xJmOFuYYji/X/uLdOJvyQJF4a1iR1WfRGcCxr1Im3/+14lgpxAOSv X-Received: by 10.69.19.161 with SMTP id gv1mr75847707pbd.21.1436856728449; Mon, 13 Jul 2015 23:52:08 -0700 (PDT) Received: from drinkcat.tpe.corp.google.com ([172.30.210.53]) by smtp.gmail.com with ESMTPSA id uk6sm108265pac.27.2015.07.13.23.52.06 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 13 Jul 2015 23:52:07 -0700 (PDT) From: Nicolas Boichat To: Mark Brown Date: Tue, 14 Jul 2015 14:51:26 +0800 Message-Id: <1436856687-31550-3-git-send-email-drinkcat@chromium.org> X-Mailer: git-send-email 2.4.3.573.g4eafbef In-Reply-To: <1436856687-31550-1-git-send-email-drinkcat@chromium.org> References: <1436856687-31550-1-git-send-email-drinkcat@chromium.org> Cc: Oder Chiou , alsa-devel@alsa-project.org, Takashi Iwai , Liam Girdwood , koro.chen@mediatek.com, Bard Liao Subject: [alsa-devel] [PATCH v2 2/3] ASoC: rt5645: Remove irq_jack_detection function 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 irq_jack_detection is only called from rt5645_jack_detect_work: remove the function to simplify the code. Signed-off-by: Nicolas Boichat --- sound/soc/codecs/rt5645.c | 53 ++++++++++++++++++++--------------------------- 1 file changed, 22 insertions(+), 31 deletions(-) diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 45651f4..ef6d3ad 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -2877,7 +2877,18 @@ static int rt5645_jack_detect(struct snd_soc_codec *codec, int jack_insert) return rt5645->jack_type; } -static int rt5645_irq_detection(struct rt5645_priv *rt5645); +static int rt5645_button_detect(struct snd_soc_codec *codec) +{ + int btn_type, val; + + val = snd_soc_read(codec, RT5650_4BTN_IL_CMD1); + pr_debug("val=0x%x\n", val); + btn_type = val & 0xfff0; + snd_soc_write(codec, RT5650_4BTN_IL_CMD1, val); + + return btn_type; +} + static irqreturn_t rt5645_irq(int irq, void *data); int rt5645_set_jack_detect(struct snd_soc_codec *codec, @@ -2908,34 +2919,6 @@ static void rt5645_jack_detect_work(struct work_struct *work) { struct rt5645_priv *rt5645 = container_of(work, struct rt5645_priv, jack_detect_work.work); - - rt5645_irq_detection(rt5645); -} - -static irqreturn_t rt5645_irq(int irq, void *data) -{ - struct rt5645_priv *rt5645 = data; - - queue_delayed_work(system_power_efficient_wq, - &rt5645->jack_detect_work, msecs_to_jiffies(250)); - - return IRQ_HANDLED; -} - -static int rt5645_button_detect(struct snd_soc_codec *codec) -{ - int btn_type, val; - - val = snd_soc_read(codec, RT5650_4BTN_IL_CMD1); - pr_debug("val=0x%x\n", val); - btn_type = val & 0xfff0; - snd_soc_write(codec, RT5650_4BTN_IL_CMD1, val); - - return btn_type; -} - -static int rt5645_irq_detection(struct rt5645_priv *rt5645) -{ int val, btn_type, gpio_state = 0, report = 0; switch (rt5645->pdata.jd_mode) { @@ -2950,7 +2933,7 @@ static int rt5645_irq_detection(struct rt5645_priv *rt5645) report, SND_JACK_HEADPHONE); snd_soc_jack_report(rt5645->mic_jack, report, SND_JACK_MICROPHONE); - return report; + return; case 1: /* 2 port */ val = snd_soc_read(rt5645->codec, RT5645_A_JD_CTRL1) & 0x0070; break; @@ -3032,8 +3015,16 @@ static int rt5645_irq_detection(struct rt5645_priv *rt5645) snd_soc_jack_report(rt5645->btn_jack, report, SND_JACK_BTN_0 | SND_JACK_BTN_1 | SND_JACK_BTN_2 | SND_JACK_BTN_3); +} - return report; +static irqreturn_t rt5645_irq(int irq, void *data) +{ + struct rt5645_priv *rt5645 = data; + + queue_delayed_work(system_power_efficient_wq, + &rt5645->jack_detect_work, msecs_to_jiffies(250)); + + return IRQ_HANDLED; } static int rt5645_probe(struct snd_soc_codec *codec)