osd: bringup for g12b
authorpengcheng chen <pengcheng.chen@amlogic.com>
Fri, 4 May 2018 14:02:25 +0000 (22:02 +0800)
committerYixun Lan <yixun.lan@amlogic.com>
Fri, 29 Jun 2018 06:39:08 +0000 (23:39 -0700)
PD#165090: osd: bringup for g12b

Change-Id: Ib1f721f695482a90716273555c7802a925145227
Signed-off-by: pengcheng chen <pengcheng.chen@amlogic.com>
arch/arm64/boot/dts/amlogic/g12b_pxp.dts
arch/arm64/boot/dts/amlogic/mesong12b.dtsi
drivers/amlogic/media/osd/osd.h
drivers/amlogic/media/osd/osd_backup.c
drivers/amlogic/media/osd/osd_fb.c
drivers/amlogic/media/osd/osd_hw.c
drivers/amlogic/media/osd/osd_rdma.c

index 4c8cd89..3e54f70 100644 (file)
                tv_mode = <0>;/*1:enabel ;0:disable*/
        };
 
-       meson-fb {
-               compatible = "amlogic, meson-g12a";
-               memory-region = <&logo_reserved>;
-               dev_name = "meson-fb";
-               status = "disabled";
-               interrupts = <0 3 1
-                       0 56 1
-                       0 89 1>;
-               interrupt-names = "viu-vsync", "viu2-vsync", "rdma";
-               mem_size = <0x00800000 0x1980000 0x100000 0x100000 0x800000>;
-               /* uboot logo,fb0/fb1 memory size,if afbcd fb0=0x01851000*/
-               display_mode_default = "1080p60hz";
-               scale_mode = <1>;
-               /** 0:VPU free scale 1:OSD free scale 2:OSD super scale */
-               display_size_default = <1920 1080 1920 2160 32>;
-               /*1920*1080*4*3 = 0x17BB000*/
-               pxp_mode = <1>; /** 0:normal mode 1:pxp mode */
-               mem_alloc = <1>;
-               logo_addr = "0x3f800000";
-               clocks = <&clkc CLKID_VPU_CLKC_MUX>;
-               clock-names = "vpu_clkc";
-       };
-
        /* Audio Related start */
        pdm_codec:dummy{
                #sound-dai-cells = <0>;
 
 }; /* end of / */
 
+&meson_fb {
+       status = "okay";
+       display_size_default = <1920 1080 1920 2160 32>;
+       mem_size = <0x00800000 0x1980000 0x100000 0x100000 0x800000>;
+       logo_addr = "0x3f800000";
+       mem_alloc = <1>;
+       pxp_mode = <1>; /** 0:normal mode 1:pxp mode */
+};
+
 &pwm_AO_cd {
                status = "okay";
        };
