From patchwork Mon Apr 1 20:55:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fletcher Woodruff X-Patchwork-Id: 10885067 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 821C8139A for ; Thu, 4 Apr 2019 07:06:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C59E28756 for ; Thu, 4 Apr 2019 07:06:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4DF82287A2; Thu, 4 Apr 2019 07:06:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 18F5E28740 for ; Thu, 4 Apr 2019 07:06:52 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id C3DD9163D; Thu, 4 Apr 2019 08:41:20 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C3DD9163D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1554360130; bh=R7v10Aqjx/CCjwvYAswXE2F+y+ml1PalXPyK1TIMUmg=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=W0Cr04a93L0uTLmnh8+dWqiJXMH9y+C8fXG46nOd6ZcZDAC08AvMfGnMstO2aGALr ZvLxyTZWJiei56Kw0YyPBa1WHCFSEvuChi7nlaTAs24Xcwq8CmHwZmXieDxrOgQKNb rTDY2TNrSXijt+zJm2NzUZHzCkKDxN770tg0WLxw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 50619F89729; Thu, 4 Apr 2019 08:37:51 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 7D1BDF89614; Mon, 1 Apr 2019 22:55:46 +0200 (CEST) Received: from mail-it1-x141.google.com (mail-it1-x141.google.com [IPv6:2607:f8b0:4864:20::141]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 9E531F8075C for ; Mon, 1 Apr 2019 22:55:43 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9E531F8075C Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="c125njDp" Received: by mail-it1-x141.google.com with SMTP id q14so1535528itk.0 for ; Mon, 01 Apr 2019 13:55:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Xrpr7Hq7dqaYL2Eo6DwUdVyXfie7eGeQXHVNyEFIVsc=; b=c125njDpcb+GViLFb7oVcDNQe5ZLS36m3H9L16x9knOSqaFwlnxDs+rGkawwSxJbev wzsTkjX3Y24BpRuyMM2PCZy92/gdYSpJwe6icQto/kqdVd40+EGD10UN9tvr2k3M8eOQ CSTTzL1rJRZkv/p3B9Xk++JR9RnhbLzOnsg4U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Xrpr7Hq7dqaYL2Eo6DwUdVyXfie7eGeQXHVNyEFIVsc=; b=oJ2Pse888sBd7mBlQSzKXUh0mFwHXuawUfalJHW1ET9uCWjLdKGfPiCymZoFpn8ocr EhHSRxv4/2LAC5cWBtW2JZHnjBpq1WH8fHHAAGUBlhnB/X7q8VjGW+5QalLzfBvN7WrY /8Fcq2xjNywv31m6kb/JP/uxioX+e0pZRvtzYn7PjM/LTpFQ2IafM4HXiF518w0WgFeQ dsKgqWZ+2rwX0JSxskcELg58VNmgjw/dCLvVyBJox1KFulIMK7tSTetVnCvvQKjZEn09 x5pLUB1+u7BgUGWy4+MgXMIf6huiDo9vqHRfx5owLcJex6xNoTN85TqEZchrRWSpCtrp WtOQ== X-Gm-Message-State: APjAAAUK1NN2W8pR1CxE987uwD1J/Wd7+fDNIE4rf8O6WCtJDnqbH3qc UYUaMYLYwvCk2Ny38HY0OWmVpA== X-Google-Smtp-Source: APXvYqxavNwBue4MkZ+KYHPxCUQFuW4/4QT/57VY6ql1jxwXoUaGRP9EICN0VkNK2m9QSLigHVZSgQ== X-Received: by 2002:a24:7014:: with SMTP id f20mr1286036itc.44.1554152141676; Mon, 01 Apr 2019 13:55:41 -0700 (PDT) Received: from fletcherw.bld.corp.google.com ([2620:15c:183:200:70a8:812a:cdeb:6e0]) by smtp.gmail.com with ESMTPSA id v133sm6688570ita.19.2019.04.01.13.55.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Apr 2019 13:55:41 -0700 (PDT) From: Fletcher Woodruff To: linux-kernel@vger.kernel.org Date: Mon, 1 Apr 2019 14:55:19 -0600 Message-Id: <20190401205519.34023-2-fletcherw@chromium.org> X-Mailer: git-send-email 2.21.0.392.gf8f6787159e-goog In-Reply-To: <20190401205519.34023-1-fletcherw@chromium.org> References: <20190401205519.34023-1-fletcherw@chromium.org> MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 04 Apr 2019 08:37:44 +0200 Cc: Oder Chiou , alsa-devel@alsa-project.org, Takashi Iwai , Liam Girdwood , Mark Brown , Ross Zwisler , Bard Liao , Fletcher Woodruff , Curtis Malainey Subject: [alsa-devel] [PATCH 2/2] ASoC: rt5677: make ACPI property names match _DSD X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" X-Virus-Scanned: ClamAV using ClamSMTP The rt5677 driver is using the wrong property names to read from ACPI. Update the property names to match those from _DSD, so that the correct GPIO pin numbers are read and that plug-detection works. With this patch, plugging and unplugging the headphone jack switches between headphones and speakers automatically. Signed-off-by: Fletcher Woodruff --- sound/soc/codecs/rt5677.c | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c index 33380f82b7008f..1f725086cee39c 100644 --- a/sound/soc/codecs/rt5677.c +++ b/sound/soc/codecs/rt5677.c @@ -4998,25 +4998,6 @@ 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, - 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"); - 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"); - - 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); -} - static void rt5677_read_device_properties(struct rt5677_priv *rt5677, struct device *dev) { @@ -5273,19 +5254,23 @@ static int rt5677_i2c_probe(struct i2c_client *i2c) 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; + u32 val; 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); + if (!device_property_read_u32(&i2c->dev, + "realtek,dmic2_clk_pin", &val)) + rt5677->pdata.dmic2_clk_pin = val; } 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.