讯为4412讯为开发板的源码接口说明

该源码位置在:arch/arm/mach-exynos/mach-itop4412.c

1. BSP的总的初始化(入口程序)

static void __init smdk4x12_machine_init(void)
{
#ifdef CONFIG_S3C64XX_DEV_SPI
    unsigned int gpio;
    struct clk *sclk = NULL;
    struct clk *prnt = NULL;
#if 0   //remove by cym 20130529
    struct device *spi0_dev = &exynos_device_spi0.dev;
#ifndef CONFIG_FB_S5P_LMS501KF03
    struct device *spi1_dev = &exynos_device_spi1.dev;
#endif
#endif
    struct device *spi2_dev = &exynos_device_spi2.dev;
#endif
    /* remove by cym 20130426 */
#if 0
    int err;
#endif
    /* end remove */

    pm_power_off = smdk4x12_power_off;
    s3c_config_sleep_gpio_table = tc4_config_sleep_gpio_table;
    samsung_board_rev = get_samsung_board_rev();

#if defined(CONFIG_EXYNOS_DEV_PD) && defined(CONFIG_PM_RUNTIME)
    exynos_pd_disable(&exynos4_device_pd[PD_MFC].dev);
    exynos_pd_disable(&exynos4_device_pd[PD_G3D].dev);
    exynos_pd_disable(&exynos4_device_pd[PD_LCD0].dev);
    exynos_pd_disable(&exynos4_device_pd[PD_CAM].dev);
    exynos_pd_disable(&exynos4_device_pd[PD_TV].dev);
    exynos_pd_disable(&exynos4_device_pd[PD_GPS].dev);
    exynos_pd_disable(&exynos4_device_pd[PD_GPS_ALIVE].dev);
    exynos_pd_disable(&exynos4_device_pd[PD_ISP].dev);
#elif defined(CONFIG_EXYNOS_DEV_PD)
    /*
         * These power domains should be always on
         * without runtime pm support.
         */
    exynos_pd_enable(&exynos4_device_pd[PD_MFC].dev);
    exynos_pd_enable(&exynos4_device_pd[PD_G3D].dev);
    exynos_pd_enable(&exynos4_device_pd[PD_LCD0].dev);
    exynos_pd_enable(&exynos4_device_pd[PD_CAM].dev);
    exynos_pd_enable(&exynos4_device_pd[PD_TV].dev);
    exynos_pd_enable(&exynos4_device_pd[PD_GPS].dev);
    exynos_pd_enable(&exynos4_device_pd[PD_GPS_ALIVE].dev);
    exynos_pd_enable(&exynos4_device_pd[PD_ISP].dev);
#endif
    s3c_i2c0_set_platdata(NULL);
    i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));

    s3c_i2c1_set_platdata(NULL);
    i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));

    s3c_i2c2_set_platdata(NULL);
    i2c_register_board_info(2, i2c_devs2, ARRAY_SIZE(i2c_devs2));

    init_lcd_type();
    get_lcd_type();
    setup_ft5x_width_height();

    s3c_i2c3_set_platdata(NULL);
    i2c_register_board_info(3, i2c_devs3, ARRAY_SIZE(i2c_devs3));

    s3c_i2c4_set_platdata(NULL);
    i2c_register_board_info(4, i2c_devs4, ARRAY_SIZE(i2c_devs4));

#ifdef CONFIG_MPU_SENSORS_MPU6050B1
    sensor_hw_init();
#endif

    s3c_i2c5_set_platdata(NULL);
    i2c_register_board_info(5, i2c_devs5, ARRAY_SIZE(i2c_devs5));

    //For S5K4EC (using i2c6)
#ifndef CONFIG_CAN_MCP251X
    s3c_i2c6_set_platdata(NULL);
    i2c_register_board_info(6, i2c_devs6, ARRAY_SIZE(i2c_devs6));
#endif

    s3c_i2c7_set_platdata(NULL);
    i2c_register_board_info(7, i2c_devs7, ARRAY_SIZE(i2c_devs7));

#ifdef CONFIG_ANDROID_PMEM
    android_pmem_set_platdata();
#endif
#if defined(CONFIG_FB_S5P_MIPI_DSIM)
    mipi_fb_init();
#endif
#ifdef CONFIG_FB_S3C
    dev_set_name(&s5p_device_fimd0.dev, "s3cfb.0");
    clk_add_alias("lcd", "exynos4-fb.0", "lcd", &s5p_device_fimd0.dev);
    clk_add_alias("sclk_fimd", "exynos4-fb.0", "sclk_fimd", &s5p_device_fimd0.dev);
    s5p_fb_setname(0, "exynos4-fb");
#if defined(CONFIG_LCD_AMS369FG06) || defined(CONFIG_LCD_LMS501KF03)
    spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
#endif
    s5p_fimd0_set_platdata(&smdk4x12_lcd0_pdata);
#ifdef CONFIG_FB_MIPI_DSIM
    s5p_device_mipi_dsim.dev.parent = &exynos4_device_pd[PD_LCD0].dev;
#endif
#ifdef CONFIG_EXYNOS_DEV_PD
    s5p_device_fimd0.dev.parent = &exynos4_device_pd[PD_LCD0].dev;
