Add support for Maxim MAX735x/MAX736x variants
Subsystems (3)
v14 cover Add support for Maxim MAX735x/MAX736x variants
v14:
- Added comment for interrupt support
v13:
- Fix dt-binding
- Fixed nits
v12:
- Add separate patch correcting interrupt support in dt-binding
- Fix typo in commit message
- Make vdd-supply non optional
v11:
- Fix dt-binding example
v10:
- Small updates to dt-bindings
- Make vdd-supply optional
- Drop MAX7357 enhanced mode configuration
v9:
- Fix 'then' not aligned with 'if' in dt-bindings
- Split enhanced mode configuration into separate patch
- Add MAX7357/MAX7358 register definitions
- Rename config register defines
- Update comments and explain non default config being applied on MAX7357
- Check for I2C_FUNC_SMBUS_WRITE_BYTE_DATA functionality
v8:
- Move allOf in dt-binding and use double negation
v7:
- Reworked the commit message, comments and renamed a struct field. No functional change.
v6:
- Fix typo in dt-bindings
v5:
- Remove optional and make vdd-supply mandatory
v4:
- Add missing maxitems dt-bindings property
v3:
- Merge dt-bindings into i2c-mux-pca954x.yaml
v2:
- Move dt-bindings to separate file
- Added support for MAX736x as they are very similar
- Fixed an issue found by kernel test robot
- Dropped max735x property and custom IRQ check
- Added MAX7357 config register defines instead of magic values
- Renamed vcc-supply to vdd-supply
Patrick Rudolph (4):
dt-bindings: i2c: pca954x: Correct interrupt support
dt-bindings: i2c: Add Maxim MAX735x/MAX736x variants
i2c: muxes: pca954x: Add MAX735x/MAX736x support
i2c: muxes: pca954x: Add regulator support
.../bindings/i2c/i2c-mux-pca954x.yaml | 45 +++++++-- drivers/i2c/muxes/Kconfig | 6 +- drivers/i2c/muxes/i2c-mux-pca954x.c | 92 +++++++++++++++++-- 3 files changed, 128 insertions(+), 15 deletions(-)
Signature · 1 line
2.39.2
PATCH v14 1/4 dt-bindings: i2c: pca954x: Correct interrupt support
Only some of the PCA954x compatible ICs have interrupt capability, but the binding advertises it on all ICs.
Sync the dt-binding with the driver and only advertise it on:
- nxp,pca9542
- nxp,pca9543
- nxp,pca9544
- nxp,pca9545
--- .../bindings/i2c/i2c-mux-pca954x.yaml | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.yaml +19 -4
@@ -12,9 +12,6 @@ maintainers: description: The binding supports NXP PCA954x and PCA984x I2C mux/switch devices. -allOf: - - $ref: /schemas/i2c/i2c-mux.yaml# - properties: compatible: oneOf:
@@ -63,6 +60,24 @@ required: - compatible - reg +allOf: + - $ref: /schemas/i2c/i2c-mux.yaml# + - if: + not: + properties: + compatible: + contains: + enum: + - nxp,pca9542 + - nxp,pca9543 + - nxp,pca9544 + - nxp,pca9545 + then: + properties: + interrupts: false + "#interrupt-cells": false + interrupt-controller: false + unevaluatedProperties: false examples:
@@ -74,7 +89,7 @@ examples: #size-cells = <0>; i2c-mux@74 { - compatible = "nxp,pca9548"; + compatible = "nxp,pca9545"; #address-cells = <1>; #size-cells = <0>; reg = <0x74>;
Signature · 1 line
2.39.2
PATCH v14 2/4 dt-bindings: i2c: Add Maxim MAX735x/MAX736x variants
In reply to Patrick RudolphUpdate the pca954x bindings to add support for the Maxim MAX735x/MAX736x chips. The functionality will be provided by the existing pca954x driver.
For chips that are powered off by default add a regulator called vdd-supply.
--- .../bindings/i2c/i2c-mux-pca954x.yaml | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.yaml +20 -2
@@ -4,18 +4,29 @@ $id: http://devicetree.org/schemas/i2c/i2c-mux-pca954x.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# -title: NXP PCA954x I2C bus switch +title: NXP PCA954x I2C and compatible bus switches maintainers: - Laurent Pinchart <[email protected]> description: - The binding supports NXP PCA954x and PCA984x I2C mux/switch devices. + The NXP PCA954x and compatible devices are I2C bus + multiplexer/switches that share the same functionality + and register layout. + The devices usually have 4 or 8 child buses, which are + attached to the parent bus by using the SMBus "Send Byte" + command. properties: compatible: oneOf: - enum: + - maxim,max7356 + - maxim,max7357 + - maxim,max7358 + - maxim,max7367 + - maxim,max7368 + - maxim,max7369 - nxp,pca9540 - nxp,pca9542 - nxp,pca9543
@@ -56,6 +67,9 @@ properties: description: if present, overrides i2c-mux-idle-disconnect $ref: /schemas/mux/mux-controller.yaml#/properties/idle-state + vdd-supply: + description: A voltage regulator supplying power to the chip. + required: - compatible - reg
@@ -68,6 +82,8 @@ allOf: compatible: contains: enum: + - maxim,max7367 + - maxim,max7369 - nxp,pca9542 - nxp,pca9543 - nxp,pca9544
@@ -94,6 +110,8 @@ examples: #size-cells = <0>; reg = <0x74>; + vdd-supply = <&p3v3>; + interrupt-parent = <&ipic>; interrupts = <17 IRQ_TYPE_LEVEL_LOW>; interrupt-controller;
Signature · 1 line
2.39.2
Re: [PATCH v14 2/4] dt-bindings: i2c: Add Maxim MAX735x/MAX736x variants
Hi!
Quoted 48 lines · Patrick Rudolph
Update the pca954x bindings to add support for the Maxim MAX735x/MAX736x chips. The functionality will be provided by the existing pca954x driver.
For chips that are powered off by default add a regulator called vdd-supply.
Signed-off-by Patrick Rudolph <[email protected]>Reviewed-by Krzysztof Kozlowski <[email protected]>--- .../bindings/i2c/i2c-mux-pca954x.yaml | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.yaml +13
-2@@ -4,18 +4,29 @@ $id: http://devicetree.org/schemas/i2c/i2c-mux-pca954x.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# -title: NXP PCA954x I2C bus switch +title: NXP PCA954x I2C and compatible bus switches maintainers: - Laurent Pinchart <[email protected]> description: - The binding supports NXP PCA954x and PCA984x I2C mux/switch devices. + The NXP PCA954x and compatible devices are I2C bus + multiplexer/switches that share the same functionality + and register layout. + The devices usually have 4 or 8 child buses, which are + attached to the parent bus by using the SMBus "Send Byte" + command. properties: compatible: oneOf: - enum: + - maxim,max7356 + - maxim,max7357 + - maxim,max7358 + - maxim,max7367 + - maxim,max7368 + - maxim,max7369 - nxp,pca9540 - nxp,pca9542 - nxp,pca9543
Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.yaml properties: · line 72
Quoted 6 lines
Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.yaml +3
-0@@ -56,6 +67,9 @@ properties: description: if present, overrides i2c-mux-idle-disconnect $ref: /schemas/mux/mux-controller.yaml#/properties/idle-state + vdd-supply: + description: A voltage regulator supplying power to the chip. +
The pca9846-9 chips do not have one VDD, they have separate supplies for "low level" (VDD1), and "core logic" (VDD2). I don't know how such a situation is normally reflected in bindings, but could it not cause headaches later if use of unqualified VDD is spreading for those chips? Possibly with different semantics depending on if vdd-supply is tied to VDD1, VDD2 or both?
Cheers,
Peter
Quoted 21 lines
Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.yaml +4
-0required: - compatible - reg@@ -68,6 +82,8 @@ allOf: compatible: contains: enum: + - maxim,max7367 + - maxim,max7369 - nxp,pca9542 - nxp,pca9543 - nxp,pca9544@@ -94,6 +110,8 @@ examples: #size-cells = <0>; reg = <0x74>; + vdd-supply = <&p3v3>; + interrupt-parent = <&ipic>; interrupts = <17 IRQ_TYPE_LEVEL_LOW>; interrupt-controller;
Re: [PATCH v14 2/4] dt-bindings: i2c: Add Maxim MAX735x/MAX736x variants
Hi Peter,
it could indeed cause problems when VDD1 != VDD2 and at both needs to be enabled.
The pca9846 datasheet seems to refer to VDD1 as VDD. Thus I could add an optional "vdd2" regulator to the binding and driver.
Please let me know if that's what you had in mind. Regards,
Patrick
Quoted 90 lines · Peter Rosin
Hi!
Quoted 48 lines · Patrick Rudolph
Update the pca954x bindings to add support for the Maxim MAX735x/MAX736x chips. The functionality will be provided by the existing pca954x driver.
For chips that are powered off by default add a regulator called vdd-supply.
Signed-off-by Patrick Rudolph <[email protected]>Reviewed-by Krzysztof Kozlowski <[email protected]>--- .../bindings/i2c/i2c-mux-pca954x.yaml | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.yaml +13
-2@@ -4,18 +4,29 @@ $id: http://devicetree.org/schemas/i2c/i2c-mux-pca954x.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# -title: NXP PCA954x I2C bus switch +title: NXP PCA954x I2C and compatible bus switches maintainers: - Laurent Pinchart <[email protected]> description: - The binding supports NXP PCA954x and PCA984x I2C mux/switch devices. + The NXP PCA954x and compatible devices are I2C bus + multiplexer/switches that share the same functionality + and register layout. + The devices usually have 4 or 8 child buses, which are + attached to the parent bus by using the SMBus "Send Byte" + command. properties: compatible: oneOf: - enum: + - maxim,max7356 + - maxim,max7357 + - maxim,max7358 + - maxim,max7367 + - maxim,max7368 + - maxim,max7369 - nxp,pca9540 - nxp,pca9542 - nxp,pca9543Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.yaml properties: · line 72
Quoted 6 lines
Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.yaml +3
-0@@ -56,6 +67,9 @@ properties: description: if present, overrides i2c-mux-idle-disconnect $ref: /schemas/mux/mux-controller.yaml#/properties/idle-state + vdd-supply: + description: A voltage regulator supplying power to the chip. +The pca9846-9 chips do not have one VDD, they have separate supplies for "low level" (VDD1), and "core logic" (VDD2). I don't know how such a situation is normally reflected in bindings, but could it not cause headaches later if use of unqualified VDD is spreading for those chips? Possibly with different semantics depending on if vdd-supply is tied to VDD1, VDD2 or both?
Cheers,
PeterQuoted 21 lines
Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.yaml +4
-0required: - compatible - reg@@ -68,6 +82,8 @@ allOf: compatible: contains: enum: + - maxim,max7367 + - maxim,max7369 - nxp,pca9542 - nxp,pca9543 - nxp,pca9544@@ -94,6 +110,8 @@ examples: #size-cells = <0>; reg = <0x74>; + vdd-supply = <&p3v3>; + interrupt-parent = <&ipic>; interrupts = <17 IRQ_TYPE_LEVEL_LOW>; interrupt-controller;
Re: [PATCH v14 2/4] dt-bindings: i2c: Add Maxim MAX735x/MAX736x variants
Quoted 7 lines · Patrick Rudolph
Hi Peter,
it could indeed cause problems when VDD1 != VDD2 and at both needs to be enabled.
The pca9846 datasheet seems to refer to VDD1 as VDD. Thus I could add an optional "vdd2" regulator to the binding and driver.Please let me know if that's what you had in mind.
Don't top post.
In such case vdd-supply should not be used for VDD2.
Best regards,
Krzysztof
Re: [PATCH v14 2/4] dt-bindings: i2c: Add Maxim MAX735x/MAX736x variants
Hi!
Quoted 7 lines · Krzysztof Kozlowski
Quoted 6 lines · Patrick Rudolph
Hi Peter,
it could indeed cause problems when VDD1 != VDD2 and at both needs to be enabled.
The pca9846 datasheet seems to refer to VDD1 as VDD. Thus I could add an optional "vdd2" regulator to the binding and driver.
Quoted 5 lines
Quoted 1 line
Please let me know if that's what you had in mind.
Don't top post.
In such case vdd-supply should not be used for VDD2.
When reading the data sheet [1], I get the feeling that the instances of VDD are either copy-paste errors from data sheets from chip with a single VDD, or a reference to either of VDD1 or VDD2. It is thus not super clear to me that VDD should be the same thing as VDD1.
Sure, there is section 6.5 "Power-on reset", which mentions VDD and VDD2 (but not VDD1), but that seems like a simply typo and that it should really have been VDD1 instead of an unqualified VDD.
There are also various timings "glitch supply voltage difference" (delta VDD(gl)) and "supply voltage glitch pulse width" (t w(gl)VDD) with notes that refer to VDD2, which *could* indicate that the glitch in VDD is about a glitch VDD1. But it could also mean glitches on any of VDD1 and VDD2?
The general description of the chip indicates that VDD1 is there mainly to allow different bus voltages on each of the channels. Which is not at all the function of VDD on the other chips. Meanwhile VDD2 "is the core logic supply from which most of the PCA9846 circuitry runs", and seems like it is a better match for plain VDD?
Maybe one can find out more by reading the spec more carefully, but as I said, it is not clear to me that either of VDD1 or VDD2 can be matched to VDD.
Perhaps it is best to not mix things at all?
Re: [PATCH v14 2/4] dt-bindings: i2c: Add Maxim MAX735x/MAX736x variants
Hi Peter,
Quoted 29 lines · Peter Rosin
Hi!
Quoted 11 lines · Krzysztof Kozlowski
Quoted 7 lines · Patrick Rudolph
Hi Peter,
it could indeed cause problems when VDD1 != VDD2 and at both needs to be enabled.
The pca9846 datasheet seems to refer to VDD1 as VDD. Thus I could add an optional "vdd2" regulator to the binding and driver.Please let me know if that's what you had in mind.
Don't top post.
In such case vdd-supply should not be used for VDD2.
When reading the data sheet [1], I get the feeling that the instances of VDD are either copy-paste errors from data sheets from chip with a single VDD, or a reference to either of VDD1 or VDD2. It is thus not super clear to me that VDD should be the same thing as VDD1.
Sure, there is section 6.5 "Power-on reset", which mentions VDD and VDD2 (but not VDD1), but that seems like a simply typo and that it should really have been VDD1 instead of an unqualified VDD.
There are also various timings "glitch supply voltage difference" (delta VDD(gl)) and "supply voltage glitch pulse width" (t w(gl)VDD) with notes that refer to VDD2, which *could* indicate that the glitch in VDD is about a glitch VDD1. But it could also mean glitches on any of VDD1 and VDD2?
Quoted 5 lines
The general description of the chip indicates that VDD1 is there mainly to allow different bus voltages on each of the channels. Which is not at all the function of VDD on the other chips. Meanwhile VDD2 "is the core logic supply from which most of the PCA9846 circuitry runs", and seems like it is a better match for plain VDD?
Yes, based on Figure 14 in datasheet, VDD2 seems to be better match for plain VDD.
Also VDD1 is I2C bus voltage on micro-controller side so the best match I can think of is VBUS.
Quoted 6 lines
Maybe one can find out more by reading the spec more carefully, but as I said, it is not clear to me that either of VDD1 or VDD2 can be matched to VDD.
Perhaps it is best to not mix things at all?
Yes. For designs with same voltage rails, "VDD" can serve the purpose. For designs with different voltage rail, VBUS would be needed to identify micro-controller side bus supply.
Let me know your thoughts.
Regards,
Naresh
Quoted 3 lines
PATCH v14 3/4 i2c: muxes: pca954x: Add MAX735x/MAX736x support
In reply to Patrick RudolphAdd support for the following Maxim chips using the existing PCA954x driver:
- MAX7356
- MAX7357
- MAX7358
- MAX7367
- MAX7368
- MAX7369
All added Maxim chips behave like the PCA954x, where a single SMBUS byte write selects up to 8 channels to be bridged to the primary bus.
While the MAX7357/MAX7358 have interrupt support, they don't act as interrupt controller like the PCA9545 does. Thus don't enable IRQ support and handle them like the PCA9548.
Tested using the MAX7357.
--- drivers/i2c/muxes/Kconfig | 6 +-- drivers/i2c/muxes/i2c-mux-pca954x.c | 64 ++++++++++++++++++++++++++++- 2 files changed, 66 insertions(+), 4 deletions(-)
drivers/i2c/muxes/Kconfig +3 -3
@@ -65,11 +65,11 @@ config I2C_MUX_PCA9541 will be called i2c-mux-pca9541. config I2C_MUX_PCA954x - tristate "NXP PCA954x and PCA984x I2C Mux/switches" + tristate "NXP PCA954x/PCA984x and Maxim MAX735x/MAX736x I2C Mux/switches" depends on GPIOLIB || COMPILE_TEST help - If you say yes here you get support for the NXP PCA954x - and PCA984x I2C mux/switch devices. + If you say yes here you get support for NXP PCA954x/PCA984x + and Maxim MAX735x/MAX736x I2C mux/switch devices. This driver can also be built as a module. If so, the module will be called i2c-mux-pca954x.
drivers/i2c/muxes/i2c-mux-pca954x.c +63 -1
101 lines not on this page · raw message
Signature · 1 line
2.39.2
PATCH v14 4/4 i2c: muxes: pca954x: Add regulator support
In reply to Patrick RudolphAdd a vdd regulator and enable it for boards that have the mux powered off by default.
--- drivers/i2c/muxes/i2c-mux-pca954x.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-)
drivers/i2c/muxes/i2c-mux-pca954x.c +23 -5
@@ -49,6 +49,7 @@#include <linux/module.h> #include <linux/pm.h> #include <linux/property.h> +#include <linux/regulator/consumer.h> #include <linux/slab.h> #include <linux/spinlock.h> #include <dt-bindings/mux/mux.h>
@@ -101,6 +102,7 @@ struct pca954x {struct irq_domain *irq;unsigned int irq_mask;raw_spinlock_t lock; +struct regulator *supply; };/* Provide specs for the MAX735x, PCA954x and PCA984x types we know about */
@@ -444,6 +446,8 @@ static void pca954x_cleanup(struct i2c_mux_core *muxc)struct pca954x *data =i2c_mux_priv (muxc);int c, irq; +regulator_disable (data->supply); +if (data->irq) {for (c =0 ; c < data->chip->nchans; c++) { irq =irq_find_mapping (data->irq, c);
@@ -496,10 +500,22 @@ static int pca954x_probe(struct i2c_client *client)i2c_set_clientdata (client, muxc); data->client = client; + data->supply =devm_regulator_get (dev,"vdd" ); +if (IS_ERR (data->supply)) +return dev_err_probe (dev,PTR_ERR (data->supply), +"Failed to request regulator\n" ); + + ret =regulator_enable (data->supply); +if (ret) +return dev_err_probe (dev, ret, +"Failed to enable vdd supply\n" ); +/* Reset the mux if a reset GPIO is specified. */ gpio =devm_gpiod_get_optional (dev,"reset" ,GPIOD_OUT_HIGH ); -if (IS_ERR (gpio)) -return PTR_ERR (gpio); +if (IS_ERR (gpio)) { + ret =PTR_ERR (gpio); + goto fail_cleanup; + }if (gpio) {udelay (1 );gpiod_set_value_cansleep (gpio,0 );
@@ -516,7 +532,7 @@ static int pca954x_probe(struct i2c_client *client) ret =i2c_get_device_id (client, &id);if (ret && ret != -EOPNOTSUPP ) -return ret; + goto fail_cleanup; if (!ret && (id.manufacturer_id != data->chip->id.manufacturer_id ||
@@ -524,7 +540,8 @@ static int pca954x_probe(struct i2c_client *client)dev_warn (dev,"unexpected device id %03x-%03x-%x\n" , id.manufacturer_id, id.part_id, id.die_revision); -return -ENODEV ; + ret = -ENODEV ; + goto fail_cleanup; } }
@@ -543,7 +560,8 @@ static int pca954x_probe(struct i2c_client *client) ret =pca954x_init (client, data);if (ret <0 ) {dev_warn (dev,"probe failed\n" ); -return -ENODEV ; + ret = -ENODEV ; + goto fail_cleanup; } ret =pca954x_irq_setup (muxc);
Signature · 1 line
2.39.2