Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4576099imu; Sat, 19 Jan 2019 12:47:42 -0800 (PST) X-Google-Smtp-Source: ALg8bN5Np7mP9miZTJYGOroABnMBK36CTWXtwJD5/icN2BB8Tszfx/oF+PCJZKLh3pEgoVYBJaBS X-Received: by 2002:a62:ca03:: with SMTP id n3mr807317pfg.241.1547930862870; Sat, 19 Jan 2019 12:47:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547930862; cv=none; d=google.com; s=arc-20160816; b=qX3ra8NyeKvE9K2a6tpe0ZuAGQcKfE4g2roRZ2cRV1dM85Ulv8vlZm9g6R9/TWN6uc 8NeR39srqRPuuT60p0/82PogZlsscvrqcQ3lOZgAgEol09jI4w4A1ewxxx+NaPM3W2zi 6n/E3dZNHj0wLzlWP8QAJHfDszDxg/QpmRtZL9r9O72cXl+BkyFZYxP9+O7Ngd69Iw+4 TZofBhw3Gf4KPpiHaDSQUkv+KqOtpqjgQoSIuBULAq1V8O6rdC2OwwKOu5/TUuR+E84O t2F5KuG2GDjS5h2I+mBflAZJKkDDCCoWXvhIBdPz24Aut1rUuo9+5LuojcEXUYbtn4NZ MadA== 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=NBcpF6qVskEdURh6FOjYjbfMStG7+/6mgJY46u25ExE=; b=E4/5FtT3Cs3jqVqA2k3zjlM//9vGQjrLC/0HewIaSwtMzicGANFvadggPFwq7A3nO0 PLJPfb7ZS1xHKTqKn8XVvHxbuJcLab28VnbRnk8AMZDptGHxr+fiD+MjTm4kLfXWNh+4 k9FaMGBLtnqFn4+TidkzBSRfCaAJdl66rwjFPddkGUEjtf2Hmra1VAgccFmTCPo0qRjH nq+4XTkuZiY9Nv7oQk3ryapCtCQgzGQldUlKgagHqjTDvIrrUNfV2sclsKo0D7qJV+dS TAjKYTlXBEutaV29ltNFkGNVLXrtXud69ywhC7Bdrb98V0KMBW598X6qCZTN4TnyG/F4 TwKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@onstation.org header.s=default header.b=dzZEyZRO; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f35si8429357pgf.449.2019.01.19.12.47.00; Sat, 19 Jan 2019 12:47:42 -0800 (PST) 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 (test mode) header.i=@onstation.org header.s=default header.b=dzZEyZRO; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729435AbfASUne (ORCPT + 99 others); Sat, 19 Jan 2019 15:43:34 -0500 Received: from onstation.org ([52.200.56.107]:35178 "EHLO onstation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729318AbfASUnd (ORCPT ); Sat, 19 Jan 2019 15:43:33 -0500 Received: from localhost.localdomain (c-98-239-145-235.hsd1.wv.comcast.net [98.239.145.235]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: masneyb) by onstation.org (Postfix) with ESMTPSA id AB5D5503; Sat, 19 Jan 2019 20:43:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=onstation.org; s=default; t=1547930612; bh=0JLZO/AyaqSFVusgMAcUoH/HmWfK9w/ALABxPAreFZg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dzZEyZROVBa7PKxjeEpRpPHlIq7wSBFTpCklImEmzaYPfIrz35cgeL3jqXMI3oSlL abQ7BeolpykHO4uC8jKXm9HHrVKpNBxVuCqMW3Rd6ogZZCLHN+98FrOstULSe5u2h1 TDLFGa9vXyV1nTCoVzkvHBUQcuYO+WcOeeX3scLc= From: Brian Masney To: linus.walleij@linaro.org, sboyd@kernel.org, bjorn.andersson@linaro.org, andy.gross@linaro.org, marc.zyngier@arm.com Cc: shawnguo@kernel.org, dianders@chromium.org, linux-gpio@vger.kernel.org, nicolas.dechesne@linaro.org, niklas.cassel@linaro.org, david.brown@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, thierry.reding@gmail.com, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v6 03/15] pinctrl: qcom: spmi-gpio: hardcode IRQ counts Date: Sat, 19 Jan 2019 15:42:40 -0500 Message-Id: <20190119204252.18370-4-masneyb@onstation.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190119204252.18370-1-masneyb@onstation.org> References: <20190119204252.18370-1-masneyb@onstation.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The probing of this driver calls platform_irq_count, which will setup all of the IRQs that are configured in device tree. In preparation for converting this driver to be a hierarchical IRQ chip, hardcode the IRQ count based on the hardware type so that all the IRQs are not configured immediately and are configured on an as-needed basis later in the boot process. This change will also allow for the removal of the interrupts property later in this patch series once the hierarchical IRQ chip support is in. This patch also removes the generic qcom,spmi-gpio OF match since we don't know the number of pins. All of the existing upstream bindings already include the more-specific binding. The pm8941 code was tested on a LG Nexus 5 (hammerhead) phone. Signed-off-by: Brian Masney Reviewed-by: Stephen Boyd Reviewed-by: Bjorn Andersson --- Changes since v5: - None Changes since v4: - Remove unnecessary u16 cast on device_get_match_data() Changes since v3: - More variants are now included. I missed these since I searched for qcom,spmi-gpio in the arm dts, and missed the ones in the arm64 dts. Changes since v2: - Don't move pmic_gpio_of_match block. Use device_get_match_data instead of of_match_device. - Correct build warning on arm64: warning: cast from pointer to integer of different size drivers/pinctrl/qcom/pinctrl-spmi-gpio.c | 28 ++++++++++-------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c index 5f2977982ef1..b6fa2c7dbb26 100644 --- a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c +++ b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c @@ -951,13 +951,7 @@ static int pmic_gpio_probe(struct platform_device *pdev) return ret; } - npins = platform_irq_count(pdev); - if (!npins) - return -EINVAL; - if (npins < 0) - return npins; - - BUG_ON(npins > ARRAY_SIZE(pmic_gpio_groups)); + npins = (uintptr_t) device_get_match_data(&pdev->dev); state = devm_kzalloc(dev, sizeof(*state), GFP_KERNEL); if (!state) @@ -1063,16 +1057,16 @@ static int pmic_gpio_remove(struct platform_device *pdev) } static const struct of_device_id pmic_gpio_of_match[] = { - { .compatible = "qcom,pm8005-gpio" }, /* 4 GPIO's */ - { .compatible = "qcom,pm8916-gpio" }, /* 4 GPIO's */ - { .compatible = "qcom,pm8941-gpio" }, /* 36 GPIO's */ - { .compatible = "qcom,pm8994-gpio" }, /* 22 GPIO's */ - { .compatible = "qcom,pmi8994-gpio" }, /* 10 GPIO's */ - { .compatible = "qcom,pm8998-gpio" }, /* 26 GPIO's */ - { .compatible = "qcom,pmi8998-gpio" }, /* 14 GPIO's */ - { .compatible = "qcom,pma8084-gpio" }, /* 22 GPIO's */ - { .compatible = "qcom,pms405-gpio" }, /* 12 GPIO's, holes on 1 9 10 */ - { .compatible = "qcom,spmi-gpio" }, /* Generic */ + { .compatible = "qcom,pm8005-gpio", .data = (void *) 4 }, + { .compatible = "qcom,pm8916-gpio", .data = (void *) 4 }, + { .compatible = "qcom,pm8941-gpio", .data = (void *) 36 }, + { .compatible = "qcom,pm8994-gpio", .data = (void *) 22 }, + { .compatible = "qcom,pmi8994-gpio", .data = (void *) 10 }, + { .compatible = "qcom,pm8998-gpio", .data = (void *) 26 }, + { .compatible = "qcom,pmi8998-gpio", .data = (void *) 14 }, + { .compatible = "qcom,pma8084-gpio", .data = (void *) 22 }, + /* pms405 has 12 GPIOs with holes on 1, 9, and 10 */ + { .compatible = "qcom,pms405-gpio", .data = (void *) 12 }, { }, }; -- 2.17.2