#include <asm/unaligned.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/irq.h>
#include <linux/media-bus-format.h>
#include <linux/of.h>
#include <linux/phy/phy.h>
#include <linux/platform_device.h>
#include <video/mipi_display.h>
#include <drm/bridge/samsung-dsim.h>
#include <drm/drm_panel.h>
#include <drm/drm_print.h>
#define NEQV(a, b) …
#define DSIM_STOP_STATE_DAT(x) …
#define DSIM_STOP_STATE_CLK …
#define DSIM_TX_READY_HS_CLK …
#define DSIM_PLL_STABLE …
#define DSIM_FUNCRST …
#define DSIM_SWRST …
#define DSIM_LPDR_TIMEOUT(x) …
#define DSIM_BTA_TIMEOUT(x) …
#define DSIM_ESC_PRESCALER(x) …
#define DSIM_ESC_PRESCALER_MASK …
#define DSIM_LANE_ESC_CLK_EN_CLK …
#define DSIM_LANE_ESC_CLK_EN_DATA(x) …
#define DSIM_LANE_ESC_CLK_EN_DATA_MASK …
#define DSIM_BYTE_CLKEN …
#define DSIM_BYTE_CLK_SRC(x) …
#define DSIM_BYTE_CLK_SRC_MASK …
#define DSIM_PLL_BYPASS …
#define DSIM_ESC_CLKEN …
#define DSIM_TX_REQUEST_HSCLK …
#define DSIM_LANE_EN_CLK …
#define DSIM_LANE_EN(x) …
#define DSIM_NUM_OF_DATA_LANE(x) …
#define DSIM_SUB_PIX_FORMAT(x) …
#define DSIM_MAIN_PIX_FORMAT_MASK …
#define DSIM_MAIN_PIX_FORMAT_RGB888 …
#define DSIM_MAIN_PIX_FORMAT_RGB666 …
#define DSIM_MAIN_PIX_FORMAT_RGB666_P …
#define DSIM_MAIN_PIX_FORMAT_RGB565 …
#define DSIM_SUB_VC …
#define DSIM_MAIN_VC …
#define DSIM_HSA_DISABLE_MODE …
#define DSIM_HBP_DISABLE_MODE …
#define DSIM_HFP_DISABLE_MODE …
#define DSIM_HSE_DISABLE_MODE …
#define DSIM_AUTO_MODE …
#define DSIM_VIDEO_MODE …
#define DSIM_BURST_MODE …
#define DSIM_SYNC_INFORM …
#define DSIM_EOT_DISABLE …
#define DSIM_MFLUSH_VS …
#define DSIM_CLKLANE_STOP …
#define DSIM_NON_CONTINUOUS_CLKLANE …
#define DSIM_TX_TRIGGER_RST …
#define DSIM_TX_LPDT_LP …
#define DSIM_CMD_LPDT_LP …
#define DSIM_FORCE_BTA …
#define DSIM_FORCE_STOP_STATE …
#define DSIM_STOP_STATE_CNT(x) …
#define DSIM_STOP_STATE_CNT_MASK …
#define DSIM_MAIN_STAND_BY …
#define DSIM_MAIN_VRESOL(x, num_bits) …
#define DSIM_MAIN_HRESOL(x, num_bits) …
#define DSIM_CMD_ALLOW(x) …
#define DSIM_STABLE_VFP(x) …
#define DSIM_MAIN_VBP(x) …
#define DSIM_CMD_ALLOW_MASK …
#define DSIM_STABLE_VFP_MASK …
#define DSIM_MAIN_VBP_MASK …
#define DSIM_MAIN_HFP(x) …
#define DSIM_MAIN_HBP(x) …
#define DSIM_MAIN_HFP_MASK …
#define DSIM_MAIN_HBP_MASK …
#define DSIM_MAIN_VSA(x) …
#define DSIM_MAIN_HSA(x) …
#define DSIM_MAIN_VSA_MASK …
#define DSIM_MAIN_HSA_MASK …
#define DSIM_SUB_STANDY(x) …
#define DSIM_SUB_VRESOL(x) …
#define DSIM_SUB_HRESOL(x) …
#define DSIM_SUB_STANDY_MASK …
#define DSIM_SUB_VRESOL_MASK …
#define DSIM_SUB_HRESOL_MASK …
#define DSIM_INT_PLL_STABLE …
#define DSIM_INT_SW_RST_RELEASE …
#define DSIM_INT_SFR_FIFO_EMPTY …
#define DSIM_INT_SFR_HDR_FIFO_EMPTY …
#define DSIM_INT_BTA …
#define DSIM_INT_FRAME_DONE …
#define DSIM_INT_RX_TIMEOUT …
#define DSIM_INT_BTA_TIMEOUT …
#define DSIM_INT_RX_DONE …
#define DSIM_INT_RX_TE …
#define DSIM_INT_RX_ACK …
#define DSIM_INT_RX_ECC_ERR …
#define DSIM_INT_RX_CRC_ERR …
#define DSIM_RX_DATA_FULL …
#define DSIM_RX_DATA_EMPTY …
#define DSIM_SFR_HEADER_FULL …
#define DSIM_SFR_HEADER_EMPTY …
#define DSIM_SFR_PAYLOAD_FULL …
#define DSIM_SFR_PAYLOAD_EMPTY …
#define DSIM_I80_HEADER_FULL …
#define DSIM_I80_HEADER_EMPTY …
#define DSIM_I80_PAYLOAD_FULL …
#define DSIM_I80_PAYLOAD_EMPTY …
#define DSIM_SD_HEADER_FULL …
#define DSIM_SD_HEADER_EMPTY …
#define DSIM_SD_PAYLOAD_FULL …
#define DSIM_SD_PAYLOAD_EMPTY …
#define DSIM_MD_HEADER_FULL …
#define DSIM_MD_HEADER_EMPTY …
#define DSIM_MD_PAYLOAD_FULL …
#define DSIM_MD_PAYLOAD_EMPTY …
#define DSIM_RX_FIFO …
#define DSIM_SFR_FIFO …
#define DSIM_I80_FIFO …
#define DSIM_SD_FIFO …
#define DSIM_MD_FIFO …
#define DSIM_AFC_EN …
#define DSIM_AFC_CTL(x) …
#define DSIM_PLL_DPDNSWAP_CLK …
#define DSIM_PLL_DPDNSWAP_DAT …
#define DSIM_FREQ_BAND(x) …
#define DSIM_PLL_EN …
#define DSIM_PLL_P(x, offset) …
#define DSIM_PLL_M(x) …
#define DSIM_PLL_S(x) …
#define DSIM_PHYCTRL_ULPS_EXIT(x) …
#define DSIM_PHYCTRL_B_DPHYCTL_VREG_LP …
#define DSIM_PHYCTRL_B_DPHYCTL_SLEW_UP …
#define DSIM_PHYTIMING_LPX(x) …
#define DSIM_PHYTIMING_HS_EXIT(x) …
#define DSIM_PHYTIMING1_CLK_PREPARE(x) …
#define DSIM_PHYTIMING1_CLK_ZERO(x) …
#define DSIM_PHYTIMING1_CLK_POST(x) …
#define DSIM_PHYTIMING1_CLK_TRAIL(x) …
#define DSIM_PHYTIMING2_HS_PREPARE(x) …
#define DSIM_PHYTIMING2_HS_ZERO(x) …
#define DSIM_PHYTIMING2_HS_TRAIL(x) …
#define DSI_MAX_BUS_WIDTH …
#define DSI_NUM_VIRTUAL_CHANNELS …
#define DSI_TX_FIFO_SIZE …
#define DSI_RX_FIFO_SIZE …
#define DSI_XFER_TIMEOUT_MS …
#define DSI_RX_FIFO_EMPTY …
#define OLD_SCLK_MIPI_CLK_NAME …
#define PS_TO_CYCLE(ps, hz) …
static const char *const clk_names[5] = …;
enum samsung_dsim_transfer_type { … };
enum reg_idx { … };
static const unsigned int exynos_reg_ofs[] = …;
static const unsigned int exynos5433_reg_ofs[] = …;
enum reg_value_idx { … };
static const unsigned int reg_values[] = …;
static const unsigned int exynos5422_reg_values[] = …;
static const unsigned int exynos5433_reg_values[] = …;
static const unsigned int imx8mm_dsim_reg_values[] = …;
static const struct samsung_dsim_driver_data exynos3_dsi_driver_data = …;
static const struct samsung_dsim_driver_data exynos4_dsi_driver_data = …;
static const struct samsung_dsim_driver_data exynos5_dsi_driver_data = …;
static const struct samsung_dsim_driver_data exynos5433_dsi_driver_data = …;
static const struct samsung_dsim_driver_data exynos5422_dsi_driver_data = …;
static const struct samsung_dsim_driver_data imx8mm_dsi_driver_data = …;
static const struct samsung_dsim_driver_data *
samsung_dsim_types[DSIM_TYPE_COUNT] = …;
static inline struct samsung_dsim *host_to_dsi(struct mipi_dsi_host *h)
{ … }
static inline struct samsung_dsim *bridge_to_dsi(struct drm_bridge *b)
{ … }
static inline void samsung_dsim_write(struct samsung_dsim *dsi,
enum reg_idx idx, u32 val)
{ … }
static inline u32 samsung_dsim_read(struct samsung_dsim *dsi, enum reg_idx idx)
{ … }
static void samsung_dsim_wait_for_reset(struct samsung_dsim *dsi)
{ … }
static void samsung_dsim_reset(struct samsung_dsim *dsi)
{ … }
#ifndef MHZ
#define MHZ …
#endif
static unsigned long samsung_dsim_pll_find_pms(struct samsung_dsim *dsi,
unsigned long fin,
unsigned long fout,
u8 *p, u16 *m, u8 *s)
{ … }
static unsigned long samsung_dsim_set_pll(struct samsung_dsim *dsi,
unsigned long freq)
{ … }
static int samsung_dsim_enable_clock(struct samsung_dsim *dsi)
{ … }
static void samsung_dsim_set_phy_ctrl(struct samsung_dsim *dsi)
{ … }
static void samsung_dsim_disable_clock(struct samsung_dsim *dsi)
{ … }
static void samsung_dsim_enable_lane(struct samsung_dsim *dsi, u32 lane)
{ … }
static int samsung_dsim_init_link(struct samsung_dsim *dsi)
{ … }
static void samsung_dsim_set_display_mode(struct samsung_dsim *dsi)
{ … }
static void samsung_dsim_set_display_enable(struct samsung_dsim *dsi, bool enable)
{ … }
static int samsung_dsim_wait_for_hdr_fifo(struct samsung_dsim *dsi)
{ … }
static void samsung_dsim_set_cmd_lpm(struct samsung_dsim *dsi, bool lpm)
{ … }
static void samsung_dsim_force_bta(struct samsung_dsim *dsi)
{ … }
static void samsung_dsim_send_to_fifo(struct samsung_dsim *dsi,
struct samsung_dsim_transfer *xfer)
{ … }
static void samsung_dsim_read_from_fifo(struct samsung_dsim *dsi,
struct samsung_dsim_transfer *xfer)
{ … }
static void samsung_dsim_transfer_start(struct samsung_dsim *dsi)
{ … }
static bool samsung_dsim_transfer_finish(struct samsung_dsim *dsi)
{ … }
static void samsung_dsim_remove_transfer(struct samsung_dsim *dsi,
struct samsung_dsim_transfer *xfer)
{ … }
static int samsung_dsim_transfer(struct samsung_dsim *dsi,
struct samsung_dsim_transfer *xfer)
{ … }
static irqreturn_t samsung_dsim_irq(int irq, void *dev_id)
{ … }
static void samsung_dsim_enable_irq(struct samsung_dsim *dsi)
{ … }
static void samsung_dsim_disable_irq(struct samsung_dsim *dsi)
{ … }
static int samsung_dsim_init(struct samsung_dsim *dsi)
{ … }
static void samsung_dsim_atomic_pre_enable(struct drm_bridge *bridge,
struct drm_bridge_state *old_bridge_state)
{ … }
static void samsung_dsim_atomic_enable(struct drm_bridge *bridge,
struct drm_bridge_state *old_bridge_state)
{ … }
static void samsung_dsim_atomic_disable(struct drm_bridge *bridge,
struct drm_bridge_state *old_bridge_state)
{ … }
static void samsung_dsim_atomic_post_disable(struct drm_bridge *bridge,
struct drm_bridge_state *old_bridge_state)
{ … }
static const u32 samsung_dsim_pixel_output_fmts[] = …;
static bool samsung_dsim_pixel_output_fmt_supported(u32 fmt)
{ … }
static u32 *
samsung_dsim_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
struct drm_bridge_state *bridge_state,
struct drm_crtc_state *crtc_state,
struct drm_connector_state *conn_state,
u32 output_fmt,
unsigned int *num_input_fmts)
{ … }
static int samsung_dsim_atomic_check(struct drm_bridge *bridge,
struct drm_bridge_state *bridge_state,
struct drm_crtc_state *crtc_state,
struct drm_connector_state *conn_state)
{ … }
static void samsung_dsim_mode_set(struct drm_bridge *bridge,
const struct drm_display_mode *mode,
const struct drm_display_mode *adjusted_mode)
{ … }
static int samsung_dsim_attach(struct drm_bridge *bridge,
enum drm_bridge_attach_flags flags)
{ … }
static const struct drm_bridge_funcs samsung_dsim_bridge_funcs = …;
static irqreturn_t samsung_dsim_te_irq_handler(int irq, void *dev_id)
{ … }
static int samsung_dsim_register_te_irq(struct samsung_dsim *dsi, struct device *dev)
{ … }
static int samsung_dsim_host_attach(struct mipi_dsi_host *host,
struct mipi_dsi_device *device)
{ … }
static void samsung_dsim_unregister_te_irq(struct samsung_dsim *dsi)
{ … }
static int samsung_dsim_host_detach(struct mipi_dsi_host *host,
struct mipi_dsi_device *device)
{ … }
static ssize_t samsung_dsim_host_transfer(struct mipi_dsi_host *host,
const struct mipi_dsi_msg *msg)
{ … }
static const struct mipi_dsi_host_ops samsung_dsim_ops = …;
static int samsung_dsim_of_read_u32(const struct device_node *np,
const char *propname, u32 *out_value, bool optional)
{ … }
static int samsung_dsim_parse_dt(struct samsung_dsim *dsi)
{ … }
static int generic_dsim_register_host(struct samsung_dsim *dsi)
{ … }
static void generic_dsim_unregister_host(struct samsung_dsim *dsi)
{ … }
static const struct samsung_dsim_host_ops generic_dsim_host_ops = …;
static const struct drm_bridge_timings samsung_dsim_bridge_timings_de_high = …;
static const struct drm_bridge_timings samsung_dsim_bridge_timings_de_low = …;
int samsung_dsim_probe(struct platform_device *pdev)
{ … }
EXPORT_SYMBOL_GPL(…);
void samsung_dsim_remove(struct platform_device *pdev)
{ … }
EXPORT_SYMBOL_GPL(…);
static int __maybe_unused samsung_dsim_suspend(struct device *dev)
{ … }
static int __maybe_unused samsung_dsim_resume(struct device *dev)
{ … }
const struct dev_pm_ops samsung_dsim_pm_ops = …;
EXPORT_SYMBOL_GPL(…);
static const struct samsung_dsim_plat_data samsung_dsim_imx8mm_pdata = …;
static const struct samsung_dsim_plat_data samsung_dsim_imx8mp_pdata = …;
static const struct of_device_id samsung_dsim_of_match[] = …;
MODULE_DEVICE_TABLE(of, samsung_dsim_of_match);
static struct platform_driver samsung_dsim_driver = …;
module_platform_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;