#endif
#endif
#ifdef CONFIG_FB_S5P
#ifdef CONFIG_FB_S5P_LMS501KF03
    spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
    s3cfb_set_platdata(&lms501kf03_data);
#else
    s3cfb_set_platdata(NULL);
#endif
#ifdef CONFIG_FB_S5P_MIPI_DSIM
    s5p_device_dsim.dev.parent = &exynos4_device_pd[PD_LCD0].dev;
#endif
#ifdef CONFIG_EXYNOS_DEV_PD
    s3c_device_fb.dev.parent = &exynos4_device_pd[PD_LCD0].dev;
#endif
#endif
#ifdef CONFIG_USB_EHCI_S5P
    smdk4x12_ehci_init();
#endif
#ifdef CONFIG_USB_OHCI_S5P
    smdk4x12_ohci_init();
#endif
#ifdef CONFIG_USB_GADGET
    smdk4x12_usbgadget_init();
#endif

    samsung_bl_set(&smdk4x12_bl_gpio_info, &smdk4x12_bl_data);

#ifdef CONFIG_EXYNOS4_DEV_DWMCI
    exynos_dwmci_set_platdata(&exynos_dwmci_pdata);
#endif

#ifdef CONFIG_VIDEO_EXYNOS_FIMC_IS
    exynos4_fimc_is_set_platdata(NULL);
#ifdef CONFIG_EXYNOS_DEV_PD
    exynos4_device_fimc_is.dev.parent = &exynos4_device_pd[PD_ISP].dev;
#endif
#endif
#ifdef CONFIG_S3C_DEV_HSMMC
    s3c_sdhci0_set_platdata(&smdk4x12_hsmmc0_pdata);
#endif
#ifdef CONFIG_S3C_DEV_HSMMC1
    s3c_sdhci1_set_platdata(&smdk4x12_hsmmc1_pdata);
#endif
#ifdef CONFIG_S3C_DEV_HSMMC2
    s3c_sdhci2_set_platdata(&smdk4x12_hsmmc2_pdata);
#endif

#ifdef CONFIG_S3C_DEV_HSMMC3
    s3c_sdhci3_set_platdata(&smdk4x12_hsmmc3_pdata);
#endif


#ifdef  CONFIG_MTK_COMBO_MT66XX
    itop4412_wifi_combo_module_gpio_init();
#endif



#ifdef CONFIG_S5P_DEV_MSHC
    s3c_mshci_set_platdata(&exynos4_mshc_pdata);
#endif
#if defined(CONFIG_VIDEO_EXYNOS_TV) && defined(CONFIG_VIDEO_EXYNOS_HDMI)
    dev_set_name(&s5p_device_hdmi.dev, "exynos4-hdmi");
    clk_add_alias("hdmi", "s5p-hdmi", "hdmi", &s5p_device_hdmi.dev);
    clk_add_alias("hdmiphy", "s5p-hdmi", "hdmiphy", &s5p_device_hdmi.dev);
    s5p_tv_setup();

    /* setup dependencies between TV devices */
    s5p_device_hdmi.dev.parent = &exynos4_device_pd[PD_TV].dev;
    s5p_device_mixer.dev.parent = &exynos4_device_pd[PD_TV].dev;

    s5p_i2c_hdmiphy_set_platdata(NULL);
#ifdef CONFIG_VIDEO_EXYNOS_HDMI_CEC
    s5p_hdmi_cec_set_platdata(&hdmi_cec_data);
#endif
#endif
#ifdef CONFIG_VIDEO_EXYNOS_FIMC_LITE
    smdk4x12_set_camera_flite_platdata();
    s3c_set_platdata(&exynos_flite0_default_data,
                     sizeof(exynos_flite0_default_data), &exynos_device_flite0);
    s3c_set_platdata(&exynos_flite1_default_data,
                     sizeof(exynos_flite1_default_data), &exynos_device_flite1);
#ifdef CONFIG_EXYNOS_DEV_PD
    exynos_device_flite0.dev.parent = &exynos4_device_pd[PD_ISP].dev;
    exynos_device_flite1.dev.parent = &exynos4_device_pd[PD_ISP].dev;
#endif
#endif
#ifdef CONFIG_EXYNOS_SETUP_THERMAL
    s5p_tmu_set_platdata(&exynos_tmu_data);
#endif
#ifdef CONFIG_VIDEO_FIMC
    s3c_fimc0_set_platdata(&fimc_plat);
#ifdef CONFIG_TC4_GB
    s3c_fimc1_set_platdata(NULL);
    s3c_fimc2_set_platdata(&fimc_plat);
#else
    s3c_fimc1_set_platdata(&fimc_plat);
    s3c_fimc2_set_platdata(NULL);
#endif
    s3c_fimc3_set_platdata(NULL);
#ifdef CONFIG_EXYNOS_DEV_PD
    s3c_device_fimc0.dev.parent = &exynos4_device_pd[PD_CAM].dev;
    s3c_device_fimc1.dev.parent = &exynos4_device_pd[PD_CAM].dev;
    s3c_device_fimc2.dev.parent = &exynos4_device_pd[PD_CAM].dev;
    s3c_device_fimc3.dev.parent = &exynos4_device_pd[PD_CAM].dev;
