2023-04-04 16:32:31

by Jonathan Cormier

[permalink] [raw]
Subject: [PATCH v4 0/3] drm/bridge: tfp410: Add i2c support

The TFP410 driver does not support I2C. As such, the device remains in
Power Down if the I2C is enabled by the bootstrap pins.

Add basic support for the I2C interface, and provide support to take
the device out of power down when enabled. Also read the bootstrap mode
pins via the CTL_1_MODE register when using the I2C bus.

Also allow polling device to support hdmi/dvi hotplug detection.

Signed-off-by: Jonathan Cormier <[email protected]>
---
Changes in v4:
- Add Reviewed-by: Neil Armstrong <[email protected]>
- Add Fixes: 5cafa0f1853b ("drm/bridge: tfp410: Replace manual connector handling with bridge")
- Link to v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- Drop dt-bindings i2c example
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Fix dt_binding_check errors
- Remove hdmi connector from binding example
- Fix compile warning. Unused variable and unsigned int instead of int for ret
- Fix commit titles
- Drop of_match_ptr change
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Michael Williamson (3):
drm/bridge: tfp410: Support basic I2C interface
drm/bridge: tfp410: Fix logic to configured polled HPD
drm/bridge: tfp410: If connected, use I2C for polled HPD status.

drivers/gpu/drm/bridge/ti-tfp410.c | 107 +++++++++++++++++++++++++++----------
1 file changed, 80 insertions(+), 27 deletions(-)
---
base-commit: 93f875a8526a291005e7f38478079526c843cbec
change-id: 20230125-tfp410_i2c-3b270b0bf3e0

Best regards,
--
Jonathan Cormier <[email protected]>


2023-04-04 16:32:47

by Jonathan Cormier

[permalink] [raw]
Subject: [PATCH v4 3/3] drm/bridge: tfp410: If connected, use I2C for polled HPD status.

From: Michael Williamson <[email protected]>

If the I2C bus is connected on the TFP410, then use the register
status bit to determine connection state. This is needed, in particular,
for polling the state when the Hot Plug detect is not connected to
a controlling CPU via GPIO/IRQ lane.

Signed-off-by: Michael Williamson <[email protected]>
Reviewed-by: Neil Armstrong <[email protected]>
Signed-off-by: Jonathan Cormier <[email protected]>
---
drivers/gpu/drm/bridge/ti-tfp410.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/bridge/ti-tfp410.c b/drivers/gpu/drm/bridge/ti-tfp410.c
index 41007d05d584..eeb7202452aa 100644
--- a/drivers/gpu/drm/bridge/ti-tfp410.c
+++ b/drivers/gpu/drm/bridge/ti-tfp410.c
@@ -28,6 +28,9 @@
#define TFP410_BIT_BSEL BIT(2)
#define TFP410_BIT_DSEL BIT(3)

+#define TFP410_REG_CTL_2_MODE 0x09
+#define TFP410_BIT_HTPLG BIT(1)
+
static const struct regmap_config tfp410_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
@@ -105,6 +108,15 @@ static enum drm_connector_status
tfp410_connector_detect(struct drm_connector *connector, bool force)
{
struct tfp410 *dvi = drm_connector_to_tfp410(connector);
+ int ret;
+
+ if (dvi->i2c) {
+ ret = regmap_test_bits(dvi->regmap, TFP410_REG_CTL_2_MODE, TFP410_BIT_HTPLG);
+ if (ret < 0)
+ dev_err(dvi->dev, "%s failed to read HTPLG bit : %d\n", __func__, ret);
+ else
+ return ret ? connector_status_connected : connector_status_disconnected;
+ }

return drm_bridge_detect(dvi->next_bridge);
}

--
2.25.1

2023-04-04 16:33:45

by Jonathan Cormier

[permalink] [raw]
Subject: [PATCH v4 2/3] drm/bridge: tfp410: Fix logic to configured polled HPD

From: Michael Williamson <[email protected]>

The logic to configure polling (vs async/irq notification) of hot-plug
events was not correct. If the connected bridge requires polling,
then inform the upstream bridge we also require polling.

Fixes: 5cafa0f1853b ("drm/bridge: tfp410: Replace manual connector handling with bridge")

Signed-off-by: Michael Williamson <[email protected]>
Reviewed-by: Neil Armstrong <[email protected]>
Signed-off-by: Jonathan Cormier <[email protected]>
---
drivers/gpu/drm/bridge/ti-tfp410.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/ti-tfp410.c b/drivers/gpu/drm/bridge/ti-tfp410.c
index bb3f8d0ff207..41007d05d584 100644
--- a/drivers/gpu/drm/bridge/ti-tfp410.c
+++ b/drivers/gpu/drm/bridge/ti-tfp410.c
@@ -155,7 +155,7 @@ static int tfp410_attach(struct drm_bridge *bridge,
return -ENODEV;
}

- if (dvi->next_bridge->ops & DRM_BRIDGE_OP_DETECT)
+ if (dvi->next_bridge->ops & DRM_BRIDGE_OP_HPD)
dvi->connector.polled = DRM_CONNECTOR_POLL_HPD;
else
dvi->connector.polled = DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT;

--
2.25.1

2023-09-26 19:59:25

by Jonathan Cormier

[permalink] [raw]
Subject: Re: [PATCH v4 0/3] drm/bridge: tfp410: Add i2c support

How do I bump this patch submission?