From patchwork Fri Nov 18 07:59:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 82844 Delivered-To: patches@linaro.org Received: by 10.140.97.165 with SMTP id m34csp1210702qge; Thu, 17 Nov 2016 23:59:41 -0800 (PST) X-Received: by 10.99.156.2 with SMTP id f2mr16584649pge.20.1479455981438; Thu, 17 Nov 2016 23:59:41 -0800 (PST) Return-Path: Received: from mail-pg0-x234.google.com (mail-pg0-x234.google.com. [2607:f8b0:400e:c05::234]) by mx.google.com with ESMTPS id 128si6978884pgc.326.2016.11.17.23.59.41 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Nov 2016 23:59:41 -0800 (PST) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c05::234 as permitted sender) client-ip=2607:f8b0:400e:c05::234; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c05::234 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by mail-pg0-x234.google.com with SMTP id f188so100314639pgc.3 for ; Thu, 17 Nov 2016 23:59:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=8cOvaJa4fzskcmj6waekhJHE2WMQ/CrO6wpMiRZwCZc=; b=YM2AHUS2J3paTbl8fu+MCGTrAlXeZUvBBkVEzu2tV93MpFroNfEZqL8iwOXaZaY00T zUb1d1Bln/WjuTT8ZoupR63cq1i5YwPrkQYp5EmgZAA3LEY6c0he7VgrHGaWHuBBWW8v HeBnGNM8enstbHkMl2XYc/AwcZ09SOZKvCi4c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=8cOvaJa4fzskcmj6waekhJHE2WMQ/CrO6wpMiRZwCZc=; b=JNwKc0QkUsJD2Auj0I+qqd4fAkVjnvokmH0ZLyYEZ5waiIc/CeEyPHznGZ6+geTmd/ WQAsedV8LzQfMb/TtKw1wnbawLOvkOQiDlS+Zqj0QxOoc3Tk88mrORf6NOALcDkN5a1j 5NSNUqphyQlNzYZloWgbUb8q8E6GdPg7P31H2fPg6FS27mVk7QbLiFYV4HntVQ4yogRO BuKc9hPBKn4HljmPGkq27T8qJbfjt0B/lSNKGirSb1JAmlTAsSIT6RNmGN9JQ1CiMKAo GIeYJb6eC3+aq/0PatEZdOTLafnkGRxKhtTyuydPHLXnrgkIG+s4F6KwsOZfGZfhGWol qNCA== X-Gm-Message-State: ABUngvdphwS7Yteprq3WzzkjysfXnAG+7G8esgYKsIhMjm4rpVAAaLavPRBnBTvDHa7Nq8/MR3s= X-Received: by 10.98.223.203 with SMTP id d72mr10261229pfl.2.1479455980917; Thu, 17 Nov 2016 23:59:40 -0800 (PST) Return-Path: Received: from localhost.localdomain ([2601:1c2:1002:83f0:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id s8sm14646974pfj.45.2016.11.17.23.59.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 17 Nov 2016 23:59:40 -0800 (PST) From: John Stultz To: Archit Taneja Cc: John Stultz , Xinliang Liu , Srinivas Kandagatla Subject: [PATCH] WIP: drm: adv7511: potential edid probe fix Date: Thu, 17 Nov 2016 23:59:34 -0800 Message-Id: <1479455974-28028-1-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 So this improved the edid probing on hotplug. I'm doing 3 things here (which I'll need to split out eventually): * Making adv7511_power_on/off reusable for internal uses * Using adv7511_power_on/off instead of the half-implementation of poweron used before edid probing * Adding a msleep(200) in the power_on path * Adding some suggested register initialization in the power_on path Cc: Archit Taneja Cc: Xinliang Liu Cc: Srinivas Kandagatla Signed-off-by: John Stultz --- drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 42 +++++++++++++++++----------- 1 file changed, 26 insertions(+), 16 deletions(-) -- 2.7.4 diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index 05b3663..3969d88 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c @@ -328,7 +328,7 @@ static void adv7511_set_link_config(struct adv7511 *adv7511, adv7511->rgb = config->input_colorspace == HDMI_COLORSPACE_RGB; } -static void adv7511_power_on(struct adv7511 *adv7511) +static void __adv7511_power_on(struct adv7511 *adv7511) { adv7511->current_edid_segment = -1; @@ -346,6 +346,17 @@ static void adv7511_power_on(struct adv7511 *adv7511) ADV7511_INT1_DDC_ERROR); } + + /* magic table initialization from table 14 in programming guide */ + regmap_write(adv7511->regmap, 0x98, 0x3); + regmap_update_bits(adv7511->regmap, 0x9a,0xfe, 0xe0); + regmap_write(adv7511->regmap, 0x9c, 0x30); + regmap_update_bits(adv7511->regmap, 0x9d,0x3, 0x1); + regmap_write(adv7511->regmap, 0xa2, 0xa4); + regmap_write(adv7511->regmap, 0xa3, 0xa4); + regmap_write(adv7511->regmap, 0xe0, 0xd0); + regmap_write(adv7511->regmap, 0xf9, 0x00); + /* * Per spec it is allowed to pulse the HPD signal to indicate that the * EDID information has changed. Some monitors do this when they wakeup @@ -363,13 +374,19 @@ static void adv7511_power_on(struct adv7511 *adv7511) */ regcache_sync(adv7511->regmap); + msleep(200); + if (adv7511->type == ADV7533) adv7533_dsi_power_on(adv7511); +} +static void adv7511_power_on(struct adv7511 *adv7511) +{ + __adv7511_power_on(adv7511); adv7511->powered = true; } -static void adv7511_power_off(struct adv7511 *adv7511) +static void __adv7511_power_off(struct adv7511 *adv7511) { /* TODO: setup additional power down modes */ regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER, @@ -379,7 +396,11 @@ static void adv7511_power_off(struct adv7511 *adv7511) if (adv7511->type == ADV7533) adv7533_dsi_power_off(adv7511); +} +static void adv7511_power_off(struct adv7511 *adv7511) +{ + __adv7511_power_off(adv7511); adv7511->powered = false; } @@ -548,24 +569,13 @@ static int adv7511_get_modes(struct adv7511 *adv7511, unsigned int count; /* Reading the EDID only works if the device is powered */ - if (!adv7511->powered) { - regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER, - ADV7511_POWER_POWER_DOWN, 0); - if (adv7511->i2c_main->irq) { - regmap_write(adv7511->regmap, ADV7511_REG_INT_ENABLE(0), - ADV7511_INT0_EDID_READY); - regmap_write(adv7511->regmap, ADV7511_REG_INT_ENABLE(1), - ADV7511_INT1_DDC_ERROR); - } - adv7511->current_edid_segment = -1; - } + if (!adv7511->powered) + __adv7511_power_on(adv7511); edid = drm_do_get_edid(connector, adv7511_get_edid_block, adv7511); if (!adv7511->powered) - regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER, - ADV7511_POWER_POWER_DOWN, - ADV7511_POWER_POWER_DOWN); + __adv7511_power_off(adv7511); kfree(adv7511->edid); adv7511->edid = edid;