mfd: add tps6594x support for Jacinto platforms
v4 cover mfd: add tps6594x support for Jacinto platforms
This patchset series adds support for the TPS6594x PMIC along with initial support for its RTC + GPIO interface, and poweroff sequence.
Additionally, add usage of the PMIC for the various Jacintor platforms devicetree's.
Changes from v1:
* Corrected devicetree documentation issues found with dt-schema
* Changed MFD references to PMIC reflecting the more valid use of driver
* Cleaning up variable naming and ordering within functions
* Adding gpio + regulator cells for upcoming driver support
* Switching from .probe to .probe_new API
* Revising comments within drivers to be more concise
* Adding device tree nodes for j721s2 and j721e platforms
Changes from v2:
* Adding gpio-tps6594x driver support
* Enabling gpio cell in MFD driver
Changes from v3:
* Refactoring gpio driver to use regmap gpio helpers
* Changing rtc driver to use more of device resource management
* Minor code changes related to error messages that aren't useful being dropped
* Dropped wildcard in device-tree compatible, and i2c device id
* Dropped device tree changes from the series; since these should be in their own series later
Keerthy (2):
MFD: TPS6594x: Add new PMIC device driver for TPS6594x chips
rtc: rtc-tps6594x: Add support for TPS6594X PMIC RTC
Matt Ranostay (2):
Documentation: ti,tps6594: Add DT bindings for the TPS6594x PMIC
gpio: gpio-tps6594x: add GPIO support for TPS6594x PMIC
.../devicetree/bindings/mfd/ti,tps6594.yaml | 65 ++++++++ drivers/gpio/Kconfig | 9 + drivers/gpio/Makefile | 1 + drivers/gpio/gpio-tps6594x.c | 78 +++++++++ drivers/mfd/Kconfig | 14 ++ drivers/mfd/Makefile | 1 + drivers/mfd/tps6594x.c | 113 +++++++++++++ drivers/rtc/Kconfig | 10 ++ drivers/rtc/Makefile | 1 + drivers/rtc/rtc-tps6594x.c | 155 ++++++++++++++++++ include/linux/mfd/tps6594x.h | 88 ++++++++++ 11 files changed, 535 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/ti,tps6594.yaml create mode 100644 drivers/gpio/gpio-tps6594x.c create mode 100644 drivers/mfd/tps6594x.c create mode 100644 drivers/rtc/rtc-tps6594x.c create mode 100644 include/linux/mfd/tps6594x.h
Signature · 1 line
2.38.GIT
PATCH v4 1/4 Documentation: ti,tps6594: Add DT bindings for the TPS6594x PMIC
Add documentation for the TPS6594x PMIC including its RTC and GPIO functionalities.
--- .../devicetree/bindings/mfd/ti,tps6594.yaml | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/ti,tps6594.yaml
Documentation/devicetree/bindings/mfd/ti,tps6594.yaml new file +65 -0
@@ -0,0 +1,65 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/ti,tps6594x.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: TPS6594x Power Management Integrated Circuit (PMIC) + +maintainers: + - Keerthy <[email protected]> + +properties: + compatible: + enum: + - ti,tps6594 + + reg: + const: 0x48 + + ti,system-power-controller: + type: boolean + description: PMIC is controlling the system power. + + rtc: + type: object + $ref: /schemas/rtc/rtc.yaml# + unevaluatedProperties: false + properties: + compatible: + const: ti,tps6594-rtc + + gpio: + type: object + unevaluatedProperties: false + properties: + compatible: + const: ti,tps6594x-gpio + +additionalProperties: false + +required: + - compatible + - reg + +examples: + - | + i2c0 { + #address-cells = <1>; + #size-cells = <0>; + + pmic: pmic@48 { + compatible = "ti,tps6594"; + reg = <0x48>; + + rtc { + compatible = "ti,tps6594-rtc"; + }; + + gpio { + compatible = "ti,tps6594-gpio"; + }; + }; + }; + +...
Signature · 1 line
2.38.GIT
Re: [PATCH v4 1/4] Documentation: ti,tps6594: Add DT bindings for the TPS6594x PMIC
Quoted 3 lines · Matt Ranostay
Add documentation for the TPS6594x PMIC including its RTC and GPIO functionalities.
This is a friendly reminder during the review process.
It seems my previous comments were not fully addressed. Maybe my feedback got lost between the quotes, maybe you just forgot to apply it. Please go back to the previous discussion and either implement all requested changes or keep discussing them.
Thank you.
The comment was about proper subject prefix. Drop also redundant, second "DT bindings" from the subject.
Quoted 17 lines
Signed-off-by Matt Ranostay <[email protected]>--- .../devicetree/bindings/mfd/ti,tps6594.yaml | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/ti,tps6594.yamlDocumentation/devicetree/bindings/mfd/ti,tps6594.yaml new file +5
-0@@ -0,0 +1,65 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/ti,tps6594x.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml#
Documentation/devicetree/bindings/mfd/ti,tps6594.yaml line 15
Quoted 10 lines
Documentation/devicetree/bindings/mfd/ti,tps6594.yaml new file +10
-0+ +title: TPS6594x Power Management Integrated Circuit (PMIC) + +maintainers: + - Keerthy <[email protected]> + +properties: + compatible: + enum: + - ti,tps6594
tps6594 is the model name? So what was previous tps6594x used also in title? This does not look correct.
Quoted 5 lines
Documentation/devicetree/bindings/mfd/ti,tps6594.yaml new file +5
-0+ + reg: + const: 0x48 + + ti,system-power-controller:
Documentation/devicetree/bindings/mfd/ti,tps6594.yaml line 30
Quoted 10 lines
Documentation/devicetree/bindings/mfd/ti,tps6594.yaml new file +10
-0+ type: boolean + description: PMIC is controlling the system power. + + rtc: + type: object + $ref: /schemas/rtc/rtc.yaml# + unevaluatedProperties: false + properties: + compatible: + const: ti,tps6594-rtc
Same problem.
Documentation/devicetree/bindings/mfd/ti,tps6594.yaml line 37
Quoted 7 lines
Documentation/devicetree/bindings/mfd/ti,tps6594.yaml new file +7
-0+ + gpio: + type: object + unevaluatedProperties: false + properties: + compatible: + const: ti,tps6594x-gpio
Not fixed.
Quoted 13 lines
Documentation/devicetree/bindings/mfd/ti,tps6594.yaml new file +13
-0+ +additionalProperties: false + +required: + - compatible + - reg + +examples: + - | + i2c0 { + #address-cells = <1>; + #size-cells = <0>; +
Documentation/devicetree/bindings/mfd/ti,tps6594.yaml line 60
Quoted 10 lines
Documentation/devicetree/bindings/mfd/ti,tps6594.yaml new file +10
-0+ pmic: pmic@48 { + compatible = "ti,tps6594"; + reg = <0x48>; + + rtc { + compatible = "ti,tps6594-rtc"; + }; + + gpio { + compatible = "ti,tps6594-gpio";
Does not look like you tested the bindings. Please run make dt_binding_check (see Documentation/devicetree/bindings/writing-schema.rst for instructions).
Best regards,
Krzysztof
Re: [PATCH v4 1/4] Documentation: ti,tps6594: Add DT bindings for the TPS6594x PMIC
Quoted 5 lines · Krzysztof Kozlowski
Quoted 3 lines · Matt Ranostay
Add documentation for the TPS6594x PMIC including its RTC and GPIO functionalities.
Quoted 7 lines
This is a friendly reminder during the review process.
It seems my previous comments were not fully addressed. Maybe my feedback got lost between the quotes, maybe you just forgot to apply it. Please go back to the previous discussion and either implement all requested changes or keep discussing them.
I missed serveral feedback suggestions in the last revision. Will try to be a little more careful in the future.
Quoted 28 lines
Thank you.
The comment was about proper subject prefix. Drop also redundant, second "DT bindings" from the subject.
Quoted 22 lines
Signed-off-by Matt Ranostay <[email protected]>--- .../devicetree/bindings/mfd/ti,tps6594.yaml | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/ti,tps6594.yamlDocumentation/devicetree/bindings/mfd/ti,tps6594.yaml new file +10
-0@@ -0,0 +1,65 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/ti,tps6594x.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: TPS6594x Power Management Integrated Circuit (PMIC) + +maintainers: + - Keerthy <[email protected]>
Quoted 9 lines
Documentation/devicetree/bindings/mfd/ti,tps6594.yaml line 15
Quoted 5 lines
Documentation/devicetree/bindings/mfd/ti,tps6594.yaml new file +5
-0+ +properties: + compatible: + enum: + - ti,tps6594tps6594 is the model name? So what was previous tps6594x used also in title? This does not look correct.
So the actual part number is TPS6594-Q1. Would tps6594q1 be more concise for naming across the device tree, and drivers?
- Matt
Quoted 63 lines
Quoted 5 lines
Documentation/devicetree/bindings/mfd/ti,tps6594.yaml new file +5
-0+ + reg: + const: 0x48 + + ti,system-power-controller:Documentation/devicetree/bindings/mfd/ti,tps6594.yaml line 30
Quoted 10 lines
Documentation/devicetree/bindings/mfd/ti,tps6594.yaml new file +10
-0+ type: boolean + description: PMIC is controlling the system power. + + rtc: + type: object + $ref: /schemas/rtc/rtc.yaml# + unevaluatedProperties: false + properties: + compatible: + const: ti,tps6594-rtcSame problem.
Documentation/devicetree/bindings/mfd/ti,tps6594.yaml line 37
Quoted 7 lines
Documentation/devicetree/bindings/mfd/ti,tps6594.yaml new file +7
-0+ + gpio: + type: object + unevaluatedProperties: false + properties: + compatible: + const: ti,tps6594x-gpioNot fixed.
Quoted 13 lines
Documentation/devicetree/bindings/mfd/ti,tps6594.yaml new file +13
-0+ +additionalProperties: false + +required: + - compatible + - reg + +examples: + - | + i2c0 { + #address-cells = <1>; + #size-cells = <0>; +Documentation/devicetree/bindings/mfd/ti,tps6594.yaml line 60
Quoted 10 lines
Documentation/devicetree/bindings/mfd/ti,tps6594.yaml new file +10
-0+ pmic: pmic@48 { + compatible = "ti,tps6594"; + reg = <0x48>; + + rtc { + compatible = "ti,tps6594-rtc"; + }; + + gpio { + compatible = "ti,tps6594-gpio";Does not look like you tested the bindings. Please run
make dt_binding_check(seeDocumentation/devicetree/bindings/writing-schema.rstfor instructions).Best regards,
Krzysztof
Rob Herring
maintainerRe: [PATCH v4 1/4] Documentation: ti,tps6594: Add DT bindings for the TPS6594x PMIC
In reply to Matt RanostayQuoted 9 lines · Matt Ranostay
Add documentation for the TPS6594x PMIC including its RTC and GPIO functionalities.
Signed-off-by Matt Ranostay <[email protected]>--- .../devicetree/bindings/mfd/ti,tps6594.yaml | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/ti,tps6594.yaml
My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):
yamllint warnings/errors:
dtschema/dtc warnings/errors:./Documentation/devicetree/bindings/mfd/ti,tps6594.yaml: $id: relative path/filename doesn't match actual path or filename
expected: http://devicetree.org/schemas/mfd/ti,tps6594.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mfd/ti,tps6594.example.dtb: pmic@48: gpio: Unevaluated properties are not allowed ('compatible' was unexpected)
From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mfd/ti,tps6594.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mfd/ti,tps6594.example.dtb: pmic@48: gpio:compatible:0: 'ti,tps6594x-gpio' was expected
From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mfd/ti,tps6594.yamlDocumentation/devicetree/bindings/mfd/ti,tps6594.example.dtb:0:0: /example-0/i2c0/pmic@48/gpio: failed to match any schema with compatible: ['ti,tps6594-gpio']
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]
This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command.
PATCH v4 2/4 MFD: TPS6594x: Add new PMIC device driver for TPS6594x chips
In reply to Matt RanostayFrom: Keerthy <[email protected]>
The TPS6594x chip is a PMIC, and contains the following components:
- GPIO controller
- RTC
--- drivers/mfd/Kconfig | 14 +++++ drivers/mfd/Makefile | 1 + drivers/mfd/tps6594x.c | 113 +++++++++++++++++++++++++++++++++++ include/linux/mfd/tps6594x.h | 84 ++++++++++++++++++++++++++ 4 files changed, 212 insertions(+) create mode 100644 drivers/mfd/tps6594x.c create mode 100644 include/linux/mfd/tps6594x.h
drivers/mfd/Kconfig +14 -0
@@ -1596,6 +1596,20 @@ config MFD_TI_LP873X This driver can also be built as a module. If so, the module will be called lp873x. +config MFD_TPS6594X + tristate "TI TPS6594X Power Management IC" + depends on I2C && OF + select MFD_CORE + select REGMAP_I2C + help + If you say yes here then you get support for the TPS6594X series of + Power Management Integrated Circuits (PMIC). + These include voltage regulators, RTS, configurable + General Purpose Outputs (GPO) that are used in portable devices. + + This driver can also be built as a module. If so, the module + will be called tps6594x. + config MFD_TI_LP87565 tristate "TI LP87565 Power Management IC" depends on I2C && OF
drivers/mfd/Makefile +1 -0
@@ -101,6 +101,7 @@ obj-$(CONFIG_MFD_TPS65910) += tps65910.o obj-$(CONFIG_MFD_TPS65912) += tps65912-core.o obj-$(CONFIG_MFD_TPS65912_I2C) += tps65912-i2c.o obj-$(CONFIG_MFD_TPS65912_SPI) += tps65912-spi.o +obj-$(CONFIG_MFD_TPS6594X) += tps6594x.o obj-$(CONFIG_MENELAUS) += menelaus.o obj-$(CONFIG_TWL4030_CORE) += twl-core.o twl4030-irq.o twl6030-irq.o
drivers/mfd/tps6594x.c new file +113 -0
113 lines not on this page · raw message
include/linux/mfd/tps6594x.h new file +84 -0
84 lines not on this page · raw message
Signature · 1 line
2.38.GIT
Re: [PATCH v4 2/4] MFD: TPS6594x: Add new PMIC device driver for TPS6594x chips
Quoted 3 lines · Matt Ranostay
From: Keerthy <[email protected]>
The TPS6594x chip is a PMIC, and contains the following components:
No improvements in the subject. The subject prefixes are lowercase.
In the binding you said device is "TPS6594", not TPS6594x.
Best regards,
Krzysztof
Re: [PATCH v4 2/4] MFD: TPS6594x: Add new PMIC device driver for TPS6594x chips
Quoted 9 lines · Krzysztof Kozlowski
Quoted 3 lines · Matt Ranostay
From: Keerthy <[email protected]>
The TPS6594x chip is a PMIC, and contains the following components:
No improvements in the subject. The subject prefixes are lowercase.
In the binding you said device is "TPS6594", not TPS6594x.
Sorry missed that :-/ will fix in future revisions
- Matt
Quoted 3 lines
Best regards,
Krzysztof
PATCH v4 3/4 rtc: rtc-tps6594x: Add support for TPS6594X PMIC RTC
In reply to Matt RanostayFrom: Keerthy <[email protected]>
Add support for TPS6594X PMIC RTC. However, currently only get/set of time + date functionality is supported.
--- drivers/rtc/Kconfig | 10 +++ drivers/rtc/Makefile | 1 + drivers/rtc/rtc-tps6594x.c | 155 +++++++++++++++++++++++++++++++++++++ 3 files changed, 166 insertions(+) create mode 100644 drivers/rtc/rtc-tps6594x.c
drivers/rtc/Kconfig +10 -0
@@ -588,6 +588,16 @@ config RTC_DRV_TPS65910 This driver can also be built as a module. If so, the module will be called rtc-tps65910. +config RTC_DRV_TPS6594X + tristate "TI TPS6594X RTC driver" + depends on MFD_TPS6594X || COMPILE_TEST + help + If you say yes here you get support for the RTC of TI TPS6594X series PMIC + chips. + + This driver can also be built as a module. If so, the module + will be called rtc-tps6594x. + config RTC_DRV_RC5T583 tristate "RICOH 5T583 RTC driver" depends on MFD_RC5T583
drivers/rtc/Makefile +1 -0
@@ -175,6 +175,7 @@ obj-$(CONFIG_RTC_DRV_TEST) += rtc-test.o obj-$(CONFIG_RTC_DRV_TI_K3) += rtc-ti-k3.o obj-$(CONFIG_RTC_DRV_TPS6586X) += rtc-tps6586x.o obj-$(CONFIG_RTC_DRV_TPS65910) += rtc-tps65910.o +obj-$(CONFIG_RTC_DRV_TPS6594X) += rtc-tps6594x.o obj-$(CONFIG_RTC_DRV_TWL4030) += rtc-twl.o obj-$(CONFIG_RTC_DRV_V3020) += rtc-v3020.o obj-$(CONFIG_RTC_DRV_VT8500) += rtc-vt8500.o
drivers/rtc/rtc-tps6594x.c new file +155 -0
155 lines not on this page · raw message
Signature · 1 line
2.38.GIT
PATCH v4 4/4 gpio: gpio-tps6594x: add GPIO support for TPS6594x PMIC
In reply to Matt RanostayAdd support for TPS6594X PMICs GPIO interface that has 11 that can be configured as input or outputs.
--- drivers/gpio/Kconfig | 9 +++++ drivers/gpio/Makefile | 1 + drivers/gpio/gpio-tps6594x.c | 78 ++++++++++++++++++++++++++++++++++++ include/linux/mfd/tps6594x.h | 4 ++ 4 files changed, 92 insertions(+) create mode 100644 drivers/gpio/gpio-tps6594x.c
drivers/gpio/Kconfig +9 -0
@@ -1405,6 +1405,15 @@ config GPIO_TPS65912 help This driver supports TPS65912 GPIO chip. +config GPIO_TPS6594X + tristate "TI TPS6594X GPIO driver" + depends on MFD_TPS6594X || COMPILE_TEST + select REGMAP + select GPIO_REGMAP + help + Select this option to enable GPIO driver for the TPS6954X + PMIC chip family. There are 11 GPIOs that can be configured. + config GPIO_TPS68470 tristate "TPS68470 GPIO" depends on INTEL_SKL_INT3472
drivers/gpio/Makefile +1 -0
@@ -159,6 +159,7 @@ obj-$(CONFIG_GPIO_TPS65218) += gpio-tps65218.o obj-$(CONFIG_GPIO_TPS6586X) += gpio-tps6586x.o obj-$(CONFIG_GPIO_TPS65910) += gpio-tps65910.o obj-$(CONFIG_GPIO_TPS65912) += gpio-tps65912.o +obj-$(CONFIG_GPIO_TPS6594X) += gpio-tps6594x.o obj-$(CONFIG_GPIO_TPS68470) += gpio-tps68470.o obj-$(CONFIG_GPIO_TQMX86) += gpio-tqmx86.o obj-$(CONFIG_GPIO_TS4800) += gpio-ts4800.o
drivers/gpio/gpio-tps6594x.c new file +78 -0
78 lines not on this page · raw message
include/linux/mfd/tps6594x.h +4 -0
@@ -21,6 +21,10 @@#define TPS6594X_FSM_I2C_TRIGGERS 0x85#define TPS6594X_FSM_NSLEEP_TRIGGERS 0x86 +#define TPS6594X_GPIO_CONF 0x31 +#define TPS6594X_GPIO_OUT 0x3d +#define TPS6594X_GPIO_IN 0x3f +#define TPS6594X_RTC_SECONDS 0xb5#define TPS6594X_RTC_MINUTES 0xb6#define TPS6594X_RTC_HOURS 0xb7
Signature · 1 line
2.38.GIT
Re: [PATCH v4 4/4] gpio: gpio-tps6594x: add GPIO support for TPS6594x PMIC
Quoted 145 lines · Matt Ranostay
Add support for TPS6594X PMICs GPIO interface that has 11 that can be configured as input or outputs.
Signed-off-by Matt Ranostay <[email protected]>--- drivers/gpio/Kconfig | 9 +++++ drivers/gpio/Makefile | 1 + drivers/gpio/gpio-tps6594x.c | 78 ++++++++++++++++++++++++++++++++++++ include/linux/mfd/tps6594x.h | 4 ++ 4 files changed, 92 insertions(+) create mode 100644 drivers/gpio/gpio-tps6594x.cdrivers/gpio/Kconfig +9
-0@@ -1405,6 +1405,15 @@ config GPIO_TPS65912 help This driver supports TPS65912 GPIO chip. +config GPIO_TPS6594X + tristate "TI TPS6594X GPIO driver" + depends on MFD_TPS6594X || COMPILE_TEST + select REGMAP + select GPIO_REGMAP + help + Select this option to enable GPIO driver for the TPS6954X + PMIC chip family. There are 11 GPIOs that can be configured. + config GPIO_TPS68470 tristate "TPS68470 GPIO" depends on INTEL_SKL_INT3472drivers/gpio/Makefile +1
-0@@ -159,6 +159,7 @@ obj-$(CONFIG_GPIO_TPS65218) += gpio-tps65218.o obj-$(CONFIG_GPIO_TPS6586X) += gpio-tps6586x.o obj-$(CONFIG_GPIO_TPS65910) += gpio-tps65910.o obj-$(CONFIG_GPIO_TPS65912) += gpio-tps65912.o +obj-$(CONFIG_GPIO_TPS6594X) += gpio-tps6594x.o obj-$(CONFIG_GPIO_TPS68470) += gpio-tps68470.o obj-$(CONFIG_GPIO_TQMX86) += gpio-tqmx86.o obj-$(CONFIG_GPIO_TS4800) += gpio-ts4800.odrivers/gpio/gpio-tps6594x.c new file +78
-0@@ -0,0 +1,78 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* GPIO driver for TI TPS6594x PMICs +* +* Copyright (C) 2022 Texas Instruments Incorporated - http://www.ti.com/ +*/ + +#include <linux/module.h> +#include <linux/of.h> +#include <linux/platform_device.h> +#include <linux/regmap.h> + +#include <linux/gpio/regmap.h> +#include <linux/gpio/driver.h> +#include <linux/mfd/tps6594x.h> + +#define GPIO_BANK_SIZE 8 +#define GPIO_CFG_MASK BIT(0) + +static int tps6594x_regmap_xlate (struct gpio_regmap *gpio, +unsigned int base,unsigned int offset, +unsigned int *reg,unsigned int *mask) +{ +if (base ==TPS6594X_GPIO_CONF ) { + *reg = base + offset; + *mask =GPIO_CFG_MASK ; + }else { +unsigned int line = offset %GPIO_BANK_SIZE ; +unsigned int stride = offset /GPIO_BANK_SIZE ; + + *reg = base + stride; + *mask =BIT (line); + } + +return 0 ; +} + +static int tps6594x_gpio_probe (struct platform_device *pdev) +{ +struct gpio_regmap_config config = {0 }; +struct regmap *regmap; + + regmap =dev_get_regmap (pdev->dev.parent,NULL ); +if (!regmap) +return -ENODEV ; + + config.regmap = regmap; + config.parent = &pdev->dev; + config.ngpio =11 ; + config.ngpio_per_reg =GPIO_BANK_SIZE ; + + config.reg_dat_base =TPS6594X_GPIO_IN ; + config.reg_set_base =TPS6594X_GPIO_OUT ; + config.reg_dir_out_base =TPS6594X_GPIO_CONF ; + config.reg_mask_xlate = tps6594x_regmap_xlate; + +return PTR_ERR_OR_ZERO (devm_gpio_regmap_register (&pdev->dev, &config)); +} + +static const struct of_device_id of_tps6594x_gpio_match[] = { + { .compatible ="ti,tps6594-gpio" , }, + {}, +}; +MODULE_DEVICE_TABLE (of, of_tps6594x_gpio_match); + +static struct platform_driver tps6594x_gpio_driver = { + .driver = { + .name ="tps6594-gpio" , + .of_match_table = of_tps6594x_gpio_match, + }, + .probe = tps6594x_gpio_probe, +}; +module_platform_driver (tps6594x_gpio_driver); + +MODULE_ALIAS ("platform:tps6594-gpio" ); +MODULE_AUTHOR ("Matt Ranostay <[email protected]>" ); +MODULE_DESCRIPTION ("TPS6594X GPIO driver" ); +MODULE_LICENSE ("GPL" );include/linux/mfd/tps6594x.h +4
-1@@ -21,6 +21,10 @@#define TPS6594X_FSM_I2C_TRIGGERS 0x85#define TPS6594X_FSM_NSLEEP_TRIGGERS 0x86 +#define TPS6594X_GPIO_CONF 0x31 +#define TPS6594X_GPIO_OUT 0x3d +#define TPS6594X_GPIO_IN 0x3f +#define TPS6594X_RTC_SECONDS 0xb5#define TPS6594X_RTC_MINUTES 0xb6#define TPS6594X_RTC_HOURS 0xb7 --
Quoted 2 lines
2.38.GIT
Re: [PATCH v4 4/4] gpio: gpio-tps6594x: add GPIO support for TPS6594x PMIC
In reply to Matt RanostayQuoted 4 lines · Matt Ranostay
Add support for TPS6594X PMICs GPIO interface that has 11 that can be configured as input or outputs.
Signed-off-by Matt Ranostay <[email protected]>
This looks really neat and clean with gpio-regmap.
Yours,
Linus Walleij