coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
dsi.c File Reference
#include <commonlib/helpers.h>
#include <console/console.h>
#include <device/mmio.h>
#include <delay.h>
#include <timer.h>
#include <soc/addressmap.h>
#include <soc/clock.h>
#include <device/device.h>
#include <edid.h>
#include <soc/nvidia/tegra/types.h>
#include <soc/nvidia/tegra/dc.h>
#include <soc/display.h>
#include <soc/mipi_dsi.h>
#include <soc/mipi_display.h>
#include <soc/tegra_dsi.h>
#include <soc/mipi-phy.h>
#include <types.h>
#include "chip.h"
#include "jdi_25x18_display/panel-jdi-lpm102a188a.h"
Include dependency graph for dsi.c:

Go to the source code of this file.

Functions

static struct tegra_dsihost_to_tegra (struct mipi_dsi_host *host)
 
static int tegra_dsi_set_phy_timing (struct tegra_dsi *dsi)
 
static int tegra_dsi_get_muldiv (enum mipi_dsi_pixel_format format, unsigned int *mulp, unsigned int *divp)
 
static int tegra_dsi_get_format (enum mipi_dsi_pixel_format format, enum tegra_dsi_format *fmt)
 
static void tegra_dsi_ganged_enable (struct tegra_dsi *dsi, unsigned int start, unsigned int size)
 
static void tegra_dsi_enable (struct tegra_dsi *dsi)
 
static int tegra_dsi_configure (struct tegra_dsi *dsi, unsigned int pipe, const struct soc_nvidia_tegra210_config *mode)
 
static int tegra_output_dsi_enable (struct tegra_dsi *dsi, const struct soc_nvidia_tegra210_config *config)
 
static void tegra_dsi_set_timeout (struct tegra_dsi *dsi, unsigned long bclk, unsigned int vrefresh)
 
static int tegra_output_dsi_setup_clock (struct tegra_dsi *dsi, const struct soc_nvidia_tegra210_config *config)
 
static int tegra_dsi_pad_enable (struct tegra_dsi *dsi)
 
static int tegra_dsi_pad_calibrate (struct tegra_dsi *dsi)
 
static int tegra_dsi_read_response (struct tegra_dsi *dsi, const struct mipi_dsi_msg *msg, unsigned int count)
 
static int tegra_dsi_transmit (struct tegra_dsi *dsi, unsigned long timeout_ms)
 
static int tegra_dsi_wait_for_response (struct tegra_dsi *dsi, unsigned long timeout_ms)
 
static ssize_t tegra_dsi_host_transfer (struct mipi_dsi_host *host, const struct mipi_dsi_msg *msg)
 
static int tegra_dsi_ganged_setup (struct tegra_dsi *dsi, struct tegra_dsi *slave)
 
static int tegra_dsi_host_attach (struct mipi_dsi_host *host, struct mipi_dsi_device *device)
 
static int dsi_probe_if (int dsi_index, struct soc_nvidia_tegra210_config *config)
 
static int dsi_probe (struct soc_nvidia_tegra210_config *config)
 
static void tegra_dsi_init_regs (struct tegra_dsi *dsi)
 
static int dsi_enable (struct soc_nvidia_tegra210_config *config)
 
void dsi_display_startup (struct device *dev)
 

Variables

struct tegra_mipi_device mipi_device_data [NUM_DSI]
 
struct tegra_dsi dsi_data [NUM_DSI]
 
static const u32 init_reg []
 
static const u32 pkt_seq_video_non_burst_sync_pulses [NUM_PKT_SEQ]
 
static const u32 pkt_seq_video_non_burst_sync_events [NUM_PKT_SEQ]
 
static const u32 pkt_seq_command_mode [NUM_PKT_SEQ]
 
static const char *const error_report [16]
 
static const struct mipi_dsi_host_ops tegra_dsi_host_ops
 

Function Documentation

◆ dsi_display_startup()

void dsi_display_startup ( struct device dev)

Definition at line 952 of file dsi.c.

References ALIGN_UP, BIOS_ERR, BIOS_INFO, device::chip_info, clock_configure_plld(), clock_configure_source, config, dsi_enable(), KHz, MiB, NULL, pass_mode_info_to_payload(), PLLD_OUT0, printk, tegra_dc_init(), update_display_mode(), and update_window().

