diff options
Diffstat (limited to 'drivers/gpu/drm/i2c/adv7511.c')
-rw-r--r-- | drivers/gpu/drm/i2c/adv7511.c | 48 |
1 files changed, 29 insertions, 19 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; |