Skip to content

Commit

Permalink
target: msm8916: add support to send the i2c commands
Browse files Browse the repository at this point in the history
To communicate to the DSI2HDMI bridge chip i2c commands
are required. These i2c commands are required to set up
the bridge chip and to communicate the incoming data's
mode and timing parameters.

This change enables the support for the same.

Change-Id: I2dfe54c0d902547c5dc48d3ea2e610de2ce3285e
(cherry picked from commit a83cf80)
  • Loading branch information
Vineet Bajaj authored and stephan-gh committed Jan 1, 2022
1 parent ea4e65b commit afcdaea
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
1 change: 1 addition & 0 deletions dev/gcdb/display/gcdb_display.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ int target_panel_clock(uint8_t enable, struct msm_panel_info *pinfo);
int target_panel_reset(uint8_t enable, struct panel_reset_sequence *resetseq,
struct msm_panel_info *pinfo);
int target_ldo_ctrl(uint8_t enable, struct msm_panel_info *pinfo);
int target_display_dsi2hdmi_config(struct msm_panel_info *pinfo);

int gcdb_display_init(const char *panel_name, uint32_t rev, void *base);
bool gcdb_display_cmdline_arg(char *panel_name, char *pbuf, uint16_t buf_size);
Expand Down
46 changes: 46 additions & 0 deletions target/msm8916/target_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include <target/display.h>
#include <i2c_qup.h>
#include <blsp_qup.h>
#include <mipi_dsi_i2c.h>

#include "include/panel.h"
#include "include/display_resource.h"
Expand Down Expand Up @@ -297,6 +298,51 @@ static int qrd_lcd_i2c_write(uint8_t addr, uint8_t val)
return 0;
}

static int dsi2HDMI_i2c_write_regs(struct mipi_dsi_i2c_cmd *cfg, int size)
{
int ret = NO_ERROR;
int i;

if (!cfg)
return ERR_INVALID_ARGS;

for (i = 0; i < size; i++) {
ret = mipi_dsi_i2c_write_byte(cfg[i].i2c_addr, cfg[i].reg,
cfg[i].val);
if (ret) {
dprintf(CRITICAL, "mipi_dsi reg writes failed\n");
goto w_regs_fail;
}
if (cfg[i].sleep_in_ms) {
udelay(cfg[i].sleep_in_ms*1000);
}
}
w_regs_fail:
return ret;
}

int target_display_dsi2hdmi_config(struct msm_panel_info *pinfo)
{
int ret = NO_ERROR;

if (!pinfo)
return ERR_INVALID_ARGS;

/*
* If dsi to HDMI bridge chip connected then
* send I2c commands to the chip
*/
if (pinfo->adv7533.dsi_setup_cfg_i2c_cmd)
ret = dsi2HDMI_i2c_write_regs(pinfo->adv7533.dsi_setup_cfg_i2c_cmd,
pinfo->adv7533.num_of_cfg_i2c_cmds);

if (pinfo->adv7533.dsi_tg_i2c_cmd)
ret = dsi2HDMI_i2c_write_regs(pinfo->adv7533.dsi_tg_i2c_cmd,
pinfo->adv7533.num_of_tg_i2c_cmds);

return ret;
}

static int target_panel_reset_skuh(uint8_t enable)
{
int ret = NO_ERROR;
Expand Down
5 changes: 5 additions & 0 deletions target/target_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,8 @@ __WEAK int target_hdmi_gpio_ctrl(bool enable)
{
return 0;
}

__WEAK int target_display_dsi2hdmi_config(struct msm_panel_info *pinfo)
{
return 0;
}

0 comments on commit afcdaea

Please sign in to comment.