Referenced by display_startup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dsi_enable()

static int dsi_enable ( struct soc_nvidia_tegra210_config config)
static

Definition at line 921 of file dsi.c.

References APB_MISC_GP_MIPI_PAD_CTRL_0, BIOS_ERR, config, DSI_A, dsi_data, dsi_probe(), DSIB_MODE_DSI, tegra_dsi::panel, panel_jdi_prepare(), printk, tegra_dsi_init_regs(), tegra_dsi_set_phy_timing(), tegra_output_dsi_enable(), tegra_output_dsi_setup_clock(), and write32().

Referenced by dsi_display_startup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dsi_probe()

static int dsi_probe ( struct soc_nvidia_tegra210_config config)
static

Definition at line 904 of file dsi.c.

References config, DSI_A, DSI_B, and dsi_probe_if().

Referenced by dsi_enable().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dsi_probe_if()

◆ host_to_tegra()

static struct tegra_dsi* host_to_tegra ( struct mipi_dsi_host host)
inlinestatic

Definition at line 86 of file dsi.c.

References container_of, and tegra_dsi::host.

Referenced by tegra_dsi_host_attach(), and tegra_dsi_host_transfer().

Here is the caller graph for this function:

◆ tegra_dsi_configure()

◆ tegra_dsi_enable()

static void tegra_dsi_enable ( struct tegra_dsi dsi)
static

Definition at line 257 of file dsi.c.

References DSI_POWER_CONTROL, DSI_POWER_CONTROL_ENABLE, tegra_dsi::slave, tegra_dsi_readl(), tegra_dsi_writel(), and value.

Referenced by tegra_output_dsi_enable().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tegra_dsi_ganged_enable()

static void tegra_dsi_ganged_enable ( struct tegra_dsi dsi,
unsigned int  start,
unsigned int  size 
)
static

Definition at line 245 of file dsi.c.

References DSI_GANGED_MODE_CONTROL, DSI_GANGED_MODE_CONTROL_ENABLE, DSI_GANGED_MODE_SIZE, DSI_GANGED_MODE_START, tegra_dsi_writel(), and value.

Referenced by tegra_dsi_configure().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tegra_dsi_ganged_setup()

static int tegra_dsi_ganged_setup ( struct tegra_dsi dsi,
struct tegra_dsi slave 
)
static

Definition at line 821 of file dsi.c.

References tegra_dsi::ganged_lanes, tegra_dsi::ganged_mode, tegra_dsi::lanes, and tegra_dsi::slave.

Referenced by tegra_dsi_host_attach().

Here is the caller graph for this function:

◆ tegra_dsi_get_format()

static int tegra_dsi_get_format ( enum mipi_dsi_pixel_format  format,
enum tegra_dsi_format fmt 
)
static

◆ tegra_dsi_get_muldiv()

static int tegra_dsi_get_muldiv ( enum mipi_dsi_pixel_format  format,
unsigned int *  mulp,
unsigned int *  divp 
)
static

Definition at line 193 of file dsi.c.

References EINVAL, tegra_dsi::format, MIPI_DSI_FMT_RGB565, MIPI_DSI_FMT_RGB666, MIPI_DSI_FMT_RGB666_PACKED, and MIPI_DSI_FMT_RGB888.

Referenced by tegra_dsi_configure(), and tegra_output_dsi_setup_clock().

Here is the caller graph for this function:

◆ tegra_dsi_host_attach()

static int tegra_dsi_host_attach ( struct mipi_dsi_host host,
struct mipi_dsi_device device 
)
static

Definition at line 836 of file dsi.c.

References BIOS_ERR, tegra_dsi::flags, tegra_dsi::format, tegra_dsi::host, host_to_tegra(), tegra_dsi::lanes, tegra_dsi::master, printk, and tegra_dsi_ganged_setup().

Here is the call graph for this function:

◆ tegra_dsi_host_transfer()

◆ tegra_dsi_init_regs()

static void tegra_dsi_init_regs ( struct tegra_dsi dsi)
static

Definition at line 911 of file dsi.c.

References ARRAY_SIZE, init_reg, tegra_dsi::slave, and tegra_dsi_writel().

