From patchwork Fri Jun 7 08:28:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 166062 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp346077ili; Fri, 7 Jun 2019 01:29:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqx1BiuyAE74g5XeYmrcWs9/U9ekYKiPMzC+RkpFlK1ENBDjdGjZPm3nSO1mmAkCfRbv5aMW X-Received: by 2002:a17:902:868a:: with SMTP id g10mr54141059plo.205.1559896146186; Fri, 07 Jun 2019 01:29:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559896146; cv=none; d=google.com; s=arc-20160816; b=paAO2AVdhugbv0GwVUTU3XnfppCmm9twEXpfpAgkzHzIX3S/OcrqYEJO6n5n8TXNK2 XSk+muN6qk7ZJTVlW75QHABMrqjbtZt0wtaV3jPAGHcX67pldAZ3zcI2HcnTvo91yVUq Fj0elmij8+tJdc9uQ+vBuzWWOo8e6PFHxqZDON6TObS8EduXJNgCbtWRs4jceewPE3tZ /Bu+4gOvK18j7K8z9fta0Dm944+2tGRxdju4W6NUaFKb9k5wh7ySAwz2GHfSC7VEeVLe mbJngWv1F5vMkqrmIwC7aXBDlTAtZoHcTphkjxtp21Zi21y+wUW11JaxIOzUt/ypJ6ZQ SfZA== 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=g8losWh2KGgtpIhe+3U6Sbsv0dHB/NexgIOQqFvg0G6MexnB5hL3Fp0tY0zt9HB7Rs fI/Vk26GDI4Owu1Y/o8I60B0cq9Y5CD/gFX3ve+NdoMv0L6gJUIVHVsNraQ+9r1biekn ER9HkfAeNA8hT0s++mZmgn3pRiF5PJVJAXTJoMyUu3ToDeZ3Uk28bMFGLC3nizw1X+GY uJVH8sh9Vi3X1QNfPHbxOcL53DE+6MHPn2KoawB5Y1rqgScM/r6dZuQIZMJozTV5JAlc TOhujsdD/ZsD0PaD+J7SEaPsQSum2LTKZ5+4A5/qyAkQGn4vkSAd2oFdQhCmuVSBzLYe Z48Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jz5mKAbU; spf=pass (google.com: best guess record for domain of linux-i2c-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-i2c-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 k10si1365116pgo.0.2019.06.07.01.29.05; Fri, 07 Jun 2019 01:29:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-i2c-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=jz5mKAbU; spf=pass (google.com: best guess record for domain of linux-i2c-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-i2c-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 S1727646AbfFGI3F (ORCPT + 2 others); Fri, 7 Jun 2019 04:29:05 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:45142 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726829AbfFGI3F (ORCPT ); Fri, 7 Jun 2019 04:29:05 -0400 Received: by mail-wr1-f65.google.com with SMTP id f9so1211210wre.12 for ; Fri, 07 Jun 2019 01:29:04 -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=jz5mKAbUNpc/2XrbWWbZCNJngHPyu1CFGXMDH3jsY6dBNiylltjRxlPmEIjFvwWsHB G1s9vbvPWlTLMh5h0UuE5dNLrvZd8+Wp+SJU3n9JXQdMMbvR7PNj6ikzJHB6SWy9kpgw 2Mbhc2hqW2YDw+8oPUxyi4UcJXUWflUNc9hFXsZ94aEJWUlNlJDXYQuOkr5ViQaBGfUO Q/NM4GLddz0ePkHqkojIxiNV4cl1J5V09BxBngzM1H4LgO3x1dYkWq/fnUvODE4L8CQz E2IOMdqvU91OVm2QCcLf6C6cvnHAO30XIzPYH8mVqqnIYhNEs6SVCDupXrCIZMxiYhz6 U6gg== 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=N9D7gfNpWEITSvaZ/eq4aGAhyQAzR9RsKysakt0X1IQ1Xa3dIJu3eivyyXORkCD85D 7apoPhGqn3PYnWqof5StzMSGkvhlBAvx+eLk6IOAtpAnip7irGz65qKtz5J77OEd4D91 Qj18nt+qtybgrUUZ5pUSUOyC/ZGp+/tTUguL3KdmbHQw5EMN4cRnR9Ub1IOta46chxK+ WNfuYumybc/iCxESRbNdIOLCvzHqmDaKRzXz2y7zHVz30IpScsHoLIy0izjxWFPXhoul n639ZRpUQWYF8scEW5nyXUhsFt6oTuT1dhtsFBfyslJrDFqg6x/orVbumbcFnicRR6x3 JiNw== X-Gm-Message-State: APjAAAWxWBHEyrE6t7m9z/mplo/Fm9Mb8L0frphNvmya1UsIeXpfHYaA hOtlmS2RcfUU4AViGdC2xb63FA== X-Received: by 2002:adf:e691:: with SMTP id r17mr15939833wrm.67.1559896143573; Fri, 07 Jun 2019 01:29:03 -0700 (PDT) Received: from localhost.localdomain ([2.31.167.229]) by smtp.gmail.com with ESMTPSA id a3sm1092946wmb.35.2019.06.07.01.29.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Jun 2019 01:29:02 -0700 (PDT) From: Lee Jones To: alokc@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 v2 1/8] i2c: i2c-qcom-geni: Provide support for ACPI Date: Fri, 7 Jun 2019 09:28:54 +0100 Message-Id: <20190607082901.6491-1-lee.jones@linaro.org> X-Mailer: git-send-email 2.17.1 Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@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 Acked-by: Ard Biesheuvel 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), }, };