Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2658653ybi; Mon, 17 Jun 2019 08:26:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqzY2UsVq1PlSw89IhL1gda1UCDAPVkXytCd5n4KJHqtW95PsTVdcenE1gnzInrtj95WUfCG X-Received: by 2002:aa7:8acb:: with SMTP id b11mr113354560pfd.115.1560785198218; Mon, 17 Jun 2019 08:26:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560785198; cv=none; d=google.com; s=arc-20160816; b=vwGU2iREA+vFv4qnSOs0S5wMgPTySrm346/eBfynwuIseLXoVXeEp3Z6PKjDHq9NsA g/WaLdCXC2Az7ubnsibIyJx/vSHNTWvmJJy1TcHQmwHp9DnvSiPbdSdzEBHw/GxggJnF mVSq0zgVMlI3oPzSvCcqSXdhu7fdGiFf5cUzBvVoJrtbVwr3vfVnDkVfn/nh8l9menTx oU5H7g4Q19H1zXH7vmkae449WCvYQZKxdCoO4Owa9QXdWKER3k1vWcF2v1A4BlTgqg/o 2IGAbrBOBijGk6/8QOjhsHIU3+5P1kLSvNLUnJOdwT8svB08DdEf+2bd6045ZWHH74qM f0rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:in-reply-to:subject:cc:to :from:dkim-signature; bh=raY7wlnyL/ndWX8s0KxBrAuiPq6/4/l+l9FrWIucjGg=; b=Aqg3GGdYiBM5UHikjMt8K9bOjEYV4A2zTWWwnhN7ow39z47vrQeYxrMBilGAiIqm/8 2Pstiofr+/5LUoyD2CIJ69lkbVHgoLh3Y9utVob+rFfGZ2fWQnJptcPklvGZnQX3hmYA m7uZZSnx5Mga0ECZqDFYlM0P3XnOCTk8I72L5mzxxcQ13/bqe6X81SsIqcVbpbEr+ddX G01qKUZA/XM1zlAmhrC6BnViUXr41wzwD4Wv6p0Ad4VJMUpbrMnjht46GqSHYjAuGgsB Ix+OpEw/r9cX6zbKEWurYVHYIIpVacHZ4hChKwd0MXnipGQgzannKPNVfZx+htgqUFo/ 1eTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=uqnnSah2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i17si11155557pgh.372.2019.06.17.08.26.22; Mon, 17 Jun 2019 08:26:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=uqnnSah2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728562AbfFQPYa (ORCPT + 99 others); Mon, 17 Jun 2019 11:24:30 -0400 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:51330 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728538AbfFQPY1 (ORCPT ); Mon, 17 Jun 2019 11:24:27 -0400 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=raY7wlnyL/ndWX8s0KxBrAuiPq6/4/l+l9FrWIucjGg=; b=uqnnSah2RXx5 +ZWI474rin4RPyI2ZmiZq7++i/By5ahAwlrd7FLrt+mufgzZKyoM/CZTUqhQnBI/ApFP9u4pJe6PH Phc+w/Ij9oq9Mrn8GjeqSwIDwvj1VrsAgCNxhe2fuGICD/IN/ojld+d6sNbjPlddE7PepHYzHQV/P uhDn0=; Received: from [2001:470:1f1d:6b5:7e7a:91ff:fede:4a45] (helo=finisterre.sirena.org.uk) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hctUX-0001ws-IS; Mon, 17 Jun 2019 15:24:17 +0000 Received: by finisterre.sirena.org.uk (Postfix, from userid 1000) id 01C03440049; Mon, 17 Jun 2019 16:24:16 +0100 (BST) From: Mark Brown To: Fletcher Woodruff Cc: alsa-devel@alsa-project.org, Curtis Malainey , Jaroslav Kysela , Liam Girdwood , linux-kernel@vger.kernel.org, Mark Brown , Oder Chiou , Ross Zwisler , Takashi Iwai Subject: Applied "ASoC: rt5677: fall back to DT prop names on error" to the asoc tree In-Reply-To: <20190614194854.208436-2-fletcherw@chromium.org> X-Patchwork-Hint: ignore Message-Id: <20190617152417.01C03440049@finisterre.sirena.org.uk> Date: Mon, 17 Jun 2019 16:24:16 +0100 (BST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch ASoC: rt5677: fall back to DT prop names on error has been applied to the asoc tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.3 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 8893cba2fa6994ac8434cbc616eeddcde211ec45 Mon Sep 17 00:00:00 2001 From: Fletcher Woodruff Date: Fri, 14 Jun 2019 13:48:51 -0600 Subject: [PATCH] ASoC: rt5677: fall back to DT prop names on error The rt5677 driver uses ACPI-style property names to read from the device API. However, these do not match the property names in _DSD used on the Chromebook Pixel 2015, which are closer to the Device Tree style. Unify the two functions for reading from the device API so that they try ACPI-style names first and fall back to the DT names on error. With this patch, plugging and unplugging the headphone jack switches between headphones and speakers automatically. Signed-off-by: Fletcher Woodruff Signed-off-by: Mark Brown --- sound/soc/codecs/rt5677.c | 74 +++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c index c49b5c218666..fe000f30b9ad 100644 --- a/sound/soc/codecs/rt5677.c +++ b/sound/soc/codecs/rt5677.c @@ -5020,48 +5020,50 @@ static const struct acpi_device_id rt5677_acpi_match[] = { }; MODULE_DEVICE_TABLE(acpi, rt5677_acpi_match); -static void rt5677_read_acpi_properties(struct rt5677_priv *rt5677, +static void rt5677_read_device_properties(struct rt5677_priv *rt5677, struct device *dev) { u32 val; - if (!device_property_read_u32(dev, "DCLK", &val)) - rt5677->pdata.dmic2_clk_pin = val; + rt5677->pdata.in1_diff = + device_property_read_bool(dev, "IN1") || + device_property_read_bool(dev, "realtek,in1-differential"); - rt5677->pdata.in1_diff = device_property_read_bool(dev, "IN1"); - rt5677->pdata.in2_diff = device_property_read_bool(dev, "IN2"); - rt5677->pdata.lout1_diff = device_property_read_bool(dev, "OUT1"); - rt5677->pdata.lout2_diff = device_property_read_bool(dev, "OUT2"); - rt5677->pdata.lout3_diff = device_property_read_bool(dev, "OUT3"); + rt5677->pdata.in2_diff = + device_property_read_bool(dev, "IN2") || + device_property_read_bool(dev, "realtek,in2-differential"); - device_property_read_u32(dev, "JD1", &rt5677->pdata.jd1_gpio); - device_property_read_u32(dev, "JD2", &rt5677->pdata.jd2_gpio); - device_property_read_u32(dev, "JD3", &rt5677->pdata.jd3_gpio); -} + rt5677->pdata.lout1_diff = + device_property_read_bool(dev, "OUT1") || + device_property_read_bool(dev, "realtek,lout1-differential"); -static void rt5677_read_device_properties(struct rt5677_priv *rt5677, - struct device *dev) -{ - rt5677->pdata.in1_diff = device_property_read_bool(dev, - "realtek,in1-differential"); - rt5677->pdata.in2_diff = device_property_read_bool(dev, - "realtek,in2-differential"); - rt5677->pdata.lout1_diff = device_property_read_bool(dev, - "realtek,lout1-differential"); - rt5677->pdata.lout2_diff = device_property_read_bool(dev, - "realtek,lout2-differential"); - rt5677->pdata.lout3_diff = device_property_read_bool(dev, - "realtek,lout3-differential"); + rt5677->pdata.lout2_diff = + device_property_read_bool(dev, "OUT2") || + device_property_read_bool(dev, "realtek,lout2-differential"); + + rt5677->pdata.lout3_diff = + device_property_read_bool(dev, "OUT3") || + device_property_read_bool(dev, "realtek,lout3-differential"); device_property_read_u8_array(dev, "realtek,gpio-config", - rt5677->pdata.gpio_config, RT5677_GPIO_NUM); - - device_property_read_u32(dev, "realtek,jd1-gpio", - &rt5677->pdata.jd1_gpio); - device_property_read_u32(dev, "realtek,jd2-gpio", - &rt5677->pdata.jd2_gpio); - device_property_read_u32(dev, "realtek,jd3-gpio", - &rt5677->pdata.jd3_gpio); + rt5677->pdata.gpio_config, + RT5677_GPIO_NUM); + + if (!device_property_read_u32(dev, "DCLK", &val) || + !device_property_read_u32(dev, "realtek,dmic2_clk_pin", &val)) + rt5677->pdata.dmic2_clk_pin = val; + + if (!device_property_read_u32(dev, "JD1", &val) || + !device_property_read_u32(dev, "realtek,jd1-gpio", &val)) + rt5677->pdata.jd1_gpio = val; + + if (!device_property_read_u32(dev, "JD2", &val) || + !device_property_read_u32(dev, "realtek,jd2-gpio", &val)) + rt5677->pdata.jd2_gpio = val; + + if (!device_property_read_u32(dev, "JD3", &val) || + !device_property_read_u32(dev, "realtek,jd3-gpio", &val)) + rt5677->pdata.jd3_gpio = val; } static struct regmap_irq rt5677_irqs[] = { @@ -5144,20 +5146,18 @@ static int rt5677_i2c_probe(struct i2c_client *i2c) match_id = of_match_device(rt5677_of_match, &i2c->dev); if (match_id) rt5677->type = (enum rt5677_type)match_id->data; - - rt5677_read_device_properties(rt5677, &i2c->dev); } else if (ACPI_HANDLE(&i2c->dev)) { const struct acpi_device_id *acpi_id; acpi_id = acpi_match_device(rt5677_acpi_match, &i2c->dev); if (acpi_id) rt5677->type = (enum rt5677_type)acpi_id->driver_data; - - rt5677_read_acpi_properties(rt5677, &i2c->dev); } else { return -EINVAL; } + rt5677_read_device_properties(rt5677, &i2c->dev); + /* pow-ldo2 and reset are optional. The codec pins may be statically * connected on the board without gpios. If the gpio device property * isn't specified, devm_gpiod_get_optional returns NULL. -- 2.20.1