mirror of
https://github.com/dingusdev/dingusppc.git
synced 2024-11-12 12:07:04 +00:00
Make display ID method selectable in video controller.
This commit is contained in:
parent
fc44cdcc83
commit
a01cd9c993
@ -120,7 +120,7 @@ ATIRage::ATIRage(uint16_t dev_id, uint32_t vmem_size_mb)
|
||||
(asic_id << 24) | dev_id);
|
||||
|
||||
/* initialize display identification */
|
||||
this->disp_id = new DisplayID();
|
||||
this->disp_id = new DisplayID(Disp_Id_Kind::DDC2B);
|
||||
}
|
||||
|
||||
ATIRage::~ATIRage()
|
||||
|
@ -24,8 +24,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#include <devices/video/displayid.h>
|
||||
#include <loguru.hpp>
|
||||
|
||||
DisplayID::DisplayID()
|
||||
DisplayID::DisplayID(Disp_Id_Kind id_kind)
|
||||
{
|
||||
this->id_kind = id_kind;
|
||||
|
||||
/* Initialize Apple monitor codes */
|
||||
this->std_sense_code = 6;
|
||||
this->ext_sense_code = 0x2B;
|
||||
@ -37,9 +39,6 @@ DisplayID::DisplayID()
|
||||
this->last_scl = 1;
|
||||
this->data_out = 0x3000;
|
||||
this->data_ptr = 0;
|
||||
|
||||
/* DDC sense mode is on by default */
|
||||
this->i2c_on = true;
|
||||
}
|
||||
|
||||
|
||||
@ -70,18 +69,18 @@ uint16_t DisplayID::read_monitor_sense(uint16_t data, uint16_t dirs)
|
||||
uint16_t result;
|
||||
|
||||
if ((dirs & 0x3100) == 0 && (data & 0x3100) == 0x3100) {
|
||||
LOG_F(WARNING, "DisplayID: Hackish Monitor ID Switch activated!");
|
||||
this->i2c_on = false;
|
||||
LOG_F(WARNING, "DisplayID: Monitor sense lines tristated!");
|
||||
}
|
||||
|
||||
if (this->i2c_on) {
|
||||
switch(this->id_kind) {
|
||||
case Disp_Id_Kind::DDC2B:
|
||||
/* if GPIO pins are in the output mode, pick up their values
|
||||
In the input mode, GPIO pins will be read "high" */
|
||||
scl = (dirs & 0x1000) ? !!(data & 0x1000) : 1;
|
||||
sda = (dirs & 0x2000) ? !!(data & 0x2000) : 1;
|
||||
|
||||
return update_ddc_i2c(sda, scl);
|
||||
} else { /* Apple legacy monitor codes (see Technical Note HW30) */
|
||||
case Disp_Id_Kind::AppleSense:
|
||||
switch (dirs & 0x3100) {
|
||||
case 0:
|
||||
result = ((this->std_sense_code & 6) << 11) | ((this->std_sense_code & 1) << 8);
|
||||
@ -98,7 +97,6 @@ uint16_t DisplayID::read_monitor_sense(uint16_t data, uint16_t dirs)
|
||||
default:
|
||||
result = 0x3100U;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
video cards.
|
||||
|
||||
DisplayID provides two methods for display identification:
|
||||
- Apple monitor sense codes as described in the Technical Note HW30
|
||||
- Apple monitor sense as described in the Technical Note HW30
|
||||
- Display Data Channel (DDC) standardized by VESA
|
||||
*/
|
||||
|
||||
@ -35,6 +35,12 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <cinttypes>
|
||||
|
||||
/* Supported diplay ID methods. */
|
||||
enum class Disp_Id_Kind {
|
||||
AppleSense,
|
||||
DDC2B,
|
||||
};
|
||||
|
||||
/** I2C bus states. */
|
||||
enum I2CState : uint8_t {
|
||||
STOP = 0, /* transaction started */
|
||||
@ -49,7 +55,7 @@ enum I2CState : uint8_t {
|
||||
|
||||
class DisplayID {
|
||||
public:
|
||||
DisplayID();
|
||||
DisplayID(Disp_Id_Kind id_kind);
|
||||
~DisplayID() = default;
|
||||
|
||||
uint16_t read_monitor_sense(uint16_t data, uint16_t dirs);
|
||||
@ -59,7 +65,7 @@ protected:
|
||||
uint16_t update_ddc_i2c(uint8_t sda, uint8_t scl);
|
||||
|
||||
private:
|
||||
bool i2c_on;
|
||||
Disp_Id_Kind id_kind;
|
||||
|
||||
uint8_t std_sense_code;
|
||||
uint8_t ext_sense_code;
|
||||
|
Loading…
Reference in New Issue
Block a user