#ifdef CONFIG_EXYNOS4_CONTENT_PATH_PROTECTION
    secmem.parent = &exynos4_device_pd[PD_CAM].dev;
#endif
#endif
#ifdef CONFIG_VIDEO_FIMC_MIPI
    s3c_csis0_set_platdata(NULL);
    s3c_csis1_set_platdata(NULL);
#ifdef CONFIG_EXYNOS_DEV_PD
    s3c_device_csis0.dev.parent = &exynos4_device_pd[PD_CAM].dev;
    s3c_device_csis1.dev.parent = &exynos4_device_pd[PD_CAM].dev;
#endif
#endif

#if defined(CONFIG_ITU_A) || defined(CONFIG_CSI_C) \
    || defined(CONFIG_S5K3H1_CSI_C) || defined(CONFIG_S5K3H2_CSI_C) \
    || defined(CONFIG_S5K6A3_CSI_C)
    smdk4x12_cam0_reset(1);
#endif
#if defined(CONFIG_ITU_B) || defined(CONFIG_CSI_D) \
    || defined(CONFIG_S5K3H1_CSI_D) || defined(CONFIG_S5K3H2_CSI_D) \
    || defined(CONFIG_VIDEO_OV5640) \
    || defined(CONFIG_S5K6A3_CSI_D)
    smdk4x12_cam1_reset(1);
#endif
#endif /* CONFIG_VIDEO_FIMC */

#ifdef CONFIG_VIDEO_SAMSUNG_S5P_FIMC
    smdk4x12_camera_config();
    smdk4x12_subdev_config();

    dev_set_name(&s5p_device_fimc0.dev, "s3c-fimc.0");
    dev_set_name(&s5p_device_fimc1.dev, "s3c-fimc.1");
    dev_set_name(&s5p_device_fimc2.dev, "s3c-fimc.2");
    dev_set_name(&s5p_device_fimc3.dev, "s3c-fimc.3");

    clk_add_alias("fimc", "exynos4210-fimc.0", "fimc", &s5p_device_fimc0.dev);
    clk_add_alias("sclk_fimc", "exynos4210-fimc.0", "sclk_fimc",
                  &s5p_device_fimc0.dev);
    clk_add_alias("fimc", "exynos4210-fimc.1", "fimc", &s5p_device_fimc1.dev);
    clk_add_alias("sclk_fimc", "exynos4210-fimc.1", "sclk_fimc",
                  &s5p_device_fimc1.dev);
    clk_add_alias("fimc", "exynos4210-fimc.2", "fimc", &s5p_device_fimc2.dev);
    clk_add_alias("sclk_fimc", "exynos4210-fimc.2", "sclk_fimc",
                  &s5p_device_fimc2.dev);
    clk_add_alias("fimc", "exynos4210-fimc.3", "fimc", &s5p_device_fimc3.dev);
    clk_add_alias("sclk_fimc", "exynos4210-fimc.3", "sclk_fimc",
                  &s5p_device_fimc3.dev);

    s3c_fimc_setname(0, "exynos4210-fimc");
    s3c_fimc_setname(1, "exynos4210-fimc");
    s3c_fimc_setname(2, "exynos4210-fimc");
    s3c_fimc_setname(3, "exynos4210-fimc");
    /* FIMC */
    s3c_set_platdata(&s3c_fimc0_default_data,
                     sizeof(s3c_fimc0_default_data), &s5p_device_fimc0);
    s3c_set_platdata(&s3c_fimc1_default_data,
                     sizeof(s3c_fimc1_default_data), &s5p_device_fimc1);
    s3c_set_platdata(&s3c_fimc2_default_data,
                     sizeof(s3c_fimc2_default_data), &s5p_device_fimc2);
    s3c_set_platdata(&s3c_fimc3_default_data,
                     sizeof(s3c_fimc3_default_data), &s5p_device_fimc3);
#ifdef CONFIG_EXYNOS_DEV_PD
    s5p_device_fimc0.dev.parent = &exynos4_device_pd[PD_CAM].dev;
    s5p_device_fimc1.dev.parent = &exynos4_device_pd[PD_CAM].dev;
    s5p_device_fimc2.dev.parent = &exynos4_device_pd[PD_CAM].dev;
    s5p_device_fimc3.dev.parent = &exynos4_device_pd[PD_CAM].dev;
#endif
#ifdef CONFIG_VIDEO_S5P_MIPI_CSIS
    dev_set_name(&s5p_device_mipi_csis0.dev, "s3c-csis.0");
    dev_set_name(&s5p_device_mipi_csis1.dev, "s3c-csis.1");
    clk_add_alias("csis", "s5p-mipi-csis.0", "csis",
                  &s5p_device_mipi_csis0.dev);
    clk_add_alias("sclk_csis", "s5p-mipi-csis.0", "sclk_csis",
                  &s5p_device_mipi_csis0.dev);
    clk_add_alias("csis", "s5p-mipi-csis.1", "csis",
                  &s5p_device_mipi_csis1.dev);
    clk_add_alias("sclk_csis", "s5p-mipi-csis.1", "sclk_csis",
                  &s5p_device_mipi_csis1.dev);
    dev_set_name(&s5p_device_mipi_csis0.dev, "s5p-mipi-csis.0");
    dev_set_name(&s5p_device_mipi_csis1.dev, "s5p-mipi-csis.1");

    s3c_set_platdata(&s5p_mipi_csis0_default_data,
                     sizeof(s5p_mipi_csis0_default_data), &s5p_device_mipi_csis0);
    s3c_set_platdata(&s5p_mipi_csis1_default_data,
                     sizeof(s5p_mipi_csis1_default_data), &s5p_device_mipi_csis1);