index f587066..a8a8518 100644 (file)
        canvas: canvas{
                compatible = "amlogic, meson, canvas";
                dev_name = "amlogic-canvas";
-               status = "disabled";
+               status = "okay";
                reg = <0x0 0xff638000 0x0 0x2000>;
        };
 
        ge2d {
                compatible = "amlogic, ge2d-g12a";
                dev_name = "ge2d";
-               status = "disabled";
+               status = "okay";
                interrupts = <0 146 1>;
                interrupt-names = "ge2d";
                clocks = <&clkc CLKID_VAPB_MUX>,
 
        codec_io: codec_io {
                compatible = "amlogic, codec_io";
-               status = "disabled";
+               status = "okay";
                #address-cells=<2>;
                #size-cells=<2>;
                ranges;
        rdma{
                compatible = "amlogic, meson, rdma";
                dev_name = "amlogic-rdma";
-               status = "disabled";
+               status = "okay";
                interrupts = <0 89 1>;
                interrupt-names = "rdma";
        };
 
+       meson_fb: meson-fb {
+               compatible = "amlogic, meson-g12b";
+               memory-region = <&logo_reserved>;
+               dev_name = "meson-fb";
+               status = "disable";
+               interrupts = <0 3 1
+                       0 56 1
+                       0 89 1>;
+               interrupt-names = "viu-vsync", "viu2-vsync", "rdma";
+               /* uboot logo,fb0/fb1 memory size,if afbcd fb0=0x01851000*/
+               display_mode_default = "1080p60hz";
+               scale_mode = <1>;
+               /** 0:VPU free scale 1:OSD free scale 2:OSD super scale */
+               display_size_default = <1920 1080 1920 2160 32>;
+               /*1920*1080*4*3 = 0x17BB000*/
+               clocks = <&clkc CLKID_VPU_CLKC_MUX>;
+               clock-names = "vpu_clkc";
+       };
        irblaster: meson-irblaster {
                compatible = "amlogic, meson_irblaster";
                dev_name = "meson-irblaster";
index e28fa2c..35137e3 100644 (file)
@@ -270,6 +270,7 @@ enum cpuid_type_e {
        __MESON_CPU_MAJOR_ID_GXLX,
        __MESON_CPU_MAJOR_ID_TXHD,
        __MESON_CPU_MAJOR_ID_G12A,
+       __MESON_CPU_MAJOR_ID_G12B,
        __MESON_CPU_MAJOR_ID_UNKNOWN,
 };
 
index fef043e..1bef589 100644 (file)
@@ -844,7 +844,8 @@ void recovery_regs_init(void)
                return;
        memset(gRecovery, 0, sizeof(gRecovery));
 
-       if (cpu_id == __MESON_CPU_MAJOR_ID_G12A)
+       if ((cpu_id == __MESON_CPU_MAJOR_ID_G12A) ||
+               (cpu_id == __MESON_CPU_MAJOR_ID_G12B))
                recovery_regs_init_g12a();
        else
                recovery_regs_init_old();
@@ -1539,7 +1540,8 @@ int update_recovery_item(u32 addr, u32 value)
        if (!recovery_enable)
                return ret;
 
-       if (cpu_id == __MESON_CPU_MAJOR_ID_G12A)
+       if ((cpu_id == __MESON_CPU_MAJOR_ID_G12A) ||
+               (cpu_id == __MESON_CPU_MAJOR_ID_G12B))
                ret = update_recovery_item_g12a(addr, value);
        else
                ret = update_recovery_item_old(addr, value);
@@ -1555,7 +1557,8 @@ s32 get_recovery_item(u32 addr, u32 *value, u32 *mask)
        if (!recovery_enable)
                return ret;
 
-       if (cpu_id == __MESON_CPU_MAJOR_ID_G12A)
+       if ((cpu_id == __MESON_CPU_MAJOR_ID_G12A) ||
+               (cpu_id == __MESON_CPU_MAJOR_ID_G12B))
                ret = get_recovery_item_g12a(addr, value, mask);
        else
                ret = get_recovery_item_old(addr, value, mask);
index d5cc68e..1f60542 100644 (file)
@@ -1401,7 +1401,8 @@ static int malloc_osd_memory(struct fb_info *info)
        /* clear osd buffer if not logo layer */
        if (((logo_index < 0) || (logo_index != fb_index)) ||
                (osd_meson_dev.cpu_id == __MESON_CPU_MAJOR_ID_AXG) ||
-               (osd_meson_dev.cpu_id == __MESON_CPU_MAJOR_ID_G12A)) {
+               (osd_meson_dev.cpu_id == __MESON_CPU_MAJOR_ID_G12A) ||
+               ((osd_meson_dev.cpu_id == __MESON_CPU_MAJOR_ID_G12B))) {
                osd_log_info("---------------clear fb%d memory %p\n",
                        fb_index, fbdev->fb_mem_vaddr);
                set_logo_loaded();
@@ -3375,6 +3376,21 @@ static struct osd_device_data_s osd_g12a = {
        .has_viu2 = 1,
 };
 
+static struct osd_device_data_s osd_g12b = {
+       .cpu_id = __MESON_CPU_MAJOR_ID_G12B,
+       .osd_ver = OSD_HIGH_ONE,
+       .afbc_type = MALI_AFBC,
+       .osd_count = 4,
+       .has_deband = 1,
+       .has_lut = 1,
+       .has_rdma = 1,
+       .has_dolby_vision = 1,
+       .osd_fifo_len = 64, /* fifo len 64*8 = 512 */
+       .vpp_fifo_len = 0xfff,/* 2048 */
+       .dummy_data = 0x00808000,
+       .has_viu2 = 1,
+};
+
 static const struct of_device_id meson_fb_dt_match[] = {
        {
                .compatible = "amlogic, meson-gxbb",
@@ -3413,6 +3429,10 @@ static const struct of_device_id meson_fb_dt_match[] = {
                .compatible = "amlogic, meson-g12a",
                .data = &osd_g12a,
        },
+       {
+               .compatible = "amlogic, meson-g12b",
+               .data = &osd_g12b,
+       },
        {},
 };
 
index 9fbfdee..925f931 100644 (file)
@@ -1438,6 +1438,7 @@ static u32 osd_get_hw_reset_flag(void)
                break;
 #endif
        case __MESON_CPU_MAJOR_ID_G12A:
+       case __MESON_CPU_MAJOR_ID_G12B:
                {
                int i, afbc_enable = 0;
 
@@ -6967,7 +6968,8 @@ void osd_init_hw(u32 logo_loaded, u32 osd_probe,
        else if ((osd_meson->cpu_id >= __MESON_CPU_MAJOR_ID_GXL)
                && (osd_meson->cpu_id < __MESON_CPU_MAJOR_ID_TXL))
                backup_regs_init(HW_RESET_OSD1_REGS);
-       else if (osd_meson->cpu_id == __MESON_CPU_MAJOR_ID_G12A)
+       else if ((osd_meson->cpu_id == __MESON_CPU_MAJOR_ID_G12A)
+               || (osd_meson->cpu_id == __MESON_CPU_MAJOR_ID_G12B))
                backup_regs_init(HW_RESET_MALI_AFBCD_REGS);
        else
                backup_regs_init(HW_RESET_NONE);
index 8e9c817..96dd933 100644 (file)
@@ -1227,8 +1227,10 @@ int osd_rdma_reset_and_flush(u32 reset_bit)
        }
 
        if ((reset_bit & HW_RESET_MALI_AFBCD_REGS)
-               && (osd_hw.osd_meson_dev.cpu_id
-               == __MESON_CPU_MAJOR_ID_G12A))
+               && ((osd_hw.osd_meson_dev.cpu_id
+               == __MESON_CPU_MAJOR_ID_G12A) ||
+               (osd_hw.osd_meson_dev.cpu_id
+               == __MESON_CPU_MAJOR_ID_G12B)))
                wrtie_reg_internal(VPU_MAFBC_COMMAND, 1);
 
        if (item_count < 500)