0.关键字
MDSS : Multimedia Display sub system 
DSI: Display Serial Interface
1.涉及文件
(1) drivers\video\fbmem.c (核心层)
  register_framebuffer(struct fb_info *fb_info)   
(2)drivers\video\msm\mdss\mdss_fb.c (mdss 核心层 fbx平台设备驱动)
(3)drivers\video\msm\mdss\dsi_host_v2.c (lcd驱动 dsi)
dsi_panel_device_register_v2(struct platform_device *dev,struct mdss_dsi_ctrl_pdata *ctrl_pdata)
static const struct of_device_id msm_dsi_v2_dt_match[] = {
    {.compatible = "qcom,msm-dsi-v2"},
    {}
};
(4)msm8610-mdss.dtsi (文件名通常为 msmxxx-mdss.dtsi 指定了mdss 的 mdp 和 dsi)
  mdss_mdp: qcom,mdss_mdp@fd900000 {
            compatible = "qcom,mdss_mdp3";
----------
  mdss_dsi0: qcom,mdss_dsi@fdd00000 {
        compatible = "qcom,msm-dsi-v2";
(5)drivers\video\msm\mdss\mdp3.c (mdp)
   .compatible = "qcom,mdss_mdp3",
(6)msm8610-asus.dts (指定mdp中的哪一个配置) 
通常在dts文件的 mdss_dsi0 lab里面通过 qcom,dsi-pref-prim-pan 属性 指定使用哪一个lcd配置
&mdss_dsi0 {
        qcom,dsi-pref-prim-pan = <&dsi_fl10802_fwvga_vid>;
};
(7)dsi-panel-fl10802-fwvga-video.dtsi
&mdss_mdp {
    dsi_fl10802_fwvga_vid: qcom,mdss_dsi_fl10802_fwvga_video {
        qcom,mdss-dsi-panel-name = "fl10802 fwvga video mode dsi panel";
        qcom,mdss-dsi-drive-ic = "fl10802";
        qcom,mdss-dsi-panel-controller = <&mdss_dsi0>;
        qcom,mdss-dsi-panel-type = "dsi_video_mode";
        qcom,mdss-dsi-panel-destination = "display_1";
        ...
        }
2. mdss_mdp 和 mdss_dsi0 的关系
mdss_mdp 相当于一个数组,里面定义了很多不同lcd显示屏的配置项包括分辨率等等
![这里写图片描述]()
mdss_dsi0 的 “qcom,dsi-pref-prim-pan ” 属性指定了使用mdss_mdp中哪一个lcd配置选项 
![这里写图片描述]()
3.时序图
画的有点渣,凑活看吧,不要在意细节 ![这里写图片描述]() 
 
![这里写图片描述]()
4. 重要结构
backLight
关键字:qcom,mdss-dsi-bl-pmic-control-type
struct mdss_dsi_ctrl_pdata {
    int ndx;    
    int (*on) (struct mdss_panel_data *pdata);                              
    int (*off) (struct mdss_panel_data *pdata);                             
    int (*partial_update_fnc) (struct mdss_panel_data *pdata);
    int (*check_status) (struct mdss_dsi_ctrl_pdata *pdata);
    int (*cmdlist_commit)(struct mdss_dsi_ctrl_pdata *ctrl, int from_mdp);
    void (*switch_mode) (struct mdss_panel_data *pdata, int mode);
    struct mdss_panel_data panel_data;                          
    unsigned char *ctrl_base;
    struct dss_io_data ctrl_io;
    struct dss_io_data mmss_misc_io;
    struct dss_io_data phy_io;
    int reg_size;
    u32 bus_clk_cnt;
    u32 link_clk_cnt;
    u32 flags;
    struct clk *mdp_core_clk;
    struct clk *ahb_clk;
    struct clk *axi_clk;
    struct clk *mmss_misc_ahb_clk;
    struct clk *byte_clk;
    struct clk *esc_clk;
    struct clk *pixel_clk;
    u8 ctrl_state;
    int panel_mode; 
    int irq_cnt;
    int rst_gpio;                   
    int disp_en_gpio;               
    int disp_te_gpio;               
    int mode_gpio;                  
    int disp_te_gpio_requested;
    int bklt_ctrl;                     
    int pwm_period;
    int pwm_pmic_gpio;
    int pwm_lpg_chan;
    int bklt_max;
    int new_fps;
    int pwm_enabled;
    bool dmap_iommu_map;
    struct pwm_device *pwm_bl;
    struct dsi_drv_cm_data shared_pdata;
    u32 pclk_rate;
    u32 byte_clk_rate;
    struct dss_module_power power_data;     
    u32 dsi_irq_mask;
    struct mdss_hw *dsi_hw;
    struct mdss_panel_recovery *recovery;
    struct dsi_panel_cmds on_cmds;          
    struct dsi_panel_cmds off_cmds;         
    struct dsi_panel_cmds status_cmds;
    u32 status_value;
    struct dsi_panel_cmds video2cmd;
    struct dsi_panel_cmds cmd2video;
    struct dcs_cmd_list cmdlist;
    struct completion dma_comp;
    struct completion mdp_comp;
    struct completion video_comp;
    struct completion bta_comp;
    spinlock_t irq_lock;
    spinlock_t mdp_lock;
    int mdp_busy;
    struct mutex mutex;
    struct mutex cmd_mutex;
    bool ulps;
    struct dsi_buf tx_buf;
    struct dsi_buf rx_buf;
    struct dsi_buf status_buf;
    int status_mode;
};
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
struct mdss_panel_info {
    u32 xres;                   
    u32 yres;                   
    u32 physical_width;         
    u32 physical_height;        
    struct lcd_panel_info lcdc; 
    u32 bpp;                    
    struct mipi_panel_info mipi; 
    u32 type;
    u32 wait_cycle;
    u32 pdest;                 
    u32 brightness_max;
    u32 bl_max;
    u32 bl_min;
    u32 fb_num;
    u32 clk_rate;
    u32 clk_min;
    u32 clk_max;
    u32 frame_count;
    u32 is_3d_panel;
    u32 out_format;
    u32 rst_seq[MDSS_DSI_RST_SEQ_LEN];
    ...
    }
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
(1)边界   
struct lcd_panel_info {
    u32 h_back_porch;
    u32 h_front_porch;
    u32 h_pulse_width;
    u32 v_back_porch;
    u32 v_front_porch;
    u32 v_pulse_width;
    u32 border_clr;
    u32 underflow_clr;
    u32 hsync_skew;
    
    u32 xres_pad;       
    
    u32 yres_pad;       
};
(2)mipi 
struct mipi_panel_info {
    char mode;         
    char interleave_mode;
    char crc_check;
    char ecc_check;
    char dst_format;    
    char data_lane0;
    char data_lane1;
    char data_lane2;
    char data_lane3;
    char dlane_swap;    
    char rgb_swap;
    char b_sel;
    char g_sel;
    char r_sel;
    char rx_eot_ignore;
    char tx_eot_append;
    char t_clk_post; 
    char t_clk_pre;  
    char vc;    
    struct mdss_dsi_phy_ctrl dsi_phy_db;
    
    char pulse_mode_hsa_he;
    char hfp_power_stop;
    char hbp_power_stop;
    char hsa_power_stop;
    char eof_bllp_power_stop;
    char last_line_interleave_en;
    char bllp_power_stop;
    char traffic_mode;
    char frame_rate;
    
    char interleave_max;
    char insert_dcs_cmd;
    char wr_mem_continue;
    char wr_mem_start;
    char te_sel;
    char stream;    
    char mdp_trigger;
    char dma_trigger;
    
    bool dynamic_switch_enabled;
    u32 pixel_packing;
    u32 dsi_pclk_rate;
    
    char no_max_pkt_size;
    
    char force_clk_lane_hs;
    char vsync_enable;
    char hw_vsync_mode;
    char lp11_init;
    u32  init_delay;
};
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77