summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorDenys Drozdov <denys.drozdov@toradex.com>2021-11-30 18:32:31 +0200
committerDenys Drozdov <denys.drozdov@toradex.com>2021-12-02 13:53:58 +0200
commit5e47248b7f7059ddf4268c652730a740e8254d32 (patch)
treedabe78d776234cdf6940430bc40481be7242582e /drivers
parent9dec72907ab9254f40a3eff1e910c8d349ddba54 (diff)
gpu: drm: bridge: lt8912: check that device responds to i2c address
Boot Without Lontium DSI to HDMI Display Adapter may cause system failure during DRM initialization sequence. Improper i2c communication with wrong device may cause the following error messages: [ 7.833586] imx_sec_dsim_drv 32e10000.mipi_dsi: no bus formats assigned by connector [ 8.076362] lt8912 3-0048: failed to get display timings from EDID [ 8.144903] imx_sec_dsim_drv 32e10000.mipi_dsi: no bus formats assigned by connector ............ [ 800.144903] imx_sec_dsim_drv 32e10000.mipi_dsi: no bus formats assigned by connector Let's probe i2c addresses from board_info before creating i2c client devices to ensure DRM/DDC operating exactly on DSI-to-HDMI adapter. Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/bridge/lt8912.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/drivers/gpu/drm/bridge/lt8912.c b/drivers/gpu/drm/bridge/lt8912.c
index 48c172a8f41c..7ad7e808842b 100644
--- a/drivers/gpu/drm/bridge/lt8912.c
+++ b/drivers/gpu/drm/bridge/lt8912.c
@@ -425,6 +425,11 @@ static int lt8912_bridge_attach(struct drm_bridge *bridge)
drm_connector_helper_add(connector, &lt8912_connector_helper_funcs);
drm_connector_attach_encoder(connector, bridge->encoder);
+ if (!bridge->encoder) {
+ dev_err(lt->dev, "Parent encoder object not found");
+ return -ENODEV;
+ }
+
ret = lt8912_attach_dsi(lt);
if (!ret && irqd_irq_disabled(irq_get_irq_data(lt->irq)))
@@ -462,8 +467,15 @@ static int lt8912_i2c_init(struct lt8912 *lt,
if (!lt || !client)
return -ENODEV;
+ ret = i2c_smbus_read_byte(client);
+ if (ret < 0) {
+ dev_err(lt->dev, "Failed to access device %s at address %02x",
+ info[0].type, info[0].addr);
+ return -ENODEV;
+ }
+
for (i = 0; i < ARRAY_SIZE(info); i++) {
- if (i > 0 ) {
+ if (i > 0) {
client = i2c_new_dummy(client->adapter, info[i].addr);
if (!client)
return -ENODEV;
@@ -543,6 +555,11 @@ static int lt8912_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
unsigned int irq_flags;
int ret = 0;
+ if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_I2C)) {
+ DRM_ERROR("device doesn't support I2C\n");
+ return -ENODEV;
+ }
+
lt = devm_kzalloc(dev, sizeof(*lt), GFP_KERNEL);
if (!lt)
return -ENOMEM;