Platform: IMX6Q
OS: Android Lollipop 5.1
Freescale Branch: l5.1.1_2.1.0-ga
Kernel Branch: 3.14.52
/*Kris,20160406, Porting lcd driver.*/ &ldb { status = "okay"; lvds-channel@0 { fsl,data-mapping = "spwg"; fsl,data-width = <24>; primary; status = "okay"; display-timings { native-mode = <&timing0>; timing0: cog_t700mixn { clock-frequency = <50000000>; hactive = <1024>; vactive = <600>; hback-porch = <220>; hfront-porch = <40>; vback-porch = <21>; vfront-porch = <7>; hsync-len = <60>; vsync-len = <10>; }; }; }; };
/ { /*Kris,20160406, Porting lcd driver.*/ cog_t700mixn { compatible = "cog_t700mixn"; bl_power_gpio = <&gpio4 14 1>; lcd_power_gpio = <&gpio3 0 1>; DVDD-supply = <&vgen2_reg>; }; };
imx6qdl-sabresd { pinctrl_hog: hoggrp { fsl,pins = < ...... MX6QDL_PAD_EIM_DA0__GPIO3_IO00 0x80000000 >; };
mxcfb1: fb@0 { compatible = "fsl,mxc_sdc_fb"; disp_dev = "ldb"; interface_pix_fmt = "RGB24"; default_bpp = <32>; int_clk = <0>; late_init = <0>; status = "disabled"; };
#Kris,20160406, Porting lcd driver. CONFIG_COG_T700MIXN=y
# regulators early, since some subsystems rely on them to initialize obj-$(CONFIG_REGULATOR) += regulator/ #Kris,20160406, Porting lcd driver. #Load lcd driver after regulator module to wait it to be ready. obj-y += video/
#Kris,20160406, Porting lcd driver. config COG_T700MIXN bool "COG T700MIXN lcd driver." default n
#Kris,20160406, Porting lcd driver. obj-$(CONFIG_COG_T700MIXN) += cog_t700mixn.o
#include <linux/device.h> #include <linux/err.h> #include <linux/init.h> #include <linux/module.h> #include <linux/of.h> #include <linux/of_gpio.h> #include <linux/platform_device.h> #include <linux/regulator/consumer.h> #include <linux/gpio.h> #define DRIVER_NAME "cog-t700mixn" static const struct of_device_id t700mixn_dt_ids[] = { { .compatible = "cog_t700mixn", }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, t700mixn_dt_ids); static int t700mixn_probe(struct platform_device *pdev) { static struct regulator *dvdd_regulator; struct device_node *lcd = NULL; int ret, bl_power_gpio, lcd_power_gpio; printk("%s\n", __func__); lcd = pdev->dev.of_node; //enable backlight power. bl_power_gpio = of_get_named_gpio(lcd, "bl_power_gpio", 0); if (gpio_is_valid(bl_power_gpio)) { ret = gpio_request_one(bl_power_gpio, GPIOF_OUT_INIT_HIGH, "bl_power_gpio"); pr_info("request bl_power_gpio\n"); if (ret) pr_warn("failed to request bl_power_gpio\n"); } //Set VGEN2 of pmic. dvdd_regulator = devm_regulator_get(&pdev->dev, "DVDD"); if (!IS_ERR(dvdd_regulator)) { regulator_set_voltage(dvdd_regulator,1500000,1500000); ret = regulator_enable(dvdd_regulator); if (ret) { pr_err("%s:DVDD set voltage error\n", __func__); return ret; } else { dev_info(&pdev->dev,"%s:DVDD set voltage ok\n", __func__); } } else { dvdd_regulator = NULL; pr_err("%s: cannot get DVDD voltage error\n", __func__); } //this gpio control DVDD and AVDD together. lcd_power_gpio = of_get_named_gpio(lcd, "lcd_power_gpio", 0); if (gpio_is_valid(lcd_power_gpio)) { ret = gpio_request_one(lcd_power_gpio, GPIOF_OUT_INIT_HIGH, "bl_power_gpio"); pr_info("request lcd_power_gpio\n"); if (ret) pr_warn("failed to request lcd_power_gpio\n"); } return ret; } static struct platform_driver t700mixn_driver = { .probe = t700mixn_probe, .driver = { .of_match_table = t700mixn_dt_ids, .name = DRIVER_NAME, .owner = THIS_MODULE, }, }; module_platform_driver(t700mixn_driver); MODULE_AUTHOR("Kris.Fei: [email protected]"); MODULE_DESCRIPTION("COG T700MIXN lcd driver"); MODULE_LICENSE("GPL"); MODULE_ALIAS("platform:" DRIVER_NAME);