From patchwork Wed May 29 16:29:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 800342 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0638C187358; Wed, 29 May 2024 16:30:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717000236; cv=none; b=V1OigAQ7JMUhnCo3t0GIY97NaGPKWzF5QpylnTt0Fwc/CgyQ/aJfG+C7lWVaVw3I7xqofS1TBmvLmuXxDRimRuDZgH48udJ0gzPITuJZ/IyEd2ct1KuAL3KWY+1if4VuwI0qyFTB12CYaRs0Qq+sdNf2ZrNSCCsO62WLMWJqNZ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717000236; c=relaxed/simple; bh=xQFnxItaw23X3Z5K4ATnqQiJwXgY2xVxtlO/Rvgqwyg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ryJIjdcVAjgyHiUH/Bn+jNLPZD5lvAyQd5HBfppr7rdtdO9NsWkY64xbGgAuLNNEu3lEX03YI+Y2cromNvWolfv+sNHB0zTP7AErNGmpzC/CnNueuPfWHqN04Ytzs5aoMvZwefSeY+yeYwtEodWSBMI2xhdq4M8WDIEzZFr3MdI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=IxX2a2aT; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="IxX2a2aT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 994C8C32789; Wed, 29 May 2024 16:30:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717000235; bh=xQFnxItaw23X3Z5K4ATnqQiJwXgY2xVxtlO/Rvgqwyg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IxX2a2aTTeLmaC7Pa3LqNnTkfbHabF5Yg6us9YIk/bmS3UQVZ3Sx1WKxgIMym3xt0 BCLy+PnFZwWHMqa/gxw81U5IBcou6JQy4PHyMwxKi/WQjkPlfHjbr9G1fobBSx/sjD UM3Xs1AWcUMaIkWB8eut92kYQ3AgQYvRffpilPY6uGcVeL3+BqIl1yz2LE/Q3+oAuZ +6KhJ2U5KGztBTsR4OqhYRqn25TKDSSj0mPv98L0nw5i0J9yhkCbmfh979RdnFuAsv LAnHIGu1RGRMQuuWsayy1dVmrlHWidUSaF2YEaNqtXqZlGQcHcvNSDxmGXeXP6gkK1 +S1uYI+nT5zFg== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1sCMCB-000000004ii-1PJU; Wed, 29 May 2024 18:30:35 +0200 From: Johan Hovold To: Lee Jones , Mark Brown , Linus Walleij , Bjorn Andersson Cc: Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Liam Girdwood , Das Srinagesh , Satya Priya Kakitapalli , Stephen Boyd , Bryan O'Donoghue , Andy Shevchenko , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Johan Hovold , Krzysztof Kozlowski Subject: [PATCH v2 01/14] dt-bindings: mfd: pm8008: add reset gpio Date: Wed, 29 May 2024 18:29:45 +0200 Message-ID: <20240529162958.18081-2-johan+linaro@kernel.org> X-Mailer: git-send-email 2.44.1 In-Reply-To: <20240529162958.18081-1-johan+linaro@kernel.org> References: <20240529162958.18081-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Describe the optional reset gpio (which may not be wired up). Reviewed-by: Krzysztof Kozlowski Reviewed-by: Stephen Boyd Reviewed-by: Linus Walleij Signed-off-by: Johan Hovold --- Documentation/devicetree/bindings/mfd/qcom,pm8008.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/mfd/qcom,pm8008.yaml b/Documentation/devicetree/bindings/mfd/qcom,pm8008.yaml index 0c75d8bde568..e1e05921afb4 100644 --- a/Documentation/devicetree/bindings/mfd/qcom,pm8008.yaml +++ b/Documentation/devicetree/bindings/mfd/qcom,pm8008.yaml @@ -29,6 +29,9 @@ properties: description: Parent interrupt. + reset-gpios: + maxItems: 1 + "#interrupt-cells": const: 2 @@ -97,6 +100,7 @@ additionalProperties: false examples: - | + #include #include #include @@ -115,6 +119,8 @@ examples: interrupt-parent = <&tlmm>; interrupts = <32 IRQ_TYPE_EDGE_RISING>; + reset-gpios = <&tlmm 42 GPIO_ACTIVE_LOW>; + pm8008_gpios: gpio@c000 { compatible = "qcom,pm8008-gpio", "qcom,spmi-gpio"; reg = <0xc000>; From patchwork Wed May 29 16:29:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 800053 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D8D6194C68; Wed, 29 May 2024 16:30:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717000236; cv=none; b=NR8J/HnX7mcf0YfGYGzSnyx5monT6KSLxx413TPLTuN0mrUiXx6W37JwVT7UypyDaQS0E2X7FmCaUB71vO9NeF6xLOjZs82cYK3GAVCKSpN3bQ9Uzc/BVcQu5ABfc1obek1CWZUXN0xtU+8B6zhBgiyZrJSfYwc0YNJPLOA0N5Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717000236; c=relaxed/simple; bh=2q8uKA69UrATuj6FRt0GVVqnEyADsM00txP6nQDM2tk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=S4Rd2VWnyU3NLbjdAakt37M2Mbg0HT/7NMTKew8JgkHuSLMzRx67krgOLRifW4leoqB39wsLjCXuiRNuuQPASs8wzMEZTxSN+5GABaUVqm0x4ogyJwwJ68IwKuSsJq1VJDPh5YWeWCI8hhWiKl9HhQq2Sm4WOy0E3zlJQiMTh2o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QTc+cHhp; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="QTc+cHhp" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D944C4AF07; Wed, 29 May 2024 16:30:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717000235; bh=2q8uKA69UrATuj6FRt0GVVqnEyADsM00txP6nQDM2tk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QTc+cHhp+mlJVys6+DmmcCUMfF9Df7Mso5WBnbpCap491+vYMb3f6IajcUpgBJL6R uuEXVYRLCKERUUGkNF2lQPPkPYznWTpvdjOdIIqMcrv6VYLityd2Iar8pjz++aODpZ ZmH34eCXi/5VATN2wmBloBwMPsbKnqN7ENOimqQxLgRe1DiNdbfHhEFkQEMA5L0/Ww 1dSC2qATQwsMCp4YUn33MS6QSqCH4gga6Zyt8rWj5kP6s+NVt68pK4lSOfHj2VbVee ShwR9hNzz8cagYuCMrWTG09RTfE33b+nhj9WYwliejk5N/1+B1E+EoC5jUaHoRyDpL VViTL+bQKKlVA== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1sCMCB-000000004ik-1oZd; Wed, 29 May 2024 18:30:35 +0200 From: Johan Hovold To: Lee Jones , Mark Brown , Linus Walleij , Bjorn Andersson Cc: Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Liam Girdwood , Das Srinagesh , Satya Priya Kakitapalli , Stephen Boyd , Bryan O'Donoghue , Andy Shevchenko , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Johan Hovold Subject: [PATCH v2 02/14] mfd: pm8008: fix regmap irq chip initialisation Date: Wed, 29 May 2024 18:29:46 +0200 Message-ID: <20240529162958.18081-3-johan+linaro@kernel.org> X-Mailer: git-send-email 2.44.1 In-Reply-To: <20240529162958.18081-1-johan+linaro@kernel.org> References: <20240529162958.18081-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The regmap irq array is potentially shared between multiple PMICs and should only contain static data. Use a custom macro to initialise also the type fields and drop the unnecessary updates on each probe. Fixes: 6b149f3310a4 ("mfd: pm8008: Add driver for QCOM PM8008 PMIC") Signed-off-by: Johan Hovold Reviewed-by: Bryan O'Donoghue --- drivers/mfd/qcom-pm8008.c | 64 ++++++++++++++------------------------- 1 file changed, 23 insertions(+), 41 deletions(-) diff --git a/drivers/mfd/qcom-pm8008.c b/drivers/mfd/qcom-pm8008.c index 3ac3742f438b..f71c490f25c8 100644 --- a/drivers/mfd/qcom-pm8008.c +++ b/drivers/mfd/qcom-pm8008.c @@ -56,15 +56,25 @@ static unsigned int pm8008_config_regs[] = { INT_POL_LOW_OFFSET, }; -static struct regmap_irq pm8008_irqs[] = { - REGMAP_IRQ_REG(PM8008_IRQ_MISC_UVLO, PM8008_MISC, BIT(0)), - REGMAP_IRQ_REG(PM8008_IRQ_MISC_OVLO, PM8008_MISC, BIT(1)), - REGMAP_IRQ_REG(PM8008_IRQ_MISC_OTST2, PM8008_MISC, BIT(2)), - REGMAP_IRQ_REG(PM8008_IRQ_MISC_OTST3, PM8008_MISC, BIT(3)), - REGMAP_IRQ_REG(PM8008_IRQ_MISC_LDO_OCP, PM8008_MISC, BIT(4)), - REGMAP_IRQ_REG(PM8008_IRQ_TEMP_ALARM, PM8008_TEMP_ALARM, BIT(0)), - REGMAP_IRQ_REG(PM8008_IRQ_GPIO1, PM8008_GPIO1, BIT(0)), - REGMAP_IRQ_REG(PM8008_IRQ_GPIO2, PM8008_GPIO2, BIT(0)), +#define _IRQ(_irq, _off, _mask, _types) \ + [_irq] = { \ + .reg_offset = (_off), \ + .mask = (_mask), \ + .type = { \ + .type_reg_offset = (_off), \ + .types_supported = (_types), \ + }, \ + } + +static const struct regmap_irq pm8008_irqs[] = { + _IRQ(PM8008_IRQ_MISC_UVLO, PM8008_MISC, BIT(0), IRQ_TYPE_EDGE_RISING), + _IRQ(PM8008_IRQ_MISC_OVLO, PM8008_MISC, BIT(1), IRQ_TYPE_EDGE_RISING), + _IRQ(PM8008_IRQ_MISC_OTST2, PM8008_MISC, BIT(2), IRQ_TYPE_EDGE_RISING), + _IRQ(PM8008_IRQ_MISC_OTST3, PM8008_MISC, BIT(3), IRQ_TYPE_EDGE_RISING), + _IRQ(PM8008_IRQ_MISC_LDO_OCP, PM8008_MISC, BIT(4), IRQ_TYPE_EDGE_RISING), + _IRQ(PM8008_IRQ_TEMP_ALARM, PM8008_TEMP_ALARM,BIT(0), IRQ_TYPE_SENSE_MASK), + _IRQ(PM8008_IRQ_GPIO1, PM8008_GPIO1, BIT(0), IRQ_TYPE_SENSE_MASK), + _IRQ(PM8008_IRQ_GPIO2, PM8008_GPIO2, BIT(0), IRQ_TYPE_SENSE_MASK), }; static const unsigned int pm8008_periph_base[] = { @@ -143,38 +153,9 @@ static struct regmap_config qcom_mfd_regmap_cfg = { .max_register = 0xFFFF, }; -static int pm8008_probe_irq_peripherals(struct device *dev, - struct regmap *regmap, - int client_irq) -{ - int rc, i; - struct regmap_irq_type *type; - struct regmap_irq_chip_data *irq_data; - - for (i = 0; i < ARRAY_SIZE(pm8008_irqs); i++) { - type = &pm8008_irqs[i].type; - - type->type_reg_offset = pm8008_irqs[i].reg_offset; - - if (type->type_reg_offset == PM8008_MISC) - type->types_supported = IRQ_TYPE_EDGE_RISING; - else - type->types_supported = (IRQ_TYPE_EDGE_BOTH | - IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW); - } - - rc = devm_regmap_add_irq_chip(dev, regmap, client_irq, - IRQF_SHARED, 0, &pm8008_irq_chip, &irq_data); - if (rc) { - dev_err(dev, "Failed to add IRQ chip: %d\n", rc); - return rc; - } - - return 0; -} - static int pm8008_probe(struct i2c_client *client) { + struct regmap_irq_chip_data *irq_data; int rc; struct device *dev; struct regmap *regmap; @@ -187,9 +168,10 @@ static int pm8008_probe(struct i2c_client *client) i2c_set_clientdata(client, regmap); if (of_property_read_bool(dev->of_node, "interrupt-controller")) { - rc = pm8008_probe_irq_peripherals(dev, regmap, client->irq); + rc = devm_regmap_add_irq_chip(dev, regmap, client->irq, + IRQF_SHARED, 0, &pm8008_irq_chip, &irq_data); if (rc) - dev_err(dev, "Failed to probe irq periphs: %d\n", rc); + dev_err(dev, "failed to add IRQ chip: %d\n", rc); } return devm_of_platform_populate(dev); From patchwork Wed May 29 16:29:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 800341 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0642A18735B; Wed, 29 May 2024 16:30:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717000236; cv=none; b=ARsHhCw9lrfsTD5cBOWxP1g4XF8LCNa4ian1GIM2B4DapG+O+6apGPceSDEGiTaVCTY9CMH8zdV1feO5F5lqkFi//gvk8YmyCl19zbuLTs+cDdX/Oieax3FpSgilrTV9nOj+K5wm0T4rRX3wgUyrRWGw//x+ktQGb+LijJ54qqM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717000236; c=relaxed/simple; bh=CMzX95BYhopK+WIO+dnov/qG98VPRvKcCjXdO2f6tTU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ly6DCO5coq85Ohrtry2YR3IupUR8hxWT0CAin7WITfP9ALxuv2JDTBeMhhK9o40ppvmazEYSeBWI/7ck4Y12+CHdCv+qzs9XWo/TBZ9EeFDwwDyL9A2hbChVxRSc1DiydhcnGHhf3gsd0rs1s5dJkyxoOIhY3XVkVcn1k4H4yjM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=k1VZZ7iS; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="k1VZZ7iS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FC04C2BD10; Wed, 29 May 2024 16:30:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717000235; bh=CMzX95BYhopK+WIO+dnov/qG98VPRvKcCjXdO2f6tTU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k1VZZ7iS25A6L58/8A5UPrXW995EwZJL/51lKKigJs+U+3d1lS6EqyycE/kndywVK l48+qG9wTxrquvUYQpuoBecH9SXQoeJXk+iEBQ76xf8gmFcxq1/0pfqdj78ctCJKT/ cVV9tK9TJGdngKhv5tbSla1ogzZPfSEs+lBAUze57/EmEc+GLeMCPtnFTzkx9AsdWM aQs2FBo3LGVrqwmZhqNrbNr3tp39SlR6a3zwLN03sogDzX8dqFuBd9XhVeA6q1HtQf K0n/mIFRMf4zKWddIcA30l3inGSeQVzu4ordJNkzPZ8mffOcPhhgv3SWetw2gScTEf +jOP+XvQNWduw== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1sCMCB-000000004im-28x3; Wed, 29 May 2024 18:30:35 +0200 From: Johan Hovold To: Lee Jones , Mark Brown , Linus Walleij , Bjorn Andersson Cc: Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Liam Girdwood , Das Srinagesh , Satya Priya Kakitapalli , Stephen Boyd , Bryan O'Donoghue , Andy Shevchenko , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Johan Hovold Subject: [PATCH v2 03/14] mfd: pm8008: deassert reset on probe Date: Wed, 29 May 2024 18:29:47 +0200 Message-ID: <20240529162958.18081-4-johan+linaro@kernel.org> X-Mailer: git-send-email 2.44.1 In-Reply-To: <20240529162958.18081-1-johan+linaro@kernel.org> References: <20240529162958.18081-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Request and deassert any (optional) reset gpio during probe in case it has been left asserted by the boot firmware. Note the reset line is not asserted to avoid reverting to the default I2C address in case the firmware has configured an alternate address. Tested-by: Bryan O'Donoghue Reviewed-by: Linus Walleij Signed-off-by: Johan Hovold --- drivers/mfd/qcom-pm8008.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/mfd/qcom-pm8008.c b/drivers/mfd/qcom-pm8008.c index f71c490f25c8..5a77155a63d7 100644 --- a/drivers/mfd/qcom-pm8008.c +++ b/drivers/mfd/qcom-pm8008.c @@ -4,6 +4,7 @@ */ #include +#include #include #include #include @@ -156,6 +157,7 @@ static struct regmap_config qcom_mfd_regmap_cfg = { static int pm8008_probe(struct i2c_client *client) { struct regmap_irq_chip_data *irq_data; + struct gpio_desc *reset; int rc; struct device *dev; struct regmap *regmap; @@ -167,6 +169,16 @@ static int pm8008_probe(struct i2c_client *client) i2c_set_clientdata(client, regmap); + reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); + if (IS_ERR(reset)) + return PTR_ERR(reset); + + /* + * The PMIC does not appear to require a post-reset delay, but wait + * for a millisecond for now anyway. + */ + usleep_range(1000, 2000); + if (of_property_read_bool(dev->of_node, "interrupt-controller")) { rc = devm_regmap_add_irq_chip(dev, regmap, client->irq, IRQF_SHARED, 0, &pm8008_irq_chip, &irq_data); From patchwork Wed May 29 16:29:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 800056 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 10FDD190661; Wed, 29 May 2024 16:30:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717000236; cv=none; b=dQAoosMlCtIE/qTgR8LcZMCc2L/r3PueT4aEt/4B1kVSA3U6/iA7gK1XMiL3gMQVmL+8QJfQTRQhrgX/jSOL2+yuMsU4ZpK6sOPYrBAk5+1YFjWXjzSUiiL4I//hzM7YWR5eVFNthMkApx4xyYvdmNb6Anwi18Zti0Z1idRsDM0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717000236; c=relaxed/simple; bh=xvGDdXmPugW8gDTyzx+vdea6PEvo7eNqJuG1wNKxm9w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=c3i0ke1PezoaH/0OgCUcSMBgBC6cSQWvWIMV1ylae9JQ9007/6UoxS/zHtEP57eivlst9q4ZBYIlMRY00ddRQJx7X6g4qiM2ViUL14XgTID6GUgvtuBohUYf5Z1MTMTNBcYuW+QL/TeER4bglRxcYqQ9gUrgYY+taKMG+JKhe5U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=iTTCjZlN; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="iTTCjZlN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96C57C32782; Wed, 29 May 2024 16:30:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717000235; bh=xvGDdXmPugW8gDTyzx+vdea6PEvo7eNqJuG1wNKxm9w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iTTCjZlNlK954ebceB6ssZ+LdKlW1fV7MIqih+4zIpyx9aJtY85I5UDCc2+Lugc3n srosb1DPi7aGuN7Vw+tY3nQpZ5fu0pn/BW5AE6FoYU9CQhLkNsKA9s4v1TTG3S/uYp rJRRajRwKpxvewmAa9Zhept+6oZdSE/DxW9izkE0ArnFxdYaKNF313DLeGQCJckeHB 4MPBw4beAKZ8TwUsf0cG5g9C5wv6yXaCNI3TaKGU6C5cRKzWtgdcrDfow5Qzkm2Znj JP3ScQ0r/AmJnUvglKezbmpkA2Fak2MtwOeNCinppCowvd5bY8AFnzpuPxs9NGl1lM BNYPcBRLZc2UQ== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1sCMCB-000000004io-2RKi; Wed, 29 May 2024 18:30:35 +0200 From: Johan Hovold To: Lee Jones , Mark Brown , Linus Walleij , Bjorn Andersson Cc: Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Liam Girdwood , Das Srinagesh , Satya Priya Kakitapalli , Stephen Boyd , Bryan O'Donoghue , Andy Shevchenko , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Johan Hovold Subject: [PATCH v2 04/14] mfd: pm8008: mark regmap structures as const Date: Wed, 29 May 2024 18:29:48 +0200 Message-ID: <20240529162958.18081-5-johan+linaro@kernel.org> X-Mailer: git-send-email 2.44.1 In-Reply-To: <20240529162958.18081-1-johan+linaro@kernel.org> References: <20240529162958.18081-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The regmap irq chip structures can be const so mark them as such. Reviewed-by: Bryan O'Donoghue Reviewed-by: Stephen Boyd Signed-off-by: Johan Hovold --- drivers/mfd/qcom-pm8008.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mfd/qcom-pm8008.c b/drivers/mfd/qcom-pm8008.c index 5a77155a63d7..ab55d524c27b 100644 --- a/drivers/mfd/qcom-pm8008.c +++ b/drivers/mfd/qcom-pm8008.c @@ -51,7 +51,7 @@ enum { POLARITY_LO_INDEX, }; -static unsigned int pm8008_config_regs[] = { +static const unsigned int pm8008_config_regs[] = { INT_SET_TYPE_OFFSET, INT_POL_HIGH_OFFSET, INT_POL_LOW_OFFSET, @@ -129,7 +129,7 @@ static int pm8008_set_type_config(unsigned int **buf, unsigned int type, return 0; } -static struct regmap_irq_chip pm8008_irq_chip = { +static const struct regmap_irq_chip pm8008_irq_chip = { .name = "pm8008_irq", .main_status = I2C_INTR_STATUS_BASE, .num_main_regs = 1, From patchwork Wed May 29 16:29:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 800057 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 063E518735A; Wed, 29 May 2024 16:30:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717000236; cv=none; b=FvUN2tXhG5x6RXcBykxte6ThBGQNAdmvZe4Shi9mG+6aBYWFZEX3sEhsKtwJv5qNTiRQCK+BLuUAqglFfUvAaooGNhd0a0cj6Pk/zHRU/AS7FPIuihqavU/P8Qzyy+AyQzJVP5GwLwVlcgzcn9IlEr8k6/E99zkNx98+wXU1hrU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717000236; c=relaxed/simple; bh=ktUgF/6UawgynxPPaqC7L5uMYlNVYYch3qE9zi0eRhM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=vBe4r92kfJ/Iblt94TpLr7B2l9ijyxjSPeYaEpnTETCWi97Mw0JHkx8nKbtygbTurTVCKew9yfA8kGt2wCW0BZvzWL9xTFvsZySxnyjM7eRSbRYhnCb7dV0avpsnChma7q8zTjS/+fmJgpcp7BHQiTbrEmDJ6b20bhLfoVDEiso= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gysS0y5G; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gysS0y5G" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 837EEC113CC; Wed, 29 May 2024 16:30:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717000235; bh=ktUgF/6UawgynxPPaqC7L5uMYlNVYYch3qE9zi0eRhM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gysS0y5GxOLy2gSWjX2Nmxy4IdenFHxzkia8cDFvsi07Eo7trhiVbQKo4iM/edUJ7 k3bmhjOI++rlSb6TWrgx9+oEzj0IRK2lAyMBy78u0CK+K75vEmh+/pjLr5pb2Luktl Hpz2jlPaVP3GyxftSYxco/yu626Ay4KzVhUZWeIOz3otyT7GYXbiS5E3aEvEarBXft IK34ztYY/17GJq5lqkaNXJoaYfRZZmT6hj8YKpKKzC3Mzx/5hqf9FS3oC/wxAYCL0r YEVFy3XXiaNcYHWMvvPBUNo50W0/Wnv36e0WyT9K0IspiCjsNhCDo2AOKlINM9lxFM qseiQLW1xaseA== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1sCMCB-000000004iq-2nfk; Wed, 29 May 2024 18:30:35 +0200 From: Johan Hovold To: Lee Jones , Mark Brown , Linus Walleij , Bjorn Andersson Cc: Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Liam Girdwood , Das Srinagesh , Satya Priya Kakitapalli , Stephen Boyd , Bryan O'Donoghue , Andy Shevchenko , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Johan Hovold Subject: [PATCH v2 05/14] mfd: pm8008: use lower case hex notation Date: Wed, 29 May 2024 18:29:49 +0200 Message-ID: <20240529162958.18081-6-johan+linaro@kernel.org> X-Mailer: git-send-email 2.44.1 In-Reply-To: <20240529162958.18081-1-johan+linaro@kernel.org> References: <20240529162958.18081-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Use lower case hex notation for consistency. Reviewed-by: Bryan O'Donoghue Reviewed-by: Stephen Boyd Signed-off-by: Johan Hovold --- drivers/mfd/qcom-pm8008.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/mfd/qcom-pm8008.c b/drivers/mfd/qcom-pm8008.c index ab55d524c27b..18173c7a7e7b 100644 --- a/drivers/mfd/qcom-pm8008.c +++ b/drivers/mfd/qcom-pm8008.c @@ -38,8 +38,8 @@ enum { #define PM8008_PERIPH_0_BASE 0x900 #define PM8008_PERIPH_1_BASE 0x2400 -#define PM8008_PERIPH_2_BASE 0xC000 -#define PM8008_PERIPH_3_BASE 0xC100 +#define PM8008_PERIPH_2_BASE 0xc000 +#define PM8008_PERIPH_3_BASE 0xc100 #define PM8008_TEMP_ALARM_ADDR PM8008_PERIPH_1_BASE #define PM8008_GPIO1_ADDR PM8008_PERIPH_2_BASE @@ -151,7 +151,7 @@ static const struct regmap_irq_chip pm8008_irq_chip = { static struct regmap_config qcom_mfd_regmap_cfg = { .reg_bits = 16, .val_bits = 8, - .max_register = 0xFFFF, + .max_register = 0xffff, }; static int pm8008_probe(struct i2c_client *client) From patchwork Wed May 29 16:29:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 800340 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3CA6A190684; Wed, 29 May 2024 16:30:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717000236; cv=none; b=QhtmQdy0XOnw/0r+j52J+j9nQCX+lgsiUgAquVj22qyq+ubuIr8cHrMpPYn9MMOVIRaSowwvqNry7IO6mzHb0b9foL+AzSKrEGHkFOQ1Ss/micr7Xf7D64JzGpcEpHExbSBhgVoAHEp1ksVOdnRGF6mSsQ9z3JZHPACLi4TuIEI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717000236; c=relaxed/simple; bh=lga3d+eXyDGzWJge8vvnwfcv1gyBqqWJmkYtkVpaX6M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tkzajrZre9/uAf+zcHIOnrhJFIerr8vxu5ps7gXm3DN+kN7HA4gtQICHRIiYdSGjoPjz9kw0YgSlD3BSy/hxPH9asm76A231RwSpaXZcCVWFcp67HsL/fqqAIqswOZ6Sk3xoovZtuUJhPXGLq3/YtBnnP+JuVfW6Fa5rq3Pp3Jk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pZ+7vg+b; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pZ+7vg+b" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3F71C4DDE2; Wed, 29 May 2024 16:30:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717000235; bh=lga3d+eXyDGzWJge8vvnwfcv1gyBqqWJmkYtkVpaX6M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pZ+7vg+baXHSYPaOi0WCGDW/RzsM6T0n59YPjj+DfPiAFJ89kLgRFQxk43lDah0Cv A7M/w7pFpq9EJzarS9ED9a8bcEC36L+GDRz1tlXBuRWPw5zQL87X6ZnDEc3cVugyEA UyeVZtl4G9/BH+hpaMjaMYswwHmgKqpJVblM8YgF6mGdwgmPxriH279kXWIrUQsf9z AY7vr2HBNbvlWUOFKuqYHCLp9nzFMxKOKvxNqn0/gUBIU/nCMMxTKXn3jjZMAPRY6p l6++qcAYMzi+P4fjnnCFY7Fo3j9w1UlNbnQr7oDv100widQfbsI2Lm/wGt7PDunz35 fWvSran9qZ82A== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1sCMCB-000000004is-36OJ; Wed, 29 May 2024 18:30:35 +0200 From: Johan Hovold To: Lee Jones , Mark Brown , Linus Walleij , Bjorn Andersson Cc: Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Liam Girdwood , Das Srinagesh , Satya Priya Kakitapalli , Stephen Boyd , Bryan O'Donoghue , Andy Shevchenko , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Johan Hovold Subject: [PATCH v2 06/14] mfd: pm8008: rename irq chip Date: Wed, 29 May 2024 18:29:50 +0200 Message-ID: <20240529162958.18081-7-johan+linaro@kernel.org> X-Mailer: git-send-email 2.44.1 In-Reply-To: <20240529162958.18081-1-johan+linaro@kernel.org> References: <20240529162958.18081-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Drop the redundant "irq" suffix from the irq chip name. Reviewed-by: Bryan O'Donoghue Reviewed-by: Stephen Boyd Signed-off-by: Johan Hovold --- drivers/mfd/qcom-pm8008.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mfd/qcom-pm8008.c b/drivers/mfd/qcom-pm8008.c index 18173c7a7e7b..bab17417aeec 100644 --- a/drivers/mfd/qcom-pm8008.c +++ b/drivers/mfd/qcom-pm8008.c @@ -130,7 +130,7 @@ static int pm8008_set_type_config(unsigned int **buf, unsigned int type, } static const struct regmap_irq_chip pm8008_irq_chip = { - .name = "pm8008_irq", + .name = "pm8008", .main_status = I2C_INTR_STATUS_BASE, .num_main_regs = 1, .irqs = pm8008_irqs, From patchwork Wed May 29 16:29:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 800339 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6A48F194C66; Wed, 29 May 2024 16:30:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717000236; cv=none; b=L5Tlqn/0krb5PP2Hb9mazOZ+P/P1hu1K86fb2lQY+GIEJmCMKLUedqxBxyp2YUasPSze5K3eGIGppbqjZ9zGo4XBkbgwfDx02Q7QqfIyMv2JmY747L3axz4I2HjCnclTH+gExmTA7qV7ccvumyt8TT/4r2qV7ISnmE7sxkxxVJ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717000236; c=relaxed/simple; bh=9D6ySfgbWhQOFK6PfMLujLLbbQCJ9ljTc4OjiKugm44=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lz4XkRXZWNQ6+28QwWPSyEHFm30tsnpGf2hZzOebxZWiKkIQMqta/VD8WP7FvsdvMjrviirh6GGvB9FFZf10VioxENxE9O2f3jELjVWrH4hxI9WHQsHjyGs9wj5ZiDiThnVAyxAytfAhz2fmgyYm5/BT4QyfQz5jAxOXB0dta7A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XRxff3Si; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XRxff3Si" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF042C4AF0A; Wed, 29 May 2024 16:30:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717000236; bh=9D6ySfgbWhQOFK6PfMLujLLbbQCJ9ljTc4OjiKugm44=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XRxff3Si8T3w4EsMM+jiwSbHJVXoKYJr7+4jRhq3FPMhNW8MOd8WDyhOP0DYIdwQZ cze326C+SxHZmRMLRVEjwPB18DrmdxVnZTN7xvFpyG7MZv+pAdak4wbw22dReMM6Dr p+2vwxrYWkjDNC/i5ESOAwZcwC1ESIo1M341EYYoNFOFWyrma/ZDLCY7zivkxs7peu bdL0ZnDvV2ZykombcCouuP1hECvifMYyutR7DDtqmies3nB2gjSah77s8t+9gAG+E1 vtQTmPBYVC+DftcQypp0td+11f7Jm45ov4/mis/vTfBvYk2DiAA4lV94LqMgRWto4L Nj150dMoCm9EA== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1sCMCB-000000004iu-3Qlj; Wed, 29 May 2024 18:30:35 +0200 From: Johan Hovold To: Lee Jones , Mark Brown , Linus Walleij , Bjorn Andersson Cc: Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Liam Girdwood , Das Srinagesh , Satya Priya Kakitapalli , Stephen Boyd , Bryan O'Donoghue , Andy Shevchenko , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Johan Hovold Subject: [PATCH v2 07/14] mfd: pm8008: drop unused driver data Date: Wed, 29 May 2024 18:29:51 +0200 Message-ID: <20240529162958.18081-8-johan+linaro@kernel.org> X-Mailer: git-send-email 2.44.1 In-Reply-To: <20240529162958.18081-1-johan+linaro@kernel.org> References: <20240529162958.18081-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The i2c client driver data pointer has never been used so drop the unnecessary assignment. Reviewed-by: Bryan O'Donoghue Reviewed-by: Stephen Boyd Signed-off-by: Johan Hovold --- drivers/mfd/qcom-pm8008.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/mfd/qcom-pm8008.c b/drivers/mfd/qcom-pm8008.c index bab17417aeec..72199840231e 100644 --- a/drivers/mfd/qcom-pm8008.c +++ b/drivers/mfd/qcom-pm8008.c @@ -167,8 +167,6 @@ static int pm8008_probe(struct i2c_client *client) if (IS_ERR(regmap)) return PTR_ERR(regmap); - i2c_set_clientdata(client, regmap); - reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); if (IS_ERR(reset)) return PTR_ERR(reset); From patchwork Wed May 29 16:29:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 800052 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7563E194C76; Wed, 29 May 2024 16:30:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717000236; cv=none; b=kNAL+jy/dXhlKzGZ8pz2sx11/cQLbn9kskgsNcUk8P0wfGfZ0zWpu4TVqlPrDEjFgh8RXAmRUlEl++SSW4u1s5dQRIb5xEcla/e1/+6yqKPlymfDN/hXyT4MjenS2epxx11ZgFrnrcQ5p8qyxi9ysRp3/RGp58fvb9iK65w7Yng= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717000236; c=relaxed/simple; bh=6qyl2l/7GJ36hxg+alBAoZ3ixQ8wp+igH5vBpgh6QLM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hMQ6giGslfC77S5dwJCyujbEQAnCPmA7QFP20CiBLznnGagPGgKyD8steiVh8EOIcbihvmLRhKUIOvB6YwhUq61vJih1LVdn3P48K/7VI5pEFxl+p1gkwbA4ziYwVzG2HlIE8UdQuqUGxsnICNZ0kONyMoGSUn5cqypLyzuX+gE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cpo4OJu2; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="cpo4OJu2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3F1DC4AF10; Wed, 29 May 2024 16:30:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717000236; bh=6qyl2l/7GJ36hxg+alBAoZ3ixQ8wp+igH5vBpgh6QLM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cpo4OJu25woQCRXyS1H4K7mvjp2+w2dkahdVBQqpNXz9v3XFkcfU33gK0uWPGrM+5 z9phuPkp+PRH4cnfUtXYtO4Ih8RG9RSfZkkMtF2Q8kZYFmC2xCOzmmHOl7LAPMe2Oc sWe2exDkYZ428k7YI/GwdL27w825EbI7SO/qONkIxGU74Qy6lqab3YzLO8EoPTTH7h LrTP0BPcfkWZhJP/Kk/Kw2hUyYPQWEG1eDC18Y9QbPKw0Ts9Dl36If4F/KA3rmc0qS fSgl3QdGYRoFW9oLp7My90wB1+sbZgqKv86xvVVu0bv238j8NE8QMgdBnJalkRR8qg jwS225+m5Gq0A== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1sCMCB-000000004iy-3oEp; Wed, 29 May 2024 18:30:35 +0200 From: Johan Hovold To: Lee Jones , Mark Brown , Linus Walleij , Bjorn Andersson Cc: Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Liam Girdwood , Das Srinagesh , Satya Priya Kakitapalli , Stephen Boyd , Bryan O'Donoghue , Andy Shevchenko , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Johan Hovold , stable@vger.kernel.org Subject: [PATCH v2 08/14] pinctrl: qcom: spmi-gpio: drop broken pm8008 support Date: Wed, 29 May 2024 18:29:52 +0200 Message-ID: <20240529162958.18081-9-johan+linaro@kernel.org> X-Mailer: git-send-email 2.44.1 In-Reply-To: <20240529162958.18081-1-johan+linaro@kernel.org> References: <20240529162958.18081-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The SPMI GPIO driver assumes that the parent device is an SPMI device and accesses random data when backcasting the parent struct device pointer for non-SPMI devices. Fortunately this does not seem to cause any issues currently when the parent device is an I2C client like the PM8008, but this could change if the structures are reorganised (e.g. using structure randomisation). Notably the interrupt implementation is also broken for non-SPMI devices. Also note that the two GPIO pins on PM8008 are used for interrupts and reset so their practical use should be limited. Drop the broken GPIO support for PM8008 for now. Fixes: ea119e5a482a ("pinctrl: qcom-pmic-gpio: Add support for pm8008") Cc: stable@vger.kernel.org # 5.13 Reviewed-by: Bryan O'Donoghue Reviewed-by: Stephen Boyd Signed-off-by: Johan Hovold --- drivers/pinctrl/qcom/pinctrl-spmi-gpio.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c index f4e2c88a7c82..e61be7d05494 100644 --- a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c +++ b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c @@ -1206,7 +1206,6 @@ static const struct of_device_id pmic_gpio_of_match[] = { { .compatible = "qcom,pm7325-gpio", .data = (void *) 10 }, { .compatible = "qcom,pm7550ba-gpio", .data = (void *) 8}, { .compatible = "qcom,pm8005-gpio", .data = (void *) 4 }, - { .compatible = "qcom,pm8008-gpio", .data = (void *) 2 }, { .compatible = "qcom,pm8019-gpio", .data = (void *) 6 }, /* pm8150 has 10 GPIOs with holes on 2, 5, 7 and 8 */ { .compatible = "qcom,pm8150-gpio", .data = (void *) 10 }, From patchwork Wed May 29 16:29:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 800054 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6C094194C67; Wed, 29 May 2024 16:30:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717000236; cv=none; b=GuBd57U5k5PC8X4h24BERXJJdD7JE3qG5+hWWbbpvFHNozRFBcj4XVNe4kSqOWOu8e4QIcHx1b8tJuPL8uPYFZYUsggD0atXYJ9XizjFBw5PiPcNzA+puBIpZ9BqyKRE4FaR3so4lqm/KcULmeIlJIxxZ980Atourn9WLXCX96U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717000236; c=relaxed/simple; bh=ay6FxObVid/tpLQpHByj0/j24W/+xZDsEHwqrIUSxCo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bLvOHxGP0CHFHUZoKniQUe2G/Xse2VgNWrvUg9EwOBSPCD1yxpXc0CpkhTAS714Lzbp88/Ls27Re/uI3YW18zLZC0ViQJD1B49waMiMC6SWkobY8EtETQkiwPVaBLBM4ZhRrjfyGWaz13viNItRYpnyOcjFYdipa+6waJfP18dM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JNrvXw/w; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JNrvXw/w" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3C8EC4AF0E; Wed, 29 May 2024 16:30:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717000236; bh=ay6FxObVid/tpLQpHByj0/j24W/+xZDsEHwqrIUSxCo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JNrvXw/wBzKS/rNwJ6A9XTbAYLDEko2MRARiA5OIkIsEtr7Y6oIAl4vsKkaV8v4/S GVd6jlkri8o7vRzXRMKDLaBrnksxG4qJ0rBFCJnODp/IYyVeG6qPYctqEjqdQn51l7 kG5vXSWDAYWwNXtwmRNiT2m2Hmh9sLOsGlSFkOLfRA33ccJRtqQoxbYHFPw1tZLz+/ 6DmbDrWoPmd3cIYId/rN44NjGppsNccbemmJqCAmhTSphMIjk4zyCkG+4Ft7IcyzCW ISxCF/o+aqPrFXL+Jt7HGPU9JhWEuAMSD9eKTvM0h6mkaUH+EcC9MuxmoYyvnoXDWr TCjhyTpJH4N0A== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1sCMCB-000000004j2-48bG; Wed, 29 May 2024 18:30:36 +0200 From: Johan Hovold To: Lee Jones , Mark Brown , Linus Walleij , Bjorn Andersson Cc: Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Liam Girdwood , Das Srinagesh , Satya Priya Kakitapalli , Stephen Boyd , Bryan O'Donoghue , Andy Shevchenko , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Johan Hovold Subject: [PATCH v2 09/14] dt-bindings: pinctrl: qcom,pmic-gpio: drop pm8008 Date: Wed, 29 May 2024 18:29:53 +0200 Message-ID: <20240529162958.18081-10-johan+linaro@kernel.org> X-Mailer: git-send-email 2.44.1 In-Reply-To: <20240529162958.18081-1-johan+linaro@kernel.org> References: <20240529162958.18081-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The binding for PM8008 is being reworked so that internal details like interrupts and register offsets are no longer described. This specifically also involves dropping the gpio child node and its compatible string which is no longer needed. Note that there are currently no users of the upstream binding and driver. Reviewed-by: Stephen Boyd Signed-off-by: Johan Hovold Reviewed-by: Rob Herring (Arm) --- Documentation/devicetree/bindings/pinctrl/qcom,pmic-gpio.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,pmic-gpio.yaml b/Documentation/devicetree/bindings/pinctrl/qcom,pmic-gpio.yaml index 3f8ad07c7cfd..58807212a601 100644 --- a/Documentation/devicetree/bindings/pinctrl/qcom,pmic-gpio.yaml +++ b/Documentation/devicetree/bindings/pinctrl/qcom,pmic-gpio.yaml @@ -28,7 +28,6 @@ properties: - qcom,pm7325-gpio - qcom,pm7550ba-gpio - qcom,pm8005-gpio - - qcom,pm8008-gpio - qcom,pm8018-gpio - qcom,pm8019-gpio - qcom,pm8038-gpio @@ -122,7 +121,6 @@ allOf: compatible: contains: enum: - - qcom,pm8008-gpio - qcom,pmi8950-gpio - qcom,pmr735d-gpio then: @@ -421,7 +419,6 @@ $defs: - gpio1-gpio10 for pm7325 - gpio1-gpio8 for pm7550ba - gpio1-gpio4 for pm8005 - - gpio1-gpio2 for pm8008 - gpio1-gpio6 for pm8018 - gpio1-gpio12 for pm8038 - gpio1-gpio40 for pm8058 From patchwork Wed May 29 16:29:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 800337 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7568519DF42; Wed, 29 May 2024 16:30:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717000236; cv=none; b=hBB3R7Do2nur8JUjHfnuIaxf1/Ff6yex82k4gvblRo2+32GB4lWkwrvsBLjgYU/eHWlNQlqk8ZmtC6q6RyCFErPI53Xmf5Yt8hNIe3HLhCdsKnpKQZTdit2S9dkGg2HNXzrzluID/0OsOHV3jVR3997B4LBqhIj0G9soBbo/aAk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717000236; c=relaxed/simple; bh=SQO/+ouLx21qu/S9Vf1DTU5WIZ4v/dXTVdqD0GLD4FM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=F5XZVXpj/vAUZ8eg75fJc+Er0Wj8M3+4spczM4nRYhyoz4x6/kzlc1UZGzMfahH0ZNHsnv0HwL03nIN4Tdio/gzbknXadQFxBpIUMSxdpg7IY5SMVLAFphPmvYMunbKG5wZNQvI94X55nDPv13gKwYoL5K9upceDK48bMZW2Eps= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=n1Cay7ae; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="n1Cay7ae" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09931C4AF0F; Wed, 29 May 2024 16:30:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717000236; bh=SQO/+ouLx21qu/S9Vf1DTU5WIZ4v/dXTVdqD0GLD4FM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n1Cay7ae3Iz2RpfLd5/XdlMF8rcIlgdnRp5sB8pjfk6wYMKtnDeVQql6tZUYDJRIe 3+YB6t0kFcB9fNpNTWfR62vG2cCLVlL3/rhRUDiXXmOlAa7y4xnF6/7ZeySX5WhTmJ PFVf+5JzoLa4Nd35yGwxGxvR4QOROBWbW1Eup2G/QiZybZKGmS7iMKgDQoMl3s77oA cmiwCVmPRjpDFFR9ufKAECbuEcFF7OerGOiLzrvJBqygu73TSjcuQT50yVXWDzItY3 toTq7NAxY25g9mT5u28nF5Wm1F0GVmLJ50UWZDhjG7+6HL90pLOBHZsv+gOYDMF4WG LzLGBLdXYJ1Jg== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1sCMCC-000000004j5-0LCb; Wed, 29 May 2024 18:30:36 +0200 From: Johan Hovold To: Lee Jones , Mark Brown , Linus Walleij , Bjorn Andersson Cc: Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Liam Girdwood , Das Srinagesh , Satya Priya Kakitapalli , Stephen Boyd , Bryan O'Donoghue , Andy Shevchenko , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Johan Hovold Subject: [PATCH v2 10/14] dt-bindings: mfd: pm8008: drop redundant descriptions Date: Wed, 29 May 2024 18:29:54 +0200 Message-ID: <20240529162958.18081-11-johan+linaro@kernel.org> X-Mailer: git-send-email 2.44.1 In-Reply-To: <20240529162958.18081-1-johan+linaro@kernel.org> References: <20240529162958.18081-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In preparation for reworking the binding, drop the redundant descriptions of the standard 'reg' and 'interrupts' properties. Signed-off-by: Johan Hovold Reviewed-by: Rob Herring (Arm) --- Documentation/devicetree/bindings/mfd/qcom,pm8008.yaml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Documentation/devicetree/bindings/mfd/qcom,pm8008.yaml b/Documentation/devicetree/bindings/mfd/qcom,pm8008.yaml index e1e05921afb4..d71657f488db 100644 --- a/Documentation/devicetree/bindings/mfd/qcom,pm8008.yaml +++ b/Documentation/devicetree/bindings/mfd/qcom,pm8008.yaml @@ -19,16 +19,11 @@ properties: const: qcom,pm8008 reg: - description: - I2C slave address. - maxItems: 1 interrupts: maxItems: 1 - description: Parent interrupt. - reset-gpios: maxItems: 1 From patchwork Wed May 29 16:29:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 800338 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7118F194C6D; Wed, 29 May 2024 16:30:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717000236; cv=none; b=ibyM79kkf8+9E2G4TwhoKA/WxGwalmxWlq8yPZhcvD1/eeJCxyj6S6nG3Stiy00Rd4exLiVh0XaKuRsq7Pp+W8kWPjAWXovAYzG88Q3q/PCAC3Rtm2aG1wgPO0fTuQJjoiUoclBDR+M8kD3+pztSPsrZ2WYjTnUWf5PzcXRRNOA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717000236; c=relaxed/simple; bh=5kY9P5BZ0+lfkMBnpNNuy5VYH98W7LbVhPjCSiEPNiU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pB7nCbcC4sbzleo2fKzrmhlT4Wy1YAGuXTbiTTaT4YcNpE3nvHU3eBNAplw1u1ZQyl+r4YDIv0QgGSNRSHOeLGv3wGYiLrwn5h9rTwvWsR3Ga6IN0Daba23C38BU1k8+KLQgg7LWu+Qs3Ku6AdiYb2vOwZ7/+BVcKvcazciFZE0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GSCdh5/0; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GSCdh5/0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13794C4DDF9; Wed, 29 May 2024 16:30:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717000236; bh=5kY9P5BZ0+lfkMBnpNNuy5VYH98W7LbVhPjCSiEPNiU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GSCdh5/0poDxJmU5vY+SK3qSTgJ8Mi1zYTz9sJq5OXOSERYIzucXFTBz6AOKs0hX3 +P9Gpv6P4BGgR8oG8eHG/MOKpeXrm0dxyqHybTjDbIetXtVRcHccHWHHukkk0g7nWH MfrXs0rmF4cRIrNUx9sm3p3OOsA9yx2VM4fC+FSs3QnXM3CaYTebJAo/IpqP6Qo8ag 3aq9oOe2BEbFTjQd2YRPOoxrzDomWMKrwtn4P9zNqsxYuYL3H+ZIKCb7aG5izW5ZYy WIy+G3kg1I+cqplzT/eRhhDOWdZ7cM0gROwfD1O+garmJHYnhzh3U+QD/3V88wlKCQ n7o3/GCJsiuuw== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1sCMCC-000000004j8-0e6j; Wed, 29 May 2024 18:30:36 +0200 From: Johan Hovold To: Lee Jones , Mark Brown , Linus Walleij , Bjorn Andersson Cc: Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Liam Girdwood , Das Srinagesh , Satya Priya Kakitapalli , Stephen Boyd , Bryan O'Donoghue , Andy Shevchenko , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Johan Hovold Subject: [PATCH v2 11/14] dt-bindings: mfd: pm8008: rework binding Date: Wed, 29 May 2024 18:29:55 +0200 Message-ID: <20240529162958.18081-12-johan+linaro@kernel.org> X-Mailer: git-send-email 2.44.1 In-Reply-To: <20240529162958.18081-1-johan+linaro@kernel.org> References: <20240529162958.18081-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Rework the pm8008 binding by dropping internal details like register offsets and interrupts and by adding the missing regulator and temperature alarm properties. Note that child nodes are still used for pinctrl and regulator configuration. Also note that the pinctrl state definition will be extended later and could eventually also be shared with other PMICs (e.g. by breaking out bits of qcom,pmic-gpio.yaml). Signed-off-by: Johan Hovold --- .../devicetree/bindings/mfd/qcom,pm8008.yaml | 149 +++++++++++------- 1 file changed, 90 insertions(+), 59 deletions(-) diff --git a/Documentation/devicetree/bindings/mfd/qcom,pm8008.yaml b/Documentation/devicetree/bindings/mfd/qcom,pm8008.yaml index d71657f488db..ccf472e7f552 100644 --- a/Documentation/devicetree/bindings/mfd/qcom,pm8008.yaml +++ b/Documentation/devicetree/bindings/mfd/qcom,pm8008.yaml @@ -27,103 +27,134 @@ properties: reset-gpios: maxItems: 1 - "#interrupt-cells": + vdd-l1-l2-supply: true + vdd-l3-l4-supply: true + vdd-l5-supply: true + vdd-l6-supply: true + vdd-l7-supply: true + + gpio-controller: true + + "#gpio-cells": const: 2 - description: | - The first cell is the IRQ number, the second cell is the IRQ trigger - flag. All interrupts are listed in include/dt-bindings/mfd/qcom-pm8008.h. + gpio-ranges: + maxItems: 1 interrupt-controller: true - "#address-cells": - const: 1 + "#interrupt-cells": + const: 2 - "#size-cells": + "#thermal-sensor-cells": const: 0 -patternProperties: - "^gpio@[0-9a-f]+$": + pinctrl: type: object + additionalProperties: false + patternProperties: + "-state$": + type: object + $ref: "#/$defs/qcom-pm8008-pinctrl-state" + unevaluatedProperties: false - description: | - The GPIO peripheral. This node may be specified twice, one for each GPIO. - - properties: - compatible: - items: - - const: qcom,pm8008-gpio - - const: qcom,spmi-gpio + regulators: + type: object + additionalProperties: false + patternProperties: + "^ldo[1-7]$": + type: object + $ref: /schemas/regulator/regulator.yaml# + unevaluatedProperties: false - reg: - description: Peripheral address of one of the two GPIO peripherals. - maxItems: 1 +required: + - compatible + - reg + - interrupts + - vdd-l1-l2-supply + - vdd-l3-l4-supply + - vdd-l5-supply + - vdd-l6-supply + - vdd-l7-supply + - gpio-controller + - "#gpio-cells" + - gpio-ranges + - interrupt-controller + - "#interrupt-cells" + - "#thermal-sensor-cells" - gpio-controller: true +additionalProperties: false - gpio-ranges: - maxItems: 1 +$defs: + qcom-pm8008-pinctrl-state: + type: object - interrupt-controller: true + allOf: + - $ref: /schemas/pinctrl/pinmux-node.yaml + - $ref: /schemas/pinctrl/pincfg-node.yaml - "#interrupt-cells": - const: 2 + properties: + pins: + items: + pattern: "^gpio[12]$" - "#gpio-cells": - const: 2 + function: + items: + - enum: + - normal required: - - compatible - - reg - - gpio-controller - - interrupt-controller - - "#gpio-cells" - - gpio-ranges - - "#interrupt-cells" + - pins + - function additionalProperties: false -required: - - compatible - - reg - - interrupts - - "#address-cells" - - "#size-cells" - - "#interrupt-cells" - -additionalProperties: false - examples: - | #include - #include #include i2c { #address-cells = <1>; #size-cells = <0>; - pmic@8 { + pm8008: pmic@8 { compatible = "qcom,pm8008"; reg = <0x8>; - #address-cells = <1>; - #size-cells = <0>; - interrupt-controller; - #interrupt-cells = <2>; interrupt-parent = <&tlmm>; interrupts = <32 IRQ_TYPE_EDGE_RISING>; reset-gpios = <&tlmm 42 GPIO_ACTIVE_LOW>; - pm8008_gpios: gpio@c000 { - compatible = "qcom,pm8008-gpio", "qcom,spmi-gpio"; - reg = <0xc000>; - gpio-controller; - gpio-ranges = <&pm8008_gpios 0 0 2>; - #gpio-cells = <2>; - interrupt-controller; - #interrupt-cells = <2>; + vdd-l1-l2-supply = <&vreg_s8b_1p2>; + vdd-l3-l4-supply = <&vreg_s1b_1p8>; + vdd-l5-supply = <&vreg_bob>; + vdd-l6-supply = <&vreg_bob>; + vdd-l7-supply = <&vreg_bob>; + + gpio-controller; + #gpio-cells = <2>; + gpio-ranges = <&pm8008 0 0 2>; + + interrupt-controller; + #interrupt-cells = <2>; + + #thermal-sensor-cells = <0>; + + pinctrl { + gpio-keys-state { + pins = "gpio1"; + function = "normal"; + }; + }; + + regulators { + ldo1 { + regulator-name = "vreg_l1"; + regulator-min-microvolt = <950000>; + regulator-max-microvolt = <1300000>; + }; }; }; }; From patchwork Wed May 29 16:29:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 800336 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A244B1C9EB3; Wed, 29 May 2024 16:30:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717000236; cv=none; b=kzFjaRrm7s8F/wUW0dYVodYNAxheDLGhOzconCbGXFmTGNYZzr2Cl6YnkMV76rvErrbNciqJbEGj2Y9iT5Z9cHa8INVKJ4+M0mzIxhw3WJjkzz2ejxIKej+EenZCOEc3CW/WXXc9WyniE3M0ldXtyh78G9rN3GSRqHbRPQyPZrQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717000236; c=relaxed/simple; bh=NLklJgLht1R6nmUM4NoOQK7QE/i2FSKy3blvxUlSSXg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mCDBnlg2FOqrAhOHk/1bAk0J6Y//wLImByq0/F30pCXhdwkhFB2Rmd5z4lJ3NrddAiYpRrEdHBWlzWUNKiMRARBVrOhAIf8s5SuETCSHOnOXl161gYun5/tcYDPd3oWkD3yziesahkLn9pVBW+q/AMVCcvtwPbf0Pi9n1xHBll8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YUH3o/69; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="YUH3o/69" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2ECA3C113CC; Wed, 29 May 2024 16:30:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717000236; bh=NLklJgLht1R6nmUM4NoOQK7QE/i2FSKy3blvxUlSSXg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YUH3o/69M8XIiozKrHOBpo9MgMDqTTgo626u94gM3mV0+TMytblGcenrIs05Xpkul ESuTdZ2ShUQbes1thd3BOjTfJUG03mdOWpKci7loTo7ArbIZvuzU268JNVxYrgCsQv mFWFovFwfjSsRCGQYLl89bUDUktO3+zj7u5UVbtMobS7jD/gRzy55xYMZsDyWi61A6 RFAfOiXqu3v+V+SiIGSUcNUC/7oh0ayNefckefQd9vlS+GrPIN5KWE9PcxR1cek1+I V6DP+KyJIBc4+MjtGWI+Z1wczmHoYvyU+FmPVPkPq8qBRfATmMISX7GqcpKpQ5GRxF x+C+N0MrTloTA== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1sCMCC-000000004jB-14g5; Wed, 29 May 2024 18:30:36 +0200 From: Johan Hovold To: Lee Jones , Mark Brown , Linus Walleij , Bjorn Andersson Cc: Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Liam Girdwood , Das Srinagesh , Satya Priya Kakitapalli , Stephen Boyd , Bryan O'Donoghue , Andy Shevchenko , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Johan Hovold Subject: [PATCH v2 12/14] mfd: pm8008: rework driver Date: Wed, 29 May 2024 18:29:56 +0200 Message-ID: <20240529162958.18081-13-johan+linaro@kernel.org> X-Mailer: git-send-email 2.44.1 In-Reply-To: <20240529162958.18081-1-johan+linaro@kernel.org> References: <20240529162958.18081-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Rework the pm8008 driver to match the new binding which no longer describes internal details like interrupts and register offsets (including which of the two consecutive I2C addresses the registers belong to). Instead make the interrupt controller implementation internal and pass interrupts to the subdrivers using MFD cell resources. Note that subdrivers may either get their resources, like register block offsets, from the parent MFD or this can be included in the subdrivers directly. In the current implementation, the temperature alarm driver is generic enough to just get its base address and alarm interrupt from the parent driver, which already uses this information to implement the interrupt controller. The regulator driver, however, needs additional information like parent supplies and regulator characteristics so in that case it is easier to just augment its table with the regulator register base addresses. Similarly, the current GPIO driver already holds the number of pins and that lookup table can therefore also be extended with register offsets. Note that subdrivers can now access the two regmaps by name, even if the primary regmap is registered last so that it is returned by default when no name is provided in lookups. Finally, note that the temperature alarm and GPIO subdrivers need some minor rework before they can be used with non-SPMI devices like the PM8008. The temperature alarm MFD cell name specifically uses a "qpnp" rather than "spmi" prefix to prevent binding until the driver has been updated. Tested-by: Bryan O'Donoghue Signed-off-by: Johan Hovold --- drivers/mfd/Kconfig | 1 + drivers/mfd/qcom-pm8008.c | 97 +++++++++++++++++++++++---- include/dt-bindings/mfd/qcom-pm8008.h | 19 ------ 3 files changed, 86 insertions(+), 31 deletions(-) delete mode 100644 include/dt-bindings/mfd/qcom-pm8008.h diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 4b023ee229cf..bfcb68c62b07 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -2208,6 +2208,7 @@ config MFD_ACER_A500_EC config MFD_QCOM_PM8008 tristate "QCOM PM8008 Power Management IC" depends on I2C && OF + select MFD_CORE select REGMAP_I2C select REGMAP_IRQ help diff --git a/drivers/mfd/qcom-pm8008.c b/drivers/mfd/qcom-pm8008.c index 72199840231e..246b5fe9819d 100644 --- a/drivers/mfd/qcom-pm8008.c +++ b/drivers/mfd/qcom-pm8008.c @@ -7,8 +7,10 @@ #include #include #include +#include #include #include +#include #include #include #include @@ -16,8 +18,6 @@ #include #include -#include - #define I2C_INTR_STATUS_BASE 0x0550 #define INT_RT_STS_OFFSET 0x10 #define INT_SET_TYPE_OFFSET 0x11 @@ -45,6 +45,16 @@ enum { #define PM8008_GPIO1_ADDR PM8008_PERIPH_2_BASE #define PM8008_GPIO2_ADDR PM8008_PERIPH_3_BASE +/* PM8008 IRQ numbers */ +#define PM8008_IRQ_MISC_UVLO 0 +#define PM8008_IRQ_MISC_OVLO 1 +#define PM8008_IRQ_MISC_OTST2 2 +#define PM8008_IRQ_MISC_OTST3 3 +#define PM8008_IRQ_MISC_LDO_OCP 4 +#define PM8008_IRQ_TEMP_ALARM 5 +#define PM8008_IRQ_GPIO1 6 +#define PM8008_IRQ_GPIO2 7 + enum { SET_TYPE_INDEX, POLARITY_HI_INDEX, @@ -148,21 +158,65 @@ static const struct regmap_irq_chip pm8008_irq_chip = { .get_irq_reg = pm8008_get_irq_reg, }; -static struct regmap_config qcom_mfd_regmap_cfg = { +static const struct regmap_config qcom_mfd_regmap_cfg = { + .name = "primary", + .reg_bits = 16, + .val_bits = 8, + .max_register = 0xffff, +}; + +static const struct regmap_config pm8008_regmap_cfg_2 = { + .name = "secondary", .reg_bits = 16, .val_bits = 8, .max_register = 0xffff, }; +static const struct resource pm8008_temp_res[] = { + DEFINE_RES_MEM(PM8008_TEMP_ALARM_ADDR, 0x100), + DEFINE_RES_IRQ(PM8008_IRQ_TEMP_ALARM), +}; + +static const struct mfd_cell pm8008_cells[] = { + MFD_CELL_NAME("pm8008-regulator"), + MFD_CELL_RES("qpnp-temp-alarm", pm8008_temp_res), + MFD_CELL_NAME("pm8008-gpio"), +}; + +static void devm_irq_domain_fwnode_release(void *data) +{ + struct fwnode_handle *fwnode = data; + + irq_domain_free_fwnode(fwnode); +} + static int pm8008_probe(struct i2c_client *client) { struct regmap_irq_chip_data *irq_data; + struct device *dev = &client->dev; + struct regmap *regmap, *regmap2; + struct fwnode_handle *fwnode; + struct i2c_client *dummy; struct gpio_desc *reset; - int rc; - struct device *dev; - struct regmap *regmap; + char *name; + int ret; + + dummy = devm_i2c_new_dummy_device(dev, client->adapter, client->addr + 1); + if (IS_ERR(dummy)) { + ret = PTR_ERR(dummy); + dev_err(dev, "failed to claim second address: %d\n", ret); + return ret; + } + + regmap2 = devm_regmap_init_i2c(dummy, &qcom_mfd_regmap_cfg); + if (IS_ERR(regmap2)) + return PTR_ERR(regmap2); - dev = &client->dev; + ret = regmap_attach_dev(dev, regmap2, &pm8008_regmap_cfg_2); + if (ret) + return ret; + + /* Default regmap must be attached last. */ regmap = devm_regmap_init_i2c(client, &qcom_mfd_regmap_cfg); if (IS_ERR(regmap)) return PTR_ERR(regmap); @@ -177,14 +231,33 @@ static int pm8008_probe(struct i2c_client *client) */ usleep_range(1000, 2000); - if (of_property_read_bool(dev->of_node, "interrupt-controller")) { - rc = devm_regmap_add_irq_chip(dev, regmap, client->irq, + name = devm_kasprintf(dev, GFP_KERNEL, "%pOF-internal", dev->of_node); + if (!name) + return -ENOMEM; + + name = strreplace(name, '/', ':'); + + fwnode = irq_domain_alloc_named_fwnode(name); + if (!fwnode) + return -ENOMEM; + + ret = devm_add_action_or_reset(dev, devm_irq_domain_fwnode_release, fwnode); + if (ret) + return ret; + + ret = devm_regmap_add_irq_chip_fwnode(dev, fwnode, regmap, client->irq, IRQF_SHARED, 0, &pm8008_irq_chip, &irq_data); - if (rc) - dev_err(dev, "failed to add IRQ chip: %d\n", rc); + if (ret) { + dev_err(dev, "failed to add IRQ chip: %d\n", ret); + return ret; } - return devm_of_platform_populate(dev); + /* Needed by GPIO driver. */ + dev_set_drvdata(dev, regmap_irq_get_domain(irq_data)); + + return devm_mfd_add_devices(dev, PLATFORM_DEVID_AUTO, pm8008_cells, + ARRAY_SIZE(pm8008_cells), NULL, 0, + regmap_irq_get_domain(irq_data)); } static const struct of_device_id pm8008_match[] = { diff --git a/include/dt-bindings/mfd/qcom-pm8008.h b/include/dt-bindings/mfd/qcom-pm8008.h deleted file mode 100644 index eca9448df228..000000000000 --- a/include/dt-bindings/mfd/qcom-pm8008.h +++ /dev/null @@ -1,19 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Copyright (c) 2021 The Linux Foundation. All rights reserved. - */ - -#ifndef __DT_BINDINGS_MFD_QCOM_PM8008_H -#define __DT_BINDINGS_MFD_QCOM_PM8008_H - -/* PM8008 IRQ numbers */ -#define PM8008_IRQ_MISC_UVLO 0 -#define PM8008_IRQ_MISC_OVLO 1 -#define PM8008_IRQ_MISC_OTST2 2 -#define PM8008_IRQ_MISC_OTST3 3 -#define PM8008_IRQ_MISC_LDO_OCP 4 -#define PM8008_IRQ_TEMP_ALARM 5 -#define PM8008_IRQ_GPIO1 6 -#define PM8008_IRQ_GPIO2 7 - -#endif From patchwork Wed May 29 16:29:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 800051 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F05F1C9EAC; Wed, 29 May 2024 16:30:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717000236; cv=none; b=E+10WJ2Y3xXG+G3AcnICzJZ3/zFcJs1m/iAl447LhGq3rTidKOsvA6u3f17bsCkaD/nWs/LIO06+f2FtwibxZkRtS1FPunJU9TYJqljPUwoaMTz7ujHTUle2Cdc6c7OG4wY2Hkh3otKj1KGqM6uJWMTuiAviPpu2tv6L+Yx+tR8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717000236; c=relaxed/simple; bh=Ts9WiTi8n3Z0JGJ0fF0cdTHZghaqZY6W9ZGkIBz1Wc4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dCgsXJpYxs31wL+RcAZ42olEVW1LGjvO/tl0vnsedHSxFF8wemQWcq6HoJgROUYhWr+9/pkn9bRGDyzfq0eyp3+Yi41vDEvOfXPgRStXuVRdguUzfUH85gv52yek949eeQF+2Mg3U+BLy6dTWDsPvLtYhFS4fAbYL0tK9oHmMbM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BGd5yz77; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BGd5yz77" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50223C4AF11; Wed, 29 May 2024 16:30:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717000236; bh=Ts9WiTi8n3Z0JGJ0fF0cdTHZghaqZY6W9ZGkIBz1Wc4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BGd5yz77G0V3q4JwEhvcE+0wKmWWcANn1VbvwTKuUXMG8gkoxnJkl0lKHJKUBjL6Z HaXshgG3UjAt/4vzIjxcSZfLc2VPsibWDwDSB++moYh4jtb4hY/XJf+DKM5FdSJaX4 jL2tjclMG7VjfbpNWZenFjsm6aWY+xgMdH4JDJznp1oLEjUHQR7FVs9Ap/ueTHL2sF VISIIQK4g01nYfU8A12cM8Yc0vA98iHLlCL1S3D4Tv0IJF8GENin9EhGrX08p+F17q /1cyZJ2A+pIaJ0n6Y2/FjWmEv2XzxFyDm22haLx2lW/6wya32Wi3zS8EKBSNf6reAi z5cNRea9r+2Ug== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1sCMCC-000000004jE-1Upy; Wed, 29 May 2024 18:30:36 +0200 From: Johan Hovold To: Lee Jones , Mark Brown , Linus Walleij , Bjorn Andersson Cc: Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Liam Girdwood , Das Srinagesh , Satya Priya Kakitapalli , Stephen Boyd , Bryan O'Donoghue , Andy Shevchenko , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Johan Hovold Subject: [PATCH v2 13/14] regulator: add pm8008 pmic regulator driver Date: Wed, 29 May 2024 18:29:57 +0200 Message-ID: <20240529162958.18081-14-johan+linaro@kernel.org> X-Mailer: git-send-email 2.44.1 In-Reply-To: <20240529162958.18081-1-johan+linaro@kernel.org> References: <20240529162958.18081-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The Qualcomm PM8008 is an I2C-controlled PMIC containing seven LDO regulators. The driver is based on a driver submitted by Satya Priya, but it has been cleaned up and reworked to match the new devicetree binding which no longer describes each regulator as a separate device. This avoids describing internal details like register offsets in the devicetree and allows for extending the implementation with features like over-current protection without having to update the binding. Specifically note that the regulator interrupts are shared between all regulators. Note that the secondary regmap is looked up by name and that if the driver ever needs to be generalised to support regulators provided by the primary regmap (I2C address) such information could be added to the device-id table. This also fixes the original implementation, which looked up regulators by 'regulator-name' property rather than devicetree node name and which prevented the regulators from being named to match board schematics. Link: https://lore.kernel.org/r/1655200111-18357-8-git-send-email-quic_c_skakit@quicinc.com Cc: Satya Priya Kakitapalli Cc: Stephen Boyd Signed-off-by: Johan Hovold Reviewed-by: Mark Brown --- drivers/regulator/Kconfig | 7 + drivers/regulator/Makefile | 1 + drivers/regulator/qcom-pm8008-regulator.c | 198 ++++++++++++++++++++++ 3 files changed, 206 insertions(+) create mode 100644 drivers/regulator/qcom-pm8008-regulator.c diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index 7db0a29b5b8d..546533735be8 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig @@ -1027,6 +1027,13 @@ config REGULATOR_PWM This driver supports PWM controlled voltage regulators. PWM duty cycle can increase or decrease the voltage. +config REGULATOR_QCOM_PM8008 + tristate "Qualcomm PM8008 PMIC regulators" + depends on MFD_QCOM_PM8008 + help + Select this option to enable support for the voltage regulators in + Qualcomm PM8008 PMICs. + config REGULATOR_QCOM_REFGEN tristate "Qualcomm REFGEN regulator driver" depends on ARCH_QCOM || COMPILE_TEST diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile index 46fb569e6be8..0457b0925b3e 100644 --- a/drivers/regulator/Makefile +++ b/drivers/regulator/Makefile @@ -112,6 +112,7 @@ obj-$(CONFIG_REGULATOR_MT6380) += mt6380-regulator.o obj-$(CONFIG_REGULATOR_MT6397) += mt6397-regulator.o obj-$(CONFIG_REGULATOR_MTK_DVFSRC) += mtk-dvfsrc-regulator.o obj-$(CONFIG_REGULATOR_QCOM_LABIBB) += qcom-labibb-regulator.o +obj-$(CONFIG_REGULATOR_QCOM_PM8008) += qcom-pm8008-regulator.o obj-$(CONFIG_REGULATOR_QCOM_REFGEN) += qcom-refgen-regulator.o obj-$(CONFIG_REGULATOR_QCOM_RPM) += qcom_rpm-regulator.o obj-$(CONFIG_REGULATOR_QCOM_RPMH) += qcom-rpmh-regulator.o diff --git a/drivers/regulator/qcom-pm8008-regulator.c b/drivers/regulator/qcom-pm8008-regulator.c new file mode 100644 index 000000000000..da017c1969d0 --- /dev/null +++ b/drivers/regulator/qcom-pm8008-regulator.c @@ -0,0 +1,198 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2024 Linaro Limited + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#define DEFAULT_VOLTAGE_STEPPER_RATE 38400 + +#define LDO_STEPPER_CTL_REG 0x3b +#define STEP_RATE_MASK GENMASK(1, 0) + +#define LDO_VSET_LB_REG 0x40 + +#define LDO_ENABLE_REG 0x46 +#define ENABLE_BIT BIT(7) + +struct pm8008_regulator { + struct regmap *regmap; + struct regulator_desc desc; + unsigned int base; +}; + +struct pm8008_regulator_data { + const char *name; + const char *supply_name; + unsigned int base; + int min_dropout_uV; + const struct linear_range *voltage_range; +}; + +static const struct linear_range nldo_ranges[] = { + REGULATOR_LINEAR_RANGE(528000, 0, 122, 8000), +}; + +static const struct linear_range pldo_ranges[] = { + REGULATOR_LINEAR_RANGE(1504000, 0, 237, 8000), +}; + +static const struct pm8008_regulator_data pm8008_reg_data[] = { + { "ldo1", "vdd-l1-l2", 0x4000, 225000, nldo_ranges, }, + { "ldo2", "vdd-l1-l2", 0x4100, 225000, nldo_ranges, }, + { "ldo3", "vdd-l3-l4", 0x4200, 300000, pldo_ranges, }, + { "ldo4", "vdd-l3-l4", 0x4300, 300000, pldo_ranges, }, + { "ldo5", "vdd-l5", 0x4400, 200000, pldo_ranges, }, + { "ldo6", "vdd-l6", 0x4500, 200000, pldo_ranges, }, + { "ldo7", "vdd-l7", 0x4600, 200000, pldo_ranges, }, +}; + +static int pm8008_regulator_set_voltage_sel(struct regulator_dev *rdev, unsigned int sel) +{ + struct pm8008_regulator *preg = rdev_get_drvdata(rdev); + unsigned int mV; + __le16 val; + int ret; + + ret = regulator_list_voltage_linear_range(rdev, sel); + if (ret < 0) + return ret; + + mV = DIV_ROUND_UP(ret, 1000); + + val = cpu_to_le16(mV); + + ret = regmap_bulk_write(preg->regmap, preg->base + LDO_VSET_LB_REG, + &val, sizeof(val)); + if (ret < 0) + return ret; + + return 0; +} + +static int pm8008_regulator_get_voltage_sel(struct regulator_dev *rdev) +{ + struct pm8008_regulator *preg = rdev_get_drvdata(rdev); + unsigned int uV; + __le16 val; + int ret; + + ret = regmap_bulk_read(preg->regmap, preg->base + LDO_VSET_LB_REG, + &val, sizeof(val)); + if (ret < 0) + return ret; + + uV = le16_to_cpu(val) * 1000; + + return (uV - preg->desc.min_uV) / preg->desc.uV_step; +} + +static const struct regulator_ops pm8008_regulator_ops = { + .list_voltage = regulator_list_voltage_linear, + .set_voltage_sel = pm8008_regulator_set_voltage_sel, + .get_voltage_sel = pm8008_regulator_get_voltage_sel, + .enable = regulator_enable_regmap, + .disable = regulator_disable_regmap, + .is_enabled = regulator_is_enabled_regmap, +}; + +static int pm8008_regulator_probe(struct platform_device *pdev) +{ + const struct pm8008_regulator_data *data; + struct regulator_config config = {}; + struct device *dev = &pdev->dev; + struct pm8008_regulator *preg; + struct regulator_desc *desc; + struct regulator_dev *rdev; + struct regmap *regmap; + unsigned int val; + int ret, i; + + regmap = dev_get_regmap(dev->parent, "secondary"); + if (!regmap) + return -EINVAL; + + for (i = 0; i < ARRAY_SIZE(pm8008_reg_data); i++) { + data = &pm8008_reg_data[i]; + + preg = devm_kzalloc(dev, sizeof(*preg), GFP_KERNEL); + if (!preg) + return -ENOMEM; + + preg->regmap = regmap; + preg->base = data->base; + + desc = &preg->desc; + + desc->name = data->name; + desc->supply_name = data->supply_name; + desc->of_match = data->name; + desc->regulators_node = of_match_ptr("regulators"); + desc->ops = &pm8008_regulator_ops; + desc->type = REGULATOR_VOLTAGE; + desc->owner = THIS_MODULE; + + desc->linear_ranges = data->voltage_range; + desc->n_linear_ranges = 1; + desc->uV_step = desc->linear_ranges[0].step; + desc->min_uV = desc->linear_ranges[0].min; + desc->n_voltages = linear_range_values_in_range(&desc->linear_ranges[0]); + + ret = regmap_read(regmap, preg->base + LDO_STEPPER_CTL_REG, &val); + if (ret < 0) { + dev_err(dev, "failed to read step rate: %d\n", ret); + return ret; + } + val &= STEP_RATE_MASK; + desc->ramp_delay = DEFAULT_VOLTAGE_STEPPER_RATE >> val; + + desc->min_dropout_uV = data->min_dropout_uV; + + desc->enable_reg = preg->base + LDO_ENABLE_REG; + desc->enable_mask = ENABLE_BIT; + + config.dev = dev->parent; + config.driver_data = preg; + config.regmap = regmap; + + rdev = devm_regulator_register(dev, desc, &config); + if (IS_ERR(rdev)) { + ret = PTR_ERR(rdev); + dev_err(dev, "failed to register regulator %s: %d\n", + desc->name, ret); + return ret; + } + } + + return 0; +} + +static const struct platform_device_id pm8008_regulator_id_table[] = { + { "pm8008-regulator" }, + { } +}; +MODULE_DEVICE_TABLE(platform, pm8008_regulator_id_table); + +static struct platform_driver pm8008_regulator_driver = { + .driver = { + .name = "qcom-pm8008-regulator", + }, + .probe = pm8008_regulator_probe, + .id_table = pm8008_regulator_id_table, +}; +module_platform_driver(pm8008_regulator_driver); + +MODULE_DESCRIPTION("Qualcomm PM8008 PMIC regulator driver"); +MODULE_LICENSE("GPL"); From patchwork Wed May 29 16:29:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 800335 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F0A61C9EAD; Wed, 29 May 2024 16:30:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717000236; cv=none; b=FH5TqmmQI3oMb1mbIZ8wh4hxnftENw1FGldUuMnQiWHKBoFg0QVtrTK9vKom+Cu9bXhmfY9EwHZlS37S8jX0NZK0Y6ESwqf41Wzze56lEMy+mL72Z6ELC/aTCu+FTGhK7fMZ//INainSgakpxZ2YjdjTIeV2eJujdT0b8LkmEXA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717000236; c=relaxed/simple; bh=S6aeLtZ42VmRPSWmwBSU9jwSLOYm/1m5zx2/rVNYkTQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GVvHCMPiCubk23qtGhy138xDP4UvM7sbOFNeZi7GNSpXJOL94o9hJYAlMzxq3ynuNY8WnlC8RTzBKoXXcmDQSJf/vKkaNQgnDnaJ6HsyAxMCyWyZ01nXdtok4zPfmlkQ1MvfZNKS8n5nAxx6CpxPswOfzkNx8uCa1DzjQVU3bIo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eM8qB6El; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="eM8qB6El" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79D25C116B1; Wed, 29 May 2024 16:30:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717000236; bh=S6aeLtZ42VmRPSWmwBSU9jwSLOYm/1m5zx2/rVNYkTQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eM8qB6ElvIIDWQkOLsl3ARiA5/b7a62/sr6Zioe7lvAiQImQeuiVPxI2VMN2vPq3e r/o6mGoyOexMHyhkAK+QL1wDPVAKcFh3n1l1QcCGbYLyijE5WNi0k77NaT1W5BmhRf QIr+cI9af7q2zfLrH1w7Vk4NJwILsO519a2Gqk+7lri5LgcFyiY5qq+XHY9qODlFoi Gcf+I0OIF7oYdY0FSnXStwhn9suzle1RsXk6vfFI2nHlrTbMUzlqEGi+x3TfSzZt5X /zpmxTHpmS11juaAgfAdOxIxUGnwpcixO7inolXdxwJZITPoyD/fod8PNCKIniyYPG C1iONtL5R9Llg== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1sCMCC-000000004jH-1qP2; Wed, 29 May 2024 18:30:36 +0200 From: Johan Hovold To: Lee Jones , Mark Brown , Linus Walleij , Bjorn Andersson Cc: Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Liam Girdwood , Das Srinagesh , Satya Priya Kakitapalli , Stephen Boyd , Bryan O'Donoghue , Andy Shevchenko , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Johan Hovold Subject: [PATCH v2 14/14] arm64: dts: qcom: sc8280xp-x13s: enable pm8008 camera pmic Date: Wed, 29 May 2024 18:29:58 +0200 Message-ID: <20240529162958.18081-15-johan+linaro@kernel.org> X-Mailer: git-send-email 2.44.1 In-Reply-To: <20240529162958.18081-1-johan+linaro@kernel.org> References: <20240529162958.18081-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Enable the PM8008 PMIC which is used to power the camera sensors. Reviewed-by: Bryan O'Donoghue Tested-by: Bryan O'Donoghue Signed-off-by: Johan Hovold --- .../qcom/sc8280xp-lenovo-thinkpad-x13s.dts | 123 ++++++++++++++++++ 1 file changed, 123 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts index 98c1b75513be..93a44f803e8d 100644 --- a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts +++ b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts @@ -295,6 +295,27 @@ linux,cma { }; thermal-zones { + pm8008-thermal { + polling-delay-passive = <100>; + polling-delay = <0>; + + thermal-sensors = <&pm8008>; + + trips { + trip0 { + temperature = <95000>; + hysteresis = <0>; + type = "passive"; + }; + + trip1 { + temperature = <115000>; + hysteresis = <0>; + type = "critical"; + }; + }; + }; + skin-temp-thermal { polling-delay-passive = <250>; polling-delay = <0>; @@ -669,6 +690,85 @@ touchscreen@10 { }; }; +&i2c11 { + clock-frequency = <400000>; + + pinctrl-names = "default"; + pinctrl-0 = <&i2c11_default>; + + status = "okay"; + + pm8008: pmic@c { + compatible = "qcom,pm8008"; + reg = <0xc>; + + interrupts-extended = <&tlmm 41 IRQ_TYPE_EDGE_RISING>; + reset-gpios = <&tlmm 42 GPIO_ACTIVE_LOW>; + + vdd-l1-l2-supply = <&vreg_s11b>; + vdd-l3-l4-supply = <&vreg_bob>; + vdd-l5-supply = <&vreg_bob>; + vdd-l6-supply = <&vreg_bob>; + vdd-l7-supply = <&vreg_bob>; + + pinctrl-names = "default"; + pinctrl-0 = <&pm8008_default>; + + gpio-controller; + #gpio-cells = <2>; + gpio-ranges = <&pm8008 0 0 2>; + + interrupt-controller; + #interrupt-cells = <2>; + + #thermal-sensor-cells = <0>; + + regulators { + vreg_l1q: ldo1 { + regulator-name = "vreg_l1q"; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1200000>; + }; + + vreg_l2q: ldo2 { + regulator-name = "vreg_l2q"; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1200000>; + }; + + vreg_l3q: ldo3 { + regulator-name = "vreg_l3q"; + regulator-min-microvolt = <2800000>; + regulator-max-microvolt = <2800000>; + }; + + vreg_l4q: ldo4 { + regulator-name = "vreg_l4q"; + regulator-min-microvolt = <2800000>; + regulator-max-microvolt = <2800000>; + }; + + vreg_l5q: ldo5 { + regulator-name = "vreg_l5q"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + }; + + vreg_l6q: ldo6 { + regulator-name = "vreg_l6q"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + }; + + vreg_l7q: ldo7 { + regulator-name = "vreg_l7q"; + regulator-min-microvolt = <2800000>; + regulator-max-microvolt = <2800000>; + }; + }; + }; +}; + &i2c21 { clock-frequency = <400000>; @@ -1367,6 +1467,13 @@ i2c4_default: i2c4-default-state { bias-disable; }; + i2c11_default: i2c11-default-state { + pins = "gpio18", "gpio19"; + function = "qup11"; + drive-strength = <16>; + bias-disable; + }; + i2c21_default: i2c21-default-state { pins = "gpio81", "gpio82"; function = "qup21"; @@ -1470,6 +1577,22 @@ wake-n-pins { }; }; + pm8008_default: pm8008-default-state { + int-pins { + pins = "gpio41"; + function = "gpio"; + drive-strength = <2>; + bias-pull-down; + }; + + reset-n-pins { + pins = "gpio42"; + function = "gpio"; + drive-strength = <2>; + bias-disable; + }; + }; + spkr_1_sd_n_default: spkr-1-sd-n-default-state { perst-n-pins { pins = "gpio178";