diff options
author | Andrzej Hajda <a.hajda@samsung.com> | 2016-10-17 15:57:03 +0200 |
---|---|---|
committer | Andrzej Hajda <a.hajda@samsung.com> | 2016-10-17 15:57:37 +0200 |
commit | a126340262a6372e85ee32edac5ebfd6670bc98d (patch) | |
tree | a80ba42795971b600b8657249ad995e016adba54 | |
parent | db34218709c2e4646578114bf1fc82145c24be69 (diff) | |
download | linux-exynos-a126340262a6372e85ee32edac5ebfd6670bc98d.tar.gz linux-exynos-a126340262a6372e85ee32edac5ebfd6670bc98d.tar.bz2 linux-exynos-a126340262a6372e85ee32edac5ebfd6670bc98d.zip |
drm/bridge/sii8620: improve reading device capabilities function
This patch adds error checks, improves logging and constifies static array.
As a result the function is similar to mainline, except missing sink
name reporting which is not yet supported by drm core.
Change-Id: Icf7a72f0b9098f74f04e039c8c5dc5dfa3c59e17
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
-rw-r--r-- | drivers/gpu/drm/bridge/sii8620.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/drivers/gpu/drm/bridge/sii8620.c b/drivers/gpu/drm/bridge/sii8620.c index c0c87e81de86..f2b5ff3997ac 100644 --- a/drivers/gpu/drm/bridge/sii8620.c +++ b/drivers/gpu/drm/bridge/sii8620.c @@ -104,6 +104,8 @@ static const u8 sii8620_i2c_page[] = { 0x61, /* eCBUS-S, eCBUS-D */ }; +static void sii8620_mhl_disconnected(struct sii8620 *ctx); + static int sii8620_clear_error(struct sii8620 *ctx) { int ret = ctx->error; @@ -367,31 +369,41 @@ static void sii8620_update_array(u8 *dst, u8 *src, int count) static void sii8620_mr_devcap(struct sii8620 *ctx) { - static const char *sink_str[] = { + static const char * const sink_str[] = { [SINK_NONE] = "NONE", [SINK_HDMI] = "HDMI", [SINK_DVI] = "DVI" }; u8 dcap[MHL_DCAP_SIZE]; + struct device *dev = ctx->dev; + + sii8620_read_buf(ctx, REG_EDID_FIFO_RD_DATA, dcap, MHL_DCAP_SIZE); + if (ctx->error < 0) + return; - sii8620_read_buf(ctx, REG_EDID_FIFO_RD_DATA, dcap, - MHL_DCAP_SIZE); + dev_info(dev, "detected dongle MHL %d.%d, ChipID %02x%02x:%02x%02x\n", + dcap[MHL_DCAP_MHL_VERSION] / 16, dcap[MHL_DCAP_MHL_VERSION] % 16, + dcap[MHL_DCAP_ADOPTER_ID_H], dcap[MHL_DCAP_ADOPTER_ID_L], + dcap[MHL_DCAP_DEVICE_ID_H], dcap[MHL_DCAP_DEVICE_ID_L]); sii8620_update_array(ctx->devcap, dcap, MHL_DCAP_SIZE); if (!(dcap[MHL_DCAP_CAT] & MHL_DCAP_CAT_SINK)) return; sii8620_fetch_edid(ctx); + if (!ctx->edid) { + dev_err(ctx->dev, "Cannot fetch EDID\n"); + sii8620_mhl_disconnected(ctx); + return; + } + if (drm_detect_hdmi_monitor(ctx->edid)) ctx->sink_type = SINK_HDMI; else ctx->sink_type = SINK_DVI; - dev_info(ctx->dev, "detected dongle: %s, ppixel: %d\n", - sink_str[ctx->sink_type], - !!(ctx->devcap[MHL_DCAP_VID_LINK_MODE] - & MHL_DCAP_VID_LINK_PPIXEL)); + dev_info(dev, "detected sink(type: %s)\n", sink_str[ctx->sink_type]); sii8620_set_upstream_edid(ctx); sii8620_enable_hpd(ctx); } |