* [PATCH v3 0/2] NFC: nxp-nci: Add pad supply voltage pvdd-supply @ 2023-06-09 18:27 Raymond Hackley 2023-06-09 18:27 ` [PATCH v3 1/2] dt-bindings: nfc: nxp-nci: document pvdd-supply Raymond Hackley 2023-06-09 18:33 ` Raymond Hackley 0 siblings, 2 replies; 5+ messages in thread From: Raymond Hackley @ 2023-06-09 18:27 UTC (permalink / raw) To: linux-kernel Cc: Krzysztof Kozlowski, David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring, Liam Girdwood, Mark Brown, Michael Walle, Uwe Kleine-König, Jeremy Kerr, Raymond Hackley, netdev, devicetree v3: Fix weird wrapping and drop another unnecessary nxp_nci_i2c_poweroff() v2: Use dev_err_probe() and drop unnecessary nxp_nci_i2c_poweroff() PN547/553, QN310/330 chips on some devices require a pad supply voltage (PVDD). Otherwise, the NFC won't power up. Implement support for pad supply voltage pvdd-supply that is enabled by the nxp-nci driver so that the regulator gets enabled when needed. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v3 1/2] dt-bindings: nfc: nxp-nci: document pvdd-supply 2023-06-09 18:27 [PATCH v3 0/2] NFC: nxp-nci: Add pad supply voltage pvdd-supply Raymond Hackley @ 2023-06-09 18:27 ` Raymond Hackley 2023-06-09 18:28 ` [PATCH v3 2/2] NFC: nxp-nci: Add pad supply voltage pvdd-supply Raymond Hackley 2023-06-09 18:33 ` Raymond Hackley 1 sibling, 1 reply; 5+ messages in thread From: Raymond Hackley @ 2023-06-09 18:27 UTC (permalink / raw) To: linux-kernel Cc: Krzysztof Kozlowski, David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring, Liam Girdwood, Mark Brown, Michael Walle, Uwe Kleine-König, Jeremy Kerr, Raymond Hackley, netdev, devicetree PN547/553, QN310/330 chips on some devices require a pad supply voltage (PVDD). Otherwise, the NFC won't power up. Document support for pad supply voltage pvdd-supply that is enabled by the nxp-nci driver so that the regulator gets enabled when needed. Signed-off-by: Raymond Hackley <raymondhackley@protonmail.com> Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> --- Documentation/devicetree/bindings/net/nfc/nxp,nci.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/net/nfc/nxp,nci.yaml b/Documentation/devicetree/bindings/net/nfc/nxp,nci.yaml index 6924aff0b2c5..d5a4f935c2ce 100644 --- a/Documentation/devicetree/bindings/net/nfc/nxp,nci.yaml +++ b/Documentation/devicetree/bindings/net/nfc/nxp,nci.yaml @@ -25,6 +25,11 @@ properties: firmware-gpios: description: Output GPIO pin used to enter firmware download mode + pvdd-supply: + description: | + Optional regulator that provides pad supply voltage for some + controllers + interrupts: maxItems: 1 -- 2.30.2 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v3 2/2] NFC: nxp-nci: Add pad supply voltage pvdd-supply 2023-06-09 18:27 ` [PATCH v3 1/2] dt-bindings: nfc: nxp-nci: document pvdd-supply Raymond Hackley @ 2023-06-09 18:28 ` Raymond Hackley 2023-06-09 19:31 ` Krzysztof Kozlowski 0 siblings, 1 reply; 5+ messages in thread From: Raymond Hackley @ 2023-06-09 18:28 UTC (permalink / raw) To: linux-kernel Cc: Krzysztof Kozlowski, David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring, Liam Girdwood, Mark Brown, Michael Walle, Uwe Kleine-König, Jeremy Kerr, Raymond Hackley, netdev, devicetree PN547/553, QN310/330 chips on some devices require a pad supply voltage (PVDD). Otherwise, the NFC won't power up. Implement support for pad supply voltage pvdd-supply that is enabled by the nxp-nci driver so that the regulator gets enabled when needed. Signed-off-by: Raymond Hackley <raymondhackley@protonmail.com> --- drivers/nfc/nxp-nci/i2c.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c index d4c299be7949..6f01152d2c83 100644 --- a/drivers/nfc/nxp-nci/i2c.c +++ b/drivers/nfc/nxp-nci/i2c.c @@ -35,6 +35,7 @@ struct nxp_nci_i2c_phy { struct gpio_desc *gpiod_en; struct gpio_desc *gpiod_fw; + struct regulator *pvdd; int hard_fault; /* * < 0 if hardware error occurred (e.g. i2c err) @@ -263,6 +264,20 @@ static const struct acpi_gpio_mapping acpi_nxp_nci_gpios[] = { { } }; +static void nxp_nci_i2c_poweroff(void *data) +{ + struct nxp_nci_i2c_phy *phy = data; + struct device *dev = &phy->i2c_dev->dev; + struct regulator *pvdd = phy->pvdd; + int r; + + if (!IS_ERR(pvdd) && regulator_is_enabled(pvdd)) { + r = regulator_disable(pvdd); + if (r < 0) + dev_warn(dev, "Failed to disable regulator pvdd: %d\n", r); + } +} + static int nxp_nci_i2c_probe(struct i2c_client *client) { struct device *dev = &client->dev; @@ -298,6 +313,25 @@ static int nxp_nci_i2c_probe(struct i2c_client *client) return PTR_ERR(phy->gpiod_fw); } + phy->pvdd = devm_regulator_get_optional(dev, "pvdd"); + if (IS_ERR(phy->pvdd)) { + r = PTR_ERR(phy->pvdd); + if (r != -ENODEV) + return dev_err_probe(dev, r, "Failed to get regulator pvdd\n"); + } else { + r = regulator_enable(phy->pvdd); + if (r < 0) { + nfc_err(dev, "Failed to enable regulator pvdd: %d\n", r); + return r; + } + } + + r = devm_add_action_or_reset(dev, nxp_nci_i2c_poweroff, phy); + if (r < 0) { + nfc_err(dev, "Failed to install poweroff handler: %d\n", r); + return r; + } + r = nxp_nci_probe(phy, &client->dev, &i2c_phy_ops, NXP_NCI_I2C_MAX_PAYLOAD, &phy->ndev); if (r < 0) -- 2.30.2 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v3 2/2] NFC: nxp-nci: Add pad supply voltage pvdd-supply 2023-06-09 18:28 ` [PATCH v3 2/2] NFC: nxp-nci: Add pad supply voltage pvdd-supply Raymond Hackley @ 2023-06-09 19:31 ` Krzysztof Kozlowski 0 siblings, 0 replies; 5+ messages in thread From: Krzysztof Kozlowski @ 2023-06-09 19:31 UTC (permalink / raw) To: Raymond Hackley, linux-kernel Cc: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring, Liam Girdwood, Mark Brown, Michael Walle, Uwe Kleine-König, Jeremy Kerr, netdev, devicetree On 09/06/2023 20:28, Raymond Hackley wrote: > PN547/553, QN310/330 chips on some devices require a pad supply voltage > (PVDD). Otherwise, the NFC won't power up. > > Implement support for pad supply voltage pvdd-supply that is enabled by > the nxp-nci driver so that the regulator gets enabled when needed. > > Signed-off-by: Raymond Hackley <raymondhackley@protonmail.com> > --- > drivers/nfc/nxp-nci/i2c.c | 34 ++++++++++++++++++++++++++++++++++ > 1 file changed, 34 insertions(+) > > diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c > index d4c299be7949..6f01152d2c83 100644 > --- a/drivers/nfc/nxp-nci/i2c.c > +++ b/drivers/nfc/nxp-nci/i2c.c > @@ -35,6 +35,7 @@ struct nxp_nci_i2c_phy { > > struct gpio_desc *gpiod_en; > struct gpio_desc *gpiod_fw; > + struct regulator *pvdd; > > int hard_fault; /* > * < 0 if hardware error occurred (e.g. i2c err) > @@ -263,6 +264,20 @@ static const struct acpi_gpio_mapping acpi_nxp_nci_gpios[] = { > { } > }; > > +static void nxp_nci_i2c_poweroff(void *data) > +{ > + struct nxp_nci_i2c_phy *phy = data; > + struct device *dev = &phy->i2c_dev->dev; > + struct regulator *pvdd = phy->pvdd; > + int r; > + > + if (!IS_ERR(pvdd) && regulator_is_enabled(pvdd)) { No, don't send a new version before we finish discussion. One version per day is enough. NAK for this part, same reasons as before. Best regards, Krzysztof ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v3 2/2] NFC: nxp-nci: Add pad supply voltage pvdd-supply 2023-06-09 18:27 [PATCH v3 0/2] NFC: nxp-nci: Add pad supply voltage pvdd-supply Raymond Hackley 2023-06-09 18:27 ` [PATCH v3 1/2] dt-bindings: nfc: nxp-nci: document pvdd-supply Raymond Hackley @ 2023-06-09 18:33 ` Raymond Hackley 1 sibling, 0 replies; 5+ messages in thread From: Raymond Hackley @ 2023-06-09 18:33 UTC (permalink / raw) To: linux-kernel Cc: Krzysztof Kozlowski, David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring, Liam Girdwood, Mark Brown, Michael Walle, Uwe Kleine-König, Jeremy Kerr, Raymond Hackley, netdev, devicetree PN547/553, QN310/330 chips on some devices require a pad supply voltage (PVDD). Otherwise, the NFC won't power up. Implement support for pad supply voltage pvdd-supply that is enabled by the nxp-nci driver so that the regulator gets enabled when needed. Signed-off-by: Raymond Hackley <raymondhackley@protonmail.com> --- drivers/nfc/nxp-nci/i2c.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c index d4c299be7949..6f01152d2c83 100644 --- a/drivers/nfc/nxp-nci/i2c.c +++ b/drivers/nfc/nxp-nci/i2c.c @@ -35,6 +35,7 @@ struct nxp_nci_i2c_phy { struct gpio_desc *gpiod_en; struct gpio_desc *gpiod_fw; + struct regulator *pvdd; int hard_fault; /* * < 0 if hardware error occurred (e.g. i2c err) @@ -263,6 +264,20 @@ static const struct acpi_gpio_mapping acpi_nxp_nci_gpios[] = { { } }; +static void nxp_nci_i2c_poweroff(void *data) +{ + struct nxp_nci_i2c_phy *phy = data; + struct device *dev = &phy->i2c_dev->dev; + struct regulator *pvdd = phy->pvdd; + int r; + + if (!IS_ERR(pvdd) && regulator_is_enabled(pvdd)) { + r = regulator_disable(pvdd); + if (r < 0) + dev_warn(dev, "Failed to disable regulator pvdd: %d\n", r); + } +} + static int nxp_nci_i2c_probe(struct i2c_client *client) { struct device *dev = &client->dev; @@ -298,6 +313,25 @@ static int nxp_nci_i2c_probe(struct i2c_client *client) return PTR_ERR(phy->gpiod_fw); } + phy->pvdd = devm_regulator_get_optional(dev, "pvdd"); + if (IS_ERR(phy->pvdd)) { + r = PTR_ERR(phy->pvdd); + if (r != -ENODEV) + return dev_err_probe(dev, r, "Failed to get regulator pvdd\n"); + } else { + r = regulator_enable(phy->pvdd); + if (r < 0) { + nfc_err(dev, "Failed to enable regulator pvdd: %d\n", r); + return r; + } + } + + r = devm_add_action_or_reset(dev, nxp_nci_i2c_poweroff, phy); + if (r < 0) { + nfc_err(dev, "Failed to install poweroff handler: %d\n", r); + return r; + } + r = nxp_nci_probe(phy, &client->dev, &i2c_phy_ops, NXP_NCI_I2C_MAX_PAYLOAD, &phy->ndev); if (r < 0) -- 2.30.2 ^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-06-09 19:31 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-06-09 18:27 [PATCH v3 0/2] NFC: nxp-nci: Add pad supply voltage pvdd-supply Raymond Hackley 2023-06-09 18:27 ` [PATCH v3 1/2] dt-bindings: nfc: nxp-nci: document pvdd-supply Raymond Hackley 2023-06-09 18:28 ` [PATCH v3 2/2] NFC: nxp-nci: Add pad supply voltage pvdd-supply Raymond Hackley 2023-06-09 19:31 ` Krzysztof Kozlowski 2023-06-09 18:33 ` Raymond Hackley
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).