Merge branch 'develop-3.10-next' of 10.10.10.29:rk/kernel into develop-3.10-next
authorzsq <zsq@rock-chips.com>
Fri, 13 Feb 2015 07:22:34 +0000 (15:22 +0800)
committerzsq <zsq@rock-chips.com>
Fri, 13 Feb 2015 07:22:34 +0000 (15:22 +0800)
1  2 
arch/arm64/configs/rockchip_defconfig
drivers/video/rockchip/rga/rga_drv.c

index 44f5f8b506e893462ee5291d8418510e1207da2e,09b503c4b9cd42877b3d4d1806940daad167fac7..1ffd052199c6d7a3425300538f74ed313a66940d
@@@ -64,6 -64,8 +64,8 @@@ CONFIG_CPU_FREQ_GOV_ONDEMAND=
  CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
  CONFIG_ARM_BIG_LITTLE_CPUFREQ=y
  CONFIG_ARM_DT_BL_CPUFREQ=y
+ # CONFIG_ARM_ROCKCHIP_CPUFREQ is not set
+ CONFIG_ARM_ROCKCHIP_BL_CPUFREQ=y
  CONFIG_CPU_IDLE=y
  CONFIG_ARM64_CPUIDLE=y
  CONFIG_NET=y
@@@ -341,11 -343,13 +343,13 @@@ CONFIG_BATTERY_RT5025=
  CONFIG_CHARGER_RT5036=y
  CONFIG_RT_POWER=y
  CONFIG_BATTERY_RICOH619=y
+ CONFIG_TEST_POWER=y
  CONFIG_BATTERY_BQ24296=y
  CONFIG_BATTERY_BQ27320=y
  CONFIG_BATTERY_RK30_ADC_FAC=y
  CONFIG_CW2015_BATTERY=y
  CONFIG_POWER_RESET_GPIO=y
+ CONFIG_POWER_RESET_ROCKCHIP=y
  CONFIG_POWER_AVS=y
  CONFIG_ROCKCHIP_IODOMAIN=y
  CONFIG_SENSORS_ROCKCHIP_TSADC=y
@@@ -385,15 -389,11 +389,13 @@@ CONFIG_BACKLIGHT_CLASS_DEVICE=
  CONFIG_BACKLIGHT_PWM=y
  CONFIG_FB_ROCKCHIP=y
  CONFIG_LCDC_RK3368=y
 +CONFIG_ROCKCHIP_RGA=y
 +CONFIG_ROCKCHIP_RGA2=y
  CONFIG_RK_TRSM=y
  CONFIG_RK31XX_LVDS=y
  CONFIG_DP_ANX6345=y
  CONFIG_RK32_DP=y
  CONFIG_RK_HDMI=y
- # CONFIG_HDMI_RK3288 is not set
- # CONFIG_HDMI_RK3036 is not set
  CONFIG_RK_TVENCODER=y
  CONFIG_LOGO=y
  # CONFIG_LOGO_LINUX_MONO is not set
@@@ -483,6 -483,9 +485,9 @@@ CONFIG_USB_HIDDEV=
  CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
  CONFIG_USB_EHCI_HCD=y
  CONFIG_USB_EHCI_RK=y
+ CONFIG_USB_EHCI_HCD_PLATFORM=y
+ CONFIG_USB_OHCI_HCD=y
+ CONFIG_USB_OHCI_HCD_PLATFORM=y
  CONFIG_USB_ACM=y
  CONFIG_USB_PRINTER=y
  CONFIG_USB_STORAGE=y
