From patchwork Wed Mar 7 14:14:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 130901 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp5233074lja; Wed, 7 Mar 2018 06:14:49 -0800 (PST) X-Google-Smtp-Source: AG47ELsO3B4mIAxTlhp75VQQ3SqjiWb8tBK8nmeqKriak2cfCmvG+EGYSD6TRE9NtVuFAjlNaFvf X-Received: by 10.28.40.214 with SMTP id o205mr13451952wmo.22.1520432089052; Wed, 07 Mar 2018 06:14:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520432089; cv=none; d=google.com; s=arc-20160816; b=qBWT29HOcRRxSXeIzBoUyD1G0fi1+LARQ1FFX7xvo9y3n872XoG4ilbwKUh2suozTh vO8kIJz2rGc2yV20zBj+ZflhF7dkgOw/MscsBeWfQOYCbAzwSZ3+kv6thZgcyuk8zvTg QkNvpROBFCdDPEKaGwrpl5wu9u6l8twnwZtQ2mVVHNt1iU8LQVYTgp4jbGF20M0FlEX0 7W2+Q2Ts+XFiLj3274vP4fiUCyTNCMX4tl74PMT4M4ZWQCQqFuxOz/AzOpndLCjZsk4t 83JgnBzjypKyTp9hBKP7ZnwE/rPe+AtzoMzA1buO4iLBU95sWtvCkJIwqGu4H8pYMJfw 8kSg== 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=5qzXCJLlgX22Md2rlyWh2csBRQjel3mDPqjWpdYJey8=; b=mgr3AaYB8NQbhd5l7mppf34Whs3/KXXiu2IuE24ipjnxu7wbPoMzY7t76tEhiN4kBs qxJKO6tZOc6R8A7OrMLG18i+JdqbcwB+v94FWm9YZzdLwQP7rtlMuaXLC2qaNJWqWNPg gUH6Fiz3o+vHigO1nOL+KEEP2vt1gx0RcBoIC/J3/nxohBF18lfcooIcRiP70T6rirsJ lwYWEe+wiZ3vIr5E5ZnaW/nJAz3lfyR7+SbM69tSOvpLaPkWEzqmH7IAtksK7GNN6QLh TpTBN/f7K7xAeAIq8b9pEon8EcG2YhfNk+HeCzVaF4sB4S6cJKmJnE17Sys+B2wVW8X7 ytJw== 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=xTkRqazv; 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 z78si4364438wrc.456.2018.03.07.06.14.48; Wed, 07 Mar 2018 06:14:49 -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=xTkRqazv; 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 465862673E1; Wed, 7 Mar 2018 15:14:37 +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 EE1EC2673D3; Wed, 7 Mar 2018 15:14:35 +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 08046267048 for ; Wed, 7 Mar 2018 15:14:32 +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=P8/icEeRVwahcE7l2+CaZxMFAVImUi9pUaeWoxsjkHY=; b=xTkRqazvSsVC okE8j9d/fzCyvStELsK78Fj2GgEM0u2HPndzSZU8lDCKolNzGxuoqTAeGRH5oLB3cVtSDGdjhNjrg j2O7e3HFg50UL+j0znOTAbg5taKz+8y4wrU+uzVWrFIGq5LdiDRcF6qkwbolrfZVNWYugCsFU7x5e Jtj2A=; 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 1etZpr-0000B8-Ej; Wed, 07 Mar 2018 14:14:27 +0000 Received: from broonie by debutante with local (Exim 4.90_1) (envelope-from ) id 1etZpr-0001SG-0E; Wed, 07 Mar 2018 14:14:27 +0000 From: Mark Brown To: Hans de Goede In-Reply-To: <20180304143610.21125-5-hdegoede@redhat.com> Message-Id: Date: Wed, 07 Mar 2018 14:14:27 +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: Allow specifying over-current threshold through a device-property" 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: Allow specifying over-current threshold through a device-property 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 583a9debd71e21a317b1fc7b293c22c49b33d9e4 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 4 Mar 2018 15:35:52 +0100 Subject: [PATCH] ASoC: rt5651: Allow specifying over-current threshold through a device-property OVer-Current-Detection (OVCD) for the micbias current is used to detect if an inserted jack is a headset or headphones (mic shorted to ground). Some boards may need different values for the OVCD current threshold because of a resistor on the board in serial with or parallel to the jack mic contact. This commit adds support for configuring the OCVD current threshold through the "realtek,over-current-threshold-microamp" device-property. Note this commit changes the default value from 600uA to 2000uA, because testing has shown 600uA to be a poor default. Signed-off-by: Hans de Goede Signed-off-by: Mark Brown --- sound/soc/codecs/rt5651.c | 22 +++++++++++++++++++++- sound/soc/codecs/rt5651.h | 1 + 2 files changed, 22 insertions(+), 1 deletion(-) -- 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 50e1c501b6b9..7ff1bc892cfd 100644 --- a/sound/soc/codecs/rt5651.c +++ b/sound/soc/codecs/rt5651.c @@ -1638,7 +1638,7 @@ static int rt5651_set_jack(struct snd_soc_component *component, RT5651_PWR_CLK12M_MASK | RT5651_PWR_MB_MASK, RT5651_MIC1_OVCD_EN | - RT5651_MIC1_OVTH_600UA | + rt5651->ovcd_th | RT5651_PWR_MB_PU | RT5651_PWR_CLK12M_PU); @@ -1684,6 +1684,26 @@ static void rt5651_apply_properties(struct snd_soc_component *component) if (device_property_read_u32(component->dev, "realtek,jack-detect-source", &val) == 0) rt5651->jd_src = val; + + rt5651->ovcd_th = RT5651_MIC1_OVTH_2000UA; + + if (device_property_read_u32(component->dev, + "realtek,over-current-threshold-microamp", &val) == 0) { + switch (val) { + case 600: + rt5651->ovcd_th = RT5651_MIC1_OVTH_600UA; + break; + case 1500: + rt5651->ovcd_th = RT5651_MIC1_OVTH_1500UA; + break; + case 2000: + rt5651->ovcd_th = RT5651_MIC1_OVTH_2000UA; + break; + default: + dev_warn(component->dev, "Warning: Invalid over-current-threshold-microamp value: %d, defaulting to 2000uA\n", + val); + } + } } static int rt5651_probe(struct snd_soc_component *component) diff --git a/sound/soc/codecs/rt5651.h b/sound/soc/codecs/rt5651.h index f3158488fc89..9cd5c279d0d6 100644 --- a/sound/soc/codecs/rt5651.h +++ b/sound/soc/codecs/rt5651.h @@ -2064,6 +2064,7 @@ struct rt5651_priv { struct snd_soc_jack *hp_jack; struct delayed_work jack_detect_work; enum rt5651_jd_src jd_src; + unsigned int ovcd_th; int irq; int sysclk;