#ifdef CONFIG_EXYNOS_DEV_PD
    s5p_device_mipi_csis0.dev.parent = &exynos4_device_pd[PD_CAM].dev;
    s5p_device_mipi_csis1.dev.parent = &exynos4_device_pd[PD_CAM].dev;
#endif
#endif
#if defined(CONFIG_ITU_A) || defined(CONFIG_CSI_C) \
    || defined(CONFIG_S5K3H1_CSI_C) || defined(CONFIG_S5K3H2_CSI_C) \
    || defined(CONFIG_S5K6A3_CSI_C)
    smdk4x12_cam0_reset(1);
#endif
#if defined(CONFIG_ITU_B) || defined(CONFIG_CSI_D) \
    || defined(CONFIG_S5K3H1_CSI_D) || defined(CONFIG_S5K3H2_CSI_D) \
    || defined(CONFIG_S5K6A3_CSI_D)
    smdk4x12_cam1_reset(1);
#endif
#endif

#if defined(CONFIG_VIDEO_TVOUT)
    s5p_hdmi_hpd_set_platdata(&hdmi_hpd_data);
    s5p_hdmi_cec_set_platdata(&hdmi_cec_data);
#ifdef CONFIG_EXYNOS_DEV_PD
    s5p_device_tvout.dev.parent = &exynos4_device_pd[PD_TV].dev;
    exynos4_device_pd[PD_TV].dev.parent= &exynos4_device_pd[PD_LCD0].dev;
#endif
#endif

#if defined(CONFIG_VIDEO_JPEG_V2X) || defined(CONFIG_VIDEO_JPEG)
#ifdef CONFIG_EXYNOS_DEV_PD
    s5p_device_jpeg.dev.parent = &exynos4_device_pd[PD_CAM].dev;
    exynos4_jpeg_setup_clock(&s5p_device_jpeg.dev, 160000000);
#endif
#endif

#ifdef CONFIG_ION_EXYNOS
    exynos_ion_set_platdata();
#endif

#if defined(CONFIG_VIDEO_MFC5X) || defined(CONFIG_VIDEO_SAMSUNG_S5P_MFC)
#ifdef CONFIG_EXYNOS_DEV_PD
    s5p_device_mfc.dev.parent = &exynos4_device_pd[PD_MFC].dev;
#endif
    if (soc_is_exynos4412() && samsung_rev() >= EXYNOS4412_REV_1_0)
        exynos4_mfc_setup_clock(&s5p_device_mfc.dev, 200 * MHZ);
    else
        exynos4_mfc_setup_clock(&s5p_device_mfc.dev, 267 * MHZ);
#endif

#if defined(CONFIG_VIDEO_SAMSUNG_S5P_MFC)
    dev_set_name(&s5p_device_mfc.dev, "s3c-mfc");
    clk_add_alias("mfc", "s5p-mfc", "mfc", &s5p_device_mfc.dev);
    s5p_mfc_setname(&s5p_device_mfc, "s5p-mfc");
#endif

#ifdef CONFIG_VIDEO_FIMG2D
    s5p_fimg2d_set_platdata(&fimg2d_data);
#endif

#ifdef CONFIG_SAMSUNG_DEV_KEYPAD
    samsung_keypad_set_platdata(&smdk4x12_keypad_data);
#endif

    /* add by cym 20131114 */
#ifdef CONFIG_USB_NET_DM9620
    dm9620_reset();
#endif
    /* end add */

#ifdef CONFIG_EXYNOS_C2C
    exynos_c2c_set_platdata(&smdk4x12_c2c_pdata);
#endif
#ifndef CONFIG_TC4_GB
    exynos_sysmmu_init();
#endif
    smdk4x12_gpio_power_init();

    platform_add_devices(smdk4x12_devices, ARRAY_SIZE(smdk4x12_devices));
    if (soc_is_exynos4412())
        platform_add_devices(smdk4412_devices, ARRAY_SIZE(smdk4412_devices));

#ifdef CONFIG_FB_S3C
    exynos4_fimd0_setup_clock(&s5p_device_fimd0.dev, "mout_mpll_user",
                              800 * MHZ);
