Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
edid debug: some cleanup
- make i2c optional on hdmi out(test presence of scl pad)
- remove i2c on hdmi_out1 on atlys (not possible to have both i2c input/output this board for this port)
- don't use number in edid command but port name
  • Loading branch information
enjoy-digital committed Dec 3, 2015
1 parent 35cac62 commit 480cd42
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 28 deletions.
39 changes: 18 additions & 21 deletions firmware/lm32/ci.c
Expand Up @@ -18,7 +18,6 @@
#include "hdmi_out1.h"

int status_enabled;
int edid_debug_enabled = 0;

void print_board_dna(void) {
int i;
Expand Down Expand Up @@ -601,26 +600,24 @@ void ci_service(void)
debug_ddr();
else if(strcmp(token, "dna") == 0)
print_board_dna();
#ifdef CSR_HDMI_OUT0_BASE
else if(strcmp(token, "edid") == 0)
{
token = get_token(&str);
if(strcmp(token, "0") == 0)
hdmi_out0_print_edid();
#ifdef CSR_HDMI_OUT1_BASE
else if(strcmp(token, "1") == 0)
hdmi_out1_print_edid();
#endif
else
printf("Unknown output %s, enter "
#ifdef CSR_HDMI_OUT1_BASE
"either 0 or 1\n", token);
#else
"0\n", token);
#endif
}
#endif
else
else if(strcmp(token, "edid") == 0) {
unsigned int found = 0;
token = get_token(&str);
#ifdef CSR_HDMI_OUT0_I2C_W_ADDR
if(strcmp(token, "output0") == 0) {
found = 1;
hdmi_out0_print_edid();
}
#endif
#ifdef CSR_HDMI_OUT1_I2C_W_ADDR
if(strcmp(token, "output1") == 0) {
found = 1;
hdmi_out1_print_edid();
}
#endif
if(found == 0)
printf("%s port has no EDID capabilities\n", token);
} else
help_debug();
} else {
if(status_enabled)
Expand Down
3 changes: 3 additions & 0 deletions firmware/lm32/hdmi_out0.c
Expand Up @@ -4,6 +4,7 @@
#include "i2c.h"
#include "hdmi_out0.h"

#ifdef CSR_HDMI_OUT0_I2C_W_ADDR
/* I2C bit banging */
int hdmi_out0_i2c_started;
int hdmi_out0_debug_enabled = 0;
Expand Down Expand Up @@ -164,4 +165,6 @@ void hdmi_out0_print_edid(void) {
hdmi_out0_i2c_stop_cond();
}

#endif

#endif
2 changes: 1 addition & 1 deletion firmware/lm32/hdmi_out0.h
@@ -1,5 +1,5 @@
#include <generated/csr.h>
#ifdef CSR_HDMI_OUT0_BASE
#ifdef CSR_HDMI_OUT0_I2C_W_ADDR

int hdmi_out0_i2c_init(void);
void hdmi_out0_print_edid(void);
Expand Down
3 changes: 3 additions & 0 deletions firmware/lm32/hdmi_out1.c
Expand Up @@ -4,6 +4,7 @@
#include "i2c.h"
#include "hdmi_out1.h"

#ifdef CSR_HDMI_OUT1_I2C_W_ADDR
/* I2C bit banging */
int hdmi_out1_i2c_started;
int hdmi_out1_debug_enabled = 0;
Expand Down Expand Up @@ -164,4 +165,6 @@ void hdmi_out1_print_edid(void) {
hdmi_out1_i2c_stop_cond();
}

#endif

#endif
2 changes: 1 addition & 1 deletion firmware/lm32/hdmi_out1.h
@@ -1,5 +1,5 @@
#include <generated/csr.h>
#ifdef CSR_HDMI_OUT1_BASE
#ifdef CSR_HDMI_OUT1_I2C_W_ADDR

int hdmi_out1_i2c_init(void);
void hdmi_out1_print_edid(void);
Expand Down
4 changes: 2 additions & 2 deletions firmware/lm32/main.c
Expand Up @@ -22,10 +22,10 @@ int main(void)
irq_setmask(0);
irq_setie(1);
uart_init();
#ifdef CSR_HDMI_OUT0_BASE
#ifdef CSR_HDMI_OUT0_I2C_W_ADDR
hdmi_out0_i2c_init();
#endif
#ifdef CSR_HDMI_OUT1_BASE
#ifdef CSR_HDMI_OUT1_I2C_W_ADDR
hdmi_out1_i2c_init();
#endif

Expand Down
3 changes: 2 additions & 1 deletion gateware/hdmi_out/__init__.py
Expand Up @@ -14,7 +14,8 @@ class HDMIOut(Module, AutoCSR):
def __init__(self, pads, lasmim, external_clocking=None):
pack_factor = lasmim.dw//bpp

self.submodules.i2c = I2C(pads)
if hasattr(pads, "scl"):
self.submodules.i2c = I2C(pads)

g = DataFlowGraph()

Expand Down
4 changes: 2 additions & 2 deletions platforms/atlys.py
Expand Up @@ -423,8 +423,8 @@
Subsignal("data2_p", Pins("N5"), IOStandard("TMDS_33")),
Subsignal("data2_n", Pins("P6"), IOStandard("TMDS_33")),
# Make sure JP2 is connected. Shared with JA.
Subsignal("scl", Pins("C13"), IOStandard("I2C")),
Subsignal("sda", Pins("A13"), IOStandard("I2C")),
#Subsignal("scl", Pins("C13"), IOStandard("LVCMOS33")),
#Subsignal("sda", Pins("A13"), IOStandard("LVCMOS33")),
),

# ("fpga_cfg",
Expand Down

0 comments on commit 480cd42

Please sign in to comment.