aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Stultz <john.stultz@linaro.org>2020-11-16 23:33:19 +0000
committerJohn Stultz <john.stultz@linaro.org>2021-05-21 23:18:43 +0000
commit89ea5f094c4c716ca6bdc155c9404146d23354d4 (patch)
treebb33aff1aec4e0e972d8d80788adf49c93102937
parent6a2d029d7b4b2140d8870d10061684fd5b729643 (diff)
downloadandroid-dev-dev/hikey-5.12.tar.gz
more adv7511 debug bits (reverting)dev/hikey-5.12
Change-Id: I7b8eaf36da5822fc128403e961b45951e0ac2689
-rw-r--r--drivers/gpu/drm/bridge/adv7511/adv7511_drv.c76
1 files changed, 19 insertions, 57 deletions
diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
index 28ca3622e9e4..26b330309332 100644
--- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
+++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
@@ -292,7 +292,6 @@ static void adv7511_set_link_config(struct adv7511 *adv7511,
unsigned int color_depth;
unsigned int input_id;
- printk("JDB: %s\n", __func__);
clock_delay = (config->clock_delay + 1200) / 400;
color_depth = config->input_color_depth == 8 ? 3
: (config->input_color_depth == 10 ? 1 : 2);
@@ -329,20 +328,6 @@ static void adv7511_set_link_config(struct adv7511 *adv7511,
static void __adv7511_power_on(struct adv7511 *adv7511)
{
adv7511->current_edid_segment = -1;
- printk("JDB: %s\n", __func__);
-
- /*
- * 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
- * from standby or are enabled. When the HPD goes low the adv7511 is
- * reset and the outputs are disabled which might cause the monitor to
- * go to standby again. To avoid this we ignore the HPD pin for the
- * first few seconds after enabling the output.
- */
- regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER2,
- ADV7511_REG_POWER2_HPD_SRC_MASK,
- ADV7511_REG_POWER2_HPD_SRC_NONE);
-
regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER,
ADV7511_POWER_POWER_DOWN, 0);
@@ -360,14 +345,21 @@ static void __adv7511_power_on(struct adv7511 *adv7511)
ADV7511_INT1_DDC_ERROR);
}
- /* HACK: If we don't delay here edid probing doesn't work properly */
- msleep(200);
+ /*
+ * 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
+ * from standby or are enabled. When the HPD goes low the adv7511 is
+ * reset and the outputs are disabled which might cause the monitor to
+ * go to standby again. To avoid this we ignore the HPD pin for the
+ * first few seconds after enabling the output.
+ */
+ regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER2,
+ ADV7511_REG_POWER2_HPD_SRC_MASK,
+ ADV7511_REG_POWER2_HPD_SRC_NONE);
}
static void adv7511_power_on(struct adv7511 *adv7511)
{
- printk("JDB: real %s called!\n", __func__);
-
__adv7511_power_on(adv7511);
/*
@@ -377,13 +369,11 @@ static void adv7511_power_on(struct adv7511 *adv7511)
if (adv7511->type == ADV7533 || adv7511->type == ADV7535)
adv7533_dsi_power_on(adv7511);
-
adv7511->powered = true;
}
static void __adv7511_power_off(struct adv7511 *adv7511)
{
- printk("JDB: %s\n", __func__);
/* TODO: setup additional power down modes */
regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER,
ADV7511_POWER_POWER_DOWN,
@@ -439,7 +429,6 @@ static void adv7511_hpd_work(struct work_struct *work)
else
status = connector_status_disconnected;
- printk("JDB: %s status: %i vs connector.status: %i (powered: %i)\n", __func__, status, adv7511->connector.status, adv7511->powered);
/*
* The bridge resets its registers on unplug. So when we get a plug
* event and we're already supposed to be powered, cycle the bridge to
@@ -448,20 +437,17 @@ static void adv7511_hpd_work(struct work_struct *work)
if (status == connector_status_connected &&
adv7511->connector.status == connector_status_disconnected &&
adv7511->powered) {
- printk("JDB: %s plug event when powered on, calling power_on again\n", __func__);
regcache_mark_dirty(adv7511->regmap);
adv7511_power_on(adv7511);
}
if (adv7511->connector.status != status) {
- printk("JDB: %s status changed, updating\n", __func__);
adv7511->connector.status = status;
if (adv7511->connector.dev) {
if (status == connector_status_disconnected)
cec_phys_addr_invalidate(adv7511->cec_adap);
- printk("JDB: %s calling hotplug event!\n", __func__);
-// drm_kms_helper_hotplug_event(adv7511->connector.dev);
+ // drm_kms_helper_hotplug_event(adv7511->connector.dev);
} else {
drm_bridge_hpd_notify(&adv7511->bridge, status);
}
@@ -518,7 +504,6 @@ static int adv7511_wait_for_edid(struct adv7511 *adv7511, int timeout)
{
int ret;
- printk("JDB: %s\n", __func__);
if (adv7511->i2c_main->irq) {
ret = wait_event_interruptible_timeout(adv7511->wq,
adv7511->edid_read, msecs_to_jiffies(timeout));
@@ -547,8 +532,6 @@ static int adv7511_get_edid_block(void *data, u8 *buf, unsigned int block,
unsigned int i;
int ret;
- printk("JDB: %s \n", __func__ );
-
if (len > 128)
return -EINVAL;
@@ -559,15 +542,14 @@ static int adv7511_get_edid_block(void *data, u8 *buf, unsigned int block,
&status);
if (ret < 0)
return ret;
+
if (status != 2) {
adv7511->edid_read = false;
regmap_write(adv7511->regmap, ADV7511_REG_EDID_SEGMENT,
block);
ret = adv7511_wait_for_edid(adv7511, 200);
- if (ret < 0) {
- printk("JDB: %s wait_for_edid failed!\n", __func__);
+ if (ret < 0)
return ret;
- }
}
/* Break this apart, hopefully more I2C controllers will
@@ -588,14 +570,10 @@ static int adv7511_get_edid_block(void *data, u8 *buf, unsigned int block,
for (i = 0; i < 4; ++i) {
ret = i2c_transfer(adv7511->i2c_edid->adapter, xfer,
ARRAY_SIZE(xfer));
- if (ret < 0) {
- printk("JDB: %s i2c_transfer failed?\n", __func__);
+ if (ret < 0)
return ret;
- }
- else if (ret != 2){
- printk("JDB: %s i2c_transfer failed (ret != 2)?\n", __func__);
+ else if (ret != 2)
return -EIO;
- }
xfer[1].buf += 64;
offset += 64;
@@ -621,7 +599,6 @@ static struct edid *adv7511_get_edid(struct adv7511 *adv7511,
{
struct edid *edid;
- printk("JDB: %s (powered: %i)\n", __func__, adv7511->powered);
/* Reading the EDID only works if the device is powered */
if (!adv7511->powered) {
unsigned int edid_i2c_addr =
@@ -660,7 +637,6 @@ static int adv7511_get_modes(struct adv7511 *adv7511,
kfree(edid);
- printk("JDB: %s returning %i modes\n", __func__, count);
return count;
}
@@ -672,12 +648,9 @@ adv7511_detect(struct adv7511 *adv7511, struct drm_connector *connector)
bool hpd;
int ret;
- printk("JDB: %s\n", __func__);
ret = regmap_read(adv7511->regmap, ADV7511_REG_STATUS, &val);
- if (ret < 0) {
- printk("JDB: %s bad read!\n", __func__);
+ if (ret < 0)
return connector_status_disconnected;
- }
if (val & ADV7511_STATUS_HPD)
status = connector_status_connected;
@@ -685,29 +658,25 @@ adv7511_detect(struct adv7511 *adv7511, struct drm_connector *connector)
status = connector_status_disconnected;
hpd = adv7511_hpd(adv7511);
- printk("JDB: %s hpd: %i\n", __func__, hpd);
- /* The chip resets itself when the cable is disc/onnected, so in case
+ /* The chip resets itself when the cable is disconnected, so in case
* there is a pending HPD interrupt and the cable is connected there was
* at least one transition from disconnected to connected and the chip
* has to be reinitialized. */
if (status == connector_status_connected && hpd && adv7511->powered) {
regcache_mark_dirty(adv7511->regmap);
- printk("JDB: %s calling adv7511_power_on!\n", __func__);
adv7511_power_on(adv7511);
if (connector)
adv7511_get_modes(adv7511, connector);
if (adv7511->status == connector_status_connected)
status = connector_status_disconnected;
} else {
- printk("JDB: %s enabling HPD sensing\n", __func__);
/* Renable HPD sensing */
regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER2,
ADV7511_REG_POWER2_HPD_SRC_MASK,
ADV7511_REG_POWER2_HPD_SRC_BOTH);
}
- printk("JDB: %s setting adv7511->status: %i\n", __func__, status);
adv7511->status = status;
return status;
}
@@ -833,7 +802,6 @@ static int adv7511_connector_get_modes(struct drm_connector *connector)
{
struct adv7511 *adv = connector_to_adv7511(connector);
- printk("JDB: %s\n", __func__);
return adv7511_get_modes(adv, connector);
}
@@ -856,8 +824,6 @@ adv7511_connector_detect(struct drm_connector *connector, bool force)
{
struct adv7511 *adv = connector_to_adv7511(connector);
- printk("JDB: %s\n", __func__);
- //dump_stack();
return adv7511_detect(adv, connector);
}
@@ -912,7 +878,7 @@ static struct adv7511 *bridge_to_adv7511(struct drm_bridge *bridge)
static void adv7511_bridge_enable(struct drm_bridge *bridge)
{
struct adv7511 *adv = bridge_to_adv7511(bridge);
- printk("JDB: %s\n", __func__);
+
adv7511_power_on(adv);
}
@@ -937,7 +903,6 @@ static int adv7511_bridge_attach(struct drm_bridge *bridge,
{
struct adv7511 *adv = bridge_to_adv7511(bridge);
int ret = 0;
- printk("JDB: %s\n", __func__);
if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)) {
ret = adv7511_connector_init(adv);
@@ -1017,7 +982,6 @@ static int adv7511_init_regulators(struct adv7511 *adv)
unsigned int i;
int ret;
- printk("JDB: %s\n", __func__);
if (adv->type == ADV7511) {
supply_names = adv7511_supply_names;
adv->num_supplies = ARRAY_SIZE(adv7511_supply_names);
@@ -1196,7 +1160,6 @@ static int adv7511_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
unsigned int val;
int ret;
- printk("JDB: %s\n", __func__);
if (!dev->of_node)
return -EINVAL;
@@ -1207,7 +1170,6 @@ static int adv7511_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
adv7511->i2c_main = i2c;
adv7511->powered = false;
adv7511->status = connector_status_disconnected;
- printk("JDB: %s adv7511->status set to disconnected (%i)\n", __func__, adv7511->status);
if (dev->of_node)
adv7511->type = (enum adv7511_type)of_device_get_match_data(dev);