#endif
#ifdef CONFIG_S3C64XX_DEV_SPI
#if 0   //remove by cym 20130529
    sclk = clk_get(spi0_dev, "dout_spi0");
    if (IS_ERR(sclk))
        dev_err(spi0_dev, "failed to get sclk for SPI-0\n");
    prnt = clk_get(spi0_dev, "mout_mpll_user");
    if (IS_ERR(prnt))
        dev_err(spi0_dev, "failed to get prnt\n");
    if (clk_set_parent(sclk, prnt))
        printk(KERN_ERR "Unable to set parent %s of clock %s.\n",
               prnt->name, sclk->name);

    clk_set_rate(sclk, 800 * 1000 * 1000);
    clk_put(sclk);
    clk_put(prnt);

    if (!gpio_request(EXYNOS4_GPB(1), "SPI_CS0")) {
        gpio_direction_output(EXYNOS4_GPB(1), 1);
        s3c_gpio_cfgpin(EXYNOS4_GPB(1), S3C_GPIO_SFN(1));
        s3c_gpio_setpull(EXYNOS4_GPB(1), S3C_GPIO_PULL_UP);
        exynos_spi_set_info(0, EXYNOS_SPI_SRCCLK_SCLK,
                            ARRAY_SIZE(spi0_csi));
    }

    for (gpio = EXYNOS4_GPB(0); gpio < EXYNOS4_GPB(4); gpio++)
        s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV3);

    spi_register_board_info(spi0_board_info, ARRAY_SIZE(spi0_board_info));

#ifndef CONFIG_FB_S5P_LMS501KF03
    sclk = clk_get(spi1_dev, "dout_spi1");
    if (IS_ERR(sclk))
        dev_err(spi1_dev, "failed to get sclk for SPI-1\n");
    prnt = clk_get(spi1_dev, "mout_mpll_user");
    if (IS_ERR(prnt))
        dev_err(spi1_dev, "failed to get prnt\n");
    if (clk_set_parent(sclk, prnt))
        printk(KERN_ERR "Unable to set parent %s of clock %s.\n",
               prnt->name, sclk->name);

    clk_set_rate(sclk, 800 * 1000 * 1000);
    clk_put(sclk);
    clk_put(prnt);

    if (!gpio_request(EXYNOS4_GPB(5), "SPI_CS1")) {
        gpio_direction_output(EXYNOS4_GPB(5), 1);
        s3c_gpio_cfgpin(EXYNOS4_GPB(5), S3C_GPIO_SFN(1));
        s3c_gpio_setpull(EXYNOS4_GPB(5), S3C_GPIO_PULL_UP);
        exynos_spi_set_info(1, EXYNOS_SPI_SRCCLK_SCLK,
                            ARRAY_SIZE(spi1_csi));
    }

    for (gpio = EXYNOS4_GPB(4); gpio < EXYNOS4_GPB(8); gpio++)
        s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV3);

    spi_register_board_info(spi1_board_info, ARRAY_SIZE(spi1_board_info));
#endif
#endif

    sclk = clk_get(spi2_dev, "dout_spi2");
    if (IS_ERR(sclk))
        dev_err(spi2_dev, "failed to get sclk for SPI-2\n");
    prnt = clk_get(spi2_dev, "mout_mpll_user");
    if (IS_ERR(prnt))
        dev_err(spi2_dev, "failed to get prnt\n");
    if (clk_set_parent(sclk, prnt))
        printk(KERN_ERR "Unable to set parent %s of clock %s.\n",
               prnt->name, sclk->name);

    clk_set_rate(sclk, 800 * 1000 * 1000);
    clk_put(sclk);
    clk_put(prnt);

    if (!gpio_request(EXYNOS4_GPC1(2), "SPI_CS2")) {
        gpio_direction_output(EXYNOS4_GPC1(2), 1);
        s3c_gpio_cfgpin(EXYNOS4_GPC1(2), S3C_GPIO_SFN(1));
        s3c_gpio_setpull(EXYNOS4_GPC1(2), S3C_GPIO_PULL_UP);
        exynos_spi_set_info(2, EXYNOS_SPI_SRCCLK_SCLK,
                            ARRAY_SIZE(spi2_csi));
    }

    for (gpio = EXYNOS4_GPC1(1); gpio < EXYNOS4_GPC1(5); gpio++)
        s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV3);

    spi_register_board_info(spi2_board_info, ARRAY_SIZE(spi2_board_info));
#endif
#ifdef CONFIG_BUSFREQ_OPP
    dev_add(&busfreq, &exynos4_busfreq.dev);
    ppmu_init(&exynos_ppmu[PPMU_DMC0], &exynos4_busfreq.dev);
    ppmu_init(&exynos_ppmu[PPMU_DMC1], &exynos4_busfreq.dev);
    ppmu_init(&exynos_ppmu[PPMU_CPU], &exynos4_busfreq.dev);