Referenced by dsi_enable().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tegra_dsi_pad_calibrate()

static int tegra_dsi_pad_calibrate ( struct tegra_dsi dsi)
static

◆ tegra_dsi_pad_enable()

static int tegra_dsi_pad_enable ( struct tegra_dsi dsi)
static

Definition at line 522 of file dsi.c.

References DSI_PAD_CONTROL_0, DSI_PAD_CONTROL_VS1_PDIO, DSI_PAD_CONTROL_VS1_PULLDN, tegra_dsi_writel(), and value.

Referenced by tegra_dsi_pad_calibrate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tegra_dsi_read_response()

static int tegra_dsi_read_response ( struct tegra_dsi dsi,
const struct mipi_dsi_msg msg,
unsigned int  count 
)
static

◆ tegra_dsi_set_phy_timing()

static int tegra_dsi_set_phy_timing ( struct tegra_dsi dsi)
static

Definition at line 178 of file dsi.c.

References BIOS_ERR, mipi_dphy_set_timing(), printk, and tegra_dsi::slave.

Referenced by dsi_enable().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tegra_dsi_set_timeout()

static void tegra_dsi_set_timeout ( struct tegra_dsi dsi,
unsigned long  bclk,
unsigned int  vrefresh 
)
static

Definition at line 437 of file dsi.c.

References DSI_TALLY_HTX, DSI_TALLY_LRX, DSI_TALLY_TA, DSI_TIMEOUT_0, DSI_TIMEOUT_1, DSI_TIMEOUT_HTX, DSI_TIMEOUT_LRX, DSI_TIMEOUT_PR, DSI_TIMEOUT_TA, DSI_TO_TALLY, tegra_dsi::slave, tegra_dsi_writel(), and value.

Referenced by tegra_output_dsi_setup_clock().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tegra_dsi_transmit()

static int tegra_dsi_transmit ( struct tegra_dsi dsi,
unsigned long  timeout_ms 
)
static

Definition at line 635 of file dsi.c.

References BIOS_ERR, DSI_TRIGGER, DSI_TRIGGER_HOST, ETIMEDOUT, printk, tegra_dsi_readl(), tegra_dsi_writel(), udelay(), and value.

Referenced by tegra_dsi_host_transfer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tegra_dsi_wait_for_response()

static int tegra_dsi_wait_for_response ( struct tegra_dsi dsi,
unsigned long  timeout_ms 
)
static

Definition at line 662 of file dsi.c.

References BIOS_ERR, count, DSI_STATUS, ETIMEDOUT, printk, tegra_dsi_readl(), udelay(), and value.

Referenced by tegra_dsi_host_transfer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tegra_output_dsi_enable()

static int tegra_output_dsi_enable ( struct tegra_dsi dsi,
const struct soc_nvidia_tegra210_config config 
)
static

Definition at line 416 of file dsi.c.

References BIOS_ERR, config, tegra_dsi::enabled, printk, tegra_dsi_configure(), and tegra_dsi_enable().

Referenced by dsi_enable().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tegra_output_dsi_setup_clock()

static int tegra_output_dsi_setup_clock ( struct tegra_dsi dsi,
const struct soc_nvidia_tegra210_config config 
)
static

Variable Documentation

◆ dsi_data

struct tegra_dsi dsi_data[NUM_DSI]
Initial value:
= {
{
.regs = (void *)TEGRA_DSIA_BASE,
.channel = 0,
.master = NULL,
.video_fifo_depth = MAX_DSI_VIDEO_FIFO_DEPTH,
.host_fifo_depth = MAX_DSI_HOST_FIFO_DEPTH,
},
{
.regs = (void *)TEGRA_DSIB_BASE,
.channel = 0,
.slave = NULL,
.master = &dsi_data[DSI_A],
.video_fifo_depth = MAX_DSI_VIDEO_FIFO_DEPTH,
.host_fifo_depth = MAX_DSI_HOST_FIFO_DEPTH,
},
}
struct tegra_dsi dsi_data[NUM_DSI]
Definition: dsi.c:26
@ TEGRA_DSIA_BASE
Definition: addressmap.h:23
@ TEGRA_DSIB_BASE
Definition: addressmap.h:24
static struct spi_slave slave
Definition: spiconsole.c:7
#define NULL
Definition: stddef.h:19
#define MAX_DSI_HOST_FIFO_DEPTH
Definition: tegra_dsi.h:168
@ DSI_B
Definition: tegra_dsi.h:158
@ DSI_A
Definition: tegra_dsi.h:157
#define MAX_DSI_VIDEO_FIFO_DEPTH
Definition: tegra_dsi.h:167

