From patchwork Mon May 6 15:08:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 13655617 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 32206153BF9; Mon, 6 May 2024 15:10:15 +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=1715008215; cv=none; b=jk8QByY5gDRy/MM46zWGVi+Hi4EdahTJPiWGKFt7qJaVTkHiIB4jn8n07Z+Kq3K2fFh+AYCG1RF9URzSf85YwGlOYD5aHw1cWE3A0F1PytCLA6JMyvotHj871MGTlACn5elCKZb0T+xroE0gbtXIoP1iAQqMvLWgWP1YnOEQHqc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715008215; c=relaxed/simple; bh=523LXoj0Pt0fxaIsf7xGgfx1SdV1yqQtWQ+gVfyEBww=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fjzxj1W6XrCthqTfHW9/LmCfnU1LZxGOBGfvsoJyBi9NZKWiw6XX61DC136vYRxOyjR4kIythXQ7UNDEiPjRuS2PKQSVQt3VNzht+AwL2DNqyNjggezdbbavmJKzWpfgA9DC6nurqCOYhOjYX1oI0MuegU7t6fBPBLO2HFUNqUw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=h6jRkwCk; 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="h6jRkwCk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B982DC4AF63; Mon, 6 May 2024 15:10:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715008214; bh=523LXoj0Pt0fxaIsf7xGgfx1SdV1yqQtWQ+gVfyEBww=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h6jRkwCkjX2psYHpb3IXCM7OIFfYeQtHB0ufepMTkeQhjAwsBv7TmxEdRX5Ih2Jpd +R38zHB63Qel0c5KyJR1YPPOvtYDWmFiDS7E42W6CjrIy928M1wXwyXI9pPCeH+UMz IELi3k88Fo7fcouxmZmGAs2SnzAmRPU6kP1qWGACB5qQ0wTCUIN9CIqPS/emnXTxLa 8yb9YwGhtDFUsOxWCv+oNyHdwTAuTxBMNx03d5erLemVMHgCzZn1JhTp6easgHAG6F iTW7I74SViMUQVgYzpWonMehjlj9LUaVTlZDuXyZXsBsg3v5MfJ3n2tjZ89WRKbAPf pa8NEZFPWgLww== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1s3zyp-000000006C9-3lxB; Mon, 06 May 2024 17:10:15 +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 , Stephen Boyd , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Johan Hovold Subject: [PATCH 01/13] dt-bindings: mfd: pm8008: add reset gpio Date: Mon, 6 May 2024 17:08:18 +0200 Message-ID: <20240506150830.23709-2-johan+linaro@kernel.org> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240506150830.23709-1-johan+linaro@kernel.org> References: <20240506150830.23709-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Describe the optional reset gpio (which may not be wired up). Signed-off-by: Johan Hovold Reviewed-by: Krzysztof Kozlowski Reviewed-by: Stephen Boyd Reviewed-by: Linus Walleij --- 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 Mon May 6 15:08:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 13655615 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 3218215359F; Mon, 6 May 2024 15:10:15 +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=1715008215; cv=none; b=uKp73a9814zQTAYj5TX1jTNQxrIi280/LdKIMWJZRjJSLR1yaSKGCLauQc6CovZDCA2Gg+F40tD8Ow9lZS9Vsq6uIEx7+yQtAXn7fp2NNC/g5CEe/p4FARUmrXPB7cFJpF3I1p4vCeIVyZZraFpa5Cj5KZSe/APMsg/z/CwcAVc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715008215; c=relaxed/simple; bh=Wuk22wlBQckYaKY1MQvvxaDZ5/OzjHLdVhwSrf/Ys6E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=N09rswsrF+zhk2qF4zF5rb8DL3vtOZfw6BjGJyPweyh9u/K1twpfFx5SVQeibXvZzFRpY2I2vkISTvDZktlt2ejb/A1z0Ooe8gJtHh40Cp52Cnx8h164SPyfJQmbqKKXWm9lyP13c4/J5jUEjK/amv3QQ7jMvi77Za1hm6hTF6o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jNWS0c7A; 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="jNWS0c7A" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE8B2C4AF68; Mon, 6 May 2024 15:10:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715008214; bh=Wuk22wlBQckYaKY1MQvvxaDZ5/OzjHLdVhwSrf/Ys6E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jNWS0c7A2MtlH5FWua/YmeJWdwguEgdt3iAsXT8ulGsXej5N4u+NDtwOKva93TXa9 Uq/cOT00nLHdD8QA2jX+eS6/ITnjjxiFOD7kd6IRcG+R7x+YS30C8lbNLpXqlVI5gw YbiJjZV8Iarvmk4z68Y9GW/Oaj3bAmYx/R6HQ43sS6Abk7kFPJTQ+G5Wz7/3I028IF VSYmHTEtPLuRilRQFwQ5+gUJ2292ib2xRfVRxNIUxGghW5xqReR9RGa7RZwHbL5OB1 GLEqcRfkAMRK8BTi9Q5F4+DJqJqFmKmoOaTfzY4DhM7yE3XiqHhiknGIAl8jLh25ix YubgIJO2T9U1Q== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1s3zyp-000000006CB-49HO; Mon, 06 May 2024 17:10:16 +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 , Stephen Boyd , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Johan Hovold Subject: [PATCH 02/13] mfd: pm8008: fix regmap irq chip initialisation Date: Mon, 6 May 2024 17:08:19 +0200 Message-ID: <20240506150830.23709-3-johan+linaro@kernel.org> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240506150830.23709-1-johan+linaro@kernel.org> References: <20240506150830.23709-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-arm-msm@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 --- drivers/mfd/qcom-pm8008.c | 66 +++++++++++++++------------------------ 1 file changed, 25 insertions(+), 41 deletions(-) diff --git a/drivers/mfd/qcom-pm8008.c b/drivers/mfd/qcom-pm8008.c index 3ac3742f438b..d53c987b0d49 100644 --- a/drivers/mfd/qcom-pm8008.c +++ b/drivers/mfd/qcom-pm8008.c @@ -56,15 +56,27 @@ 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), \ + }, \ + } + +#define _IRQ_TYPE_ALL (IRQ_TYPE_EDGE_BOTH | IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW) + +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_ALL), + _IRQ(PM8008_IRQ_GPIO1, PM8008_GPIO1, BIT(0), _IRQ_TYPE_ALL), + _IRQ(PM8008_IRQ_GPIO2, PM8008_GPIO2, BIT(0), _IRQ_TYPE_ALL), }; static const unsigned int pm8008_periph_base[] = { @@ -143,38 +155,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 +170,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 Mon May 6 15:08:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 13655622 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 7B4F615533B; Mon, 6 May 2024 15:10:15 +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=1715008215; cv=none; b=Has7jwBuG0EGIgNHyS5ntO2vab0xhPpkVmF96/dSasTbNc1gshbUcqS9Wx475OnFEyjHh3aLypLarMpbmK3+j2tdU0WqQPqCKa08yuVGoI2QO750j1d7eVGM5137/9G/FnJU9kfuE+xT2//71TryucvOR5kwh26N4s5tO5e9dNg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715008215; c=relaxed/simple; bh=HmGUGhnzq6QWX6rTJF28CKXiwTy0X3WDlAtZACUyhGs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rmxVa+OlYYoMMwgNkHKQvARPjCiM3MpHvj3mzSsAbiqRbzep835XY8HgSy1P/jdGaAVnGsFvaS7qcB+lUPCPC6l8G/mwuVpCMi55HANENBmie1l/ST/mqHToFarUDNrf+JBttIGR/QWbX4hnGuaXdHYn1P95r2ijOa9/FCdMXjw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Cn4l2ry0; 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="Cn4l2ry0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC291C4DDE3; Mon, 6 May 2024 15:10:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715008214; bh=HmGUGhnzq6QWX6rTJF28CKXiwTy0X3WDlAtZACUyhGs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cn4l2ry0hKT6yqFRwCGAXb20eJaRxo8ufaXe1rq3p25aXgXmMSXuQxsFcJVw1EBMi m/4k1KXL0hfWhHM5Yxohn/ZexZuaIcadzmh/Qp1/jW1vkmaNNbsfVvinsv2OKNznQ8 P2fzeBtQ7miyec2PfOEZ+z95Fpmjj0L0U7Tv+VT4AvA9llvYfkXoAGfGLtuZNt2ITq m2PaWC9PU8tDkafOWoSfuPhxJPVJmiU/rbzraFwNJDsYiYJXLmAW5LS1TsYgdnu81x +t5zksOxwU1xMQIhbzIcwBT5Cmh+YI49FWJjn0W4seekphkYUo6lWVvuH9KeRIsP95 M2hTBEhF8TC4A== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1s3zyq-000000006CD-0KE4; Mon, 06 May 2024 17:10:16 +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 , Stephen Boyd , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Johan Hovold Subject: [PATCH 03/13] mfd: pm8008: deassert reset on probe Date: Mon, 6 May 2024 17:08:20 +0200 Message-ID: <20240506150830.23709-4-johan+linaro@kernel.org> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240506150830.23709-1-johan+linaro@kernel.org> References: <20240506150830.23709-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-arm-msm@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. Signed-off-by: Johan Hovold Tested-by: Bryan O'Donoghue Reviewed-by: Bryan O'Donoghue Reviewed-by: Linus Walleij --- drivers/mfd/qcom-pm8008.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/mfd/qcom-pm8008.c b/drivers/mfd/qcom-pm8008.c index d53c987b0d49..d0f190c2ea2b 100644 --- a/drivers/mfd/qcom-pm8008.c +++ b/drivers/mfd/qcom-pm8008.c @@ -4,6 +4,7 @@ */ #include +#include #include #include #include @@ -158,6 +159,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; @@ -169,6 +171,10 @@ 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); + 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 Mon May 6 15:08:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 13655624 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 7CBDE155341; Mon, 6 May 2024 15:10:15 +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=1715008215; cv=none; b=jv6MocxXT2T2N/jSvnFAjhwJoVTijiEtLAzB7BnPznWYO5oGNT+EkOWnVgfaBcfGuItwTYUj6jZP4llMTmbjQxT2yf6NIaRyQbheG4d8Gk1NH/yytRxRrKXj4SDZeA3phd24nZSeW3gMfB+JNbTOxVN2KFfRa35pCds/IBPLUKU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715008215; c=relaxed/simple; bh=WE6fiiBRXkuvD5QoFFN6grCsQPErDYZqFjeNOGTsme8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Obc8rJfCM9llb36q5yTOf6TTZtmqeVs7u7QdyVmxC/VkWxaiHjMZUhWIaWdplTfSOLSRSAVVQH5iJHr7GCa62cewaeE6BpCmMGQyIGJu21oIyt3+faUIBwRr3AXqG0wOToyRV0K4SsDF+Iwc+2/jS0E04A1yYJFoL5aIKaDGAwI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=O9eQ1sU3; 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="O9eQ1sU3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C98C7C4DDE0; Mon, 6 May 2024 15:10:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715008214; bh=WE6fiiBRXkuvD5QoFFN6grCsQPErDYZqFjeNOGTsme8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O9eQ1sU3y8iRZaa55hQUp+u8QHHIElfOLFNPrXhYMn8oNWIfZXJFvT45rp/W4Y9MQ 33rq2nddVU2v0apc3klXXTUZShxvfEWB9Va5xuo37c3EinT7kqslTlSYyGa8OuHX6S zJO6vvQLRcxDu0geIo7a9iPVZGCcVsA/fj85EbR9sZMHQvs6cYb2m+zZjdrh2o+E2X 4eRHFt7p7YV+hbW6OVvTp3n2A6TtsaCqLfbLVL5+LuOrfsaEdqXNjNi2eUfvChk87d VItoLd7NXWQwDtyjWC2tPDxX90inkqXcEZ5+OGkTTbDaUzmvrh1v+gBq5DYfLh9iFS Z2ZZW3w83VQEQ== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1s3zyq-000000006CF-0ekN; Mon, 06 May 2024 17:10:16 +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 , Stephen Boyd , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Johan Hovold Subject: [PATCH 04/13] mfd: pm8008: mark regmap structures as const Date: Mon, 6 May 2024 17:08:21 +0200 Message-ID: <20240506150830.23709-5-johan+linaro@kernel.org> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240506150830.23709-1-johan+linaro@kernel.org> References: <20240506150830.23709-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-arm-msm@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. Signed-off-by: Johan Hovold Reviewed-by: Bryan O'Donoghue Reviewed-by: Stephen Boyd --- 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 d0f190c2ea2b..42dd4bf039c9 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, @@ -131,7 +131,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 Mon May 6 15:08:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 13655619 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 5B774154BE9; Mon, 6 May 2024 15:10:15 +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=1715008215; cv=none; b=LCCXBx1kg5hL0VJePBJIssDbwP4SdwCCSQjKrQ3c+KnuZrklQFwRjg5NwNii0lSJuH+cB9+sjw5Yfnp/OBk8uq6X0y91Yt6xZ3K9Nbst07xZVrX6882Nnra3i3FYTRKoGzRjvijprBmtxZFs8LF3IZpOXuPZ4rB7fCICkJT2lO0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715008215; c=relaxed/simple; bh=HhlLnCR9F5J17LJe4ADpdzxAsvlsyae/fKK3YJPeBm8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QSaOypagbCm+EGMUl6TqtUlnSQzcCw1qrFv7RL2kgoFls9thoDni7ellV1b8uzNl5419MhTHkpMH8XJ1dYv9VwovtbOmMLjjn72andcNRiZUX/B/vtFI80AChlf+q8tK5KnZSuhTLhTgKMUUm25Bb25fZ6b9XzejP7Y3GCEOhns= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VNDhr/bo; 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="VNDhr/bo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2D1DC4AF67; Mon, 6 May 2024 15:10:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715008214; bh=HhlLnCR9F5J17LJe4ADpdzxAsvlsyae/fKK3YJPeBm8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VNDhr/bodaRVN3PneIIGwUtSGZse8FFNzIApL4G3CurQ+0bJOKVu2Y1w79zvtr38o l5Zn5c5vdA+SAKEm9+DSXnByXjUX1t8jTEiN1Jr5C1WYNeq9yOLTLLblHM8K24UIJw Adqc1/XZXVIp09CdXQWjn29bmjIydQ4m7+65gGUysvfSXRuTLwUl7Quz/Kdl9p+Uhj 2itJyVHnkT2EbVjXVPNAbxWmS73vN11JeSnkIHIxseDNcILfwYBYuAiFJSv59O5FG3 sOBa8KK5baE9+D3vegG46MWopVVFC3t9Uuy24snTUi0mjomct1jgZAFHg2zB77bNyQ zHe3bu7Ov24fg== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1s3zyq-000000006CH-0yFM; Mon, 06 May 2024 17:10:16 +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 , Stephen Boyd , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Johan Hovold Subject: [PATCH 05/13] mfd: pm8008: use lower case hex notation Date: Mon, 6 May 2024 17:08:22 +0200 Message-ID: <20240506150830.23709-6-johan+linaro@kernel.org> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240506150830.23709-1-johan+linaro@kernel.org> References: <20240506150830.23709-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Use lower case hex notation for consistency. Signed-off-by: Johan Hovold Reviewed-by: Bryan O'Donoghue Reviewed-by: Stephen Boyd --- 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 42dd4bf039c9..f1c68b3da1b6 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 @@ -153,7 +153,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 Mon May 6 15:08:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 13655618 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 32246154433; Mon, 6 May 2024 15:10:15 +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=1715008215; cv=none; b=n8PVdDFoktg/p5qoqL/4FYI6Rn62PJZPB61mEY1NFLwHaPuQ0uiIa82aSnNjVwvml+fslqIWZDvzBvUFEIJEgGOAR4T9to4VFzCcoE6lY7WsnkB8NbLGT+50Q6j1iA7NMLu2hvqj2yp8sa/PB/6gdiMb7oow9exbO9yex1QkcNg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715008215; c=relaxed/simple; bh=3KIBPMYxlsik6cDO7/GK2sOz5yizOcMa7uM6iabiCx0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dHESxMpkXwfP81nYrDmbVaD5Dd1vwWvBzqeyMUsa0yzeaIjcArDj+cjPXj/ap+lNuFiy0SleH/yMeSQDsi1NdCbDJoeAM2gRzOx9QEI5BRXdgBylYeFCXQdapyC+h1jbakmHxv1QiDEke+MtE5g61vVRYUwR/BnvskuzhdJYA2g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oEyNIng4; 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="oEyNIng4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6C1DC116B1; Mon, 6 May 2024 15:10:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715008214; bh=3KIBPMYxlsik6cDO7/GK2sOz5yizOcMa7uM6iabiCx0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oEyNIng402YHRxPlGaux4wtc6byOacBpT2TD/+MAtwuIo3Auy62aVEL7Ku2Ls04Fs uy6TPAgFtpUy2IsqE5wih9EtCNaV9MyjhpGSMEKpi3SgkMDoWds/aerxEXL93dsX58 3LNrXKrCWIEZms6W5J8DL3Ssy1QGFsEotSOqaKpdRayBsqDZAdF7/Ly3Jvognft1hB ZyD+xjSadQUIULRQBjIFmZbjTGtPVbleTlnxOJJ3w0gEkgaGb02MedQlM6XjceOdXG 1Vb7X6FWdGS8Zu8MwbHx0R7GglHmj/e8fZgLn/tvgBYzBoOM/m3Dc91zDZZVXHI2HY lntu2czvaeByA== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1s3zyq-000000006CJ-1Guc; Mon, 06 May 2024 17:10:16 +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 , Stephen Boyd , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Johan Hovold Subject: [PATCH 06/13] mfd: pm8008: rename irq chip Date: Mon, 6 May 2024 17:08:23 +0200 Message-ID: <20240506150830.23709-7-johan+linaro@kernel.org> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240506150830.23709-1-johan+linaro@kernel.org> References: <20240506150830.23709-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Drop the redundant "irq" suffix from the irq chip name. Signed-off-by: Johan Hovold Reviewed-by: Bryan O'Donoghue Reviewed-by: Stephen Boyd --- 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 f1c68b3da1b6..a04bae52a49a 100644 --- a/drivers/mfd/qcom-pm8008.c +++ b/drivers/mfd/qcom-pm8008.c @@ -132,7 +132,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 Mon May 6 15:08:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 13655623 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 79E5F15533A; Mon, 6 May 2024 15:10:15 +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=1715008215; cv=none; b=Frs6aNgDPCCTVOGODj2IOLF4ltJDoRTjrNAa0pN/O0yzckQqT9JMOiFjr2ocCjRuoxytoV/5IQMYgsq/ri8hPI6nI4nThuyStpdRr9TEnQHb/EhUWswhnPuvv/rqUJ5pKHCtQxcWXlzchIFrc5sUr8dJ6yvjneA6Jlw6c79KBMA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715008215; c=relaxed/simple; bh=3nHjQ8geF8c61rNg0mCqn4/A6dXpqr7qrJ7QmC0179I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=e5AHH2sQQcMGkJ516CXVIK9994Rgp/Pu8zGji6/1408joATsfqoCUYIDcb8nCjjJl3TfFG+zMfCtU7JdA0+huXlYjGa/e5wLMu9jTMCXHlm50lr4v4eNxYZHJQRaTLqo+cXbMWxO7GHoptMZXEyB7JxSnbOjMzZb01VxbxOA+sQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cfJ56tuA; 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="cfJ56tuA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF2F7C4DDE2; Mon, 6 May 2024 15:10:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715008214; bh=3nHjQ8geF8c61rNg0mCqn4/A6dXpqr7qrJ7QmC0179I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cfJ56tuAN5FTksuu5gk/A3vUZlyYzTzIsNZVIsRwPooHWxtQMVjgufOkiYg5njjyq 0Vp4OHdFyLZaeatEIa943wEvB4T2brHNifoYIv0DCncnt3dk8dR69/1mYTTSXsEI4A +7xLYpHYHyvzSrn2FcXHO72NXW65s23dPmz2ipv5gb5MDdaau4QqF4SgUXxmC7zp0W MPQOwbl+W0E80PGzGyKP0iWmP12A2QpdktKesXsuXpbhc7BpV1WjSjKTCVU6NTTsvH qMoZIXrzvrVpIzSZ2GhBOZ96TlRB0P8On3dthqYqt1xHbj8fm0knfO/x9CUYhol+FH plMro2YdeN7IA== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1s3zyq-000000006CL-1a1f; Mon, 06 May 2024 17:10:16 +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 , Stephen Boyd , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Johan Hovold Subject: [PATCH 07/13] mfd: pm8008: drop unused driver data Date: Mon, 6 May 2024 17:08:24 +0200 Message-ID: <20240506150830.23709-8-johan+linaro@kernel.org> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240506150830.23709-1-johan+linaro@kernel.org> References: <20240506150830.23709-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-arm-msm@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. Signed-off-by: Johan Hovold Reviewed-by: Bryan O'Donoghue Reviewed-by: Stephen Boyd --- 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 a04bae52a49a..c7a4f8a60cd4 100644 --- a/drivers/mfd/qcom-pm8008.c +++ b/drivers/mfd/qcom-pm8008.c @@ -169,8 +169,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 Mon May 6 15:08:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 13655616 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 321C815383A; Mon, 6 May 2024 15:10:15 +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=1715008215; cv=none; b=rchRXFdH1bzi+C0cf+Gk3KXckXanFqufwHoDfa3vYEertQsiEC/QtkfYkn7uMKc9ylNN8qI3PqYZPmNJpXIWxbVTwVar4WvSF4edvpy1T07E8F2R2XhKrtj8vnNobRG2gTqtUjC+W4MJBAZyLO2o2O26RYnQR/LmhbtNAj1l0eU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715008215; c=relaxed/simple; bh=qyD342BqfDOno7Fiw8o0i1cQm2xzwZ7rJO4LeMETBjc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=O6elTOLJstdi/fNiV2uj9Eax9I2mw/6FKwMUsaRDg+NqzSjKBCvmcDSOWk9qJATFSOHv3k4PAvWbO7LlQUEXhuwwM4y9sk9+FOLmI3+d5NKFjrWgQPBErMfmNc8lIOakU0M/2H12FpDNP9y1yEl0+Qedpcokqjk8oPe0qUVVuA0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=B8W9RkQ2; 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="B8W9RkQ2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC10EC4AF66; Mon, 6 May 2024 15:10:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715008214; bh=qyD342BqfDOno7Fiw8o0i1cQm2xzwZ7rJO4LeMETBjc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B8W9RkQ2tyKuug618wjKuMW6ToJK9gNNwHMN2hirdxhilHeosoPeUqskvQ8UD9LbF CF+vojWNHg3nFGEnson136J13nggU+erTA0jsVMaQvySxw26FAi2W2nAZQz6VDw/p4 VzJiebGtUTh2JayQSPLBol/DxGwYl7bc7WqV44euKyE7rjQ2a8p9pnzPy0x4jES4z9 7f3qq33sJYAOx8gLUTMsND5T6f6alcdmaS3+91zaaF/+FMOmlG6WiwACAKs2jR3tmk 7lFLT7T1ou7lHa77WhTbUfmefT3eMSDe0vJvMDCopl5pT2LhTceeMGLLcWfpf51TSd LUyZcw2tXiLDg== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1s3zyq-000000006CN-1uiB; Mon, 06 May 2024 17:10:16 +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 , Stephen Boyd , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Johan Hovold Subject: [PATCH 08/13] dt-bindings: pinctrl: qcom,pmic-gpio: drop pm8008 Date: Mon, 6 May 2024 17:08:25 +0200 Message-ID: <20240506150830.23709-9-johan+linaro@kernel.org> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240506150830.23709-1-johan+linaro@kernel.org> References: <20240506150830.23709-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-arm-msm@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. Signed-off-by: Johan Hovold Reviewed-by: Stephen Boyd --- 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 Mon May 6 15:08:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 13655620 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 76F5B155336; Mon, 6 May 2024 15:10:15 +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=1715008215; cv=none; b=D5ur/YhYk8qOIJcE0BVkZ3PgQhfMGMcZKEB/o/lcfeZX2oJ3tMeSm/e+6jegis4S2iJFTs5WAFiZp6NFk1lh7FlVqU9fEW2HlB/tEr82f2MaiiaIVTlg+6eyfSf7TTQsWfo8O2eCSTX+LRfM44QaLQ+OE3761hpWAlpIGmklXsE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715008215; c=relaxed/simple; bh=ysW2dfSlvMClvcrj43aokizS/K9NZ5GHVi4SudgETa0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=q1NOqUqYc0SkWdDgxQXKGpyR4qBypoCmedHfS9jJ2Shd+Fv+vgz94ehUegRmBte8tPlo6r7/AUwPVmAO3fajl7s4TltQIkqkNkoGdQNYNdvaL1/f8VzXXaNnj8NW7fs4NuZj6zr+IYAXuiUgfA0e3LEVP8i0iijiByqGNvUkl1g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PfR5drgW; 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="PfR5drgW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F4220C4DDFD; Mon, 6 May 2024 15:10:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715008215; bh=ysW2dfSlvMClvcrj43aokizS/K9NZ5GHVi4SudgETa0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PfR5drgW597jkO7PARyT6eQjHYQ9cnUHTy8i4JrrMV8+PnAjO+Zzwol8lzL4Tit5I oXDwZjot/WmMDmxolLhVlDWVmafDYu02txnCzojkBeKRL/PkzPHQySLVRoVxF+1/+J 39Uea5MJzS8QEgnzIp8L9lVa+9qxzmuEvTIXi0NLBOsP5xzsJ2vRm6pyW7OaTAD8Tq NConWcEdhGICWofjR3CRAhMK+uASZ5R0VLN3akWZyDwG1AhKepmGxdbOoNeBllDJ6c 5L7pfZKHPGsi73R5FhDrtJDvKTAYqrfLlCcO6dTDUj8LccERh1IE1pDUux/NDGop6M 24r+y+/r/6zhw== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1s3zyq-000000006CP-2KgO; Mon, 06 May 2024 17:10:16 +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 , Stephen Boyd , 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 09/13] pinctrl: qcom: spmi-gpio: drop broken pm8008 support Date: Mon, 6 May 2024 17:08:26 +0200 Message-ID: <20240506150830.23709-10-johan+linaro@kernel.org> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240506150830.23709-1-johan+linaro@kernel.org> References: <20240506150830.23709-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-arm-msm@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 Signed-off-by: Johan Hovold Reviewed-by: Bryan O'Donoghue Reviewed-by: Stephen Boyd --- 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 Mon May 6 15:08:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 13655621 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 725C615531D; Mon, 6 May 2024 15:10:15 +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=1715008215; cv=none; b=fv+/pE57d+EnnJJ3zwJ6Nn2JBn0mJjtOjNhCfvPJBzsZlQw2b3sTYrlXW4S3LDiPNxH2lRo0xkK56/UG6Nny17u2C17YCXjrHAupqvVLKmbTjL1iu3uSrqZJ0JHMRduFLXGmujkzaFkms/hwYhrtNADaFr4VyhTF4jXwnW+iM/E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715008215; c=relaxed/simple; bh=AkdkaR54sACrEoSvNXOHYSL1x8xDnc3d3gyuETl7sUU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VxAbrCLH2LHxcZRclCdILQTpD8nQVp8tqTg1Qh+h428lDiBnMmP/1NjGmCGjnBROVYCwZv1ePuTR3Ll1L2Eq7o1F7r88LLPZPrSIZcoWkoEspZr1r8v0l9r1NAkcB6NSY5abCCZAE6g/uvBKFxfhOiwPRmGcAB7mkiYNewmufbs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MIWaKCl7; 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="MIWaKCl7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4B5CC4DDF1; Mon, 6 May 2024 15:10:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715008215; bh=AkdkaR54sACrEoSvNXOHYSL1x8xDnc3d3gyuETl7sUU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MIWaKCl70QAmGJwYnzJ4aB9Bm4VHKlrVwiBBJVJ4Ag08l46Qn0GcZsIH1d2kUfxv7 GEJ0zt8mw9Y0ShewmqWl++sLpvQx4/rE4Sj+ms4nqOZdC0DMyGqYIJL3dTH7M+1Ojv ywHOlHJNM3YaSYZ7ozZz/jT/PgY3SnMYFxkvxIWDUYbG+xdf+mvwBLjISjqJBc8WSH CBzNNtX0qEwrkyfMrGOJt1mPZyn7sgYT2vGBgaAkQNnSWRyTjxj+vEfwHjFrLxNS3J H2an/u2fkk2SvNMXON25Dbdg0KYkuHM5gX7aVropoZteDfD3GYolBipKIRWiEg66m3 TYyvEtgaaWAgA== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1s3zyq-000000006CU-2jIX; Mon, 06 May 2024 17:10:16 +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 , Stephen Boyd , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Johan Hovold Subject: [PATCH 10/13] dt-bindings: mfd: pm8008: rework binding Date: Mon, 6 May 2024 17:08:27 +0200 Message-ID: <20240506150830.23709-11-johan+linaro@kernel.org> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240506150830.23709-1-johan+linaro@kernel.org> References: <20240506150830.23709-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-arm-msm@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 | 154 ++++++++++-------- 1 file changed, 90 insertions(+), 64 deletions(-) diff --git a/Documentation/devicetree/bindings/mfd/qcom,pm8008.yaml b/Documentation/devicetree/bindings/mfd/qcom,pm8008.yaml index e1e05921afb4..ac1bab0261b6 100644 --- a/Documentation/devicetree/bindings/mfd/qcom,pm8008.yaml +++ b/Documentation/devicetree/bindings/mfd/qcom,pm8008.yaml @@ -19,116 +19,142 @@ properties: const: qcom,pm8008 reg: - description: - I2C slave address. - maxItems: 1 interrupts: maxItems: 1 - description: Parent interrupt. - 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 Mon May 6 15:08:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 13655627 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 8843C15538A; Mon, 6 May 2024 15:10:15 +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=1715008215; cv=none; b=GL0tEjnMVwdsF6utk+55YH0j+NKzyzpkKQ3yf5oXvkcJsv6A+yeCCnRFqv1MaW+jLorTJC9jrN1U6qUTC3xdRZbmpPCr1HVXvm35JXJFefVZqELmVxNaOv07hd9wtlR/2VmCfGvm2Jv1++KVrHykFfzB/2EtXxammerdztCHqPU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715008215; c=relaxed/simple; bh=0aydgANvs4yyrVr15oY0u9/Cz+F+w2leBSDOWuTvRIw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pQVz7sN0NHoZS9qdLXOwzLzq1Sws8/FjE0xzYCv/iC8LI8z3XDexYQW21F7elsmlfXSm/kZqDMn3BYMsByayLtsn0s3RCi0vo5pq1s5001bZjhmslRCxH/Rz0COjlHmdzcBvxA4fCVEfF7YzQvHmePyWmkaSs+Fepm5JGgSW6Ic= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=I3+9ZDQx; 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="I3+9ZDQx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED81EC4DDF3; Mon, 6 May 2024 15:10:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715008215; bh=0aydgANvs4yyrVr15oY0u9/Cz+F+w2leBSDOWuTvRIw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I3+9ZDQxTUQU4/QDlDWt5c84d3lzqov+UO2P2mp2UaCyRFsUxyTa/qyxOomcVoBQW Hnv26uVKZXc8n5l8yIqSAF+d5iwPDI3RcnxTTMivQX3YMTqeP6wxyUjdQ9XgpUJm5z d2ev0bKTFKANLKLEwp7suZlomu0q00pIqAYvQNFU2gUgJ2DtXnQiG/KuwEKQSsrcpA BCmha3TvO8WTgwJqaBX+eHaQNwLGCmmXuq1On2FfWkA4Ova5No60ec/LLlDJoBiXJ5 AOMAc2gVka+DxYfYPeEFGIfHN6orM4ujF+pB+LTivy9aPFW4Y0aR+HepDlWKZeiXyn 2vMwmy98/F+CQ== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1s3zyq-000000006CZ-38WB; Mon, 06 May 2024 17:10:16 +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 , Stephen Boyd , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Johan Hovold Subject: [PATCH 11/13] mfd: pm8008: rework driver Date: Mon, 6 May 2024 17:08:28 +0200 Message-ID: <20240506150830.23709-12-johan+linaro@kernel.org> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240506150830.23709-1-johan+linaro@kernel.org> References: <20240506150830.23709-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-arm-msm@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 two). 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's returned by default when no name is provided in lookups. Finally, note that the current QPNP GPIO and temperature alarm subdrivers need some minor rework before they can be used with non-SPMI devices like the PM8008. The MFD cell names therefore use a "qpnp" rather than "spmi" prefix to prevent binding until the drivers have been updated. Signed-off-by: Johan Hovold Tested-by: Bryan O'Donoghue --- drivers/mfd/Kconfig | 1 + drivers/mfd/qcom-pm8008.c | 95 +++++++++++++++++++++++---- include/dt-bindings/mfd/qcom-pm8008.h | 19 ------ 3 files changed, 85 insertions(+), 30 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 c7a4f8a60cd4..706a725428dd 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, @@ -150,21 +160,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("qcom-pm8008-regulator"), + MFD_CELL_RES("qpnp-temp-alarm", pm8008_temp_res), + MFD_CELL_NAME("qpnp-gpio"), +}; + +static void devm_irq_domain_fwnode_release(void *res) +{ + struct fwnode_handle *fwnode = res; + + 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; + char *name; int rc; - struct device *dev; - struct regmap *regmap; - dev = &client->dev; + dummy = devm_i2c_new_dummy_device(dev, client->adapter, client->addr + 1); + if (IS_ERR(dummy)) { + rc = PTR_ERR(dummy); + dev_err(&client->dev, "failed to claim second address: %d\n", rc); + return rc; + } + + regmap2 = devm_regmap_init_i2c(dummy, &qcom_mfd_regmap_cfg); + if (IS_ERR(regmap2)) + return PTR_ERR(regmap2); + + rc = regmap_attach_dev(dev, regmap2, &pm8008_regmap_cfg_2); + if (rc) + return rc; + + /* Default regmap must be attached last. */ regmap = devm_regmap_init_i2c(client, &qcom_mfd_regmap_cfg); if (IS_ERR(regmap)) return PTR_ERR(regmap); @@ -173,14 +227,33 @@ static int pm8008_probe(struct i2c_client *client) if (IS_ERR(reset)) return PTR_ERR(reset); - 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; + + rc = devm_add_action_or_reset(dev, devm_irq_domain_fwnode_release, fwnode); + if (rc) + return rc; + + rc = 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 (rc) { + dev_err(dev, "failed to add IRQ chip: %d\n", rc); + return rc; } - 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 Mon May 6 15:08:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 13655628 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 A0D8C1553B5; Mon, 6 May 2024 15:10:15 +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=1715008215; cv=none; b=eCpdRQTT8eUOzBYHYOda1mzXF/YtT3TLvY+uNJMzp1JZdAQwyE0F6HrRsWZQPuBUs9nWnT7s4X3nKnU7pX9Ta3x0NUxOeJG/PKH/8V2nLZyg/TfEqv6X1wMkugZAAxlYOIUlcIRKeNRWQYnWcKDkhNdPbTdb+0Hpq8GcOQmyKFY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715008215; c=relaxed/simple; bh=IqN85Bl78UCzls1ZfaO48JRo5epr0gUY+Set+TiTF8A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OoyEur9/A7kTtFXtF/PONWdBAjwNLChOFB3f5/VQahmgA8q1aTdncLUqBrP2vOuodRy2Xw4iFGQM9jr8Ujoq75qSx3tkahzc1PH6MfppqLHqThlzIE3PmN85NCtp4OXBMvOmT+gup73K2j7hBBeR46zfhSy/m2gqkWshCTpXHTw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=C0aWDSPU; 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="C0aWDSPU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1FE5EC4DE16; Mon, 6 May 2024 15:10:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715008215; bh=IqN85Bl78UCzls1ZfaO48JRo5epr0gUY+Set+TiTF8A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C0aWDSPUkZim8kQ4VN+PAqAVqCdCFbyyorfBpkwmzkwXPrmKrDbdwSJzcHex7mnyG S499acB15z6WDY2unRXYX2z59ZaKKUCbl8H+Lo0V8hx0R9bnYdBvGb3Zo6WjsJtKZY 2FqNssm1S+d0aIp8SPv3EQjX4r33mDOxPa4zRR9Vr9dPJ1dDbB1CD/IQ9LxtoumsiV egC0FLgeZPX7ahZddbZpvcfWh+7vfcNJjpQ92MGQjfMGNUi5DhRHTtoPzVOukIsnT4 OQTRoc8V9A2hmMT/AaWnn+35gV1VxGKtV6zJqDmutIvBY/l9FL+XFag4eiG8EyZOVq lh8PYArFDDcHA== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1s3zyq-000000006Cd-3U7A; Mon, 06 May 2024 17:10:16 +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 , Stephen Boyd , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Johan Hovold Subject: [PATCH 12/13] regulator: add pm8008 pmic regulator driver Date: Mon, 6 May 2024 17:08:29 +0200 Message-ID: <20240506150830.23709-13-johan+linaro@kernel.org> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240506150830.23709-1-johan+linaro@kernel.org> References: <20240506150830.23709-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Satya Priya Qualcomm Technologies, Inc. PM8008 is an I2C-controlled PMIC containing seven LDO regulators. Add a PM8008 regulator driver to support PMIC regulator management via the regulator framework. Note that this driver, originally submitted by Satya Priya [1], has been 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 a driver lookup table matching on the parent compatible. 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. [1] https://lore.kernel.org/r/1655200111-18357-8-git-send-email-quic_c_skakit@quicinc.com Signed-off-by: Satya Priya Cc: Stephen Boyd [ johan: rework probe to match new binding, amend commit message and Kconfig entry] Signed-off-by: Johan Hovold Tested-by: Bryan O'Donoghue Acked-by: Krzysztof Kozlowski --- drivers/regulator/Kconfig | 7 + drivers/regulator/Makefile | 1 + drivers/regulator/qcom-pm8008-regulator.c | 215 ++++++++++++++++++++++ 3 files changed, 223 insertions(+) create mode 100644 drivers/regulator/qcom-pm8008-regulator.c diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index 7db0a29b5b8d..d07d034ef1a2 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 Technologies, Inc. PM8008 PMIC regulators" + depends on MFD_QCOM_PM8008 + help + Select this option to enable support for the voltage regulators in + Qualcomm Technologies, Inc. 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..51f1ce5e043c --- /dev/null +++ b/drivers/regulator/qcom-pm8008-regulator.c @@ -0,0 +1,215 @@ +// 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. + */ + +#include +#include +#include +#include +#include +#include +#include + +#define VSET_STEP_MV 8 +#define VSET_STEP_UV (VSET_STEP_MV * 1000) + +#define LDO_ENABLE_REG(base) ((base) + 0x46) +#define ENABLE_BIT BIT(7) + +#define LDO_VSET_LB_REG(base) ((base) + 0x40) + +#define LDO_STEPPER_CTL_REG(base) ((base) + 0x3b) +#define DEFAULT_VOLTAGE_STEPPER_RATE 38400 +#define STEP_RATE_MASK GENMASK(1, 0) + +#define NLDO_MIN_UV 528000 +#define NLDO_MAX_UV 1504000 + +#define PLDO_MIN_UV 1504000 +#define PLDO_MAX_UV 3400000 + +struct pm8008_regulator_data { + const char *name; + const char *supply_name; + u16 base; + int min_dropout_uv; + const struct linear_range *voltage_range; +}; + +struct pm8008_regulator { + struct regmap *regmap; + struct regulator_desc rdesc; + u16 base; + int step_rate; +}; + +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 reg_data[] = { + /* name parent base headroom_uv voltage_range */ + { "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_get_voltage(struct regulator_dev *rdev) +{ + struct pm8008_regulator *pm8008_reg = rdev_get_drvdata(rdev); + __le16 mV; + int uV; + + regmap_bulk_read(pm8008_reg->regmap, + LDO_VSET_LB_REG(pm8008_reg->base), (void *)&mV, 2); + + uV = le16_to_cpu(mV) * 1000; + return (uV - pm8008_reg->rdesc.min_uV) / pm8008_reg->rdesc.uV_step; +} + +static inline int pm8008_write_voltage(struct pm8008_regulator *pm8008_reg, + int mV) +{ + __le16 vset_raw; + + vset_raw = cpu_to_le16(mV); + + return regmap_bulk_write(pm8008_reg->regmap, + LDO_VSET_LB_REG(pm8008_reg->base), + (const void *)&vset_raw, sizeof(vset_raw)); +} + +static int pm8008_regulator_set_voltage_time(struct regulator_dev *rdev, + int old_uV, int new_uv) +{ + struct pm8008_regulator *pm8008_reg = rdev_get_drvdata(rdev); + + return DIV_ROUND_UP(abs(new_uv - old_uV), pm8008_reg->step_rate); +} + +static int pm8008_regulator_set_voltage(struct regulator_dev *rdev, + unsigned int selector) +{ + struct pm8008_regulator *pm8008_reg = rdev_get_drvdata(rdev); + int rc, mV; + + rc = regulator_list_voltage_linear_range(rdev, selector); + if (rc < 0) + return rc; + + /* voltage control register is set with voltage in millivolts */ + mV = DIV_ROUND_UP(rc, 1000); + + rc = pm8008_write_voltage(pm8008_reg, mV); + if (rc < 0) + return rc; + + return 0; +} + +static const struct regulator_ops pm8008_regulator_ops = { + .enable = regulator_enable_regmap, + .disable = regulator_disable_regmap, + .is_enabled = regulator_is_enabled_regmap, + .set_voltage_sel = pm8008_regulator_set_voltage, + .get_voltage_sel = pm8008_regulator_get_voltage, + .list_voltage = regulator_list_voltage_linear, + .set_voltage_time = pm8008_regulator_set_voltage_time, +}; + +static int pm8008_regulator_probe(struct platform_device *pdev) +{ + struct regulator_config reg_config = {}; + struct pm8008_regulator *pm8008_reg; + struct device *dev = &pdev->dev; + struct regulator_desc *rdesc; + struct regulator_dev *rdev; + struct regmap *regmap; + unsigned int val; + int rc, i; + + regmap = dev_get_regmap(dev->parent, "secondary"); + if (!regmap) + return -EINVAL; + + for (i = 0; i < ARRAY_SIZE(reg_data); i++) { + pm8008_reg = devm_kzalloc(dev, sizeof(*pm8008_reg), GFP_KERNEL); + if (!pm8008_reg) + return -ENOMEM; + + pm8008_reg->regmap = regmap; + pm8008_reg->base = reg_data[i].base; + + /* get slew rate */ + rc = regmap_bulk_read(pm8008_reg->regmap, + LDO_STEPPER_CTL_REG(pm8008_reg->base), &val, 1); + if (rc < 0) { + dev_err(dev, "failed to read step rate: %d\n", rc); + return rc; + } + val &= STEP_RATE_MASK; + pm8008_reg->step_rate = DEFAULT_VOLTAGE_STEPPER_RATE >> val; + + rdesc = &pm8008_reg->rdesc; + rdesc->type = REGULATOR_VOLTAGE; + rdesc->ops = &pm8008_regulator_ops; + rdesc->name = reg_data[i].name; + rdesc->supply_name = reg_data[i].supply_name; + rdesc->of_match = reg_data[i].name; + rdesc->uV_step = VSET_STEP_UV; + rdesc->linear_ranges = reg_data[i].voltage_range; + rdesc->n_linear_ranges = 1; + BUILD_BUG_ON((ARRAY_SIZE(pldo_ranges) != 1) || + (ARRAY_SIZE(nldo_ranges) != 1)); + + if (reg_data[i].voltage_range == nldo_ranges) { + rdesc->min_uV = NLDO_MIN_UV; + rdesc->n_voltages = ((NLDO_MAX_UV - NLDO_MIN_UV) / rdesc->uV_step) + 1; + } else { + rdesc->min_uV = PLDO_MIN_UV; + rdesc->n_voltages = ((PLDO_MAX_UV - PLDO_MIN_UV) / rdesc->uV_step) + 1; + } + + rdesc->enable_reg = LDO_ENABLE_REG(pm8008_reg->base); + rdesc->enable_mask = ENABLE_BIT; + rdesc->min_dropout_uV = reg_data[i].min_dropout_uv; + rdesc->regulators_node = of_match_ptr("regulators"); + + reg_config.dev = dev->parent; + reg_config.driver_data = pm8008_reg; + reg_config.regmap = pm8008_reg->regmap; + + rdev = devm_regulator_register(dev, rdesc, ®_config); + if (IS_ERR(rdev)) { + rc = PTR_ERR(rdev); + dev_err(dev, "failed to register regulator %s: %d\n", + reg_data[i].name, rc); + return rc; + } + } + + return 0; +} + +static struct platform_driver pm8008_regulator_driver = { + .driver = { + .name = "qcom-pm8008-regulator", + }, + .probe = pm8008_regulator_probe, +}; + +module_platform_driver(pm8008_regulator_driver); + +MODULE_DESCRIPTION("Qualcomm Technologies, Inc. PM8008 PMIC Regulator Driver"); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:qcom-pm8008-regulator"); From patchwork Mon May 6 15:08:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 13655626 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 9B0591553A1; Mon, 6 May 2024 15:10:15 +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=1715008215; cv=none; b=G6OdAicANh6mwJXKKpOAMRba3VioAGbuCXsppMcJJLy73vbsRYaoz+YLGiebvYkqdsNaZPyeFkXPXEvElx6AQL0B6i0BEQlcKoadxqrLBizPm8yottO+3/OOZl3Rb6qpmEaO7UrMrhItj8X3q5kfLCyNlU+dGrWoMeiZDj8rVBo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715008215; c=relaxed/simple; bh=1Ss/oHL8DEJVMJndnNCdr7e+QS596xFOusjHOLUImeU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dsocq93Xpimm9pwbXbcv+leFFamDuW+L0HSkT3Ff54xUWjk+4jBGCFf5ATE3I19z4BKyg9wYPJLBIOXh3ywAlUZ8OpMpT6wT2KM204UZxRfggBln1Bg92KBHOzP7u3dpZne8d7rXDl7rQu9TtzfLL5VEuzofzPBhz817HgFboXo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tkJxPXQ7; 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="tkJxPXQ7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47245C4DDE6; Mon, 6 May 2024 15:10:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715008215; bh=1Ss/oHL8DEJVMJndnNCdr7e+QS596xFOusjHOLUImeU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tkJxPXQ7t7k2y/coMRTsM8D8WGEMYlVFz4H5Lb6MAqLUuiDDKdSghPYvEer6IndfJ egGqcsFqyKcIO8kwWpoBwYK2NM65lqJcVEQRIBwSQI8bjySwdiVH49+ROEW6YiXGYa tBBQeIttkzFmQQkAT5+FkqOonOfHXC+YZFtxXSv6xRIHx4XY1UvYMcW5o1RDe5yHZX WAlsRh7V8W00zQxyJzuxRcvfmzws+gnILPwsXrEBg+z7QU20L888i8jZblMDKEh2ng rxhxyVixM7PJCK0b9rQS+mvWC/yz5zZ8CLu0e0+dnUHAmMy6TE8ON/O6c3S0VxcPVT Zo9MgFOGj44VQ== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1s3zyq-000000006Cg-3uHl; Mon, 06 May 2024 17:10:16 +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 , Stephen Boyd , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Johan Hovold Subject: [PATCH 13/13] arm64: dts: qcom: sc8280xp-x13s: enable pm8008 camera pmic Date: Mon, 6 May 2024 17:08:30 +0200 Message-ID: <20240506150830.23709-14-johan+linaro@kernel.org> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240506150830.23709-1-johan+linaro@kernel.org> References: <20240506150830.23709-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-arm-msm@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. Signed-off-by: Johan Hovold Reviewed-by: Bryan O'Donoghue Tested-by: Bryan O'Donoghue --- .../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..78d85e722ab1 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";