[RK3288][Android7.1.2] kernel移植 : rk808+edp

平台:Rockchip
处理器:rk3288
Android版本:Android 7.1.2
内核版本:Linux 4.4.71

第一步:将最接近的dts拷贝一份并重新命名。
rk3288\kernel\arch\arm\boot\dts\rk3288-evb-android-rk818-edp.dts
拷贝一份并命名如下:
rk3288\kernel\arch\arm\boot\dts\ rk3288-evb-android-rk808-edp.dts

第二步:修改对应的PMU,根据第一步拷贝而来的PMU是RK818,我们平板所用的PMU是RK808
所以做以下的几个修改:
//compatible = "rockchip,rk3288-evb-android-rk818", "rockchip,rk3288";
compatible = "rockchip,rk3288-evb-android-rk808", "rockchip,rk3288";

sdio_pwrseq: sdio-pwrseq {
  compatible = "mmc-pwrseq-simple";
  //clocks = <&rk818 1>;
    clocks = <&rk808 1>;//rk818 1>;

wireless-bluetooth {
  //clocks = <&rk818 1>;
  clocks = <&rk808 1>;//rk818 1>;
  clock-names = "ext_clock";
};

&i2c0 {
clock-frequency = <400000>;
//rk818: pmic@1c {
rk808: pmic@1b {
}

第三步:注意保留  vcc_lcd 即可,注意pmu里面也有一个vcc_lcd相关的应该舍去
vcc_lcd: vcc-lcd {
  compatible = "regulator-fixed";
  regulator-boot-on;
  enable-active-high;
  gpio = <&gpio7 3 GPIO_ACTIVE_HIGH>;
  pinctrl-names = "default";
  pinctrl-0 = <&lcd_en>;
  regulator-name = "vcc_lcd";
  vin-supply = <&vcc_io>;
};

至此,pmic相关的就已经配置好了。 我们再来根据edp相关的配置点亮屏幕。 检查下dts以下四个与edp相关的选择是否正确,如下:
&edp {
status = "okay";
};

&edp_panel {
compatible ="lg,lp079qx1-sp0v", "simple-panel";
enable-gpios = <&gpio7 4 GPIO_ACTIVE_HIGH>;
pinctrl-0 = <&lcd_cs>;
power-supply = <&vcc_lcd>;
delay,prepare = <120>;
status = "okay";

disp_timings: display-timings {
  native-mode = <&timing0>;
  timing0: timing0 {
  clock-frequency = <200000000>;
  hactive = <1536>;
  vactive = <2048>;
  hfront-porch = <12>;
  hsync-len = <16>;
  hback-porch = <48>;
  vfront-porch = <8>;
  vsync-len = <4>;
  vback-porch = <8>;
  hsync-active = <0>;
  vsync-active = <0>;
  de-active = <0>;
  pixelclk-active = <0>;
  };
};

&edp_phy {
status = "okay";
};

&route_edp {
status = "okay";
};

在Android5.1的SDK里面,Rockchip是这样用一个dtsi包裹起来的参数:
/ {
disp_timings: display-timings {
  native-mode = <&timing0>;
  timing0: timing0 {
    screen-type = ;
    out-face    = ;
    clock-frequency = <205000000>;
    hactive = <1536>;
    vactive = <2048>;
    hback-porch = <5>;
    hfront-porch = <150>;
    vback-porch = <9>;
    vfront-porch = <3>;
    hsync-len = <5>;
    vsync-len = <1>;
    hsync-active = <0>;
    vsync-active = <0>;
    de-active = <0>;
    pixelclk-active = <1>;
    swap-rb = <0>;
    swap-rg = <0>;
    swap-gb = <0>;
   };
  };
};

如今应该在驱动文件:rk3288\kernel\drivers\gpu\drm\panel\panel-simple.c
static const struct of_device_id platform_of_match[] = 
{
  {
  .compatible = "simple-panel",
  .data = NULL,
  }, {
  }, {
  .compatible = "lg,lp079qx1-sp0v",
  .data = &lg_lp079qx1_sp0v,
  }, 
}

对应的dts里面的兼容:
compatible ="lg,lp079qx1-sp0v", "simple-panel";

static const struct drm_display_mode lg_lp079qx1_sp0v_mode = {
// .clock = 200000,
// .hdisplay = 1536,
// .hsync_start = 1536 + 12,
// .hsync_end = 1536 + 12 + 16,
// .htotal = 1536 + 12 + 16 + 48,
// .vdisplay = 2048,
// .vsync_start = 2048 + 8,
// .vsync_end = 2048 + 8 + 4,
// .vtotal = 2048 + 8 + 4 + 8,
// .vrefresh = 60,
.clock = 205000,
.hdisplay = 1536,
.hsync_start = 1536 + 150,
.hsync_end = 1536 + 150 + 5,
.htotal = 1536 + 150 + 5 + 5,
.vdisplay = 2048,
.vsync_start = 2048 + 3,
.vsync_end = 2048 + 3 + 9,
.vtotal = 2048 + 3 + 9 + 1,
.vrefresh = 60,
.flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
};

static const struct panel_desc lg_lp079qx1_sp0v = {
  .modes = &lg_lp079qx1_sp0v_mode,
  .num_modes = 1,
  .size = {
    .width = 129,
    .height = 171,
  },
  .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
};

[RK3288][Android7.1.2] kernel移植 : rk808+edp_第1张图片

你可能感兴趣的:(Android,RockChip)