#endif
    register_reboot_notifier(&exynos4_reboot_notifier);

}
 
 
   
   
   
   
  • 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
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204
  • 205
  • 206
  • 207
  • 208
  • 209
  • 210
  • 211
  • 212
  • 213
  • 214
  • 215
  • 216
  • 217
  • 218
  • 219
  • 220
  • 221
  • 222
  • 223
  • 224
  • 225
  • 226
  • 227
  • 228
  • 229
  • 230
  • 231
  • 232
  • 233
  • 234
  • 235
  • 236
  • 237
  • 238
  • 239
  • 240
  • 241
  • 242
  • 243
  • 244
  • 245
  • 246
  • 247
  • 248
  • 249
  • 250
  • 251
  • 252
  • 253
  • 254
  • 255
  • 256
  • 257
  • 258
  • 259
  • 260
  • 261
  • 262
  • 263
  • 264
  • 265
  • 266
  • 267
  • 268
  • 269
  • 270
  • 271
  • 272
  • 273
  • 274
  • 275
  • 276
  • 277
  • 278
  • 279
  • 280
  • 281
  • 282
  • 283
  • 284
  • 285
  • 286
  • 287
  • 288
  • 289
  • 290
  • 291
  • 292
  • 293
  • 294
  • 295
  • 296
  • 297
  • 298
  • 299
  • 300
  • 301
  • 302
  • 303
  • 304
  • 305
  • 306
  • 307
  • 308
  • 309
  • 310
  • 311
  • 312
  • 313
  • 314
  • 315
  • 316
  • 317
  • 318
  • 319
  • 320
  • 321
  • 322
  • 323
  • 324
  • 325
  • 326
  • 327
  • 328
  • 329
  • 330
  • 331
  • 332
  • 333
  • 334
  • 335
  • 336
  • 337
  • 338
  • 339
  • 340
  • 341
  • 342
  • 343
  • 344
  • 345
  • 346
  • 347
  • 348
  • 349
  • 350
  • 351
  • 352
  • 353
  • 354
  • 355
  • 356
  • 357
  • 358
  • 359
  • 360
  • 361
  • 362
  • 363
  • 364
  • 365
  • 366
  • 367
  • 368
  • 369
  • 370
  • 371
  • 372
  • 373
  • 374
  • 375
  • 376
  • 377
  • 378
  • 379
  • 380
  • 381
  • 382
  • 383
  • 384
  • 385
  • 386
  • 387
  • 388
  • 389
  • 390
  • 391
  • 392
  • 393
  • 394
  • 395
  • 396
  • 397
  • 398
  • 399
  • 400
  • 401
  • 402
  • 403
  • 404
  • 405
  • 406
  • 407
  • 408
  • 409
  • 410
  • 411
  • 412
  • 413
  • 414
  • 415
  • 416
  • 417
  • 418
  • 419
  • 420
  • 421
  • 422
  • 423
  • 424
  • 425
  • 426
  • 427
  • 428
  • 429
  • 430
  • 431
  • 432
  • 433
  • 434
  • 435
  • 436
  • 437
  • 438
  • 439
  • 440
  • 441
  • 442
  • 443
  • 444
  • 445
  • 446
  • 447
  • 448
  • 449
  • 450
  • 451
  • 452
  • 453
  • 454
  • 455
  • 456
  • 457
  • 458
  • 459
  • 460
  • 461
  • 462
  • 463
  • 464
  • 465
  • 466
  • 467
  • 468
  • 469
  • 470
  • 471

2. I2C接口

/* ly 20111102 : i2c devs mapping: 
  * i2c0 : HDMI (DDC全文为Display Data Channel)
  * i2c1 : max8997: PMIC & RTC & motor(S5M8767的电源管理IC(PMIC))
  * i2c2 : not used
  * i2c3 : touch(触摸芯片ft5x06)
  * i2c4 : max8997 fuel gauge & wm8960(音频编解码芯片)
  * i2c5 : sensor: MPU3050(三轴陀螺仪芯片)
  * i2c6 : camera & HSIC  (内核加载摄像头驱动,在这里并没有配置)
  * i2c7 : light sensor  (TSC2007触摸芯片,暂时没用)
  */
static struct i2c_board_info i2c_devs0[] __initdata = {
#ifdef CONFIG_VIDEO_TVOUT
{
    I2C_BOARD_INFO("s5p_ddc", (0x74 >> 1)),
},
#endif
};

static struct i2c_board_info i2c_devs1[] __initdata = {
{
#ifdef CONFIG_REGULATOR_S5M8767

    I2C_BOARD_INFO("s5m87xx", 0xCC >> 1),
    .platform_data = &exynos4_s5m8767_pdata,
    .irq        = IRQ_EINT(15),
#endif
},
};
#if 1 //iic 2 : nfc
static struct i2c_board_info i2c_devs2[] __initdata = {

};
#endif
// For S5K4EC(using i2c6)
#ifndef CONFIG_CAN_MCP251X
static struct i2c_board_info i2c_devs6[] __initdata = {

};
#endif

/* add by cym 20130515 */
#ifdef CONFIG_TOUCHSCREEN_FT5X0X
#include 
static struct ft5x0x_i2c_platform_data ft5x0x_pdata = {
    .gpio_irq               = EXYNOS4_GPX0(4),
    .irq_cfg                = S3C_GPIO_SFN(0xf),
    .screen_max_x   = 768,
    .screen_max_y   = 1024,
    .pressure_max   = 255,
};
#if 0
static int __init setup_width_height(char *str)
{
    if (!strncasecmp("9.7", str, 3)) {
        //printk("000000000000000000000000\n");
        ft5x0x_pdata.screen_max_x = 768;
        ft5x0x_pdata.screen_max_y = 1024;

    }
    else if(!strncasecmp("7.0", str, 3))
    {
        //printk("1111111111111111111111111\n");
        ft5x0x_pdata.screen_max_x = 1280;//1280;
        ft5x0x_pdata.screen_max_y = 800;//800;
    }

    printk("%s\n", __FUNCTION__);
}
early_param("lcd", setup_width_height);
#endif
#endif
/* end add */
void init_lcd_type()
{
    int err;

    if(gpio_request(EXYNOS4_GPC0(3), "GPC0_3"))
        printk(KERN_WARNING "GPC0_3 Port request error!!!\n");
    else    {
        s3c_gpio_setpull(EXYNOS4_GPC0(3), S3C_GPIO_PULL_NONE);
        s3c_gpio_cfgpin(EXYNOS4_GPC0(3), S3C_GPIO_SFN(0));
        gpio_direction_input(EXYNOS4_GPC0(3));
        //gpio_free(EXYNOS4_GPC0(3));
    }

    if(gpio_request(EXYNOS4_GPX0(6), "GPX0_6"))
        printk(KERN_WARNING "GPX0_6 Port request error!!!\n");
    else    {
        s3c_gpio_setpull(EXYNOS4_GPX0(6), S3C_GPIO_PULL_NONE);
        s3c_gpio_cfgpin(EXYNOS4_GPX0(6), S3C_GPIO_SFN(0));
        gpio_direction_input(EXYNOS4_GPX0(6));
        //gpio_free(EXYNOS4_GPX0(6));
    }
}

