From patchwork Fri Nov 10 21:29:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 118603 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp8430012qgn; Fri, 10 Nov 2017 13:30:24 -0800 (PST) X-Google-Smtp-Source: AGs4zMZrpbHxSFekrFX1gKwzJ9Vth7JwnwJBPtE98lZ76imXGIT+lVVVSroERPaehf+llYiDqlPq X-Received: by 10.223.133.242 with SMTP id 47mr1481312wru.170.1510349424678; Fri, 10 Nov 2017 13:30:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510349424; cv=none; d=google.com; s=arc-20160816; b=NfNi8hhPfmi1M1NBc6/4oblxDHZ8lbKULJzd+JPZcOEYQJwznbBqbdceFpnpg0v3wG 9hJ3BqcBs/is3y+7eMTVK3MkMdtmVzbQCHYoVFFORmLpePnzqb1OjFcrcQcQXebIWdoP xcTGjRLjtt4caZMBfUSZWQzV0muy/eq+PMwxOlLPtuF1RF5dHPOlRkp2+vBd5H+45Gd/ TeqJhWoKD9kVdiJ8tCXFF+XcVgC8w/z8ffIvaPWehEScmp9FnlQUhJFOgHCTDIOy/aO+ JnJRgtuWYo0ZlGM71S9PNEbWm4cA130MvZrjX68EYjT/LzSW+DiSgUPs8RgZmEF2MGXp Lmew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:date:message-id:in-reply-to:to:from :dkim-signature:delivered-to:arc-authentication-results; bh=dB7bbGXoHLiFg8gNprPpbH6JTkLbVEpGA1EFY3euwDM=; b=0EkRnUYCoUpYW/+A4Im2P9+M09Kp2XDj2JyR1k3SiRgyjgK83xItEfg9/Nbqw/v6Qv w0WkM+9kSWBGm3/G7QNA7pI1L5Cb8k1jA7GzCK3kW2a9bqVWdOuZfdR5obq27OebLCZG zoBZo8Q2TG3B3tEvIIK0W9G0D6FH3eSmYmbkOjDcvd/Z/89vWrNh2uduUksFKPmYGLUS DukGsT8+pIdTVyJJFP4B5BGlj3icw7LyJVqXCbo0CdOKNUYo+2nWg+nke29uGUKOJPMG PkObijL7CMwXQOW++KlG6nJyB2GQlYzhx5GBKfMfVXnqewMdaPVudBMdHilc5NsTQb9r ftRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=bxbIEgy6; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTP id u18si9450546wrc.235.2017.11.10.13.30.24; Fri, 10 Nov 2017 13:30:24 -0800 (PST) Received-SPF: pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) client-ip=77.48.224.243; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=bxbIEgy6; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id B833A2679E4; Fri, 10 Nov 2017 22:30:07 +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 6A836267A07; Fri, 10 Nov 2017 22:30:05 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, SPF_PASS autolearn=disabled version=3.4.0 Received: from heliosphere.sirena.org.uk (heliosphere.sirena.org.uk [172.104.155.198]) by alsa0.perex.cz (Postfix) with ESMTP id 3D5462679E2 for ; Fri, 10 Nov 2017 22:29:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=R8u+jDEUZe8YEk7+wpd9Ed5BwunVPoJ0EhngpdIjPUI=; b=bxbIEgy6GMh1 10uXr7bAbXlMNh+TzPdGmjxzwBuk0lic/rQtv5kYcZjBEvnWPshQ4Iq+3IBJpv+FO1iI++KiG2BYC XLDXOS8287IfzamMbO+NkfwB1OqBJTd1fT7c12u7eUkqTE+OUMDry/MCUKKeQSIzR/jPJ8ZxEPclp 937BU=; Received: from debutante.sirena.org.uk ([2001:470:1f1d:6b5::3] helo=debutante) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1eDGru-000768-M2; Fri, 10 Nov 2017 21:29:42 +0000 Received: from broonie by debutante with local (Exim 4.89) (envelope-from ) id 1eDGru-0004YE-1N; Fri, 10 Nov 2017 21:29:42 +0000 From: Mark Brown To: oder_chiou@realtek.com In-Reply-To: <1510291004-10244-1-git-send-email-oder_chiou@realtek.com> Message-Id: Date: Fri, 10 Nov 2017 21:29:42 +0000 Cc: Oder Chiou , jack.yu@realtek.com, alsa-devel@alsa-project.org, lgirdwood@gmail.com, albertchen@realtek.com, broonie@kernel.org, shumingf@realtek.com, bardliao@realtek.com, flove@realtek.com, cychiang@chromium.org Subject: [alsa-devel] Applied "ASoC: rt5663: Check the JD status in the button pushing" to the asoc tree 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 The patch ASoC: rt5663: Check the JD status in the button pushing has been applied to the asoc tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark >From de6ae8afb9c098a874c3e81e3cc63938cc9f5bbc Mon Sep 17 00:00:00 2001 From: "oder_chiou@realtek.com" Date: Fri, 10 Nov 2017 13:16:44 +0800 Subject: [PATCH] ASoC: rt5663: Check the JD status in the button pushing Check the JD status in the button pushing to prevent the IRQ that is locked by button pushing event while the jack unpluging. Signed-off-by: Oder Chiou Signed-off-by: Mark Brown --- sound/soc/codecs/rt5663.c | 43 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) -- 2.15.0 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/sound/soc/codecs/rt5663.c b/sound/soc/codecs/rt5663.c index eb3065a992ab..d7b163a9769c 100644 --- a/sound/soc/codecs/rt5663.c +++ b/sound/soc/codecs/rt5663.c @@ -52,7 +52,7 @@ struct rt5663_priv { struct snd_soc_codec *codec; struct rt5663_platform_data pdata; struct regmap *regmap; - struct delayed_work jack_detect_work; + struct delayed_work jack_detect_work, jd_unplug_work; struct snd_soc_jack *hs_jack; struct timer_list btn_check_timer; struct impedance_mapping_table *imp_table; @@ -1940,8 +1940,15 @@ static void rt5663_jack_detect_work(struct work_struct *work) break; } /* button release or spurious interrput*/ - if (btn_type == 0) + if (btn_type == 0) { report = rt5663->jack_type; + cancel_delayed_work_sync( + &rt5663->jd_unplug_work); + } else { + queue_delayed_work(system_wq, + &rt5663->jd_unplug_work, + msecs_to_jiffies(500)); + } } } else { /* jack out */ @@ -1962,6 +1969,37 @@ static void rt5663_jack_detect_work(struct work_struct *work) SND_JACK_BTN_2 | SND_JACK_BTN_3); } +static void rt5663_jd_unplug_work(struct work_struct *work) +{ + struct rt5663_priv *rt5663 = + container_of(work, struct rt5663_priv, jd_unplug_work.work); + struct snd_soc_codec *codec = rt5663->codec; + + if (!codec) + return; + + if (!rt5663_check_jd_status(codec)) { + /* jack out */ + switch (rt5663->codec_ver) { + case CODEC_VER_1: + rt5663_v2_jack_detect(rt5663->codec, 0); + break; + case CODEC_VER_0: + rt5663_jack_detect(rt5663->codec, 0); + break; + default: + dev_err(codec->dev, "Unknown CODEC Version\n"); + } + + snd_soc_jack_report(rt5663->hs_jack, 0, SND_JACK_HEADSET | + SND_JACK_BTN_0 | SND_JACK_BTN_1 | + SND_JACK_BTN_2 | SND_JACK_BTN_3); + } else { + queue_delayed_work(system_wq, &rt5663->jd_unplug_work, + msecs_to_jiffies(500)); + } +} + static const struct snd_kcontrol_new rt5663_snd_controls[] = { /* DAC Digital Volume */ SOC_DOUBLE_TLV("DAC Playback Volume", RT5663_STO1_DAC_DIG_VOL, @@ -3556,6 +3594,7 @@ static int rt5663_i2c_probe(struct i2c_client *i2c, } INIT_DELAYED_WORK(&rt5663->jack_detect_work, rt5663_jack_detect_work); + INIT_DELAYED_WORK(&rt5663->jd_unplug_work, rt5663_jd_unplug_work); if (i2c->irq) { ret = request_irq(i2c->irq, rt5663_irq,