From patchwork Wed Mar 7 14:14:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 130902 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp5233340lja; Wed, 7 Mar 2018 06:15:00 -0800 (PST) X-Google-Smtp-Source: AG47ELsjfhoHQtV+czDQR2qkLI99L6+f4H0ihilGKyZEgkKBkHa6jU/sa95+fJiDQHGHQ1eDzPNS X-Received: by 10.28.193.134 with SMTP id r128mr14061416wmf.85.1520432099944; Wed, 07 Mar 2018 06:14:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520432099; cv=none; d=google.com; s=arc-20160816; b=BXGvUpWKg4vcqHV/1yfYkEIH6cu2SSS7nmkvUvmSAQEVwUYlxJdETYrJ3Lt038nv9e 0+gUGHeogdKurnoiG+FZdPZtnyxG36hSpXtS2kjgiGQt/Uz9KlSxvz22Dvrk6a2cNbIV sQL/6Q9ouRxvGXmy+mHyGoI3ggll2hTVD7KVGoo4nh0oML3PdXyhRkPabDtWNW1gV2tJ SUBaCxjXNSLLBxUFWd7TZnsvLOjf3ZV1L9QVLfF877UK9dW7Pv+NOvDc//SVG45ZNaFI ZHkYQnd7pttrCVFJrIZ6ZZzl9rR97KtQA7K77QAx21PEILE9xMCvIxUnSUxhNE1z5In6 tP3A== 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=hBa9HXsE2byDJ0lEPoLulgtjrIrAHj6feZeYkTkWaE8=; b=yFrhyYkszbJ7F1HkFym1mB9sLCi0fEg1KzU0gjq8djpdqeI8ko+zIu80Gvsi1tUXFX 9J54X0CM0xUXdXQ5vIrI0w0i9dKo0xq82tQh7Ob1EiFh6Rl5r+Y3FoIldYErpcpl8ycN iLNM13hNSYQ/PVKH8SV0VjfiVxSarcV3LFqa+5xtfGYNVEkbVZ74+G00xHLeaW37M7Ai PL8PajBSZD6g11pEGxEA5Ooo9+Y+OVgqPLuya+GJ60ryWkYppuxSjKJvFu0EzS6nhU5I hc9b5WcHwtCqwHz1+HE4DeGu48wCFtjY1XwfqXNidpclqanzzpO5GJ5oRrGLdOZpSu/y eYUA== 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=nQlIM2w8; 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 80si1059386wmi.234.2018.03.07.06.14.59; Wed, 07 Mar 2018 06:14:59 -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=nQlIM2w8; 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 C7D3F267381; Wed, 7 Mar 2018 15:14:58 +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 1F60A267381; Wed, 7 Mar 2018 15:14:56 +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 5C61B267048 for ; Wed, 7 Mar 2018 15:14:54 +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=o1DaNW+h6uXY/pwvozbfcKVSXeoPqTSRy95XbBTNRuQ=; b=nQlIM2w8Epda 1hrlMk4xrGnAmxD3mzlUsl+GIPXefQlX/s/FVz9QMi41MEJA2nzGGTFHhyGiDy0Ujpkd0Hx6FQL9G pHA5tjHlsjdbYlIcPEoDJ0TpdFP8CCpNZv7PDRuIoeE31ITxZuTWKGHsjKo/xl4ZdptD6f35n1fYA quRug=; 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 1etZqA-0000BI-Fm; Wed, 07 Mar 2018 14:14:46 +0000 Received: from broonie by debutante with local (Exim 4.90_1) (envelope-from ) id 1etZqA-0001Tl-1b; Wed, 07 Mar 2018 14:14:46 +0000 From: Mark Brown To: Hans de Goede In-Reply-To: <20180304143610.21125-4-hdegoede@redhat.com> Message-Id: Date: Wed, 07 Mar 2018 14:14:46 +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: Configure jack-detect source 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: Configure jack-detect source 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 f0c2a330d99ef81519dc809d8b6a7dafe39b0933 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 4 Mar 2018 15:35:51 +0100 Subject: [PATCH] ASoC: rt5651: Configure jack-detect source through a device-property Configure the jack-detect source through a device-property which can be set by code outside of the codec driver. Rather then putting platform specific DMI quirks inside the generic codec driver. Signed-off-by: Hans de Goede Signed-off-by: Mark Brown --- include/sound/rt5651.h | 4 ++++ sound/soc/codecs/rt5651.c | 33 +++++++-------------------------- 2 files changed, 11 insertions(+), 26 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/include/sound/rt5651.h b/include/sound/rt5651.h index 1612462bf5ad..725b36c329d0 100644 --- a/include/sound/rt5651.h +++ b/include/sound/rt5651.h @@ -11,6 +11,10 @@ #ifndef __LINUX_SND_RT5651_H #define __LINUX_SND_RT5651_H +/* + * Note these MUST match the values from the DT binding: + * Documentation/devicetree/bindings/sound/rt5651.txt + */ enum rt5651_jd_src { RT5651_JD_NULL, RT5651_JD1_1, diff --git a/sound/soc/codecs/rt5651.c b/sound/soc/codecs/rt5651.c index 767a05e009df..50e1c501b6b9 100644 --- a/sound/soc/codecs/rt5651.c +++ b/sound/soc/codecs/rt5651.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -32,8 +31,6 @@ #include "rl6231.h" #include "rt5651.h" -#define RT5651_JD_MAP(quirk) ((quirk) & GENMASK(7, 0)) - #define RT5651_DEVICE_ID_VALUE 0x6281 #define RT5651_PR_RANGE_BASE (0xff + 1) @@ -41,8 +38,6 @@ #define RT5651_PR_BASE (RT5651_PR_RANGE_BASE + (0 * RT5651_PR_SPACING)) -static unsigned long rt5651_quirk; - static const struct regmap_range_cfg rt5651_ranges[] = { { .name = "PR", .range_min = RT5651_PR_BASE, .range_max = RT5651_PR_BASE + 0xb4, @@ -1675,6 +1670,9 @@ static int rt5651_set_jack(struct snd_soc_component *component, */ static void rt5651_apply_properties(struct snd_soc_component *component) { + struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component); + u32 val; + if (device_property_read_bool(component->dev, "realtek,in2-differential")) snd_soc_component_update_bits(component, RT5651_IN1_IN2, RT5651_IN_DF2, RT5651_IN_DF2); @@ -1682,6 +1680,10 @@ static void rt5651_apply_properties(struct snd_soc_component *component) if (device_property_read_bool(component->dev, "realtek,dmic-en")) snd_soc_component_update_bits(component, RT5651_GPIO_CTRL1, RT5651_GP2_PIN_MASK, RT5651_GP2_PIN_DMIC1_SCL); + + if (device_property_read_u32(component->dev, + "realtek,jack-detect-source", &val) == 0) + rt5651->jd_src = val; } static int rt5651_probe(struct snd_soc_component *component) @@ -1831,24 +1833,6 @@ static const struct i2c_device_id rt5651_i2c_id[] = { }; MODULE_DEVICE_TABLE(i2c, rt5651_i2c_id); -static int rt5651_quirk_cb(const struct dmi_system_id *id) -{ - rt5651_quirk = (unsigned long) id->driver_data; - return 1; -} - -static const struct dmi_system_id rt5651_quirk_table[] = { - { - .callback = rt5651_quirk_cb, - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "KIANO"), - DMI_MATCH(DMI_PRODUCT_NAME, "KIANO SlimNote 14.2"), - }, - .driver_data = (unsigned long *) RT5651_JD1_1, - }, - {} -}; - static int rt5651_jack_detect(struct snd_soc_component *component, int jack_insert) { int jack_type; @@ -1916,9 +1900,6 @@ static int rt5651_i2c_probe(struct i2c_client *i2c, i2c_set_clientdata(i2c, rt5651); - dmi_check_system(rt5651_quirk_table); - rt5651->jd_src = RT5651_JD_MAP(rt5651_quirk); - rt5651->regmap = devm_regmap_init_i2c(i2c, &rt5651_regmap); if (IS_ERR(rt5651->regmap)) { ret = PTR_ERR(rt5651->regmap);