From patchwork Thu Mar 1 18:06:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 130363 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp3113075edc; Thu, 1 Mar 2018 10:07:53 -0800 (PST) X-Google-Smtp-Source: AG47ELtHYB2ASe1dVKMb8mKdmwIz+UIBRwwXbg3VjB4MCtbGLxJGe7qlNqAPjo6tXzu1B1lxHoJS X-Received: by 10.223.181.152 with SMTP id c24mr2827371wre.233.1519927673369; Thu, 01 Mar 2018 10:07:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519927673; cv=none; d=google.com; s=arc-20160816; b=Y/KvmWMLqjdTzrRBYj3uxw9m5sji8811kCPX6r6vqZh+ZLEeRwMHS6RduoW5pjat5h KqBivUZ9TcPVGIMfn91MUjijTt93bAXxII/Bf9JS+4LhwUVBepJNGZsxr7cIyi0sbo+K NDKYHv30bCB5XCC4TM5fdBEM04rP/9k0N0gGPxJUYe0Cj1sIvU91Lj8DJuIlxncXXO4E mbTpr4RoNiQZr+SNTB7YH9cji7JVBCIR6c1V/iT94ejIc7JUES0XIbe6vb3/EGDsY038 /AiP3OfX3PYIWK30az7pRu7P8dhERbClok+XFpbJ6QkHYAqyOjhU4f7R9rwVBy/xeZBT m+DA== 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=dW0dzpWgQZE1tMryRBJjZmkxgfC/WeJvqYXHfH/d4hY=; b=WvY5d3oU8/D44ginnZbyifV/a3Ihkn6xmZmaY5qoeeFMPgK7Y78pWwOMDJjuISiqE9 y4nFiFtUyGHRQ/j0VnR4SYe5/xrI+/5GjUWHWvUrDw8zjsV5uCIImOBVJj95ZVZlVJ5i PJyzzkmRwbmKQDkM4Zt+SHeqFj+7yp5l1XbpNr7vgx79i58hAEeRyFG8vwcQx+FYvCFu txKPGmrEsuofLn9pkkn9HOLyiPzwwfP5WM09Vtxwok9VOBvbXNpSNjVU5p3kAuypvm2u ABgNq3rmo7OdNvROxGG9hLOGVy9KntCXT82BdEGDuG3pdor4CSZXmtZGoTgQd2YzgqQs YvXw== 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=ZKHpp3aI; 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 v21si3278475wrv.451.2018.03.01.10.07.53; Thu, 01 Mar 2018 10:07:53 -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=ZKHpp3aI; 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 BA72D267B4E; Thu, 1 Mar 2018 19:07:09 +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 8D3FA267B44; Thu, 1 Mar 2018 19:07:07 +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.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, SPF_PASS, T_RP_MATCHES_RCVD 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 BE3A6267B33 for ; Thu, 1 Mar 2018 19:07:04 +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=mER9FRf4nXu7EtcTUbtNIrpb0q14tkirwd4TUeivubU=; b=ZKHpp3aI+PYd znj2kw1vUpFQ6+Zbz3DADkZJ1L5YMnIqqOWV/sLHsRYtH0SUpO/r5PnNQ6lKWMEYPyQLvggdEeT4/ qQ/99oxQBrHKSu/+6PIq0YnXkPobmyXPIrXU+f+A3vLzaJd6vGGHQxW+3dQyz7m2DNGZvmmxEjwPg bWY7c=; 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 1erSbW-0005WW-5q; Thu, 01 Mar 2018 18:06:54 +0000 Received: from broonie by debutante with local (Exim 4.90_1) (envelope-from ) id 1erSbV-0005rA-NO; Thu, 01 Mar 2018 18:06:53 +0000 From: Mark Brown To: Hans de Goede In-Reply-To: <20180225104713.4745-4-hdegoede@redhat.com> Message-Id: Date: Thu, 01 Mar 2018 18:06:53 +0000 Cc: Oder Chiou , alsa-devel@alsa-project.org, Pierre-Louis Bossart , Takashi Iwai , Mark Brown , Carlo Caione , Bard Liao Subject: [alsa-devel] Applied "ASoC: rt5651: Move 2 functions higher up in rt5651.c" 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: rt5651: Move 2 functions higher up in rt5651.c 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 d8b8c878e86593ad8bd86676a2a4c2be58a8b889 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 25 Feb 2018 11:46:44 +0100 Subject: [PATCH] ASoC: rt5651: Move 2 functions higher up in rt5651.c Move 2 functions higher up in rt5651.c, this is a preparation patch to avoid needing forward declarations when moving over from a codec private function to the standard snd_soc_component_set_jack(). This commit purely moves these 2 functions up, not a single line is changed. Signed-off-by: Hans de Goede Signed-off-by: Mark Brown --- sound/soc/codecs/rt5651.c | 154 +++++++++++++++++++++++----------------------- 1 file changed, 77 insertions(+), 77 deletions(-) -- 2.16.2 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/sound/soc/codecs/rt5651.c b/sound/soc/codecs/rt5651.c index 390cab134ba0..c9698229fc33 100644 --- a/sound/soc/codecs/rt5651.c +++ b/sound/soc/codecs/rt5651.c @@ -1583,6 +1583,83 @@ static int rt5651_set_bias_level(struct snd_soc_component *component, return 0; } +static irqreturn_t rt5651_irq(int irq, void *data) +{ + struct rt5651_priv *rt5651 = data; + + queue_delayed_work(system_power_efficient_wq, + &rt5651->jack_detect_work, msecs_to_jiffies(250)); + + return IRQ_HANDLED; +} + +int rt5651_set_jack_detect(struct snd_soc_component *component, + struct snd_soc_jack *hp_jack) +{ + struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); + struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component); + int ret; + + if (!rt5651->irq) + return -EINVAL; + + /* IRQ output on GPIO1 */ + snd_soc_component_update_bits(component, RT5651_GPIO_CTRL1, + RT5651_GP1_PIN_MASK, RT5651_GP1_PIN_IRQ); + + /* Select jack detect source */ + switch (rt5651->jd_src) { + case RT5651_JD1_1: + snd_soc_component_update_bits(component, RT5651_JD_CTRL2, + RT5651_JD_TRG_SEL_MASK, RT5651_JD_TRG_SEL_JD1_1); + snd_soc_component_update_bits(component, RT5651_IRQ_CTRL1, + RT5651_JD1_1_IRQ_EN, RT5651_JD1_1_IRQ_EN); + break; + case RT5651_JD1_2: + snd_soc_component_update_bits(component, RT5651_JD_CTRL2, + RT5651_JD_TRG_SEL_MASK, RT5651_JD_TRG_SEL_JD1_2); + snd_soc_component_update_bits(component, RT5651_IRQ_CTRL1, + RT5651_JD1_2_IRQ_EN, RT5651_JD1_2_IRQ_EN); + break; + case RT5651_JD2: + snd_soc_component_update_bits(component, RT5651_JD_CTRL2, + RT5651_JD_TRG_SEL_MASK, RT5651_JD_TRG_SEL_JD2); + snd_soc_component_update_bits(component, RT5651_IRQ_CTRL1, + RT5651_JD2_IRQ_EN, RT5651_JD2_IRQ_EN); + break; + case RT5651_JD_NULL: + return 0; + default: + dev_err(component->dev, "Currently only JD1_1 / JD1_2 / JD2 are supported\n"); + return -EINVAL; + } + + snd_soc_dapm_force_enable_pin(dapm, "JD Power"); + snd_soc_dapm_force_enable_pin(dapm, "LDO"); + snd_soc_dapm_sync(dapm); + + snd_soc_component_update_bits(component, RT5651_MICBIAS, 0x38, 0x38); + + rt5651->hp_jack = hp_jack; + + ret = devm_request_threaded_irq(component->dev, rt5651->irq, NULL, + rt5651_irq, + IRQF_TRIGGER_RISING | + IRQF_TRIGGER_FALLING | + IRQF_ONESHOT, "rt5651", rt5651); + if (ret) { + dev_err(component->dev, "Failed to reguest IRQ: %d\n", ret); + return ret; + } + + /* sync initial jack state */ + queue_delayed_work(system_power_efficient_wq, + &rt5651->jack_detect_work, 0); + + return 0; +} +EXPORT_SYMBOL_GPL(rt5651_set_jack_detect); + static int rt5651_probe(struct snd_soc_component *component) { struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component); @@ -1752,16 +1829,6 @@ static const struct dmi_system_id rt5651_quirk_table[] = { {} }; -static irqreturn_t rt5651_irq(int irq, void *data) -{ - struct rt5651_priv *rt5651 = data; - - queue_delayed_work(system_power_efficient_wq, - &rt5651->jack_detect_work, msecs_to_jiffies(250)); - - return IRQ_HANDLED; -} - static int rt5651_jack_detect(struct snd_soc_component *component, int jack_insert) { struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); @@ -1827,73 +1894,6 @@ static void rt5651_jack_detect_work(struct work_struct *work) snd_soc_jack_report(rt5651->hp_jack, report, SND_JACK_HEADSET); } -int rt5651_set_jack_detect(struct snd_soc_component *component, - struct snd_soc_jack *hp_jack) -{ - struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); - struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component); - int ret; - - if (!rt5651->irq) - return -EINVAL; - - /* IRQ output on GPIO1 */ - snd_soc_component_update_bits(component, RT5651_GPIO_CTRL1, - RT5651_GP1_PIN_MASK, RT5651_GP1_PIN_IRQ); - - /* Select jack detect source */ - switch (rt5651->jd_src) { - case RT5651_JD1_1: - snd_soc_component_update_bits(component, RT5651_JD_CTRL2, - RT5651_JD_TRG_SEL_MASK, RT5651_JD_TRG_SEL_JD1_1); - snd_soc_component_update_bits(component, RT5651_IRQ_CTRL1, - RT5651_JD1_1_IRQ_EN, RT5651_JD1_1_IRQ_EN); - break; - case RT5651_JD1_2: - snd_soc_component_update_bits(component, RT5651_JD_CTRL2, - RT5651_JD_TRG_SEL_MASK, RT5651_JD_TRG_SEL_JD1_2); - snd_soc_component_update_bits(component, RT5651_IRQ_CTRL1, - RT5651_JD1_2_IRQ_EN, RT5651_JD1_2_IRQ_EN); - break; - case RT5651_JD2: - snd_soc_component_update_bits(component, RT5651_JD_CTRL2, - RT5651_JD_TRG_SEL_MASK, RT5651_JD_TRG_SEL_JD2); - snd_soc_component_update_bits(component, RT5651_IRQ_CTRL1, - RT5651_JD2_IRQ_EN, RT5651_JD2_IRQ_EN); - break; - case RT5651_JD_NULL: - return 0; - default: - dev_err(component->dev, "Currently only JD1_1 / JD1_2 / JD2 are supported\n"); - return -EINVAL; - } - - snd_soc_dapm_force_enable_pin(dapm, "JD Power"); - snd_soc_dapm_force_enable_pin(dapm, "LDO"); - snd_soc_dapm_sync(dapm); - - snd_soc_component_update_bits(component, RT5651_MICBIAS, 0x38, 0x38); - - rt5651->hp_jack = hp_jack; - - ret = devm_request_threaded_irq(component->dev, rt5651->irq, NULL, - rt5651_irq, - IRQF_TRIGGER_RISING | - IRQF_TRIGGER_FALLING | - IRQF_ONESHOT, "rt5651", rt5651); - if (ret) { - dev_err(component->dev, "Failed to reguest IRQ: %d\n", ret); - return ret; - } - - /* sync initial jack state */ - queue_delayed_work(system_power_efficient_wq, - &rt5651->jack_detect_work, 0); - - return 0; -} -EXPORT_SYMBOL_GPL(rt5651_set_jack_detect); - static int rt5651_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id) {