index d5857c9dac53c2ce1a764a5063965253337ff3cd,d081f0ca8c8ee35110c1ec7298cc95052ddaa8df..d897c8795619c72816e1115f7a934c8393977b66
 -/*
 - * Copyright (C) 2012 ROCKCHIP, Inc.
 - *
 - * This software is licensed under the terms of the GNU General Public
 - * License version 2, as published by the Free Software Foundation, and
 - * may be copied, distributed, and modified under those terms.
 - *
 - * This program is distributed in the hope that it will be useful,
 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 - * GNU General Public License for more details.
 - *
 - */
 -
 -#define pr_fmt(fmt) "rga: " fmt
 -#include <linux/kernel.h>
 -#include <linux/init.h>
 -#include <linux/module.h>
 -#include <linux/platform_device.h>
 -#include <linux/sched.h>
 -#include <linux/mutex.h>
 -#include <linux/err.h>
 -#include <linux/clk.h>
 -#include <asm/delay.h>
 -#include <linux/dma-mapping.h>
 -#include <linux/delay.h>
 -#include <asm/io.h>
 -#include <linux/irq.h>
 -#include <linux/interrupt.h>
 -//#include <mach/io.h>
 -//#include <mach/irqs.h>
 -#include <linux/fs.h>
 -#include <asm/uaccess.h>
 -#include <linux/miscdevice.h>
 -#include <linux/poll.h>
 -#include <linux/delay.h>
 -#include <linux/wait.h>
 -#include <linux/syscalls.h>
 -#include <linux/timer.h>
 -#include <linux/time.h>
 -#include <asm/cacheflush.h>
 -#include <linux/slab.h>
 -#include <linux/fb.h>
 -#include <linux/wakelock.h>
 -
 -#if defined(CONFIG_ION_ROCKCHIP)
 -#include <linux/rockchip_ion.h>
 -#endif
 -
 -
 -#include "rga.h"
 -#include "rga_reg_info.h"
 -#include "rga_mmu_info.h"
 -#include "RGA_API.h"
 -
 -#define RGA_TEST_CASE 0
 -
 -#define RGA_TEST 0
 -#define RGA_TEST_TIME 0
 -#define RGA_TEST_FLUSH_TIME 0
 -#define RGA_INFO_BUS_ERROR 1
 -
 -#define PRE_SCALE_BUF_SIZE  2048*1024*4
 -
 -#define RGA_POWER_OFF_DELAY   4*HZ /* 4s */
 -#define RGA_TIMEOUT_DELAY     2*HZ /* 2s */
 -
 -#define RGA_MAJOR             255
 -
 -#if defined(CONFIG_ARCH_RK2928) || defined(CONFIG_ARCH_RK3026)
 -#define RK30_RGA_PHYS         RK2928_RGA_PHYS
 -#define RK30_RGA_SIZE         RK2928_RGA_SIZE
 -#endif
 -#define RGA_RESET_TIMEOUT     1000
 -
 -/* Driver information */
 -#define DRIVER_DESC           "RGA Device Driver"
 -#define DRIVER_NAME           "rga"
 -
 -#define RGA_VERSION   "1.003"
 -
 -ktime_t rga_start;
 -ktime_t rga_end;
 -
 -rga_session rga_session_global;
 -
 -long (*rga_ioctl_kernel_p)(struct rga_req *);
 -
 -
 -struct rga_drvdata {
 -      struct miscdevice miscdev;
 -      struct device dev;
 -      void *rga_base;
 -      int irq;
 -
 -      struct delayed_work power_off_work;
 -      void (*rga_irq_callback)(int rga_retval);   //callback function used by aync call
 -      struct wake_lock wake_lock;
 -
 -    struct clk *pd_rga;
 -      struct clk *aclk_rga;
 -    struct clk *hclk_rga;
 -
 -    //#if defined(CONFIG_ION_ROCKCHIP)
 -    struct ion_client * ion_client;
 -    //#endif
 -};
 -
 -static struct rga_drvdata *drvdata;
 -rga_service_info rga_service;
 -struct rga_mmu_buf_t rga_mmu_buf;
 -
 -
 -#if defined(CONFIG_ION_ROCKCHIP)
 -extern struct ion_client *rockchip_ion_client_create(const char * name);
 -#endif
 -
 -static int rga_blit_async(rga_session *session, struct rga_req *req);
 -static void rga_del_running_list(void);
 -static void rga_del_running_list_timeout(void);
 -static void rga_try_set_reg(void);
 -
 -
 -/* Logging */
 -#define RGA_DEBUG 1
 -#if RGA_DEBUG
 -#define DBG(format, args...) printk(KERN_DEBUG "%s: " format, DRIVER_NAME, ## args)
 -#define ERR(format, args...) printk(KERN_ERR "%s: " format, DRIVER_NAME, ## args)
 -#define WARNING(format, args...) printk(KERN_WARN "%s: " format, DRIVER_NAME, ## args)
 -#define INFO(format, args...) printk(KERN_INFO "%s: " format, DRIVER_NAME, ## args)
 -#else
 -#define DBG(format, args...)
 -#define ERR(format, args...)
 -#define WARNING(format, args...)
 -#define INFO(format, args...)
 -#endif
 -
 -#if RGA_TEST
 -static void print_info(struct rga_req *req)
 -{
 -    printk("src : yrgb_addr = %.8x, src.uv_addr = %.8x, src.v_addr = %.8x, format = %d\n",
 -            req->src.yrgb_addr, req->src.uv_addr, req->src.v_addr, req->src.format);
 -    printk("src : act_w = %d, act_h = %d, vir_w = %d, vir_h = %d\n",
 -        req->src.act_w, req->src.act_h, req->src.vir_w, req->src.vir_h);
 -    printk("src : x_off = %.8x y_off = %.8x\n", req->src.x_offset, req->src.y_offset);
 -
 -    printk("dst : yrgb_addr = %.8x, dst.uv_addr = %.8x, dst.v_addr = %.8x, format = %d\n",
 -            req->dst.yrgb_addr, req->dst.uv_addr, req->dst.v_addr, req->dst.format);
 -    printk("dst : x_off = %.8x y_off = %.8x\n", req->dst.x_offset, req->dst.y_offset);
 -    printk("dst : act_w = %d, act_h = %d, vir_w = %d, vir_h = %d\n",
 -        req->dst.act_w, req->dst.act_h, req->dst.vir_w, req->dst.vir_h);
 -
 -    printk("clip.xmin = %d, clip.xmax = %d. clip.ymin = %d, clip.ymax = %d\n",
 -        req->clip.xmin, req->clip.xmax, req->clip.ymin, req->clip.ymax);
 -
 -    printk("mmu_flag = %.8x\n", req->mmu_info.mmu_flag);
 -
 -    //printk("alpha_rop_flag = %.8x\n", req->alpha_rop_flag);
 -    //printk("alpha_rop_mode = %.8x\n", req->alpha_rop_mode);
 -    //printk("PD_mode = %.8x\n", req->PD_mode);
 -}
 -#endif
 -
 -
 -static inline void rga_write(u32 b, u32 r)
 -{
 -      __raw_writel(b, drvdata->rga_base + r);
 -}
 -
 -static inline u32 rga_read(u32 r)
 -{
 -      return __raw_readl(drvdata->rga_base + r);
 -}
 -
 -static void rga_soft_reset(void)
 -{
 -      u32 i;
 -      u32 reg;
 -
 -      rga_write(1, RGA_SYS_CTRL); //RGA_SYS_CTRL
 -
 -      for(i = 0; i < RGA_RESET_TIMEOUT; i++)
 -      {
 -              reg = rga_read(RGA_SYS_CTRL) & 1; //RGA_SYS_CTRL
 -
 -              if(reg == 0)
 -                      break;
 -
 -              udelay(1);
 -      }
 -
 -      if(i == RGA_RESET_TIMEOUT)
 -              ERR("soft reset timeout.\n");
 -}
 -
 -static void rga_dump(void)
 -{
 -      int running;
 -    struct rga_reg *reg, *reg_tmp;
 -    rga_session *session, *session_tmp;
 -
 -      running = atomic_read(&rga_service.total_running);
 -      printk("rga total_running %d\n", running);
 -
 -    #if 0
 -
 -    /* Dump waiting list info */
 -    if (!list_empty(&rga_service.waiting))
 -    {
 -        list_head     *next;
 +/*\r
 + * Copyright (C) 2012 ROCKCHIP, Inc.\r
 + *\r
 + * This software is licensed under the terms of the GNU General Public\r
 + * License version 2, as published by the Free Software Foundation, and\r
 + * may be copied, distributed, and modified under those terms.\r
 + *\r
 + * This program is distributed in the hope that it will be useful,\r
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
 + * GNU General Public License for more details.\r
 + *\r
 + */\r
 +\r
 +#define pr_fmt(fmt) "rga: " fmt\r
 +#include <linux/kernel.h>\r
 +#include <linux/init.h>\r
 +#include <linux/module.h>\r
 +#include <linux/platform_device.h>\r
 +#include <linux/sched.h>\r
 +#include <linux/mutex.h>\r
 +#include <linux/err.h>\r
 +#include <linux/clk.h>\r
 +#include <asm/delay.h>\r
 +#include <linux/dma-mapping.h>\r
 +#include <linux/delay.h>\r
 +#include <asm/io.h>\r
 +#include <linux/irq.h>\r
 +#include <linux/interrupt.h>\r
 +//#include <mach/io.h>\r
 +//#include <mach/irqs.h>\r
 +#include <linux/fs.h>\r
 +#include <asm/uaccess.h>\r
 +#include <linux/miscdevice.h>\r
 +#include <linux/poll.h>\r
 +#include <linux/delay.h>\r
 +#include <linux/wait.h>\r
 +#include <linux/syscalls.h>\r
 +#include <linux/timer.h>\r
 +#include <linux/time.h>\r
 +#include <asm/cacheflush.h>\r
 +#include <linux/slab.h>\r
 +#include <linux/fb.h>\r
 +#include <linux/wakelock.h>\r
 +\r
 +#if defined(CONFIG_ION_ROCKCHIP)\r
 +#include <linux/rockchip_ion.h>\r
 +#endif\r
 +\r
 +\r
 +#include "rga.h"\r
 +#include "rga_reg_info.h"\r
 +#include "rga_mmu_info.h"\r
 +#include "RGA_API.h"\r
 +\r
 +#define RGA_TEST_CASE 0\r
 +\r
 +#define RGA_TEST 0\r
 +#define RGA_TEST_TIME 0\r
 +#define RGA_TEST_FLUSH_TIME 0\r
 +#define RGA_INFO_BUS_ERROR 1\r
 +\r
 +#define PRE_SCALE_BUF_SIZE  2048*1024*4\r
 +\r
 +#define RGA_POWER_OFF_DELAY   4*HZ /* 4s */\r
 +#define RGA_TIMEOUT_DELAY     2*HZ /* 2s */\r
 +\r
 +#define RGA_MAJOR             255\r
 +\r
 +#if defined(CONFIG_ARCH_RK2928) || defined(CONFIG_ARCH_RK3026)\r
 +#define RK30_RGA_PHYS         RK2928_RGA_PHYS\r
 +#define RK30_RGA_SIZE         RK2928_RGA_SIZE\r
 +#endif\r
 +#define RGA_RESET_TIMEOUT     1000\r
 +\r
 +/* Driver information */\r
 +#define DRIVER_DESC           "RGA Device Driver"\r
 +#define DRIVER_NAME           "rga"\r
 +\r
 +#define RGA_VERSION   "1.003"\r
 +\r
 +ktime_t rga_start;\r
 +ktime_t rga_end;\r
 +\r
 +rga_session rga_session_global;\r
 +\r
 +long (*rga_ioctl_kernel_p)(struct rga_req *);\r
 +\r
 +\r
 +struct rga_drvdata {\r
 +      struct miscdevice miscdev;\r
 +      struct device dev;\r
 +      void *rga_base;\r
 +      int irq;\r
 +\r
 +      struct delayed_work power_off_work;\r
 +      void (*rga_irq_callback)(int rga_retval);   //callback function used by aync call\r
 +      struct wake_lock wake_lock;\r
 +\r
 +    struct clk *pd_rga;\r
 +      struct clk *aclk_rga;\r
 +    struct clk *hclk_rga;\r
 +\r
 +    //#if defined(CONFIG_ION_ROCKCHIP)\r
 +    struct ion_client * ion_client;\r
 +    //#endif\r
 +};\r
 +\r
 +static struct rga_drvdata *drvdata;\r
 +rga_service_info rga_service;\r
 +struct rga_mmu_buf_t rga_mmu_buf;\r
 +\r
 +\r
 +#if defined(CONFIG_ION_ROCKCHIP)\r
 +extern struct ion_client *rockchip_ion_client_create(const char * name);\r
 +#endif\r
 +\r
 +static int rga_blit_async(rga_session *session, struct rga_req *req);\r
 +static void rga_del_running_list(void);\r
 +static void rga_del_running_list_timeout(void);\r
 +static void rga_try_set_reg(void);\r
 +\r
 +\r
 +/* Logging */\r
 +#define RGA_DEBUG 1\r
 +#if RGA_DEBUG\r
 +#define DBG(format, args...) printk(KERN_DEBUG "%s: " format, DRIVER_NAME, ## args)\r
 +#define ERR(format, args...) printk(KERN_ERR "%s: " format, DRIVER_NAME, ## args)\r
 +#define WARNING(format, args...) printk(KERN_WARN "%s: " format, DRIVER_NAME, ## args)\r
 +#define INFO(format, args...) printk(KERN_INFO "%s: " format, DRIVER_NAME, ## args)\r
 +#else\r
 +#define DBG(format, args...)\r
 +#define ERR(format, args...)\r
 +#define WARNING(format, args...)\r
 +#define INFO(format, args...)\r
 +#endif\r
 +\r
 +#if RGA_TEST\r
 +static void print_info(struct rga_req *req)\r
 +{\r
 +    printk("src : yrgb_addr = %.8x, src.uv_addr = %.8x, src.v_addr = %.8x, format = %d\n",\r
 +            req->src.yrgb_addr, req->src.uv_addr, req->src.v_addr, req->src.format);\r
 +    printk("src : act_w = %d, act_h = %d, vir_w = %d, vir_h = %d\n",\r
 +        req->src.act_w, req->src.act_h, req->src.vir_w, req->src.vir_h);\r
 +    printk("src : x_off = %.8x y_off = %.8x\n", req->src.x_offset, req->src.y_offset);\r
 +\r
 +    printk("dst : yrgb_addr = %.8x, dst.uv_addr = %.8x, dst.v_addr = %.8x, format = %d\n",\r
 +            req->dst.yrgb_addr, req->dst.uv_addr, req->dst.v_addr, req->dst.format);\r
 +    printk("dst : x_off = %.8x y_off = %.8x\n", req->dst.x_offset, req->dst.y_offset);\r
 +    printk("dst : act_w = %d, act_h = %d, vir_w = %d, vir_h = %d\n",\r
 +        req->dst.act_w, req->dst.act_h, req->dst.vir_w, req->dst.vir_h);\r
 +\r
 +    printk("clip.xmin = %d, clip.xmax = %d. clip.ymin = %d, clip.ymax = %d\n",\r
 +        req->clip.xmin, req->clip.xmax, req->clip.ymin, req->clip.ymax);\r
 +\r
 +    printk("mmu_flag = %.8x\n", req->mmu_info.mmu_flag);\r
 +\r
 +    //printk("alpha_rop_flag = %.8x\n", req->alpha_rop_flag);\r
 +    //printk("alpha_rop_mode = %.8x\n", req->alpha_rop_mode);\r
 +    //printk("PD_mode = %.8x\n", req->PD_mode);\r
 +}\r
 +#endif\r
 +\r
 +\r
 +static inline void rga_write(u32 b, u32 r)\r
 +{\r
 +      __raw_writel(b, drvdata->rga_base + r);\r
 +}\r
 +\r
 +static inline u32 rga_read(u32 r)\r
 +{\r
 +      return __raw_readl(drvdata->rga_base + r);\r
 +}\r
 +\r
 +static void rga_soft_reset(void)\r
 +{\r
 +      u32 i;\r
 +      u32 reg;\r
 +\r
 +      rga_write(1, RGA_SYS_CTRL); //RGA_SYS_CTRL\r
 +\r
 +      for(i = 0; i < RGA_RESET_TIMEOUT; i++)\r
 +      {\r
 +              reg = rga_read(RGA_SYS_CTRL) & 1; //RGA_SYS_CTRL\r
 +\r
 +              if(reg == 0)\r
 +                      break;\r
 +\r
 +              udelay(1);\r
 +      }\r
 +\r
 +      if(i == RGA_RESET_TIMEOUT)\r
 +              ERR("soft reset timeout.\n");\r
 +}\r
 +\r
 +static void rga_dump(void)\r
 +{\r
 +      int running;\r
 +    struct rga_reg *reg, *reg_tmp;\r
 +    rga_session *session, *session_tmp;\r
 +\r
 +      running = atomic_read(&rga_service.total_running);\r
 +      printk("rga total_running %d\n", running);\r
 +\r
 +    #if 0\r
 +\r
 +    /* Dump waiting list info */\r
 +    if (!list_empty(&rga_service.waiting))\r
 +    {\r
 +        list_head     *next;\r
 +\r
 +        next = &rga_service.waiting;\r
 +\r
 +        printk("rga_service dump waiting list\n");\r
 +\r
 +        do\r
 +        {\r
 +            reg = list_entry(next->next, struct rga_reg, status_link);\r
 +            running = atomic_read(&reg->session->task_running);\r
 +            num_done = atomic_read(&reg->session->num_done);\r
 +            printk("rga session pid %d, done %d, running %d\n", reg->session->pid, num_done, running);\r
 +            next = next->next;\r
 +        }\r
 +        while(!list_empty(next));\r
 +    }\r
 +\r
 +    /* Dump running list info */\r
 +    if (!list_empty(&rga_service.running))\r
 +    {\r
 +        printk("rga_service dump running list\n");\r
 +\r
 +        list_head     *next;\r
 +\r
 +        next = &rga_service.running;\r
 +        do\r
 +        {\r
 +            reg = list_entry(next->next, struct rga_reg, status_link);\r
 +            running = atomic_read(&reg->session->task_running);\r
 +            num_done = atomic_read(&reg->session->num_done);\r
 +            printk("rga session pid %d, done %d, running %d:\n", reg->session->pid, num_done, running);\r
 +            next = next->next;\r
 +        }\r
 +        while(!list_empty(next));\r
 +    }\r
 +    #endif\r
 +\r
 +      list_for_each_entry_safe(session, session_tmp, &rga_service.session, list_session)\r
 +    {\r
 +              printk("session pid %d:\n", session->pid);\r
 +              running = atomic_read(&session->task_running);\r
 +              printk("task_running %d\n", running);\r
 +              list_for_each_entry_safe(reg, reg_tmp, &session->waiting, session_link)\r
 +        {\r
 +                      printk("waiting register set 0x%.lu\n", (unsigned long)reg);\r
 +              }\r
 +              list_for_each_entry_safe(reg, reg_tmp, &session->running, session_link)\r
 +        {\r
 +                      printk("running register set 0x%.lu\n", (unsigned long)reg);\r
 +              }\r
 +      }\r
 +}\r
 +\r
 +static inline void rga_queue_power_off_work(void)\r
 +{\r
 +      queue_delayed_work(system_nrt_wq, &drvdata->power_off_work, RGA_POWER_OFF_DELAY);\r
 +}\r
 +\r
 +/* Caller must hold rga_service.lock */\r
 +static void rga_power_on(void)\r
 +{\r
 +      static ktime_t last;\r
 +      ktime_t now = ktime_get();\r
 +\r
 +      if (ktime_to_ns(ktime_sub(now, last)) > NSEC_PER_SEC) {\r
 +              cancel_delayed_work_sync(&drvdata->power_off_work);\r
 +              rga_queue_power_off_work();\r
 +              last = now;\r
 +      }\r
 +      if (rga_service.enable)\r
 +              return;\r
 +\r
 +      clk_prepare_enable(drvdata->aclk_rga);\r
 +      clk_prepare_enable(drvdata->hclk_rga);\r
 +      //clk_prepare_enable(drvdata->pd_rga);\r
 +      wake_lock(&drvdata->wake_lock);\r
 +      rga_service.enable = true;\r
 +}\r
 +\r
 +/* Caller must hold rga_service.lock */\r
 +static void rga_power_off(void)\r
 +{\r
 +      int total_running;\r
 +\r
 +      if (!rga_service.enable) {\r
 +              return;\r
 +      }\r
 +\r
 +      total_running = atomic_read(&rga_service.total_running);\r
 +      if (total_running) {\r
 +              pr_err("power off when %d task running!!\n", total_running);\r
 +              mdelay(50);\r
 +              pr_err("delay 50 ms for running task\n");\r
 +              rga_dump();\r
 +      }\r
 +\r
 +      //clk_disable_unprepare(drvdata->pd_rga);\r
 +      clk_disable_unprepare(drvdata->aclk_rga);\r
 +      clk_disable_unprepare(drvdata->hclk_rga);\r
 +      wake_unlock(&drvdata->wake_lock);\r
 +      rga_service.enable = false;\r
 +}\r
 +\r
 +static void rga_power_off_work(struct work_struct *work)\r
 +{\r
 +      if (mutex_trylock(&rga_service.lock)) {\r
 +              rga_power_off();\r
 +              mutex_unlock(&rga_service.lock);\r
 +      } else {\r
 +              /* Come back later if the device is busy... */\r
  
 -        next = &rga_service.waiting;
 -
 -        printk("rga_service dump waiting list\n");
 -
 -        do
 -        {
 -            reg = list_entry(next->next, struct rga_reg, status_link);
 -            running = atomic_read(&reg->session->task_running);
 -            num_done = atomic_read(&reg->session->num_done);
 -            printk("rga session pid %d, done %d, running %d\n", reg->session->pid, num_done, running);
 -            next = next->next;
 -        }
 -        while(!list_empty(next));
 -    }
 -
 -    /* Dump running list info */
 -    if (!list_empty(&rga_service.running))
 -    {
 -        printk("rga_service dump running list\n");
 -
 -        list_head     *next;
 -
 -        next = &rga_service.running;
 -        do
 -        {
 -            reg = list_entry(next->next, struct rga_reg, status_link);
 -            running = atomic_read(&reg->session->task_running);
 -            num_done = atomic_read(&reg->session->num_done);
 -            printk("rga session pid %d, done %d, running %d:\n", reg->session->pid, num_done, running);
 -            next = next->next;
 -        }
 -        while(!list_empty(next));
 -    }
 -    #endif
 -
 -      list_for_each_entry_safe(session, session_tmp, &rga_service.session, list_session)
 -    {
 -              printk("session pid %d:\n", session->pid);
 -              running = atomic_read(&session->task_running);
 -              printk("task_running %d\n", running);
 -              list_for_each_entry_safe(reg, reg_tmp, &session->waiting, session_link)
 -        {
 -                      printk("waiting register set 0x%.8x\n", (unsigned int)reg);
 -              }
 -              list_for_each_entry_safe(reg, reg_tmp, &session->running, session_link)
 -        {
 -                      printk("running register set 0x%.8x\n", (unsigned int)reg);
 -              }
 -      }
 -}
 -
 -static inline void rga_queue_power_off_work(void)
 -{
 -      queue_delayed_work(system_nrt_wq, &drvdata->power_off_work, RGA_POWER_OFF_DELAY);
 -}
 -
 -/* Caller must hold rga_service.lock */
 -static void rga_power_on(void)
 -{
 -      static ktime_t last;
 -      ktime_t now = ktime_get();
 -
 -      if (ktime_to_ns(ktime_sub(now, last)) > NSEC_PER_SEC) {
 -              cancel_delayed_work_sync(&drvdata->power_off_work);
 -              rga_queue_power_off_work();
 -              last = now;
 -      }
 -      if (rga_service.enable)
 -              return;
 -
 -      clk_prepare_enable(drvdata->aclk_rga);
 -      clk_prepare_enable(drvdata->hclk_rga);
 -      //clk_prepare_enable(drvdata->pd_rga);
 -      wake_lock(&drvdata->wake_lock);
 -      rga_service.enable = true;
 -}
 -
 -/* Caller must hold rga_service.lock */
 -static void rga_power_off(void)
 -{
 -      int total_running;
 -
 -      if (!rga_service.enable) {
 -              return;
 -      }
 -
 -      total_running = atomic_read(&rga_service.total_running);
 -      if (total_running) {
 -              pr_err("power off when %d task running!!\n", total_running);
 -              mdelay(50);
 -              pr_err("delay 50 ms for running task\n");
 -              rga_dump();
 -      }
 -
 -      //clk_disable_unprepare(drvdata->pd_rga);
 -      clk_disable_unprepare(drvdata->aclk_rga);
 -      clk_disable_unprepare(drvdata->hclk_rga);
 -      wake_unlock(&drvdata->wake_lock);
 -      rga_service.enable = false;
 -}
 -
 -static void rga_power_off_work(struct work_struct *work)
 -{
 -      if (mutex_trylock(&rga_service.lock)) {
 -              rga_power_off();
 -              mutex_unlock(&rga_service.lock);
 -      } else {
 -              /* Come back later if the device is busy... */
                rga_queue_power_off_work();
        }
  }
@@@ -450,9 -449,12 +450,9 @@@ static void rga_copy_reg(struct rga_re
      cmd_buf = (uint32_t *)rga_service.cmd_buff + offset*32;
      reg_p = (uint32_t *)reg->cmd_reg;
  
 -    for(i=0; i<32; i++)
 -    {
 +    for(i=0; i<32; i++)\r
          cmd_buf[i] = reg_p[i];
 -    }
 -
 -    dsb();
 +\r
  }
  
  
@@@ -633,15 -635,11 +633,15 @@@ static void rga_try_set_reg(void
  
              rga_copy_reg(reg, 0);
              rga_reg_from_wait_to_run(reg);
 -
 +\r
 +            #ifdef CONFIG_ARM\r
              dmac_flush_range(&rga_service.cmd_buff[0], &rga_service.cmd_buff[28]);
 -            outer_flush_range(virt_to_phys(&rga_service.cmd_buff[0]),virt_to_phys(&rga_service.cmd_buff[28]));
 +            outer_flush_range(virt_to_phys(&rga_service.cmd_buff[0]),virt_to_phys(&rga_service.cmd_buff[28]));\r
 +            #elif defined(CONFIG_ARM64)\r
 +            __dma_flush_range(&rga_service.cmd_buff[0], &rga_service.cmd_buff[28]);\r
 +            #endif\r
  
-             #if defined(CONFIG_ARCH_RK30)
+             #if 
              rga_soft_reset();
              #endif
  
@@@ -818,7 -816,7 +818,7 @@@ static int rga_convert_dma_buf(struct r
  
      req->sg_src  = NULL;
      req->sg_dst  = NULL;
 -    
 +\r
          src_offset = req->line_draw_info.flag;
          dst_offset = req->line_draw_info.line_width;
  
@@@ -1284,321 -1282,317 +1284,321 @@@ static int rga_drv_probe(struct platfor
        } else {
                dev_info(&pdev->dev, "rga ion client create success!\n");
        }
 -    #endif
 -
 -      ret = misc_register(&rga_dev);
 -      if(ret)
 -      {
 -              ERR("cannot register miscdev (%d)\n", ret);
 -              goto err_misc_register;
 -      }
 -
 -      pr_info("Driver loaded succesfully\n");
 -
 -      return 0;
 -
 -err_misc_register:
 -      free_irq(data->irq, pdev);
 -err_irq:
 -      iounmap(data->rga_base);
 -err_ioremap:
 -      wake_lock_destroy(&data->wake_lock);
 -      //kfree(data);
 -
 -      return ret;
 -}
 -
 -static int rga_drv_remove(struct platform_device *pdev)
 -{
 -      struct rga_drvdata *data = platform_get_drvdata(pdev);
 -      DBG("%s [%d]\n",__FUNCTION__,__LINE__);
 -
 -      wake_lock_destroy(&data->wake_lock);
 -      misc_deregister(&(data->miscdev));
 -      free_irq(data->irq, &data->miscdev);
 -      iounmap((void __iomem *)(data->rga_base));
 -
 -      //clk_put(data->pd_rga);
 -      devm_clk_put(&pdev->dev, data->aclk_rga);
 -      devm_clk_put(&pdev->dev, data->hclk_rga);
 -
 -      //kfree(data);
 -      return 0;
 -}
 -
 -static struct platform_driver rga_driver = {
 -      .probe          = rga_drv_probe,
 -      .remove         = rga_drv_remove,
 -      .driver         = {
 -              .owner  = THIS_MODULE,
 -              .name   = "rga",
 -              .of_match_table = of_match_ptr(rockchip_rga_dt_ids),
 -      },
 -};
 -
 -
 -void rga_test_0(void);
 -void rga_test_1(void);
 -
 -
 -static int __init rga_init(void)
 -{
 -      int ret;
 -    uint32_t *mmu_buf;
 -    uint32_t i;
 -    uint32_t *buf_p;
 -
 -    /* malloc pre scale mid buf mmu table */
 -    mmu_buf = kzalloc(1024*8, GFP_KERNEL);
 -    if(mmu_buf == NULL) {
 -        printk(KERN_ERR "RGA get Pre Scale buff failed. \n");
 -        return -1;
 -    }
 -
 -    /* malloc 4 M buf */
 -    for(i=0; i<1024; i++) {
 -        buf_p = (uint32_t *)__get_free_page(GFP_KERNEL|__GFP_ZERO);
 -        if(buf_p == NULL) {
 -            printk(KERN_ERR "RGA init pre scale buf falied\n");
 -            return -ENOMEM;
 -        }
 -        mmu_buf[i] = virt_to_phys((void *)((uint32_t)buf_p));
 -    }
 -
 -    rga_service.pre_scale_buf = (uint32_t *)mmu_buf;
 -
 -    buf_p = kmalloc(1024*256, GFP_KERNEL);
 -    rga_mmu_buf.buf_virtual = buf_p;
 -    rga_mmu_buf.buf = (uint32_t *)virt_to_phys((void *)((uint32_t)buf_p));
 -    rga_mmu_buf.front = 0;
 -    rga_mmu_buf.back = 64*1024;
 -    rga_mmu_buf.size = 64*1024;
 -
 -    rga_mmu_buf.pages = kmalloc((32768)* sizeof(struct page *), GFP_KERNEL);
 -
 -      if ((ret = platform_driver_register(&rga_driver)) != 0)
 -      {
 -        printk(KERN_ERR "Platform device register failed (%d).\n", ret);
 -                      return ret;
 -      }
 -
 -    {
 -        rga_session_global.pid = 0x0000ffff;
 -        INIT_LIST_HEAD(&rga_session_global.waiting);
 -        INIT_LIST_HEAD(&rga_session_global.running);
 -        INIT_LIST_HEAD(&rga_session_global.list_session);
 -
 -        INIT_LIST_HEAD(&rga_service.waiting);
 -          INIT_LIST_HEAD(&rga_service.running);
 -          INIT_LIST_HEAD(&rga_service.done);
 -          INIT_LIST_HEAD(&rga_service.session);
 -
 -        init_waitqueue_head(&rga_session_global.wait);
 -        //mutex_lock(&rga_service.lock);
 -        list_add_tail(&rga_session_global.list_session, &rga_service.session);
 -        //mutex_unlock(&rga_service.lock);
 -        atomic_set(&rga_session_global.task_running, 0);
 -        atomic_set(&rga_session_global.num_done, 0);
 -    }
 -
 -
 -
 -    #if RGA_TEST_CASE
 -    rga_test_0();
 -    #endif
 -
 -      INFO("Module initialized.\n");
 -
 -      return 0;
 -}
 -
 -static void __exit rga_exit(void)
 -{
 -    uint32_t i;
 -
 -    rga_power_off();
 -
 -    for(i=0; i<1024; i++)
 -    {
 -        if((uint32_t *)rga_service.pre_scale_buf[i] != NULL)
 -        {
 -            __free_page((void *)rga_service.pre_scale_buf[i]);
 -        }
 -    }
 -
 -    if(rga_service.pre_scale_buf != NULL) {
 -        kfree((uint8_t *)rga_service.pre_scale_buf);
 -    }
 -
 -    if (rga_mmu_buf.buf_virtual)
 -        kfree(rga_mmu_buf.buf_virtual);
 -
 -    if (rga_mmu_buf.pages)
 -        kfree(rga_mmu_buf.pages);
 -
 -      platform_driver_unregister(&rga_driver);
 -}
 -
 -
 -#if RGA_TEST_CASE
 -
 -extern struct fb_info * rk_get_fb(int fb_id);
 -EXPORT_SYMBOL(rk_get_fb);
 -
 -extern void rk_direct_fb_show(struct fb_info * fbi);
 -EXPORT_SYMBOL(rk_direct_fb_show);
 -
 -unsigned int src_buf[1920*1080];
 -unsigned int dst_buf[1920*1080];
 -//unsigned int tmp_buf[1920*1080 * 2];
 -
 -void rga_test_0(void)
 -{
 -    struct rga_req req;
 -    rga_session session;
 -    unsigned int *src, *dst;
 -    uint32_t i, j;
 -    uint8_t *p;
 -    uint8_t t;
 -    uint32_t *dst0, *dst1, *dst2;
 -
 -    struct fb_info *fb;
 -
 -    session.pid       = current->pid;
 -      INIT_LIST_HEAD(&session.waiting);
 -      INIT_LIST_HEAD(&session.running);
 -      INIT_LIST_HEAD(&session.list_session);
 -      init_waitqueue_head(&session.wait);
 -      /* no need to protect */
 -      list_add_tail(&session.list_session, &rga_service.session);
 -      atomic_set(&session.task_running, 0);
 -    atomic_set(&session.num_done, 0);
 -      //file->private_data = (void *)session;
 -
 -    fb = rk_get_fb(0);
 -
 -    memset(&req, 0, sizeof(struct rga_req));
 -    src = src_buf;
 -    dst = dst_buf;
 -
 -    memset(src_buf, 0x80, 1024*600*4);
 -
 -    dmac_flush_range(&src_buf[0], &src_buf[1024*600]);
 -    outer_flush_range(virt_to_phys(&src_buf[0]),virt_to_phys(&src_buf[1024*600]));
 -
 -
 -    #if 0
 -    memset(src_buf, 0x80, 800*480*4);
 -    memset(dst_buf, 0xcc, 800*480*4);
 -
 -    dmac_flush_range(&dst_buf[0], &dst_buf[800*480]);
 -    outer_flush_range(virt_to_phys(&dst_buf[0]),virt_to_phys(&dst_buf[800*480]));
 -    #endif
 -
 -    dst0 = &dst_buf[0];
 -    //dst1 = &dst_buf[1280*800*4];
 -    //dst2 = &dst_buf[1280*800*4*2];
 -
 -    i = j = 0;
 -
 -    printk("\n********************************\n");
 -    printk("************ RGA_TEST ************\n");
 -    printk("********************************\n\n");
 -
 -    req.src.act_w = 1024;
 -    req.src.act_h = 600;
 -
 -    req.src.vir_w = 1024;
 -    req.src.vir_h = 600;
 -    req.src.yrgb_addr = (uint32_t)virt_to_phys(src);
 -    req.src.uv_addr = (uint32_t)(req.src.yrgb_addr + 1080*1920);
 -    req.src.v_addr = (uint32_t)virt_to_phys(src);
 -    req.src.format = RK_FORMAT_RGBA_8888;
 -
 -    req.dst.act_w = 600;
 -    req.dst.act_h = 352;
 -
 -    req.dst.vir_w = 1280;
 -    req.dst.vir_h = 800;
 -    req.dst.x_offset = 600;
 -    req.dst.y_offset = 0;
 -
 -    dst = dst0;
 -
 -    req.dst.yrgb_addr = ((uint32_t)virt_to_phys(dst));
 -
 -    //req.dst.format = RK_FORMAT_RGB_565;
 -
 -    req.clip.xmin = 0;
 -    req.clip.xmax = 1279;
 -    req.clip.ymin = 0;
 -    req.clip.ymax = 799;
 -
 -    //req.render_mode = color_fill_mode;
 -    //req.fg_color = 0x80ffffff;
 -
 -    req.rotate_mode = 1;
 -    //req.scale_mode = 2;
 -
 -    //req.alpha_rop_flag = 0;
 -    //req.alpha_rop_mode = 0x19;
 -    //req.PD_mode = 3;
 -
 -    req.sina = 65536;
 -    req.cosa = 0;
 -
 -    //req.mmu_info.mmu_flag = 0x21;
 -    //req.mmu_info.mmu_en = 1;
 -
 -    //printk("src = %.8x\n", req.src.yrgb_addr);
 -    //printk("src = %.8x\n", req.src.uv_addr);
 -    //printk("dst = %.8x\n", req.dst.yrgb_addr);
 -
 -
 -    rga_blit_sync(&session, &req);
 -
 -    #if 1
 -    fb->var.bits_per_pixel = 32;
 -
 -    fb->var.xres = 1280;
 -    fb->var.yres = 800;
 -
 -    fb->var.red.length = 8;
 -    fb->var.red.offset = 0;
 -    fb->var.red.msb_right = 0;
 -
 -    fb->var.green.length = 8;
 -    fb->var.green.offset = 8;
 -    fb->var.green.msb_right = 0;
 -
 -    fb->var.blue.length = 8;
 -
 -    fb->var.blue.offset = 16;
 -    fb->var.blue.msb_right = 0;
 -
 -    fb->var.transp.length = 8;
 -    fb->var.transp.offset = 24;
 -    fb->var.transp.msb_right = 0;
 -
 -    fb->var.nonstd &= (~0xff);
 -    fb->var.nonstd |= 1;
 -
 -    fb->fix.smem_start = virt_to_phys(dst);
 -
 -    rk_direct_fb_show(fb);
 -    #endif
 -
 -}
 -
 -#endif
 -module_init(rga_init);
 -module_exit(rga_exit);
 -
 -/* Module information */
 -MODULE_AUTHOR("zsq@rock-chips.com");
 -MODULE_DESCRIPTION("Driver for rga device");
 -MODULE_LICENSE("GPL");
 +    #endif\r
 +\r
 +      ret = misc_register(&rga_dev);\r
 +      if(ret)\r
 +      {\r
 +              ERR("cannot register miscdev (%d)\n", ret);\r
 +              goto err_misc_register;\r
 +      }\r
 +\r
 +      pr_info("Driver loaded succesfully\n");\r
 +\r
 +      return 0;\r
 +\r
 +err_misc_register:\r
 +      free_irq(data->irq, pdev);\r
 +err_irq:\r
 +      iounmap(data->rga_base);\r
 +err_ioremap:\r
 +      wake_lock_destroy(&data->wake_lock);\r
 +      //kfree(data);\r
 +\r
 +      return ret;\r
 +}\r
 +\r
 +static int rga_drv_remove(struct platform_device *pdev)\r
 +{\r
 +      struct rga_drvdata *data = platform_get_drvdata(pdev);\r
 +      DBG("%s [%d]\n",__FUNCTION__,__LINE__);\r
 +\r
 +      wake_lock_destroy(&data->wake_lock);\r
 +      misc_deregister(&(data->miscdev));\r
 +      free_irq(data->irq, &data->miscdev);\r
 +      iounmap((void __iomem *)(data->rga_base));\r
 +\r
 +      //clk_put(data->pd_rga);\r
 +      devm_clk_put(&pdev->dev, data->aclk_rga);\r
 +      devm_clk_put(&pdev->dev, data->hclk_rga);\r
 +\r
 +      //kfree(data);\r
 +      return 0;\r
 +}\r
 +\r
 +static struct platform_driver rga_driver = {\r
 +      .probe          = rga_drv_probe,\r
 +      .remove         = rga_drv_remove,\r
 +      .driver         = {\r
 +              .owner  = THIS_MODULE,\r
 +              .name   = "rga",\r
 +              .of_match_table = of_match_ptr(rockchip_rga_dt_ids),\r
 +      },\r
 +};\r
 +\r
 +\r
 +void rga_test_0(void);\r
 +void rga_test_1(void);\r
 +\r
 +\r
 +static int __init rga_init(void)\r
 +{\r
 +      int ret;\r
 +    uint32_t *mmu_buf;\r
 +    unsigned long *mmu_buf_virtual;\r
 +    uint32_t i;\r
 +    uint32_t *buf_p;\r
 +\r
 +    /* malloc pre scale mid buf mmu table */\r
 +    mmu_buf = kzalloc(1024*8, GFP_KERNEL);\r
 +    mmu_buf_virtual = kzalloc(1024*2*sizeof(unsigned long), GFP_KERNEL);\r
 +    if(mmu_buf == NULL) {\r
 +        printk(KERN_ERR "RGA get Pre Scale buff failed. \n");\r
 +        return -1;\r
 +    }\r
 +\r
 +    /* malloc 4 M buf */\r
 +    for(i=0; i<1024; i++) {\r
 +        buf_p = (uint32_t *)__get_free_page(GFP_KERNEL|__GFP_ZERO);\r
 +        if(buf_p == NULL) {\r
 +            printk(KERN_ERR "RGA init pre scale buf falied\n");\r
 +            return -ENOMEM;\r
 +        }\r
 +        mmu_buf[i] = virt_to_phys((void *)((unsigned long)buf_p));\r
 +        mmu_buf_virtual[i] = (unsigned long)buf_p;\r
 +    }\r
 +\r
 +    rga_service.pre_scale_buf = (uint32_t *)mmu_buf;\r
 +    rga_service.pre_scale_buf_virtual = (unsigned long *)mmu_buf_virtual;\r
 +\r
 +    buf_p = kmalloc(1024*256, GFP_KERNEL);\r
 +    rga_mmu_buf.buf_virtual = buf_p;\r
 +    rga_mmu_buf.buf = (uint32_t *)virt_to_phys((void *)((unsigned long)buf_p));\r
 +    rga_mmu_buf.front = 0;\r
 +    rga_mmu_buf.back = 64*1024;\r
 +    rga_mmu_buf.size = 64*1024;\r
 +\r
 +    rga_mmu_buf.pages = kmalloc((32768)* sizeof(struct page *), GFP_KERNEL);\r
 +\r
 +      if ((ret = platform_driver_register(&rga_driver)) != 0)\r
 +      {\r
 +        printk(KERN_ERR "Platform device register failed (%d).\n", ret);\r
 +                      return ret;\r
 +      }\r
 +\r
 +    {\r
 +        rga_session_global.pid = 0x0000ffff;\r
 +        INIT_LIST_HEAD(&rga_session_global.waiting);\r
 +        INIT_LIST_HEAD(&rga_session_global.running);\r
 +        INIT_LIST_HEAD(&rga_session_global.list_session);\r
 +\r
 +        INIT_LIST_HEAD(&rga_service.waiting);\r
 +          INIT_LIST_HEAD(&rga_service.running);\r
 +          INIT_LIST_HEAD(&rga_service.done);\r
 +          INIT_LIST_HEAD(&rga_service.session);\r
 +\r
 +        init_waitqueue_head(&rga_session_global.wait);\r
 +        //mutex_lock(&rga_service.lock);\r
 +        list_add_tail(&rga_session_global.list_session, &rga_service.session);\r
 +        //mutex_unlock(&rga_service.lock);\r
 +        atomic_set(&rga_session_global.task_running, 0);\r
 +        atomic_set(&rga_session_global.num_done, 0);\r
 +    }\r
 +\r
 +\r
 +\r
 +    #if RGA_TEST_CASE\r
 +    rga_test_0();\r
 +    #endif\r
 +\r
 +      INFO("Module initialized.\n");\r
 +\r
 +      return 0;\r
 +}\r
 +\r
 +static void __exit rga_exit(void)\r
 +{\r
 +    uint32_t i;\r
 +\r
 +    rga_power_off();\r
 +\r
 +    for(i=0; i<1024; i++)\r
 +    {\r
 +        if((unsigned long)rga_service.pre_scale_buf_virtual[i])\r
 +        {\r
 +            __free_page((void *)rga_service.pre_scale_buf_virtual[i]);\r
 +        }\r
 +    }\r
 +\r
 +    if(rga_service.pre_scale_buf != NULL) {\r
 +        kfree((uint8_t *)rga_service.pre_scale_buf);\r
 +    }\r
 +\r
 +    if (rga_mmu_buf.buf_virtual)\r
 +        kfree(rga_mmu_buf.buf_virtual);\r
 +\r
 +    if (rga_mmu_buf.pages)\r
 +        kfree(rga_mmu_buf.pages);\r
 +\r
 +      platform_driver_unregister(&rga_driver);\r
 +}\r
 +\r
 +\r
 +#if RGA_TEST_CASE\r
 +\r
 +extern struct fb_info * rk_get_fb(int fb_id);\r
 +EXPORT_SYMBOL(rk_get_fb);\r
 +\r
 +extern void rk_direct_fb_show(struct fb_info * fbi);\r
 +EXPORT_SYMBOL(rk_direct_fb_show);\r
 +\r
 +unsigned int src_buf[1920*1080];\r
 +unsigned int dst_buf[1920*1080];\r
 +//unsigned int tmp_buf[1920*1080 * 2];\r
 +\r
 +void rga_test_0(void)\r
 +{\r
 +    struct rga_req req;\r
 +    rga_session session;\r
 +    unsigned int *src, *dst;\r
 +    uint32_t i, j;\r
 +    uint8_t *p;\r
 +    uint8_t t;\r
 +    uint32_t *dst0, *dst1, *dst2;\r
 +\r
 +    struct fb_info *fb;\r
 +\r
 +    session.pid       = current->pid;\r
 +      INIT_LIST_HEAD(&session.waiting);\r
 +      INIT_LIST_HEAD(&session.running);\r
 +      INIT_LIST_HEAD(&session.list_session);\r
 +      init_waitqueue_head(&session.wait);\r
 +      /* no need to protect */\r
 +      list_add_tail(&session.list_session, &rga_service.session);\r
 +      atomic_set(&session.task_running, 0);\r
 +    atomic_set(&session.num_done, 0);\r
 +      //file->private_data = (void *)session;\r
 +\r
 +    fb = rk_get_fb(0);\r
 +\r
 +    memset(&req, 0, sizeof(struct rga_req));\r
 +    src = src_buf;\r
 +    dst = dst_buf;\r
 +\r
 +    memset(src_buf, 0x80, 1024*600*4);\r
 +\r
 +    dmac_flush_range(&src_buf[0], &src_buf[1024*600]);\r
 +    outer_flush_range(virt_to_phys(&src_buf[0]),virt_to_phys(&src_buf[1024*600]));\r
 +\r
 +\r
 +    #if 0\r
 +    memset(src_buf, 0x80, 800*480*4);\r
 +    memset(dst_buf, 0xcc, 800*480*4);\r
 +\r
 +    dmac_flush_range(&dst_buf[0], &dst_buf[800*480]);\r
 +    outer_flush_range(virt_to_phys(&dst_buf[0]),virt_to_phys(&dst_buf[800*480]));\r
 +    #endif\r
 +\r
 +    dst0 = &dst_buf[0];\r
 +    //dst1 = &dst_buf[1280*800*4];\r
 +    //dst2 = &dst_buf[1280*800*4*2];\r
 +\r
 +    i = j = 0;\r
 +\r
 +    printk("\n********************************\n");\r
 +    printk("************ RGA_TEST ************\n");\r
 +    printk("********************************\n\n");\r
 +\r
 +    req.src.act_w = 1024;\r
 +    req.src.act_h = 600;\r
 +\r
 +    req.src.vir_w = 1024;\r
 +    req.src.vir_h = 600;\r
 +    req.src.yrgb_addr = (uint32_t)virt_to_phys(src);\r
 +    req.src.uv_addr = (uint32_t)(req.src.yrgb_addr + 1080*1920);\r
 +    req.src.v_addr = (uint32_t)virt_to_phys(src);\r
 +    req.src.format = RK_FORMAT_RGBA_8888;\r
 +\r
 +    req.dst.act_w = 600;\r
 +    req.dst.act_h = 352;\r
 +\r
 +    req.dst.vir_w = 1280;\r
 +    req.dst.vir_h = 800;\r
 +    req.dst.x_offset = 600;\r
 +    req.dst.y_offset = 0;\r
 +\r
 +    dst = dst0;\r
 +\r
 +    req.dst.yrgb_addr = ((uint32_t)virt_to_phys(dst));\r
 +\r
 +    //req.dst.format = RK_FORMAT_RGB_565;\r
 +\r
 +    req.clip.xmin = 0;\r
 +    req.clip.xmax = 1279;\r
 +    req.clip.ymin = 0;\r
 +    req.clip.ymax = 799;\r
 +\r
 +    //req.render_mode = color_fill_mode;\r
 +    //req.fg_color = 0x80ffffff;\r
 +\r
 +    req.rotate_mode = 1;\r
 +    //req.scale_mode = 2;\r
 +\r
 +    //req.alpha_rop_flag = 0;\r
 +    //req.alpha_rop_mode = 0x19;\r
 +    //req.PD_mode = 3;\r
 +\r
 +    req.sina = 65536;\r
 +    req.cosa = 0;\r
 +\r
 +    //req.mmu_info.mmu_flag = 0x21;\r
 +    //req.mmu_info.mmu_en = 1;\r
 +\r
 +    //printk("src = %.8x\n", req.src.yrgb_addr);\r
 +    //printk("src = %.8x\n", req.src.uv_addr);\r
 +    //printk("dst = %.8x\n", req.dst.yrgb_addr);\r
 +\r
 +\r
 +    rga_blit_sync(&session, &req);\r
 +\r
 +    #if 1\r
 +    fb->var.bits_per_pixel = 32;\r
 +\r
 +    fb->var.xres = 1280;\r
 +    fb->var.yres = 800;\r
 +\r
 +    fb->var.red.length = 8;\r
 +    fb->var.red.offset = 0;\r
 +    fb->var.red.msb_right = 0;\r
 +\r
 +    fb->var.green.length = 8;\r
 +    fb->var.green.offset = 8;\r
 +    fb->var.green.msb_right = 0;\r
 +\r
 +    fb->var.blue.length = 8;\r
 +\r
 +    fb->var.blue.offset = 16;\r
 +    fb->var.blue.msb_right = 0;\r
 +\r
 +    fb->var.transp.length = 8;\r
 +    fb->var.transp.offset = 24;\r
 +    fb->var.transp.msb_right = 0;\r
 +\r
 +    fb->var.nonstd &= (~0xff);\r
 +    fb->var.nonstd |= 1;\r
 +\r
 +    fb->fix.smem_start = virt_to_phys(dst);\r
 +\r
 +    rk_direct_fb_show(fb);\r
 +    #endif\r
 +\r
 +}\r
 +\r
 +#endif\r
 +module_init(rga_init);\r
 +module_exit(rga_exit);\r
 +\r
 +/* Module information */\r
 +MODULE_AUTHOR("zsq@rock-chips.com");\r
 +MODULE_DESCRIPTION("Driver for rga device");\r
 +MODULE_LICENSE("GPL");\r