Definition at line 1 of file dsi.c.

Referenced by dsi_enable(), and dsi_probe_if().

◆ error_report

const char* const error_report[16]
static
Initial value:
= {
"SoT Error",
"SoT Sync Error",
"EoT Sync Error",
"Escape Mode Entry Command Error",
"Low-Power Transmit Sync Error",
"Peripheral Timeout Error",
"False Control Error",
"Contention Detected",
"ECC Error, single-bit",
"ECC Error, multi-bit",
"Checksum Error",
"DSI Data Type Not Recognized",
"DSI VC ID Invalid",
"Invalid Transmission Length",
"Reserved",
"DSI Protocol Violation",
}

Definition at line 556 of file dsi.c.

Referenced by tegra_dsi_read_response().

◆ init_reg

const u32 init_reg[]
static

Definition at line 45 of file dsi.c.

Referenced by tegra_dsi_init_regs().

◆ mipi_device_data

struct tegra_mipi_device mipi_device_data[NUM_DSI]

Definition at line 1 of file dsi.c.

Referenced by dsi_probe_if().

◆ pkt_seq_command_mode

const u32 pkt_seq_command_mode[NUM_PKT_SEQ]
static
Initial value:
= {
[ 0] = 0,
[ 1] = 0,
[ 2] = 0,
[ 3] = 0,
[ 4] = 0,
[ 5] = 0,
[ 7] = 0,
[ 8] = 0,
[ 9] = 0,
[11] = 0,
}
@ MIPI_DSI_DCS_LONG_WRITE
Definition: dsi.h:38
#define PKT_LP
Definition: tegra_dsi.h:138
#define PKT_LEN0(len)
Definition: tegra_dsi.h:132
#define PKT_ID0(id)
Definition: tegra_dsi.h:131

Definition at line 163 of file dsi.c.

Referenced by tegra_dsi_configure().

◆ pkt_seq_video_non_burst_sync_events

const u32 pkt_seq_video_non_burst_sync_events[NUM_PKT_SEQ]
static
Initial value:
= {
[ 1] = 0,
[ 3] = 0,
[ 5] = 0,
[ 9] = 0,
}
@ MIPI_DSI_H_SYNC_START
Definition: dsi.h:10
@ MIPI_DSI_END_OF_TRANSMISSION
Definition: dsi.h:33
@ MIPI_DSI_V_SYNC_START
Definition: dsi.h:8
@ MIPI_DSI_PACKED_PIXEL_STREAM_24
Definition: dsi.h:51
@ MIPI_DSI_BLANKING_PACKET
Definition: dsi.h:36
#define PKT_LEN1(len)
Definition: tegra_dsi.h:134
#define PKT_ID2(id)
Definition: tegra_dsi.h:135
#define PKT_ID1(id)
Definition: tegra_dsi.h:133
#define PKT_LEN2(len)
Definition: tegra_dsi.h:136

Definition at line 132 of file dsi.c.

Referenced by tegra_dsi_configure().

◆ pkt_seq_video_non_burst_sync_pulses

const u32 pkt_seq_video_non_burst_sync_pulses[NUM_PKT_SEQ]
static

Definition at line 94 of file dsi.c.

Referenced by tegra_dsi_configure().

◆ tegra_dsi_host_ops

const struct mipi_dsi_host_ops tegra_dsi_host_ops
static
Initial value:
= {
}
static ssize_t tegra_dsi_host_transfer(struct mipi_dsi_host *host, const struct mipi_dsi_msg *msg)
Definition: dsi.c:688
static int tegra_dsi_host_attach(struct mipi_dsi_host *host, struct mipi_dsi_device *device)
Definition: dsi.c:836

Definition at line 836 of file dsi.c.

Referenced by dsi_probe_if().