int get_lcd_type()
{
    int value1, value2, type = 0;
    int flags = 0;

    //if(0 == flags)
    //{
    //  init_lcd_type();
    //  flags = 1;
    //}
#if 0
    if(gpio_request(EXYNOS4_GPC0(3), "GPC0_3"))
        printk(KERN_WARNING "GPC0_3 Port request error!!!\n");
    else
    {
        value1 = gpio_get_value(EXYNOS4_GPC0(3));
        gpio_free(EXYNOS4_GPC0(3));
    }

    if(gpio_request(EXYNOS4_GPX0(6), "GPX0_6"))
        printk(KERN_WARNING "GPX0_6 Port request error!!!\n");
    else
    {
        value2 = gpio_get_value(EXYNOS4_GPX0(6));
        gpio_free(EXYNOS4_GPC0(3));
    }
#else
    value1 = gpio_get_value(EXYNOS4_GPC0(3));

    value2 = gpio_get_value(EXYNOS4_GPX0(6));
#endif  
    type = (value1<<1)|value2;

    printk("value1 = %d, value2 = %d, type = 0x%x\n", value1, value2, type);

    return type;
}
EXPORT_SYMBOL(get_lcd_type);

void setup_ft5x_width_height()
{
    int type = get_lcd_type();

    if(0x00 == type)    //9.7
    {
#if defined(CONFIG_TOUCHSCREEN_FT5X0X)
        ft5x0x_pdata.screen_max_x = 768;
        ft5x0x_pdata.screen_max_y = 1024;
#endif
        ;
    }
    else if(0x01 == type)   //7.0
    {
#if defined(CONFIG_TOUCHSCREEN_FT5X0X)
        ft5x0x_pdata.screen_max_x = 800;//1280;//1280;
        ft5x0x_pdata.screen_max_y = 1280;//800;//800;
#endif
        ;
    }
    else if(0x02 == type)   //4.3
    {
        ;
    }
}

static struct i2c_board_info i2c_devs3[] __initdata = {
    /* add by cym 20130318 support for FT5X0X TouchScreen */
#if defined(CONFIG_TOUCHSCREEN_FT5X0X)
{
    I2C_BOARD_INFO("ft5x0x_ts", 0x70>>1),
    .irq = IRQ_EINT(4),
    .platform_data = &ft5x0x_pdata,
},
#endif
/* end add */
};

#ifdef CONFIG_SND_SOC_WM8960
#include 
static struct wm8960_data wm8960_pdata = {
    .capless        = 0,
    .dres           = WM8960_DRES_400R,
};
#endif

/* I2C4 */
static struct i2c_board_info i2c_devs4[] __initdata = {
#ifdef CONFIG_SND_SOC_WM8960
{
    I2C_BOARD_INFO("wm8960", 0x1a),
    .platform_data  = &wm8960_pdata,
},
#endif
};


/* I2C5 */
static struct i2c_board_info i2c_devs5[] __initdata = {
#ifdef CONFIG_TC4_GB// liang
#if defined(CONFIG_MPU_SENSORS_MPU3050) || defined(CONFIG_MPU_SENSORS_MPU3050_MODULE)
    // liang
{
    I2C_BOARD_INFO(SENSOR_MPU_NAME, 0x68),
    //.irq = gpio_to_irq(MPUGPIO),
    .irq = IRQ_EINT(27),
    .platform_data = &mpu_data,
},
#endif  //yulu for test sleep
#endif
#ifdef CONFIG_TC4_ICS
#ifdef CONFIG_MPU_SENSORS_MPU6050B1
{
    I2C_BOARD_INFO("mpu6050", 0x68),
    .platform_data = &mpu6050_data,
    .irq = EXYNOS4_GPX3(3),
},
/*
        {
                I2C_BOARD_INFO("ak8975", 0x0C),
                .platform_data = &inv_mpu_compass_data,
                .irq = EXYNOS4_GPX1(4),
        }
*/
#else
// gyro
{
    I2C_BOARD_INFO(MPU_NAME, 0x68),
    .irq = IRQ_EINT(27),
    .platform_data = &mpu3050_data,
},
// accel
{
    I2C_BOARD_INFO("bma250", (0x30>>1)),
    //.irq = IRQ_EINT(24),// 25?
    .platform_data = &inv_mpu_bma250_data,
},
#endif
#endif
};

