From patchwork Tue Jun 4 10:44:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 165747 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp5667886ili; Tue, 4 Jun 2019 03:45:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqypi/4opBcnoB7QPkJRYZ2VcLycEC4wDNg+eWbi371hwpgFkB8prKV+7eknMh8Sz0l2+fy7 X-Received: by 2002:a63:1d1d:: with SMTP id d29mr35084676pgd.63.1559645102158; Tue, 04 Jun 2019 03:45:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559645102; cv=none; d=google.com; s=arc-20160816; b=zqPzR7wSTs5rjaAOpk2YAd5yj0ospmhM8+HRM3U2EL6aXmxIT4/7n6BY8velFbv+3+ 9vPphKGrhCk0vcwei+Df8q9paGDy67LagUXkcGh1BpZ+SEkxCq5htm+L1AXRaRKPajP2 LwNiJ1Mc5QipSi9J3/8dZD70VLA6Ae4h9fVAXE/SHTZG9QdFZtRZ+WV+fhuNOoK9NBl+ zkVoG/Y/R4JPQMxVoSRnjyYbyUIySw+zbg/K7kU0B3tMA6iK4MWyIGqtyxQae3zl/G7i Vywl8VG9mHnK0cbWLojywuIlTIMdVGDCJr3CMw63rp1/7AVHhHANAn8tdyEAZUTrfeAE vm9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=nQjqkj1EN8NC8Ay0yEHmwn6X2HJX2TtkXyONunIjoOQ=; b=UjE9pYIXoPVrHTSeDu3M8t8I/5njTolB960y8lvW163/FyvrsKEsBc4jzuZuWxpMNX fHW97I7q0BXndHZIvnF7f0GqYB+HUfj2UUcqxl4QJ6aXlvCE1Fsc2qYnnOMGRUPGCcAE qCGvEpYWY+SOSC5+P0tTxkwxnhvCBSOA1WP2l0PESwW6U0ERDwSTtSHgUEwvtjTbNGvo Vm0H9X7MBKHE1sgPNmFgdfChm3bnohL5jsNfbkr7lazoQxa2Is87XGvgeGziSU+V5LE+ eMuo0QxzfN/ratWjhk/p+Qhe2WZriS1c10Qbc72Gow5AVwsbnxytYEtSZzidvfevEFaW R2eQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LgaFtLgo; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k13si20904922pll.64.2019.06.04.03.45.01; Tue, 04 Jun 2019 03:45:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LgaFtLgo; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727386AbfFDKpB (ORCPT + 5 others); Tue, 4 Jun 2019 06:45:01 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:37666 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727179AbfFDKpB (ORCPT ); Tue, 4 Jun 2019 06:45:01 -0400 Received: by mail-wm1-f67.google.com with SMTP id 22so5959543wmg.2 for ; Tue, 04 Jun 2019 03:45:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=nQjqkj1EN8NC8Ay0yEHmwn6X2HJX2TtkXyONunIjoOQ=; b=LgaFtLgo69Z61g+GbWOW59qkBgcDUOxjNGAQFne/2sNXo+5nvlREiDIDiZ5YaY5F9N Eyv3uRxa6TWCtsMCUJWb9Z8oapmFfry/+Ssw7nMD9REJirzVscIqSBPbu0EB+tXDsrFJ oz9y18iFepuQyqmb98O7GQYfNCXa6ElADnlthp5IzMl8S1xTIWDKver4ZF2aPfftF/WZ CeRdv9BwD+LaDbuC4g0tzV0AMVmDUGL4/e5N0YOscBVmeAlZUeRwdhH6/g9pHq7/a/rA fdQ8GAvTL8rb31m81z4MDhX0+POnf3oemi4gmNJYx+AMv8NuAF1EMYqp8A85NWygnW/u Tz5w== 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; bh=nQjqkj1EN8NC8Ay0yEHmwn6X2HJX2TtkXyONunIjoOQ=; b=mvqVyXRVyhkZS1HW6EONh+4SjAMxnqSLJSN8YKrL+RFt17mKebCGc/+n0kHaIs1GqS EuDZ3j7kIRkC/jDurnSUTntXu/VNmom+Ygl/0jqM63/Apk16W9ukwT9AltzWBbS+IZWb 5FJvLlMyK8s0vBSB/FUFLL6Kpezj2dSGI3D2dANG3VLqe+zBsYPm9i0JmoiWoG5EfjfV J6eTWjBAdZNLyZPnwCYV69+I9lD83Kgx/Ace5JATQVWNhuFmsfao59wCA65pU1EzhHOX 2CjtHrr0ZCAcBXpTuFJbSm337Oj4DsMJUV09W8vcb8fASny99yCtjPu+eZThyNUNf/pT 0Bng== X-Gm-Message-State: APjAAAUXtVk+DwnKSEYhg1mCBVJpWIjkRFjwB23P8YfDcNCrmE0Ao22T H+eDiGI50NIR/wFUl8fu9Xk9WQ== X-Received: by 2002:a1c:448b:: with SMTP id r133mr5943280wma.114.1559645099469; Tue, 04 Jun 2019 03:44:59 -0700 (PDT) Received: from localhost.localdomain ([2.27.167.43]) by smtp.gmail.com with ESMTPSA id t140sm2718623wmt.0.2019.06.04.03.44.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Jun 2019 03:44:58 -0700 (PDT) From: Lee Jones To: alokc@codeaurora.org, kramasub@codeaurora.org, andy.gross@linaro.org, david.brown@linaro.org, wsa+renesas@sang-engineering.com, bjorn.andersson@linaro.org, linus.walleij@linaro.org, balbi@kernel.org, gregkh@linuxfoundation.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, jlhugo@gmail.com, linux-i2c@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-gpio@vger.kernel.org, linux-usb@vger.kernel.org, Lee Jones Subject: [PATCH 1/8] i2c: i2c-qcom-geni: Provide support for ACPI Date: Tue, 4 Jun 2019 11:44:48 +0100 Message-Id: <20190604104455.8877-1-lee.jones@linaro.org> X-Mailer: git-send-email 2.17.1 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Add a match table to allow automatic probing of ACPI device QCOM0220. Ignore clock attainment errors. Set default clock frequency value. Signed-off-by: Lee Jones --- drivers/i2c/busses/i2c-qcom-geni.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) -- 2.17.1 Reviewed-by: Bjorn Andersson diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c index db075bc0d952..0fa93b448e8d 100644 --- a/drivers/i2c/busses/i2c-qcom-geni.c +++ b/drivers/i2c/busses/i2c-qcom-geni.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2017-2018, The Linux Foundation. All rights reserved. +#include #include #include #include @@ -483,6 +484,12 @@ static const struct i2c_algorithm geni_i2c_algo = { .functionality = geni_i2c_func, }; +static const struct acpi_device_id geni_i2c_acpi_match[] = { + { "QCOM0220"}, + { }, +}; +MODULE_DEVICE_TABLE(acpi, geni_i2c_acpi_match); + static int geni_i2c_probe(struct platform_device *pdev) { struct geni_i2c_dev *gi2c; @@ -502,7 +509,7 @@ static int geni_i2c_probe(struct platform_device *pdev) return PTR_ERR(gi2c->se.base); gi2c->se.clk = devm_clk_get(&pdev->dev, "se"); - if (IS_ERR(gi2c->se.clk)) { + if (IS_ERR(gi2c->se.clk) && !ACPI_HANDLE(&pdev->dev)) { ret = PTR_ERR(gi2c->se.clk); dev_err(&pdev->dev, "Err getting SE Core clk %d\n", ret); return ret; @@ -510,12 +517,19 @@ static int geni_i2c_probe(struct platform_device *pdev) ret = device_property_read_u32(&pdev->dev, "clock-frequency", &gi2c->clk_freq_out); - if (ret) { + if (ret && !ACPI_HANDLE(&pdev->dev)) { dev_info(&pdev->dev, "Bus frequency not specified, default to 100kHz.\n"); gi2c->clk_freq_out = KHZ(100); } + if (ACPI_HANDLE(&pdev->dev)) { + ACPI_COMPANION_SET(&gi2c->adap.dev, ACPI_COMPANION(&pdev->dev)); + + /* Using default, same as the !ACPI case above */ + gi2c->clk_freq_out = KHZ(100); + } + gi2c->irq = platform_get_irq(pdev, 0); if (gi2c->irq < 0) { dev_err(&pdev->dev, "IRQ error for i2c-geni\n"); @@ -660,6 +674,7 @@ static struct platform_driver geni_i2c_driver = { .name = "geni_i2c", .pm = &geni_i2c_pm_ops, .of_match_table = geni_i2c_dt_match, + .acpi_match_table = ACPI_PTR(geni_i2c_acpi_match), }, };