From patchwork Wed Jun 5 11:42:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 165866 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp7216875ili; Wed, 5 Jun 2019 04:43:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqyqU1Ebu5AbwEqmhjZ/Q4eCBRVBJib1j21uaW+Dtm6bR0PVs9FrylxBDVDLVhD2bBpdQPSy X-Received: by 2002:a63:d652:: with SMTP id d18mr3878485pgj.112.1559734990240; Wed, 05 Jun 2019 04:43:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559734990; cv=none; d=google.com; s=arc-20160816; b=dhZHJSLYR0J06u9MPmhk4Ol7qLnp1bY9pjJBRQ5B2kBoZZ2cL6mUiigLKdThwJOrNO 1lGXJpDfACn0ZSZdU9ft5nzSd44rwWhreWIXU+gJiHCd8qXwWkWI0XElM2/K8P1hHoC/ iF06nYyCNKTO2GkLbiwG8QDHfMejShyK9k7QP3ECybCg2owUrBOQA4O2C3tXPNPHRYZf AUUlVdU6SNhoUQclln9eYfTDgcBY9RW4c/Jz5g0RhtUs1Oz9tPymoOLxIpF658L5nDvv /9kV65VisbQUxRovjKPxgs9x7Dsb5J6s5bUGLZbEVzfGJPFVs1ot7EyagRHzN4o9Jd0T Pf/w== 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=h9tlx5W8LOn7RqWbzzZ4Rp2w5321B6J3pJgUB5NIlDxR6nVca9MJ3he6Qte6ZprqNX NvGlu06J0VLh3UecEWBFMFnmG+HuVX7Cq04PIOTaFjEPQ0Fx+JfTwJBX0yHYxdOjwLiP yDCjMQ1q5iLBdm7OfUd4AQGXbp3Pfwt3rNScgV3bAvuRPrzJK0C3dagFWXGTpdEE1wSf VnMPV0PbtvD0HpP4bx4P3D7Fgfa1QR+uZ86v+IixVGh//gqkrNFJS+YuI+ECRTD7FJ2u f0Kis125LraGfrEsoUWwaxAWC+QXGGpZlNqkBcRBDxgwD1b7DsGgsbzDjiebn5lNUrjx kDjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RH78oA+N; 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 a3si25828775pju.78.2019.06.05.04.43.09; Wed, 05 Jun 2019 04:43:10 -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=RH78oA+N; 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 S1727376AbfFELnJ (ORCPT + 5 others); Wed, 5 Jun 2019 07:43:09 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:38288 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727219AbfFELnJ (ORCPT ); Wed, 5 Jun 2019 07:43:09 -0400 Received: by mail-wr1-f67.google.com with SMTP id d18so19112067wrs.5 for ; Wed, 05 Jun 2019 04:43:08 -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=RH78oA+NxoAk2QUd4m2HOQ8dyN2sCxrVo+FvNDasZKbmuqv5dUteK2nYHr3AU8dZY2 lL6O731jO9kBau+KvwCnnF2pv2zQNFqiUY9zOrc3A4LrxHgl9/zAkEPJlQwGcvHZMo/w T5Q+bajSnI9mx+6X4Pf9VCvK19Rxr/TWdt13E2G4DlLn2iW89yA4kT0OaSSfHFXfqVw2 wsqz5uFfMcqQjg4rZ9X+5QJeBFThsy8V7siule0Y3MR04je8W6A0+CQYQsv0XPB0SH1t zd6JjCDEnS9YTtARJbgAB90xZpf4QrVjQTx3SGk0eBWm1D1i41b7bUq302Rnt1ZCH8ac ByZg== 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=Fq/yT08tckc9TybSPVDBbatGGIOVfrYVsvhcDX01i0Um6NwzyDMBk+1sREhqf2vcxc VfNKXw9vc2BWzt7yNm/OTJXGeaM5qjxO16knoX5Rw67u8pLVbaLnOi2EtARwg1xTXcb2 1KpH2fO3nttcN+iIqKwV1cItAhRiB3o81gvuAVABQxXxxhpiNBEbguR/pvTn7+Q6Ha21 Rf0e/hzUc3ZJ6WhZjjgke5C4zaI+NEjXpFtoPLKPatG1qBx2yN392qFsRcqBnpHOrldh 2EThcoQ4KWuNL6Up7DA8YVGg3eSmB6FGw4JZ/HBqY+FU0MTI2eIAMTwmdvNcdFWwoZ8n WZ4A== X-Gm-Message-State: APjAAAWHcMruHhQoORNd9sti2We8B4YZoqtT3bfCFBDat3YvfG9EX5f+ nxOCq8JzcxzUwP3IOGAqefyfzw== X-Received: by 2002:a5d:5702:: with SMTP id a2mr9341914wrv.89.1559734987545; Wed, 05 Jun 2019 04:43:07 -0700 (PDT) Received: from localhost.localdomain ([2.27.167.43]) by smtp.gmail.com with ESMTPSA id 34sm27718740wre.32.2019.06.05.04.43.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Jun 2019 04:43:06 -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 1/8] i2c: i2c-qcom-geni: Provide support for ACPI Date: Wed, 5 Jun 2019 12:42:55 +0100 Message-Id: <20190605114302.22509-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), }, }; From patchwork Wed Jun 5 11:43:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 165871 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp7217145ili; Wed, 5 Jun 2019 04:43:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqxtdW8pjxzPNfQFctl5Qh2LdHZ6kmt/H0PemCbM3xzqar0mKTA6HZyIOfgzSggIo2BnY3Gj X-Received: by 2002:a17:90a:195e:: with SMTP id 30mr44282369pjh.116.1559735004309; Wed, 05 Jun 2019 04:43:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559735004; cv=none; d=google.com; s=arc-20160816; b=hkNoy2uBrpQoInu2Fsgg342LG5JvohRYX/ZCTCHP4E5J12P77Zw9bIHGFA7rxYHaHl rdStLds5qUB6+NqSQqpZkPFLFgqGsgYfv/FO3/4ajjI+wefw3KovCP3hi07KFy0QZ+8x 9VI5etBmDCuATI80BvXYiX51IJ/J3+nvLmcR7prnWijMtlsajKhA+HlYdwMg1Iywb8Ec 9Wj46JWUnkYQZYaDGwkrk7Hbn80vQ7iovYxaAeMUMhE/YC8yK7TsB9eLRD/BopMpJfLs CSIVWW1XIklvW9ECxqphVi5VeKJb75aj+wqEo/nY2Hp0nKa6RsKUlmnliKQx0PtMiT/3 fDxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=FalRLEADzMPtGyW8NIPAA0F5olxzxXGnPVoGFb+myak=; b=JHQtf4hFCie8OZL1Db8rJOP4oFP1zvrqT+O9mpE0RjzcImquSXarAq1/zf1we8UIgu SILPOJY6EsDNh9cn4erFPF3T6px0C1cLhIKpsszHRLp5Y3aEwPpEWAevmgowk2R8kOL4 1aUI083OdmTsL4oQ+o+gsIRD7VlT3XaQHiDBXd17npnsPNwP+UOlB3Wfk18B0VJMFfLW ctw3GHFH/fVLmqKG7XMoabLBWhOPLI31PZ3h8qVqWZxnSl6LZR6HJKK0SE7RSAAo7YlN 4n/BRNZ2fIYwvQJaWqwbqbHARcV141p7bkcOMgE6XmoYpTMhM5kPuLdjFoyuM6VRx1b4 okIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QKMO16Hz; 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 j15si27658197pgs.43.2019.06.05.04.43.24; Wed, 05 Jun 2019 04:43:24 -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=QKMO16Hz; 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 S1727602AbfFELnR (ORCPT + 5 others); Wed, 5 Jun 2019 07:43:17 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:51756 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727581AbfFELnR (ORCPT ); Wed, 5 Jun 2019 07:43:17 -0400 Received: by mail-wm1-f67.google.com with SMTP id f10so1928890wmb.1 for ; Wed, 05 Jun 2019 04:43:15 -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:in-reply-to:references; bh=FalRLEADzMPtGyW8NIPAA0F5olxzxXGnPVoGFb+myak=; b=QKMO16HzOa6yOl0TtOpHhtaz2SlgdqhYZJyTw38c30d4UIeX/UDQnVA2Q9d0ipicdD Emx8H2oabCuuVPEsxhBlwmfa+rkssHoxoqRU3YK8BQlbomqW5kzJbpEytzeiEhZgRzTj UuIbaCfiENidI6XCj4Q+ItiQk6OwNI+MlfHUM4Ee1wn3nAm4MbEgnWVI2SXMhsKUpm74 uQFspWBHEtn7jRgazZmuN+pcHm22NJx+aTrImCUgcPsYActEEks62mCVCDgBdhq4xHqV aLwalHia+TPEdWi3LiXfCNf8Dzv+nwpo4e0Tsvy22vppNbw+xuPuEpZs6dyJHOhTwxZg pP/w== 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; bh=FalRLEADzMPtGyW8NIPAA0F5olxzxXGnPVoGFb+myak=; b=PaomwLV+XvD5c94OaC1kkTzcJz+X3UDW/Vv6ksNlmzhZJPQqsdi3aac551V/M3Ghqi /JGV7IStDfB/Ewtckf8kT4zXF8gbLylyH9MIzmfYboUFo8dgU//u0o66u4u1lAImfD3A U7omeF5JDG5hqC/HaZB402mxpkK66EA8qcRS2tKHvrJiRmzjImNuzukSyhWdiVJ0hSDi F90SNWyLaYCMrbW4gTuEfbByr1P0/AuBuGOefE4xGbPj2dyLKHDd6YHyER2hwfZvo6bu O/MSR3NWfB9KP+omk5fYKn1cQMR9c2yiIfIt9/Rnbol++euSbvVY3TC0YZoAtWHz+dhE T5yA== X-Gm-Message-State: APjAAAV5Zf4QRleCLWVxznPPwkT5gAySV3nDBVjnfpc8OYhwVkP5oGbX ev/43tiP2LKX9PfnZlJvnTu9tQ== X-Received: by 2002:a7b:cb06:: with SMTP id u6mr10100159wmj.170.1559734994798; Wed, 05 Jun 2019 04:43:14 -0700 (PDT) Received: from localhost.localdomain ([2.27.167.43]) by smtp.gmail.com with ESMTPSA id 34sm27718740wre.32.2019.06.05.04.43.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Jun 2019 04:43:14 -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 8/8] usb: dwc3: qcom: Improve error handling Date: Wed, 5 Jun 2019 12:43:02 +0100 Message-Id: <20190605114302.22509-8-lee.jones@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190605114302.22509-1-lee.jones@linaro.org> References: <20190605114302.22509-1-lee.jones@linaro.org> Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org dwc3_qcom_clk_init() is called with of_count_phandle_with_args() as an argument. If of_count_phandle_with_args() returns an error, the number of clocks will be a negative value and will lead to undefined behaviour. Ensure we check for an error before attempting to blindly use the value. Signed-off-by: Lee Jones Reviewed-by: Bjorn Andersson --- drivers/usb/dwc3/dwc3-qcom.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.17.1 diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c index 55ba04254e38..e4dac82abd7d 100644 --- a/drivers/usb/dwc3/dwc3-qcom.c +++ b/drivers/usb/dwc3/dwc3-qcom.c @@ -409,6 +409,9 @@ static int dwc3_qcom_clk_init(struct dwc3_qcom *qcom, int count) if (!np || !count) return 0; + if (count < 0) + return count; + qcom->num_clocks = count; qcom->clks = devm_kcalloc(dev, qcom->num_clocks,