/* add by cym 20130417 for TSC2007 TouchScreen */
#ifdef CONFIG_TOUCHSCREEN_TSC2007
#define GPIO_TSC_PORT EXYNOS4_GPX0(0)
static int ts_get_pendown_state(void)
{
    int val;

    val = gpio_get_value(GPIO_TSC_PORT);

    return !val;
}

static int ts_init(void)
{
    int err;

    err = gpio_request_one(EXYNOS4_GPX0(0), GPIOF_IN, "TSC2007_IRQ");
    if (err) {
        printk(KERN_ERR "failed to request TSC2007_IRQ pin\n");
        return -1;
    }

    s3c_gpio_cfgpin(EXYNOS4_GPX0(0), S3C_GPIO_SFN(0xF));
    s3c_gpio_setpull(EXYNOS4_GPX0(0), S3C_GPIO_PULL_NONE);
    gpio_free(EXYNOS4_GPX0(0));

    return 0;
}

static struct tsc2007_platform_data tsc2007_info = {
    .model          = 2007,
    .x_plate_ohms       = 180,
    .get_pendown_state  = ts_get_pendown_state,
    .init_platform_hw   = ts_init,
};
#endif
/* end add */

/* I2C7 */
static struct i2c_board_info i2c_devs7[] __initdata = {
    /* add by cym 20130417 for TSC2007 TouchScreen */
#ifdef CONFIG_TOUCHSCREEN_TSC2007
{
    I2C_BOARD_INFO("tsc2007", 0x48),
    .type       = "tsc2007",
    .platform_data  = &tsc2007_info,
    .irq = IRQ_EINT(0),
}
#endif
/* end add */
};
 
 
   
   
   
   
  • 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
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204
  • 205
  • 206
  • 207
  • 208
  • 209
  • 210
  • 211
  • 212
  • 213
  • 214
  • 215
  • 216
  • 217
  • 218
  • 219
  • 220
  • 221
  • 222
  • 223
  • 224
  • 225
  • 226
  • 227
  • 228
  • 229
  • 230
  • 231
  • 232
  • 233
  • 234
  • 235
  • 236
  • 237
  • 238
  • 239
  • 240
  • 241
  • 242
  • 243
  • 244
  • 245
  • 246
  • 247
  • 248
  • 249
  • 250
  • 251
  • 252
  • 253
  • 254
  • 255
  • 256
  • 257
  • 258
  • 259
  • 260
  • 261
  • 262
  • 263
  • 264
  • 265
  • 266
  • 267
  • 268
  • 269
  • 270
  • 271
  • 272
  • 273
  • 274
  • 275
  • 276
  • 277
  • 278
  • 279
  • 280
  • 281
  • 282
  • 283
  • 284
  • 285
  • 286

3.背光接口

/* LCD Backlight data */
static struct samsung_bl_gpio_info smdk4x12_bl_gpio_info = {
    .no = EXYNOS4_GPD0(1),
    .func = S3C_GPIO_SFN(2),
};

static struct platform_pwm_backlight_data smdk4x12_bl_data = {
    .pwm_id = 1,
#ifdef CONFIG_FB_S5P_LMS501KF03
    .pwm_period_ns  = 1000,
#endif
};
 
 
   
   
   
   
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

4. 六轴运动处理组件

#ifdef CONFIG_MPU_SENSORS_MPU6050B1
void sensor_hw_init(void)
{
    printk("%s: line = %d\n", __FUNCTION__, __LINE__);

    if (gpio_request(EXYNOS4_GPX3(3), "MPU6050 INT"))
        printk(KERN_WARNING "MPU6050 INT(GPX3.3) Port request error!!!\n");
    else    {
        s3c_gpio_setpull(EXYNOS4_GPX3(3), S3C_GPIO_PULL_NONE);
        s3c_gpio_cfgpin(EXYNOS4_GPX3(3), S3C_GPIO_SFN(0));
        gpio_direction_input(EXYNOS4_GPX3(3));
        gpio_free(EXYNOS4_GPX3(3));
    }

    /* Sensor AK8975 DRDY */
    /*      if (gpio_request(EXYNOS4_GPX1(4), "AK8975 RDY"))
                printk(KERN_WARNING "AK8975 RDY(GPX1.4) Port request error!!!\n");
        else    {
                s3c_gpio_setpull(EXYNOS4_GPX1(4), S3C_GPIO_PULL_NONE);
                s3c_gpio_cfgpin(EXYNOS4_GPX1(4), S3C_GPIO_SFN(0));
                gpio_direction_input(EXYNOS4_GPX1(4));
                gpio_free(EXYNOS4_GPX1(4));
        }
        //enable_irq(IRQ_EINT(27));
*/
}

static struct mpu_platform_data mpu6050_data = {
    .int_config = 0x10,
    .orientation = {
        0, -1, 0,
        -1, 0, 0,
        0, 0, -1},

    .level_shifter = 0,
};
static struct ext_slave_platform_data inv_mpu_compass_data = {
    .bus = EXT_SLAVE_BUS_PRIMARY,
    .orientation = {
        -1, 0, 0,
        0, 1, 0,
        0, 0, -1},
};

你可能感兴趣的:(讯为4412讯为开发板的源码接口说明)