Linux驱动之mipi接口的LCD设备添加过程

记录供以后参考用

void __init msm_fb_add_devices(void)

{

       int rc = 0;

        msm7x27a_set_display_params(prim_panel_name);

        if (machine_is_msm8225_xxx()){

           if (cpu_is_msm8625q())

                        mipi_dsi_pdata.dlane_swap = 0;

       platform_add_devices(xxx_fb_devices,

       ARRAY_SIZE(xxx_fb_devices));

}

****************************************

****************************************

msm_fb_register_device("mdp", &mdp_pdata);

***************************************

***************************************

#ifdef CONFIG_FB_MSM_MIPI_DSI

msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);

#endif

***************************************

***************************************

}

 

 

(一)platform_add_devices(xxx_fb_devices,ARRAY_SIZE(xxx_fb_devices));

  ----->

     static struct platform_device *xxx_fb_devices[] __initdata = {

              &msm_fb_device,

     };

 

------>

   /*该设备在sysfs中显示为msm_fb.0*/

   static struct platform_device msm_fb_device = {

.name   = "msm_fb",

.id     = 0,

.num_resources  = ARRAY_SIZE(msm_fb_resources),

.resource       = msm_fb_resources,

.dev    = {

.platform_data = &msm_fb_pdata,

}

};

 

    ----->

      static struct msm_fb_platform_data msm_fb_pdata = {

      .detect_client = msm_fb_detect_panel,

      };

 

       ----->

         static int msm_fb_detect_panel(const char *name)

{

int ret = -ENODEV;

printk("%s: %s\n", __func__, name);

if (machine_is_msm8225_xxx()) {

ret = xxx_auto_match_lcd_panel(name);

else if  {

    **************************************

    **************************************

    }

return ret;

}

 

 

 

----->

static int xxx_auto_match_lcd_panel(const char *name)

{

int ret = -ENODEV;

#if defined(CONFIG_xxx)

     ******************************

     ******************************

#elif defined(CONFIG_xxxxxx)

if(lcd_id1 == 1 ){

if (!strcmp(name, "mipi_video_xxxx_qhd"))

                // id1=1, id2=0,id3=1

ret = 0;

}else{

if (!strcmp(name, "mipi_video_xxxxxxx_qhd"))

                // id1=0, id2=0,id3=1

ret = 0;

}

#endif

return ret;

}

 

 

(二)msm_fb_register_device("mdp", &mdp_pdata);

----->

   static struct msm_panel_common_pdata mdp_pdata = {

.gpio = 97,

.mdp_rev = MDP_REV_303,

.cont_splash_enabled = 0x1,

};

 

 

void __init msm_fb_register_device(char *name, void *data)

{

if (!strncmp(name, "mdp", 3)) {

if (cpu_is_msm8625() || cpu_is_msm8625q())

      msm_register_device(&msm8625_mdp_device, data);

else

     msm_register_device(&msm_mdp_device, data);

} else if (!strncmp(name, "mipi_dsi", 8)) {

       if (cpu_is_msm8625() || cpu_is_msm8625q()) {

       msm_register_device(&msm8625_mipi_dsi_device, data);

       mipi_dsi_device = msm8625_mipi_dsi_device;

        }

    else *****************

    }  

}

      

--------->

  static struct resource msm8625_mdp_resources[] = {

{

.name   = "mdp",

.start  = MDP_BASE,

.end    = MDP_BASE + 0x000F1008 - 1,

.flags  = IORESOURCE_MEM,

},

{

.start  = MSM8625_INT_MDP,

.end    = MSM8625_INT_MDP,

.flags  = IORESOURCE_IRQ,

},

};

 

/*platform device : mdp.0 in sysfs*/

static struct platform_device msm8625_mdp_device = {

.name   = "mdp",

.id     = 0,

.num_resources  = ARRAY_SIZE(msm8625_mdp_resources),

.resource       = msm8625_mdp_resources,

};

static void __init msm_register_device(struct platform_device *pdev, void *data)

{

int ret;

pdev->dev.platform_data = data;

ret = platform_device_register(pdev);

if (ret)

dev_err(&pdev->dev,

"%s: platform_device_register() failed = %d\n",

__func__, ret);

}

 

 

()msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);

------->

  static struct mipi_dsi_platform_data mipi_dsi_pdata = {

.vsync_gpio = MDP_303_VSYNC_GPIO,

.dsi_power_save= mipi_dsi_panel_power,

                        /*configure the lcd_reset pin*/

.dsi_client_reset       = msm_fb_dsi_client_reset,

                  /*getting lcd id and enabling backlight*/

.get_lane_config= msm_fb_get_lane_config,

.splash_is_enabled= mipi_dsi_splash_is_enabled,

.dlane_swap = 0x1,

};

至于msm_fb_register_device()参照(二)的实现

你可能感兴趣的:(linux,kernel)