aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2016-02-04 23:44:16 -0500
committerDave Airlie <airlied@redhat.com>2016-02-04 23:44:16 -0500
commitc6b431cc595b714c631866087b00dc2db9c5f450 (patch)
tree6522a38719fdbebd52884f56b73667e588d2f506
parent87d0f93961b201997b0d2d41af259e794a4e41b9 (diff)
parent29ce4ed441d04a8931150f291c0f7d961690ab81 (diff)
Merge branch 'drm/adv7511' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux into drm-fixes
misc adv7511 edid reading fixes. * 'drm/adv7511' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: drm: adv7511: it's HPD, not HDP drm: adv7511: mark ADV7511_REG_EDID_READ_CTRL volatile drm: adv7511: really enable interrupts for EDID detection
-rw-r--r--drivers/gpu/drm/i2c/adv7511.c48
-rw-r--r--drivers/gpu/drm/i2c/adv7511.h12
2 files changed, 35 insertions, 25 deletions
diff --git a/drivers/gpu/drm/i2c/adv7511.c b/drivers/gpu/drm/i2c/adv7511.c
index 533d1e3d4a99..a02112ba1c3d 100644
--- a/drivers/gpu/drm/i2c/adv7511.c
+++ b/drivers/gpu/drm/i2c/adv7511.c
@@ -136,6 +136,7 @@ static bool adv7511_register_volatile(struct device *dev, unsigned int reg)
136 case ADV7511_REG_BKSV(3): 136 case ADV7511_REG_BKSV(3):
137 case ADV7511_REG_BKSV(4): 137 case ADV7511_REG_BKSV(4):
138 case ADV7511_REG_DDC_STATUS: 138 case ADV7511_REG_DDC_STATUS:
139 case ADV7511_REG_EDID_READ_CTRL:
139 case ADV7511_REG_BSTATUS(0): 140 case ADV7511_REG_BSTATUS(0):
140 case ADV7511_REG_BSTATUS(1): 141 case ADV7511_REG_BSTATUS(1):
141 case ADV7511_REG_CHIP_ID_HIGH: 142 case ADV7511_REG_CHIP_ID_HIGH:
@@ -362,24 +363,31 @@ static void adv7511_power_on(struct adv7511 *adv7511)
362{ 363{
363 adv7511->current_edid_segment = -1; 364 adv7511->current_edid_segment = -1;
364 365
365 regmap_write(adv7511->regmap, ADV7511_REG_INT(0),
366 ADV7511_INT0_EDID_READY);
367 regmap_write(adv7511->regmap, ADV7511_REG_INT(1),
368 ADV7511_INT1_DDC_ERROR);
369 regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER, 366 regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER,
370 ADV7511_POWER_POWER_DOWN, 0); 367 ADV7511_POWER_POWER_DOWN, 0);
368 if (adv7511->i2c_main->irq) {
369 /*
370 * Documentation says the INT_ENABLE registers are reset in
371 * POWER_DOWN mode. My 7511w preserved the bits, however.
372 * Still, let's be safe and stick to the documentation.
373 */
374 regmap_write(adv7511->regmap, ADV7511_REG_INT_ENABLE(0),
375 ADV7511_INT0_EDID_READY);
376 regmap_write(adv7511->regmap, ADV7511_REG_INT_ENABLE(1),
377 ADV7511_INT1_DDC_ERROR);
378 }
371 379
372 /* 380 /*
373 * Per spec it is allowed to pulse the HDP signal to indicate that the 381 * Per spec it is allowed to pulse the HPD signal to indicate that the
374 * EDID information has changed. Some monitors do this when they wakeup 382 * EDID information has changed. Some monitors do this when they wakeup
375 * from standby or are enabled. When the HDP goes low the adv7511 is 383 * from standby or are enabled. When the HPD goes low the adv7511 is
376 * reset and the outputs are disabled which might cause the monitor to 384 * reset and the outputs are disabled which might cause the monitor to
377 * go to standby again. To avoid this we ignore the HDP pin for the 385 * go to standby again. To avoid this we ignore the HPD pin for the
378 * first few seconds after enabling the output. 386 * first few seconds after enabling the output.
379 */ 387 */
380 regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER2, 388 regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER2,
381 ADV7511_REG_POWER2_HDP_SRC_MASK, 389 ADV7511_REG_POWER2_HPD_SRC_MASK,
382 ADV7511_REG_POWER2_HDP_SRC_NONE); 390 ADV7511_REG_POWER2_HPD_SRC_NONE);
383 391
384 /* 392 /*
385 * Most of the registers are reset during power down or when HPD is low. 393 * Most of the registers are reset during power down or when HPD is low.
@@ -413,9 +421,9 @@ static bool adv7511_hpd(struct adv7511 *adv7511)
413 if (ret < 0) 421 if (ret < 0)
414 return false; 422 return false;
415 423
416 if (irq0 & ADV7511_INT0_HDP) { 424 if (irq0 & ADV7511_INT0_HPD) {
417 regmap_write(adv7511->regmap, ADV7511_REG_INT(0), 425 regmap_write(adv7511->regmap, ADV7511_REG_INT(0),
418 ADV7511_INT0_HDP); 426 ADV7511_INT0_HPD);
419 return true; 427 return true;
420 } 428 }
421 429
@@ -438,7 +446,7 @@ static int adv7511_irq_process(struct adv7511 *adv7511)
438 regmap_write(adv7511->regmap, ADV7511_REG_INT(0), irq0); 446 regmap_write(adv7511->regmap, ADV7511_REG_INT(0), irq0);
439 regmap_write(adv7511->regmap, ADV7511_REG_INT(1), irq1); 447 regmap_write(adv7511->regmap, ADV7511_REG_INT(1), irq1);
440 448
441 if (irq0 & ADV7511_INT0_HDP && adv7511->encoder) 449 if (irq0 & ADV7511_INT0_HPD && adv7511->encoder)
442 drm_helper_hpd_irq_event(adv7511->encoder->dev); 450 drm_helper_hpd_irq_event(adv7511->encoder->dev);
443 451
444 if (irq0 & ADV7511_INT0_EDID_READY || irq1 & ADV7511_INT1_DDC_ERROR) { 452 if (irq0 & ADV7511_INT0_EDID_READY || irq1 & ADV7511_INT1_DDC_ERROR) {
@@ -567,12 +575,14 @@ static int adv7511_get_modes(struct drm_encoder *encoder,
567 575
568 /* Reading the EDID only works if the device is powered */ 576 /* Reading the EDID only works if the device is powered */
569 if (!adv7511->powered) { 577 if (!adv7511->powered) {
570 regmap_write(adv7511->regmap, ADV7511_REG_INT(0),
571 ADV7511_INT0_EDID_READY);
572 regmap_write(adv7511->regmap, ADV7511_REG_INT(1),
573 ADV7511_INT1_DDC_ERROR);
574 regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER, 578 regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER,
575 ADV7511_POWER_POWER_DOWN, 0); 579 ADV7511_POWER_POWER_DOWN, 0);
580 if (adv7511->i2c_main->irq) {
581 regmap_write(adv7511->regmap, ADV7511_REG_INT_ENABLE(0),
582 ADV7511_INT0_EDID_READY);
583 regmap_write(adv7511->regmap, ADV7511_REG_INT_ENABLE(1),
584 ADV7511_INT1_DDC_ERROR);
585 }
576 adv7511->current_edid_segment = -1; 586 adv7511->current_edid_segment = -1;
577 } 587 }
578 588
@@ -638,10 +648,10 @@ adv7511_encoder_detect(struct drm_encoder *encoder,
638 if (adv7511->status == connector_status_connected) 648 if (adv7511->status == connector_status_connected)
639 status = connector_status_disconnected; 649 status = connector_status_disconnected;
640 } else { 650 } else {
641 /* Renable HDP sensing */ 651 /* Renable HPD sensing */
642 regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER2, 652 regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER2,
643 ADV7511_REG_POWER2_HDP_SRC_MASK, 653 ADV7511_REG_POWER2_HPD_SRC_MASK,
644 ADV7511_REG_POWER2_HDP_SRC_BOTH); 654 ADV7511_REG_POWER2_HPD_SRC_BOTH);
645 } 655 }
646 656
647 adv7511->status = status; 657 adv7511->status = status;
diff --git a/drivers/gpu/drm/i2c/adv7511.h b/drivers/gpu/drm/i2c/adv7511.h
index 6599ed538426..38515b30cedf 100644
--- a/drivers/gpu/drm/i2c/adv7511.h
+++ b/drivers/gpu/drm/i2c/adv7511.h
@@ -90,7 +90,7 @@
90#define ADV7511_CSC_ENABLE BIT(7) 90#define ADV7511_CSC_ENABLE BIT(7)
91#define ADV7511_CSC_UPDATE_MODE BIT(5) 91#define ADV7511_CSC_UPDATE_MODE BIT(5)
92 92
93#define ADV7511_INT0_HDP BIT(7) 93#define ADV7511_INT0_HPD BIT(7)
94#define ADV7511_INT0_VSYNC BIT(5) 94#define ADV7511_INT0_VSYNC BIT(5)
95#define ADV7511_INT0_AUDIO_FIFO_FULL BIT(4) 95#define ADV7511_INT0_AUDIO_FIFO_FULL BIT(4)
96#define ADV7511_INT0_EDID_READY BIT(2) 96#define ADV7511_INT0_EDID_READY BIT(2)
@@ -157,11 +157,11 @@
157#define ADV7511_PACKET_ENABLE_SPARE2 BIT(1) 157#define ADV7511_PACKET_ENABLE_SPARE2 BIT(1)
158#define ADV7511_PACKET_ENABLE_SPARE1 BIT(0) 158#define ADV7511_PACKET_ENABLE_SPARE1 BIT(0)
159 159
160#define ADV7511_REG_POWER2_HDP_SRC_MASK 0xc0 160#define ADV7511_REG_POWER2_HPD_SRC_MASK 0xc0
161#define ADV7511_REG_POWER2_HDP_SRC_BOTH 0x00 161#define ADV7511_REG_POWER2_HPD_SRC_BOTH 0x00
162#define ADV7511_REG_POWER2_HDP_SRC_HDP 0x40 162#define ADV7511_REG_POWER2_HPD_SRC_HPD 0x40
163#define ADV7511_REG_POWER2_HDP_SRC_CEC 0x80 163#define ADV7511_REG_POWER2_HPD_SRC_CEC 0x80
164#define ADV7511_REG_POWER2_HDP_SRC_NONE 0xc0 164#define ADV7511_REG_POWER2_HPD_SRC_NONE 0xc0
165#define ADV7511_REG_POWER2_TDMS_ENABLE BIT(4) 165#define ADV7511_REG_POWER2_TDMS_ENABLE BIT(4)
166#define ADV7511_REG_POWER2_GATE_INPUT_CLK BIT(0) 166#define ADV7511_REG_POWER2_GATE_INPUT_CLK BIT(0)
167 167