Radix cross Linux

Radix Linux distribution for embedded systems.

637 Commits   4 Branches   3 Tags
author: Andrey V.Kosteltsev <kx@radix.pro> 2016-11-16 08:49:52 +0000 committer: Andrey V.Kosteltsev <kx@radix.pro> 2016-11-16 08:49:52 +0000 commit: 661ac22a3347c79b573e9d12f8295104d8d5af14 parent: de01e599766515309d8233491cbde1033593592a
Commit Summary:
Amlogic s805: kernel, aml-libs, patches for xf86-video-mali
Diffstat:
40 files changed, 10929 insertions, 47 deletions
diff --git a/X11/app/WindowMaker/0.95.7/xinit/xinitrc.wmaker b/X11/app/WindowMaker/0.95.7/xinit/xinitrc.wmaker
index 0830ea672..49683dd94 100644
--- a/X11/app/WindowMaker/0.95.7/xinit/xinitrc.wmaker
+++ b/X11/app/WindowMaker/0.95.7/xinit/xinitrc.wmaker
@@ -26,7 +26,7 @@ fi
 
 # start some nice programs
 
-xset -dpms &
+# xset -dpms &
 xset s noblank &
 xset s off &
 
diff --git a/base/radix-system/etc/profile b/base/radix-system/etc/profile
index 345e21f96..24ecd690f 100644
--- a/base/radix-system/etc/profile
+++ b/base/radix-system/etc/profile
@@ -22,7 +22,7 @@ PATH="/usr/local/bin:/usr/bin:/bin:/usr/games"
 if [ "`id -u`" = "0" ]; then
   echo $PATH | grep /usr/local/sbin 1> /dev/null 2> /dev/null
   if [ ! $? = 0 ]; then
-    PATH=/usr/local/sbin:/usr/sbin:/sbin:$PATH
+    PATH=/sbin/pkgtool:/usr/local/sbin:/usr/sbin:/sbin:$PATH
   fi
 fi
 
diff --git a/boot/kernel/s805/3.10.33-20150117/Makefile b/boot/kernel/s805/3.10.33-20160716/Makefile
similarity index 99%
rename from boot/kernel/s805/3.10.33-20150117/Makefile
rename to boot/kernel/s805/3.10.33-20160716/Makefile
index 75aa58640..267a59e1b 100644
--- a/boot/kernel/s805/3.10.33-20150117/Makefile
+++ b/boot/kernel/s805/3.10.33-20160716/Makefile
@@ -17,7 +17,7 @@ REQUIRES           = base/pkgtool
 # ======= __END_OF_REQUIRES__ =======
 
 
-version            = 3.10.33-20150117
+version            = 3.10.33-20160716
 subversion         =
 modules_version    = 3.10.33
 full_version       = $(version)
diff --git a/boot/kernel/s805/3.10.33-20150117/PATCHES b/boot/kernel/s805/3.10.33-20160716/PATCHES
similarity index 64%
rename from boot/kernel/s805/3.10.33-20150117/PATCHES
rename to boot/kernel/s805/3.10.33-20160716/PATCHES
index 9723ba362..dde345d2a 100644
--- a/boot/kernel/s805/3.10.33-20150117/PATCHES
+++ b/boot/kernel/s805/3.10.33-20160716/PATCHES
@@ -1,5 +1,5 @@
 
-../../../../sources/Linux/Amlogic/M201/patches/linux-aml-3.10.33-20150117-headers-install.patch -p0
-../../../../sources/Linux/Amlogic/M201/patches/linux-aml-3.10.33-20150117-gcc5.patch            -p0
-../../../../sources/Linux/Amlogic/M201/patches/linux-aml-3.10.33-20150117-m201-dtbs.patch       -p0
-../../../../sources/Linux/Amlogic/M201/patches/linux-aml-3.10.33-20150117-osd-xrgb.patch        -p0
+../../../../sources/Linux/Amlogic/M201/patches/linux-aml-3.10.33-20160716-headers-install.patch -p0
+../../../../sources/Linux/Amlogic/M201/patches/linux-aml-3.10.33-20160716-gcc5.patch            -p0
+../../../../sources/Linux/Amlogic/M201/patches/linux-aml-3.10.33-20160716-m201-dtbs.patch       -p0
+../../../../sources/Linux/Amlogic/M201/patches/linux-aml-3.10.33-20160716-osd-xrgb.patch        -p0
diff --git a/boot/kernel/s805/3.10.33-20150117/configs/m201.config b/boot/kernel/s805/3.10.33-20160716/configs/m201.config
similarity index 100%
rename from boot/kernel/s805/3.10.33-20150117/configs/m201.config
rename to boot/kernel/s805/3.10.33-20160716/configs/m201.config
diff --git a/boot/kernel/s805/3.10.33-20150117/configs/m201.osd2-cursor.config b/boot/kernel/s805/3.10.33-20160716/configs/m201.osd2-cursor.config
similarity index 100%
rename from boot/kernel/s805/3.10.33-20150117/configs/m201.osd2-cursor.config
rename to boot/kernel/s805/3.10.33-20160716/configs/m201.osd2-cursor.config
diff --git a/boot/kernel/s805/3.10.33-20150117/configs/mxq.config b/boot/kernel/s805/3.10.33-20160716/configs/mxq.config
similarity index 100%
rename from boot/kernel/s805/3.10.33-20150117/configs/mxq.config
rename to boot/kernel/s805/3.10.33-20160716/configs/mxq.config
diff --git a/boot/kernel/s805/3.10.33-20150117/configs/mxq.osd2-cursor.config b/boot/kernel/s805/3.10.33-20160716/configs/mxq.osd2-cursor.config
similarity index 100%
rename from boot/kernel/s805/3.10.33-20150117/configs/mxq.osd2-cursor.config
rename to boot/kernel/s805/3.10.33-20160716/configs/mxq.osd2-cursor.config
diff --git a/boot/kernel/s805/3.10.33-20150117/kernel-pkg-description.in b/boot/kernel/s805/3.10.33-20160716/kernel-pkg-description.in
similarity index 100%
rename from boot/kernel/s805/3.10.33-20150117/kernel-pkg-description.in
rename to boot/kernel/s805/3.10.33-20160716/kernel-pkg-description.in
diff --git a/boot/kernel/s805/3.10.33-20150117/kernel-pkg-install.sh b/boot/kernel/s805/3.10.33-20160716/kernel-pkg-install.sh
similarity index 100%
rename from boot/kernel/s805/3.10.33-20150117/kernel-pkg-install.sh
rename to boot/kernel/s805/3.10.33-20160716/kernel-pkg-install.sh
diff --git a/boot/u-boot/s805/2011.03-20160716/Makefile b/boot/u-boot/s805/2011.03-20160716/Makefile
index 97602b6b4..1b2a51b96 100644
--- a/boot/u-boot/s805/2011.03-20160716/Makefile
+++ b/boot/u-boot/s805/2011.03-20160716/Makefile
@@ -13,7 +13,7 @@ include ../../../../build-system/constants.mk
 SOURCE_REQUIRES   = sources/U-Boot/Amlogic/M201
 
 ifneq ($(filter $(HARDWARE),$(HARDWARE_M201)),)
-REQUIRES          = boot/kernel/s805/3.10.33-20150117
+REQUIRES          = boot/kernel/s805/3.10.33-20160716
 endif
 ifneq ($(filter $(HARDWARE),$(HARDWARE_MXQ)),)
 REQUIRES          = boot/kernel/s805/3.10.103-20160830
diff --git a/dev/kernel-headers/Makefile b/dev/kernel-headers/Makefile
index a5592ee02..323c436b4 100644
--- a/dev/kernel-headers/Makefile
+++ b/dev/kernel-headers/Makefile
@@ -39,7 +39,7 @@ REQUIRES           = dev/kernel/firefly/3.10-20151231-headers
 endif
 
 ifneq ($(filter $(HARDWARE),$(HARDWARE_M201)),)
-REQUIRES           = dev/kernel/s805/3.10.33-20150117-headers
+REQUIRES           = dev/kernel/s805/3.10.33-20160716-headers
 endif
 
 ifneq ($(filter $(HARDWARE),$(HARDWARE_MXQ)),)
diff --git a/dev/kernel/s805/3.10.33-20150117-headers/Makefile b/dev/kernel/s805/3.10.33-20160716-headers/Makefile
similarity index 99%
rename from dev/kernel/s805/3.10.33-20150117-headers/Makefile
rename to dev/kernel/s805/3.10.33-20160716-headers/Makefile
index d7df2a366..1da8e5f5a 100644
--- a/dev/kernel/s805/3.10.33-20150117-headers/Makefile
+++ b/dev/kernel/s805/3.10.33-20160716-headers/Makefile
@@ -17,7 +17,7 @@ REQUIRES           = base/pkgtool
 # ======= __END_OF_REQUIRES__ =======
 
 
-version            = 3.10.33-20150117
+version            = 3.10.33-20160716
 modules_version    = 3.10.33
 full_version       = $(version)
 tar_xz_archive     = $(SRC_PACKAGE_PATH)/Linux/Amlogic/M201/linux-aml-$(version).tar.xz
diff --git a/dev/kernel/s805/3.10.33-20150117-headers/PATCHES b/dev/kernel/s805/3.10.33-20160716-headers/PATCHES
similarity index 64%
rename from dev/kernel/s805/3.10.33-20150117-headers/PATCHES
rename to dev/kernel/s805/3.10.33-20160716-headers/PATCHES
index b5a610c78..25ab35ca5 100644
--- a/dev/kernel/s805/3.10.33-20150117-headers/PATCHES
+++ b/dev/kernel/s805/3.10.33-20160716-headers/PATCHES
@@ -1,2 +1,2 @@
 
-../../../../sources/Linux/Amlogic/M201/patches/linux-aml-3.10.33-20150117-headers-install.patch -p0
+../../../../sources/Linux/Amlogic/M201/patches/linux-aml-3.10.33-20160716-headers-install.patch -p0
diff --git a/dev/kernel/s805/3.10.33-20150117-headers/kernel-headers-pkg-description.in b/dev/kernel/s805/3.10.33-20160716-headers/kernel-headers-pkg-description.in
similarity index 100%
rename from dev/kernel/s805/3.10.33-20150117-headers/kernel-headers-pkg-description.in
rename to dev/kernel/s805/3.10.33-20160716-headers/kernel-headers-pkg-description.in
diff --git a/dev/kernel/s805/3.10.33-20150117-headers/kernel-headers-pkg-install.sh b/dev/kernel/s805/3.10.33-20160716-headers/kernel-headers-pkg-install.sh
similarity index 100%
rename from dev/kernel/s805/3.10.33-20150117-headers/kernel-headers-pkg-install.sh
rename to dev/kernel/s805/3.10.33-20160716-headers/kernel-headers-pkg-install.sh
diff --git a/libs/aml-libs/0.4.0/Makefile b/libs/aml-libs/0.4.0/Makefile
new file mode 100644
index 000000000..9e446446b
--- /dev/null
+++ b/libs/aml-libs/0.4.0/Makefile
@@ -0,0 +1,215 @@
+
+COMPONENT_TARGETS  = $(HARDWARE_M201)
+COMPONENT_TARGETS += $(HARDWARE_MXQ)
+
+
+NEED_ABS_PATH      = true
+COMPONENT_IS_3PP   = true
+
+
+include ../../../build-system/constants.mk
+
+
+SOURCE_REQUIRES    = sources/packages/m/amlogic/aml-libs
+
+REQUIRES           = libs/alsa-lib/1.1.1
+
+# ======= __END_OF_REQUIRES__ =======
+
+
+version            = 0.4.0-20160716
+so_version         = $(shell echo $(version) | cut -f1 -d'-')
+so_major_version   = $(shell echo $(version) | cut -f1 -d'.')
+tar_xz_archive     = $(SRC_PACKAGE_PATH)/packages/m/amlogic/aml-libs/aml-libs-$(version).tar.xz
+SRC_ARCHIVE        = $(tar_xz_archive)
+SRC_DIR            = $(TARGET_BUILD_DIR)/aml-libs-$(version)
+doc_dir_name       = aml-libs-$(version)
+src_done           = $(TARGET_BUILD_DIR)/.source_done
+
+PATCHES = PATCHES
+
+build_target       = $(TARGET_BUILD_DIR)/.build_done
+install_target     = $(TARGET_BUILD_DIR)/.install_done
+
+pkgconfig_in       = $(CURDIR)/pkgconfigs/aml-libs.pc.in
+license            = $(CURDIR)/license/COPYING.GPLv2
+
+
+####### Targets
+
+PKG_GROUP = libs
+
+#
+# *PKG_NAME & *PKG_VERSION shouldn't be a reference to value.
+#
+AML_LIBS_PKG_NAME                = aml-libs
+AML_LIBS_PKG_VERSION             = 0.4.0
+AML_LIBS_PKG_ARCH                = $(TOOLCHAIN)
+AML_LIBS_PKG_DISTRO_NAME         = $(DISTRO_NAME)
+AML_LIBS_PKG_DISTRO_VERSION      = $(DISTRO_VERSION)
+AML_LIBS_PKG_GROUP               = $(PKG_GROUP)
+###                               |---handy-ruler-------------------------------|
+AML_LIBS_PKG_SHORT_DESCRIPTION   = Amlogic media player library
+AML_LIBS_PKG_URL                 = $(BUG_URL)
+AML_LIBS_PKG_LICENSE             = GPLv2
+AML_LIBS_PKG_DESCRIPTION_FILE    = $(TARGET_BUILD_DIR)/$(AML_LIBS_PKG_NAME)-pkg-description
+AML_LIBS_PKG_DESCRIPTION_FILE_IN = $(AML_LIBS_PKG_NAME)-pkg-description.in
+AML_LIBS_PKG_INSTALL_SCRIPT      = $(AML_LIBS_PKG_NAME)-pkg-install.sh
+
+AML_LIBS_PKG     = $(CURDIR)/$(TARGET_BUILD_DIR)/$(AML_LIBS_PKG_NAME)-package
+
+pkg_basename     = $(AML_LIBS_PKG_NAME)-$(AML_LIBS_PKG_VERSION)-$(AML_LIBS_PKG_ARCH)-$(AML_LIBS_PKG_DISTRO_NAME)-$(AML_LIBS_PKG_DISTRO_VERSION)
+
+pkg_archive      = $(TARGET_BUILD_DIR)/$(PKG_GROUP)/$(pkg_basename).$(pkg_arch_suffix)
+pkg_signature    = $(call sign-name,$(pkg_archive))
+pkg_description  = $(call desc-name,$(pkg_archive))
+products         = $(call pkg-files,$(pkg_archive))
+
+BUILD_TARGETS    = $(build_target)
+BUILD_TARGETS   += $(install_target)
+
+PRODUCT_TARGETS  = $(products)
+
+ROOTFS_TARGETS   = $(pkg_archive)
+
+
+include ../../../build-system/core.mk
+
+
+env_sysroot = DESTDIR=$(AML_LIBS_PKG)
+
+
+aml_build_environment  = PREFIX=/usr
+aml_build_environment += BIN_DIR=/usr/bin
+aml_build_environment += LIB_DIR=/usr/lib$(LIBSUFFIX)
+aml_build_environment += HEADERS_DIR=/usr/include
+aml_build_environment += FIRMWARE_DIR=/lib/firmware
+
+
+CFLAGS += -Wno-implicit-function-declaration -Wno-int-conversion -Wno-strict-aliasing
+CFLAGS += -Wno-incompatible-pointer-types -Wno-implicit-int -Wno-int-to-pointer-cast -Wno-missing-braces
+CFLAGS += -Wno-discarded-qualifiers -Wno-unused-variable -Wno-pointer-sign -Wno-enum-compare
+CFLAGS += -Wno-switch -Wno-unused-but-set-variable -Wno-unused-function -Wno-attributes
+CFLAGS += -Wno-unknown-pragmas -Wno-unused-label -Wparentheses -Wno-maybe-uninitialized
+
+
+####### Dependencies
+
+$(src_done): $(SRC_ARCHIVE) $(PATCHES_DEP)
+	$(UNPACK_SRC_ARCHIVE)
+	$(APPLY_PATCHES)
+	@touch $@
+
+$(build_target): $(src_done)
+	@( cd $(SRC_DIR) ; \
+	   $(BUILD_ENVIRONMENT) $(MAKE) -C amadec    all $(aml_build_environment) ; \
+	   $(BUILD_ENVIRONMENT) $(MAKE) -C amavutils all $(aml_build_environment) ; \
+	   $(BUILD_ENVIRONMENT) $(MAKE) -C amcodec   all $(aml_build_environment) ; \
+	   $(BUILD_ENVIRONMENT) $(MAKE) -C example   all $(aml_build_environment) ; \
+	 )
+	@( cd $(SRC_DIR)/audio_codec ; \
+	   $(BUILD_ENVIRONMENT) $(MAKE) -C libmad    all $(aml_build_environment) ; \
+	   $(BUILD_ENVIRONMENT) $(MAKE) -C libadpcm  all $(aml_build_environment) ; \
+	   $(BUILD_ENVIRONMENT) $(MAKE) -C libamr    all $(aml_build_environment) ; \
+	   $(BUILD_ENVIRONMENT) $(MAKE) -C libape    all $(aml_build_environment) ; \
+	   $(BUILD_ENVIRONMENT) $(MAKE) -C libcook   all $(aml_build_environment) ; \
+	   $(BUILD_ENVIRONMENT) $(MAKE) -C libfaad   all $(aml_build_environment) ; \
+	   $(BUILD_ENVIRONMENT) $(MAKE) -C libflac   all $(aml_build_environment) ; \
+	   $(BUILD_ENVIRONMENT) $(MAKE) -C liblpcm   all $(aml_build_environment) ; \
+	   $(BUILD_ENVIRONMENT) $(MAKE) -C libraac   all $(aml_build_environment) ; \
+	   $(BUILD_ENVIRONMENT) $(MAKE) -C libpcm    all $(aml_build_environment) ; \
+	 )
+	@touch $@
+
+$(install_target): $(build_target)
+	@mkdir -p $(AML_LIBS_PKG)
+	@( cd $(SRC_DIR) ; \
+	   $(BUILD_ENVIRONMENT) $(MAKE) -j1 -C amadec    install $(aml_build_environment) $(env_sysroot) ; \
+	   $(BUILD_ENVIRONMENT) $(MAKE) -j1 -C amavutils install $(aml_build_environment) $(env_sysroot) ; \
+	   $(BUILD_ENVIRONMENT) $(MAKE) -j1 -C amcodec   install $(aml_build_environment) $(env_sysroot) ; \
+	   $(BUILD_ENVIRONMENT) $(MAKE) -j1 -C example   install $(aml_build_environment) $(env_sysroot) ; \
+	 )
+	@( cd $(SRC_DIR)/audio_codec ; \
+	   $(BUILD_ENVIRONMENT) $(MAKE) -j1 -C libmad    install $(aml_build_environment) $(env_sysroot) ; \
+	   $(BUILD_ENVIRONMENT) $(MAKE) -j1 -C libadpcm  install $(aml_build_environment) $(env_sysroot) ; \
+	   $(BUILD_ENVIRONMENT) $(MAKE) -j1 -C libamr    install $(aml_build_environment) $(env_sysroot) ; \
+	   $(BUILD_ENVIRONMENT) $(MAKE) -j1 -C libape    install $(aml_build_environment) $(env_sysroot) ; \
+	   $(BUILD_ENVIRONMENT) $(MAKE) -j1 -C libcook   install $(aml_build_environment) $(env_sysroot) ; \
+	   $(BUILD_ENVIRONMENT) $(MAKE) -j1 -C libfaad   install $(aml_build_environment) $(env_sysroot) ; \
+	   $(BUILD_ENVIRONMENT) $(MAKE) -j1 -C libflac   install $(aml_build_environment) $(env_sysroot) ; \
+	   $(BUILD_ENVIRONMENT) $(MAKE) -j1 -C liblpcm   install $(aml_build_environment) $(env_sysroot) ; \
+	   $(BUILD_ENVIRONMENT) $(MAKE) -j1 -C libraac   install $(aml_build_environment) $(env_sysroot) ; \
+	   $(BUILD_ENVIRONMENT) $(MAKE) -j1 -C libpcm    install $(aml_build_environment) $(env_sysroot) ; \
+	 )
+	@( cd $(AML_LIBS_PKG)/usr/lib$(LIBSUFFIX) ; \
+	   for file in *.so ; do \
+	     mv $$file $${file}.$(so_version) ; \
+	     ln -sf $${file}.$(so_version) $${file}.$(so_major_version) ; \
+	     ln -sf $${file}.$(so_major_version) $${file} ; \
+	   done ; \
+	 )
+	# ======= Install pkg-config file =======
+	@mkdir -p $(AML_LIBS_PKG)/usr/lib$(LIBSUFFIX)/pkgconfig
+	@cat $(pkgconfig_in) | $(SED) -e "s,@PREFIX@,/usr,g" \
+	                     | $(SED) -e "s,@LIBDIRSUFFIX@,$(LIBSUFFIX),g" \
+	                     > $(AML_LIBS_PKG)/usr/lib$(LIBSUFFIX)/pkgconfig/aml-libs.pc
+	# ======= Install Documentation =======
+	@if [ -d $(AML_LIBS_PKG)/usr/share/man ]; then \
+	  ( cd $(AML_LIBS_PKG)/usr/share/man ; \
+	    for manpagedir in `find . -type d -name "man*"` ; do \
+	      ( cd $$manpagedir ; \
+	        for eachpage in `find . -type l -maxdepth 1` ; do \
+	          ln -s `readlink $$eachpage`.gz $$eachpage.gz ; \
+	          rm $$eachpage ; \
+	        done ; \
+	        gzip -9 *.?  ; \
+	      ) \
+	    done \
+	  ) \
+	 fi
+	@mkdir -p $(AML_LIBS_PKG)/usr/doc/$(doc_dir_name)
+	@cp -a $(license) \
+	       $(AML_LIBS_PKG)/usr/doc/$(doc_dir_name)
+	@mkdir -p $(AML_LIBS_PKG)/usr/share/doc/$(doc_dir_name)
+	@cp -a $(license) \
+	       $(AML_LIBS_PKG)/usr/share/doc/$(doc_dir_name)
+	@( cd $(SRC_DIR) ; \
+	   if [ -r ChangeLog ]; then \
+	     DOCSDIR=`echo $(AML_LIBS_PKG)/usr/share/doc/$(doc_dir_name)` ; \
+	     cat ChangeLog | head -n 1000 > $$DOCSDIR/ChangeLog ; \
+	     touch -r ChangeLog $$DOCSDIR/ChangeLog ; \
+	   fi \
+	 )
+	# ======= Install the same to $(TARGET_DEST_DIR) =======
+	$(call install-into-devenv, $(AML_LIBS_PKG))
+	# ======= tune pkg-config *.pc search path to the target destination for development =======
+	@( cd $(TARGET_DEST_DIR)/usr/lib$(LIBSUFFIX)/pkgconfig ; \
+	   sed -i "s,/usr,$(TARGET_DEST_DIR)/usr,g" aml-libs.pc \
+	 )
+	# ======= Strip binaries =======
+	@( cd $(AML_LIBS_PKG) ; \
+	   find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs $(STRIP) --strip-unneeded 2> /dev/null ; \
+	   find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs $(STRIP) --strip-unneeded 2> /dev/null ; \
+	 )
+	@touch $@
+
+$(AML_LIBS_PKG_DESCRIPTION_FILE): $(AML_LIBS_PKG_DESCRIPTION_FILE_IN)
+	@cat $< | $(SED) -e "s/@VERSION@/$(version)/g" > $@
+
+$(pkg_signature)   : $(pkg_archive) ;
+$(pkg_description) : $(pkg_archive) ;
+
+$(pkg_archive): $(install_target) $(AML_LIBS_PKG_DESCRIPTION_FILE) $(AML_LIBS_PKG_INSTALL_SCRIPT)
+	@cp $(AML_LIBS_PKG_DESCRIPTION_FILE) $(AML_LIBS_PKG)/.DESCRIPTION
+	@cp $(AML_LIBS_PKG_INSTALL_SCRIPT) $(AML_LIBS_PKG)/.INSTALL
+	@$(BUILD_PKG_REQUIRES) $(AML_LIBS_PKG)/.REQUIRES
+	@echo "pkgname=$(AML_LIBS_PKG_NAME)"                            >  $(AML_LIBS_PKG)/.PKGINFO ; \
+	 echo "pkgver=$(AML_LIBS_PKG_VERSION)"                          >> $(AML_LIBS_PKG)/.PKGINFO ; \
+	 echo "arch=$(AML_LIBS_PKG_ARCH)"                               >> $(AML_LIBS_PKG)/.PKGINFO ; \
+	 echo "distroname=$(AML_LIBS_PKG_DISTRO_NAME)"                  >> $(AML_LIBS_PKG)/.PKGINFO ; \
+	 echo "distrover=$(AML_LIBS_PKG_DISTRO_VERSION)"                >> $(AML_LIBS_PKG)/.PKGINFO ; \
+	 echo "group=$(AML_LIBS_PKG_GROUP)"                             >> $(AML_LIBS_PKG)/.PKGINFO ; \
+	 echo "short_description=\"$(AML_LIBS_PKG_SHORT_DESCRIPTION)\"" >> $(AML_LIBS_PKG)/.PKGINFO ; \
+	 echo "url=$(AML_LIBS_PKG_URL)"                                 >> $(AML_LIBS_PKG)/.PKGINFO ; \
+	 echo "license=$(AML_LIBS_PKG_LICENSE)"                         >> $(AML_LIBS_PKG)/.PKGINFO
+	@$(FAKEROOT) sh -c "cd $(AML_LIBS_PKG) && chown -R root:root . && $(MAKE_PACKAGE) --linkadd yes .."
diff --git a/libs/aml-libs/0.4.0/PATCHES b/libs/aml-libs/0.4.0/PATCHES
new file mode 100644
index 000000000..e69de29bb
diff --git a/libs/aml-libs/0.4.0/aml-libs-pkg-description.in b/libs/aml-libs/0.4.0/aml-libs-pkg-description.in
new file mode 100644
index 000000000..f036a92fc
--- /dev/null
+++ b/libs/aml-libs/0.4.0/aml-libs-pkg-description.in
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.  Line
+# up the first '|' above the ':' following the base package name, and the '|'
+# on the right side marks the last column you can put a character in.  You must
+# make exactly 11 lines for the formatting to be correct.  It's also
+# customary to leave one space after the ':'.
+
+        |-----handy-ruler------------------------------------------------------|
+aml-libs: aml-libs @VERSION@ (Amlogic media player library)
+aml-libs:
+aml-libs: aml-libs is a set of Amlogic media player libraries and codecs.
+aml-libs:
+aml-libs:
+aml-libs: For more information, see http://openlinux.amlogic.com
+aml-libs:
+aml-libs:
+aml-libs:
+aml-libs:
+aml-libs:
diff --git a/libs/aml-libs/0.4.0/aml-libs-pkg-install.sh b/libs/aml-libs/0.4.0/aml-libs-pkg-install.sh
new file mode 100755
index 000000000..8e8683cd6
--- /dev/null
+++ b/libs/aml-libs/0.4.0/aml-libs-pkg-install.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+# arg 1:  the new package version
+pre_install() {
+  /bin/true
+}
+
+# arg 1:  the new package version
+post_install() {
+  /bin/true
+}
+
+# arg 1:  the new package version
+# arg 2:  the old package version
+pre_update() {
+  /bin/true
+}
+
+# arg 1:  the new package version
+# arg 2:  the old package version
+post_update() {
+  post_install
+}
+
+# arg 1:  the old package version
+pre_remove() {
+  /bin/true
+}
+
+# arg 1:  the old package version
+post_remove() {
+  /bin/true
+}
+
+
+operation=$1
+shift
+
+$operation $*
diff --git a/libs/aml-libs/0.4.0/license/COPYING.GPLv2 b/libs/aml-libs/0.4.0/license/COPYING.GPLv2
new file mode 100644
index 000000000..d159169d1
--- /dev/null
+++ b/libs/aml-libs/0.4.0/license/COPYING.GPLv2
@@ -0,0 +1,339 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                            NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    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.
+
+    You should have received a copy of the GNU General Public License along
+    with this program; if not, write to the Free Software Foundation, Inc.,
+    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/libs/aml-libs/0.4.0/pkgconfigs/aml-libs.pc.in b/libs/aml-libs/0.4.0/pkgconfigs/aml-libs.pc.in
new file mode 100644
index 000000000..459883a47
--- /dev/null
+++ b/libs/aml-libs/0.4.0/pkgconfigs/aml-libs.pc.in
@@ -0,0 +1,12 @@
+prefix=@PREFIX@
+exec_prefix=${prefix}
+libdir=${prefix}/lib@LIBDIRSUFFIX@
+includedir=${prefix}/include
+
+Name: egl
+Description: Amlogic media player library
+Requires.private:  alsa >= 1.1.1
+Version: 0.4.0
+Libs: -L${libdir} -L${libdir}/aml_libs -lamadec -lamavutils -lamcodec -lz -lrt
+Libs.private:
+Cflags: -I${includedir}
diff --git a/sources/Linux/Amlogic/M201/Makefile b/sources/Linux/Amlogic/M201/Makefile
index 9eea19630..6e77e312d 100644
--- a/sources/Linux/Amlogic/M201/Makefile
+++ b/sources/Linux/Amlogic/M201/Makefile
@@ -7,18 +7,20 @@ include ../../../../build-system/constants.mk
 
 url         = $(DOWNLOAD_SERVER)/sources/Linux/Amlogic/M201
 
-versions    = aml-3.10.33-20150115
-versions   += aml-3.10.33-20150117
+versions    = aml-3.10.33-20150117
+versions   += aml-3.10.33-20160716
 
 tarballs    = $(addsuffix .tar.xz, $(addprefix linux-, $(versions)))
 sha1s       = $(addsuffix .sha1sum, $(tarballs))
 
-patches     = $(CURDIR)/patches/linux-aml-3.10.33-20150115-headers-install.patch
-patches    += $(CURDIR)/patches/linux-aml-3.10.33-20150115-gcc5.patch
-patches    += $(CURDIR)/patches/linux-aml-3.10.33-20150117-headers-install.patch
+patches     = $(CURDIR)/patches/linux-aml-3.10.33-20150117-headers-install.patch
 patches    += $(CURDIR)/patches/linux-aml-3.10.33-20150117-gcc5.patch
 patches    += $(CURDIR)/patches/linux-aml-3.10.33-20150117-m201-dtbs.patch
 patches    += $(CURDIR)/patches/linux-aml-3.10.33-20150117-osd-xrgb.patch
+patches    += $(CURDIR)/patches/linux-aml-3.10.33-20160716-headers-install.patch
+patches    += $(CURDIR)/patches/linux-aml-3.10.33-20160716-gcc5.patch
+patches    += $(CURDIR)/patches/linux-aml-3.10.33-20160716-m201-dtbs.patch
+patches    += $(CURDIR)/patches/linux-aml-3.10.33-20160716-osd-xrgb.patch
 
 .NOTPARALLEL: $(patches)
 
@@ -53,12 +55,14 @@ $(sha1s): $(tarballs)
 
 $(patches): $(sha1s)
 	@echo -e "\n======= Create Patches =======\n" ; \
-	 ( cd create-3.10.33-20150115-headers-install-patch ; ./create.patch.sh ) ; \
-	 ( cd create-3.10.33-20150115-gcc5-patch            ; ./create.patch.sh ) ; \
 	 ( cd create-3.10.33-20150117-headers-install-patch ; ./create.patch.sh ) ; \
 	 ( cd create-3.10.33-20150117-gcc5-patch            ; ./create.patch.sh ) ; \
 	 ( cd create-3.10.33-20150117-m201-dtbs-patch       ; ./create.patch.sh ) ; \
 	 ( cd create-3.10.33-20150117-osd-xrgb-patch        ; ./create.patch.sh ) ; \
+	 ( cd create-3.10.33-20160716-headers-install-patch ; ./create.patch.sh ) ; \
+	 ( cd create-3.10.33-20160716-gcc5-patch            ; ./create.patch.sh ) ; \
+	 ( cd create-3.10.33-20160716-m201-dtbs-patch       ; ./create.patch.sh ) ; \
+	 ( cd create-3.10.33-20160716-osd-xrgb-patch        ; ./create.patch.sh ) ; \
 	 echo -e "\n"
 
 download_clean:
diff --git a/sources/Linux/Amlogic/M201/create-3.10.33-20150115-gcc5-patch/file.list b/sources/Linux/Amlogic/M201/create-3.10.33-20150115-gcc5-patch/file.list
deleted file mode 100644
index 0857b9a25..000000000
--- a/sources/Linux/Amlogic/M201/create-3.10.33-20150115-gcc5-patch/file.list
+++ /dev/null
@@ -1 +0,0 @@
-linux-aml-3.10.33-20150115/Makefile
diff --git a/sources/Linux/Amlogic/M201/create-3.10.33-20150115-headers-install-patch/file.list b/sources/Linux/Amlogic/M201/create-3.10.33-20150115-headers-install-patch/file.list
deleted file mode 100644
index ea3622e10..000000000
--- a/sources/Linux/Amlogic/M201/create-3.10.33-20150115-headers-install-patch/file.list
+++ /dev/null
@@ -1 +0,0 @@
-linux-aml-3.10.33-20150115/scripts/Makefile.headersinst
diff --git a/sources/Linux/Amlogic/M201/create-3.10.33-20150117-osd-xrgb-patch/linux-aml-3.10.33-20150117-new/drivers/amlogic/display/osd/osd_hw.c b/sources/Linux/Amlogic/M201/create-3.10.33-20150117-osd-xrgb-patch/linux-aml-3.10.33-20150117-new/drivers/amlogic/display/osd/osd_hw.c
index 755c323cb..82bd6f567 100644
--- a/sources/Linux/Amlogic/M201/create-3.10.33-20150117-osd-xrgb-patch/linux-aml-3.10.33-20150117-new/drivers/amlogic/display/osd/osd_hw.c
+++ b/sources/Linux/Amlogic/M201/create-3.10.33-20150117-osd-xrgb-patch/linux-aml-3.10.33-20150117-new/drivers/amlogic/display/osd/osd_hw.c
@@ -2251,6 +2251,7 @@ static   void  osd1_update_color_mode(void)
 				 * What we have to do here for M201 board with S805 ?????????????
 				   VSYNCOSD_WR_MPEG_REG_BITS(VIU_OSD1_CTRL_STAT2, 0x1ff, 6, 9);
 				 */
+				VSYNCOSD_SET_MPEG_REG_MASK(VPP_MISC, 1<<9); /* enable OSD1 premultiplied alpha */
 			}
 			else
 			{
@@ -2259,6 +2260,7 @@ static   void  osd1_update_color_mode(void)
 				 * What we have to do here for M201 board with S805 ?????????????
 				   VSYNCOSD_WR_MPEG_REG_BITS(VIU_OSD1_CTRL_STAT2, 0, 6, 9);
 				 */
+				VSYNCOSD_CLR_MPEG_REG_MASK(VPP_MISC, 1<<9); /* disable OSD1 premultiplied alpha */
 			}
 		}
 	}
@@ -2291,6 +2293,7 @@ static   void  osd2_update_color_mode(void)
 				 * What we have to do here for M201 board with S805 ?????????????
 				   VSYNCOSD_WR_MPEG_REG_BITS(VIU_OSD2_CTRL_STAT2, 0x1ff, 6, 9);
 				 */
+				VSYNCOSD_SET_MPEG_REG_MASK(VPP_MISC, 1<<8); /* enable OSD2 premultiplied alpha */
 			}
 			else
 			{
@@ -2299,6 +2302,7 @@ static   void  osd2_update_color_mode(void)
 				 * What we have to do here for M201 board with S805 ?????????????
 				   VSYNCOSD_WR_MPEG_REG_BITS(VIU_OSD2_CTRL_STAT2, 0, 6, 9);
 				 */
+				VSYNCOSD_CLR_MPEG_REG_MASK(VPP_MISC, 1<<8); /* disable OSD2 premultiplied alpha */
 			}
 		}
 	}
@@ -2591,7 +2595,7 @@ static   void  osd1_update_gbl_alpha(void)
 	data32 &= ~(0x1ff << 12);
 	data32 |= osd_hw.gbl_alpha[OSD1] << 12;
 	VSYNCOSD_WR_MPEG_REG(VIU_OSD1_CTRL_STAT, data32);
-	VSYNCOSD_SET_MPEG_REG_MASK(VPP_MISC, 1<<9); /* enable OSD1 premultiplied alpha */
+	/* VSYNCOSD_SET_MPEG_REG_MASK(VPP_MISC, 1<<9); */ /* enable OSD1 premultiplied alpha */
 	remove_from_update_list(OSD1, OSD_GBL_ALPHA);
 }
 static   void  osd2_update_gbl_alpha(void)
@@ -2602,6 +2606,7 @@ static   void  osd2_update_gbl_alpha(void)
 	data32 &= ~(0x1ff << 12);
 	data32 |= osd_hw.gbl_alpha[OSD2] << 12;
 	VSYNCOSD_WR_MPEG_REG(VIU_OSD2_CTRL_STAT, data32);
+	/* VSYNCOSD_SET_MPEG_REG_MASK(VPP_MISC, 1<<8); */ /* enable OSD2 premultiplied alpha */
 	remove_from_update_list(OSD2, OSD_GBL_ALPHA);
 }
 static   void  osd2_update_order(void)
diff --git a/sources/Linux/Amlogic/M201/create-3.10.33-20150115-gcc5-patch/create.patch.sh b/sources/Linux/Amlogic/M201/create-3.10.33-20160716-gcc5-patch/create.patch.sh
similarity index 93%
rename from sources/Linux/Amlogic/M201/create-3.10.33-20150115-gcc5-patch/create.patch.sh
rename to sources/Linux/Amlogic/M201/create-3.10.33-20160716-gcc5-patch/create.patch.sh
index f747654ae..cd85e2a61 100755
--- a/sources/Linux/Amlogic/M201/create-3.10.33-20150115-gcc5-patch/create.patch.sh
+++ b/sources/Linux/Amlogic/M201/create-3.10.33-20160716-gcc5-patch/create.patch.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-VERSION=3.10.33-20150115
+VERSION=3.10.33-20160716
 
 tar --files-from=file.list -xJvf ../linux-aml-$VERSION.tar.xz
 mv linux-aml-$VERSION linux-aml-$VERSION-orig
diff --git a/sources/Linux/Amlogic/M201/create-3.10.33-20160716-gcc5-patch/file.list b/sources/Linux/Amlogic/M201/create-3.10.33-20160716-gcc5-patch/file.list
new file mode 100644
index 000000000..7bf9ab7c7
--- /dev/null
+++ b/sources/Linux/Amlogic/M201/create-3.10.33-20160716-gcc5-patch/file.list
@@ -0,0 +1 @@
+linux-aml-3.10.33-20160716/Makefile
diff --git a/sources/Linux/Amlogic/M201/create-3.10.33-20150115-gcc5-patch/linux-aml-3.10.33-20150115-new/Makefile b/sources/Linux/Amlogic/M201/create-3.10.33-20160716-gcc5-patch/linux-aml-3.10.33-20160716-new/Makefile
similarity index 98%
rename from sources/Linux/Amlogic/M201/create-3.10.33-20150115-gcc5-patch/linux-aml-3.10.33-20150115-new/Makefile
rename to sources/Linux/Amlogic/M201/create-3.10.33-20160716-gcc5-patch/linux-aml-3.10.33-20160716-new/Makefile
index 56923c761..075f0c43c 100644
--- a/sources/Linux/Amlogic/M201/create-3.10.33-20150115-gcc5-patch/linux-aml-3.10.33-20150115-new/Makefile
+++ b/sources/Linux/Amlogic/M201/create-3.10.33-20160716-gcc5-patch/linux-aml-3.10.33-20160716-new/Makefile
@@ -376,24 +376,6 @@ KBUILD_CFLAGS   := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
 		   -fno-delete-null-pointer-checks \
 		   -std=gnu89
 
-KBUILD_CFLAGS   += -Werror=enum-compare \
-		   -Werror=comment \
-		   -Werror=implicit-int \
-		   -Werror=missing-braces \
-		   -Werror=unused-value \
-		   -Werror=format \
-		   -Werror=switch \
-		   -Werror=strict-prototypes \
-		   -Werror=declaration-after-statement \
-		   -Werror=uninitialized \
-		   -Werror=unused-label \
-		   -Werror=undef \
-		   -Werror=unused-result \
-		   -Werror=return-type \
-		   -Werror=parentheses \
-		   -Werror=int-to-pointer-cast \
-		   -Wno-maybe-uninitialized \
-		   -Wno-error=cpp
 KBUILD_AFLAGS_KERNEL :=
 KBUILD_CFLAGS_KERNEL :=
 KBUILD_AFLAGS   := -D__ASSEMBLY__
@@ -405,11 +387,12 @@ KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds
 KERNELRELEASE = $(shell head -1 include/config/kernel.release 2> /dev/null)
 KERNELRELEASE_FULL = $(shell tail -1 include/config/kernel.release 2> /dev/null)
 KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)
+CUSTOMER_DIR_NAME ?= customer
 
 
 export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION
 export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC
-export CPP AR NM STRIP OBJCOPY OBJDUMP
+export CPP AR NM STRIP OBJCOPY OBJDUMP CUSTOMER_DIR_NAME
 export MAKE AWK GENKSYMS INSTALLKERNEL PERL UTS_MACHINE
 export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
 
@@ -1205,7 +1188,7 @@ dtd:
 	$(srctree)/scripts/amlogic/aml_dtd.sh $(srctree)
 
 %.dtd:
-	$(srctree)/scripts/amlogic/aml2dts.sh $(wildcard $(srctree)/arch/arm/boot/dts/amlogic/$@)
+	$(srctree)/scripts/amlogic/aml2dts.sh $(firstword $(wildcard $(srctree)/arch/arm/boot/dts/amlogic/$@ $(srctree)/$(CUSTOMER_DIR_NAME)/meson/dt/$@))
 
 # Documentation targets
 # ---------------------------------------------------------------------------
diff --git a/sources/Linux/Amlogic/M201/create-3.10.33-20150115-gcc5-patch/linux-aml-3.10.33-20150115-new/include/linux/compiler-gcc5.h b/sources/Linux/Amlogic/M201/create-3.10.33-20160716-gcc5-patch/linux-aml-3.10.33-20160716-new/include/linux/compiler-gcc5.h
similarity index 100%
rename from sources/Linux/Amlogic/M201/create-3.10.33-20150115-gcc5-patch/linux-aml-3.10.33-20150115-new/include/linux/compiler-gcc5.h
rename to sources/Linux/Amlogic/M201/create-3.10.33-20160716-gcc5-patch/linux-aml-3.10.33-20160716-new/include/linux/compiler-gcc5.h
diff --git a/sources/Linux/Amlogic/M201/create-3.10.33-20150115-headers-install-patch/create.patch.sh b/sources/Linux/Amlogic/M201/create-3.10.33-20160716-headers-install-patch/create.patch.sh
similarity index 94%
rename from sources/Linux/Amlogic/M201/create-3.10.33-20150115-headers-install-patch/create.patch.sh
rename to sources/Linux/Amlogic/M201/create-3.10.33-20160716-headers-install-patch/create.patch.sh
index 2f6e8cccb..8a7ad5b4a 100755
--- a/sources/Linux/Amlogic/M201/create-3.10.33-20150115-headers-install-patch/create.patch.sh
+++ b/sources/Linux/Amlogic/M201/create-3.10.33-20160716-headers-install-patch/create.patch.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-VERSION=3.10.33-20150115
+VERSION=3.10.33-20160716
 
 tar --files-from=file.list -xJvf ../linux-aml-$VERSION.tar.xz
 mv linux-aml-$VERSION linux-aml-$VERSION-orig
diff --git a/sources/Linux/Amlogic/M201/create-3.10.33-20160716-headers-install-patch/file.list b/sources/Linux/Amlogic/M201/create-3.10.33-20160716-headers-install-patch/file.list
new file mode 100644
index 000000000..e076353be
--- /dev/null
+++ b/sources/Linux/Amlogic/M201/create-3.10.33-20160716-headers-install-patch/file.list
@@ -0,0 +1 @@
+linux-aml-3.10.33-20160716/scripts/Makefile.headersinst
diff --git a/sources/Linux/Amlogic/M201/create-3.10.33-20150115-headers-install-patch/linux-aml-3.10.33-20150115-new/scripts/Makefile.headersinst b/sources/Linux/Amlogic/M201/create-3.10.33-20160716-headers-install-patch/linux-aml-3.10.33-20160716-new/scripts/Makefile.headersinst
similarity index 100%
rename from sources/Linux/Amlogic/M201/create-3.10.33-20150115-headers-install-patch/linux-aml-3.10.33-20150115-new/scripts/Makefile.headersinst
rename to sources/Linux/Amlogic/M201/create-3.10.33-20160716-headers-install-patch/linux-aml-3.10.33-20160716-new/scripts/Makefile.headersinst
diff --git a/sources/Linux/Amlogic/M201/create-3.10.33-20160716-m201-dtbs-patch/create.patch.sh b/sources/Linux/Amlogic/M201/create-3.10.33-20160716-m201-dtbs-patch/create.patch.sh
new file mode 100755
index 000000000..052af0b74
--- /dev/null
+++ b/sources/Linux/Amlogic/M201/create-3.10.33-20160716-m201-dtbs-patch/create.patch.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+VERSION=3.10.33-20160716
+
+tar --files-from=file.list -xJvf ../linux-aml-$VERSION.tar.xz
+mv linux-aml-$VERSION linux-aml-$VERSION-orig
+
+cp -rf ./linux-aml-$VERSION-new ./linux-aml-$VERSION
+
+diff -b --unified -Nr  linux-aml-$VERSION-orig  linux-aml-$VERSION > linux-aml-$VERSION-m201-dtbs.patch
+
+mv linux-aml-$VERSION-m201-dtbs.patch ../patches
+
+rm -rf ./linux-aml-$VERSION
+rm -rf ./linux-aml-$VERSION-orig
diff --git a/sources/Linux/Amlogic/M201/create-3.10.33-20160716-m201-dtbs-patch/file.list b/sources/Linux/Amlogic/M201/create-3.10.33-20160716-m201-dtbs-patch/file.list
new file mode 100644
index 000000000..08910cd58
--- /dev/null
+++ b/sources/Linux/Amlogic/M201/create-3.10.33-20160716-m201-dtbs-patch/file.list
@@ -0,0 +1,2 @@
+linux-aml-3.10.33-20160716/arch/arm/boot/dts/amlogic/meson8b_m201_1G.dtd
+linux-aml-3.10.33-20160716/arch/arm/boot/dts/amlogic/meson8b_m201_512M.dtd
diff --git a/sources/Linux/Amlogic/M201/create-3.10.33-20160716-m201-dtbs-patch/linux-aml-3.10.33-20160716-new/arch/arm/boot/dts/amlogic/meson8b-mxq.dtd b/sources/Linux/Amlogic/M201/create-3.10.33-20160716-m201-dtbs-patch/linux-aml-3.10.33-20160716-new/arch/arm/boot/dts/amlogic/meson8b-mxq.dtd
new file mode 100644
index 000000000..367281690
--- /dev/null
+++ b/sources/Linux/Amlogic/M201/create-3.10.33-20160716-m201-dtbs-patch/linux-aml-3.10.33-20160716-new/arch/arm/boot/dts/amlogic/meson8b-mxq.dtd
@@ -0,0 +1,1034 @@
+/dts-v1/;
+/// ***************************************************************************************\n
+//$$ PROJECT="meson8b"
+//$$ REMOVE 1
+void root_func(){
+//$$ ADD / {
+	compatible = "AMLOGIC,8726_M8B";
+	model = "AMLOGIC";
+	interrupt-parent = <0x1>;
+	#address-cells = <0x1>;
+	#size-cells = <0x1>;
+
+	cpus {
+		#address-cells = <0x1>;
+		#size-cells = <0x0>;
+
+		cpu@0 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a5";
+			reg = <0x200>;
+		};
+
+		cpu@1 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a5";
+			reg = <0x1>;
+		};
+
+		cpu@2 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a5";
+			reg = <0x2>;
+		};
+
+		cpu@3 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a5";
+			reg = <0x3>;
+		};
+	};
+
+	cache-controller {
+		compatible = "arm,meson-pl310-cache";
+		reg = <0xc4200000 0x1000>;
+		arm,data-latency = <0x3 0x3 0x3>;
+		arm,tag-latency = <0x2 0x2 0x2>;
+		arm,filter-ranges = <0x100000 0xc0000000>;
+		cache-unified;
+		cache-level = <0x2>;
+		aux-instruction_prefetch;
+		aux-data_prefetch;
+		aux-ns_lockdown;
+		aux-force_no_write_alloc;
+		aux-cache_replace_policy_round_robin;
+		aux-early_write_response;
+		aux-full_line_of_zero;
+		aux-ns_int_ctrl;
+		aux-share_override;
+		prefetch-double_line_fill;
+		prefetch-prefetch_drop;
+		prefetch-prefetch_offset = <0x7>;
+	};
+
+	memory {
+		device_type = "memory";
+		aml_reserved_start = <0x6000000>;
+		aml_reserved_end = <0x5000000>;
+		phys_offset = <0x200000>;
+		linux,total-memory = <0x3fe00000>;
+		#address-cells = <0x1>;
+		#size-cells = <0x1>;
+
+		region@0 {
+			region_name = "cma_0";
+			reg = <0x0 0x2a00000>;
+			linux,contiguous-region;
+			linux,phandle = <0x2>;
+			phandle = <0x2>;
+		};
+	};
+
+	interrupt-controller {
+		compatible = "arm,cortex-a9-gic";
+		reg = <0xc4301000 0x1000 0xc4300100 0x100>;
+		interrupt-controller;
+		#interrupt-cells = <0x3>;
+		#address-cells = <0x0>;
+		linux,phandle = <0x1>;
+		phandle = <0x1>;
+	};
+
+	vpu {
+		compatible = "amlogic,vpu";
+		dev_name = "vpu";
+		status = "ok";
+		clk_level = <0x3>;
+	};
+
+	mesonfb {
+		compatible = "amlogic,mesonfb";
+		dev_name = "mesonfb";
+		status = "okay";
+		reserve-memory = <0x1800000 0x100000>;
+		reserve-iomap = "true";
+		vmode = <0x3>;
+		scale_mode = <0x1>;
+		4k2k_fb = <0x0>;
+		display_size_default = <0x780 0x438 0x780 0xca8 0x20>;
+	};
+
+	deinterlace {
+		compatible = "amlogic,deinterlace";
+		dev_name = "deinterlace";
+		status = "ok";
+		reserve-memory = <0x2100000>;
+	};
+
+	mesonstream {
+		compatible = "amlogic,mesonstream";
+		dev_name = "mesonstream.0";
+		status = "okay";
+		reserve-memory = <0x2000000>;
+		reserve-iomap = "true";
+	};
+
+	vdec {
+		compatible = "amlogic,vdec";
+		dev_name = "vdec.0";
+		status = "okay";
+		reserve-memory = <0x4000000>;
+		reserve-iomap = "true";
+	};
+
+	ppmgr {
+		compatible = "amlogic,ppmgr";
+		dev_name = "ppmgr";
+		status = "okay";
+		reserve-memory = <0x1000000>;
+	};
+
+	amvenc_avc {
+		compatible = "amlogic,amvenc_avc";
+		dev_name = "amvenc_avc.0";
+		status = "okay";
+		linux,contiguous-region = <0x2>;
+		reserve-iomap = "true";
+	};
+
+	ion_dev {
+		compatible = "amlogic,ion_dev";
+		dev_name = "ion_dev";
+		status = "ok";
+		share-memory-name = "ppmgr0";
+		share-memory-offset = <0x0>;
+		share-memory-size = <0x1000000>;
+	};
+
+	mesonvout {
+		compatible = "amlogic,mesonvout";
+		dev_name = "mesonvout";
+		status = "okay";
+	};
+
+	rtc {
+		compatible = "amlogic,aml_rtc";
+		status = "okay";
+	};
+
+	uart_ao {
+		compatible = "amlogic,aml_uart";
+		port_name = "uart_ao";
+		status = "okay";
+		dev_name = "uart_ao";
+	};
+
+	uart_0 {
+		compatible = "amlogic,aml_uart";
+		port_name = "uart_a";
+		status = "okay";
+		dev_name = "uart_0";
+	};
+
+	uart_1 {
+		compatible = "amlogic,aml_uart";
+		port_name = "uart_b";
+		status = "okay";
+		dev_name = "uart_1";
+		pinctrl-names = "default";
+		pinctrl-0 = <0x3>;
+	};
+
+	uart_2 {
+		compatible = "amlogic,aml_uart";
+		port_name = "uart_c";
+		status = "disabled";
+		dev_name = "uart_2";
+	};
+
+	uart_3 {
+		compatible = "amlogic,aml_uart";
+		port_name = "uart_d";
+		status = "ok";
+		dev_name = "uart_3";
+	};
+
+	bt-dev {
+		compatible = "amlogic,bt-dev";
+		dev_name = "bt-dev";
+		status = "ok";
+		gpio_reset = "GPIOX_20";
+	};
+
+	wifi {
+		compatible = "amlogic,aml_broadcm_wifi";
+		dev_name = "aml_broadcm_wifi";
+		status = "okay";
+		interrupt_pin = "GPIOX_21";
+		irq_num = <0x4>;
+		irq_trigger_type = "GPIO_IRQ_HIGH";
+		power_on_pin = "GPIOAO_6";
+		power_on_pin2 = "GPIOX_11";
+		clock_32k_pin = "GPIOX_10";
+	};
+
+	wifi_power {
+		compatible = "amlogic,wifi_power";
+		dev_name = "wifi_power";
+		status = "okay";
+		power_gpio = "GPIOAO_6";
+		power_gpio2 = "GPIOX_11";
+	};
+
+	sdio {
+		compatible = "amlogic,aml_sdio";
+		dev_name = "aml_sdio.0";
+		status = "okay";
+		reg = <0xc1108c20 0x20>;
+		pinctrl-names = "sd_clk_cmd_pins", "sd_all_pins", "emmc_clk_cmd_pins", "emmc_all_pins", "sdio_clk_cmd_pins", "sdio_all_pins", "sd_1bit_pins";
+		pinctrl-0 = <0x4>;
+		pinctrl-1 = <0x5>;
+		pinctrl-2 = <0x6>;
+		pinctrl-3 = <0x7>;
+		pinctrl-4 = <0x8>;
+		pinctrl-5 = <0x9>;
+		pinctrl-6 = <0xa>;
+
+		sd {
+			status = "okay";
+			port = <0x1>;
+			pinname = "sd";
+			ocr_avail = <0x200000>;
+			caps = "MMC_CAP_4_BIT_DATA", "MMC_CAP_MMC_HIGHSPEED", "MMC_CAP_SD_HIGHSPEED";
+			f_min = <0x493e0>;
+			f_max = <0x2faf080>;
+			f_max_w = <0x2faf080>;
+			max_req_size = <0x20000>;
+			gpio_dat3 = "CARD_4";
+			jtag_pin = "CARD_0";
+			gpio_cd = "CARD_6";
+			irq_in = <0x3>;
+			irq_out = <0x5>;
+			card_type = <0x5>;
+		};
+
+		emmc {
+			status = "ok";
+			port = <0x2>;
+			pinname = "emmc";
+			ocr_avail = <0x200000>;
+			caps = "MMC_CAP_4_BIT_DATA", "MMC_CAP_MMC_HIGHSPEED", "MMC_CAP_SD_HIGHSPEED", "MMC_CAP_NONREMOVABLE", "MMC_CAP_ERASE", "MMC_CAP_HW_RESET";
+			f_min = <0x493e0>;
+			f_max = <0x2faf080>;
+			f_max_w = <0x2faf080>;
+			max_req_size = <0x20000>;
+			gpio_dat3 = "BOOT_3";
+			card_type = <0x1>;
+		};
+
+		sdio {
+			status = "ok";
+			port = <0x0>;
+			pinname = "sdio";
+			ocr_avail = <0x200000>;
+			caps = "MMC_CAP_4_BIT_DATA", "MMC_CAP_SDIO_IRQ", "MMC_CAP_MMC_HIGHSPEED", "MMC_CAP_SD_HIGHSPEED", "MMC_CAP_NONREMOVABLE";
+			f_min = <0x493e0>;
+			f_max = <0x2faf080>;
+			max_req_size = <0x20000>;
+			card_type = <0x3>;
+		};
+	};
+
+	i2c@c8100500 {
+		compatible = "amlogic,aml_i2c";
+		dev_name = "i2c-AO";
+		status = "ok";
+		reg = <0xc8100500 0x1d>;
+		#address-cells = <0x1>;
+		#size-cells = <0x0>;
+		device_id = <0x0>;
+		pinctrl-names = "default";
+		pinctrl-0 = <0xb>;
+		use_pio = <0x0>;
+		master_i2c_speed = <0x186a0>;
+	};
+
+	i2c@c11087c0 {
+		compatible = "amlogic,aml_i2c";
+		dev_name = "i2c-B";
+		status = "ok";
+		reg = <0xc11087c0 0x20>;
+		device_id = <0x2>;
+		pinctrl-names = "default";
+		pinctrl-0 = <0xc>;
+		#address-cells = <0x1>;
+		#size-cells = <0x0>;
+		use_pio = <0x0>;
+		master_i2c_speed = <0x493e0>;
+	};
+
+	i2c@c11087e0 {
+		compatible = "amlogic,aml_i2c";
+		dev_name = "i2c-C";
+		status = "ok";
+		reg = <0xc11087e0 0x20>;
+		device_id = <0x3>;
+		pinctrl-names = "default";
+		#address-cells = <0x1>;
+		#size-cells = <0x0>;
+		use_pio = <0x0>;
+		master_i2c_speed = <0x493e0>;
+	};
+
+	i2c@c1108d20 {
+		compatible = "amlogic,aml_i2c";
+		dev_name = "i2c-D";
+		status = "ok";
+		reg = <0xc1108d20 0x20>;
+		device_id = <0x4>;
+		pinctrl-names = "default";
+		#address-cells = <0x1>;
+		#size-cells = <0x0>;
+		use_pio = <0x0>;
+		master_i2c_speed = <0x493e0>;
+	};
+
+	dvfs {
+		compatible = "amlogic, amlogic-dvfs";
+		#address-cells = <0x1>;
+		#size-cells = <0x0>;
+		status = "ok";
+
+		vcck_dvfs {
+			dvfs_id = <0x1>;
+			table_count = <0xc>;
+			dvfs_table = <0x17700 0xd1f60 0xd1f60 0x2ee00 0xd1f60 0xd1f60 0x4c2c0 0xd1f60 0xd1f60 0x639c0 0xd1f60 0xd1f60 0x7b0c0 0xd1f60 0xd1f60 0x927c0 0xd1f60 0xd1f60 0xafc80 0xd1f60 0xd1f60 0xc7380 0xdbba0 0xdbba0 0xf6180 0xe09c0 0xe09c0 0x124f80 0xecd10 0xecd10 0x142440 0x100590 0x100590 0x16b480 0x10c8e0 0x10c8e0>;
+		};
+	};
+
+	meson_vcck_dvfs_driver {
+		compatible = "amlogic, meson_vcck_dvfs";
+		dev_name = "meson_vcck_dvfs_driver";
+		status = "ok";
+		pinctrl-names = "default";
+		pinctrl-0 = <0xd>;
+		use_pwm = <0x1>;
+		pmw_controller = "PWM_C";
+		table_count = <0x1d>;
+		cs_voltage_table = <0x1c0000 0xd1f60 0x1b0001 0xd4670 0x1a0002 0xd6d80 0x190003 0xd9490 0x180004 0xdbba0 0x170005 0xde2b0 0x160006 0xe09c0 0x150007 0xe30d0 0x140008 0xe57e0 0x130009 0xe7ef0 0x12000a 0xea600 0x11000b 0xecd10 0x10000c 0xef420 0xf000d 0xf1b30 0xe000e 0xf4240 0xd000f 0xf6950 0xc0010 0xf9060 0xb0011 0xfb770 0xa0012 0xfde80 0x90013 0x100590 0x80014 0x102ca0 0x70015 0x1053b0 0x60016 0x107ac0 0x50017 0x10a1d0 0x40018 0x10c8e0 0x30019 0x10eff0 0x2001a 0x111700 0x1001b 0x113e10 0x1c 0x116520>;
+	};
+
+	arm_pmu {
+		compatible = "arm,cortex-a9-pmu";
+		status = "ok";
+		interrupts = <0x0 0x89 0x4 0x0 0x8a 0x4 0x0 0x99 0x4 0x0 0x9a 0x4>;
+	};
+
+	usb_con {
+		lm-compatible = "logicmodule-bus";
+
+		usb_b {
+			lm-compatible = "amlogic,usb";
+			lm-periph-id = <0x1>;
+			clock-src = "usb1";
+			port-id = <0x1>;
+			port-type = <0x1>;
+			port-speed = <0x0>;
+			port-config = <0x0>;
+			port-dma = <0x0>;
+			port-id-mode = <0x1>;
+			status = "okay";
+		};
+
+		usb_a {
+			lm-compatible = "amlogic,usb";
+			lm-periph-id = <0x0>;
+			clock-src = "usb0";
+			port-id = <0x0>;
+			port-type = <0x0>;
+			port-speed = <0x0>;
+			port-config = <0x0>;
+			port-dma = <0x0>;
+			port-id-mode = <0x0>;
+			gpio-work-mask = <0x1>;
+			status = "okay";
+		};
+	};
+
+	audio_platform {
+		compatible = "amlogic,aml-i2s";
+		dev_name = "aml-i2s.0";
+		status = "okay";
+	};
+
+	audio_dai {
+		compatible = "amlogic,aml-i2s-dai";
+		dev_name = "aml-i2s-dai.0";
+		status = "okay";
+	};
+
+	audio_spdif_dai {
+		compatible = "amlogic,aml-spdif-dai";
+		dev_name = "aml-spdif-dai.0";
+		status = "okay";
+	};
+
+	audio_spdif_codec {
+		compatible = "amlogic,aml-spdif-codec";
+		dev_name = "spdif-dit.0";
+		status = "okay";
+	};
+
+	audio_pcm2BT_codec {
+		compatible = "amlogic,pcm2BT-codec";
+		dev_name = "pcm2bt.0";
+		status = "okay";
+	};
+
+	audio_pcm_dai {
+		compatible = "amlogic,aml-pcm-dai";
+		dev_name = "aml-pcm-dai.0";
+		status = "okay";
+	};
+
+	audio_pcm {
+		compatible = "amlogic,aml-pcm";
+		dev_name = "aml-pcm.0";
+		status = "okay";
+	};
+
+	audio_m8_audio {
+		compatible = "amlogic,m8_audio_codec";
+		dev_name = "aml_m8_codec.0";
+		status = "disable";
+	};
+
+	dummy_codec {
+		compatible = "amlogic,aml_dummy_codec";
+		dev_name = "dummy_codec.0";
+		status = "okay";
+	};
+
+	aml_audio_codec {
+		compatible = "amlogic,audio_codec";
+
+		rt5616 {
+			codec_name = "rt5616";
+			i2c_addr = <0x1b>;
+			i2c_bus = "i2c_bus_d";
+			id_reg = <0x0>;
+			id_val = <0x21>;
+			capless = <0x0>;
+			status = "disable";
+		};
+
+		rt5631 {
+			codec_name = "rt5631";
+			i2c_addr = <0x1a>;
+			i2c_bus = "i2c_bus_b";
+			id_reg = <0x0>;
+			id_val = <0x1>;
+			capless = <0x0>;
+			status = "disable";
+		};
+
+		wm8960 {
+			codec_name = "wm8960";
+			i2c_addr = <0x1a>;
+			i2c_bus = "i2c_bus_b";
+			capless = <0x1>;
+			status = "disable";
+		};
+
+		dummy {
+			codec_name = "dummy_codec";
+			status = "okay";
+		};
+	};
+
+	aml_m8_sound_card {
+		compatible = "sound_card, aml_snd_m8";
+		aml,sound_card = "AML-M8AUDIO";
+		aml,codec_dai = "AML-M8", "rt5616-aif1", "rt5631-hifi", "wm8960-hifi", "dummy_codec";
+		aml,audio-routing-rt5616 = "Ext Spk", "LOUTL", "Ext Spk", "LOUTR", "HP", "HPOL", "HP", "HPOR", "micbias1", "MAIN MIC", "IN2P", "micbias1";
+		aml,audio-routing-amlm8 = "Ext Spk", "LINEOUTL", "Ext Spk", "LINEOUTR", "HP", "HP_L", "HP", "HP_R", "MICBIAS", "MAIN MIC", "LINPUT1", "MICBIAS";
+		aml,audio-routing-dummy = "Ext Spk", "LOUTL", "Ext Spk", "LOUTR";
+		mute_gpio = "GPIO_BSD_EN";
+		hp_disable;
+		hp_paraments = <0x320 0x12c 0x0 0x5 0x1>;
+		pinctrl-names = "aml_snd_m8";
+		pinctrl-0 = <0xe>;
+		status = "okay";
+	};
+
+	aml_cams {
+		compatible = "amlogic,cams_prober";
+		status = "okay";
+		pinctrl-names = "gpio", "csi";
+		pinctrl-0 = <0xf>;
+		pinctrl-1 = <0x10>;
+
+		cam_0 {
+			cam_name = "ar0543";
+			front_back = <0x0>;
+			i2c_bus = "i2c_bus_d";
+			gpio_pwdn = "GPIOH_6";
+			gpio_rst = "GPIOH_4";
+			mirror_flip = <0x0>;
+			vertical_flip = <0x0>;
+			config_path = "/system/etc/camera_isp_cfg/ar0543_skt";
+			mclk = <0x2ee0>;
+			bt_path = "csi";
+			interface = "mipi";
+			clk_channel = [61 00];
+			status = "okay";
+		};
+
+		cam_1 {
+			cam_name = "ov5647";
+			front_back = <0x0>;
+			i2c_bus = "i2c_bus_d";
+			gpio_pwdn = "GPIOH_5";
+			gpio_rst = "GPIOH_4";
+			mirror_flip = <0x0>;
+			vertical_flip = <0x0>;
+			config_path = "/system/etc/camera_isp_cfg/ov5647_cw0767";
+			bt_path = "csi";
+			interface = "mipi";
+			clk_channel = [62 00];
+			status = "okay";
+		};
+
+		cam_2 {
+			cam_name = "ar0833";
+			front_back = <0x0>;
+			i2c_bus = "i2c_bus_d";
+			gpio_pwdn = "GPIOH_6";
+			gpio_rst = "GPIOH_4";
+			mirror_flip = <0x0>;
+			vertical_flip = <0x0>;
+			config_path = "/system/etc/camera_isp_cfg/ar0833_skt";
+			mclk = <0x2ee0>;
+			bt_path = "csi";
+			interface = "mipi";
+			clk_channel = [61 00];
+			status = "okay";
+		};
+	};
+
+	gpio_keypad {
+		compatible = "amlogic,gpio_keypad";
+		status = "okay";
+		scan_period = <0x14>;
+		key_num = <0x1>;
+		key_name = "power";
+		key_code = <0x74>;
+		key_pin = "GPIOAO_3";
+		irq_keyup = <0x6>;
+		irq_keydown = <0x7>;
+	};
+
+	saradc {
+		compatible = "amlogic,saradc";
+		status = "okay";
+	};
+
+	meson-remote {
+		compatible = "amlogic,aml_remote";
+		dev_name = "meson-remote";
+		status = "ok";
+		ao_baseaddr = <0xf3100480>;
+		pinctrl-names = "default";
+		pinctrl-0 = <0x11>;
+	};
+
+	spi@cc000000 {
+		compatible = "amlogic,apollo_spi_nor";
+		status = "ok";
+		reg = <0xcc000000 0x4000000>;
+		pinctrl-names = "default";
+		pinctrl-0 = <0x12>;
+		nr-parts = <0x2>;
+		nr-part-0 = <0x13>;
+		nr-part-1 = <0x14>;
+
+		bootloader {
+			offset = <0x0>;
+			size = <0x100000>;
+			linux,phandle = <0x13>;
+			phandle = <0x13>;
+		};
+
+		ubootenv {
+			offset = <0x100000>;
+			size = <0x10000>;
+			linux,phandle = <0x14>;
+			phandle = <0x14>;
+		};
+	};
+
+	nand {
+		compatible = "amlogic,aml_nand";
+		dev_name = "nand";
+		status = "ok";
+		reg = <0xd0048600 0x24>;
+		pinctrl-names = "nand_rb_mod", "nand_norb_mod";
+		pinctrl-0 = <0x15 0x16 0x17>;
+		pinctrl-1 = <0x15 0x16 0x17>;
+		device_id = <0x0>;
+		plat-names = "nandnormal";
+		plat-num = <0x1>;
+		plat-part-0 = <0x18>;
+
+		normal {
+			enable_pad = "ce0", "ce1", "ce2", "ce3";
+			busy_pad = "rb0";
+			linux,phandle = <0x18>;
+			phandle = <0x18>;
+		};
+	};
+
+	efuse {
+		compatible = "amlogic,efuse";
+		dev_name = "efuse";
+		status = "okay";
+		plat-pos = <0x0 0x1c6>;
+		plat-count = <0x3a>;
+		usid-min = <0x8>;
+		usid-max = <0x1f>;
+	};
+
+	thermal {
+		compatible = "amlogic-thermal";
+		#thermal-cells = <0x7>;
+		dev_name = "aml_thermal";
+		trip_point = <0x46 0x16b481 0x16b481 0x1ff 0x1ff 0x3 0x2 0x50 0x124f81 0x124f81 0x1b3 0x1b3 0x2 0x2 0x5a 0xc3501 0xc3501 0x148 0x148 0x1 0x1 0x6e 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff>;
+		cpu_cali_a = <0x0>;
+		idle_interval = <0x3e8>;
+		use_virtual_thermal;
+		freq_sample_period = <0x1e>;
+		report_time = <0x1 0xa 0x1e 0x3c>;
+		cpu_virtual = <0x7a120 0x28 0x28 0x28 0x28 0x927c0 0x2d 0x37 0x3c 0x41 0xc3500 0x32 0x3c 0x41 0x46 0xf4240 0x37 0x41 0x46 0x4b 0x124f80 0x3c 0x46 0x4b 0x50 0x149970 0x41 0x4b 0x50 0x55>;
+		gpu_virtual = <0xb7 0x28 0x28 0x28 0x28 0xfb 0x28 0x2d 0x32 0x37 0x13f 0x32 0x3c 0x41 0x46 0x1aa 0x37 0x41 0x46 0x4b 0x1ff 0x3c 0x46 0x4b 0x50>;
+	};
+
+	securitykey {
+		compatible = "amlogic,aml_keys";
+		status = "ok";
+	};
+
+	unifykey {
+		compatible = "amlogic,unifykey";
+		status = "ok";
+		unifykey-num = <0x6>;
+		unifykey-index-0 = <0x19>;
+		unifykey-index-1 = <0x1a>;
+		unifykey-index-2 = <0x1b>;
+		unifykey-index-3 = <0x1c>;
+		unifykey-index-4 = <0x1d>;
+		unifykey-index-5 = <0x1e>;
+
+		key_0 {
+			key-name = "usid";
+			key-device = "nandkey";
+			key-dataformat = "allascii";
+			key-permit = "read", "write", "del";
+			linux,phandle = <0x19>;
+			phandle = <0x19>;
+		};
+
+		key_1 {
+			key-name = "mac";
+			key-device = "nandkey";
+			key-dataformat = "hexdata";
+			key-permit = "read", "write", "del";
+			linux,phandle = <0x1a>;
+			phandle = <0x1a>;
+		};
+
+		key_2 {
+			key-name = "hdcp";
+			key-device = "nandkey";
+			key-dataformat = "hexdata";
+			key-permit = "read", "write", "del";
+			linux,phandle = <0x1b>;
+			phandle = <0x1b>;
+		};
+
+		key_3 {
+			key-name = "secure_boot_set";
+			key-device = "efusekey";
+			key-dataformat = "hexdata";
+			key-permit = "read", "write";
+			linux,phandle = <0x1c>;
+			phandle = <0x1c>;
+		};
+
+		key_4 {
+			key-name = "mac_bt";
+			key-device = "nandkey";
+			key-dataformat = "hexdata";
+			key-permit = "read", "write", "del";
+			linux,phandle = <0x1d>;
+			phandle = <0x1d>;
+		};
+
+		key_5 {
+			key-name = "mac_wifi";
+			key-device = "nandkey";
+			key-dataformat = "hexdata";
+			key-permit = "read", "write", "del";
+			linux,phandle = <0x1e>;
+			phandle = <0x1e>;
+		};
+	};
+
+	amhdmitx {
+		compatible = "amlogic,amhdmitx";
+		dev_name = "amhdmitx";
+		status = "ok";
+		vend-data = <0x1f>;
+		pwr-ctrl = <0x20>;
+
+		vend_data {
+			vendor_name = "Amlogic";
+			vendor_id = <0x0>;
+			product_desc = "M8 MBox SKTv1";
+			cec_osd_string = "Amlogic MBox";
+			linux,phandle = <0x1f>;
+			phandle = <0x1f>;
+		};
+
+		pwr_ctrl {
+			pwr_5v_on = [00];
+			pwr_5v_off = [00];
+			pwr_3v3_on = [00];
+			pwr_3v3_off = [00];
+			pwr_hpll_vdd_on = [00];
+			pwr_hpll_vdd_off = [00];
+			linux,phandle = <0x20>;
+			phandle = <0x20>;
+		};
+	};
+
+	aml_pm {
+		compatible = "amlogic,pm-m8";
+		dev_name = "aml_pm_m8";
+		status = "okay";
+	};
+
+	cpufreq-meson {
+		compatible = "amlogic,cpufreq-meson";
+		status = "okay";
+	};
+
+	gpio {
+		compatible = "amlogic,m8b-gpio";
+		dev_name = "gpio";
+		#gpio-cells = <0x2>;
+	};
+
+	pinmux {
+		compatible = "amlogic,pinmux-m8b";
+		dev_name = "pinmux";
+		#pinmux-cells = <0x2>;
+
+		b_uart {
+			amlogic,setmask = <0x4 0x3c0>;
+			amlogic,pins = "GPIOX_16", "GPIOX_17", "GPIOX_18", "GPIOX_19";
+			linux,phandle = <0x3>;
+			phandle = <0x3>;
+		};
+
+		nand_input {
+			amlogic,pins = "BOOT_0", "BOOT_1", "BOOT_2", "BOOT_3", "BOOT_4", "BOOT_5", "BOOT_6", "BOOT_7", "BOOT_12", "BOOT_13", "BOOT_8", "BOOT_9", "BOOT_10", "BOOT_11", "BOOT_14", "BOOT_15", "BOOT_16", "BOOT_17";
+			amlogic,enable-output = <0x1>;
+			linux,phandle = <0x15>;
+			phandle = <0x15>;
+		};
+
+		conf_nand {
+			amlogic,pins = "BOOT_0", "BOOT_1", "BOOT_2", "BOOT_3", "BOOT_4", "BOOT_5", "BOOT_6", "BOOT_7", "BOOT_15";
+			amlogic,pullup = <0x0>;
+			linux,phandle = <0x16>;
+			phandle = <0x16>;
+		};
+
+		nand {
+			amlogic,setmask = <0x2 0x7fe0000>;
+			amlogic,clrmask = <0x5 0xe 0x6 0x3f000000 0x4 0x7c000000>;
+			amlogic,pins = "BOOT_0", "BOOT_1", "BOOT_2", "BOOT_3", "BOOT_4", "BOOT_5", "BOOT_6", "BOOT_7", "BOOT_8", "BOOT_9", "BOOT_10", "BOOT_12", "BOOT_13", "BOOT_14", "BOOT_15", "BOOT_16", "BOOT_17";
+			linux,phandle = <0x17>;
+			phandle = <0x17>;
+		};
+
+		sdhc_b_pin {
+			amlogic,setmask = <0x2 0xfc00>;
+			amlogic,clrmask = <0x2 0xf0 0x8 0x600>;
+			amlogic,pins = "CARD_0", "CARD_1", "CARD_2", "CARD_3", "CARD_4", "CARD_5";
+		};
+
+		sdhc_c_pin {
+			amlogic,setmask = <0x6 0x3f000000>;
+			amlogic,clrmask = <0x4 0x6c000000 0x2 0x4c00000>;
+			amlogic,pins = "BOOT_0", "BOOT_1", "BOOT_2", "BOOT_3", "BOOT_10", "BOOT_11";
+		};
+
+		sdhc_a_pin {
+			amlogic,setmask = <0x8 0x3f>;
+			amlogic,clrmask = <0x5 0x6c00>;
+			amlogic,pins = "GPIOX_0", "GPIOX_1", "GPIOX_2", "GPIOX_3", "GPIOX_8", "GPIOX_9";
+		};
+
+		sdio_all_pins {
+			amlogic,setmask = <0x8 0x3f>;
+			amlogic,clrmask = <0x6 0x3f000000 0x2 0xfc00 0x5 0x6c00>;
+			amlogic,pins = "GPIOX_0", "GPIOX_1", "GPIOX_2", "GPIOX_3", "GPIOX_8", "GPIOX_9";
+			amlogic,enable-output = <0x1>;
+			amlogic,pullup = <0x1>;
+			amlogic,pullupen = <0x1>;
+			linux,phandle = <0x9>;
+			phandle = <0x9>;
+		};
+
+		sdio_clk_cmd_pins {
+			amlogic,setmask = <0x8 0x3>;
+			amlogic,clrmask = <0x6 0x3f000000 0x2 0xfc00 0x5 0x6c00>;
+			amlogic,pins = "GPIOX_8", "GPIOX_9";
+			amlogic,enable-output = <0x1>;
+			amlogic,pullup = <0x1>;
+			amlogic,pullupen = <0x1>;
+			linux,phandle = <0x8>;
+			phandle = <0x8>;
+		};
+
+		sd_all_pins {
+			amlogic,setmask = <0x2 0xfc00>;
+			amlogic,clrmask = <0x6 0x3f000000 0x8 0x63f 0x2 0xf0>;
+			amlogic,pins = "CARD_0", "CARD_1", "CARD_2", "CARD_3", "CARD_4", "CARD_5";
+			amlogic,enable-output = <0x1>;
+			amlogic,pullup = <0x1>;
+			amlogic,pullupen = <0x1>;
+			linux,phandle = <0x5>;
+			phandle = <0x5>;
+		};
+
+		sd_1bit_pins {
+			amlogic,setmask = <0x2 0x8c00>;
+			amlogic,clrmask = <0x6 0x3f000000 0x8 0x3f 0x2 0xf0>;
+			amlogic,pins = "CARD_0", "CARD_1", "CARD_2", "CARD_3", "CARD_4", "CARD_5";
+			amlogic,enable-output = <0x1>;
+			amlogic,pullup = <0x1>;
+			amlogic,pullupen = <0x1>;
+			linux,phandle = <0xa>;
+			phandle = <0xa>;
+		};
+
+		sd_clk_cmd_pins {
+			amlogic,setmask = <0x2 0xc00>;
+			amlogic,clrmask = <0x6 0x3f000000 0x8 0x3f 0x2 0xf0>;
+			amlogic,pins = "CARD_2", "CARD_3";
+			amlogic,enable-output = <0x1>;
+			amlogic,pullup = <0x1>;
+			amlogic,pullupen = <0x1>;
+			linux,phandle = <0x4>;
+			phandle = <0x4>;
+		};
+
+		emmc_all_pins {
+			amlogic,setmask = <0x6 0xfc000000>;
+			amlogic,clrmask = <0x2 0x6c2fc00 0x8 0x3f 0x4 0x6c000000>;
+			amlogic,pins = "BOOT_0", "BOOT_1", "BOOT_2", "BOOT_3", "BOOT_8", "BOOT_10";
+			amlogic,enable-output = <0x1>;
+			amlogic,pullup = <0x1>;
+			amlogic,pullupen = <0x1>;
+			linux,phandle = <0x7>;
+			phandle = <0x7>;
+		};
+
+		emmc_clk_cmd_pins {
+			amlogic,setmask = <0x6 0xc0000000>;
+			amlogic,clrmask = <0x2 0x6c2fc00 0x8 0x3f 0x7 0xc0000>;
+			amlogic,pins = "BOOT_8", "BOOT_10";
+			amlogic,enable-output = <0x1>;
+			amlogic,pullup = <0x1>;
+			amlogic,pullupen = <0x1>;
+			linux,phandle = <0x6>;
+			phandle = <0x6>;
+		};
+
+		sdhc_sd_clk_cmd_pins {
+			amlogic,setmask = <0x2 0x30>;
+			amlogic,clrmask = <0x5 0x7c00 0x4 0x7c000000 0x2 0xfc00 0x8 0x600>;
+			amlogic,pins = "CARD_2", "CARD_3";
+			amlogic,enable-output = <0x1>;
+			amlogic,pullup = <0x1>;
+			amlogic,pullupen = <0x1>;
+		};
+
+		sdhc_sd_all_pins {
+			amlogic,setmask = <0x2 0xf0>;
+			amlogic,clrmask = <0x5 0x7c00 0x4 0x7c000000 0x2 0xfc00 0x8 0x600>;
+			amlogic,pins = "CARD_0", "CARD_1", "CARD_2", "CARD_3", "CARD_4", "CARD_5";
+			amlogic,enable-output = <0x1>;
+			amlogic,pullup = <0x1>;
+			amlogic,pullupen = <0x1>;
+		};
+
+		sdhc_emmc_clk_cmd_pins {
+			amlogic,setmask = <0x4 0xc000000>;
+			amlogic,clrmask = <0x2 0x4c000f0 0x5 0x7c00 0x6 0x3f000000>;
+			amlogic,pins = "BOOT_16", "BOOT_17";
+			amlogic,enable-output = <0x1>;
+			amlogic,pullup = <0x1>;
+			amlogic,pullupen = <0x1>;
+		};
+
+		sdhc_emmc_all_pins {
+			amlogic,setmask = <0x4 0x7c000000>;
+			amlogic,clrmask = <0x2 0x4c000f0 0x5 0x7c00 0x6 0x3f000000>;
+			amlogic,pins = "BOOT_0", "BOOT_1", "BOOT_2", "BOOT_3", "BOOT_4", "BOOT_5", "BOOT_6", "BOOT_7", "BOOT_16", "BOOT_17";
+			amlogic,enable-output = <0x1>;
+			amlogic,pullup = <0x1>;
+			amlogic,pullupen = <0x1>;
+		};
+
+		sdhc_sdio_clk_cmd_pins {
+			amlogic,setmask = <0x5 0xc00>;
+			amlogic,clrmask = <0x2 0x58000f0 0x4 0x7c000000 0x8 0x3f>;
+			amlogic,pins = "GPIOX_8", "GPIOX_9";
+			amlogic,enable-output = <0x1>;
+			amlogic,pullup = <0x1>;
+			amlogic,pullupen = <0x1>;
+		};
+
+		sdhc_sdio_all_pins {
+			amlogic,setmask = <0x5 0x6c00>;
+			amlogic,clrmask = <0x2 0x58000f0 0x4 0x7c000000 0x8 0x3f>;
+			amlogic,pins = "GPIOX_0", "GPIOX_1", "GPIOX_2", "GPIOX_3", "GPIOX_8", "GPIOX_9";
+			amlogic,enable-output = <0x1>;
+			amlogic,pullup = <0x1>;
+			amlogic,pullupen = <0x1>;
+		};
+
+		aml_cam_gpio_pins {
+			amlogic,setmask = <0x3 0x80000 0x9 0x37c>;
+			amlogic,pins = "GPIOH_9", "GPIOY_6", "GPIOY_7", "GPIOY_8", "GPIOY_9", "GPIOY_10", "GPIOY_11", "GPIOY_12", "GPIOY_13", "GPIOY_14";
+			linux,phandle = <0xf>;
+			phandle = <0xf>;
+		};
+
+		aml_cam_csi_pins {
+			amlogic,setmask = <0x3 0x80000>;
+			amlogic,pins = "GPIOH_9";
+			linux,phandle = <0x10>;
+			phandle = <0x10>;
+		};
+
+		ao_i2c {
+			amlogic,setmask = <0xa 0x60>;
+			amlogic,clrmask = <0xa 0x1800006>;
+			amlogic,pins = "GPIOAO_4", "GPIOAO_5";
+			linux,phandle = <0xb>;
+			phandle = <0xb>;
+		};
+
+		b_i2c {
+			amlogic,setmask = <0x9 0x30000000>;
+			amlogic,clrmask = <0x0 0x480 0x6 0x300000 0x8 0x10780000>;
+			amlogic,pins = "GPIODV_26", "GPIODV_27";
+			linux,phandle = <0xc>;
+			phandle = <0xc>;
+		};
+
+		remote_pin {
+			amlogic,setmask = <0xa 0x1>;
+			amlogic,pins = "GPIOAO_7";
+			linux,phandle = <0x11>;
+			phandle = <0x11>;
+		};
+
+		audio_pin {
+			amlogic,setmask = <0xa 0x78000000 0x1 0x80>;
+			amlogic,clrmask = <0xa 0x80002000 0x1 0x10000 0x3 0x40000>;
+			amlogic,pins = "GPIOAO_8", "GPIOAO_9", "GPIOAO_10", "GPIOAO_11", "GPIOY_3";
+			linux,phandle = <0xe>;
+			phandle = <0xe>;
+		};
+
+		aml_spi_nor_pins {
+			amlogic,setmask = <0x5 0xf>;
+			amlogic,clrmask = <0x2 0x10380000>;
+			amlogic,pins = "BOOT_11", "BOOT_12", "BOOT_13", "BOOT_18";
+			linux,phandle = <0x12>;
+			phandle = <0x12>;
+		};
+
+		aml_pwm {
+			amlogic,setmask = <0x3 0x1000000>;
+			amlogic,clrmask = <0x0 0x48 0x7 0x10000020>;
+			amlogic,pins = "GPIODV_9";
+			linux,phandle = <0xd>;
+			phandle = <0xd>;
+		};
+	};
+
+	meson-eth {
+		compatible = "amlogic,meson-eth";
+		dev_name = "meson-eth";
+		status = "okay";
+		ethbaseaddr = <0xfe0c0000>;
+		interruptnum = <0x28>;
+		new_maclogic = <0x1>;
+	};
+};
diff --git a/sources/Linux/Amlogic/M201/create-3.10.33-20160716-m201-dtbs-patch/linux-aml-3.10.33-20160716-new/arch/arm/boot/dts/amlogic/meson8b_m201_1G.dtd b/sources/Linux/Amlogic/M201/create-3.10.33-20160716-m201-dtbs-patch/linux-aml-3.10.33-20160716-new/arch/arm/boot/dts/amlogic/meson8b_m201_1G.dtd
new file mode 100644
index 000000000..be8bfdfdc
--- /dev/null
+++ b/sources/Linux/Amlogic/M201/create-3.10.33-20160716-m201-dtbs-patch/linux-aml-3.10.33-20160716-new/arch/arm/boot/dts/amlogic/meson8b_m201_1G.dtd
@@ -0,0 +1,2071 @@
+/dts-v1/;
+/// ***************************************************************************************\n
+//$$ PROJECT="meson8b"
+//$$ REMOVE 1
+void root_func(){
+//$$ ADD /{
+	amlogic-dt-id = "m8b_m201_1G";
+	compatible = "AMLOGIC,8726_M8B";
+	model = "AMLOGIC";
+	interrupt-parent = <&gic>;
+	#address-cells = <1>;
+	#size-cells = <1>;
+	
+/// ***************************************************************************************
+///	-	CPU
+//$$ MODULE="CPU"
+    cpus {
+        #address-cells = <1>;
+        #size-cells = <0>;
+//$$ DEVICE="cpu0"
+        cpu@0 {
+        	device_type = "cpu";
+        	compatible = "arm,cortex-a5";
+        	reg = <0x200>;
+        };
+//$$ DEVICE="cpu1"
+        cpu@1 {
+        	device_type = "cpu";
+        	compatible = "arm,cortex-a5";
+        	reg = <0x1>;
+        };
+//$$ DEVICE="cpu2"
+        cpu@2 {
+        	device_type = "cpu";
+        	compatible = "arm,cortex-a5";
+        	reg = <0x2>;
+        };
+//$$ DEVICE="cpu3"
+        cpu@3 {
+        	device_type = "cpu";
+        	compatible = "arm,cortex-a5";
+        	reg = <0x3>;
+        };
+    };
+
+/// ***************************************************************************************
+///	-	Cache
+//$$ MODULE="Cache"
+//$$ DEVICE="cache"
+    cache-controller {
+          compatible = "arm,meson-pl310-cache";
+          reg = <0xc4200000 0x1000>;
+          arm,data-latency = <3 3 3>;
+          arm,tag-latency = <2 2 2>;
+          arm,filter-ranges = <0x100000 0xc0000000>;
+          cache-unified;
+          cache-level = <2>;
+          aux-instruction_prefetch;
+          aux-data_prefetch;
+          aux-ns_lockdown;
+          aux-force_no_write_alloc;
+          aux-cache_replace_policy_round_robin;
+          aux-early_write_response;
+          aux-full_line_of_zero;
+          aux-ns_int_ctrl;
+          aux-share_override;
+          prefetch-double_line_fill;
+          prefetch-prefetch_drop;
+          prefetch-prefetch_offset = <7>;
+    };
+
+/// ***************************************************************************************
+///	-	Memory
+//$$ MODULE="Memory"
+//$$ DEVICE="memory"
+//$$ L2 PROP_U32 = "aml_reserved_start"
+//$$ L2 PROP_U32 = "aml_reserved_end"
+//$$ L2 PROP_U32 6 = "linux,usable-memory"
+	memory{
+		device_type = "memory";
+		aml_reserved_start = <0x06000000>; /**reserved memory start */
+		aml_reserved_end = <0x05000000>;/**reserved memory end : dtb start for uboot*/
+		phys_offset = <0x00200000>;
+		linux,total-memory = <0x3fe00000>;
+        #address-cells = <1>;
+        #size-cells = <1>;
+
+        cma_0:region@0 {
+           region_name = "cma_0";
+           reg = <0 0x01200000>;
+           linux,contiguous-region;
+        };
+	};
+/// ***************************************************************************************
+///	-	GIC
+//$$ MODULE="GIC"
+//$$ DEVICE="gic"	
+	gic:interrupt-controller{
+        compatible = "arm,cortex-a9-gic";
+        reg = <0xc4301000 0x1000
+               0xc4300100 0x0100>;
+        interrupt-controller;
+        #interrupt-cells = <3>;
+        #address-cells = <0>;
+    };
+    
+/// ***************************************************************************************
+///	-	VPU
+//$$ MODULE="VPU"
+//$$ DEVICE="vpu"
+//$$ L2 PROP_STR = "status"
+//$$ L2 PROP_U32 = "clk_level"
+    vpu{
+		compatible = "amlogic,vpu";
+		dev_name = "vpu";	
+		status = "ok";
+		clk_level = <3>;
+		/**    	0: 106.25M		1: 127.5M		2: 159.375M
+				3: 182.15M		4: 212.5M	 */
+	};
+	
+/// **************************************************************************************	
+/// -   DISP&MM-FB
+//$$ MODULE = "DISP&MM-FB"	
+//$$ DEVICE = "mesonfb"
+//$$ L2 PROP_STR = "status"
+//$$ L3 PROP_U32 4 ="reg"
+//$$ L2 PROP_U32 = "vmode"
+//$$ L2 PROP_U32 5 = "display_size_default"
+	mesonfb{
+		compatible = "amlogic,mesonfb";
+		dev_name = "mesonfb";
+		status = "okay";
+		reserve-memory = <0x01800000 0x00100000>;
+		reserve-iomap = "true";
+		vmode = <3>; /* 0:VMODE_720P 1:VMODE_LCD 2:VMODE_LVDS_1080P 3:VMODE_1080P */
+		scale_mode = <1>; /* 0:default 1:new */
+		4k2k_fb = <0>;
+		display_size_default = <1920 1080 1920 3240 32>; /* osd0:24M, osd1:1m  1920*1080*4*3 = 0x17BB000 */
+	};
+
+//$$ DEVICE="deinterlace"
+//$$ L2 PROP_STR = "status"
+//$$ L2 PROP_U32 2 = "reg"
+    deinterlace{
+		compatible = "amlogic,deinterlace";
+		dev_name = "deinterlace";
+		status = "ok";
+		reserve-memory = <0x02100000>; //10x1920x1088x3/2=33M
+	};
+
+/// ***************************************************************************************
+///	-	DISP&MM-A/V stream
+//$$ MODULE = "DISP&MM-A/V stream"
+//$$ DEVICE="mesonstream"
+//$$ L2 PROP_STR = "status"
+//$$ L3 PROP_U32 4 ="reg"
+	mesonstream{
+		compatible = "amlogic,mesonstream";
+		dev_name = "mesonstream.0";
+		status = "okay";
+		reserve-memory = <0x02000000>; // 32M
+		reserve-iomap = "true";
+	};
+
+/// ***************************************************************************************
+///     -       DISP&MM-A/V stream
+//$$ MODULE = "DISP&MM-A/V video dec"
+//$$ DEVICE="vdec"
+//$$ L2 PROP_STR = "status"
+//$$ L3 PROP_U32 4 ="reg"
+        vdec{
+                compatible = "amlogic,vdec";
+                dev_name = "vdec.0";
+                status = "okay";
+                reserve-memory = <0x04000000>; // 64M
+                reserve-iomap = "true";
+        };
+
+/// ***************************************************************************************
+///	-	DISP&MM-PostProcess
+//$$ MODULE="DISP&MM-PostProcess"
+//$$ DEVICE="ppmgr"
+//$$ L2 PROP_STR = "status"
+//$$ L3 PROP_U32 2 ="reg"
+    ppmgr{
+		compatible = "amlogic,ppmgr";
+		dev_name = "ppmgr";
+		status = "okay";
+		reserve-memory = <0x01000000>; // 16M
+	};
+
+/// ***************************************************************************************
+///	-	DISP&MM-AVC Video Encoder
+//$$ MODULE = "DISP&MM-AVC Video Encoder"
+//$$ DEVICE="amvenc_avc"
+//$$ L2 PROP_STR = "status"
+//$$ L3 PROP_U32 2 ="reg"
+    amvenc_avc{
+		compatible = "amlogic,amvenc_avc";
+		dev_name = "amvenc_avc.0";
+		status = "okay";
+		linux,contiguous-region = <&cma_0>;
+		reserve-iomap = "true";
+	};
+
+/// ***************************************************************************************
+///	-	DISP&MM-BT656
+//$$ MODULE = "DISP&MM-BT656"
+//$$ DEVICE="amvdec_656in"
+//$$ L2 PROP_STR = "status"
+//$$ L2 PROP_U32 2 = "reg"
+//    amvdec_656in{
+//		compatible = "amlogic,amvdec_656in";
+//		dev_name = "amvdec_656in";
+//		status = "ok";
+//		reg = <0x1e400000 0x00100000>;
+//	};
+//	
+/// ***************************************************************************************
+///	-	DISP&MM-VDIN
+//$$ MODULE = "DISP&MM-VDIN"
+//$$ DEVICE="vdin0"
+//$$ L2 PROP_STR = "status"
+//$$ L2 PROP_U32 2 = "reg"
+//$$ L2 PROP_U32 = "irq"
+//$$ L2 PROP_U32 = "vdin_id"
+//    vdin0{
+//       compatible = "amlogic,vdin";
+//        dev_name = "vdin0";
+//        status = "ok";
+//	 reserve-memory = <0x04000000>;
+//        irq = <115>;
+//        vdin_id = <0>;
+//	};
+	
+//$$ DEVICE="vdin1"
+//$$ L2 PROP_STR = "status"
+//$$ L2 PROP_U32 2 = "reg"
+//$$ L2 PROP_U32 = "irq"
+//$$ L2 PROP_U32 = "vdin_id"
+//    vdin1{
+//        compatible = "amlogic,vdin";
+//       dev_name = "vdin1";
+//        status = "ok";
+//        reserve-memory = <0x01000000>;
+//	  miracast_size = <1920 1080>;//1920x1080x2x4=17M
+//	  reserve-iomap = "true";
+//        irq = <117>;
+//        vdin_id = <1>;
+//	};
+
+/// ***************************************************************************************
+///	-	DISP&MM-AMLVIDEO2
+//$$ MODULE = "DISP&MM-AMLVIDEO2"
+//$$ DEVICE="amlvideo2"
+//$$ L2 PROP_STR = "status"
+//$$ L3 PROP_U32 2 ="reg"
+//    amlvideo2{
+//		compatible = "amlogic,amlvideo2";
+//		dev_name = "amlvideo2.0";
+//		status = "okay";
+//		reserve-memory = <0x01800000>;
+//		reserve-iomap = "true";
+//	};
+
+/// ***************************************************************************************
+///	-	DISP&MM-Video Input Manager
+//$$ MODULE = "DISP&MM-Video Input Manager"
+//$$ DEVICE="vm"
+//$$ L2 PROP_STR = "status"
+//    vm{
+//		compatible = "amlogic,vm";
+//		dev_name = "vm.0";
+//		status = "okay";
+//		reserve-memory = <0x01800000>;
+//		reserve-iomap = "true";
+//	};
+
+/// ***************************************************************************************
+///	-	ION
+//$$ MODULE="ION"
+//$$ DEVICE="ion_dev"
+//$$ L2 PROP_STR = "status"
+    ion_dev{
+        compatible = "amlogic,ion_dev";
+        dev_name = "ion_dev";
+        status = "ok";
+        share-memory-name = "ppmgr0";
+        share-memory-offset = <0>;
+        share-memory-size = <0x01000000>; //16M
+    };
+/// ***************************************************************************************
+///	-	DISP&MM-Vout
+//$$ MODULE = "DISP&MM-Vout"
+//$$ DEVICE = "mesonvout"
+//$$ L2 PROP_STR = "status"
+	mesonvout{
+		compatible = "amlogic,mesonvout";
+		dev_name = "mesonvout";
+		status = "okay";
+	};
+
+/// ***************************************************************************************
+///	-	RTC
+//$$ MODULE="RTC"
+//$$ DEVICE="Rtc"
+//$$ L2 PROP_STR = "status"
+    rtc{
+		compatible = "amlogic,aml_rtc";
+		status = "okay";
+	};
+
+/// ***************************************************************************************
+///	-	UART
+//$$ MODULE="UART"
+//$$ DEVICE="uart_ao"
+//$$ L2 PROP_STR = "status"
+//$$ L2 PROP_STR = "pinctrl-names"
+//$$ L3 PROP_CHOICE "uart_ao_pin_match" = "pinctrl-0"
+	uart_ao{
+		compatible = "amlogic,aml_uart";
+		port_name = "uart_ao";
+		status = "okay";
+		dev_name = "uart_ao";
+		pinctrl-names = "default";
+		pinctrl-0 = <&ao_uart_pins>;
+	};
+	
+//$$ DEVICE="uart_0"
+//$$ L2 PROP_STR = "status"
+	uart_0{
+		compatible = "amlogic,aml_uart";
+		port_name = "uart_a";
+		status = "okay";
+		dev_name = "uart_0";
+//    	pinctrl-names = "default";
+//    	pinctrl-0 = <&a_uart_pins>;
+	};
+	
+//$$ DEVICE="uart_1"
+//$$ L2 PROP_STR = "status"
+	uart_1{
+		compatible = "amlogic,aml_uart";
+		port_name = "uart_b";
+		status = "okay";
+		dev_name = "uart_1";
+        pinctrl-names = "default";
+        pinctrl-0 = <&b_uart_pins>;
+	};
+	
+//$$ DEVICE="uart_2"
+//$$ L2 PROP_STR = "status"
+	uart_2{
+		compatible = "amlogic,aml_uart";
+		port_name = "uart_c";
+		status = "disabled";
+		dev_name = "uart_2";
+	};
+	
+//$$ DEVICE="uart_3"
+//$$ L2 PROP_STR = "status"	
+	uart_3{
+		compatible = "amlogic,aml_uart";
+		port_name = "uart_d";
+		status = "ok";
+		dev_name = "uart_3";
+	};
+
+/// ***************************************************************************************
+///	-	Bluetooth
+//$$ MODULE="Bluetooth"
+//$$ DEVICE="bt-dev"
+//$$ L2 PROP_STR = "status"
+//$$ L2 PROP_STR = "gpio_reset"
+    bt-dev{
+        compatible = "amlogic,bt-dev";
+        dev_name = "bt-dev";
+        status = "ok";
+        gpio_reset = "GPIOX_20";
+    };
+/// ***************************************************************************************
+///	-	WiFi
+//$$ MODULE="WiFi"
+//$$ DEVICE="aml_broadcm_wifi"
+//$$ L2 PROP_STR = "status"
+//$$ L2 PROP_STR = "interrupt_pin"
+//$$ L2 PROP_U32 = "irq_num"
+//$$ L2 PROP_STR = "irq_trigger_type"
+//$$ L2 PROP_STR = "power_on_pin"
+//$$ L2 PROP_STR = "clock_32k_pin"
+    wifi{
+		compatible = "amlogic,aml_broadcm_wifi";
+		dev_name = "aml_broadcm_wifi";
+		status = "okay";
+		interrupt_pin = "GPIOX_21";
+		irq_num = <4>;
+		irq_trigger_type = "GPIO_IRQ_HIGH";
+		power_on_pin = "GPIOAO_6";
+		power_on_pin2 = "GPIOX_11";
+		clock_32k_pin = "GPIOX_10";
+	};
+	
+//$$ DEVICE="wifi_power"
+//$$ L2 PROP_STR = "status"
+//$$ L2 PROP_STR = "power_gpio"
+	wifi_power{
+            compatible = "amlogic,wifi_power";
+            dev_name = "wifi_power";
+            status = "okay";
+            power_gpio = "GPIOAO_6";
+            power_gpio2 = "GPIOX_11";
+	}; 
+
+/// ***************************************************************************************
+///	-	MMC
+//$$ MODULE="MMC"
+//$$ DEVICE="aml_sdio"
+//$$ L2 PROP_STR = "status"
+//$$ L3 PROP_U32 2 ="reg"
+//$$ L2 PROP_STR 7 = "pinctrl-names"
+//$$ L2 PROP_CHOICE "sdio_pin_0_match" = "pinctrl-0"
+//$$ L2 PROP_CHOICE "sdio_pin_1_match" = "pinctrl-1"
+//$$ L2 PROP_CHOICE "sdio_pin_2_match" = "pinctrl-2"
+//$$ L2 PROP_CHOICE "sdio_pin_3_match" = "pinctrl-3"
+//$$ L2 PROP_CHOICE "sdio_pin_4_match" = "pinctrl-4"
+//$$ L2 PROP_CHOICE "sdio_pin_5_match" = "pinctrl-5"
+//$$ L2 PROP_CHOICE "sdio_pin_6_match" = "pinctrl-6"
+    sdio{
+        compatible = "amlogic,aml_sdio";
+        dev_name = "aml_sdio.0";
+        status = "okay";
+        reg = <0xc1108c20 0x20>;
+        pinctrl-names = "sd_clk_cmd_pins", "sd_all_pins", "emmc_clk_cmd_pins", "emmc_all_pins", "sdio_clk_cmd_pins", "sdio_all_pins","sd_1bit_pins"; // "jtag_pin", "uartao_default";
+        pinctrl-0 = <&sd_clk_cmd_pins>;
+        pinctrl-1 = <&sd_all_pins>;
+        pinctrl-2 = <&emmc_clk_cmd_pins>;
+        pinctrl-3 = <&emmc_all_pins>;
+        pinctrl-4 = <&sdio_clk_cmd_pins>;
+        pinctrl-5 = <&sdio_all_pins>;
+        pinctrl-6 = <&sd_1bit_pins>;
+
+//$$ DEVICE="sd"
+//$$ L2 PROP_STR = "status"
+//$$ L3 PROP_U32 = "port"
+//$$ L2 PROP_STR = "pinname"
+//$$ L3 PROP_U32 = "ocr_avail"
+//$$ L2 PROP_STR 3 = "caps"
+//$$ L3 PROP_U32 = "f_min"
+//$$ L3 PROP_U32 = "f_max"
+//$$ L3 PROP_U32 = "f_max_w"
+//$$ L3 PROP_U32 = "max_req_size"
+//$$ L2 PROP_STR = "gpio_dat3"
+//$$ L2 PROP_STR = "jtag_pin"
+//$$ L2 PROP_STR = "gpio_cd"
+//$$ L2 PROP_STR = "gpio_ro"
+//$$ L2 PROP_U32 = "irq_in"
+//$$ L2 PROP_U32 = "irq_out"
+//$$ L2 PROP_U32 = "card_type"
+      sd{
+            status = "okay";
+            port = <1>;          /**0:sdio_a, 1:sdio_b, 2:sdio_c, 3:sdhc_a, 4:sdhc_b, 5:sdhc_c */
+            pinname = "sd";
+            ocr_avail = <0x200000>;          /**VDD voltage 3.3 ~ 3.4 */
+            caps = "MMC_CAP_4_BIT_DATA","MMC_CAP_MMC_HIGHSPEED","MMC_CAP_SD_HIGHSPEED";
+            f_min = <300000>;
+            f_max = <50000000>;
+            f_max_w = <50000000>;
+            max_req_size = <0x20000>;          /**128KB*/
+            gpio_dat3 = "CARD_4";
+            jtag_pin = "CARD_0";
+            gpio_cd = "CARD_6";
+//            gpio_ro = "GPIODV_25";
+            irq_in = <3>;
+            irq_out = <5>;
+            card_type = <5>; /* 0:unknown, 1:mmc card(include eMMC), 2:sd card(include tSD), 3:sdio device(ie:sdio-wifi), 4:SD combo (IO+mem) card, 5:NON sdio device(means sd/mmc card), other:reserved */
+        };
+
+//$$ DEVICE="emmc"
+//$$ L2 PROP_STR = "status"
+//$$ L3 PROP_U32 = "port"
+//$$ L2 PROP_STR = "pinname"
+//$$ L3 PROP_U32 = "ocr_avail"
+//$$ L2 PROP_STR 4 = "caps"
+//$$ L3 PROP_U32 = "f_min"
+//$$ L3 PROP_U32 = "f_max"
+//$$ L3 PROP_U32 = "f_max_w"
+//$$ L3 PROP_U32 = "max_req_size"
+//$$ L2 PROP_STR = "gpio_dat3"
+//$$ L2 PROP_U32 = "card_type"
+//        emmc{
+//            status = "ok";
+//            port = <2>;          /**0:sdio_a, 1:sdio_b, 2:sdio_c, 3:sdhc_a, 4:sdhc_b, 5:sdhc_c */
+//            pinname = "emmc";
+//            ocr_avail = <0x200000>;          /**VDD voltage 3.3 ~ 3.4 */
+//            caps = "MMC_CAP_4_BIT_DATA","MMC_CAP_MMC_HIGHSPEED","MMC_CAP_SD_HIGHSPEED", "MMC_CAP_NONREMOVABLE","MMC_CAP_ERASE", "MMC_CAP_HW_RESET"; // MMC_CAP_NEEDS_POLL -- for detect, MMC_CAP_NONREMOVABLE -- for eMMC/TSD
+//            f_min = <300000>;
+//            f_max = <50000000>;
+//            f_max_w = <50000000>;
+//            max_req_size = <0x20000>;          /**128KB*/
+//            gpio_dat3 = "BOOT_3";
+//            card_type = <1>; /* 0:unknown, 1:mmc card(include eMMC), 2:sd card(include tSD), 3:sdio device(ie:sdio-wifi), 4:SD combo (IO+mem) card, 5:NON sdio device(means sd/mmc card), other:reserved */
+//        };
+
+//$$ DEVICE="sdio"
+//$$ L2 PROP_STR = "status"
+//$$ L3 PROP_U32 = "port"
+//$$ L2 PROP_STR = "pinname"
+//$$ L3 PROP_U32 = "ocr_avail"
+//$$ L2 PROP_STR 4 = "caps"
+//$$ L3 PROP_U32 = "f_min"
+//$$ L3 PROP_U32 = "f_max"
+//$$ L3 PROP_U32 = "max_req_size"
+//$$ L2 PROP_U32 = "card_type"    
+        sdio{
+            status = "ok";
+            port = <0>;          /*0:sdio_a, 1:sdio_b, 2:sdio_c, 3:sdhc_a, 4:sdhc_b, 5:sdhc_c */
+            pinname = "sdio";
+            ocr_avail = <0x200000>;          /*VDD voltage 3.3 ~ 3.4 */
+            caps = "MMC_CAP_4_BIT_DATA","MMC_CAP_SDIO_IRQ","MMC_CAP_MMC_HIGHSPEED","MMC_CAP_SD_HIGHSPEED", "MMC_CAP_NONREMOVABLE";
+            f_min = <300000>;
+            f_max = <50000000>;
+            max_req_size = <0x20000>;          /**128KB*/
+            card_type = <3>; /* 0:unknown, 1:mmc card(include eMMC), 2:sd card(include tSD), 3:sdio device(ie:sdio-wifi), 4:SD combo (IO+mem) card, 5:NON sdio device(means sd/mmc card), other:reserved */
+        };
+    };
+
+/// ***************************************************************************************
+///	-	MMC
+//$$ MODULE="MMC"
+//$$ DEVICE="aml_sdhc"
+//$$ L2 PROP_STR = "status"
+//$$ L3 PROP_U32 2 ="reg"
+//$$ L2 PROP_STR 6 = "pinctrl-names"
+//$$ L2 PROP_CHOICE "sdhc_pin_0_match" = "pinctrl-0"
+//$$ L2 PROP_CHOICE "sdhc_pin_1_match" = "pinctrl-1"
+//$$ L2 PROP_CHOICE "sdhc_pin_2_match" = "pinctrl-2"
+//$$ L2 PROP_CHOICE "sdhc_pin_3_match" = "pinctrl-3"
+//$$ L2 PROP_CHOICE "sdhc_pin_4_match" = "pinctrl-4"
+//$$ L2 PROP_CHOICE "sdjc_pin_5_match" = "pinctrl-5"
+// L2 PROP_CHOICE "sdhc_pin_6_match" = "pinctrl-6"
+    sdhc{
+        compatible = "amlogic,aml_sdhc";
+        dev_name = "aml_sdhc.0";
+        status = "okay";
+        reg = <0xc1108e00 0x3c>;
+        pinctrl-names = "sdhc_sd_clk_cmd_pins", "sdhc_sd_all_pins", "sdhc_emmc_clk_cmd_pins", "sdhc_emmc_all_pins", "sdhc_sdio_clk_cmd_pins", "sdhc_sdio_all_pins";
+        pinctrl-0 = <&sdhc_sd_clk_cmd_pins>;
+        pinctrl-1 = <&sdhc_sd_all_pins>;
+        pinctrl-2 = <&sdhc_emmc_clk_cmd_pins>;
+        pinctrl-3 = <&sdhc_emmc_all_pins>;
+        pinctrl-4 = <&sdhc_sdio_clk_cmd_pins>;
+        pinctrl-5 = <&sdhc_sdio_all_pins>;
+        //pinctrl-6 = <&sd_1bit_pins>;
+
+//$$ DEVICE="sd"
+//$$ L2 PROP_STR = "status"
+//$$ L3 PROP_U32 = "port"
+//$$ L2 PROP_STR = "pinname"
+//$$ L3 PROP_U32 = "ocr_avail"
+//$$ L2 PROP_STR 3 = "caps"
+//$$ L3 PROP_U32 = "f_min"
+//$$ L3 PROP_U32 = "f_max"
+//$$ L3 PROP_U32 = "f_max_w"
+//$$ L3 PROP_U32 = "max_req_size"
+//$$ L2 PROP_STR = "gpio_dat3"
+//$$ L2 PROP_STR = "jtag_pin"
+//$$ L2 PROP_STR = "gpio_cd"
+//$$ L2 PROP_STR = "gpio_ro"
+//$$ L2 PROP_U32 = "irq_in"
+//$$ L2 PROP_U32 = "irq_out"
+//$$ L2 PROP_U32 = "card_type"
+//         sd{
+//             status = "okay";
+//             port = <4>;          /**0:sdhc_a, 1:sdio_b, 2:sdio_c, 3:sdhc_a, 4:sdhc_b, 5:sdhc_c */
+//             pinname = "sd";
+//             ocr_avail = <0x00200080>; // 3.3:0x200000, 1.8+3.3:0x00200080
+//             caps = "MMC_CAP_4_BIT_DATA","MMC_CAP_MMC_HIGHSPEED","MMC_CAP_SD_HIGHSPEED","MMC_CAP_UHS_SDR12","MMC_CAP_UHS_SDR25","MMC_CAP_UHS_SDR50","MMC_CAP_UHS_SDR104";
+//             f_min = <300000>;
+//             f_max = <100000000>;
+//             max_req_size = <0x20000>;          /**128KB*/
+//             gpio_dat3 = "CARD_4";
+//             //jtag_pin = "CARD_0";
+//             gpio_cd = "CARD_6";
+//             //gpio_ro = "GPIOZ_0";
+//             irq_in = <3>;
+//             irq_out = <5>;
+//             card_type = <5>; /* 0:unknown, 1:mmc card(include eMMC), 2:sd card(include tSD), 3:sdio device(ie:sdio-wifi), 4:SD combo (IO+mem) card, 5:NON sdio device(means sd/mmc card), other:reserved */
+//         };
+
+//$$ DEVICE="emmc"
+//$$ L2 PROP_STR = "status"
+//$$ L3 PROP_U32 = "port"
+//$$ L2 PROP_STR = "pinname"
+//$$ L3 PROP_U32 = "ocr_avail"
+//$$ L2 PROP_STR 4 = "caps"
+//$$ L3 PROP_U32 = "f_min"
+//$$ L3 PROP_U32 = "f_max"
+//$$ L3 PROP_U32 = "f_max_w"
+//$$ L3 PROP_U32 = "max_req_size"
+//$$ L2 PROP_STR = "gpio_dat3"
+//$$ L2 PROP_U32 = "card_type"
+        emmc{
+            status = "okay";
+            port = <5>;          /**0:sdio_a, 1:sdio_b, 2:sdio_c, 3:sdhc_a, 4:sdhc_b, 5:sdhc_c */
+            pinname = "emmc";
+            ocr_avail = <0x200000>;          /**VDD voltage 3.3 ~ 3.4 */
+            caps = "MMC_CAP_8_BIT_DATA","MMC_CAP_MMC_HIGHSPEED","MMC_CAP_SD_HIGHSPEED", "MMC_CAP_NONREMOVABLE","MMC_CAP_ERASE", "MMC_CAP_HW_RESET"; // MMC_CAP_NEEDS_POLL -- for detect, MMC_CAP_NONREMOVABLE -- for eMMC/TSD
+            //caps2 = "MMC_CAP2_HS200_1_8V_SDR";
+	        f_min = <300000>;
+            f_max = <50000000>;
+            max_req_size = <0x20000>;          /**128KB*/
+            gpio_dat3 = "BOOT_3";
+            card_type = <1>; /* 0:unknown, 1:mmc card(include eMMC), 2:sd card(include tSD), 3:sdio device(ie:sdio-wifi), 4:SD combo (IO+mem) card, 5:NON sdio device(means sd/mmc card), other:reserved */
+        };
+
+//$$ DEVICE="sdio"
+//$$ L2 PROP_STR = "status"
+//$$ L3 PROP_U32 = "port"
+//$$ L2 PROP_STR = "pinname"
+//$$ L3 PROP_U32 = "ocr_avail"
+//$$ L2 PROP_STR 4 = "caps"
+//$$ L3 PROP_U32 = "f_min"
+//$$ L3 PROP_U32 = "f_max"
+//$$ L3 PROP_U32 = "max_req_size"    
+//$$ L2 PROP_U32 = "card_type"    
+        // sdio{
+        //     status = "okay";
+        //     port = <3>;          /**0:sdio_a, 1:sdio_b, 2:sdio_c, 3:sdhc_a, 4:sdhc_b, 5:sdhc_c */
+        //     pinname = "sdio";
+        //     ocr_avail = <0x00200080>; // 3.3:0x200000, 1.8+3.3:0x00200080
+        //     caps = "MMC_CAP_4_BIT_DATA","MMC_CAP_MMC_HIGHSPEED","MMC_CAP_SD_HIGHSPEED", "MMC_CAP_NONREMOVABLE", "MMC_CAP_UHS_SDR12","MMC_CAP_UHS_SDR25","MMC_CAP_UHS_SDR50","MMC_CAP_UHS_SDR104";
+        //     f_min = <300000>;
+        //     f_max = <100000000>;
+        //     max_req_size = <0x20000>;          /**128KB*/
+        //     card_type = <3>; /* 0:unknown, 1:mmc card(include eMMC), 2:sd card(include tSD), 3:sdio device(ie:sdio-wifi), 4:SD combo (IO+mem) card, 5:NON sdio device(means sd/mmc card), other:reserved */
+        // };
+    };
+    
+
+/// ***************************************************************************************
+///	-	I2C
+//$$ MODULE="I2C"
+//$$ DEVICE="I2C_AO"
+//$$ L2 PROP_STR = "status"
+//$$ L3 PROP_U32 2 ="reg"
+//$$ L3 PROP_STR = "pinctrl-names"
+//$$ L2 PROP_CHOICE "I2C_AO_pin_match" = "pinctrl-0"	
+	i2c@c8100500{ /*I2C-AO*/
+		compatible = "amlogic,aml_i2c";
+		dev_name = "i2c-AO";
+		status = "ok";
+		reg = <0xc8100500 0x1d>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		device_id = <0>;
+		pinctrl-names="default";
+		pinctrl-0=<&ao_i2c_master>;
+		use_pio = <0>;
+		master_i2c_speed = <100000>;
+	};
+
+//$$ DEVICE = "I2C_A"
+//$$ L2 PROP_STR = "status"
+//$$ L3 PROP_U32 2 ="reg"
+//$$ L3 PROP_STR = "pinctrl-names"
+//$$ L2 PROP_CHOICE "I2C_A_pin_match" = "pinctrl-0"
+    i2c@c1108500{ /*I2C-A*/
+		compatible = "amlogic,aml_i2c";
+		dev_name = "i2c-A";
+		status = "ok";
+		reg = <0xc1108500 0x20>;
+		device_id = <1>;
+		pinctrl-names="default";
+		pinctrl-0=<&a_i2c_master>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		use_pio = <0>;
+		master_i2c_speed = <300000>;
+	};
+	
+//$$ DEVICE="I2C_B"
+//$$ L2 PROP_STR = "status"
+//$$ L3 PROP_U32 2="reg"
+//$$ L3 PROP_STR = "pinctrl-names"
+//$$ L2 PROP_CHOICE "I2C_B_pin_match" = "pinctrl-0"	
+	i2c@c11087c0{ /*I2C-B*/
+		compatible = "amlogic,aml_i2c";
+		dev_name = "i2c-B";
+		status = "ok";
+		reg = <0xc11087c0 0x20>;
+		device_id = <2>;
+		pinctrl-names="default";
+		pinctrl-0=<&b_i2c_master>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		use_pio = <0>;
+		master_i2c_speed = <300000>;
+ 	};
+
+//$$ DEVICE="I2C_C"
+//$$ L2 PROP_STR = "status"
+//$$ L3 PROP_U32 2="reg"
+//$$ L3 PROP_STR = "pinctrl-names"	
+    i2c@c11087e0{ /*I2C-C*/
+		compatible = "amlogic,aml_i2c";
+		dev_name = "i2c-C";
+		status = "ok";
+		reg = <0xc11087e0 0x20>;
+		device_id = <3>;
+		pinctrl-names="default";
+//		pinctrl-0=<&c_i2c_master>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		use_pio = <0>;
+		master_i2c_speed = <300000>;
+	};
+
+//$$ DEVICE="I2C_D"
+//$$ L2 PROP_STR = "status"
+//$$ L3 PROP_U32 2="reg"
+//$$ L3 PROP_STR = "pinctrl-names"
+//$$ L2 PROP_CHOICE "I2C_D_pin_match" = "pinctrl-0"	
+	i2c@c1108d20{ /*I2C-D*/
+		compatible = "amlogic,aml_i2c";
+		dev_name = "i2c-D";
+		status = "ok";
+		reg = <0xc1108d20 0x20>;
+		device_id = <4>;
+		pinctrl-names="default";
+		pinctrl-0=<&d_i2c_master>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		use_pio = <0>;
+		master_i2c_speed = <300000>;
+	};
+
+/// ***************************************************************************************
+///	-	Power
+//$$ MODULE="Power"
+//$$ DEVICE="dvfs"
+//$$ L2 PROP_STR = "status"
+    dvfs {
+        compatible = "amlogic, amlogic-dvfs";                   /** fixed for driver, don't change       */
+        #address-cells = <1>;
+        #size-cells = <0>;
+        status = "ok";
+
+//$$ L2 PROP_U32 = "dvfs_id"
+//$$ L2 PROP_U32 = "table_count"
+//$$ L2 PROP_U32 16*3 = "dvfs_table"
+        vcck_dvfs {
+            dvfs_id     = <1>;                                  /** must be value of (1 << n)            */
+            table_count = <13>;                                 /** must be correct count for dvfs_table */
+            dvfs_table  = <
+            /* NOTE: frequent in this table must be ascending order */
+            /* frequent(Khz)    min_uV      max_uV                  */
+                  96000         860000      860000
+                 192000         860000      860000
+                 312000         860000      860000
+                 408000         860000      860000
+                 504000         860000      860000
+                 600000         860000      860000
+                 720000         860000      860000
+                 816000         900000      900000
+                1008000         920000      920000
+                1200000         970000      970000
+                1320000        1100000     1100000
+                1488000        1100000     1100000
+                1536000        1140000     1140000
+            >;
+        };
+    };
+//$$ DEVICE="meson_vcck_dvfs_driver"
+//$$ L2 PROP_STR = "status"
+//$$ L2 PROP_STR = "pinctrl-names"
+//$$ L2 PROP_CHOICE "meson_vcck_dvfs_pin_0_match" = "pinctrl-0"
+//$$ L2 PROP_U32 = "use_pwm"
+//$$ L2 PROP_U32 = "table_count"
+//$$ L2 PROP_U32 16*2 = "cs_voltage_table"
+	meson_vcck_dvfs_driver{
+        compatible = "amlogic, meson_vcck_dvfs";
+        dev_name = "meson_vcck_dvfs_driver";
+        status = "ok";
+        pinctrl-names = "default";
+        pinctrl-0 = <&aml_pwm_pins>;
+        use_pwm = <1>; 
+        pmw_controller = "PWM_C";
+        table_count = <29>;
+        cs_voltage_table = <
+        /*   
+         * Note: This table is hardware depended, If your hardware use PWM method,
+         * then first line in this table is PWM register value, second line is
+         * voltage of VCCK according this PWM register value. If your platform use
+         * constant-current source to adjust vcck voltage, then the first line should 
+         * set to 0, means not valid, member 'use_pwm' in this node should set to 0.
+         *
+         *  ---- This table must be in ascending order by voltage ----
+         *    
+         *  PWM value       VCCK voltage 
+         */ 
+		0x1c0000        860000
+		0x1b0001        870000
+		0x1a0002        880000
+		0x190003        890000		
+		0x180004        900000			
+		0x170005        910000
+		0x160006        920000
+		0x150007        930000
+		0x140008        940000			
+		0x130009        950000		
+		0x12000a        960000			
+		0x11000b        970000		
+		0x10000c        980000			
+		0x0f000d        990000			
+		0x0e000e        1000000			
+		0x0d000f        1010000		
+		0x0c0010        1020000			
+		0x0b0011        1030000			
+		0x0a0012        1040000			
+		0x090013        1050000
+		0x080014        1060000
+		0x070015        1070000			
+		0x060016        1080000
+		0x050017        1090000
+		0x040018        1100000
+		0x030019        1110000			
+		0x02001a        1120000			
+		0x01001b        1130000
+		0x00001c        1140000
+        >;   
+    };   	
+
+//$$ DEVICE="arm_pmu"
+//$$ L2 PROP_STR = "status"
+//$$ L2 PROP_U32 4*3 = "interrupts"
+    arm_pmu {
+        compatible = "arm,cortex-a9-pmu";
+        status = "ok";
+        interrupts = <0     137     0x04
+                      0     138     0x04
+                      0     153     0x04
+                      0     154     0x04>;
+    };
+
+/// ***************************************************************************************
+///	-	USB Controller
+//$$ MODULE="USB Controller"
+    usb_con {
+		lm-compatible = "logicmodule-bus";
+
+//$$ DEVICE="usb_b"
+//$$ L2 PROP_U32 = "lm-periph-id"
+//$$ L2 PROP_STR = "clock-src"
+//$$ L2 PROP_U32 = "port-id"
+//$$ L2 PROP_U32 = "port-type"
+//$$ L2 PROP_U32 = "port-speed"
+//$$ L2 PROP_U32 = "port-config"
+//$$ L2 PROP_U32 = "port-dma"
+//$$ L2 PROP_U32 = "port-id-mode"
+//$$ L2 PROP_STR = "status"
+		usb_b{
+			lm-compatible = "amlogic,usb";
+			lm-periph-id = <1>; /** lm name */
+			clock-src = "usb1"; /** clock src */
+			port-id = <1>; /** ref to mach/usb.h */
+			port-type = <1>;	/** 0: otg, 1: host, 2: slave */
+			port-speed = <0>; /** 0: default, 1: high, 2: full */
+			port-config = <0>; /** 0: default */
+			port-dma = <0>; /** 0: default, 1: single, 2: incr, 3: incr4, 4: incr8, 5: incr16, 6: disable*/
+			port-id-mode = <1>; /** 0: hardware, 1: sw_host, 2: sw_slave*/
+			status = "okay";
+		};
+		
+//$$ DEVICE="usb_a"
+//$$ L2 PROP_U32 = "lm-periph-id"
+//$$ L2 PROP_STR = "clock-src"
+//$$ L2 PROP_U32 = "port-id"
+//$$ L2 PROP_U32 = "port-type"
+//$$ L2 PROP_U32 = "port-speed"
+//$$ L2 PROP_U32 = "port-config"
+//$$ L2 PROP_U32 = "port-dma"
+//$$ L2 PROP_U32 = "port-id-mode"
+//$$ L2 PROP_STR = "gpio-vbus-power"
+//$$ L2 PROP_U32 = "gpio-work-mask"
+//$$ L2 PROP_STR = "status"
+		usb_a{
+			lm-compatible = "amlogic,usb";
+			lm-periph-id = <0>; /** lm name */
+			clock-src = "usb0"; /** clock src */
+			port-id = <0>;  /** ref to mach/usb.h */
+			port-type = <1>;	/** 0: otg, 1: host, 2: slave */
+			port-speed = <0>; /** 0: default, high, 1: full */
+			port-config = <0>; /** 0: default */
+			port-dma = <0>; /** 0: default, 1: single, 2: incr, 3: incr4, 4: incr8, 5: incr16, 6: disable*/
+			port-id-mode = <0>; /** 0: hardware, 1: sw_host, 2: sw_slave*/
+//			gpio-vbus-power = "GPIOZ_1";
+			gpio-work-mask	= <1>; /**0: work on pulldown,1:work on pullup*/
+			status = "okay";
+		};
+	};
+
+
+
+
+/// ***************************************************************************************
+/// -   Audio
+//$$ MODULE="Audio"
+//$$ DEVICE="audio_i2s"
+//$$ L2 PROP_STR = "status"
+    audio_platform{
+        compatible = "amlogic,aml-i2s";
+        dev_name = "aml-i2s.0";
+        status = "okay";
+    };
+
+//$$ DEVICE="audio_i2s_dai"
+//$$ L2 PROP_STR = "status"
+    audio_dai{
+        compatible = "amlogic,aml-i2s-dai";
+        dev_name = "aml-i2s-dai.0";
+        status = "okay";
+    };
+    audio_spdif_dai{
+        compatible = "amlogic,aml-spdif-dai";
+        dev_name = "aml-spdif-dai.0";
+        status = "okay";
+    };
+
+    audio_spdif_codec{
+        compatible = "amlogic,aml-spdif-codec";
+        dev_name = "spdif-dit.0";
+        status = "okay";
+    };
+
+//$$ DEVICE="audio_pcm2BT_codec"
+//$$ L2 PROP_STR = "status"
+    audio_pcm2BT_codec{
+        compatible = "amlogic,pcm2BT-codec";
+        dev_name = "pcm2bt.0";
+        status = "okay";
+    };
+
+//$$ DEVICE="audio_pcm_dai"
+//$$ L2 PROP_STR = "status"
+    audio_pcm_dai{
+        compatible = "amlogic,aml-pcm-dai";
+        dev_name = "aml-pcm-dai.0";
+        status = "okay";
+    };
+
+//$$ DEVICE="audio_pcm"
+//$$ L2 PROP_STR = "status"
+    audio_pcm{
+        compatible = "amlogic,aml-pcm";
+        dev_name = "aml-pcm.0";
+        status = "okay";
+    };
+
+//$$ DEVICE="audio_m8_audio"
+//$$ L2 PROP_STR = "status"
+    audio_m8_audio{
+        compatible = "amlogic,m8_audio_codec";
+        dev_name = "aml_m8_codec.0";
+        status = "disable";
+    };
+
+//$$ DEVICE="dummy_codec"
+//$$ L2 PROP_STR = "status"
+    dummy_codec{
+        compatible = "amlogic,aml_dummy_codec";
+        dev_name = "dummy_codec.0";
+        status = "okay";
+    };
+
+    aml_audio_codec{
+        compatible = "amlogic,audio_codec";
+        rt5616:rt5616{
+            codec_name = "rt5616";
+            i2c_addr = <0x1B>;
+            i2c_bus = "i2c_bus_d";
+            id_reg = <0x00>;
+            id_val = <0x21>;
+            capless = <0>;
+            status = "disable";
+        };
+        rt5631:rt5631{
+            codec_name = "rt5631";
+            i2c_addr = <0x1A>;
+            i2c_bus = "i2c_bus_b";
+            id_reg = <0x00>;
+            id_val = <0x01>;
+            capless = <0>;
+            status = "disable";      
+        };  
+        wm8960:wm8960{
+            codec_name = "wm8960";
+            i2c_addr = <0x1A>;
+            i2c_bus = "i2c_bus_b";
+            capless = <1>;
+            status = "disable";
+        };
+
+        dummy:dummy{
+          codec_name = "dummy_codec";
+          status = "okay";
+        };
+    };
+
+//$$ DEVICE="aml_m8_sound_card"
+//$$ L2 PROP_STR = "aml,sound_card"
+//$$ L2 PROP_STR = "aml,codec_dai"
+//$$ L2 PROP_STR 6*2 = "aml,audio-routing"
+//$$ L2 PROP_STR = "mute_gpio"
+//$$ L2 PROP_U32 5 = "hp_paraments"
+//$$ L2 PROP_STR = "pinctrl-names"
+//$$ L2 PROP_CHOICE "Audio_pin_0_match" = "pinctrl-0"
+//$$ L2 PROP_STR = "status"
+    aml_m8_sound_card{
+        compatible = "sound_card, aml_snd_m8";
+        aml,sound_card = "AML-M8AUDIO";
+        aml,codec_dai = "AML-M8","rt5616-aif1","rt5631-hifi","wm8960-hifi","dummy_codec";
+        //aml,codec_name = "aml_m8_codec.0","rt5616.4-001b";
+        //aml,audio-codec = <&rt5616>;
+        aml,audio-routing-rt5616 = 
+            "Ext Spk","LOUTL",
+            "Ext Spk","LOUTR",
+            "HP","HPOL",
+            "HP","HPOR",
+            "micbias1","MAIN MIC",
+            "IN2P","micbias1";
+        aml,audio-routing-amlm8 = 
+            "Ext Spk","LINEOUTL",
+            "Ext Spk","LINEOUTR",
+            "HP","HP_L",
+            "HP","HP_R",
+            "MICBIAS","MAIN MIC",
+            "LINPUT1","MICBIAS";
+        aml,audio-routing-dummy=
+            "Ext Spk","LOUTL",
+            "Ext Spk","LOUTR";
+        mute_gpio = "GPIO_BSD_EN";
+        hp_disable;
+        //mute_inv;
+        hp_paraments = <800 300 0 5 1>;
+        pinctrl-names = "aml_snd_m8";
+        pinctrl-0 = <&audio_pins>;
+        status = "okay";
+        
+    };
+
+/// ***************************************************************************************
+///	-	Camera
+//$$ MODULE="Camera"
+///	-	aml_cams
+//$$ DEVICE = "aml_cams"
+//$$ L2 PROP_STR = "status"
+//$$ L2 PROP_STR 2 = "pinctrl-names"
+//$$ L2 PROP_CHOICE "Camera_pin_0_match" = "pinctrl-0"
+//$$ L2 PROP_CHOICE "Camera_pin_1_match" = "pinctrl-1"
+	aml_cams{
+		compatible = "amlogic,cams_prober";
+		status = "okay";
+		pinctrl-names = "gpio","csi";
+		pinctrl-0 = <&aml_cam_gpio_pins> ;
+		pinctrl-1 = <&aml_cam_csi_pins> ;
+
+///	-	ar0543
+//$$ DEVICE="ar0543"
+//$$ L2 PROP_STR = "status"
+//$$ L2 PROP_U32 = "front_back"
+//$$ L2 PROP_STR = "i2c_bus"
+//$$ L2 PROP_STR = "gpio_pwdn"
+//$$ L2 PROP_STR = "gpio_rst"
+//$$ L2 PROP_U32 = "mirror_flip"
+//$$ L2 PROP_U32 = "vertical_flip"
+//$$ L2 PROP_STR = "config_path"
+//$$ L2 PROP_U32 = "mclk"
+//$$ L2 PROP_STR = "bt_path"
+//$$ L2 PROP_STR = "interface"
+//$$ L2 PROP_STR = "clk_channel"
+		cam_0{
+			cam_name = "ar0543";
+			front_back = <0>;
+			i2c_bus = "i2c_bus_d";
+			gpio_pwdn = "GPIOH_6";
+			gpio_rst = "GPIOH_4";
+			mirror_flip = <0>;
+			vertical_flip = <0>;
+			config_path = "/system/etc/camera_isp_cfg/ar0543_skt";
+			mclk = <12000>;
+			bt_path = "csi";
+			interface = "mipi";
+			clk_channel = "a";
+			status = "okay";
+		};
+
+///	-	ov5647
+//$$ DEVICE="ov5647"
+//$$ L2 PROP_STR = "status"
+//$$ L2 PROP_U32 = "front_back"
+//$$ L2 PROP_STR = "i2c_bus"
+//$$ L2 PROP_STR = "gpio_pwdn"
+//$$ L2 PROP_STR = "gpio_rst"
+//$$ L2 PROP_U32 = "mirror_flip"
+//$$ L2 PROP_U32 = "vertical_flip"
+//$$ L2 PROP_STR = "bt_path"
+//$$ L2 PROP_STR = "interface"
+//$$ L2 PROP_STR = "clk_channel"
+		cam_1{
+			cam_name = "ov5647";
+			front_back = <0>;
+			i2c_bus = "i2c_bus_d";
+			gpio_pwdn = "GPIOH_5";
+			gpio_rst = "GPIOH_4";
+			mirror_flip = <0>;
+			vertical_flip = <0>;	
+			config_path = "/system/etc/camera_isp_cfg/ov5647_cw0767";
+			bt_path = "csi";
+			interface = "mipi";
+			clk_channel = "b";
+			status = "okay";
+		};
+		
+		cam_2{
+			cam_name = "ar0833";
+			front_back = <0>;
+			i2c_bus = "i2c_bus_d";
+			gpio_pwdn = "GPIOH_6";
+			gpio_rst = "GPIOH_4";
+			mirror_flip = <0>;
+			vertical_flip = <0>;
+			config_path = "/system/etc/camera_isp_cfg/ar0833_skt";
+			mclk = <12000>;
+			bt_path = "csi";
+			interface = "mipi";
+			clk_channel = "a";
+			status = "okay";
+		};
+	};	
+
+/// ***************************************************************************************
+///	-	Input
+//$$ MODULE="Input"
+//$$ DEVICE="gpio_keypad"
+//$$ L2 PROP_STR = "status"
+//$$ L2 PROP_U32 = "scan_period"
+//$$ L2 PROP_U32 = "key_num"
+//$$ L2 PROP_STR = "key_name"
+//$$ L2 PROP_U32 = "key_code"
+//$$ L2 PROP_STR = "key_pin"
+//$$ L2 PROP_U32 = "irq_keyup"
+//$$ L2 PROP_U32 = "irq_keydown"
+    gpio_keypad{
+		compatible = "amlogic,gpio_keypad";
+		status = "okay";
+		scan_period = <20>;
+		key_num = <1>;
+        key_name = "power";
+		key_code = <116>;
+		key_pin = "GPIOAO_3";
+        irq_keyup = <6>;
+        irq_keydown = <7>;
+	};
+//$$ DEVICE="saradc"
+//$$ L2 PROP_STR = "status"
+	saradc{
+		compatible = "amlogic,saradc";
+		status = "okay";
+	};
+
+//$$ DEVICE="adc_keypad"
+//$$ L2 PROP_STR = "status"
+//$$ L2 PROP_STR = "key_name"
+//$$ L2 PROP_U32 = "key_num"
+//$$ L2 PROP_U32 2 = "key_code"
+//$$ L2 PROP_U32 2 = "key_chan"
+//$$ L2 PROP_U32 2 = "key_val"
+//$$ L2 PROP_U32 2 = "key_tolerance"
+/*    adc_keypad{
+		compatible = "amlogic,adc_keypad";
+		status = "okay";
+		key_name = "menu", "vol-","vol+", "esc", "home";
+		key_num = <5>;
+		key_code = <139 114 115 1 102>;
+		key_chan = <0 0 0 0 0>;
+		key_val = <0 143 271 393 468>; //voltage=0/252/478/692/824mV, val=voltage/1800mV*1023
+		key_tolerance = <40 40 40 40 40>;
+	};
+*/
+
+//$$ DEVICE="meson-remote"
+//$$ L2 PROP_STR = "status"
+//$$ L2 PROP_U32 = "ao_baseaddr"
+//$$ L2 PROP_STR = "pinctrl-names"
+//$$ L2 PROP_CHOICE "remote_pin_0_match" = "pinctrl-0"
+    meson-remote{
+		compatible = "amlogic,aml_remote";
+		dev_name = "meson-remote";
+		status = "ok";
+		ao_baseaddr = <0xf3100480>;
+		pinctrl-names="default";
+		pinctrl-0=<&remote_pins>;
+	};
+
+/// ***************************************************************************************
+///	-	Spi
+//$$ MODULE="Spi"
+//$$ DEVICE="spi"
+//$$ L2 PROP_STR = "status"
+//$$ L2 PROP_U32 2 = "reg"
+//$$ L2 PROP_STR = "pinctrl-names"
+//$$ L2 PROP_CHOICE "Spi_pin_0_match" = "pinctrl-0"
+//$$ L2 PROP_U32 = "nr-parts"
+//$$ L2 PROP_CHOICE "Spi_nr-part-0_match" = "nr-part-0"
+//$$ L2 PROP_CHOICE "Spi_nr-part-1_match" = "nr-part-1"
+    spi@cc000000{
+		compatible = "amlogic,apollo_spi_nor";
+		status = "ok";
+		reg = <0xcc000000 0x04000000>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&aml_spi_nor_pins>;
+
+		nr-parts = <2>;
+		nr-part-0 = <&bootloader>;
+		nr-part-1 = <&ubootenv>;
+
+//$$ MATCH "Spi_nr-part-0_match" = <&bootloader>
+//$$ L2 PROP_STR = "name"
+//$$ L2 PROP_U32 = "offset"
+//$$ L2 PROP_U32 = "size"
+		bootloader:bootloader{
+			name = "bootloader";
+			offset = <0>;
+			size = <0x100000>;
+		};
+
+//$$ MATCH "Spi_nr-part-1_match" = <&ubootenv>
+//$$ L2 PROP_STR = "name"
+//$$ L2 PROP_U32 = "offset"
+//$$ L2 PROP_U32 = "size"
+		ubootenv:ubootenv{
+			name = "ubootenv";
+		      offset = <0x100000>;
+		      size = <0x10000>;
+		};
+	};
+	
+/// ***************************************************************************************
+///	-	Nand
+//$$ MODULE="Nand"
+//$$ DEVICE="aml_nand"
+//$$ L2 PROP_STR = "status"
+//$$ L3 PROP_U32 2 ="reg"
+//$$ L2 PROP_STR 2 = "pinctrl-names"
+//$$ L2 PROP_CHOICE 3 "Nand_pin_0_match" = "pinctrl-0"
+//$$ L2 PROP_CHOICE 3 "Nand_pin_1_match" = "pinctrl-1"
+//$$ L3 PROP_STR ="plat-names"
+//$$ L2 PROP_U32 = "plat-num"
+//$$ L2 PROP_CHOICE "plat-part-0_match" = "plat-part-0"
+	nand{
+		compatible = "amlogic,aml_nand";
+		dev_name = "nand";
+		status = "ok";
+		reg = <0xd0048600 0x24>;
+		pinctrl-names = "nand_rb_mod","nand_norb_mod";
+		pinctrl-0 = <&nand_input_state &conf_nand_state &conf_nand_state1 &nand_base>;
+		pinctrl-1 = <&nand_input_state &conf_nand_state &conf_nand_state1 &nand_base>;
+		device_id = <0>;
+		plat-names = "nandnormal";
+		plat-num = <1>;
+		plat-part-0 = <&normal>;
+
+//$$ MATCH "plat-part-0_match" = <&normal>
+//$$ L2 PROP_STR 4 = "enable_pad"
+//$$ L2 PROP_STR = "busy_pad"
+		normal: normal{
+			enable_pad ="ce0","ce1","ce2","ce3";
+			busy_pad = "rb0";
+		};
+	};
+
+/// ***************************************************************************************
+///	-	Efuse
+//$$ MODULE="Efuse"
+//$$ DEVICE="efuse"
+//$$ L2 PROP_STR = "status"
+//$$ L2 PROP_U32 2 = "plat-pos"
+//$$ L2 PROP_U32 = "plat-count"
+//$$ L2 PROP_U32 = "usid-min"
+//$$ L2 PROP_U32 = "usid-max"
+    efuse{
+		compatible = "amlogic,efuse";
+		dev_name = "efuse";
+		status = "okay";
+		plat-pos = <0 454>;
+		plat-count = <58>;
+		usid-min = <8>; /*reserved*/
+		usid-max = <31>; /*reserved*/
+	};
+	
+/// ***************************************************************************************
+///	-	Thermal
+//$$ MODULE="Thermal"
+//$$ DEVICE="thermal"
+//$$ L2 PROP_U32 3*3 = "trip_point"
+//$$ L2 PROP_U32 = "#thermal-cells"
+//$$ L2 PROP_U32 = "cpu_cali_a"
+//$$ L2 PROP_U32 = "idle_interval"
+	thermal{
+		compatible = "amlogic-thermal";
+		#thermal-cells=<7>;
+		dev_name = "aml_thermal";
+        trip_point=<70 1488001 1488001 511 511 3 2
+                    80 1200001 1200001 435 435 2 2
+                    90  800001  800001 328 328 1 1
+                    260 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff>;
+		cpu_cali_a=<0>;
+		idle_interval=<1000>;
+        use_virtual_thermal;
+        freq_sample_period=<30>;
+        report_time=<1 10 30 60>;         /* based on freq_sample_period */
+        cpu_virtual=<
+             500000  40  40  40  40
+             600000  45  55  60  65
+             800000  50  60  65  70
+            1000000  55  65  70  75
+            1200000  60  70  75  80
+            1350000  65  75  80  85
+        >;
+        gpu_virtual=<
+            183      40  40  40  40
+            251      40  45  50  55
+            319      50  60  65  70
+            426      55  65  70  75
+            511      60  70  75  80
+        >;
+	};
+	
+/// ***************************************************************************************
+///	-	Securitykey
+//$$ MODULE="Securitykey"
+//$$ DEVICE="securitykey"
+//$$ L2 PROP_STR = "status"
+    securitykey{
+		compatible = "amlogic,aml_keys";
+		status = "ok";
+	};
+
+/// ***************************************************************************************
+///	-	Unifykey
+//$$ MODULE="Unifykey"
+//$$ DEVICE="securitykey"
+//$$ L2 PROP_STR = "status"
+//$$ L3 PROP_U32 ="unifykey-num"
+//$$ L2 PROP_CHOICE "Unifykey_0_match" = "unifykey-index-0"
+//$$ L2 PROP_CHOICE "Unifykey_1_match" = "unifykey-index-1"
+//$$ L2 PROP_CHOICE "Unifykey_2_match" = "unifykey-index-2"
+    	unifykey{
+		compatible = "amlogic,unifykey";
+		status = "ok";
+
+		/*efuse-version = <20>;*/ /*m6 efuse version 2,m3 efuse version 1, not config efuse version in default*/
+		unifykey-num = <6>;
+		unifykey-index-0 = <&keysn_0>;
+		unifykey-index-1 = <&keysn_1>;
+		unifykey-index-2 = <&keysn_2>;
+		unifykey-index-3 = <&keysn_3>;
+		unifykey-index-4 = <&keysn_4>;
+		unifykey-index-5 = <&keysn_5>;
+
+
+//$$ MATCH "Unifykey_0_match" = <&keysn_0>
+//$$ L2 PROP_STR = "key-name"
+//$$ L2 PROP_STR = "key-device"
+//$$ L2 PROP_STR = "key-dataformat"
+//$$ L2 PROP_STR 3 = "key-permit"
+		keysn_0: key_0{
+			key-name = "usid";
+			key-device = "nandkey";
+			key-dataformat = "allascii";
+			key-permit = "read","write","del";
+		};
+		
+//$$ MATCH "Unifykey_1_match" = <&keysn_1>
+//$$ L2 PROP_STR = "key-name"
+//$$ L2 PROP_STR = "key-device"
+//$$ L2 PROP_STR = "key-dataformat"
+//$$ L2 PROP_STR 3 = "key-permit"
+		keysn_1:key_1{
+			key-name = "mac";
+			key-device = "nandkey";
+			key-dataformat = "hexdata";
+			key-permit = "read","write","del";
+		};
+		
+//$$ MATCH "Unifykey_2_match" = <&keysn_2>
+//$$ L2 PROP_STR = "key-name"
+//$$ L2 PROP_STR = "key-device"
+//$$ L2 PROP_STR = "key-dataformat"
+//$$ L2 PROP_STR 3 = "key-permit"
+		keysn_2:key_2{
+			key-name = "hdcp";
+			key-device = "nandkey";
+			key-dataformat = "hexdata";
+			key-permit = "read","write","del";
+		};
+
+//$$ MATCH "Unifykey_3_match" = <&keysn_3>
+//$$ L2 PROP_STR = "key-name"
+//$$ L2 PROP_STR = "key-device"
+//$$ L2 PROP_STR = "key-dataformat"
+//$$ L2 PROP_STR 3 = "key-permit"
+		keysn_3:key_3{
+			key-name = "secure_boot_set";
+			key-device = "efusekey";
+			key-dataformat = "hexdata";
+			key-permit = "read","write";
+		};
+		
+//$$ MATCH "Unifykey_4_match" = <&keysn_4>
+//$$ L2 PROP_STR = "key-name"
+//$$ L2 PROP_STR = "key-device"
+//$$ L2 PROP_STR = "key-dataformat"
+//$$ L2 PROP_STR 3 = "key-permit"
+		keysn_4:key_4{
+			key-name = "mac_bt";
+			key-device = "nandkey";
+			key-dataformat = "hexdata";
+			key-permit = "read","write","del";
+		};
+		
+//$$ MATCH "Unifykey_5_match" = <&keysn_5>
+//$$ L2 PROP_STR = "key-name"
+//$$ L2 PROP_STR = "key-device"
+//$$ L2 PROP_STR = "key-dataformat"
+//$$ L2 PROP_STR 3 = "key-permit"
+		keysn_5:key_5{
+			key-name = "mac_wifi";
+			key-device = "nandkey";
+			key-dataformat = "hexdata";
+			key-permit = "read","write","del";
+		};
+	};
+
+/// ***************************************************************************************
+///	-	HDMI
+//$$ MODULE="HDMI"
+//$$ DEVICE="amhdmitx"
+//$$ L2 PROP_STR = "status"
+//$$ L2 PROP_CHOICE "HDMI_vend-data_match" = "vend-data"
+//$$ L2 PROP_CHOICE "HDMI_pwr-ctrl_match" = "pwr-ctrl"
+    amhdmitx{
+		compatible = "amlogic,amhdmitx";
+		dev_name = "amhdmitx";
+		status = "ok";
+        vend-data = <&vend_data>;
+        pwr-ctrl = <&pwr_ctrl>;
+        
+//$$ MATCH "HDMI_vend-data_match" = <&vend_data>
+//$$ L2 PROP_STR = "vendor_name"
+//$$ L2 PROP_U32 = "vendor_id"
+//$$ L2 PROP_STR = "product_desc"
+//$$ L2 PROP_STR = "cec_osd_string"   
+//$$ L2 PROP_U32 = "cec_config"    
+//$$ L2 PROP_U32 = "ao_cec"   
+        vend_data: vend_data{
+            vendor_name = "Amlogic";           /* Max Chars: 8     */
+            vendor_id = <0x000000>;            /* Refer to http://standards.ieee.org/develop/regauth/oui/oui.txt */
+            product_desc = "M8 MBox SKTv1";    /* Max Chars: 16    */
+            cec_osd_string = "MBox";           /* Max Chars: 14    */
+            cec_config = <0x00000f>;           /* 4 bytes: use to control cec switch on/off; distinguish between Mbox and Tablet. <0x00000f>:Mbox; <0x000000> or no this value:Tablet*/
+            ao_cec = <0x000001>;               /* switch between ao-cec and ee-cec:: 1: ao-cec; 0: ee-cec */
+        };
+        
+//$$ MATCH "HDMI_pwr-ctrl_match" = <&pwr_ctrl>
+//$$ L2 PROP_STR = "pwr_5v_on"
+//$$ L2 PROP_STR = "pwr_5v_off"
+//$$ L2 PROP_STR = "pwr_3v3_on"
+//$$ L2 PROP_STR = "pwr_3v3_off"
+//$$ L2 PROP_STR = "pwr_hpll_vdd_on"
+//$$ L2 PROP_STR = "pwr_hpll_vdd_off"
+        pwr_ctrl: pwr_ctrl{
+            pwr_5v_on = "";
+            pwr_5v_off = "";
+            pwr_3v3_on = "";
+            pwr_3v3_off = "";
+            pwr_hpll_vdd_on = "";
+            pwr_hpll_vdd_off = "";
+        };
+	};
+
+/// ***************************************************************************************
+///	-	PowerManager
+//$$ MODULE="PowerManager"
+//$$ DEVICE="amvenc_avc"
+//$$ L2 PROP_STR = "status"
+    aml_pm{
+		compatible = "amlogic,pm-m8";
+		dev_name = "aml_pm_m8";
+		status = "okay";
+	};
+
+/// ***************************************************************************************
+///	-	Cpufreq
+//$$ MODULE="Cpufreq"
+//$$ DEVICE="cpufreq-meson"
+//$$ L2 PROP_STR = "status"
+    cpufreq-meson{
+        compatible = "amlogic,cpufreq-meson";
+        syspll_fixed;
+        status = "okay";
+    };
+
+//    crypto_device{
+//       compatible = "amlogic,crypto-device";
+//       dev_name = "crypto_device";
+//    };
+
+/// **************************************************************************************
+/// -   GPIO
+//$$ MODULE="GPIO"
+//$$ DEVICE="m8-gpio"
+	gpio:gpio{
+		compatible = "amlogic,m8b-gpio";
+		dev_name = "gpio";
+		#gpio-cells=<2>;
+	};
+
+/// **************************************************************************************
+/// -   Pinmux
+//$$ MODULE="Pinmux"
+//$$ DEVICE="pinmux-m8"
+    pinmux{ 
+		compatible = "amlogic,pinmux-m8b";
+		dev_name = "pinmux";
+		#pinmux-cells=<2>;    
+    
+//$$ MATCH "uart_ao_pin_match" = "&ao_uart_pins"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_STR 2 = "amlogic,pins"
+        ao_uart_pins:ao_uart{
+			amlogic,setmask=<10 0x1800>;
+			amlogic,pins="GPIOAO_0", "GPIOAO_1";
+		};
+		
+//$$ MATCH "uart_0_pin_match" = "&a_uart_pins"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_STR 4 = "amlogic,pins"
+//		a_uart_pins:a_uart{
+//			amlogic,setmask=<4 0x3c00>;
+//			amlogic,pins="GPIOX_12", "GPIOX_13", "GPIOX_14", "GPIOX_15";
+//		};
+
+//$$ MATCH "uart_1_pin_match" = "&b_uart_pins"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_STR 4 = "amlogic,pins"
+		b_uart_pins:b_uart{
+			amlogic,setmask=<4 0x03c0>;
+			amlogic,pins="GPIOX_16", "GPIOX_17", "GPIOX_18", "GPIOX_19";
+		};
+		
+//$$ MATCH "Nand_pin_0_match" = "&nand_input_state"
+//$$ MATCH "Nand_pin_1_match" = "&nand_input_state"
+//$$ L2 PROP_STR 18 = "amlogic,pins"
+//$$ L2 PROP_U32 = "amlogic,enable-output"
+		nand_input_state:nand_input{
+			amlogic,pins = "BOOT_0","BOOT_1","BOOT_2","BOOT_3","BOOT_4",
+						"BOOT_5","BOOT_6","BOOT_7","BOOT_12","BOOT_13",
+						"BOOT_8","BOOT_9","BOOT_10","BOOT_11",
+						"BOOT_14","BOOT_15","BOOT_16","BOOT_17";
+			amlogic,enable-output=<1>;
+		};
+		
+//$$ MATCH "Nand_pin_0_match" = "&conf_nand_state"
+//$$ MATCH "Nand_pin_1_match" = "&conf_nand_state"
+//$$ L2 PROP_STR 9 = "amlogic,pins"
+//$$ L2 PROP_U32 = "amlogic,pullup"
+		conf_nand_state: conf_nand{
+			amlogic,pins = "BOOT_0","BOOT_1","BOOT_2","BOOT_3","BOOT_4",
+						"BOOT_5","BOOT_6","BOOT_7","BOOT_15";
+			amlogic,pullup=<0>;
+			amlogic,pullupen=<1>;
+		};
+		conf_nand_state1: conf_nand1{
+			amlogic,pins = "BOOT_8", "BOOT_10";
+			amlogic,pullup=<1>;
+			amlogic,pullupen=<1>;
+		};
+//$$ MATCH "Nand_pin_0_match" = "&nand_base"
+//$$ MATCH "Nand_pin_1_match" = "&nand_base"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_U32 3*2 = "amlogic,clrmask"
+//$$ L2 PROP_STR 17 = "amlogic,pins"
+		nand_base: nand{
+			amlogic,setmask=<2 0x7fe0000>;
+			amlogic,clrmask=<	5 0xe
+							6 0x3f000000
+							4 0x7c000000>;
+			amlogic,pins = "BOOT_0","BOOT_1","BOOT_2","BOOT_3","BOOT_4",
+						"BOOT_5","BOOT_6","BOOT_7","BOOT_8","BOOT_9",
+						"BOOT_10","BOOT_12","BOOT_13",
+						"BOOT_14","BOOT_15","BOOT_16","BOOT_17";
+		};
+		
+//$$ MATCH "Card_pin_0_match" = "&sdhc_b_pins"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_U32 4 = "amlogic,clrmask"
+//$$ L2 PROP_STR 6 = "amlogic,pins"	
+		sdhc_b_pins:sdhc_b_pin{
+			amlogic,setmask=<2 0xfc00>;
+			amlogic,clrmask=<2 0xf0 8 0x600>;
+			amlogic,pins="CARD_0","CARD_1","CARD_2","CARD_3","CARD_4","CARD_5";
+		};
+
+//$$ MATCH "Card_pin_1_match" = "&sdhc_c_pins"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_U32 4 = "amlogic,clrmask"
+//$$ L2 PROP_STR 6 = "amlogic,pins"	
+		sdhc_c_pins:sdhc_c_pin{
+			amlogic,setmask=<6 0x3f000000>;
+			amlogic,clrmask=<4 0x6c000000 2 0x4c00000>;
+			amlogic,pins="BOOT_0","BOOT_1","BOOT_2","BOOT_3","BOOT_10","BOOT_11";
+		};
+
+//$$ MATCH "Card_pin_2_match" = "&sdhc_a_pins"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_U32 2 = "amlogic,clrmask"
+//$$ L2 PROP_STR 6 = "amlogic,pins"		
+		sdhc_a_pins:sdhc_a_pin{
+			amlogic,setmask=<8 0x3f>;
+			amlogic,clrmask=<5 0x6c00 >;
+			amlogic,pins="GPIOX_0","GPIOX_1","GPIOX_2","GPIOX_3","GPIOX_8","GPIOX_9";
+		};
+
+//$$ MATCH "sdio_pin_5_match" = "&sdio_all_pins"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_U32 3*2 = "amlogic,clrmask"
+//$$ L2 PROP_STR 6 = "amlogic,pins"	
+//$$ L2 PROP_U32 = "amlogic,enable-output"
+//$$ L2 PROP_U32 = "amlogic,pullup"
+//$$ L2 PROP_U32 = "amlogic,pullupen"	
+        sdio_all_pins:sdio_all_pins{
+            amlogic,setmask=<8 0x0000003f>;         /*sdio a*/
+            amlogic,clrmask=<6 0x3f000000           /*sdio c*/
+                                2 0x0000fc00        /*sdio b*/
+                                5 0x00006c00>;      /*sdhc a*/
+            amlogic,pins = "GPIOX_0","GPIOX_1","GPIOX_2","GPIOX_3","GPIOX_8","GPIOX_9";
+            amlogic,enable-output=<1>; /** 0:output, 1:input */
+            amlogic,pullup=<1>;
+            amlogic,pullupen=<1>;
+        };
+        
+//$$ MATCH "sdio_pin_4_match" = "&sdio_clk_cmd_pins"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_U32 3*2 = "amlogic,clrmask"
+//$$ L2 PROP_STR 2 = "amlogic,pins"	
+//$$ L2 PROP_U32 = "amlogic,enable-output"
+//$$ L2 PROP_U32 = "amlogic,pullup"
+//$$ L2 PROP_U32 = "amlogic,pullupen"
+        sdio_clk_cmd_pins:sdio_clk_cmd_pins{
+            amlogic,setmask=<8 0x00000003>;         /*sdio a*/
+            amlogic,clrmask=<6 0x3f000000           /*sdio c*/
+                                2 0x0000fc00        /*sdio b*/
+                                5 0x00006c00>;      /*sdhc a*/
+            amlogic,pins = "GPIOX_8","GPIOX_9"; /** GPIOX_8:CLK, GPIOX_9:CMD */
+            amlogic,enable-output=<1>; /** 0:output, 1:input */
+            amlogic,pullup=<1>;
+            amlogic,pullupen=<1>;
+        };
+
+//$$ MATCH "sdio_pin_1_match" = "&sd_all_pins"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_U32 3*2 = "amlogic,clrmask"
+//$$ L2 PROP_STR 6 = "amlogic,pins"	
+//$$ L2 PROP_U32 = "amlogic,enable-output"
+//$$ L2 PROP_U32 = "amlogic,pullup"
+//$$ L2 PROP_U32 = "amlogic,pullupen"
+        sd_all_pins:sd_all_pins{
+            amlogic,setmask=<2 0x0000fc00>;         /*sdio b*/
+            amlogic,clrmask=<6 0x3f000000           /*sdio c*/
+                                8 0x0000063f        /*sdio a, UART*/
+                                2 0x000000f0>;      /*sdhc b*/
+            amlogic,pins = "CARD_0","CARD_1","CARD_2","CARD_3","CARD_4","CARD_5";
+            amlogic,enable-output=<1>; /* 0:output, 1:input */
+            amlogic,pullup=<1>;
+            amlogic,pullupen=<1>;
+        };
+        
+//$$ MATCH "sdio_pin_6_match" = "&sd_1bit_pins"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_U32 3*2 = "amlogic,clrmask"
+//$$ L2 PROP_STR 6 = "amlogic,pins"	
+//$$ L2 PROP_U32 = "amlogic,enable-output"
+//$$ L2 PROP_U32 = "amlogic,pullup"
+//$$ L2 PROP_U32 = "amlogic,pullupen"
+        sd_1bit_pins:sd_1bit_pins{
+            amlogic,setmask=<2 0x00008c00>;         /*sdio b*/
+            amlogic,clrmask=<6 0x3f000000           /*sdio c*/
+                                8 0x0000003f        /*sdio a*/
+                                2 0x000000f0>;      /*sdhc b*/
+            amlogic,pins = "CARD_0","CARD_1","CARD_2","CARD_3","CARD_4","CARD_5";
+            amlogic,enable-output=<1>; /* 0:output, 1:input */
+            amlogic,pullup=<1>;
+            amlogic,pullupen=<1>;
+        };
+        
+//$$ MATCH "sdio_pin_0_match" = "&sd_clk_cmd_pins"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_U32 3*2 = "amlogic,clrmask"
+//$$ L2 PROP_STR 2 = "amlogic,pins"	
+//$$ L2 PROP_U32 = "amlogic,enable-output"
+//$$ L2 PROP_U32 = "amlogic,pullup"
+//$$ L2 PROP_U32 = "amlogic,pullupen"
+        sd_clk_cmd_pins:sd_clk_cmd_pins{
+            amlogic,setmask=<2 0x00000c00>;         /*sdio b*/
+            amlogic,clrmask=<6 0x3f000000           /*sdio c*/
+                                8 0x0000003f        /*sdio a*/
+                                2 0x000000f0>;      /*sdhc b*/
+            amlogic,pins = "CARD_2","CARD_3"; /** CARD_2:CLK, CARD_3:CMD */
+            amlogic,enable-output=<1>; /** 0:output, 1:input */
+            amlogic,pullup=<1>;
+            amlogic,pullupen=<1>;
+        };
+        
+//$$ MATCH "sdio_pin_3_match" = "&emmc_all_pins"  
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_U32 3*2 = "amlogic,clrmask"
+//$$ L2 PROP_STR 6 = "amlogic,pins"	
+//$$ L2 PROP_U32 = "amlogic,enable-output"
+//$$ L2 PROP_U32 = "amlogic,pullup"
+//$$ L2 PROP_U32 = "amlogic,pullupen"      
+        emmc_all_pins:emmc_all_pins{
+            amlogic,setmask=<6 0xfc000000>;         /*sdio c*/
+            amlogic,clrmask=<2 0x06c2fc00           /*sdio b & nand*/
+                                8 0x0000003f        /*sdio a*/
+                                4 0x6c000000>;        /*sdhc c*/
+            amlogic,pins = "BOOT_0","BOOT_1","BOOT_2","BOOT_3","BOOT_8","BOOT_10";
+            amlogic,enable-output=<1>; /** 0:output, 1:input */
+            amlogic,pullup=<1>;
+            amlogic,pullupen=<1>;
+        };
+        
+//$$ MATCH "sdio_pin_2_match" = "&emmc_clk_cmd_pins" 
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_U32 3*2 = "amlogic,clrmask"
+//$$ L2 PROP_STR 2 = "amlogic,pins"	
+//$$ L2 PROP_U32 = "amlogic,enable-output"
+//$$ L2 PROP_U32 = "amlogic,pullup"
+//$$ L2 PROP_U32 = "amlogic,pullupen"
+        emmc_clk_cmd_pins:emmc_clk_cmd_pins{
+            amlogic,setmask=<6 0xc0000000>;         /*bit[30-31] */
+            amlogic,clrmask=<2 0x06c2fc00           /*sdio b & nand   nand bit17 bit25*/ 
+                                8 0x0000003f        /*sdio a*/
+                                7 0xc0000>;        /*sdhc c bit 18-19*/
+            amlogic,pins = "BOOT_8","BOOT_10"; /** BOOT_10:CMD, BOOT_8:CLK */
+            amlogic,enable-output=<1>; /** 0:output, 1:input */
+            amlogic,pullup=<1>;
+            amlogic,pullupen=<1>;
+        };
+
+//$$ MATCH "sdhc_pin_0_match" = "&sdhc_sd_clk_cmd_pins"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_U32 4*2 = "amlogic,clrmask"
+//$$ L2 PROP_STR 2 = "amlogic,pins"
+//$$ L2 PROP_U32 = "amlogic,enable-output"
+//$$ L2 PROP_U32 = "amlogic,pullup"
+//$$ L2 PROP_U32 = "amlogic,pullupen"
+        sdhc_sd_clk_cmd_pins:sdhc_sd_clk_cmd_pins{
+            amlogic,setmask=<2 0x00000030>;         /*sdhc b*/
+            amlogic,clrmask=<5 0x00007c00           /*sdhc a*/
+                                4 0x7c000000        /*sdhc c*/
+                                2 0x0000fc00        /*sdio b*/
+                                8 0x00000600>;      /*UART*/
+            amlogic,pins = "CARD_2","CARD_3"; /* CARD_2:CLK, CARD_3:CMD */
+            amlogic,enable-output=<1>; /* 0:output, 1:input */
+            amlogic,pullup=<1>;
+            amlogic,pullupen=<1>;
+        };
+//$$ MATCH "sdhc_pin_1_match" = "&sdhc_sd_all_pins"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_U32 4*2 = "amlogic,clrmask"
+//$$ L2 PROP_STR 6 = "amlogic,pins"
+//$$ L2 PROP_U32 = "amlogic,enable-output"
+//$$ L2 PROP_U32 = "amlogic,pullup"
+//$$ L2 PROP_U32 = "amlogic,pullupen"
+        sdhc_sd_all_pins:sdhc_sd_all_pins{
+            amlogic,setmask=<2 0x000000f0>;         /*sdhc b*/
+            amlogic,clrmask=<5 0x00007c00           /*sdhc a*/
+                                4 0x7c000000        /*sdhc c*/
+                                2 0x0000fc00        /*sdio b*/
+                                8 0x00000600>;      /*UART*/
+            amlogic,pins="CARD_0","CARD_1","CARD_2","CARD_3","CARD_4","CARD_5";
+            amlogic,enable-output=<1>; /* 0:output, 1:input */
+            amlogic,pullup=<1>;
+            amlogic,pullupen=<1>;
+        };
+//$$ MATCH "sdhc_pin_2_match" = "&sdhc_emmc_clk_cmd_pins"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_U32 3*2 = "amlogic,clrmask"
+//$$ L2 PROP_STR 2 = "amlogic,pins"
+//$$ L2 PROP_U32 = "amlogic,enable-output"
+//$$ L2 PROP_U32 = "amlogic,pullup"
+//$$ L2 PROP_U32 = "amlogic,pullupen"
+        sdhc_emmc_clk_cmd_pins:sdhc_emmc_clk_cmd_pins{
+            amlogic,setmask=<7 0xc0000>;         /*bit[18-19] */
+            amlogic,clrmask=<2 0x04c000f0           /*sdhc b & nand*/
+                                5 0x00007c00        /*sdhc a*/
+                                6 0xff000000>;        /*sdio c*/
+            amlogic,pins = "BOOT_8","BOOT_10"; /** BOOT_10:CMD, BOOT_8:CLK */
+            amlogic,enable-output=<1>; /** 0:output, 1:input */
+            amlogic,pullup=<1>;
+            amlogic,pullupen=<1>;
+        };
+//$$ MATCH "sdhc_pin_3_match" = "&sdhc_emmc_all_pins"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_U32 3*2 = "amlogic,clrmask"
+//$$ L2 PROP_STR 10 = "amlogic,pins"
+//$$ L2 PROP_U32 = "amlogic,enable-output"
+//$$ L2 PROP_U32 = "amlogic,pullup"
+//$$ L2 PROP_U32 = "amlogic,pullupen"
+        sdhc_emmc_all_pins:sdhc_emmc_all_pins{
+            amlogic,setmask=<4 0x70000000
+                             7 0xc0000>;         /*sdhc c*/
+            amlogic,clrmask=<2 0x04c000f0           /*sdhc b & nand*/
+                                5 0x00007c00        /*sdhc a*/
+                                6 0xff000000>;        /*sdio c*/
+            amlogic,pins = "BOOT_0","BOOT_1","BOOT_2","BOOT_3","BOOT_4","BOOT_5","BOOT_6","BOOT_7","BOOT_8","BOOT_10";
+            amlogic,enable-output=<1>; /** 0:output, 1:input */
+            amlogic,pullup=<1>;
+            amlogic,pullupen=<1>;
+        };
+//$$ MATCH "sdhc_pin_4_match" = "&sdhc_sdio_clk_cmd_pins"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_U32 3*2 = "amlogic,clrmask"
+//$$ L2 PROP_STR 2 = "amlogic,pins"
+//$$ L2 PROP_U32 = "amlogic,enable-output"
+//$$ L2 PROP_U32 = "amlogic,pullup"
+//$$ L2 PROP_U32 = "amlogic,pullupen"
+        sdhc_sdio_clk_cmd_pins:sdhc_sdio_clk_cmd_pins{
+            amlogic,setmask=<5 0x00000c00>;         /*sdhc a bit[10-11] */
+            amlogic,clrmask=<2 0x058000f0           /*sdhc b*/
+                                4 0x7c000000        /*sdhc c */
+                                8 0x0000003f>;        /*sdio a*/
+            amlogic,pins = "GPIOX_8","GPIOX_9"; /** BOOT_16:CMD, BOOT_17:CLK */
+            amlogic,enable-output=<1>; /** 0:output, 1:input */
+            amlogic,pullup=<1>;
+            amlogic,pullupen=<1>;
+        };
+//$$ MATCH "sdhc_pin_5_match" = "&sdhc_sdio_all_pins"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_U32 3*2 = "amlogic,clrmask"
+//$$ L2 PROP_STR 6 = "amlogic,pins"
+//$$ L2 PROP_U32 = "amlogic,enable-output"
+//$$ L2 PROP_U32 = "amlogic,pullup"
+//$$ L2 PROP_U32 = "amlogic,pullupen"
+        sdhc_sdio_all_pins:sdhc_sdio_all_pins{
+            amlogic,setmask=<5 0x00006c00>;         /*sdhc a*/
+            amlogic,clrmask=<2 0x058000f0           /*sdhc b*/
+                                4 0x7c000000        /*sdhc c */
+                                8 0x0000003f>;        /*sdio a*/
+            amlogic,pins = "GPIOX_0","GPIOX_1","GPIOX_2","GPIOX_3","GPIOX_8","GPIOX_9";
+            amlogic,enable-output=<1>; /** 0:output, 1:input */
+            amlogic,pullup=<1>;
+            amlogic,pullupen=<1>;
+        };
+
+//$$ MATCH "Camera_pin_0_match" = "&aml_cam_gpio_pins"
+//$$ L2 PROP_U32 4 = "amlogic,setmask"
+//$$ L2 PROP_STR 10 = "amlogic,pins"	
+        aml_cam_gpio_pins: aml_cam_gpio_pins{
+			amlogic,setmask=<3 0x80000
+					         9 0x37c>;
+			amlogic,pins = "GPIOH_9","GPIOY_6","GPIOY_7","GPIOY_8","GPIOY_9","GPIOY_10","GPIOY_11","GPIOY_12","GPIOY_13","GPIOY_14";
+		};
+		
+//$$ MATCH "Camera_pin_1_match" = "&aml_cam_csi_pins"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_STR = "amlogic,pins"	
+		aml_cam_csi_pins: aml_cam_csi_pins{
+			amlogic,setmask=<3 0x80000>;
+			amlogic,pins = "GPIOH_9";
+		};
+
+//$$ MATCH "I2C_AO_pin_match" = "&ao_i2c_master"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_U32 2 = "amlogic,clrmask"
+//$$ L2 PROP_STR 2 = "amlogic,pins"
+		ao_i2c_master:ao_i2c{
+			amlogic,setmask=<10 0x60>;
+			amlogic,clrmask=<10 0x1800006>;
+			amlogic,pins="GPIOAO_4","GPIOAO_5";
+		};
+
+//$$ MATCH "I2C_A_pin_match" = "&a_i2c_master"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_U32 6 = "amlogic,clrmask"
+//$$ L2 PROP_STR 2 = "amlogic,pins"
+		a_i2c_master:a_i2c{
+			amlogic,setmask=<9 0xC0000000>;
+			amlogic,clrmask=<0 0x3C0300 
+			                 6 0xC00000
+			                 8 0x1800000>;
+			amlogic,pins="GPIODV_24","GPIODV_25";
+		};
+
+//$$ MATCH "I2C_B_pin_match" = "&b_i2c_master"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_U32 6 = "amlogic,clrmask"
+//$$ L2 PROP_STR 2 = "amlogic,pins"
+		b_i2c_master:b_i2c{
+			amlogic,setmask=<9 0x30000000>;
+			amlogic,clrmask=<0 0x480 
+			                 6 0x300000
+			                 8 0x10780000>;
+			amlogic,pins="GPIODV_26","GPIODV_27";
+		};
+		
+// MATCH "I2C_D_pin_match" = "&d_i2c_master"
+// L2 PROP_U32 2 = "amlogic,setmask"
+// L2 PROP_STR 2 = "amlogic,pins"
+		d_i2c_master:d_i2c{
+			amlogic,setmask=<4 0xc>;
+			amlogic,clrmask=<6 0x3000>;
+			amlogic,pins="GPIOH_7","GPIOH_8";
+		};
+
+//$$ MATCH "remote_pin_0_match" = "&remote_pins"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_STR = "amlogic,pins"
+        remote_pins:remote_pin{
+			amlogic,setmask=<10 0x1>;
+			amlogic,pins="GPIOAO_7";
+		};
+
+//$$ MATCH "Audio_pin_0_match" = "&audio_pins"
+//$$ L2 PROP_U32 4 = "amlogic,setmask"
+//$$ L2 PROP_U32 10 = "amlogic,clrmask"
+//$$ L2 PROP_STR 6 = "amlogic,pins"
+        audio_pins:audio_pin{
+            amlogic,setmask=<0xa 0x78000000
+                             0x1 0x80>;
+            amlogic,clrmask=<0xa 0x80002000
+                             0x1 0x10000
+                             0x3 0x40000>;
+            amlogic,pins = "GPIOAO_8","GPIOAO_9","GPIOAO_10","GPIOAO_11","GPIOY_3";
+        };
+
+//$$ MATCH "Spi_pin_0_match" = "&aml_spi_nor_pins"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_U32 2 = "amlogic,clrmask"
+//$$ L2 PROP_STR 4 = "amlogic,pins"
+		aml_spi_nor_pins: aml_spi_nor_pins{
+			amlogic,setmask=<5 0xf>;
+			amlogic,clrmask=<2 0x10380000>;
+			amlogic,pins = "BOOT_11","BOOT_12","BOOT_13","BOOT_18";
+		};
+//$$ MATCH "meson_vcck_dvfs_pin_0_match" = "&aml_pwm_pins"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_U32 2 = "amlogic,clrmask"
+//$$ L2 PROP_STR = "amlogic,pins"
+		aml_pwm_pins:aml_pwm{
+		    	amlogic,setmask=<3 0x1000000>;
+			amlogic,clrmask=<0 0x48
+					 7 0x10000020>;
+			amlogic,pins="GPIODV_9";
+		};
+
+//$$ MATCH "dvb_p_ts0_pins_match" = "&dvb_p_ts0_pins"
+//$$ L2 PROP_U32 1 = "amlogic,setmask"
+//$$ L2 PROP_U32 2 = "amlogic,clrmask"
+//$$ L2 PROP_STR 11 = "amlogic,pins"
+		dvb_p_ts0_pins: dvb_p_ts0_pins {
+			amlogic,setmask = <3 0x37>;
+			amlogic,clrmask = <5 0xC0
+								9 0x37C>;
+			amlogic,pins = "GPIOY_9","GPIOY_10","GPIOY_11","GPIOY_12","GPIOY_13","GPIOY_14","GPIOY_6","GPIOY_7","GPIOY_0","GPIOY_1","GPIOY_8";
+		};
+
+//$$ MATCH "dvb_s_ts0_pins_match" = "&dvb_s_ts0_pins"
+//$$ L2 PROP_U32 1 = "amlogic,setmask"
+//$$ L2 PROP_U32 1 = "amlogic,clrmask"
+//$$ L2 PROP_STR 4 = "amlogic,pins"
+		dvb_s_ts0_pins: dvb_s_ts0_pins {
+			amlogic,setmask = <3 0x17>;
+			amlogic,clrmask = <9 0x378>;
+			amlogic,pins = "GPIOY_9","GPIOY_0","GPIOY_1","GPIOY_8";
+		};
+
+	};
+/// ***************************************************************************************
+///	-	Ethernet
+//$$ MODULE="Ethernet"
+//$$ DEVICE="meson-eth"
+//$$ L2 PROP_STR = "status"
+    meson-eth{
+		compatible = "amlogic,meson-eth";
+		dev_name = "meson-eth";
+		status = "okay";
+		ethbaseaddr = <0xfe0c0000>;
+		interruptnum = <40>;
+		new_maclogic = <1>;
+	};
+
+/// ***************************************************************************************
+///	-	RNG
+//$$ MODULE="RNG"
+//$$ DEVICE="meson-rng"
+//$$ L2 PROP_STR = "status"
+	meson-rng{
+		compatible = "amlogic,meson-rng";
+		status = "ok";
+	};
+///	-	DVB
+//$$ MODULE="DVB"
+
+//$$ DEVICE="dvb"
+//$$ L2 PROP_STR = "ts0"
+//$$ L2 PROP_U32 = "ts0_invert"
+//$$ L2 PROP_U32 = "ts0_control"
+//$$ L2 PROP_STR 6 = "pinctrl-names"
+//$$ L2 PROP_CHOICE "dvb_p_ts0_pins_match" = "pinctrl-0"
+//$$ L2 PROP_CHOICE "dvb_s_ts0_pins_match" = "pinctrl-1"
+	dvb{
+		compatible = "amlogic,dvb";
+		/*"parallel","serial","disable"*/
+		ts0 = "parallel";
+		ts0_control = <0>;
+		ts0_invert = <0>;
+		pinctrl-names = "p_ts0", "s_ts0";
+		pinctrl-0 = <&dvb_p_ts0_pins>;
+		pinctrl-1 = <&dvb_s_ts0_pins>;
+	};
+
+//$$ DEVICE="dvbfe"
+//$$ L2 PROP_STR = "dtv_demod0"
+//$$ L2 PROP_U32 = "dtv_demod0_i2c_adap_id"
+//$$ L2 PROP_U32 = "dtv_demod0_i2c_addr"
+//$$ L2 PROP_U32 = "dtv_demod0_reset_value"
+//$$ L2 PROP_STR = "dtv_demod0_reset_gpio"
+//$$ L2 PROP_U32 = "fe0_dtv_demod"
+//$$ L2 PROP_U32 = "fe0_ts"
+//$$ L2 PROP_U32 = "fe0_dev"
+//$$ L2 PROP_STR 6 = "pinctrl-names"
+//$$ L2 PROP_CHOICE "dvb_fe_pins_match" = "pinctrl-0"
+	dvbfe{
+		compatible = "amlogic,dvbfe";
+		dtv_demod0 = "Si2168";
+		dtv_demod0_i2c_adap_id = <4>;
+		dtv_demod0_i2c_addr = <0x64>;
+		dtv_demod0_reset_value = <0>;
+		dtv_demod0_reset_gpio = "GPIOY_3";
+		fe0_dtv_demod = <0>;
+		fe0_ts = <0>;
+		fe0_dev = <0>;
+	};
+
+/*	dvbfe{
+		compatible = "amlogic,dvbfe";
+		dtv_demod0 = "Mxl101";
+		dtv_demod0_i2c_adap_id = <4>;
+		dtv_demod0_i2c_addr = <0x60>;
+		dtv_demod0_reset_value = <0>;
+		dtv_demod0_reset_gpio = "GPIOY_3";
+		fe0_dtv_demod = <0>;
+		fe0_ts = <0>;
+		fe0_dev = <0>;
+	};
+*/
+
+}; /* end of / */
diff --git a/sources/Linux/Amlogic/M201/create-3.10.33-20160716-m201-dtbs-patch/linux-aml-3.10.33-20160716-new/arch/arm/boot/dts/amlogic/meson8b_m201_512M.dtd b/sources/Linux/Amlogic/M201/create-3.10.33-20160716-m201-dtbs-patch/linux-aml-3.10.33-20160716-new/arch/arm/boot/dts/amlogic/meson8b_m201_512M.dtd
new file mode 100644
index 000000000..21204518e
--- /dev/null
+++ b/sources/Linux/Amlogic/M201/create-3.10.33-20160716-m201-dtbs-patch/linux-aml-3.10.33-20160716-new/arch/arm/boot/dts/amlogic/meson8b_m201_512M.dtd
@@ -0,0 +1,1927 @@
+/dts-v1/;
+/// ***************************************************************************************\n
+//$$ PROJECT="meson8b"
+//$$ REMOVE 1
+void root_func(){
+//$$ ADD /{
+	compatible = "AMLOGIC,8726_M8B";
+	model = "AMLOGIC";
+	interrupt-parent = <&gic>;
+	#address-cells = <1>;
+	#size-cells = <1>;
+	
+/// ***************************************************************************************
+///	-	CPU
+//$$ MODULE="CPU"
+    cpus {
+        #address-cells = <1>;
+        #size-cells = <0>;
+//$$ DEVICE="cpu0"
+        cpu@0 {
+        	device_type = "cpu";
+        	compatible = "arm,cortex-a5";
+        	reg = <0x200>;
+        };
+//$$ DEVICE="cpu1"
+        cpu@1 {
+        	device_type = "cpu";
+        	compatible = "arm,cortex-a5";
+        	reg = <0x1>;
+        };
+//$$ DEVICE="cpu2"
+        cpu@2 {
+        	device_type = "cpu";
+        	compatible = "arm,cortex-a5";
+        	reg = <0x2>;
+        };
+//$$ DEVICE="cpu3"
+        cpu@3 {
+        	device_type = "cpu";
+        	compatible = "arm,cortex-a5";
+        	reg = <0x3>;
+        };
+    };
+
+/// ***************************************************************************************
+///	-	Cache
+//$$ MODULE="Cache"
+//$$ DEVICE="cache"
+    cache-controller {
+          compatible = "arm,meson-pl310-cache";
+          reg = <0xc4200000 0x1000>;
+          arm,data-latency = <3 3 3>;
+          arm,tag-latency = <2 2 2>;
+          arm,filter-ranges = <0x100000 0xc0000000>;
+          cache-unified;
+          cache-level = <2>;
+          aux-instruction_prefetch;
+          aux-data_prefetch;
+          aux-ns_lockdown;
+          aux-force_no_write_alloc;
+          aux-cache_replace_policy_round_robin;
+          aux-early_write_response;
+          aux-full_line_of_zero;
+          aux-ns_int_ctrl;
+          aux-share_override;
+          prefetch-double_line_fill;
+          prefetch-prefetch_drop;
+          prefetch-prefetch_offset = <7>;
+    };
+
+/// ***************************************************************************************
+///	-	Memory
+//$$ MODULE="Memory"
+//$$ DEVICE="memory"
+//$$ L2 PROP_U32 = "aml_reserved_start"
+//$$ L2 PROP_U32 = "aml_reserved_end"
+//$$ L2 PROP_U32 6 = "linux,usable-memory"
+	memory{
+		device_type = "memory";
+		aml_reserved_start = <0x06000000>; /**reserved memory start */
+		aml_reserved_end = <0x05000000>;/**reserved memory end */
+		phys_offset = <0x00200000>;
+		linux,total-memory = <0x1fe00000>;
+
+        #address-cells = <1>;
+        #size-cells = <1>;
+
+        cma_0:region@0 {
+           region_name = "cma_0";
+           reg = <0 0x02a00000>;
+           linux,contiguous-region;
+        };
+	};
+/// ***************************************************************************************
+///	-	GIC
+//$$ MODULE="GIC"
+//$$ DEVICE="gic"	
+	gic:interrupt-controller{
+        compatible = "arm,cortex-a9-gic";
+        reg = <0xc4301000 0x1000
+               0xc4300100 0x0100>;
+        interrupt-controller;
+        #interrupt-cells = <3>;
+        #address-cells = <0>;
+    };
+    
+/// ***************************************************************************************
+///	-	VPU
+//$$ MODULE="VPU"
+//$$ DEVICE="vpu"
+//$$ L2 PROP_STR = "status"
+//$$ L2 PROP_U32 = "clk_level"
+    vpu{
+		compatible = "amlogic,vpu";
+		dev_name = "vpu";	
+		status = "ok";
+		clk_level = <3>;
+		/**    	0: 106.25M		1: 127.5M		2: 159.375M
+				3: 182.15M		4: 212.5M	 */
+	};
+	
+/// **************************************************************************************	
+/// -   DISP&MM-FB
+//$$ MODULE = "DISP&MM-FB"	
+//$$ DEVICE = "mesonfb"
+//$$ L2 PROP_STR = "status"
+//$$ L3 PROP_U32 4 ="reg"
+//$$ L2 PROP_U32 = "vmode"
+//$$ L2 PROP_U32 5 = "display_size_default"
+	mesonfb{
+		compatible = "amlogic,mesonfb";
+		dev_name = "mesonfb";
+		status = "okay";
+		reserve-memory = <0x01800000 0x00100000>;
+		reserve-iomap = "true";
+		vmode = <3>; /* 0:VMODE_720P 1:VMODE_LCD 2:VMODE_LVDS_1080P 3:VMODE_1080P */
+		scale_mode = <1>; /* 0:default 1:new */
+		4k2k_fb = <0>;
+	        display_size_default = <1920 1080 1920 3240 32>;  /* osd0:24M, osd1:1m  1920*1080*4*3 = 24,883,200 */
+	};
+
+//$$ DEVICE="deinterlace"
+//$$ L2 PROP_STR = "status"
+//$$ L2 PROP_U32 2 = "reg"
+    deinterlace{
+		compatible = "amlogic,deinterlace";
+		dev_name = "deinterlace";
+		status = "ok";
+		reserve-memory = <0x02100000>; //10x1920x1088x3/2=33M
+	};
+
+/// ***************************************************************************************
+///	-	DISP&MM-A/V stream
+//$$ MODULE = "DISP&MM-A/V stream"
+//$$ DEVICE="mesonstream"
+//$$ L2 PROP_STR = "status"
+//$$ L3 PROP_U32 4 ="reg"
+	mesonstream{
+		compatible = "amlogic,mesonstream";
+		dev_name = "mesonstream.0";
+		status = "okay";
+		reserve-memory = <0x02000000>; // 32M
+		reserve-iomap = "true";
+	};
+
+/// ***************************************************************************************
+///     -       DISP&MM-A/V stream
+//$$ MODULE = "DISP&MM-A/V video dec"
+//$$ DEVICE="vdec"
+//$$ L2 PROP_STR = "status"
+//$$ L3 PROP_U32 4 ="reg"
+        vdec{
+                compatible = "amlogic,vdec";
+                dev_name = "vdec.0";
+                status = "okay";
+                reserve-memory = <0x02000000>;//32M
+		reserve-iomap = "true";
+        };
+
+/// ***************************************************************************************
+///	-	DISP&MM-PostProcess
+//$$ MODULE="DISP&MM-PostProcess"
+//$$ DEVICE="ppmgr"
+//$$ L2 PROP_STR = "status"
+//$$ L3 PROP_U32 2 ="reg"
+    ppmgr{
+		compatible = "amlogic,ppmgr";
+		dev_name = "ppmgr";
+		status = "okay";
+		reserve-memory = <0x01000000>;//16M
+		reserve-iomap = "true";
+	};
+
+/// ***************************************************************************************
+///	-	DISP&MM-AVC Video Encoder
+//$$ MODULE = "DISP&MM-AVC Video Encoder"
+//$$ DEVICE="amvenc_avc"
+//$$ L2 PROP_STR = "status"
+//$$ L3 PROP_U32 2 ="reg"
+    amvenc_avc{
+		compatible = "amlogic,amvenc_avc";
+		dev_name = "amvenc_avc.0";
+		status = "okay";
+		linux,contiguous-region = <&cma_0>;
+		reserve-iomap = "true";
+	};
+
+/// ***************************************************************************************
+///	-	DISP&MM-BT656
+//$$ MODULE = "DISP&MM-BT656"
+//$$ DEVICE="amvdec_656in"
+//$$ L2 PROP_STR = "status"
+//$$ L2 PROP_U32 2 = "reg"
+//    amvdec_656in{
+//		compatible = "amlogic,amvdec_656in";
+//		dev_name = "amvdec_656in";
+//		status = "ok";
+//		reg = <0x1e400000 0x00100000>;
+//	};
+//	
+/// ***************************************************************************************
+///	-	DISP&MM-VDIN
+//$$ MODULE = "DISP&MM-VDIN"
+//$$ DEVICE="vdin0"
+//$$ L2 PROP_STR = "status"
+//$$ L2 PROP_U32 2 = "reg"
+//$$ L2 PROP_U32 = "irq"
+//$$ L2 PROP_U32 = "vdin_id"
+//    vdin0{
+//       compatible = "amlogic,vdin";
+//        dev_name = "vdin0";
+//        status = "ok";
+//	 reserve-memory = <0x04000000>;
+//        irq = <115>;
+//        vdin_id = <0>;
+//	};
+	
+//$$ DEVICE="vdin1"
+//$$ L2 PROP_STR = "status"
+//$$ L2 PROP_U32 2 = "reg"
+//$$ L2 PROP_U32 = "irq"
+//$$ L2 PROP_U32 = "vdin_id"
+//    vdin1{
+//        compatible = "amlogic,vdin";
+//       dev_name = "vdin1";
+//        status = "ok";
+//        reserve-memory = <0x01000000>;
+//	  miracast_size = <1920 1080>;//1920x1080x2x4=17M
+//	  reserve-iomap = "true";
+//        irq = <117>;
+//        vdin_id = <1>;
+//	};
+
+/// ***************************************************************************************
+///	-	DISP&MM-AMLVIDEO2
+//$$ MODULE = "DISP&MM-AMLVIDEO2"
+//$$ DEVICE="amlvideo2"
+//$$ L2 PROP_STR = "status"
+//$$ L3 PROP_U32 2 ="reg"
+//    amlvideo2{
+//		compatible = "amlogic,amlvideo2";
+//		dev_name = "amlvideo2.0";
+//		status = "okay";
+//		reserve-memory = <0x01800000>;
+//		reserve-iomap = "true";
+//	};
+
+/// ***************************************************************************************
+///	-	DISP&MM-Video Input Manager
+//$$ MODULE = "DISP&MM-Video Input Manager"
+//$$ DEVICE="vm"
+//$$ L2 PROP_STR = "status"
+//    vm{
+//		compatible = "amlogic,vm";
+//		dev_name = "vm.0";
+//		status = "okay";
+//		reserve-memory = <0x01800000>;
+//		reserve-iomap = "true";
+//	};
+
+/// ***************************************************************************************
+///	-	ION
+//$$ MODULE="ION"
+//$$ DEVICE="ion_dev"
+//$$ L2 PROP_STR = "status"
+    ion_dev{
+        compatible = "amlogic,ion_dev";
+        dev_name = "ion_dev";
+        status = "ok";
+        share-memory-name = "ppmgr0";
+        share-memory-offset = <0>;
+        share-memory-size = <0x01000000>; //16M
+    };
+/// ***************************************************************************************
+///	-	DISP&MM-Vout
+//$$ MODULE = "DISP&MM-Vout"
+//$$ DEVICE = "mesonvout"
+//$$ L2 PROP_STR = "status"
+	mesonvout{
+		compatible = "amlogic,mesonvout";
+		dev_name = "mesonvout";
+		status = "okay";
+	};
+
+/// ***************************************************************************************
+///	-	RTC
+//$$ MODULE="RTC"
+//$$ DEVICE="Rtc"
+//$$ L2 PROP_STR = "status"
+    rtc{
+		compatible = "amlogic,aml_rtc";
+		status = "okay";
+	};
+
+/// ***************************************************************************************
+///	-	UART
+//$$ MODULE="UART"
+//$$ DEVICE="uart_ao"
+//$$ L2 PROP_STR = "status"
+//$$ L2 PROP_STR = "pinctrl-names"
+//$$ L3 PROP_CHOICE "uart_ao_pin_match" = "pinctrl-0"
+	uart_ao{
+		compatible = "amlogic,aml_uart";
+		port_name = "uart_ao";
+		status = "okay";
+		dev_name = "uart_ao";
+		pinctrl-names = "default";
+		pinctrl-0 = <&ao_uart_pins>;
+	};
+	
+//$$ DEVICE="uart_0"
+//$$ L2 PROP_STR = "status"
+	uart_0{
+		compatible = "amlogic,aml_uart";
+		port_name = "uart_a";
+		status = "okay";
+		dev_name = "uart_0";
+//    	pinctrl-names = "default";
+//    	pinctrl-0 = <&a_uart_pins>;
+	};
+	
+//$$ DEVICE="uart_1"
+//$$ L2 PROP_STR = "status"
+	uart_1{
+		compatible = "amlogic,aml_uart";
+		port_name = "uart_b";
+		status = "okay";
+		dev_name = "uart_1";
+        pinctrl-names = "default";
+        pinctrl-0 = <&b_uart_pins>;
+	};
+	
+//$$ DEVICE="uart_2"
+//$$ L2 PROP_STR = "status"
+	uart_2{
+		compatible = "amlogic,aml_uart";
+		port_name = "uart_c";
+		status = "disabled";
+		dev_name = "uart_2";
+	};
+	
+//$$ DEVICE="uart_3"
+//$$ L2 PROP_STR = "status"	
+	uart_3{
+		compatible = "amlogic,aml_uart";
+		port_name = "uart_d";
+		status = "ok";
+		dev_name = "uart_3";
+	};
+
+/// ***************************************************************************************
+///	-	Bluetooth
+//$$ MODULE="Bluetooth"
+//$$ DEVICE="bt-dev"
+//$$ L2 PROP_STR = "status"
+//$$ L2 PROP_STR = "gpio_reset"
+    bt-dev{
+        compatible = "amlogic,bt-dev";
+        dev_name = "bt-dev";
+        status = "ok";
+        gpio_reset = "GPIOX_20";
+    };
+/// ***************************************************************************************
+///	-	WiFi
+//$$ MODULE="WiFi"
+//$$ DEVICE="aml_broadcm_wifi"
+//$$ L2 PROP_STR = "status"
+//$$ L2 PROP_STR = "interrupt_pin"
+//$$ L2 PROP_U32 = "irq_num"
+//$$ L2 PROP_STR = "irq_trigger_type"
+//$$ L2 PROP_STR = "power_on_pin"
+//$$ L2 PROP_STR = "clock_32k_pin"
+    wifi{
+		compatible = "amlogic,aml_broadcm_wifi";
+		dev_name = "aml_broadcm_wifi";
+		status = "okay";
+		interrupt_pin = "GPIOX_21";
+		irq_num = <4>;
+		irq_trigger_type = "GPIO_IRQ_HIGH";
+		power_on_pin = "GPIOAO_6";
+		power_on_pin2 = "GPIOX_11";
+		clock_32k_pin = "GPIOX_10";
+	};
+	
+//$$ DEVICE="wifi_power"
+//$$ L2 PROP_STR = "status"
+//$$ L2 PROP_STR = "power_gpio"
+	wifi_power{
+            compatible = "amlogic,wifi_power";
+            dev_name = "wifi_power";
+            status = "okay";
+            power_gpio = "GPIOAO_6";
+            power_gpio2 = "GPIOX_11";
+	}; 
+
+/// ***************************************************************************************
+///	-	MMC
+//$$ MODULE="MMC"
+//$$ DEVICE="aml_sdio"
+//$$ L2 PROP_STR = "status"
+//$$ L3 PROP_U32 2 ="reg"
+//$$ L2 PROP_STR 7 = "pinctrl-names"
+//$$ L2 PROP_CHOICE "sdio_pin_0_match" = "pinctrl-0"
+//$$ L2 PROP_CHOICE "sdio_pin_1_match" = "pinctrl-1"
+//$$ L2 PROP_CHOICE "sdio_pin_2_match" = "pinctrl-2"
+//$$ L2 PROP_CHOICE "sdio_pin_3_match" = "pinctrl-3"
+//$$ L2 PROP_CHOICE "sdio_pin_4_match" = "pinctrl-4"
+//$$ L2 PROP_CHOICE "sdio_pin_5_match" = "pinctrl-5"
+//$$ L2 PROP_CHOICE "sdio_pin_6_match" = "pinctrl-6"
+    sdio{
+        compatible = "amlogic,aml_sdio";
+        dev_name = "aml_sdio.0";
+        status = "okay";
+        reg = <0xc1108c20 0x20>;
+        pinctrl-names = "sd_clk_cmd_pins", "sd_all_pins", "emmc_clk_cmd_pins", "emmc_all_pins", "sdio_clk_cmd_pins", "sdio_all_pins","sd_1bit_pins"; // "jtag_pin", "uartao_default";
+        pinctrl-0 = <&sd_clk_cmd_pins>;
+        pinctrl-1 = <&sd_all_pins>;
+        pinctrl-2 = <&emmc_clk_cmd_pins>;
+        pinctrl-3 = <&emmc_all_pins>;
+        pinctrl-4 = <&sdio_clk_cmd_pins>;
+        pinctrl-5 = <&sdio_all_pins>;
+        pinctrl-6 = <&sd_1bit_pins>;
+
+//$$ DEVICE="sd"
+//$$ L2 PROP_STR = "status"
+//$$ L3 PROP_U32 = "port"
+//$$ L2 PROP_STR = "pinname"
+//$$ L3 PROP_U32 = "ocr_avail"
+//$$ L2 PROP_STR 3 = "caps"
+//$$ L3 PROP_U32 = "f_min"
+//$$ L3 PROP_U32 = "f_max"
+//$$ L3 PROP_U32 = "f_max_w"
+//$$ L3 PROP_U32 = "max_req_size"
+//$$ L2 PROP_STR = "gpio_dat3"
+//$$ L2 PROP_STR = "jtag_pin"
+//$$ L2 PROP_STR = "gpio_cd"
+//$$ L2 PROP_STR = "gpio_ro"
+//$$ L2 PROP_U32 = "irq_in"
+//$$ L2 PROP_U32 = "irq_out"
+//$$ L2 PROP_U32 = "card_type"
+      sd{
+            status = "okay";
+            port = <1>;          /**0:sdio_a, 1:sdio_b, 2:sdio_c, 3:sdhc_a, 4:sdhc_b, 5:sdhc_c */
+            pinname = "sd";
+            ocr_avail = <0x200000>;          /**VDD voltage 3.3 ~ 3.4 */
+            caps = "MMC_CAP_4_BIT_DATA","MMC_CAP_MMC_HIGHSPEED","MMC_CAP_SD_HIGHSPEED";
+            f_min = <300000>;
+            f_max = <50000000>;
+            f_max_w = <50000000>;
+            max_req_size = <0x20000>;          /**128KB*/
+            gpio_dat3 = "CARD_4";
+            jtag_pin = "CARD_0";
+            gpio_cd = "CARD_6";
+//            gpio_ro = "GPIODV_25";
+            irq_in = <3>;
+            irq_out = <5>;
+            card_type = <5>; /* 0:unknown, 1:mmc card(include eMMC), 2:sd card(include tSD), 3:sdio device(ie:sdio-wifi), 4:SD combo (IO+mem) card, 5:NON sdio device(means sd/mmc card), other:reserved */
+        };
+
+//$$ DEVICE="emmc"
+//$$ L2 PROP_STR = "status"
+//$$ L3 PROP_U32 = "port"
+//$$ L2 PROP_STR = "pinname"
+//$$ L3 PROP_U32 = "ocr_avail"
+//$$ L2 PROP_STR 4 = "caps"
+//$$ L3 PROP_U32 = "f_min"
+//$$ L3 PROP_U32 = "f_max"
+//$$ L3 PROP_U32 = "f_max_w"
+//$$ L3 PROP_U32 = "max_req_size"
+//$$ L2 PROP_STR = "gpio_dat3"
+//$$ L2 PROP_U32 = "card_type"
+        emmc{
+            status = "ok";
+            port = <2>;          /**0:sdio_a, 1:sdio_b, 2:sdio_c, 3:sdhc_a, 4:sdhc_b, 5:sdhc_c */
+            pinname = "emmc";
+            ocr_avail = <0x200000>;          /**VDD voltage 3.3 ~ 3.4 */
+            caps = "MMC_CAP_4_BIT_DATA","MMC_CAP_MMC_HIGHSPEED","MMC_CAP_SD_HIGHSPEED", "MMC_CAP_NONREMOVABLE","MMC_CAP_ERASE", "MMC_CAP_HW_RESET"; // MMC_CAP_NEEDS_POLL -- for detect, MMC_CAP_NONREMOVABLE -- for eMMC/TSD
+            f_min = <300000>;
+            f_max = <50000000>;
+            f_max_w = <50000000>;
+            max_req_size = <0x20000>;          /**128KB*/
+            gpio_dat3 = "BOOT_3";
+            card_type = <1>; /* 0:unknown, 1:mmc card(include eMMC), 2:sd card(include tSD), 3:sdio device(ie:sdio-wifi), 4:SD combo (IO+mem) card, 5:NON sdio device(means sd/mmc card), other:reserved */
+        };
+
+//$$ DEVICE="sdio"
+//$$ L2 PROP_STR = "status"
+//$$ L3 PROP_U32 = "port"
+//$$ L2 PROP_STR = "pinname"
+//$$ L3 PROP_U32 = "ocr_avail"
+//$$ L2 PROP_STR 4 = "caps"
+//$$ L3 PROP_U32 = "f_min"
+//$$ L3 PROP_U32 = "f_max"
+//$$ L3 PROP_U32 = "max_req_size"
+//$$ L2 PROP_U32 = "card_type"    
+        sdio{
+            status = "ok";
+            port = <0>;          /*0:sdio_a, 1:sdio_b, 2:sdio_c, 3:sdhc_a, 4:sdhc_b, 5:sdhc_c */
+            pinname = "sdio";
+            ocr_avail = <0x200000>;          /*VDD voltage 3.3 ~ 3.4 */
+            caps = "MMC_CAP_4_BIT_DATA","MMC_CAP_SDIO_IRQ","MMC_CAP_MMC_HIGHSPEED","MMC_CAP_SD_HIGHSPEED", "MMC_CAP_NONREMOVABLE";
+            f_min = <300000>;
+            f_max = <50000000>;
+            max_req_size = <0x20000>;          /**128KB*/
+            card_type = <3>; /* 0:unknown, 1:mmc card(include eMMC), 2:sd card(include tSD), 3:sdio device(ie:sdio-wifi), 4:SD combo (IO+mem) card, 5:NON sdio device(means sd/mmc card), other:reserved */
+        };
+    };
+
+//    sdhc{
+//        compatible = "amlogic,aml_sdhc";
+//        dev_name = "aml_sdhc.0";
+//        reg = <0xc1108e00 0x3c>;
+//        pinctrl-names = "sdhc_sd_clk_cmd_pins", "sdhc_sd_all_pins", "sdhc_emmc_clk_cmd_pins", "sdhc_emmc_all_pins", "sdhc_sdio_clk_cmd_pins", "sdhc_sdio_all_pins";
+//        pinctrl-0 = <&sdhc_sd_clk_cmd_pins>;
+//        pinctrl-1 = <&sdhc_sd_all_pins>;
+//        pinctrl-2 = <&sdhc_emmc_clk_cmd_pins>;
+//        pinctrl-3 = <&sdhc_emmc_all_pins>;
+//        pinctrl-4 = <&sdhc_sdio_clk_cmd_pins>;
+//        pinctrl-5 = <&sdhc_sdio_all_pins>;
+//        //pinctrl-6 = <&sd_1bit_pins>;
+
+//$$ DEVICE="sd"
+//$$ L2 PROP_STR = "status"
+//$$ L3 PROP_U32 = "port"
+//$$ L2 PROP_STR = "pinname"
+//$$ L3 PROP_U32 = "ocr_avail"
+//$$ L2 PROP_STR 3 = "caps"
+//$$ L3 PROP_U32 = "f_min"
+//$$ L3 PROP_U32 = "f_max"
+//$$ L3 PROP_U32 = "f_max_w"
+//$$ L3 PROP_U32 = "max_req_size"
+//$$ L2 PROP_STR = "gpio_dat3"
+//$$ L2 PROP_STR = "jtag_pin"
+//$$ L2 PROP_STR = "gpio_cd"
+//$$ L2 PROP_STR = "gpio_ro"
+//$$ L2 PROP_U32 = "irq_in"
+//$$ L2 PROP_U32 = "irq_out"
+//$$ L2 PROP_U32 = "card_type"
+//         sd{
+//             status = "okay";
+//             port = <4>;          /**0:sdhc_a, 1:sdio_b, 2:sdio_c, 3:sdhc_a, 4:sdhc_b, 5:sdhc_c */
+//             pinname = "sd";
+//             ocr_avail = <0x00200080>; // 3.3:0x200000, 1.8+3.3:0x00200080
+//             caps = "MMC_CAP_4_BIT_DATA","MMC_CAP_MMC_HIGHSPEED","MMC_CAP_SD_HIGHSPEED","MMC_CAP_UHS_SDR12","MMC_CAP_UHS_SDR25","MMC_CAP_UHS_SDR50","MMC_CAP_UHS_SDR104";
+//             f_min = <300000>;
+//             f_max = <100000000>;
+//             max_req_size = <0x20000>;          /**128KB*/
+//             gpio_dat3 = "CARD_4";
+//             //jtag_pin = "CARD_0";
+//             gpio_cd = "CARD_6";
+//             //gpio_ro = "GPIOZ_0";
+//             irq_in = <3>;
+//             irq_out = <5>;
+//             card_type = <5>; /* 0:unknown, 1:mmc card(include eMMC), 2:sd card(include tSD), 3:sdio device(ie:sdio-wifi), 4:SD combo (IO+mem) card, 5:NON sdio device(means sd/mmc card), other:reserved */
+//         };
+
+//$$ DEVICE="emmc"
+//$$ L2 PROP_STR = "status"
+//$$ L3 PROP_U32 = "port"
+//$$ L2 PROP_STR = "pinname"
+//$$ L3 PROP_U32 = "ocr_avail"
+//$$ L2 PROP_STR 4 = "caps"
+//$$ L3 PROP_U32 = "f_min"
+//$$ L3 PROP_U32 = "f_max"
+//$$ L3 PROP_U32 = "f_max_w"
+//$$ L3 PROP_U32 = "max_req_size"
+//$$ L2 PROP_STR = "gpio_dat3"
+//$$ L2 PROP_U32 = "card_type"
+//        emmc{
+//            status = "okay";
+//            port = <5>;          /**0:sdio_a, 1:sdio_b, 2:sdio_c, 3:sdhc_a, 4:sdhc_b, 5:sdhc_c */
+//            pinname = "emmc";
+//            ocr_avail = <0x00200080>; // 3.3:0x200000, 1.8+3.3:0x00200080
+//            caps = "MMC_CAP_8_BIT_DATA","MMC_CAP_MMC_HIGHSPEED","MMC_CAP_SD_HIGHSPEED", "MMC_CAP_NONREMOVABLE","MMC_CAP_ERASE", "MMC_CAP_HW_RESET"; // MMC_CAP_NEEDS_POLL -- for detect, MMC_CAP_NONREMOVABLE -- for eMMC/TSD
+//            caps2 = "MMC_CAP2_HS200_1_8V_SDR";
+//            f_min = <300000>;
+//            f_max = <100000000>;
+//            max_req_size = <0x20000>;          /**128KB*/
+//            gpio_dat3 = "BOOT_3";
+//            card_type = <1>; /* 0:unknown, 1:mmc card(include eMMC), 2:sd card(include tSD), 3:sdio device(ie:sdio-wifi), 4:SD combo (IO+mem) card, 5:NON sdio device(means sd/mmc card), other:reserved */
+//        };  
+
+//$$ DEVICE="sdio"
+//$$ L2 PROP_STR = "status"
+//$$ L3 PROP_U32 = "port"
+//$$ L2 PROP_STR = "pinname"
+//$$ L3 PROP_U32 = "ocr_avail"
+//$$ L2 PROP_STR 4 = "caps"
+//$$ L3 PROP_U32 = "f_min"
+//$$ L3 PROP_U32 = "f_max"
+//$$ L3 PROP_U32 = "max_req_size"    
+//$$ L2 PROP_U32 = "card_type"    
+        // sdio{
+        //     status = "okay";
+        //     port = <3>;          /**0:sdio_a, 1:sdio_b, 2:sdio_c, 3:sdhc_a, 4:sdhc_b, 5:sdhc_c */
+        //     pinname = "sdio";
+        //     ocr_avail = <0x00200080>; // 3.3:0x200000, 1.8+3.3:0x00200080
+        //     caps = "MMC_CAP_4_BIT_DATA","MMC_CAP_MMC_HIGHSPEED","MMC_CAP_SD_HIGHSPEED", "MMC_CAP_NONREMOVABLE", "MMC_CAP_UHS_SDR12","MMC_CAP_UHS_SDR25","MMC_CAP_UHS_SDR50","MMC_CAP_UHS_SDR104";
+        //     f_min = <300000>;
+        //     f_max = <100000000>;
+        //     max_req_size = <0x20000>;          /**128KB*/
+        //     card_type = <3>; /* 0:unknown, 1:mmc card(include eMMC), 2:sd card(include tSD), 3:sdio device(ie:sdio-wifi), 4:SD combo (IO+mem) card, 5:NON sdio device(means sd/mmc card), other:reserved */
+        // };
+//    };
+    
+
+/// ***************************************************************************************
+///	-	I2C
+//$$ MODULE="I2C"
+//$$ DEVICE="I2C_AO"
+//$$ L2 PROP_STR = "status"
+//$$ L3 PROP_U32 2 ="reg"
+//$$ L3 PROP_STR = "pinctrl-names"
+//$$ L2 PROP_CHOICE "I2C_AO_pin_match" = "pinctrl-0"	
+	i2c@c8100500{ /*I2C-AO*/
+		compatible = "amlogic,aml_i2c";
+		dev_name = "i2c-AO";
+		status = "ok";
+		reg = <0xc8100500 0x1d>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		device_id = <0>;
+		pinctrl-names="default";
+		pinctrl-0=<&ao_i2c_master>;
+		use_pio = <0>;
+		master_i2c_speed = <100000>;
+	};
+
+//$$ DEVICE = "I2C_A"
+//$$ L2 PROP_STR = "status"
+//$$ L3 PROP_U32 2 ="reg"
+//$$ L3 PROP_STR = "pinctrl-names"
+//$$ L2 PROP_CHOICE "I2C_A_pin_match" = "pinctrl-0"
+    i2c@c1108500{ /*I2C-A*/
+		compatible = "amlogic,aml_i2c";
+		dev_name = "i2c-A";
+		status = "ok";
+		reg = <0xc1108500 0x20>;
+		device_id = <1>;
+		pinctrl-names="default";
+		pinctrl-0=<&a_i2c_master>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		use_pio = <0>;
+		master_i2c_speed = <300000>;
+	};
+	
+//$$ DEVICE="I2C_B"
+//$$ L2 PROP_STR = "status"
+//$$ L3 PROP_U32 2="reg"
+//$$ L3 PROP_STR = "pinctrl-names"
+//$$ L2 PROP_CHOICE "I2C_B_pin_match" = "pinctrl-0"	
+	i2c@c11087c0{ /*I2C-B*/
+		compatible = "amlogic,aml_i2c";
+		dev_name = "i2c-B";
+		status = "ok";
+		reg = <0xc11087c0 0x20>;
+		device_id = <2>;
+		pinctrl-names="default";
+		pinctrl-0=<&b_i2c_master>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		use_pio = <0>;
+		master_i2c_speed = <300000>;
+ 	};
+
+//$$ DEVICE="I2C_C"
+//$$ L2 PROP_STR = "status"
+//$$ L3 PROP_U32 2="reg"
+//$$ L3 PROP_STR = "pinctrl-names"	
+    i2c@c11087e0{ /*I2C-C*/
+		compatible = "amlogic,aml_i2c";
+		dev_name = "i2c-C";
+		status = "ok";
+		reg = <0xc11087e0 0x20>;
+		device_id = <3>;
+		pinctrl-names="default";
+//		pinctrl-0=<&c_i2c_master>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		use_pio = <0>;
+		master_i2c_speed = <300000>;
+	};
+
+//$$ DEVICE="I2C_D"
+//$$ L2 PROP_STR = "status"
+//$$ L3 PROP_U32 2="reg"
+//$$ L3 PROP_STR = "pinctrl-names"
+//$$ L2 PROP_CHOICE "I2C_D_pin_match" = "pinctrl-0"	
+	i2c@c1108d20{ /*I2C-D*/
+		compatible = "amlogic,aml_i2c";
+		dev_name = "i2c-D";
+		status = "ok";
+		reg = <0xc1108d20 0x20>;
+		device_id = <4>;
+		pinctrl-names="default";
+//		pinctrl-0=<&d_i2c_master>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		use_pio = <0>;
+		master_i2c_speed = <300000>;
+	};
+
+/// ***************************************************************************************
+///	-	Power
+//$$ MODULE="Power"
+//$$ DEVICE="dvfs"
+//$$ L2 PROP_STR = "status"
+    dvfs {
+        compatible = "amlogic, amlogic-dvfs";                   /** fixed for driver, don't change       */
+        #address-cells = <1>;
+        #size-cells = <0>;
+        status = "ok";
+
+//$$ L2 PROP_U32 = "dvfs_id"
+//$$ L2 PROP_U32 = "table_count"
+//$$ L2 PROP_U32 16*3 = "dvfs_table"
+        vcck_dvfs {
+            dvfs_id     = <1>;                                  /** must be value of (1 << n)            */
+            table_count = <13>;                                 /** must be correct count for dvfs_table */
+            dvfs_table  = <
+            /* NOTE: frequent in this table must be ascending order */
+            /* frequent(Khz)    min_uV      max_uV                  */
+                  96000         860000      860000
+                 192000         860000      860000
+                 312000         860000      860000
+                 408000         860000      860000
+                 504000         860000      860000
+                 600000         860000      860000
+                 720000         860000      860000
+                 816000         900000      900000
+                1008000         920000      920000
+                1200000         970000      970000
+                1320000        1100000     1100000
+                1488000        1100000     1100000
+                1536000        1140000     1140000
+            >;
+        };
+    };
+//$$ DEVICE="meson_vcck_dvfs_driver"
+//$$ L2 PROP_STR = "status"
+//$$ L2 PROP_STR = "pinctrl-names"
+//$$ L2 PROP_CHOICE "meson_vcck_dvfs_pin_0_match" = "pinctrl-0"
+//$$ L2 PROP_U32 = "use_pwm"
+//$$ L2 PROP_U32 = "table_count"
+//$$ L2 PROP_U32 16*2 = "cs_voltage_table"
+	meson_vcck_dvfs_driver{
+        compatible = "amlogic, meson_vcck_dvfs";
+        dev_name = "meson_vcck_dvfs_driver";
+        status = "ok";
+        pinctrl-names = "default";
+        pinctrl-0 = <&aml_pwm_pins>;
+        use_pwm = <1>; 
+        pmw_controller = "PWM_C";
+        table_count = <29>;
+        cs_voltage_table = <
+        /*   
+         * Note: This table is hardware depended, If your hardware use PWM method,
+         * then first line in this table is PWM register value, second line is
+         * voltage of VCCK according this PWM register value. If your platform use
+         * constant-current source to adjust vcck voltage, then the first line should 
+         * set to 0, means not valid, member 'use_pwm' in this node should set to 0.
+         *
+         *  ---- This table must be in ascending order by voltage ----
+         *    
+         *  PWM value       VCCK voltage 
+         */ 
+		0x1c0000        860000
+		0x1b0001        870000
+		0x1a0002        880000
+		0x190003        890000		
+		0x180004        900000			
+		0x170005        910000
+		0x160006        920000
+		0x150007        930000
+		0x140008        940000			
+		0x130009        950000		
+		0x12000a        960000			
+		0x11000b        970000		
+		0x10000c        980000			
+		0x0f000d        990000			
+		0x0e000e        1000000			
+		0x0d000f        1010000		
+		0x0c0010        1020000			
+		0x0b0011        1030000			
+		0x0a0012        1040000			
+		0x090013        1050000
+		0x080014        1060000
+		0x070015        1070000			
+		0x060016        1080000
+		0x050017        1090000
+		0x040018        1100000
+		0x030019        1110000			
+		0x02001a        1120000			
+		0x01001b        1130000
+		0x00001c        1140000
+        >;   
+    };   	
+
+//$$ DEVICE="arm_pmu"
+//$$ L2 PROP_STR = "status"
+//$$ L2 PROP_U32 4*3 = "interrupts"
+    arm_pmu {
+        compatible = "arm,cortex-a9-pmu";
+        status = "ok";
+        interrupts = <0     137     0x04
+                      0     138     0x04
+                      0     153     0x04
+                      0     154     0x04>;
+    };
+
+/// ***************************************************************************************
+///	-	USB Controller
+//$$ MODULE="USB Controller"
+    usb_con {
+		lm-compatible = "logicmodule-bus";
+
+//$$ DEVICE="usb_b"
+//$$ L2 PROP_U32 = "lm-periph-id"
+//$$ L2 PROP_STR = "clock-src"
+//$$ L2 PROP_U32 = "port-id"
+//$$ L2 PROP_U32 = "port-type"
+//$$ L2 PROP_U32 = "port-speed"
+//$$ L2 PROP_U32 = "port-config"
+//$$ L2 PROP_U32 = "port-dma"
+//$$ L2 PROP_U32 = "port-id-mode"
+//$$ L2 PROP_STR = "status"
+		usb_b{
+			lm-compatible = "amlogic,usb";
+			lm-periph-id = <1>; /** lm name */
+			clock-src = "usb1"; /** clock src */
+			port-id = <1>; /** ref to mach/usb.h */
+			port-type = <1>;	/** 0: otg, 1: host, 2: slave */
+			port-speed = <0>; /** 0: default, 1: high, 2: full */
+			port-config = <0>; /** 0: default */
+			port-dma = <0>; /** 0: default, 1: single, 2: incr, 3: incr4, 4: incr8, 5: incr16, 6: disable*/
+			port-id-mode = <1>; /** 0: hardware, 1: sw_host, 2: sw_slave*/
+			status = "okay";
+		};
+		
+//$$ DEVICE="usb_a"
+//$$ L2 PROP_U32 = "lm-periph-id"
+//$$ L2 PROP_STR = "clock-src"
+//$$ L2 PROP_U32 = "port-id"
+//$$ L2 PROP_U32 = "port-type"
+//$$ L2 PROP_U32 = "port-speed"
+//$$ L2 PROP_U32 = "port-config"
+//$$ L2 PROP_U32 = "port-dma"
+//$$ L2 PROP_U32 = "port-id-mode"
+//$$ L2 PROP_STR = "gpio-vbus-power"
+//$$ L2 PROP_U32 = "gpio-work-mask"
+//$$ L2 PROP_STR = "status"
+		usb_a{
+			lm-compatible = "amlogic,usb";
+			lm-periph-id = <0>; /** lm name */
+			clock-src = "usb0"; /** clock src */
+			port-id = <0>;  /** ref to mach/usb.h */
+			port-type = <1>;	/** 0: otg, 1: host, 2: slave */
+			port-speed = <0>; /** 0: default, high, 1: full */
+			port-config = <0>; /** 0: default */
+			port-dma = <0>; /** 0: default, 1: single, 2: incr, 3: incr4, 4: incr8, 5: incr16, 6: disable*/
+			port-id-mode = <0>; /** 0: hardware, 1: sw_host, 2: sw_slave*/
+//			gpio-vbus-power = "GPIOZ_1";
+			gpio-work-mask	= <1>; /**0: work on pulldown,1:work on pullup*/
+			status = "okay";
+		};
+	};
+
+
+
+
+/// ***************************************************************************************
+/// -   Audio
+//$$ MODULE="Audio"
+//$$ DEVICE="audio_i2s"
+//$$ L2 PROP_STR = "status"
+    audio_platform{
+        compatible = "amlogic,aml-i2s";
+        dev_name = "aml-i2s.0";
+        status = "okay";
+    };
+
+//$$ DEVICE="audio_i2s_dai"
+//$$ L2 PROP_STR = "status"
+    audio_dai{
+        compatible = "amlogic,aml-i2s-dai";
+        dev_name = "aml-i2s-dai.0";
+        status = "okay";
+    };
+    audio_spdif_dai{
+        compatible = "amlogic,aml-spdif-dai";
+        dev_name = "aml-spdif-dai.0";
+        status = "okay";
+    };
+
+    audio_spdif_codec{
+        compatible = "amlogic,aml-spdif-codec";
+        dev_name = "spdif-dit.0";
+        status = "okay";
+    };
+
+//$$ DEVICE="audio_pcm2BT_codec"
+//$$ L2 PROP_STR = "status"
+    audio_pcm2BT_codec{
+        compatible = "amlogic,pcm2BT-codec";
+        dev_name = "pcm2bt.0";
+        status = "okay";
+    };
+
+//$$ DEVICE="audio_pcm_dai"
+//$$ L2 PROP_STR = "status"
+    audio_pcm_dai{
+        compatible = "amlogic,aml-pcm-dai";
+        dev_name = "aml-pcm-dai.0";
+        status = "okay";
+    };
+
+//$$ DEVICE="audio_pcm"
+//$$ L2 PROP_STR = "status"
+    audio_pcm{
+        compatible = "amlogic,aml-pcm";
+        dev_name = "aml-pcm.0";
+        status = "okay";
+    };
+
+//$$ DEVICE="audio_m8_audio"
+//$$ L2 PROP_STR = "status"
+    audio_m8_audio{
+        compatible = "amlogic,m8_audio_codec";
+        dev_name = "aml_m8_codec.0";
+        status = "disable";
+    };
+
+//$$ DEVICE="dummy_codec"
+//$$ L2 PROP_STR = "status"
+    dummy_codec{
+        compatible = "amlogic,aml_dummy_codec";
+        dev_name = "dummy_codec.0";
+        status = "okay";
+    };
+
+    aml_audio_codec{
+        compatible = "amlogic,audio_codec";
+        rt5616:rt5616{
+            codec_name = "rt5616";
+            i2c_addr = <0x1B>;
+            i2c_bus = "i2c_bus_d";
+            id_reg = <0x00>;
+            id_val = <0x21>;
+            capless = <0>;
+            status = "disable";
+        };
+        rt5631:rt5631{
+            codec_name = "rt5631";
+            i2c_addr = <0x1A>;
+            i2c_bus = "i2c_bus_b";
+            id_reg = <0x00>;
+            id_val = <0x01>;
+            capless = <0>;
+            status = "disable";      
+        };  
+        wm8960:wm8960{
+            codec_name = "wm8960";
+            i2c_addr = <0x1A>;
+            i2c_bus = "i2c_bus_b";
+            capless = <1>;
+            status = "disable";
+        };
+
+        dummy:dummy{
+          codec_name = "dummy_codec";
+          status = "okay";
+        };
+    };
+
+//$$ DEVICE="aml_m8_sound_card"
+//$$ L2 PROP_STR = "aml,sound_card"
+//$$ L2 PROP_STR = "aml,codec_dai"
+//$$ L2 PROP_STR 6*2 = "aml,audio-routing"
+//$$ L2 PROP_STR = "mute_gpio"
+//$$ L2 PROP_U32 5 = "hp_paraments"
+//$$ L2 PROP_STR = "pinctrl-names"
+//$$ L2 PROP_CHOICE "Audio_pin_0_match" = "pinctrl-0"
+//$$ L2 PROP_STR = "status"
+    aml_m8_sound_card{
+        compatible = "sound_card, aml_snd_m8";
+        aml,sound_card = "AML-M8AUDIO";
+        aml,codec_dai = "AML-M8","rt5616-aif1","rt5631-hifi","wm8960-hifi","dummy_codec";
+        //aml,codec_name = "aml_m8_codec.0","rt5616.4-001b";
+        //aml,audio-codec = <&rt5616>;
+        aml,audio-routing-rt5616 = 
+            "Ext Spk","LOUTL",
+            "Ext Spk","LOUTR",
+            "HP","HPOL",
+            "HP","HPOR",
+            "micbias1","MAIN MIC",
+            "IN2P","micbias1";
+        aml,audio-routing-amlm8 = 
+            "Ext Spk","LINEOUTL",
+            "Ext Spk","LINEOUTR",
+            "HP","HP_L",
+            "HP","HP_R",
+            "MICBIAS","MAIN MIC",
+            "LINPUT1","MICBIAS";
+        aml,audio-routing-dummy=
+            "Ext Spk","LOUTL",
+            "Ext Spk","LOUTR";
+        mute_gpio = "GPIO_BSD_EN";
+        hp_disable;
+        //mute_inv;
+        hp_paraments = <800 300 0 5 1>;
+        pinctrl-names = "aml_snd_m8";
+        pinctrl-0 = <&audio_pins>;
+        status = "okay";
+        
+    };
+
+/// ***************************************************************************************
+///	-	Camera
+//$$ MODULE="Camera"
+///	-	aml_cams
+//$$ DEVICE = "aml_cams"
+//$$ L2 PROP_STR = "status"
+//$$ L2 PROP_STR 2 = "pinctrl-names"
+//$$ L2 PROP_CHOICE "Camera_pin_0_match" = "pinctrl-0"
+//$$ L2 PROP_CHOICE "Camera_pin_1_match" = "pinctrl-1"
+	aml_cams{
+		compatible = "amlogic,cams_prober";
+		status = "okay";
+		pinctrl-names = "gpio","csi";
+		pinctrl-0 = <&aml_cam_gpio_pins> ;
+		pinctrl-1 = <&aml_cam_csi_pins> ;
+
+///	-	ar0543
+//$$ DEVICE="ar0543"
+//$$ L2 PROP_STR = "status"
+//$$ L2 PROP_U32 = "front_back"
+//$$ L2 PROP_STR = "i2c_bus"
+//$$ L2 PROP_STR = "gpio_pwdn"
+//$$ L2 PROP_STR = "gpio_rst"
+//$$ L2 PROP_U32 = "mirror_flip"
+//$$ L2 PROP_U32 = "vertical_flip"
+//$$ L2 PROP_STR = "config_path"
+//$$ L2 PROP_U32 = "mclk"
+//$$ L2 PROP_STR = "bt_path"
+//$$ L2 PROP_STR = "interface"
+//$$ L2 PROP_STR = "clk_channel"
+		cam_0{
+			cam_name = "ar0543";
+			front_back = <0>;
+			i2c_bus = "i2c_bus_d";
+			gpio_pwdn = "GPIOH_6";
+			gpio_rst = "GPIOH_4";
+			mirror_flip = <0>;
+			vertical_flip = <0>;
+			config_path = "/system/etc/camera_isp_cfg/ar0543_skt";
+			mclk = <12000>;
+			bt_path = "csi";
+			interface = "mipi";
+			clk_channel = "a";
+			status = "okay";
+		};
+
+///	-	ov5647
+//$$ DEVICE="ov5647"
+//$$ L2 PROP_STR = "status"
+//$$ L2 PROP_U32 = "front_back"
+//$$ L2 PROP_STR = "i2c_bus"
+//$$ L2 PROP_STR = "gpio_pwdn"
+//$$ L2 PROP_STR = "gpio_rst"
+//$$ L2 PROP_U32 = "mirror_flip"
+//$$ L2 PROP_U32 = "vertical_flip"
+//$$ L2 PROP_STR = "bt_path"
+//$$ L2 PROP_STR = "interface"
+//$$ L2 PROP_STR = "clk_channel"
+		cam_1{
+			cam_name = "ov5647";
+			front_back = <0>;
+			i2c_bus = "i2c_bus_d";
+			gpio_pwdn = "GPIOH_5";
+			gpio_rst = "GPIOH_4";
+			mirror_flip = <0>;
+			vertical_flip = <0>;	
+			config_path = "/system/etc/camera_isp_cfg/ov5647_cw0767";
+			bt_path = "csi";
+			interface = "mipi";
+			clk_channel = "b";
+			status = "okay";
+		};
+		
+		cam_2{
+			cam_name = "ar0833";
+			front_back = <0>;
+			i2c_bus = "i2c_bus_d";
+			gpio_pwdn = "GPIOH_6";
+			gpio_rst = "GPIOH_4";
+			mirror_flip = <0>;
+			vertical_flip = <0>;
+			config_path = "/system/etc/camera_isp_cfg/ar0833_skt";
+			mclk = <12000>;
+			bt_path = "csi";
+			interface = "mipi";
+			clk_channel = "a";
+			status = "okay";
+		};
+	};	
+
+/// ***************************************************************************************
+///	-	Input
+//$$ MODULE="Input"
+//$$ DEVICE="gpio_keypad"
+//$$ L2 PROP_STR = "status"
+//$$ L2 PROP_U32 = "scan_period"
+//$$ L2 PROP_U32 = "key_num"
+//$$ L2 PROP_STR = "key_name"
+//$$ L2 PROP_U32 = "key_code"
+//$$ L2 PROP_STR = "key_pin"
+//$$ L2 PROP_U32 = "irq_keyup"
+//$$ L2 PROP_U32 = "irq_keydown"
+    gpio_keypad{
+		compatible = "amlogic,gpio_keypad";
+		status = "okay";
+		scan_period = <20>;
+		key_num = <1>;
+        key_name = "power";
+		key_code = <116>;
+		key_pin = "GPIOAO_3";
+        irq_keyup = <6>;
+        irq_keydown = <7>;
+	};
+//$$ DEVICE="saradc"
+//$$ L2 PROP_STR = "status"
+	saradc{
+		compatible = "amlogic,saradc";
+		status = "okay";
+	};
+
+//$$ DEVICE="adc_keypad"
+//$$ L2 PROP_STR = "status"
+//$$ L2 PROP_STR = "key_name"
+//$$ L2 PROP_U32 = "key_num"
+//$$ L2 PROP_U32 2 = "key_code"
+//$$ L2 PROP_U32 2 = "key_chan"
+//$$ L2 PROP_U32 2 = "key_val"
+//$$ L2 PROP_U32 2 = "key_tolerance"
+/*    adc_keypad{
+		compatible = "amlogic,adc_keypad";
+		status = "okay";
+		key_name = "menu", "vol-","vol+", "esc", "home";
+		key_num = <5>;
+		key_code = <139 114 115 1 102>;
+		key_chan = <0 0 0 0 0>;
+		key_val = <0 143 271 393 468>; //voltage=0/252/478/692/824mV, val=voltage/1800mV*1023
+		key_tolerance = <40 40 40 40 40>;
+	};
+*/
+
+//$$ DEVICE="meson-remote"
+//$$ L2 PROP_STR = "status"
+//$$ L2 PROP_U32 = "ao_baseaddr"
+//$$ L2 PROP_STR = "pinctrl-names"
+//$$ L2 PROP_CHOICE "remote_pin_0_match" = "pinctrl-0"
+    meson-remote{
+		compatible = "amlogic,aml_remote";
+		dev_name = "meson-remote";
+		status = "ok";
+		ao_baseaddr = <0xf3100480>;
+		pinctrl-names="default";
+		pinctrl-0=<&remote_pins>;
+	};
+
+/// ***************************************************************************************
+///	-	Spi
+//$$ MODULE="Spi"
+//$$ DEVICE="spi"
+//$$ L2 PROP_STR = "status"
+//$$ L2 PROP_U32 2 = "reg"
+//$$ L2 PROP_STR = "pinctrl-names"
+//$$ L2 PROP_CHOICE "Spi_pin_0_match" = "pinctrl-0"
+//$$ L2 PROP_U32 = "nr-parts"
+//$$ L2 PROP_CHOICE "Spi_nr-part-0_match" = "nr-part-0"
+//$$ L2 PROP_CHOICE "Spi_nr-part-1_match" = "nr-part-1"
+    spi@cc000000{
+		compatible = "amlogic,apollo_spi_nor";
+		status = "ok";
+		reg = <0xcc000000 0x04000000>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&aml_spi_nor_pins>;
+
+		nr-parts = <2>;
+		nr-part-0 = <&bootloader>;
+		nr-part-1 = <&ubootenv>;
+
+//$$ MATCH "Spi_nr-part-0_match" = <&bootloader>
+//$$ L2 PROP_STR = "name"
+//$$ L2 PROP_U32 = "offset"
+//$$ L2 PROP_U32 = "size"
+		bootloader:bootloader{
+			name = "bootloader";
+			offset = <0>;
+			size = <0x60000>;
+		};
+
+//$$ MATCH "Spi_nr-part-1_match" = <&ubootenv>
+//$$ L2 PROP_STR = "name"
+//$$ L2 PROP_U32 = "offset"
+//$$ L2 PROP_U32 = "size"
+		ubootenv:ubootenv{
+			name = "ubootenv";
+		      offset = <0x100000>;
+		      size = <0x10000>;
+		};
+	};
+	
+/// ***************************************************************************************
+///	-	Nand
+//$$ MODULE="Nand"
+//$$ DEVICE="aml_nand"
+//$$ L2 PROP_STR = "status"
+//$$ L3 PROP_U32 2 ="reg"
+//$$ L2 PROP_STR 2 = "pinctrl-names"
+//$$ L2 PROP_CHOICE 3 "Nand_pin_0_match" = "pinctrl-0"
+//$$ L2 PROP_CHOICE 3 "Nand_pin_1_match" = "pinctrl-1"
+//$$ L3 PROP_STR ="plat-names"
+//$$ L2 PROP_U32 = "plat-num"
+//$$ L2 PROP_CHOICE "plat-part-0_match" = "plat-part-0"
+	nand{
+		compatible = "amlogic,aml_nand";
+		dev_name = "nand";
+		status = "ok";
+		reg = <0xd0048600 0x24>;
+		pinctrl-names = "nand_rb_mod","nand_norb_mod";
+		pinctrl-0 = <&nand_input_state &conf_nand_state &conf_nand_state1 &nand_base>;
+		pinctrl-1 = <&nand_input_state &conf_nand_state &conf_nand_state1 &nand_base>;
+		device_id = <0>;
+		plat-names = "nandnormal";
+		plat-num = <1>;
+		plat-part-0 = <&normal>;
+
+//$$ MATCH "plat-part-0_match" = <&normal>
+//$$ L2 PROP_STR 4 = "enable_pad"
+//$$ L2 PROP_STR = "busy_pad"
+		normal: normal{
+			enable_pad ="ce0","ce1","ce2","ce3";
+			busy_pad = "rb0";
+		};
+	};
+
+/// ***************************************************************************************
+///	-	Efuse
+//$$ MODULE="Efuse"
+//$$ DEVICE="efuse"
+//$$ L2 PROP_STR = "status"
+//$$ L2 PROP_U32 2 = "plat-pos"
+//$$ L2 PROP_U32 = "plat-count"
+//$$ L2 PROP_U32 = "usid-min"
+//$$ L2 PROP_U32 = "usid-max"
+    efuse{
+		compatible = "amlogic,efuse";
+		dev_name = "efuse";
+		status = "okay";
+		plat-pos = <0 454>;
+		plat-count = <58>;
+		usid-min = <8>; /*reserved*/
+		usid-max = <31>; /*reserved*/
+	};
+	
+/// ***************************************************************************************
+///	-	Thermal
+//$$ MODULE="Thermal"
+//$$ DEVICE="thermal"
+//$$ L2 PROP_U32 3*3 = "trip_point"
+//$$ L2 PROP_U32 = "#thermal-cells"
+//$$ L2 PROP_U32 = "cpu_cali_a"
+//$$ L2 PROP_U32 = "idle_interval"
+	thermal{
+		compatible = "amlogic-thermal";
+		#thermal-cells=<7>;
+		dev_name = "aml_thermal";
+        trip_point=<70 1488001 1488001 511 511 3 2
+                    80 1200001 1200001 435 435 2 2
+                    90  800001  800001 328 328 1 1
+                    260 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff>;
+		cpu_cali_a=<0>;
+		idle_interval=<1000>;
+        use_virtual_thermal;
+        freq_sample_period=<30>;
+        report_time=<1 10 30 60>;         /* based on freq_sample_period */
+        cpu_virtual=<
+             500000  40  40  40  40
+             600000  45  55  60  65
+             800000  50  60  65  70
+            1000000  55  65  70  75
+            1200000  60  70  75  80
+            1350000  65  75  80  85
+        >;
+        gpu_virtual=<
+            183      40  40  40  40
+            251      40  45  50  55
+            319      50  60  65  70
+            426      55  65  70  75
+            511      60  70  75  80
+        >;
+	};
+	
+/// ***************************************************************************************
+///	-	Securitykey
+//$$ MODULE="Securitykey"
+//$$ DEVICE="securitykey"
+//$$ L2 PROP_STR = "status"
+    securitykey{
+		compatible = "amlogic,aml_keys";
+		status = "ok";
+	};
+
+/// ***************************************************************************************
+///	-	Unifykey
+//$$ MODULE="Unifykey"
+//$$ DEVICE="securitykey"
+//$$ L2 PROP_STR = "status"
+//$$ L3 PROP_U32 ="unifykey-num"
+//$$ L2 PROP_CHOICE "Unifykey_0_match" = "unifykey-index-0"
+//$$ L2 PROP_CHOICE "Unifykey_1_match" = "unifykey-index-1"
+//$$ L2 PROP_CHOICE "Unifykey_2_match" = "unifykey-index-2"
+    	unifykey{
+		compatible = "amlogic,unifykey";
+		status = "ok";
+
+		/*efuse-version = <20>;*/ /*m6 efuse version 2,m3 efuse version 1, not config efuse version in default*/
+		unifykey-num = <6>;
+		unifykey-index-0 = <&keysn_0>;
+		unifykey-index-1 = <&keysn_1>;
+		unifykey-index-2 = <&keysn_2>;
+		unifykey-index-3 = <&keysn_3>;
+		unifykey-index-4 = <&keysn_4>;
+		unifykey-index-5 = <&keysn_5>;
+
+
+//$$ MATCH "Unifykey_0_match" = <&keysn_0>
+//$$ L2 PROP_STR = "key-name"
+//$$ L2 PROP_STR = "key-device"
+//$$ L2 PROP_STR = "key-dataformat"
+//$$ L2 PROP_STR 3 = "key-permit"
+		keysn_0: key_0{
+			key-name = "usid";
+			key-device = "nandkey";
+			key-dataformat = "allascii";
+			key-permit = "read","write","del";
+		};
+		
+//$$ MATCH "Unifykey_1_match" = <&keysn_1>
+//$$ L2 PROP_STR = "key-name"
+//$$ L2 PROP_STR = "key-device"
+//$$ L2 PROP_STR = "key-dataformat"
+//$$ L2 PROP_STR 3 = "key-permit"
+		keysn_1:key_1{
+			key-name = "mac";
+			key-device = "nandkey";
+			key-dataformat = "hexdata";
+			key-permit = "read","write","del";
+		};
+		
+//$$ MATCH "Unifykey_2_match" = <&keysn_2>
+//$$ L2 PROP_STR = "key-name"
+//$$ L2 PROP_STR = "key-device"
+//$$ L2 PROP_STR = "key-dataformat"
+//$$ L2 PROP_STR 3 = "key-permit"
+		keysn_2:key_2{
+			key-name = "hdcp";
+			key-device = "nandkey";
+			key-dataformat = "hexdata";
+			key-permit = "read","write","del";
+		};
+
+//$$ MATCH "Unifykey_3_match" = <&keysn_3>
+//$$ L2 PROP_STR = "key-name"
+//$$ L2 PROP_STR = "key-device"
+//$$ L2 PROP_STR = "key-dataformat"
+//$$ L2 PROP_STR 3 = "key-permit"
+		keysn_3:key_3{
+			key-name = "secure_boot_set";
+			key-device = "efusekey";
+			key-dataformat = "hexdata";
+			key-permit = "read","write";
+		};
+		
+//$$ MATCH "Unifykey_4_match" = <&keysn_4>
+//$$ L2 PROP_STR = "key-name"
+//$$ L2 PROP_STR = "key-device"
+//$$ L2 PROP_STR = "key-dataformat"
+//$$ L2 PROP_STR 3 = "key-permit"
+		keysn_4:key_4{
+			key-name = "mac_bt";
+			key-device = "nandkey";
+			key-dataformat = "hexdata";
+			key-permit = "read","write","del";
+		};
+		
+//$$ MATCH "Unifykey_5_match" = <&keysn_5>
+//$$ L2 PROP_STR = "key-name"
+//$$ L2 PROP_STR = "key-device"
+//$$ L2 PROP_STR = "key-dataformat"
+//$$ L2 PROP_STR 3 = "key-permit"
+		keysn_5:key_5{
+			key-name = "mac_wifi";
+			key-device = "nandkey";
+			key-dataformat = "hexdata";
+			key-permit = "read","write","del";
+		};
+	};
+
+/// ***************************************************************************************
+///	-	HDMI
+//$$ MODULE="HDMI"
+//$$ DEVICE="amhdmitx"
+//$$ L2 PROP_STR = "status"
+//$$ L2 PROP_CHOICE "HDMI_vend-data_match" = "vend-data"
+//$$ L2 PROP_CHOICE "HDMI_pwr-ctrl_match" = "pwr-ctrl"
+    amhdmitx{
+		compatible = "amlogic,amhdmitx";
+		dev_name = "amhdmitx";
+		status = "ok";
+        vend-data = <&vend_data>;
+        pwr-ctrl = <&pwr_ctrl>;
+        
+//$$ MATCH "HDMI_vend-data_match" = <&vend_data>
+//$$ L2 PROP_STR = "vendor_name"
+//$$ L2 PROP_U32 = "vendor_id"
+//$$ L2 PROP_STR = "product_desc"
+//$$ L2 PROP_STR = "cec_osd_string"   
+//$$ L2 PROP_U32 = "cec_config"    
+//$$ L2 PROP_U32 = "ao_cec"   
+        vend_data: vend_data{
+            vendor_name = "Amlogic";           /* Max Chars: 8     */
+            vendor_id = <0x000000>;            /* Refer to http://standards.ieee.org/develop/regauth/oui/oui.txt */
+            product_desc = "M8 MBox SKTv1";    /* Max Chars: 16    */
+            cec_osd_string = "MBox";           /* Max Chars: 14    */
+            cec_config = <0x00000f>;           /* 4 bytes: use to control cec switch on/off; distinguish between Mbox and Tablet. <0x00000f>:Mbox; <0x000000> or no this value:Tablet*/
+            ao_cec = <0x000001>;               /* switch between ao-cec and ee-cec:: 1: ao-cec; 0: ee-cec */
+        };
+        
+//$$ MATCH "HDMI_pwr-ctrl_match" = <&pwr_ctrl>
+//$$ L2 PROP_STR = "pwr_5v_on"
+//$$ L2 PROP_STR = "pwr_5v_off"
+//$$ L2 PROP_STR = "pwr_3v3_on"
+//$$ L2 PROP_STR = "pwr_3v3_off"
+//$$ L2 PROP_STR = "pwr_hpll_vdd_on"
+//$$ L2 PROP_STR = "pwr_hpll_vdd_off"
+        pwr_ctrl: pwr_ctrl{
+            pwr_5v_on = "";
+            pwr_5v_off = "";
+            pwr_3v3_on = "";
+            pwr_3v3_off = "";
+            pwr_hpll_vdd_on = "";
+            pwr_hpll_vdd_off = "";
+        };
+	};
+
+/// ***************************************************************************************
+///	-	PowerManager
+//$$ MODULE="PowerManager"
+//$$ DEVICE="amvenc_avc"
+//$$ L2 PROP_STR = "status"
+    aml_pm{
+		compatible = "amlogic,pm-m8";
+		dev_name = "aml_pm_m8";
+		status = "okay";
+	};
+
+/// ***************************************************************************************
+///	-	Cpufreq
+//$$ MODULE="Cpufreq"
+//$$ DEVICE="cpufreq-meson"
+//$$ L2 PROP_STR = "status"
+    cpufreq-meson{
+        compatible = "amlogic,cpufreq-meson";
+        syspll_fixed;
+        status = "okay";
+    };
+
+//    crypto_device{
+//       compatible = "amlogic,crypto-device";
+//       dev_name = "crypto_device";
+//    };
+
+/// **************************************************************************************
+/// -   GPIO
+//$$ MODULE="GPIO"
+//$$ DEVICE="m8-gpio"
+	gpio:gpio{
+		compatible = "amlogic,m8b-gpio";
+		dev_name = "gpio";
+		#gpio-cells=<2>;
+	};
+
+/// **************************************************************************************
+/// -   Pinmux
+//$$ MODULE="Pinmux"
+//$$ DEVICE="pinmux-m8"
+    pinmux{ 
+		compatible = "amlogic,pinmux-m8b";
+		dev_name = "pinmux";
+		#pinmux-cells=<2>;    
+    
+//$$ MATCH "uart_ao_pin_match" = "&ao_uart_pins"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_STR 2 = "amlogic,pins"
+        ao_uart_pins:ao_uart{
+			amlogic,setmask=<10 0x1800>;
+			amlogic,pins="GPIOAO_0", "GPIOAO_1";
+		};
+		
+//$$ MATCH "uart_0_pin_match" = "&a_uart_pins"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_STR 4 = "amlogic,pins"
+//		a_uart_pins:a_uart{
+//			amlogic,setmask=<4 0x3c00>;
+//			amlogic,pins="GPIOX_12", "GPIOX_13", "GPIOX_14", "GPIOX_15";
+//		};
+
+//$$ MATCH "uart_1_pin_match" = "&b_uart_pins"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_STR 4 = "amlogic,pins"
+		b_uart_pins:b_uart{
+			amlogic,setmask=<4 0x03c0>;
+			amlogic,pins="GPIOX_16", "GPIOX_17", "GPIOX_18", "GPIOX_19";
+		};
+		
+//$$ MATCH "Nand_pin_0_match" = "&nand_input_state"
+//$$ MATCH "Nand_pin_1_match" = "&nand_input_state"
+//$$ L2 PROP_STR 18 = "amlogic,pins"
+//$$ L2 PROP_U32 = "amlogic,enable-output"
+		nand_input_state:nand_input{
+			amlogic,pins = "BOOT_0","BOOT_1","BOOT_2","BOOT_3","BOOT_4",
+						"BOOT_5","BOOT_6","BOOT_7","BOOT_12","BOOT_13",
+						"BOOT_8","BOOT_9","BOOT_10","BOOT_11",
+						"BOOT_14","BOOT_15","BOOT_16","BOOT_17";
+			amlogic,enable-output=<1>;
+		};
+		
+//$$ MATCH "Nand_pin_0_match" = "&conf_nand_state"
+//$$ MATCH "Nand_pin_1_match" = "&conf_nand_state"
+//$$ L2 PROP_STR 9 = "amlogic,pins"
+//$$ L2 PROP_U32 = "amlogic,pullup"
+		conf_nand_state: conf_nand{
+			amlogic,pins = "BOOT_0","BOOT_1","BOOT_2","BOOT_3","BOOT_4",
+						"BOOT_5","BOOT_6","BOOT_7","BOOT_15";
+			amlogic,pullup=<0>;
+			amlogic,pullupen=<1>;
+		};
+		conf_nand_state1: conf_nand1{
+			amlogic,pins = "BOOT_8", "BOOT_10";
+			amlogic,pullup=<1>;
+			amlogic,pullupen=<1>;
+		};
+//$$ MATCH "Nand_pin_0_match" = "&nand_base"
+//$$ MATCH "Nand_pin_1_match" = "&nand_base"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_U32 3*2 = "amlogic,clrmask"
+//$$ L2 PROP_STR 17 = "amlogic,pins"
+		nand_base: nand{
+			amlogic,setmask=<2 0x7fe0000>;
+			amlogic,clrmask=<	5 0xe
+							6 0x3f000000
+							4 0x7c000000>;
+			amlogic,pins = "BOOT_0","BOOT_1","BOOT_2","BOOT_3","BOOT_4",
+						"BOOT_5","BOOT_6","BOOT_7","BOOT_8","BOOT_9",
+						"BOOT_10","BOOT_12","BOOT_13",
+						"BOOT_14","BOOT_15","BOOT_16","BOOT_17";
+		};
+		
+//$$ MATCH "Card_pin_0_match" = "&sdhc_b_pins"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_U32 4 = "amlogic,clrmask"
+//$$ L2 PROP_STR 6 = "amlogic,pins"	
+		sdhc_b_pins:sdhc_b_pin{
+			amlogic,setmask=<2 0xfc00>;
+			amlogic,clrmask=<2 0xf0 8 0x600>;
+			amlogic,pins="CARD_0","CARD_1","CARD_2","CARD_3","CARD_4","CARD_5";
+		};
+
+//$$ MATCH "Card_pin_1_match" = "&sdhc_c_pins"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_U32 4 = "amlogic,clrmask"
+//$$ L2 PROP_STR 6 = "amlogic,pins"	
+		sdhc_c_pins:sdhc_c_pin{
+			amlogic,setmask=<6 0x3f000000>;
+			amlogic,clrmask=<4 0x6c000000 2 0x4c00000>;
+			amlogic,pins="BOOT_0","BOOT_1","BOOT_2","BOOT_3","BOOT_10","BOOT_11";
+		};
+
+//$$ MATCH "Card_pin_2_match" = "&sdhc_a_pins"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_U32 2 = "amlogic,clrmask"
+//$$ L2 PROP_STR 6 = "amlogic,pins"		
+		sdhc_a_pins:sdhc_a_pin{
+			amlogic,setmask=<8 0x3f>;
+			amlogic,clrmask=<5 0x6c00 >;
+			amlogic,pins="GPIOX_0","GPIOX_1","GPIOX_2","GPIOX_3","GPIOX_8","GPIOX_9";
+		};
+
+//$$ MATCH "sdio_pin_5_match" = "&sdio_all_pins"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_U32 3*2 = "amlogic,clrmask"
+//$$ L2 PROP_STR 6 = "amlogic,pins"	
+//$$ L2 PROP_U32 = "amlogic,enable-output"
+//$$ L2 PROP_U32 = "amlogic,pullup"
+//$$ L2 PROP_U32 = "amlogic,pullupen"	
+        sdio_all_pins:sdio_all_pins{
+            amlogic,setmask=<8 0x0000003f>;         /*sdio a*/
+            amlogic,clrmask=<6 0x3f000000           /*sdio c*/
+                                2 0x0000fc00        /*sdio b*/
+                                5 0x00006c00>;      /*sdhc a*/
+            amlogic,pins = "GPIOX_0","GPIOX_1","GPIOX_2","GPIOX_3","GPIOX_8","GPIOX_9";
+            amlogic,enable-output=<1>; /** 0:output, 1:input */
+            amlogic,pullup=<1>;
+            amlogic,pullupen=<1>;
+        };
+        
+//$$ MATCH "sdio_pin_4_match" = "&sdio_clk_cmd_pins"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_U32 3*2 = "amlogic,clrmask"
+//$$ L2 PROP_STR 2 = "amlogic,pins"	
+//$$ L2 PROP_U32 = "amlogic,enable-output"
+//$$ L2 PROP_U32 = "amlogic,pullup"
+//$$ L2 PROP_U32 = "amlogic,pullupen"
+        sdio_clk_cmd_pins:sdio_clk_cmd_pins{
+            amlogic,setmask=<8 0x00000003>;         /*sdio a*/
+            amlogic,clrmask=<6 0x3f000000           /*sdio c*/
+                                2 0x0000fc00        /*sdio b*/
+                                5 0x00006c00>;      /*sdhc a*/
+            amlogic,pins = "GPIOX_8","GPIOX_9"; /** GPIOX_8:CLK, GPIOX_9:CMD */
+            amlogic,enable-output=<1>; /** 0:output, 1:input */
+            amlogic,pullup=<1>;
+            amlogic,pullupen=<1>;
+        };
+
+//$$ MATCH "sdio_pin_1_match" = "&sd_all_pins"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_U32 3*2 = "amlogic,clrmask"
+//$$ L2 PROP_STR 6 = "amlogic,pins"	
+//$$ L2 PROP_U32 = "amlogic,enable-output"
+//$$ L2 PROP_U32 = "amlogic,pullup"
+//$$ L2 PROP_U32 = "amlogic,pullupen"
+        sd_all_pins:sd_all_pins{
+            amlogic,setmask=<2 0x0000fc00>;         /*sdio b*/
+            amlogic,clrmask=<6 0x3f000000           /*sdio c*/
+                                8 0x0000063f        /*sdio a, UART*/
+                                2 0x000000f0>;      /*sdhc b*/
+            amlogic,pins = "CARD_0","CARD_1","CARD_2","CARD_3","CARD_4","CARD_5";
+            amlogic,enable-output=<1>; /* 0:output, 1:input */
+            amlogic,pullup=<1>;
+            amlogic,pullupen=<1>;
+        };
+        
+//$$ MATCH "sdio_pin_6_match" = "&sd_1bit_pins"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_U32 3*2 = "amlogic,clrmask"
+//$$ L2 PROP_STR 6 = "amlogic,pins"	
+//$$ L2 PROP_U32 = "amlogic,enable-output"
+//$$ L2 PROP_U32 = "amlogic,pullup"
+//$$ L2 PROP_U32 = "amlogic,pullupen"
+        sd_1bit_pins:sd_1bit_pins{
+            amlogic,setmask=<2 0x00008c00>;         /*sdio b*/
+            amlogic,clrmask=<6 0x3f000000           /*sdio c*/
+                                8 0x0000003f        /*sdio a*/
+                                2 0x000000f0>;      /*sdhc b*/
+            amlogic,pins = "CARD_0","CARD_1","CARD_2","CARD_3","CARD_4","CARD_5";
+            amlogic,enable-output=<1>; /* 0:output, 1:input */
+            amlogic,pullup=<1>;
+            amlogic,pullupen=<1>;
+        };
+        
+//$$ MATCH "sdio_pin_0_match" = "&sd_clk_cmd_pins"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_U32 3*2 = "amlogic,clrmask"
+//$$ L2 PROP_STR 2 = "amlogic,pins"	
+//$$ L2 PROP_U32 = "amlogic,enable-output"
+//$$ L2 PROP_U32 = "amlogic,pullup"
+//$$ L2 PROP_U32 = "amlogic,pullupen"
+        sd_clk_cmd_pins:sd_clk_cmd_pins{
+            amlogic,setmask=<2 0x00000c00>;         /*sdio b*/
+            amlogic,clrmask=<6 0x3f000000           /*sdio c*/
+                                8 0x0000003f        /*sdio a*/
+                                2 0x000000f0>;      /*sdhc b*/
+            amlogic,pins = "CARD_2","CARD_3"; /** CARD_2:CLK, CARD_3:CMD */
+            amlogic,enable-output=<1>; /** 0:output, 1:input */
+            amlogic,pullup=<1>;
+            amlogic,pullupen=<1>;
+        };
+        
+//$$ MATCH "sdio_pin_3_match" = "&emmc_all_pins"  
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_U32 3*2 = "amlogic,clrmask"
+//$$ L2 PROP_STR 6 = "amlogic,pins"	
+//$$ L2 PROP_U32 = "amlogic,enable-output"
+//$$ L2 PROP_U32 = "amlogic,pullup"
+//$$ L2 PROP_U32 = "amlogic,pullupen"      
+        emmc_all_pins:emmc_all_pins{
+            amlogic,setmask=<6 0xfc000000>;         /*sdio c*/
+            amlogic,clrmask=<2 0x06c2fc00           /*sdio b & nand*/
+                                8 0x0000003f        /*sdio a*/
+                                4 0x6c000000>;        /*sdhc c*/
+            amlogic,pins = "BOOT_0","BOOT_1","BOOT_2","BOOT_3","BOOT_8","BOOT_10";
+            amlogic,enable-output=<1>; /** 0:output, 1:input */
+            amlogic,pullup=<1>;
+            amlogic,pullupen=<1>;
+        };
+        
+//$$ MATCH "sdio_pin_2_match" = "&emmc_clk_cmd_pins" 
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_U32 3*2 = "amlogic,clrmask"
+//$$ L2 PROP_STR 2 = "amlogic,pins"	
+//$$ L2 PROP_U32 = "amlogic,enable-output"
+//$$ L2 PROP_U32 = "amlogic,pullup"
+//$$ L2 PROP_U32 = "amlogic,pullupen"
+        emmc_clk_cmd_pins:emmc_clk_cmd_pins{
+            amlogic,setmask=<6 0xc0000000>;         /*bit[30-31] */
+            amlogic,clrmask=<2 0x06c2fc00           /*sdio b & nand   nand bit17 bit25*/ 
+                                8 0x0000003f        /*sdio a*/
+                                7 0xc0000>;        /*sdhc c bit 18-19*/
+            amlogic,pins = "BOOT_8","BOOT_10"; /** BOOT_10:CMD, BOOT_8:CLK */
+            amlogic,enable-output=<1>; /** 0:output, 1:input */
+            amlogic,pullup=<1>;
+            amlogic,pullupen=<1>;
+        };
+sdhc_sd_clk_cmd_pins:sdhc_sd_clk_cmd_pins{
+            amlogic,setmask=<2 0x00000030>;         /*sdhc b*/
+            amlogic,clrmask=<5 0x00007c00           /*sdhc a*/
+                                4 0x7c000000        /*sdhc c*/
+                                2 0x0000fc00        /*sdio b*/
+                                8 0x00000600>;      /*UART*/
+            amlogic,pins = "CARD_2","CARD_3"; /* CARD_2:CLK, CARD_3:CMD */
+            amlogic,enable-output=<1>; /* 0:output, 1:input */
+            amlogic,pullup=<1>;
+            amlogic,pullupen=<1>;
+        };
+        sdhc_sd_all_pins:sdhc_sd_all_pins{
+            amlogic,setmask=<2 0x000000f0>;         /*sdhc b*/
+            amlogic,clrmask=<5 0x00007c00           /*sdhc a*/
+                                4 0x7c000000        /*sdhc c*/
+                                2 0x0000fc00        /*sdio b*/
+                                8 0x00000600>;      /*UART*/
+            amlogic,pins="CARD_0","CARD_1","CARD_2","CARD_3","CARD_4","CARD_5";
+            amlogic,enable-output=<1>; /* 0:output, 1:input */
+            amlogic,pullup=<1>;
+            amlogic,pullupen=<1>;
+        };
+
+        sdhc_emmc_clk_cmd_pins:sdhc_emmc_clk_cmd_pins{
+            amlogic,setmask=<4 0x0c000000>;         /*bit[26-27] */
+            amlogic,clrmask=<2 0x04c000f0           /*sdhc b & nand*/
+                                5 0x00007c00        /*sdhc a*/
+                                6 0x3f000000>;        /*sdio c*/
+            amlogic,pins = "BOOT_16","BOOT_17"; /** BOOT_16:CMD, BOOT_17:CLK */
+            amlogic,enable-output=<1>; /** 0:output, 1:input */
+            amlogic,pullup=<1>;
+            amlogic,pullupen=<1>;
+        };
+        sdhc_emmc_all_pins:sdhc_emmc_all_pins{
+            amlogic,setmask=<4 0x7c000000>;         /*sdhc c*/
+            amlogic,clrmask=<2 0x04c000f0           /*sdhc b & nand*/
+                                5 0x00007c00        /*sdhc a*/
+                                6 0x3f000000>;        /*sdio c*/
+            amlogic,pins = "BOOT_0","BOOT_1","BOOT_2","BOOT_3","BOOT_4","BOOT_5","BOOT_6","BOOT_7","BOOT_16","BOOT_17";
+            amlogic,enable-output=<1>; /** 0:output, 1:input */
+            amlogic,pullup=<1>;
+            amlogic,pullupen=<1>;
+        };
+
+        sdhc_sdio_clk_cmd_pins:sdhc_sdio_clk_cmd_pins{
+            amlogic,setmask=<5 0x00000c00>;         /*sdhc a bit[10-11] */
+            amlogic,clrmask=<2 0x058000f0           /*sdhc b*/
+                                4 0x7c000000        /*sdhc c */
+                                8 0x0000003f>;        /*sdio a*/
+            amlogic,pins = "GPIOX_8","GPIOX_9"; /** BOOT_16:CMD, BOOT_17:CLK */
+            amlogic,enable-output=<1>; /** 0:output, 1:input */
+            amlogic,pullup=<1>;
+            amlogic,pullupen=<1>;
+        };
+        sdhc_sdio_all_pins:sdhc_sdio_all_pins{
+            amlogic,setmask=<5 0x00006c00>;         /*sdhc a*/
+            amlogic,clrmask=<2 0x058000f0           /*sdhc b*/
+                                4 0x7c000000        /*sdhc c */
+                                8 0x0000003f>;        /*sdio a*/
+            amlogic,pins = "GPIOX_0","GPIOX_1","GPIOX_2","GPIOX_3","GPIOX_8","GPIOX_9";
+            amlogic,enable-output=<1>; /** 0:output, 1:input */
+            amlogic,pullup=<1>;
+            amlogic,pullupen=<1>;
+        };
+
+//$$ MATCH "Camera_pin_0_match" = "&aml_cam_gpio_pins"
+//$$ L2 PROP_U32 4 = "amlogic,setmask"
+//$$ L2 PROP_STR 10 = "amlogic,pins"	
+        aml_cam_gpio_pins: aml_cam_gpio_pins{
+			amlogic,setmask=<3 0x80000
+					         9 0x37c>;
+			amlogic,pins = "GPIOH_9","GPIOY_6","GPIOY_7","GPIOY_8","GPIOY_9","GPIOY_10","GPIOY_11","GPIOY_12","GPIOY_13","GPIOY_14";
+		};
+		
+//$$ MATCH "Camera_pin_1_match" = "&aml_cam_csi_pins"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_STR = "amlogic,pins"	
+		aml_cam_csi_pins: aml_cam_csi_pins{
+			amlogic,setmask=<3 0x80000>;
+			amlogic,pins = "GPIOH_9";
+		};
+
+//$$ MATCH "I2C_AO_pin_match" = "&ao_i2c_master"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_U32 2 = "amlogic,clrmask"
+//$$ L2 PROP_STR 2 = "amlogic,pins"
+		ao_i2c_master:ao_i2c{
+			amlogic,setmask=<10 0x60>;
+			amlogic,clrmask=<10 0x1800006>;
+			amlogic,pins="GPIOAO_4","GPIOAO_5";
+		};
+
+//$$ MATCH "I2C_A_pin_match" = "&a_i2c_master"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_U32 6 = "amlogic,clrmask"
+//$$ L2 PROP_STR 2 = "amlogic,pins"
+		a_i2c_master:a_i2c{
+			amlogic,setmask=<9 0xC0000000>;
+			amlogic,clrmask=<0 0x3C0300 
+			                 6 0xC00000
+			                 8 0x1800000>;
+			amlogic,pins="GPIODV_24","GPIODV_25";
+		};
+
+//$$ MATCH "I2C_B_pin_match" = "&b_i2c_master"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_U32 6 = "amlogic,clrmask"
+//$$ L2 PROP_STR 2 = "amlogic,pins"
+		b_i2c_master:b_i2c{
+			amlogic,setmask=<9 0x30000000>;
+			amlogic,clrmask=<0 0x480 
+			                 6 0x300000
+			                 8 0x10780000>;
+			amlogic,pins="GPIODV_26","GPIODV_27";
+		};
+		
+// MATCH "I2C_D_pin_match" = "&d_i2c_master"
+// L2 PROP_U32 2 = "amlogic,setmask"
+// L2 PROP_STR 2 = "amlogic,pins"
+//		d_i2c_master:d_i2c{
+//			amlogic,setmask=<4 0xc>;
+//			amlogic,pins="GPIOH_7","GPIOH_8";
+//		};
+
+//$$ MATCH "remote_pin_0_match" = "&remote_pins"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_STR = "amlogic,pins"
+        remote_pins:remote_pin{
+			amlogic,setmask=<10 0x1>;
+			amlogic,pins="GPIOAO_7";
+		};
+
+//$$ MATCH "Audio_pin_0_match" = "&audio_pins"
+//$$ L2 PROP_U32 4 = "amlogic,setmask"
+//$$ L2 PROP_U32 10 = "amlogic,clrmask"
+//$$ L2 PROP_STR 6 = "amlogic,pins"
+        audio_pins:audio_pin{
+            amlogic,setmask=<0xa 0x78000000
+                             0x1 0x80>;
+            amlogic,clrmask=<0xa 0x80002000
+                             0x1 0x10000
+                             0x3 0x40000>;
+            amlogic,pins = "GPIOAO_8","GPIOAO_9","GPIOAO_10","GPIOAO_11","GPIOY_3";
+        };
+
+//$$ MATCH "Spi_pin_0_match" = "&aml_spi_nor_pins"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_U32 2 = "amlogic,clrmask"
+//$$ L2 PROP_STR 4 = "amlogic,pins"
+		aml_spi_nor_pins: aml_spi_nor_pins{
+			amlogic,setmask=<5 0xf>;
+			amlogic,clrmask=<2 0x380000>;
+			amlogic,pins = "BOOT_11","BOOT_12","BOOT_13","BOOT_18";
+		};
+//$$ MATCH "meson_vcck_dvfs_pin_0_match" = "&aml_pwm_pins"
+//$$ L2 PROP_U32 2 = "amlogic,setmask"
+//$$ L2 PROP_U32 2 = "amlogic,clrmask"
+//$$ L2 PROP_STR = "amlogic,pins"
+		aml_pwm_pins:aml_pwm{
+		    	amlogic,setmask=<3 0x1000000>;
+			amlogic,clrmask=<0 0x48
+					 7 0x10000020>;
+			amlogic,pins="GPIODV_9";
+		};
+
+	};
+/// ***************************************************************************************
+///	-	Ethernet
+//$$ MODULE="Ethernet"
+//$$ DEVICE="meson-eth"
+//$$ L2 PROP_STR = "status"
+    meson-eth{
+		compatible = "amlogic,meson-eth";
+		dev_name = "meson-eth";
+		status = "okay";
+		ethbaseaddr = <0xfe0c0000>;
+		interruptnum = <40>;
+		new_maclogic = <1>;
+	};
+
+}; /* end of / */
diff --git a/sources/Linux/Amlogic/M201/create-3.10.33-20160716-osd-xrgb-patch/create.patch.sh b/sources/Linux/Amlogic/M201/create-3.10.33-20160716-osd-xrgb-patch/create.patch.sh
new file mode 100755
index 000000000..ab65dc96d
--- /dev/null
+++ b/sources/Linux/Amlogic/M201/create-3.10.33-20160716-osd-xrgb-patch/create.patch.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+VERSION=3.10.33-20160716
+
+tar --files-from=file.list -xJvf ../linux-aml-$VERSION.tar.xz
+mv linux-aml-$VERSION linux-aml-$VERSION-orig
+
+cp -rf ./linux-aml-$VERSION-new ./linux-aml-$VERSION
+
+diff -b --unified -Nr  linux-aml-$VERSION-orig  linux-aml-$VERSION > linux-aml-$VERSION-osd-xrgb.patch
+
+mv linux-aml-$VERSION-osd-xrgb.patch ../patches
+
+rm -rf ./linux-aml-$VERSION
+rm -rf ./linux-aml-$VERSION-orig
diff --git a/sources/Linux/Amlogic/M201/create-3.10.33-20160716-osd-xrgb-patch/file.list b/sources/Linux/Amlogic/M201/create-3.10.33-20160716-osd-xrgb-patch/file.list
new file mode 100644
index 000000000..ca030eaeb
--- /dev/null
+++ b/sources/Linux/Amlogic/M201/create-3.10.33-20160716-osd-xrgb-patch/file.list
@@ -0,0 +1,5 @@
+linux-aml-3.10.33-20160716/drivers/amlogic/display/osd/osd_dev.c
+linux-aml-3.10.33-20160716/drivers/amlogic/display/osd/osd_hw.c
+linux-aml-3.10.33-20160716/drivers/amlogic/display/osd/osd_main.c
+linux-aml-3.10.33-20160716/include/linux/amlogic/osd/osd.h
+linux-aml-3.10.33-20160716/include/linux/amlogic/osd/osd_main.h
diff --git a/sources/Linux/Amlogic/M201/create-3.10.33-20160716-osd-xrgb-patch/linux-aml-3.10.33-20160716-new/drivers/amlogic/display/osd/osd_dev.c b/sources/Linux/Amlogic/M201/create-3.10.33-20160716-osd-xrgb-patch/linux-aml-3.10.33-20160716-new/drivers/amlogic/display/osd/osd_dev.c
new file mode 100644
index 000000000..fb10a44d1
--- /dev/null
+++ b/sources/Linux/Amlogic/M201/create-3.10.33-20160716-osd-xrgb-patch/linux-aml-3.10.33-20160716-new/drivers/amlogic/display/osd/osd_dev.c
@@ -0,0 +1,395 @@
+/*
+ * Amlogic osd
+ * frame buffer driver
+ *
+ * Copyright (C) 2009 Amlogic, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the named License,
+ * or any later version.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
+ *
+ * Author:  Tim Yao <timyao@amlogic.com>
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/interrupt.h>
+#include <linux/mutex.h>
+#include <linux/platform_device.h>
+#include <linux/fb.h>
+#include <mach/am_regs.h>
+
+#include <linux/amlogic/osd/osd.h>
+#include <linux/amlogic/osd/osd_dev.h>
+#include <linux/amlogic/osd/osd_hw.h>
+/* to-do: TV output mode should be configured by
+ * sysfs attribute
+ */
+
+void osddev_set(struct myfb_dev *fbdev)
+{
+	
+    fbdev_lock(fbdev);
+
+    //memset((char*) fbdev->fb_mem,0x0,fbdev->fb_len);
+
+    osd_setup(&fbdev->osd_ctl,
+               fbdev->fb_info->var.xoffset,
+               fbdev->fb_info->var.yoffset,
+               fbdev->fb_info->var.xres,
+               fbdev->fb_info->var.yres,
+               fbdev->fb_info->var.xres_virtual,
+               fbdev->fb_info->var.yres_virtual,
+               fbdev->osd_ctl.disp_start_x,
+               fbdev->osd_ctl.disp_start_y,
+               fbdev->osd_ctl.disp_end_x,
+               fbdev->osd_ctl.disp_end_y,
+               fbdev->fb_mem_paddr,
+               fbdev->color,
+               fbdev->fb_info->node);	
+
+
+
+    fbdev_unlock(fbdev);
+    	
+    return;
+}
+void osddev_update_disp_axis(struct myfb_dev *fbdev,int  mode_change)
+{
+	osddev_update_disp_axis_hw(	fbdev->osd_ctl.disp_start_x,
+								fbdev->osd_ctl.disp_end_x,
+               						fbdev->osd_ctl.disp_start_y,
+               						fbdev->osd_ctl.disp_end_y,
+               						fbdev->fb_info->var.xoffset,
+               						fbdev->fb_info->var.yoffset,
+               						mode_change,
+               						fbdev->fb_info->node);
+}
+int osddev_setcolreg(unsigned regno, u16 red, u16 green, u16 blue,
+        u16 transp, struct myfb_dev *fbdev)
+{
+    struct fb_info *info = fbdev->fb_info;
+
+    if ((fbdev->color->color_index== COLOR_INDEX_02_PAL4) ||
+        (fbdev->color->color_index == COLOR_INDEX_04_PAL16) ||
+        (fbdev->color->color_index == COLOR_INDEX_08_PAL256)) {
+
+        fbdev_lock(fbdev);
+
+        osd_setpal_hw(regno, red, green, blue, transp,fbdev->fb_info->node);
+
+        fbdev_unlock(fbdev);
+    }
+
+	if (info->fix.visual == FB_VISUAL_TRUECOLOR) {
+		u32 v, r, g, b, a;
+
+		if (regno >= 16)
+			return 1;
+	 
+        r = red    >> (16 - info->var.red.length);
+        g = green  >> (16 - info->var.green.length);
+        b = blue   >> (16 - info->var.blue.length);
+        a = transp >> (16 - ((info->var.transp.length) ? info->var.transp.length : 8));
+
+		v = (r << info->var.red.offset)   |
+		    (g << info->var.green.offset) |
+		    (b << info->var.blue.offset)  |
+		    (a << info->var.transp.offset);
+
+  		((u32*)(info->pseudo_palette))[regno] = v;
+	}
+
+    return 0;
+}
+void osddev_init(void)
+{
+	osd_init_hw(0);
+}
+u32	osddev_get_osd_order(u32 index)
+{
+	return osd_get_osd_order_hw(index);
+}
+void osddev_change_osd_order(u32 index,u32 order)
+{
+	osd_change_osd_order_hw(index,order);
+}
+void osddev_free_scale_enable(u32 index ,u32 enable)
+{
+	//at present we only support osd1 & osd2 have the same random scale mode.
+	osd_free_scale_enable_hw(index,enable);
+	
+}
+
+void osddev_get_free_scale_enable(u32 index, u32 *free_scale_enable)
+{
+	osd_get_free_scale_enable_hw(index, free_scale_enable);
+}
+
+void osddev_4k2k_fb_mode(u32 fb_for_4k2k)
+{
+	osd_4k2k_fb_mode_hw(fb_for_4k2k);
+}
+
+void osddev_free_scale_mode(u32 index ,u32 freescale_mode)
+{
+	osd_free_scale_mode_hw(index, freescale_mode);
+
+}
+
+void osddev_get_free_scale_mode(u32 index, u32 *freescale_mode)
+{
+	osd_get_free_scale_mode_hw(index, freescale_mode);
+}
+
+void osddev_free_scale_width(u32 index ,u32 width)
+{
+	//at present we only support osd1 & osd2 have the same random scale mode.
+	osd_free_scale_width_hw(index,width);
+	
+}
+
+void osddev_get_free_scale_width(u32 index, u32 *free_scale_width)
+{
+	osd_get_free_scale_width_hw(index, free_scale_width);
+}
+
+void osddev_free_scale_height(u32 index ,u32 height)
+{
+	//at present we only support osd1 & osd2 have the same random scale mode.
+	osd_free_scale_height_hw(index,height);
+	
+}
+
+void osddev_get_free_scale_height(u32 index, u32 *free_scale_height)
+{
+	osd_get_free_scale_height_hw(index, free_scale_height);
+}
+
+void osddev_get_free_scale_axis(u32 index, s32 *x0, s32 *y0, s32 *x1, s32 *y1)
+{
+	//at present we only support osd1 & osd2 have the same random scale mode.
+	osd_get_free_scale_axis_hw(index, x0, y0, x1, y1);
+
+}
+
+void osddev_set_free_scale_axis(u32 index, s32 x0, s32 y0, s32 x1, s32 y1)
+{
+	//at present we only support osd1 & osd2 have the same random scale mode.
+	osd_set_free_scale_axis_hw(index, x0, y0, x1, y1);
+}
+
+void osddev_enable_3d_mode(u32 index ,u32 enable)
+{
+	osd_enable_3d_mode_hw(index,enable);
+}
+
+void osddev_set_scale_axis(u32 index, s32 x0, s32 y0, s32 x1, s32 y1)
+{
+	osd_set_scale_axis_hw(index, x0, y0, x1, y1);
+}
+
+void osddev_get_scale_axis(u32 index, s32 *x0, s32 *y0, s32 *x1, s32 *y1)
+{
+	osd_get_scale_axis_hw(index, x0, y0, x1, y1);
+}
+
+void osddev_get_window_axis(u32 index, s32 *x0, s32 *y0, s32 *x1, s32 *y1)
+{
+	osd_get_window_axis_hw(index, x0, y0, x1, y1);
+}
+
+void osddev_set_window_axis(u32 index, s32 x0, s32 y0, s32 x1, s32 y1)
+{
+	osd_set_window_axis_hw(index, x0, y0, x1, y1);
+}
+int osddev_sync_request( struct fb_info * info,u32 xoffset, u32 yoffset,s32 in_fence_fd)
+{
+	return osd_sync_request(info->node, info->var.yres,xoffset ,yoffset ,in_fence_fd);
+}
+int osddev_wait_for_vsync(void)
+{
+	return osd_wait_vsync_event();
+}
+void osddev_get_osd_info(u32 index, s32 (*posdval)[4], u32 (*posdreg)[5], s32 info_flag)
+{
+	osd_get_osd_info_hw(index, posdval, posdreg, info_flag);
+}
+
+void osddev_set_2x_scale(u32 index,u16 h_scale_enable,u16 v_scale_enable)
+{
+	osd_set_2x_scale_hw(index,h_scale_enable,v_scale_enable);
+}
+
+void osddev_get_flush_rate(u32 *flush_rate)
+{
+	osd_get_flush_rate(flush_rate);
+}
+
+void osddev_get_osd_reverse(u32 index, u32 *reverse)
+{
+	osd_get_osd_reverse_hw(index, reverse);
+}
+
+void osddev_set_osd_reverse(u32 index, u32 reverse)
+{
+	osd_set_osd_reverse_hw(index, reverse);
+}
+
+void osddev_get_osd_rotate_on(u32 index, u32 *on_off)
+{
+        osd_get_osd_rotate_on_hw(index, on_off);
+}
+
+void osddev_set_osd_rotate_on(u32 index, u32 on_off)
+{
+        osd_set_osd_rotate_on_hw(index, on_off);
+}
+
+void osddev_get_osd_antiflicker(u32 index, u32 *on_off)
+{
+        osd_get_osd_antiflicker_hw(index, on_off);
+}
+
+void osddev_set_osd_antiflicker(u32 index, u32 vmode, u32 yres)
+{
+        osd_set_osd_antiflicker_hw(index, vmode, yres);
+}
+
+void osddev_get_update_state(u32 index, u32 *up_free)
+{
+        osd_get_osd_updatestate_hw(index, up_free);
+}
+
+void osddev_set_update_state(u32 index, u32 up_free)
+{
+        osd_set_osd_updatestate_hw(index, up_free);
+}
+
+void osddev_get_osd_angle(u32 index, u32 *angle)
+{
+        osd_get_osd_angle_hw(index, angle);
+}
+
+void osddev_set_osd_angle(u32 index, u32 angle, u32  virtual_osd1_yres, u32 virtual_osd2_yres)
+{
+        osd_set_osd_angle_hw(index, angle, virtual_osd1_yres, virtual_osd2_yres);
+}
+
+void osddev_get_osd_clone(u32 index, u32 *clone)
+{
+        osd_get_osd_clone_hw(index, clone);
+}
+
+void osddev_set_osd_clone(u32 index, u32 clone)
+{
+        osd_set_osd_clone_hw(index, clone);
+}
+
+void osddev_set_osd_update_pan(u32 index)
+{
+        osd_set_osd_update_pan_hw(index);
+}
+
+void osddev_get_osd_rotate_angle(u32 index, u32 *angle)
+{
+        osd_get_osd_rotate_angle_hw(index, angle);
+}
+
+void osddev_set_osd_rotate_angle(u32 index, u32 angle)
+{
+        osd_set_osd_rotate_angle_hw(index, angle);
+}
+
+void osddev_get_prot_canvas(u32 index, s32 *x_start, s32 *y_start, s32 *x_end, s32 *y_end)
+{
+	osd_get_prot_canvas_hw(index, x_start, y_start, x_end, y_end);
+}
+
+void osddev_set_prot_canvas(u32 index, s32 x_start, s32 y_start, s32 x_end, s32 y_end)
+{
+	osd_set_prot_canvas_hw(index, x_start, y_start, x_end, y_end);
+}
+
+void osddev_set_block_windows(u32 index, u32 *block_windows)
+{
+	osd_set_block_windows_hw(index, block_windows);
+}
+
+void osddev_get_block_windows(u32 index, u32 *block_windows)
+{
+	osd_get_block_windows_hw(index, block_windows);
+}
+
+void osddev_set_block_mode(u32 index, u32 mode)
+{
+	osd_set_block_mode_hw(index, mode);
+}
+
+void osddev_get_block_mode(u32 index, u32 *mode)
+{
+	osd_get_block_mode_hw(index, mode);
+}
+
+void osddev_enable(int enable,int  index)
+{
+    osd_enable_hw(enable,index);
+}
+
+void osddev_pan_display(struct fb_var_screeninfo *var,struct fb_info *fbi)
+{
+    osd_pan_display_hw(var->xoffset, var->yoffset,fbi->node);
+}
+
+#if defined(CONFIG_FB_OSD2_CURSOR)
+void osddev_cursor(struct myfb_dev *fbdev, s16 x, s16 y, s16 xstart, s16 ystart, u32 osd_w, u32 osd_h)
+{
+    fbdev_lock(fbdev);
+    osd_cursor_hw(x, y, xstart, ystart, osd_w, osd_h, fbdev->fb_info->node);
+    fbdev_unlock(fbdev);
+}
+#endif
+
+int osddev_copy_data_tocursor(myfb_dev_t *g_fbi, aml_hwc_addr_t *cursor_mem)
+{
+	if (cursor_mem == NULL){
+		return 0;
+	}
+	osddev_copy_data_tocursor_hw((u32)g_fbi->fb_mem_vaddr, cursor_mem);
+	return 1;
+}
+
+void  osddev_set_colorkey(u32 index,u32 bpp,u32 colorkey )
+{
+	osd_set_colorkey_hw( index, bpp, colorkey );
+}
+void  osddev_srckey_enable(u32  index,u8 enable)
+{
+	osd_srckey_enable_hw(index,enable);
+}
+void  osddev_set_gbl_alpha(u32 index,u32 gbl_alpha)
+{
+	osd_set_gbl_alpha_hw(index,gbl_alpha);
+}
+u32  osddev_get_gbl_alpha(u32  index)
+{
+	return osd_get_gbl_alpha_hw(index);
+}
+void  osddev_suspend(void)
+{
+	osd_suspend_hw();
+}
+void osddev_resume(void)
+{
+	osd_resume_hw();
+}
diff --git a/sources/Linux/Amlogic/M201/create-3.10.33-20160716-osd-xrgb-patch/linux-aml-3.10.33-20160716-new/drivers/amlogic/display/osd/osd_hw.c b/sources/Linux/Amlogic/M201/create-3.10.33-20160716-osd-xrgb-patch/linux-aml-3.10.33-20160716-new/drivers/amlogic/display/osd/osd_hw.c
new file mode 100644
index 000000000..82bd6f567
--- /dev/null
+++ b/sources/Linux/Amlogic/M201/create-3.10.33-20160716-osd-xrgb-patch/linux-aml-3.10.33-20160716-new/drivers/amlogic/display/osd/osd_hw.c
@@ -0,0 +1,3331 @@
+/*
+ * Amlogic Apollo
+ * frame buffer driver
+ *
+ * Copyright (C) 2009 Amlogic, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the named License,
+ * or any later version.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
+ *
+ * Author:  Tim Yao <timyao@amlogic.com>
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/spinlock.h>
+#include <plat/regops.h>
+#include <mach/am_regs.h>
+#include <linux/irqreturn.h>
+#include <linux/errno.h>
+#include <linux/irq.h>
+#include <linux/slab.h>
+#include <linux/interrupt.h>
+#include <linux/amlogic/osd/osd.h>
+#include <linux/amlogic/vout/vout_notify.h>
+#include <linux/amlogic/amports/canvas.h>
+#include <linux/fdtable.h>
+#include <linux/file.h>
+#include <linux/list.h>
+#include <linux/kthread.h>
+#include <sw_sync.h>
+#include <sync.h>
+#include "osd_log.h"
+#include <linux/amlogic/amlog.h>
+#include <linux/amlogic/amports/vframe_receiver.h>
+#include "osd_hw_def.h"
+#include "osd_prot.h"
+#include "osd_antiflicker.h"
+#include "osd_clone.h"
+
+#if MESON_CPU_TYPE >= MESON_CPU_TYPE_MESONG9TV
+#include <mach/vpu.h>
+#define OSD_SUPER_SCALER_MEM_POWER_ON() \
+	do { \
+		switch_vpu_mem_pd_vmod(VPU_VIU_OSD_SCALE, VPU_MEM_POWER_ON); \
+	} while (0)
+#define OSD_SUPER_SCALER_MEM_POWER_OFF() \
+	do { \
+		switch_vpu_mem_pd_vmod(VPU_VIU_OSD_SCALE, VPU_MEM_POWER_DOWN); \
+	} while (0)
+#endif
+
+
+#ifdef CONFIG_AML_VSYNC_FIQ_ENABLE
+#define  FIQ_VSYNC
+#endif
+
+
+#ifdef CONFIG_VSYNC_RDMA
+int reset_rdma(void);
+int osd_rdma_enable(u32  enable);
+int read_rdma_table(void);
+#endif
+
+static DEFINE_MUTEX(osd_mutex);
+static DEFINE_SPINLOCK(osd_onoff_lock);
+static DECLARE_WAIT_QUEUE_HEAD(osd_vsync_wq);
+
+static bool vsync_hit = false;
+static bool osd_vf_need_update = false;
+static bool osd_update_window_axis = false;
+#ifdef CONFIG_AM_FB_EXT
+extern void osd_ext_clone_pan(u32 index);
+#endif
+extern void osd_clone_pan(u32 index, u32 yoffset, int debug_flag);
+
+#ifdef  CONFIG_FB_OSD_SUPPORT_SYNC_FENCE
+//add sync fence relative varible here.
+//we will limit all fence relative code in this driver file.
+static int  timeline_created = 0;
+static struct  sw_sync_timeline *timeline;
+static u32  cur_streamline_val;
+//thread control part
+struct kthread_worker buffer_toggle_worker;
+struct task_struct *buffer_toggle_thread;
+struct kthread_work buffer_toggle_work;
+struct list_head	post_fence_list;
+struct mutex		post_fence_list_lock;
+
+void osd_pan_display_fence(osd_fence_map_t *fence_map);
+#endif
+
+static struct vframe_provider_s osd_vf_prov;
+static int  g_vf_visual_width;
+static int  g_vf_width;
+static int  g_vf_height;
+static int  g_rotation_width;
+static int  g_rotation_height;
+
+static int osd_h_filter_mode = 1;
+static int osd_v_filter_mode = 1;
+static int use_h_filter_mode = -1;
+static int use_v_filter_mode = -1;
+static unsigned int osd_filter_coefs_bicubic_sharp[] = {
+	0x01fa008c, 0x01fa0100, 0xff7f0200, 0xfe7f0300,
+	0xfd7e0500, 0xfc7e0600, 0xfb7d0800, 0xfb7c0900,
+	0xfa7b0b00, 0xfa7a0dff, 0xf9790fff, 0xf97711ff,
+	0xf87613ff, 0xf87416fe, 0xf87218fe, 0xf8701afe,
+	0xf76f1dfd, 0xf76d1ffd, 0xf76b21fd, 0xf76824fd,
+	0xf76627fc, 0xf76429fc, 0xf7612cfc, 0xf75f2ffb,
+	0xf75d31fb, 0xf75a34fb, 0xf75837fa, 0xf7553afa,
+	0xf8523cfa, 0xf8503ff9, 0xf84d42f9, 0xf84a45f9,
+	0xf84848f8
+};
+
+static unsigned int osd_filter_coefs_bicubic[] = { //bicubic	coef0
+	0x00800000, 0x007f0100, 0xff7f0200, 0xfe7f0300, 0xfd7e0500, 0xfc7e0600,
+	0xfb7d0800, 0xfb7c0900, 0xfa7b0b00, 0xfa7a0dff, 0xf9790fff, 0xf97711ff,
+	0xf87613ff, 0xf87416fe, 0xf87218fe, 0xf8701afe, 0xf76f1dfd, 0xf76d1ffd,
+	0xf76b21fd, 0xf76824fd, 0xf76627fc, 0xf76429fc, 0xf7612cfc, 0xf75f2ffb,
+	0xf75d31fb, 0xf75a34fb, 0xf75837fa, 0xf7553afa, 0xf8523cfa, 0xf8503ff9,
+	0xf84d42f9, 0xf84a45f9, 0xf84848f8
+};
+
+static unsigned int osd_filter_coefs_bilinear[] = { //2 point bilinear	coef1
+	0x00800000, 0x007e0200, 0x007c0400, 0x007a0600, 0x00780800, 0x00760a00,
+	0x00740c00, 0x00720e00, 0x00701000, 0x006e1200, 0x006c1400, 0x006a1600,
+	0x00681800, 0x00661a00, 0x00641c00, 0x00621e00, 0x00602000, 0x005e2200,
+	0x005c2400, 0x005a2600, 0x00582800, 0x00562a00, 0x00542c00, 0x00522e00,
+	0x00503000, 0x004e3200, 0x004c3400, 0x004a3600, 0x00483800, 0x00463a00,
+	0x00443c00, 0x00423e00, 0x00404000
+};
+
+static unsigned int osd_filter_coefs_2point_binilear[]
+= { //2 point bilinear, bank_length == 2	coef2
+	0x80000000, 0x7e020000, 0x7c040000, 0x7a060000, 0x78080000, 0x760a0000,
+	0x740c0000, 0x720e0000, 0x70100000, 0x6e120000, 0x6c140000, 0x6a160000,
+	0x68180000, 0x661a0000, 0x641c0000, 0x621e0000, 0x60200000, 0x5e220000,
+	0x5c240000, 0x5a260000, 0x58280000, 0x562a0000, 0x542c0000, 0x522e0000,
+	0x50300000, 0x4e320000, 0x4c340000, 0x4a360000, 0x48380000, 0x463a0000,
+	0x443c0000, 0x423e0000, 0x40400000
+};
+
+//filt_triangle, point_num =3, filt_len =2.6, group_num = 64
+static unsigned int osd_filter_coefs_3point_triangle_sharp[] = {
+	0x40400000, 0x3e420000, 0x3d430000, 0x3b450000,
+	0x3a460000, 0x38480000, 0x37490000, 0x354b0000,
+	0x344c0000, 0x324e0000, 0x314f0000, 0x2f510000,
+	0x2e520000, 0x2c540000, 0x2b550000, 0x29570000,
+	0x28580000, 0x265a0000, 0x245c0000, 0x235d0000,
+	0x215f0000, 0x20600000, 0x1e620000, 0x1d620100,
+	0x1b620300, 0x19630400, 0x17630600, 0x15640700,
+	0x14640800, 0x12640a00, 0x11640b00, 0x0f650c00,
+	0x0d660d00
+};
+
+static unsigned int osd_filter_coefs_3point_triangle[] = {
+	0x40400000, 0x3f400100, 0x3d410200, 0x3c410300,
+	0x3a420400, 0x39420500, 0x37430600, 0x36430700,
+	0x35430800, 0x33450800, 0x32450900, 0x31450a00,
+	0x30450b00, 0x2e460c00, 0x2d460d00, 0x2c470d00,
+	0x2b470e00, 0x29480f00, 0x28481000, 0x27481100,
+	0x26491100, 0x25491200, 0x24491300, 0x234a1300,
+	0x224a1400, 0x214a1500, 0x204a1600, 0x1f4b1600,
+	0x1e4b1700, 0x1d4b1800, 0x1c4c1800, 0x1b4c1900,
+	0x1a4c1a00
+};
+
+static unsigned int osd_filter_coefs_4point_triangle[] = {
+	0x20402000, 0x20402000, 0x1f3f2101, 0x1f3f2101,
+	0x1e3e2202, 0x1e3e2202, 0x1d3d2303, 0x1d3d2303,
+	0x1c3c2404, 0x1c3c2404, 0x1b3b2505, 0x1b3b2505,
+	0x1a3a2606, 0x1a3a2606, 0x19392707, 0x19392707,
+	0x18382808, 0x18382808, 0x17372909, 0x17372909,
+	0x16362a0a, 0x16362a0a, 0x15352b0b, 0x15352b0b,
+	0x14342c0c, 0x14342c0c, 0x13332d0d, 0x13332d0d,
+	0x12322e0e, 0x12322e0e, 0x11312f0f, 0x11312f0f,
+	0x10303010
+};
+
+// 4th order (cubic) b-spline
+//filt_cubic point_num =4, filt_len =4, group_num = 64
+static unsigned int vpp_filter_coefs_4point_bspline[] = {
+	0x15561500, 0x14561600, 0x13561700, 0x12561800,
+	0x11551a00, 0x11541b00, 0x10541c00, 0x0f541d00,
+	0x0f531e00, 0x0e531f00, 0x0d522100, 0x0c522200,
+	0x0b522300, 0x0b512400, 0x0a502600, 0x0a4f2700,
+	0x094e2900, 0x084e2a00, 0x084d2b00, 0x074c2c01,
+	0x074b2d01, 0x064a2f01, 0x06493001, 0x05483201,
+	0x05473301, 0x05463401, 0x04453601, 0x04433702,
+	0x04423802, 0x03413a02, 0x03403b02, 0x033f3c02,
+	0x033d3d03
+};
+
+//filt_quadratic, point_num =3, filt_len =3, group_num = 64
+static unsigned int osd_filter_coefs_3point_bspline[] = {
+	0x40400000, 0x3e420000, 0x3c440000, 0x3a460000,
+	0x38480000, 0x364a0000, 0x344b0100, 0x334c0100,
+	0x314e0100, 0x304f0100, 0x2e500200, 0x2c520200,
+	0x2a540200, 0x29540300, 0x27560300, 0x26570300,
+	0x24580400, 0x23590400, 0x215a0500, 0x205b0500,
+	0x1e5c0600, 0x1d5c0700, 0x1c5d0700, 0x1a5e0800,
+	0x195e0900, 0x185e0a00, 0x175f0a00, 0x15600b00,
+	0x14600c00, 0x13600d00, 0x12600e00, 0x11600f00,
+	0x10601000
+};
+
+static unsigned int *filter_table[] = {
+	osd_filter_coefs_bicubic_sharp,
+	osd_filter_coefs_bicubic,
+	osd_filter_coefs_bilinear,
+	osd_filter_coefs_2point_binilear,
+	osd_filter_coefs_3point_triangle_sharp,
+	osd_filter_coefs_3point_triangle,
+	osd_filter_coefs_4point_triangle,
+	vpp_filter_coefs_4point_bspline,
+	osd_filter_coefs_3point_bspline
+};
+
+#define OSD_TYPE_TOP_FIELD 0
+#define OSD_TYPE_BOT_FIELD 1
+
+/********************************************************************/
+/***********		osd fence relative code 	 			*****************/
+/********************************************************************/
+
+#ifdef  CONFIG_FB_OSD_SUPPORT_SYNC_FENCE
+static inline  int  find_buf_num(u32 yres, u32 yoffset)
+{
+	int n = yres;
+	int i;
+	for (i = 0; i < MAX_BUF_NUM; i++) { //find current addr position.
+		if (yoffset  < (n))
+			break;
+		n += yres;
+	}
+	return i;
+}
+
+/*void osd_wait_vsync_hw(void)
+{
+        vsync_hit = false;
+        wait_event_interruptible_timeout(osd_vsync_wq, vsync_hit, HZ);
+}*/
+
+//next we will process two osd layer in toggle buffer.
+static void osd_toggle_buffer(struct kthread_work *work)
+{
+	osd_fence_map_t *data, *next;
+	struct list_head saved_list;
+
+	mutex_lock(&post_fence_list_lock);
+	saved_list = post_fence_list;
+	list_replace_init(&post_fence_list, &saved_list);
+	mutex_unlock(&post_fence_list_lock);
+
+	list_for_each_entry_safe(data, next, &saved_list, list) {
+		//printk("osd_toggle_buffer the save_list is not NULL\n");
+		osd_pan_display_fence(data);
+		if (data->in_fence)
+			sync_fence_put(data->in_fence);
+		if (data->in_fd > 0)
+			__close_fd(data->files, data->in_fd);
+		list_del(&data->list);
+		kfree(data);
+	}
+}
+
+static int out_fence_create(int *release_fence_fd, u32 *val, u32 buf_num)
+{
+	//the first time create out_fence_fd==0
+	//sw_sync_timeline_inc  will release fence and it's sync point
+	struct sync_pt *outer_sync_pt;
+	struct sync_fence *outer_fence;
+	int out_fence_fd = -1;
+
+	out_fence_fd = get_unused_fd();
+	if (out_fence_fd < 0) return -1; //no file descriptor could be used. Error.
+	if (!timeline_created) { //timeline has not been created
+		timeline = sw_sync_timeline_create("osd_timeline");
+		cur_streamline_val = 1;
+		if (NULL == timeline)
+			return -1;
+		init_kthread_worker(&buffer_toggle_worker);
+		buffer_toggle_thread = kthread_run(kthread_worker_fn,
+						   &buffer_toggle_worker, "aml_buf_toggle");
+		init_kthread_work(&buffer_toggle_work, osd_toggle_buffer);
+		timeline_created = 1;
+	}
+	//install fence map; first ,the simplest.
+	cur_streamline_val++;
+	*val = cur_streamline_val;
+
+	outer_sync_pt = sw_sync_pt_create(timeline, *val);
+	if (NULL == outer_sync_pt)
+		goto error_ret;
+
+	outer_fence = sync_fence_create("osd_fence_out",
+					outer_sync_pt); //fence object will be released when no point
+	if (NULL == outer_fence) {
+		sync_pt_free(outer_sync_pt); //free sync point.
+		goto error_ret;
+	}
+
+	sync_fence_install(outer_fence, out_fence_fd);
+	amlog_mask_level(LOG_MASK_HARDWARE, LOG_LEVEL_LOW,
+			 "---------------------------------------\n");
+	amlog_mask_level(LOG_MASK_HARDWARE, LOG_LEVEL_LOW, "return out fence fd:%d\n",
+			 out_fence_fd);
+	*release_fence_fd = out_fence_fd;
+	return out_fence_fd;
+
+error_ret:
+	cur_streamline_val--; //pt or fence fail,restore timeline value.
+	amlog_level(LOG_LEVEL_HIGH, "fence obj create fail\n");
+	put_unused_fd(out_fence_fd);
+	return -1;
+
+}
+
+int osd_sync_request(u32 index, u32 yres, u32 xoffset, u32 yoffset,
+		     s32 in_fence_fd)
+{
+	int out_fence_fd = -1;
+	int buf_num = 0;
+
+	osd_fence_map_t *fence_map = kzalloc(sizeof(osd_fence_map_t), GFP_KERNEL);
+	buf_num = find_buf_num(yres, yoffset);
+
+	if (!fence_map) {
+		printk("could not allocate osd_fence_map\n");
+		return -ENOMEM;
+	}
+
+	mutex_lock(&post_fence_list_lock);
+	fence_map->fb_index = index;
+	fence_map->buf_num = buf_num;
+	fence_map->yoffset = yoffset;
+	fence_map->xoffset = xoffset;
+	fence_map->yres = yres;
+	fence_map->in_fd = in_fence_fd;
+	fence_map->in_fence = sync_fence_fdget(in_fence_fd);
+	fence_map->files = current->files;
+
+	fence_map->out_fd = out_fence_create(&out_fence_fd, &fence_map->val, buf_num);
+	list_add_tail(&fence_map->list, &post_fence_list);
+	mutex_unlock(&post_fence_list_lock);
+
+	queue_kthread_work(&buffer_toggle_worker, &buffer_toggle_work);
+
+	return  out_fence_fd;
+}
+
+static int  osd_wait_buf_ready(osd_fence_map_t *fence_map)
+{
+	s32 ret = -1;
+	struct sync_fence *buf_ready_fence = NULL;
+
+	if (fence_map->in_fd <= 0) {
+		ret = -1;
+		return ret;
+	}
+
+	buf_ready_fence = fence_map->in_fence;
+	if (NULL == buf_ready_fence) {
+		ret = -1;//no fence ,output directly.
+		return ret;
+	}
+
+	ret = sync_fence_wait(buf_ready_fence, -1);
+	if (ret < 0) {
+		amlog_level(LOG_LEVEL_HIGH, "Sync Fence wait error:%d\n", ret);
+		printk("-----wait buf idx:[%d] ERROR\n-----on screen buf idx:[%d]\n",
+		       fence_map->buf_num, find_buf_num(fence_map->yres,
+							osd_hw.pandata[fence_map->fb_index].y_start));
+	} else
+		ret = 1;
+
+	return ret;
+}
+
+#else
+int osd_sync_request(u32 index, u32 yres, u32 xoffset, u32 yoffset,
+		     s32 in_fence_fd)
+{
+	amlog_level(LOG_LEVEL_HIGH, "osd_sync_request not supported\n");
+	return -5566;
+}
+#endif
+
+/********************************************************************/
+/***********		osd psedu frame provider 			*****************/
+/********************************************************************/
+static vframe_t *osd_vf_peek(void *arg)
+{
+	return ((osd_vf_need_update && (vf.width > 0) && (vf.height > 0)) ? &vf : NULL);
+}
+
+static vframe_t *osd_vf_get(void *arg)
+{
+	if (osd_vf_need_update) {
+		vf_ext_light_unreg_provider(&osd_vf_prov);
+		osd_vf_need_update = false;
+		return &vf;
+	}
+	return NULL;
+}
+
+#define PROVIDER_NAME   "osd"
+static const struct vframe_operations_s osd_vf_provider = {
+	.peek = osd_vf_peek,
+	.get  = osd_vf_get,
+	.put  = NULL,
+};
+
+#ifdef CONFIG_AM_VIDEO
+static unsigned char osd_vf_prov_init = 0;
+#endif
+
+static inline void  osd_update_3d_mode(int enable_osd1, int enable_osd2)
+{
+	if (enable_osd1)
+		osd1_update_disp_3d_mode();
+	if (enable_osd2)
+		osd2_update_disp_3d_mode();
+}
+
+static inline void wait_vsync_wakeup(void)
+{
+	vsync_hit = true;
+	wake_up_interruptible(&osd_vsync_wq);
+}
+
+#ifdef CONFIG_VSYNC_RDMA
+static irqreturn_t osd_rdma_isr(int irq, void *dev_id)
+{
+#define  	VOUT_ENCI	1
+#define   	VOUT_ENCP	2
+#define	VOUT_ENCT	3
+	unsigned  int  fb0_cfg_w0, fb1_cfg_w0;
+	unsigned  int  odd_or_even_line;
+	unsigned  int  scan_line_number = 0;
+	unsigned  char output_type = 0;
+
+	reset_rdma();
+	read_rdma_table();
+	output_type = aml_read_reg32(P_VPU_VIU_VENC_MUX_CTRL) & 0x3;
+	osd_hw.scan_mode = SCAN_MODE_PROGRESSIVE;
+	switch (output_type) {
+	case VOUT_ENCP:
+		if (aml_read_reg32(P_ENCP_VIDEO_MODE) & (1 << 12)) //1080i
+			osd_hw.scan_mode = SCAN_MODE_INTERLACE;
+		break;
+	case VOUT_ENCI:
+		if (aml_read_reg32(P_ENCI_VIDEO_EN) & 1)
+			osd_hw.scan_mode = SCAN_MODE_INTERLACE;
+		break;
+	}
+
+	if (osd_hw.free_scale_enable[OSD1])
+		osd_hw.scan_mode = SCAN_MODE_PROGRESSIVE;
+
+	if (osd_hw.scan_mode == SCAN_MODE_INTERLACE) {
+		fb0_cfg_w0 = aml_read_reg32(P_VIU_OSD1_BLK0_CFG_W0);
+		fb1_cfg_w0 = aml_read_reg32(P_VIU_OSD2_BLK0_CFG_W0);
+		if (aml_read_reg32(P_ENCP_VIDEO_MODE) & (1 << 12)) {
+			/* 1080I */
+			scan_line_number = ((aml_read_reg32(P_ENCP_INFO_READ)) & 0x1fff0000) >> 16;
+			if ((osd_hw.pandata[OSD1].y_start % 2) == 0) {
+				if (scan_line_number >= 562) {
+					/* bottom field, odd lines*/
+					odd_or_even_line = 0;	//vsync enable when the next vsync trigger
+				} else {
+					/* top field, even lines*/
+					odd_or_even_line = 1;
+				}
+			} else {
+				if (scan_line_number >= 562) {
+					/* top field, even lines*/
+					odd_or_even_line = 1;
+				} else {
+					/* bottom field, odd lines*/
+					odd_or_even_line = 0;
+				}
+			}
+		} else {
+			if ((osd_hw.pandata[OSD1].y_start % 2) == 1) {
+				odd_or_even_line = (aml_read_reg32(P_ENCI_INFO_READ) & (1 << 29)) ?
+						   OSD_TYPE_BOT_FIELD : OSD_TYPE_TOP_FIELD;
+			} else {
+				odd_or_even_line = (aml_read_reg32(P_ENCI_INFO_READ) & (1 << 29)) ?
+						   OSD_TYPE_TOP_FIELD : OSD_TYPE_BOT_FIELD;
+			}
+		}
+
+		fb0_cfg_w0 &= ~1;
+		fb1_cfg_w0 &= ~1;
+		fb0_cfg_w0 |= odd_or_even_line;
+		fb1_cfg_w0 |= odd_or_even_line;
+		VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W0, fb0_cfg_w0);
+		VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK1_CFG_W0, fb0_cfg_w0);
+		VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK2_CFG_W0, fb0_cfg_w0);
+		VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK3_CFG_W0, fb0_cfg_w0);
+		VSYNCOSD_WR_MPEG_REG(VIU_OSD2_BLK0_CFG_W0, fb1_cfg_w0);
+		VSYNCOSD_WR_MPEG_REG(VIU_OSD2_BLK1_CFG_W0, fb1_cfg_w0);
+		VSYNCOSD_WR_MPEG_REG(VIU_OSD2_BLK2_CFG_W0, fb1_cfg_w0);
+		VSYNCOSD_WR_MPEG_REG(VIU_OSD2_BLK3_CFG_W0, fb1_cfg_w0);
+	}
+
+	osd_update_3d_mode(osd_hw.mode_3d[OSD1].enable, osd_hw.mode_3d[OSD2].enable);
+
+	if (!vsync_hit) {
+#ifdef FIQ_VSYNC
+		fiq_bridge_pulse_trigger(&osd_hw.fiq_handle_item);
+#else
+		wait_vsync_wakeup();
+#endif
+	}
+	aml_write_reg32(P_RDMA_CTRL, 1 << 24);
+
+	return IRQ_HANDLED;
+}
+#endif
+
+static inline void  walk_through_update_list(void)
+{
+	u32  i, j;
+	for (i = 0; i < HW_OSD_COUNT; i++) {
+		j = 0;
+		while (osd_hw.updated[i] && j < 32) {
+			if (osd_hw.updated[i] & (1 << j)) {
+				osd_hw.reg[i][j].update_func();
+				remove_from_update_list(i, j);
+			}
+			j++;
+		}
+	}
+}
+
+/**********************************************************************/
+/**********          osd vsync irq handler              ***************/
+/**********************************************************************/
+#ifdef FIQ_VSYNC
+static irqreturn_t vsync_isr(int irq, void *dev_id)
+{
+	wait_vsync_wakeup();
+
+	return IRQ_HANDLED;
+}
+#endif
+
+#ifdef FIQ_VSYNC
+static void osd_fiq_isr(void)
+#else
+static irqreturn_t vsync_isr(int irq, void *dev_id)
+#endif
+{
+#ifndef CONFIG_VSYNC_RDMA
+#define  	VOUT_ENCI	1
+#define   	VOUT_ENCP	2
+#define	VOUT_ENCT	3
+
+	unsigned  int  fb0_cfg_w0, fb1_cfg_w0;
+	unsigned  int  odd_or_even_line;
+	unsigned  int  scan_line_number = 0;
+	unsigned  char output_type = 0;
+
+	output_type = aml_read_reg32(P_VPU_VIU_VENC_MUX_CTRL) & 0x3;
+	osd_hw.scan_mode = SCAN_MODE_PROGRESSIVE;
+	switch (output_type) {
+	case VOUT_ENCP:
+		if (aml_read_reg32(P_ENCP_VIDEO_MODE) & (1 << 12)) //1080i
+			osd_hw.scan_mode = SCAN_MODE_INTERLACE;
+		break;
+	case VOUT_ENCI:
+		if (aml_read_reg32(P_ENCI_VIDEO_EN) & 1)
+			osd_hw.scan_mode = SCAN_MODE_INTERLACE;
+		break;
+	}
+
+	if (osd_hw.free_scale_enable[OSD1])
+		osd_hw.scan_mode = SCAN_MODE_PROGRESSIVE;
+
+	if (osd_hw.scan_mode == SCAN_MODE_INTERLACE) {
+		fb0_cfg_w0 = aml_read_reg32(P_VIU_OSD1_BLK0_CFG_W0);
+		fb1_cfg_w0 = aml_read_reg32(P_VIU_OSD1_BLK0_CFG_W0 + REG_OFFSET);
+		if (aml_read_reg32(P_ENCP_VIDEO_MODE) & (1 << 12)) {
+			/* 1080I */
+			scan_line_number = ((aml_read_reg32(P_ENCP_INFO_READ)) & 0x1fff0000) >> 16;
+			if ((osd_hw.pandata[OSD1].y_start % 2) == 0) {
+				if (scan_line_number >= 562) {
+					/* bottom field, odd lines*/
+					odd_or_even_line = 1;
+				} else {
+					/* top field, even lines*/
+					odd_or_even_line = 0;
+				}
+			} else {
+				if (scan_line_number >= 562) {
+					/* top field, even lines*/
+					odd_or_even_line = 0;
+				} else {
+					/* bottom field, odd lines*/
+					odd_or_even_line = 1;
+				}
+			}
+		} else {
+			if ((osd_hw.pandata[OSD1].y_start % 2) == 0)
+				odd_or_even_line = aml_read_reg32(P_ENCI_INFO_READ) & 1;
+			else
+				odd_or_even_line = !(aml_read_reg32(P_ENCI_INFO_READ) & 1);
+		}
+
+		fb0_cfg_w0 &= ~1;
+		fb1_cfg_w0 &= ~1;
+		fb0_cfg_w0 |= odd_or_even_line;
+		fb1_cfg_w0 |= odd_or_even_line;
+		aml_write_reg32(P_VIU_OSD1_BLK0_CFG_W0, fb0_cfg_w0);
+		aml_write_reg32(P_VIU_OSD1_BLK1_CFG_W0, fb0_cfg_w0);
+		aml_write_reg32(P_VIU_OSD1_BLK2_CFG_W0, fb0_cfg_w0);
+		aml_write_reg32(P_VIU_OSD1_BLK3_CFG_W0, fb0_cfg_w0);
+		aml_write_reg32(P_VIU_OSD1_BLK0_CFG_W0 + REG_OFFSET, fb1_cfg_w0);
+		aml_write_reg32(P_VIU_OSD1_BLK1_CFG_W0 + REG_OFFSET, fb1_cfg_w0);
+		aml_write_reg32(P_VIU_OSD1_BLK2_CFG_W0 + REG_OFFSET, fb1_cfg_w0);
+		aml_write_reg32(P_VIU_OSD1_BLK3_CFG_W0 + REG_OFFSET, fb1_cfg_w0);
+	}
+	//go through update list
+	walk_through_update_list();
+
+	osd_update_3d_mode(osd_hw.mode_3d[OSD1].enable, osd_hw.mode_3d[OSD2].enable);
+#endif
+
+#if 0
+#ifdef CONFIG_VSYNC_RDMA
+	reset_rdma();
+#endif
+#endif
+
+#ifndef CONFIG_VSYNC_RDMA
+	if (!vsync_hit) {
+#ifdef FIQ_VSYNC
+		fiq_bridge_pulse_trigger(&osd_hw.fiq_handle_item);
+#else
+		wait_vsync_wakeup();
+#endif
+	}
+#endif
+
+#ifndef FIQ_VSYNC
+	return  IRQ_HANDLED;
+#endif
+}
+
+void osd_wait_vsync_hw(void)
+{
+	vsync_hit = false;
+	wait_event_interruptible_timeout(osd_vsync_wq, vsync_hit, HZ);
+}
+
+s32 osd_wait_vsync_event(void)
+{
+	vsync_hit = false;
+	wait_event_interruptible_timeout(osd_vsync_wq, vsync_hit,
+					 1); //waiting for 10ms.
+	return 0;
+}
+
+int osd_set_scan_mode(int index)
+{
+	const vinfo_t *vinfo;
+	u32 data32 = 0x0;
+	int real_scan_mode;
+
+	osd_hw.scan_mode = SCAN_MODE_PROGRESSIVE;
+	vinfo = get_current_vinfo();
+	if (vinfo) {
+		osd_hw.scale_workaround = 0;
+		switch (vinfo->mode) {
+		case VMODE_480I:
+		case VMODE_480CVBS:
+		case VMODE_576I:
+		case VMODE_576CVBS:
+			if (osd_hw.free_scale_mode[index]) {
+				osd_hw.field_out_en = 1;
+
+				if (osd_hw.free_scale_data[index].y_end == 719)
+					osd_hw.bot_type = 2;
+				else if (osd_hw.free_scale_data[index].y_end == 1079)
+					osd_hw.bot_type = 3;
+				else
+					osd_hw.bot_type = 2;
+			}
+			osd_hw.scan_mode = real_scan_mode = SCAN_MODE_INTERLACE;
+			break;
+		case VMODE_1080I:
+		case VMODE_1080I_50HZ:
+#ifdef CONFIG_AML_VOUT_FRAMERATE_AUTOMATION
+		case VMODE_1080I_59HZ:
+#endif
+			if (osd_hw.free_scale_mode[index]) {
+				osd_hw.field_out_en = 1;
+
+				if (osd_hw.free_scale_data[index].y_end == 719)
+					osd_hw.bot_type = 1;
+				else if (osd_hw.free_scale_data[index].y_end == 1079)
+					osd_hw.bot_type = 2;
+				else
+					osd_hw.bot_type = 1;
+			}
+			osd_hw.scan_mode = real_scan_mode = SCAN_MODE_INTERLACE;
+			break;
+		case VMODE_4K2K_24HZ:
+		case VMODE_4K2K_25HZ:
+		case VMODE_4K2K_30HZ:
+		case VMODE_4K2K_SMPTE:
+			if (osd_hw.fb_for_4k2k) {
+				if (osd_hw.free_scale_enable[index])
+					osd_hw.scale_workaround = 1;
+			}
+			osd_hw.field_out_en = 0;
+			break;
+		default:
+			if (osd_hw.free_scale_mode[index])
+				osd_hw.field_out_en = 0;
+			break;
+		}
+	}
+
+	if (osd_hw.free_scale_enable[index])
+		osd_hw.scan_mode = SCAN_MODE_PROGRESSIVE;
+	if (index == OSD2) {
+		if (real_scan_mode == SCAN_MODE_INTERLACE)
+			return 1;
+		data32 = (aml_read_reg32(P_VIU_OSD2_BLK0_CFG_W0) & 3) >> 1;
+	} else
+		data32 = (aml_read_reg32(P_VIU_OSD1_BLK0_CFG_W0) & 3) >> 1;
+	if (data32 == osd_hw.scan_mode)
+		return 1;
+	else
+		return 0;
+}
+
+void  osd_set_gbl_alpha_hw(u32 index, u32 gbl_alpha)
+{
+	if (osd_hw.gbl_alpha[index] != gbl_alpha) {
+
+		osd_hw.gbl_alpha[index] = gbl_alpha;
+		add_to_update_list(index, OSD_GBL_ALPHA);
+
+		osd_wait_vsync_hw();
+	}
+}
+u32  osd_get_gbl_alpha_hw(u32  index)
+{
+	return osd_hw.gbl_alpha[index];
+}
+void  osd_set_colorkey_hw(u32 index, u32 color_index, u32 colorkey)
+{
+	u8  r = 0, g = 0, b = 0, a = (colorkey & 0xff000000) >> 24;
+	u32	data32;
+
+	colorkey &= 0x00ffffff;
+	switch (color_index) {
+	case COLOR_INDEX_16_655:
+		r = (colorkey >> 10 & 0x3f) << 2;
+		g = (colorkey >> 5 & 0x1f) << 3;
+		b = (colorkey & 0x1f) << 3;
+		break;
+	case COLOR_INDEX_16_844:
+		r = colorkey >> 8 & 0xff;
+		g = (colorkey >> 4 & 0xf) << 4;
+		b = (colorkey & 0xf) << 4;
+		break;
+	case COLOR_INDEX_16_565:
+		r = (colorkey >> 11 & 0x1f) << 3;
+		g = (colorkey >> 5 & 0x3f) << 2;
+		b = (colorkey & 0x1f) << 3;
+		break;
+	case COLOR_INDEX_24_888_B:
+		b = colorkey >> 16 & 0xff;
+		g = colorkey >> 8 & 0xff;
+		r = colorkey & 0xff;
+		break;
+	case COLOR_INDEX_24_RGB:
+	case COLOR_INDEX_YUV_422:
+		r = colorkey >> 16 & 0xff;
+		g = colorkey >> 8 & 0xff;
+		b = colorkey & 0xff;
+		break;
+	}
+	data32 = r << 24 | g << 16 | b << 8 | a;
+	if (osd_hw.color_key[index] != data32) {
+		osd_hw.color_key[index] = data32;
+		amlog_mask_level(LOG_MASK_HARDWARE, LOG_LEVEL_LOW,
+				 "bpp:%d--r:0x%x g:0x%x b:0x%x ,a:0x%x\n", color_index, r, g, b, a);
+		add_to_update_list(index, OSD_COLOR_KEY);
+
+		osd_wait_vsync_hw();
+	}
+
+	return ;
+}
+void  osd_srckey_enable_hw(u32  index, u8 enable)
+{
+	if (enable != osd_hw.color_key_enable[index]) {
+		osd_hw.color_key_enable[index] = enable;
+		add_to_update_list(index, OSD_COLOR_KEY_ENABLE);
+
+		osd_wait_vsync_hw();
+	}
+
+}
+
+void osd_set_color_mode(int index, const color_bit_define_t *color)
+{
+	if (color != osd_hw.color_info[index]) {
+		osd_hw.color_info[index] = color;
+		add_to_update_list(index, OSD_COLOR_MODE);
+	}
+}
+
+void osddev_update_disp_axis_hw(
+	u32 display_h_start,
+	u32 display_h_end,
+	u32 display_v_start,
+	u32 display_v_end,
+	u32 xoffset,
+	u32 yoffset,
+	u32 mode_change,
+	u32 index)
+{
+	dispdata_t   disp_data;
+	pandata_t    pan_data;
+
+#if (MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON8)
+	if (index == OSD2)
+		return;
+#endif
+
+	if (NULL == osd_hw.color_info[index]) return;
+
+	disp_data.x_start = display_h_start;
+	disp_data.y_start = display_v_start;
+	disp_data.x_end = display_h_end;
+	disp_data.y_end = display_v_end;
+
+	pan_data.x_start = xoffset;
+	pan_data.x_end = xoffset + (display_h_end - display_h_start);
+	pan_data.y_start = yoffset;
+	pan_data.y_end = yoffset + (display_v_end - display_v_start);
+
+	//if output mode change then reset pan ofFfset.
+	memcpy(&osd_hw.pandata[index], &pan_data, sizeof(pandata_t));
+	memcpy(&osd_hw.dispdata[index], &disp_data, sizeof(dispdata_t));
+
+	spin_lock_irqsave(&osd_lock, lock_flags);
+	if (mode_change) //modify pandata .
+		osd_hw.reg[index][OSD_COLOR_MODE].update_func();
+	osd_hw.reg[index][DISP_GEOMETRY].update_func();
+	spin_unlock_irqrestore(&osd_lock, lock_flags);
+	osd_wait_vsync_hw();
+
+}
+//now , we will do overwrite ,if call osd_setup multi times between two vsync.
+//and the BUFFER will be released one by one ,i.e. only release one BUFFER ervery VSYNC.
+//I think if not skip frame , It will be smooth and better.
+void osd_setup(struct osd_ctl_s *osd_ctl,
+	       u32 xoffset,
+	       u32 yoffset,
+	       u32 xres,
+	       u32 yres,
+	       u32 xres_virtual,
+	       u32 yres_virtual,
+	       u32 disp_start_x,
+	       u32 disp_start_y,
+	       u32 disp_end_x,
+	       u32 disp_end_y,
+	       u32 fbmem,
+	       const color_bit_define_t *color,
+	       int index
+	      )
+{
+	u32  w = (color->bpp * xres_virtual + 7) >> 3;
+	dispdata_t   disp_data;
+	pandata_t    pan_data;
+#ifdef CONFIG_AM_LOGO
+	static u32	    logo_setup_ok = 0;
+#endif
+	int update_color_mode = 0;
+	int update_geometry = 0;
+
+	pan_data.x_start = xoffset;
+	pan_data.y_start = yoffset;
+	disp_data.x_start = disp_start_x;
+	disp_data.y_start = disp_start_y;
+
+	if (likely(osd_hw.free_scale_enable[OSD1] && index == OSD1)) {
+		if (!(osd_hw.free_scale_mode[OSD1])) {
+			pan_data.x_end = xoffset + g_vf_visual_width;
+			pan_data.y_end = yoffset + g_vf_height;
+			disp_data.x_end = disp_start_x + g_vf_width;
+			disp_data.y_end = disp_start_y + g_vf_height;
+		} else {
+			pan_data.x_end = xoffset + (disp_end_x - disp_start_x);
+			pan_data.y_end = yoffset + (disp_end_y - disp_start_y);
+			disp_data.x_end = disp_end_x;
+			disp_data.y_end = disp_end_y;
+		}
+	} else {
+		pan_data.x_end = xoffset + (disp_end_x - disp_start_x);
+		pan_data.y_end = yoffset + (disp_end_y - disp_start_y);
+		if (likely(osd_hw.rotate[index].on_off && osd_hw.rotate[index].on_off > 0)) {
+			disp_data.x_end = disp_start_x + g_rotation_height;
+			disp_data.y_end = disp_start_y + g_rotation_width;
+		} else {
+			disp_data.x_end = disp_end_x;
+			disp_data.y_end = disp_end_y;
+		}
+	}
+
+	if (osd_hw.fb_gem[index].addr != fbmem || osd_hw.fb_gem[index].width != w ||
+	    osd_hw.fb_gem[index].height != yres_virtual) {
+		osd_hw.fb_gem[index].addr = fbmem;
+		osd_hw.fb_gem[index].width = w;
+		osd_hw.fb_gem[index].height = yres_virtual;
+		canvas_config(osd_hw.fb_gem[index].canvas_idx, osd_hw.fb_gem[index].addr,
+			      osd_hw.fb_gem[index].width, osd_hw.fb_gem[index].height,
+			      CANVAS_ADDR_NOWRAP, CANVAS_BLKMODE_LINEAR);
+	}
+
+	if (color != osd_hw.color_info[index]) {
+		update_color_mode = 1;
+		osd_hw.color_info[index] = color;
+	}
+	//osd blank only control by /sys/class/graphcis/fbx/blank
+	/*
+	   if(osd_hw.enable[index] == DISABLE)
+	   {
+	   osd_hw.enable[index]=ENABLE;
+	   add_to_update_list(index,OSD_ENABLE);
+
+	   }*/
+	if (memcmp(&pan_data, &osd_hw.pandata[index], sizeof(pandata_t)) != 0 ||
+	    memcmp(&disp_data, &osd_hw.dispdata[index], sizeof(dispdata_t)) != 0) {
+		update_geometry = 1;
+		memcpy(&osd_hw.pandata[index], &pan_data, sizeof(pandata_t));
+		memcpy(&osd_hw.dispdata[index], &disp_data, sizeof(dispdata_t));
+	}
+
+	spin_lock_irqsave(&osd_lock, lock_flags);
+	if (update_color_mode)
+		osd_hw.reg[index][OSD_COLOR_MODE].update_func();
+	if (update_geometry)
+		osd_hw.reg[index][DISP_GEOMETRY].update_func();
+	spin_unlock_irqrestore(&osd_lock, lock_flags);
+
+#ifdef CONFIG_AM_LOGO
+	if (!logo_setup_ok) {
+#ifdef FIQ_VSYNC
+		osd_fiq_isr();
+#else
+		vsync_isr(INT_VIU_VSYNC, NULL);
+#endif
+		logo_setup_ok++;
+	}
+#endif
+
+	if (osd_hw.antiflicker_mode)
+		osd_antiflicker_update_pan(yoffset, yres);
+
+	if (osd_hw.clone)
+		osd_clone_pan(index, yoffset, 0);
+
+#ifdef CONFIG_AM_FB_EXT
+	osd_ext_clone_pan(index);
+#endif
+	osd_wait_vsync_hw();
+}
+
+void osd_setpal_hw(unsigned regno,
+		   unsigned red,
+		   unsigned green,
+		   unsigned blue,
+		   unsigned transp,
+		   int index
+		  )
+{
+
+	if (regno < 256) {
+		u32 pal;
+		pal = ((red   & 0xff) << 24) |
+		      ((green & 0xff) << 16) |
+		      ((blue  & 0xff) <<  8) |
+		      (transp & 0xff);
+
+		VSYNCOSD_WR_MPEG_REG(VIU_OSD1_COLOR_ADDR + REG_OFFSET * index, regno);
+		VSYNCOSD_WR_MPEG_REG(VIU_OSD1_COLOR + REG_OFFSET * index, pal);
+	}
+}
+u32 osd_get_osd_order_hw(u32 index)
+{
+	return  osd_hw.osd_order & 0x3;
+}
+void osd_change_osd_order_hw(u32 index, u32 order)
+{
+	if ((order != OSD_ORDER_01) && (order != OSD_ORDER_10))
+		return ;
+	osd_hw.osd_order = order;
+	add_to_update_list(index, OSD_CHANGE_ORDER);
+	osd_wait_vsync_hw();
+}
+
+void osd_free_scale_enable_hw(u32 index, u32 enable)
+{
+	int ret = 0;
+	if (osd_hw.free_scale_mode[index]) {
+		unsigned int hfs_enable = 0;
+		unsigned int vfs_enable = 0;
+
+		hfs_enable = (enable & 0xffff0000 ? 1 : 0);
+		vfs_enable = (enable & 0xffff ? 1 : 0);
+		osd_hw.free_scale[index].hfs_enable = hfs_enable;
+		osd_hw.free_scale[index].vfs_enable = vfs_enable;
+
+		osd_hw.free_scale_enable[index] = enable;
+		if (osd_hw.free_scale_enable[index]) {
+			if ((osd_hw.free_scale_data[index].x_end > 0) && hfs_enable) {
+				osd_hw.free_scale_width[index] = osd_hw.free_scale_data[index].x_end - \
+								 osd_hw.free_scale_data[index].x_start + 1;
+			}
+			if ((osd_hw.free_scale_data[index].y_end > 0) && vfs_enable) {
+				osd_hw.free_scale_height[index] = osd_hw.free_scale_data[index].y_end - \
+								  osd_hw.free_scale_data[index].y_start + 1;
+			}
+			spin_lock_irqsave(&osd_lock, lock_flags);
+			ret = osd_set_scan_mode(index);
+			if (ret)
+				osd_hw.reg[index][OSD_COLOR_MODE].update_func();
+			osd_hw.reg[index][OSD_FREESCALE_COEF].update_func();
+			osd_hw.reg[index][DISP_GEOMETRY].update_func();
+			osd_hw.reg[index][DISP_FREESCALE_ENABLE].update_func();
+			osd_hw.reg[index][OSD_ENABLE].update_func();
+			spin_unlock_irqrestore(&osd_lock, lock_flags);
+		} else {
+			spin_lock_irqsave(&osd_lock, lock_flags);
+			ret = osd_set_scan_mode(index);
+			if (ret)
+				osd_hw.reg[index][OSD_COLOR_MODE].update_func();
+			osd_hw.reg[index][DISP_GEOMETRY].update_func();
+			osd_hw.reg[index][DISP_FREESCALE_ENABLE].update_func();
+			osd_hw.reg[index][OSD_ENABLE].update_func();
+			spin_unlock_irqrestore(&osd_lock, lock_flags);
+		}
+		osd_wait_vsync_hw();
+	} else {
+		static dispdata_t save_disp_data = {0, 0, 0, 0};
+#ifdef CONFIG_AM_VIDEO
+#ifdef CONFIG_POST_PROCESS_MANAGER
+		int mode_changed = 0;
+		if ((index == OSD1) && (osd_hw.free_scale_enable[index] != enable))
+			mode_changed = 1;
+#endif
+#endif
+		amlog_level(LOG_LEVEL_HIGH, "osd%d free scale %s\n", index,
+			    enable ? "ENABLE" : "DISABLE");
+		enable = (enable & 0xffff ? 1 : 0);
+		osd_hw.free_scale_enable[index] = enable;
+		if (index == OSD1) {
+			if (enable) {
+				osd_vf_need_update = true;
+				if ((osd_hw.free_scale_data[OSD1].x_end > 0) &&
+				    (osd_hw.free_scale_data[OSD1].x_end > 0)) {
+					vf.width = osd_hw.free_scale_data[index].x_end -
+						   osd_hw.free_scale_data[index].x_start + 1;
+					vf.height = osd_hw.free_scale_data[index].y_end -
+						    osd_hw.free_scale_data[index].y_start + 1;
+				} else {
+					vf.width = osd_hw.free_scale_width[OSD1];
+					vf.height = osd_hw.free_scale_height[OSD1];
+				}
+				vf.type = (VIDTYPE_NO_VIDEO_ENABLE | VIDTYPE_PROGRESSIVE | VIDTYPE_VIU_FIELD |
+					   VIDTYPE_VSCALE_DISABLE);
+				vf.ratio_control = DISP_RATIO_FORCECONFIG | DISP_RATIO_NO_KEEPRATIO;
+#ifdef CONFIG_AM_VIDEO
+				if (osd_vf_prov_init == 0) {
+					vf_provider_init(&osd_vf_prov, PROVIDER_NAME, &osd_vf_provider, NULL);
+					osd_vf_prov_init = 1;
+				}
+				vf_reg_provider(&osd_vf_prov);
+#endif
+				memcpy(&save_disp_data, &osd_hw.dispdata[OSD1], sizeof(dispdata_t));
+				g_vf_visual_width = vf.width - 1 - osd_hw.dispdata[OSD1].x_start ;
+				g_vf_width = vf.width - 1;
+				g_vf_height = vf.height - 1;
+
+				osd_hw.dispdata[OSD1].x_end = osd_hw.dispdata[OSD1].x_start + vf.width - 1;
+				osd_hw.dispdata[OSD1].y_end = osd_hw.dispdata[OSD1].y_start + vf.height - 1;
+
+				osd_set_scan_mode(index);
+				spin_lock_irqsave(&osd_lock, lock_flags);
+				osd_hw.reg[index][DISP_GEOMETRY].update_func();
+				osd_hw.reg[index][OSD_COLOR_MODE].update_func();
+				osd_hw.reg[index][OSD_ENABLE].update_func();
+				spin_unlock_irqrestore(&osd_lock, lock_flags);
+			} else {
+				osd_vf_need_update = false;
+				osd_set_scan_mode(index);
+				if (save_disp_data.x_end <= save_disp_data.x_start ||
+				    save_disp_data.y_end <= save_disp_data.y_start)
+					return ;
+				memcpy(&osd_hw.dispdata[OSD1], &save_disp_data, sizeof(dispdata_t));
+
+				spin_lock_irqsave(&osd_lock, lock_flags);
+				osd_hw.reg[index][DISP_GEOMETRY].update_func();
+				osd_hw.reg[index][OSD_COLOR_MODE].update_func();
+				osd_hw.reg[index][OSD_ENABLE].update_func();
+				spin_unlock_irqrestore(&osd_lock, lock_flags);
+#ifdef CONFIG_AM_VIDEO
+				vf_unreg_provider(&osd_vf_prov);
+#endif
+			}
+		} else {
+			spin_lock_irqsave(&osd_lock, lock_flags);
+			osd_hw.reg[index][DISP_GEOMETRY].update_func();
+			osd_hw.reg[index][OSD_COLOR_MODE].update_func();
+			osd_hw.reg[index][OSD_ENABLE].update_func();
+			spin_unlock_irqrestore(&osd_lock, lock_flags);
+		}
+		osd_wait_vsync_hw();
+#ifdef CONFIG_AM_VIDEO
+#ifdef CONFIG_POST_PROCESS_MANAGER
+		if (mode_changed) {
+			//vf_notify_receiver(PROVIDER_NAME,VFRAME_EVENT_PROVIDER_RESET,NULL);
+			extern void vf_ppmgr_reset(int type);
+			vf_ppmgr_reset(1);
+		}
+#endif
+#endif
+	}
+}
+
+void osd_get_free_scale_enable_hw(u32 index, u32 *free_scale_enable)
+{
+	*free_scale_enable = osd_hw.free_scale_enable[index];
+}
+
+void osd_free_scale_mode_hw(u32 index, u32 freescale_mode)
+{
+	osd_hw.free_scale_mode[index] = freescale_mode;
+}
+
+void osd_get_free_scale_mode_hw(u32 index, u32 *freescale_mode)
+{
+	*freescale_mode = osd_hw.free_scale_mode[index];
+}
+
+void osd_4k2k_fb_mode_hw(u32 fb_for_4k2k)
+{
+	osd_hw.fb_for_4k2k = fb_for_4k2k;
+}
+
+void osd_free_scale_width_hw(u32 index, u32 width)
+{
+	osd_hw.free_scale_width[index] = width;
+	if (osd_hw.free_scale_enable[index] &&
+	    (!osd_hw.free_scale_mode[index])) {
+		osd_vf_need_update = true;
+		vf.width = osd_hw.free_scale_width[index];
+	}
+}
+
+void osd_get_free_scale_width_hw(u32 index, u32 *free_scale_width)
+{
+	*free_scale_width = osd_hw.free_scale_width[index];
+}
+
+void osd_free_scale_height_hw(u32 index, u32 height)
+{
+	osd_hw.free_scale_height[index] = height;
+	if (osd_hw.free_scale_enable[index] &&
+	    (!osd_hw.free_scale_mode[index])) {
+		osd_vf_need_update = true;
+		vf.height = osd_hw.free_scale_height[index];
+	}
+}
+
+void osd_get_free_scale_height_hw(u32 index, u32 *free_scale_height)
+{
+	*free_scale_height = osd_hw.free_scale_height[index];
+}
+
+void osd_get_free_scale_axis_hw(u32 index, s32 *x0, s32 *y0, s32 *x1, s32 *y1)
+{
+	*x0 = osd_hw.free_scale_data[index].x_start;
+	*y0 = osd_hw.free_scale_data[index].y_start;
+	*x1 = osd_hw.free_scale_data[index].x_end;
+	*y1 = osd_hw.free_scale_data[index].y_end;
+}
+
+void osd_set_free_scale_axis_hw(u32 index, s32 x0, s32 y0, s32 x1, s32 y1)
+{
+	osd_hw.free_scale_data[index].x_start = x0;
+	osd_hw.free_scale_data[index].y_start = y0;
+	osd_hw.free_scale_data[index].x_end = x1;
+	osd_hw.free_scale_data[index].y_end = y1;
+}
+
+void osd_get_scale_axis_hw(u32 index, s32 *x0, s32 *y0, s32 *x1, s32 *y1)
+{
+	*x0 = osd_hw.scaledata[index].x_start;
+	*x1 = osd_hw.scaledata[index].x_end;
+	*y0 = osd_hw.scaledata[index].y_start;
+	*y1 = osd_hw.scaledata[index].y_end;
+}
+
+void osd_set_scale_axis_hw(u32 index, s32 x0, s32 y0, s32 x1, s32 y1)
+{
+	osd_hw.scaledata[index].x_start = x0;
+	osd_hw.scaledata[index].x_end = x1;
+	osd_hw.scaledata[index].y_start = y0;
+	osd_hw.scaledata[index].y_end = y1;
+}
+
+void osd_get_window_axis_hw(u32 index, s32 *x0, s32 *y0, s32 *x1, s32 *y1)
+{
+	const vinfo_t *vinfo;
+	vinfo = get_current_vinfo();
+	if (vinfo) {
+		switch (vinfo->mode) {
+		case VMODE_480I:
+		case VMODE_480CVBS:
+		case VMODE_576I:
+		case VMODE_576CVBS:
+		case VMODE_1080I:
+		case VMODE_1080I_50HZ:
+#ifdef CONFIG_AML_VOUT_FRAMERATE_AUTOMATION
+		case VMODE_1080I_59HZ:
+#endif
+
+			*y0 = osd_hw.free_dst_data[index].y_start * 2;
+			*y1 = osd_hw.free_dst_data[index].y_end * 2;
+			break;
+		default:
+			*y0 = osd_hw.free_dst_data[index].y_start;
+			*y1 = osd_hw.free_dst_data[index].y_end;
+			break;
+		}
+	}
+
+	*x0 = osd_hw.free_dst_data[index].x_start;
+	*x1 = osd_hw.free_dst_data[index].x_end;
+}
+
+void osd_set_window_axis_hw(u32 index, s32 x0, s32 y0, s32 x1, s32 y1)
+{
+	const vinfo_t *vinfo;
+	mutex_lock(&osd_mutex);
+	vinfo = get_current_vinfo();
+	if (vinfo) {
+		switch (vinfo->mode) {
+		case VMODE_480I:
+		case VMODE_480CVBS:
+		case VMODE_576I:
+		case VMODE_576CVBS:
+		case VMODE_1080I:
+		case VMODE_1080I_50HZ:
+#ifdef CONFIG_AML_VOUT_FRAMERATE_AUTOMATION
+		case VMODE_1080I_59HZ:
+#endif
+
+			osd_hw.free_dst_data[index].y_start = y0 / 2;
+			osd_hw.free_dst_data[index].y_end = y1 / 2;
+			break;
+		default:
+			osd_hw.free_dst_data[index].y_start = y0;
+			osd_hw.free_dst_data[index].y_end = y1;
+			break;
+		}
+	}
+	osd_hw.free_dst_data[index].x_start = x0;
+	osd_hw.free_dst_data[index].x_end = x1;
+
+#if defined(CONFIG_FB_OSD2_CURSOR)
+	osd_hw.cursor_dispdata[index].x_start = x0;
+	osd_hw.cursor_dispdata[index].x_end = x1;
+	osd_hw.cursor_dispdata[index].y_start = y0;
+	osd_hw.cursor_dispdata[index].y_end = y1;
+#endif
+	osd_update_window_axis = true;
+	mutex_unlock(&osd_mutex);
+}
+
+
+void osd_get_osd_info_hw(u32 index, s32(*posdval)[4], u32(*posdreg)[5],
+			 s32 info_flag)
+{
+	if (info_flag == 0) {
+		posdval[0][0] = osd_hw.pandata[index].x_start;
+		posdval[0][1] = osd_hw.pandata[index].x_end;
+		posdval[0][2] = osd_hw.pandata[index].y_start;
+		posdval[0][3] = osd_hw.pandata[index].y_end;
+
+		posdval[1][0] = osd_hw.dispdata[index].x_start;
+		posdval[1][1] = osd_hw.dispdata[index].x_end;
+		posdval[1][2] = osd_hw.dispdata[index].y_start;
+		posdval[1][3] = osd_hw.dispdata[index].y_end;
+
+		posdval[2][0] = osd_hw.scaledata[index].x_start;
+		posdval[2][1] = osd_hw.scaledata[index].x_end;
+		posdval[2][2] = osd_hw.scaledata[index].y_start;
+		posdval[2][3] = osd_hw.scaledata[index].y_end;
+	} else if (info_flag == 1) {
+		posdreg[0][0] = aml_read_reg32(P_VIU_OSD1_BLK0_CFG_W0);
+		posdreg[0][1] = aml_read_reg32(P_VIU_OSD1_BLK0_CFG_W1);
+		posdreg[0][2] = aml_read_reg32(P_VIU_OSD1_BLK0_CFG_W2);
+		posdreg[0][3] = aml_read_reg32(P_VIU_OSD1_BLK0_CFG_W3);
+		posdreg[0][4] = aml_read_reg32(P_VIU_OSD1_BLK0_CFG_W4);
+
+		posdreg[1][0] = aml_read_reg32(P_VIU_OSD2_BLK0_CFG_W0);
+		posdreg[1][1] = aml_read_reg32(P_VIU_OSD2_BLK0_CFG_W1);
+		posdreg[1][2] = aml_read_reg32(P_VIU_OSD2_BLK0_CFG_W2);
+		posdreg[1][3] = aml_read_reg32(P_VIU_OSD2_BLK0_CFG_W3);
+		posdreg[1][4] = aml_read_reg32(P_VIU_OSD2_BLK0_CFG_W4);
+	} else {
+		;//ToDo
+	}
+}
+
+void osd_get_block_windows_hw(u32 index, u32 *windows)
+{
+	memcpy(windows, osd_hw.block_windows[index],
+	       sizeof(osd_hw.block_windows[index]));
+}
+
+void osd_set_block_windows_hw(u32 index, u32 *windows)
+{
+	memcpy(osd_hw.block_windows[index], windows,
+	       sizeof(osd_hw.block_windows[index]));
+	add_to_update_list(index, DISP_GEOMETRY);
+	osd_wait_vsync_hw();
+}
+
+void osd_get_block_mode_hw(u32 index, u32 *mode)
+{
+	*mode = osd_hw.block_mode[index];
+}
+
+void osd_set_block_mode_hw(u32 index, u32 mode)
+{
+	osd_hw.block_mode[index] = mode;
+	add_to_update_list(index, DISP_GEOMETRY);
+	osd_wait_vsync_hw();
+}
+
+void osd_enable_3d_mode_hw(int index, int enable)
+{
+	spin_lock_irqsave(&osd_lock, lock_flags);
+	osd_hw.mode_3d[index].enable = enable;
+	spin_unlock_irqrestore(&osd_lock, lock_flags);
+	if (enable) { //when disable 3d mode ,we should return to stardard state.
+		osd_hw.mode_3d[index].left_right = LEFT;
+		osd_hw.mode_3d[index].l_start = osd_hw.pandata[index].x_start;
+		osd_hw.mode_3d[index].l_end = (osd_hw.pandata[index].x_end +
+					       osd_hw.pandata[index].x_start) >> 1;
+		osd_hw.mode_3d[index].r_start = osd_hw.mode_3d[index].l_end + 1;
+		osd_hw.mode_3d[index].r_end = osd_hw.pandata[index].x_end;
+		osd_hw.mode_3d[index].origin_scale.h_enable = osd_hw.scale[index].h_enable;
+		osd_hw.mode_3d[index].origin_scale.v_enable = osd_hw.scale[index].v_enable;
+		osd_set_2x_scale_hw(index, 1, 0);
+	} else {
+
+		osd_set_2x_scale_hw(index, osd_hw.mode_3d[index].origin_scale.h_enable,
+				    osd_hw.mode_3d[index].origin_scale.v_enable);
+	}
+}
+void osd_enable_hw(int enable , int index)
+{
+	osd_hw.enable[index] = enable;
+	add_to_update_list(index, OSD_ENABLE);
+
+	osd_wait_vsync_hw();
+}
+
+void osd_set_2x_scale_hw(u32 index, u16 h_scale_enable, u16 v_scale_enable)
+{
+	amlog_level(LOG_LEVEL_HIGH, "osd[%d] set scale, h_scale: %s, v_scale: %s\n",
+		    index, h_scale_enable ? "ENABLE" : "DISABLE",
+		    v_scale_enable ? "ENABLE" : "DISABLE");
+	amlog_level(LOG_LEVEL_HIGH, "osd[%d].scaledata: %d %d %d %d\n",
+		    index,
+		    osd_hw.scaledata[index].x_start,
+		    osd_hw.scaledata[index].x_end,
+		    osd_hw.scaledata[index].y_start,
+		    osd_hw.scaledata[index].y_end);
+	amlog_level(LOG_LEVEL_HIGH, "osd[%d].pandata: %d %d %d %d\n",
+		    index,
+		    osd_hw.pandata[index].x_start,
+		    osd_hw.pandata[index].x_end,
+		    osd_hw.pandata[index].y_start,
+		    osd_hw.pandata[index].y_end);
+
+	osd_hw.scale[index].h_enable = h_scale_enable;
+	osd_hw.scale[index].v_enable = v_scale_enable;
+
+	spin_lock_irqsave(&osd_lock, lock_flags);
+	osd_hw.reg[index][DISP_SCALE_ENABLE].update_func();
+	osd_hw.reg[index][DISP_GEOMETRY].update_func();
+	spin_unlock_irqrestore(&osd_lock, lock_flags);
+
+	osd_wait_vsync_hw();
+}
+
+void osd_get_flush_rate(u32 *break_rate)
+{
+	const vinfo_t *vinfo;
+	vinfo = get_current_vinfo();
+	*break_rate = vinfo->sync_duration_num / vinfo->sync_duration_den;
+}
+
+void osd_set_osd_rotate_angle_hw(u32 index, u32 angle)
+{
+	osd_hw.rotate[index].angle = angle;
+	add_to_update_list(index, DISP_OSD_ROTATE);
+	osd_wait_vsync_hw();
+}
+
+void osd_get_osd_rotate_angle_hw(u32 index, u32 *angle)
+{
+	*angle = osd_hw.rotate[index].angle;
+}
+void osd_set_osd_rotate_on_hw(u32 index, u32 on_off)
+{
+	//static dispdata_t save_disp_data={0,0,0,0};
+	//static dispdata_t save_disp_data2={0,0,0,0};
+	osd_hw.rotate[index].on_off = on_off;
+
+	if (on_off) {
+		if (index == OSD1) {
+			//memcpy(&save_disp_data,&osd_hw.dispdata[index],sizeof(dispdata_t));
+		} else if (index == OSD2) {
+			//memcpy(&save_disp_data2,&osd_hw.dispdata[index],sizeof(dispdata_t));
+		}
+		g_rotation_width = osd_hw.rotation_pandata[index].x_end -
+				   osd_hw.rotation_pandata[index].x_start;
+		g_rotation_height = osd_hw.rotation_pandata[index].y_end -
+				    osd_hw.rotation_pandata[index].y_start;
+		osd_hw.dispdata[index].x_end = osd_hw.dispdata[OSD1].x_start +
+					       g_rotation_height;
+		osd_hw.dispdata[index].y_end = osd_hw.dispdata[OSD1].y_start + g_rotation_width;
+	} else {
+#if (MESON_CPU_TYPE == MESON_CPU_TYPE_MESON8)
+		{
+			if (IS_MESON_M8_CPU)
+			{
+				aml_set_reg32_mask(P_VPU_SW_RESET, 1 << 8);
+				aml_clr_reg32_mask(P_VPU_SW_RESET, 1 << 8);
+			}
+		}
+#endif
+		if (index == OSD1) {
+#if (MESON_CPU_TYPE == MESON_CPU_TYPE_MESON8)
+			if (IS_MESON_M8_CPU) {
+				aml_set_reg32_mask(P_VIU_SW_RESET, 1 << 0);
+				aml_clr_reg32_mask(P_VIU_SW_RESET, 1 << 0);
+			}
+#endif
+			VSYNCOSD_SET_MPEG_REG_MASK(VIU_OSD1_FIFO_CTRL_STAT, 1 << 0);
+		} else {
+			aml_set_reg32_mask(P_VIU_SW_RESET, 1 << 1);
+			aml_clr_reg32_mask(P_VIU_SW_RESET, 1 << 1);
+			VSYNCOSD_SET_MPEG_REG_MASK(VIU_OSD2_FIFO_CTRL_STAT, 1 << 0);
+			//memcpy(&osd_hw.dispdata[index],&save_disp_data2,sizeof(dispdata_t));
+		}
+	}
+	spin_lock_irqsave(&osd_lock, lock_flags);
+	osd_hw.reg[index][OSD_COLOR_MODE].update_func();
+	osd_hw.reg[index][DISP_GEOMETRY].update_func();
+	osd_hw.reg[index][DISP_OSD_ROTATE].update_func();
+	spin_unlock_irqrestore(&osd_lock, lock_flags);
+	osd_wait_vsync_hw();
+}
+
+void osd_get_osd_rotate_on_hw(u32 index, u32 *on_off)
+{
+	*on_off = osd_hw.rotate[index].on_off;
+}
+
+void osd_set_osd_antiflicker_hw(u32 index, u32 vmode, u32 yres)
+{
+	bool osd_need_antiflicker = false;
+
+	switch (vmode) {
+	case VMODE_480I:
+	case VMODE_480CVBS:
+	case VMODE_576I:
+	case VMODE_576CVBS:
+	case VMODE_1080I:
+	case VMODE_1080I_50HZ:
+#ifdef CONFIG_AML_VOUT_FRAMERATE_AUTOMATION
+	case VMODE_1080I_59HZ:
+#endif
+		osd_need_antiflicker = false;
+		break;
+	default:
+		break;
+	}
+
+	if (osd_need_antiflicker) {
+		osd_hw.antiflicker_mode = 1;
+		osd_antiflicker_task_start();
+		osd_antiflicker_enable(1);
+		osd_antiflicker_update_pan(osd_hw.pandata[index].y_start, yres);
+	} else {
+		if (osd_hw.antiflicker_mode)
+			osd_antiflicker_task_stop();
+		osd_hw.antiflicker_mode = 0;
+	}
+}
+
+void osd_get_osd_antiflicker_hw(u32 index, u32 *on_off)
+{
+	*on_off = osd_hw.antiflicker_mode;
+}
+
+void osd_get_osd_updatestate_hw(u32 index, u32 *up_free)
+{
+	if (osd_vf_need_update)
+		*up_free = 1;
+	else
+		*up_free = 0;
+}
+
+void osd_set_osd_updatestate_hw(u32 index, u32 up_free)
+{
+	if (up_free > 0)
+		osd_vf_need_update = true;
+	else
+		osd_vf_need_update = false;
+}
+
+
+void osd_clone_pan(u32 index, u32 yoffset, int debug_flag)
+{
+	s32 offset = 0;
+	u32 index_buffer = 0;
+	s32 osd0_buffer_number = 0;
+	s32 height_osd1 = 0;
+
+	if (yoffset != 0) {
+		index_buffer = osd_hw.fb_gem[index].height / yoffset;
+		if (index_buffer == 3)
+			osd0_buffer_number = 1;
+		else if (index_buffer == 1)
+			osd0_buffer_number = 2;
+	} else
+		osd0_buffer_number = 0;
+
+	osd_clone_get_virtual_yres(&height_osd1);
+	if (osd_hw.clone) {
+		offset = osd0_buffer_number * height_osd1;
+
+		osd_hw.pandata[OSD2].y_start = offset;
+		osd_hw.pandata[OSD2].y_end = offset + height_osd1 - 1;
+		if (osd_hw.angle[OSD2]) {
+			if (debug_flag)
+				printk("++ osd_clone_pan start when enable clone\n");
+			osd_clone_update_pan(osd0_buffer_number);
+		}
+		add_to_update_list(OSD2, DISP_GEOMETRY);
+	}
+}
+
+void osd_set_osd_angle_hw(u32 index, u32 angle, u32  virtual_osd1_yres,
+			  u32 virtual_osd2_yres)
+{
+#ifndef OSD_GE2D_CLONE_SUPPORT
+	printk("++ osd_clone depends on GE2D module!\n");
+	return;
+#endif
+
+	if (angle > 4) {
+		printk("++ invalid angle: %d\n", angle);
+		return;
+	}
+
+	printk("++ virtual_osd1_yres is %d, virtual_osd2_yres is %d!\n",
+	       virtual_osd1_yres, virtual_osd2_yres);
+	osd_clone_set_virtual_yres(virtual_osd1_yres, virtual_osd2_yres);
+	if (osd_hw.clone == 0) {
+		printk("++ set osd[%d]->angle: %d->%d\n", index, osd_hw.angle[index], angle);
+		osd_clone_set_angle(angle);
+		osd_hw.angle[index] = angle;
+	} else if (!((osd_hw.angle[index] == 0) || (angle == 0))) {
+		printk("++ set osd[%d]->angle: %d->%d\n", index, osd_hw.angle[index], angle);
+		osd_clone_set_angle(angle);
+		osd_hw.angle[index] = angle;
+		osd_clone_pan(index, osd_hw.pandata[OSD1].y_start, 1);
+	}
+}
+
+void osd_get_osd_angle_hw(u32 index, u32 *angle)
+{
+	*angle = osd_hw.angle[index];
+}
+
+void osd_set_osd_clone_hw(u32 index, u32 clone)
+{
+	int ret = -1;
+
+	printk("++ set osd[%d]->clone: %d->%d\n", index, osd_hw.clone, clone);
+	osd_hw.clone = clone;
+
+	if (osd_hw.clone) {
+		if (osd_hw.angle[index]) {
+			osd_hw.color_info[index] = osd_hw.color_info[OSD1];
+			ret = osd_clone_task_start();
+			if (ret)
+				osd_clone_pan(index, osd_hw.pandata[OSD1].y_start, 1);
+			else
+				printk("++ start clone error\n");
+		}
+	} else {
+		if (osd_hw.angle[index])
+			osd_clone_task_stop();
+	}
+	add_to_update_list(index, OSD_COLOR_MODE);
+}
+
+void osd_set_osd_update_pan_hw(u32 index)
+{
+	osd_clone_pan(index, osd_hw.pandata[OSD1].y_start, 1);
+}
+
+void osd_get_osd_clone_hw(u32 index, u32 *clone)
+{
+	*clone = osd_hw.clone;
+}
+
+void osd_set_osd_reverse_hw(u32 index, u32 reverse)
+{
+	osd_hw.osd_reverse[index] = reverse;
+	add_to_update_list(index, DISP_OSD_REVERSE);
+	osd_wait_vsync_hw();
+}
+
+void osd_get_osd_reverse_hw(u32 index, u32 *reverse)
+{
+	*reverse = osd_hw.osd_reverse[index];
+}
+
+void osd_set_prot_canvas_hw(u32 index, s32 x_start, s32 y_start, s32 x_end,
+			    s32 y_end)
+{
+	osd_hw.rotation_pandata[index].x_start = x_start;
+	osd_hw.rotation_pandata[index].y_start = y_start;
+	osd_hw.rotation_pandata[index].x_end = x_end;
+	osd_hw.rotation_pandata[index].y_end = y_end;
+
+	if (osd_hw.rotate[index].on_off && osd_hw.rotate[index].angle > 0) {
+		g_rotation_width = osd_hw.rotation_pandata[index].x_end -
+				   osd_hw.rotation_pandata[index].x_start;
+		g_rotation_height = osd_hw.rotation_pandata[index].y_end -
+				    osd_hw.rotation_pandata[index].y_start;
+		osd_hw.dispdata[index].x_end = osd_hw.dispdata[OSD1].x_start +
+					       g_rotation_height;
+		osd_hw.dispdata[index].y_end = osd_hw.dispdata[OSD1].y_start + g_rotation_width;
+
+		spin_lock_irqsave(&osd_lock, lock_flags);
+		osd_hw.reg[index][DISP_GEOMETRY].update_func();
+		osd_hw.reg[index][OSD_COLOR_MODE].update_func();
+		spin_unlock_irqrestore(&osd_lock, lock_flags);
+	}
+}
+
+void osd_get_prot_canvas_hw(u32 index, s32 *x_start, s32 *y_start, s32 *x_end,
+			    s32 *y_end)
+{
+	*x_start = osd_hw.rotation_pandata[index].x_start;
+	*y_start = osd_hw.rotation_pandata[index].y_start;
+	*x_end = osd_hw.rotation_pandata[index].x_end;
+	*y_end = osd_hw.rotation_pandata[index].y_end;
+}
+
+#ifdef  CONFIG_FB_OSD_SUPPORT_SYNC_FENCE
+void osd_pan_display_fence(osd_fence_map_t *fence_map)
+{
+	s32 ret = 1;
+	long diff_x, diff_y;
+	u32 index = fence_map->fb_index;
+	u32 xoffset = fence_map->xoffset;
+	u32 yoffset = fence_map->yoffset;
+
+	if (index >= 2)
+		return;
+
+	if (timeline_created) { //out fence created success.
+		ret = osd_wait_buf_ready(fence_map);
+		if (ret < 0)
+			amlog_mask_level(LOG_MASK_HARDWARE, LOG_LEVEL_LOW, "fence wait ret %d\n", ret);
+	}
+
+	if (ret) {
+		if (xoffset != osd_hw.pandata[index].x_start ||
+		    yoffset != osd_hw.pandata[index].y_start) {
+			spin_lock_irqsave(&osd_lock, lock_flags);
+			diff_x = xoffset - osd_hw.pandata[index].x_start;
+			diff_y = yoffset - osd_hw.pandata[index].y_start;
+
+			osd_hw.pandata[index].x_start += diff_x;
+			osd_hw.pandata[index].x_end   += diff_x;
+			osd_hw.pandata[index].y_start += diff_y;
+			osd_hw.pandata[index].y_end   += diff_y;
+			osd_hw.reg[index][DISP_GEOMETRY].update_func();
+			if (osd_hw.free_scale_enable[index] && osd_update_window_axis) {
+				osd_hw.reg[index][DISP_FREESCALE_ENABLE].update_func();
+				osd_update_window_axis = false;
+			}
+			spin_unlock_irqrestore(&osd_lock, lock_flags);
+			osd_wait_vsync_hw();
+		}
+	}
+
+	if (timeline_created) {
+		if (ret)
+			sw_sync_timeline_inc(timeline, 1);
+		else
+			printk("------NOT signal out_fence ERROR\n");
+	}
+#ifdef CONFIG_AM_FB_EXT
+	if (ret)
+		osd_ext_clone_pan(index);
+#endif
+
+	amlog_mask_level(LOG_MASK_HARDWARE, LOG_LEVEL_LOW,
+			 "offset[%d-%d]x[%d-%d]y[%d-%d]\n", \
+			 xoffset, yoffset, osd_hw.pandata[index].x_start , osd_hw.pandata[index].x_end ,
+			 \
+			 osd_hw.pandata[index].y_start , osd_hw.pandata[index].y_end);
+}
+#endif
+
+void osd_pan_display_hw(unsigned int xoffset, unsigned int yoffset, int index)
+{
+	long diff_x, diff_y;
+
+#if defined(CONFIG_FB_OSD2_CURSOR)
+	if (index >= 1)
+#else
+	if (index >= 2)
+#endif
+		return;
+
+	if (xoffset != osd_hw.pandata[index].x_start ||
+	    yoffset != osd_hw.pandata[index].y_start) {
+		diff_x = xoffset - osd_hw.pandata[index].x_start;
+		diff_y = yoffset - osd_hw.pandata[index].y_start;
+
+		osd_hw.pandata[index].x_start += diff_x;
+		osd_hw.pandata[index].x_end   += diff_x;
+		osd_hw.pandata[index].y_start += diff_y;
+		osd_hw.pandata[index].y_end   += diff_y;
+		add_to_update_list(index, DISP_GEOMETRY);
+		osd_wait_vsync_hw();
+	}
+#ifdef CONFIG_AM_FB_EXT
+	osd_ext_clone_pan(index);
+#endif
+	amlog_mask_level(LOG_MASK_HARDWARE, LOG_LEVEL_LOW,
+			 "offset[%d-%d]x[%d-%d]y[%d-%d]\n", \
+			 xoffset, yoffset, osd_hw.pandata[index].x_start , osd_hw.pandata[index].x_end ,
+			 \
+			 osd_hw.pandata[index].y_start , osd_hw.pandata[index].y_end);
+}
+
+static  void  osd1_update_disp_scale_enable(void)
+{
+	if (osd_hw.scale[OSD1].h_enable)
+		VSYNCOSD_SET_MPEG_REG_MASK(VIU_OSD1_BLK0_CFG_W0, 3 << 12);
+	else
+		VSYNCOSD_CLR_MPEG_REG_MASK(VIU_OSD1_BLK0_CFG_W0, 3 << 12);
+	if (osd_hw.scan_mode != SCAN_MODE_INTERLACE) {
+		if (osd_hw.scale[OSD1].v_enable)
+			VSYNCOSD_SET_MPEG_REG_MASK(VIU_OSD1_BLK0_CFG_W0, 1 << 14);
+		else
+			VSYNCOSD_CLR_MPEG_REG_MASK(VIU_OSD1_BLK0_CFG_W0, 1 << 14);
+	}
+}
+
+static  void  osd2_update_disp_scale_enable(void)
+{
+	if (osd_hw.scale[OSD2].h_enable) {
+#if defined(CONFIG_FB_OSD2_CURSOR)
+		VSYNCOSD_CLR_MPEG_REG_MASK(VIU_OSD2_BLK0_CFG_W0, 3 << 12);
+#else
+		VSYNCOSD_SET_MPEG_REG_MASK(VIU_OSD2_BLK0_CFG_W0, 3 << 12);
+#endif
+	} else
+		VSYNCOSD_CLR_MPEG_REG_MASK(VIU_OSD2_BLK0_CFG_W0, 3 << 12);
+	if (osd_hw.scan_mode != SCAN_MODE_INTERLACE) {
+		if (osd_hw.scale[OSD2].v_enable) {
+#if defined(CONFIG_FB_OSD2_CURSOR)
+			VSYNCOSD_CLR_MPEG_REG_MASK(VIU_OSD2_BLK0_CFG_W0, 1 << 14);
+#else
+			VSYNCOSD_SET_MPEG_REG_MASK(VIU_OSD2_BLK0_CFG_W0, 1 << 14);
+#endif
+		} else
+			VSYNCOSD_CLR_MPEG_REG_MASK(VIU_OSD2_BLK0_CFG_W0, 1 << 14);
+	}
+}
+
+static void osd1_update_disp_freescale_enable(void)
+{
+	int hf_phase_step, vf_phase_step;
+	int src_w, src_h, dst_w, dst_h;
+	int bot_ini_phase;
+	int vsc_ini_rcv_num, vsc_ini_rpt_p0_num;
+	int vsc_bot_rcv_num = 0, vsc_bot_rpt_p0_num = 0;
+	int hsc_ini_rcv_num, hsc_ini_rpt_p0_num;
+
+	int hf_bank_len = 4;
+	int vf_bank_len = 0;
+	u32 data32 = 0x0;
+
+	if (osd_hw.scale_workaround)
+		vf_bank_len = 2;
+	else
+		vf_bank_len = 4;
+
+	if (osd_hw.bot_type == 1) {
+		vsc_bot_rcv_num = 4;
+		vsc_bot_rpt_p0_num = 1;
+	} else if (osd_hw.bot_type == 2) {
+		vsc_bot_rcv_num = 6;
+		vsc_bot_rpt_p0_num = 2;
+	} else if (osd_hw.bot_type == 3) {
+		vsc_bot_rcv_num = 8;
+		vsc_bot_rpt_p0_num = 3;
+	}
+	hsc_ini_rcv_num = hf_bank_len;
+	vsc_ini_rcv_num = vf_bank_len;
+	hsc_ini_rpt_p0_num = (hf_bank_len / 2 - 1) > 0 ? (hf_bank_len / 2 - 1) : 0;
+	vsc_ini_rpt_p0_num = (vf_bank_len / 2 - 1) > 0 ? (vf_bank_len / 2 - 1) : 0;
+
+	src_w = osd_hw.free_scale_width[OSD1];
+	src_h = osd_hw.free_scale_height[OSD1];
+	dst_w = osd_hw.free_dst_data[OSD1].x_end - osd_hw.free_dst_data[OSD1].x_start +
+		1;
+	dst_h = osd_hw.free_dst_data[OSD1].y_end - osd_hw.free_dst_data[OSD1].y_start +
+		1;
+
+#if MESON_CPU_TYPE >= MESON_CPU_TYPE_MESONG9TV
+	/* super scaler mode */
+	if (osd_hw.free_scale_mode[OSD1] & 0x2) {
+		if (osd_hw.free_scale_enable[OSD1]) {
+			OSD_SUPER_SCALER_MEM_POWER_ON();
+			/* enable osd scaler path */
+			VSYNCOSD_WR_MPEG_REG(VPP_OSD_SC_CTRL0, 0x8);
+			/* enable osd super scaler */
+			data32 = (1 << 0)
+				 | (1 << 1)
+				 | (1 << 2);
+			VSYNCOSD_WR_MPEG_REG(OSDSR_CTRL_MODE, data32);
+
+			/* config osd super scaler setting */
+			VSYNCOSD_WR_MPEG_REG(OSDSR_UK_GRAD2DDIAG_LIMIT, 0xffffff);
+			VSYNCOSD_WR_MPEG_REG(OSDSR_UK_GRAD2DADJA_LIMIT, 0xffffff);
+			VSYNCOSD_WR_MPEG_REG(OSDSR_UK_BST_GAIN, 0x7a7a3a50);
+
+			/* config osd super scaler input size */
+			data32 = (src_h & 0x1fff) | (src_w & 0x1fff) << 16;
+			VSYNCOSD_WR_MPEG_REG(OSDSR_HV_SIZEIN, data32);
+
+			/* config osd super scaler output size */
+			data32 = ((osd_hw.free_dst_data[OSD1].x_end & 0xfff) |
+				  (osd_hw.free_dst_data[OSD1].x_start & 0xfff) << 16);
+			VSYNCOSD_WR_MPEG_REG(VPP_OSD_SCO_H_START_END, data32);
+
+			data32 = ((osd_hw.free_dst_data[OSD1].y_end & 0xfff) |
+				  (osd_hw.free_dst_data[OSD1].y_start & 0xfff) << 16);
+			VSYNCOSD_WR_MPEG_REG(VPP_OSD_SCO_V_START_END, data32);
+		} else {
+			/* disable osd scaler path */
+			VSYNCOSD_WR_MPEG_REG(VPP_OSD_SC_CTRL0, 0);
+			/* disable osd super scaler */
+			VSYNCOSD_WR_MPEG_REG(OSDSR_HV_SIZEIN, 0);
+			VSYNCOSD_WR_MPEG_REG(OSDSR_CTRL_MODE, 0);
+			OSD_SUPER_SCALER_MEM_POWER_OFF();
+		}
+		remove_from_update_list(OSD1, DISP_FREESCALE_ENABLE);
+		return;
+	}
+#endif
+
+	data32 = 0x0;
+	if (osd_hw.free_scale_enable[OSD1]) {
+		/* enable osd scaler */
+		if (osd_hw.free_scale_mode[OSD1] & 0x1) {
+			data32 |= 1 << 2; //enable osd scaler
+			data32 |= 1 << 3; //enable osd scaler path
+			VSYNCOSD_WR_MPEG_REG(VPP_OSD_SC_CTRL0, data32);
+		}
+	} else {
+		/* disable osd scaler path */
+		VSYNCOSD_WR_MPEG_REG(VPP_OSD_SC_CTRL0, 0);
+	}
+
+	hf_phase_step = (src_w << 18) / dst_w;
+	hf_phase_step = (hf_phase_step << 6);
+	vf_phase_step = (src_h << 20) / dst_h;
+
+	if (osd_hw.field_out_en)   //interface output
+		bot_ini_phase = ((vf_phase_step / 2) >> 4);
+	else
+		bot_ini_phase = 0;
+	vf_phase_step = (vf_phase_step << 4);
+
+	/* config osd scaler in/out hv size */
+	data32 = 0x0;
+	if (osd_hw.free_scale_enable[OSD1]) {
+		data32 = (((src_h - 1) & 0x1fff) | ((src_w - 1) & 0x1fff) << 16);
+		VSYNCOSD_WR_MPEG_REG(VPP_OSD_SCI_WH_M1, data32);
+
+		data32 = ((osd_hw.free_dst_data[OSD1].x_end & 0xfff) |
+			  (osd_hw.free_dst_data[OSD1].x_start & 0xfff) << 16);
+		VSYNCOSD_WR_MPEG_REG(VPP_OSD_SCO_H_START_END, data32);
+
+		data32 = ((osd_hw.free_dst_data[OSD1].y_end & 0xfff) |
+			  (osd_hw.free_dst_data[OSD1].y_start & 0xfff) << 16);
+		VSYNCOSD_WR_MPEG_REG(VPP_OSD_SCO_V_START_END, data32);
+	}
+
+	data32 = 0x0;
+	if (osd_hw.free_scale[OSD1].vfs_enable) {
+		data32 |= (vf_bank_len & 0x7) | ((vsc_ini_rcv_num & 0xf) << 3) | ((
+					vsc_ini_rpt_p0_num & 0x3) << 8);
+		if (osd_hw.field_out_en)
+			data32 |= ((vsc_bot_rcv_num & 0xf) << 11) | ((vsc_bot_rpt_p0_num & 0x3) << 16)
+				  | (1 << 23);
+
+		if (osd_hw.scale_workaround)
+			data32 |= 1 << 21;
+		data32 |= 1 << 24;
+	}
+	VSYNCOSD_WR_MPEG_REG(VPP_OSD_VSC_CTRL0, data32);
+
+	data32 = 0x0;
+	if (osd_hw.free_scale[OSD1].hfs_enable) {
+		data32 |= (hf_bank_len & 0x7) | ((hsc_ini_rcv_num & 0xf) << 3) | ((
+					hsc_ini_rpt_p0_num & 0x3) << 8);
+		data32 |= 1 << 22;
+	}
+	VSYNCOSD_WR_MPEG_REG(VPP_OSD_HSC_CTRL0, data32);
+
+	data32 = 0x0;
+	if (osd_hw.free_scale_enable[OSD1]) {
+		data32 |= (bot_ini_phase & 0xffff) << 16;
+		VSYNCOSD_WR_MPEG_REG_BITS(VPP_OSD_HSC_PHASE_STEP, hf_phase_step, 0, 28);
+		VSYNCOSD_WR_MPEG_REG_BITS(VPP_OSD_HSC_INI_PHASE, 0, 0, 16);
+
+		VSYNCOSD_WR_MPEG_REG_BITS(VPP_OSD_VSC_PHASE_STEP, vf_phase_step, 0, 28);
+		VSYNCOSD_WR_MPEG_REG(VPP_OSD_VSC_INI_PHASE, data32);
+	}
+
+	remove_from_update_list(OSD1, DISP_FREESCALE_ENABLE);
+}
+
+static void osd1_update_coef(void)
+{
+	int i;
+	bool need_update_coef = false;
+	int hf_coef_wren = 1;
+	int vf_coef_wren = 1;
+	int *hf_coef, *vf_coef;
+
+	if (osd_hw.scale_workaround) {
+		if (use_v_filter_mode != 3) {
+			use_v_filter_mode = 3;
+			need_update_coef = true;
+		} else
+			need_update_coef = false;
+	} else {
+		if (use_v_filter_mode != osd_v_filter_mode) {
+			use_v_filter_mode = osd_v_filter_mode;
+			need_update_coef = true;
+		} else
+			need_update_coef = false;
+	}
+
+	if (need_update_coef) {
+		vf_coef = filter_table[use_v_filter_mode];
+
+		if (vf_coef_wren) {
+			aml_set_reg32_bits(P_VPP_OSD_SCALE_COEF_IDX, 0x0000, 0, 9);
+			for (i = 0; i < 33; i++)
+				aml_write_reg32(P_VPP_OSD_SCALE_COEF, vf_coef[i]);
+		}
+	}
+
+	need_update_coef = false;
+	if (use_h_filter_mode != osd_h_filter_mode) {
+		use_h_filter_mode = osd_h_filter_mode;
+		need_update_coef = true;
+	}
+	hf_coef = filter_table[use_h_filter_mode];
+
+	if (need_update_coef) {
+		if (hf_coef_wren) {
+			aml_set_reg32_bits(P_VPP_OSD_SCALE_COEF_IDX, 0x0100, 0, 9);
+			for (i = 0; i < 33; i++)
+				aml_write_reg32(P_VPP_OSD_SCALE_COEF, hf_coef[i]);
+		}
+	}
+	remove_from_update_list(OSD1, OSD_FREESCALE_COEF);
+}
+
+static void osd2_update_disp_freescale_enable(void)
+{
+	int hf_phase_step, vf_phase_step;
+	int src_w, src_h, dst_w, dst_h;
+	int bot_ini_phase;
+	int vsc_ini_rcv_num, vsc_ini_rpt_p0_num;
+	int vsc_bot_rcv_num = 6, vsc_bot_rpt_p0_num = 2;
+	int hsc_ini_rcv_num, hsc_ini_rpt_p0_num;
+
+	int hf_bank_len = 4;
+	int vf_bank_len = 4;
+	u32 data32 = 0x0;
+
+	if (osd_hw.scale_workaround)
+		vf_bank_len = 2;
+
+	hsc_ini_rcv_num = hf_bank_len;
+	vsc_ini_rcv_num = vf_bank_len;
+	hsc_ini_rpt_p0_num = (hf_bank_len / 2 - 1) > 0 ? (hf_bank_len / 2 - 1) : 0;
+	vsc_ini_rpt_p0_num = (vf_bank_len / 2 - 1) > 0 ? (vf_bank_len / 2 - 1) : 0;
+
+	src_w = osd_hw.free_scale_width[OSD2];
+	src_h = osd_hw.free_scale_height[OSD2];
+	dst_w = osd_hw.free_dst_data[OSD2].x_end - osd_hw.free_dst_data[OSD2].x_start +
+		1;
+	dst_h = osd_hw.free_dst_data[OSD2].y_end - osd_hw.free_dst_data[OSD2].y_start +
+		1;
+
+#if MESON_CPU_TYPE >= MESON_CPU_TYPE_MESONG9TV
+	/* super scaler mode */
+	if (osd_hw.free_scale_mode[OSD2] & 0x2) {
+		if (osd_hw.free_scale_enable[OSD2]) {
+			OSD_SUPER_SCALER_MEM_POWER_ON();
+			/* enable osd scaler path */
+			data32 = 1;       //select osd2 input
+			data32 |= 1 << 3; //enable osd scaler path
+			VSYNCOSD_WR_MPEG_REG(VPP_OSD_SC_CTRL0, data32);
+			/* enable osd super scaler */
+			data32 = (1 << 0)
+				 | (1 << 1)
+				 | (1 << 2);
+			VSYNCOSD_WR_MPEG_REG(OSDSR_CTRL_MODE, data32);
+
+			/* config osd super scaler setting */
+			VSYNCOSD_WR_MPEG_REG(OSDSR_UK_GRAD2DDIAG_LIMIT, 0xffffff);
+			VSYNCOSD_WR_MPEG_REG(OSDSR_UK_GRAD2DADJA_LIMIT, 0xffffff);
+			VSYNCOSD_WR_MPEG_REG(OSDSR_UK_BST_GAIN, 0x7a7a3a50);
+
+			/* config osd super scaler input size */
+			data32 = (src_h & 0x1fff) | (src_w & 0x1fff) << 16;
+			VSYNCOSD_WR_MPEG_REG(OSDSR_HV_SIZEIN, data32);
+			/* config osd super scaler output size */
+			data32 = ((osd_hw.free_dst_data[OSD2].x_end & 0xfff) |
+				  (osd_hw.free_dst_data[OSD2].x_start & 0xfff) << 16);
+			VSYNCOSD_WR_MPEG_REG(VPP_OSD_SCO_H_START_END, data32);
+
+			data32 = ((osd_hw.free_dst_data[OSD2].y_end & 0xfff) |
+				  (osd_hw.free_dst_data[OSD2].y_start & 0xfff) << 16);
+			VSYNCOSD_WR_MPEG_REG(VPP_OSD_SCO_V_START_END, data32);
+		} else {
+			/* disable osd scaler path */
+			VSYNCOSD_WR_MPEG_REG(VPP_OSD_SC_CTRL0, 0);
+			/* disable osd super scaler */
+			VSYNCOSD_WR_MPEG_REG(OSDSR_HV_SIZEIN, 0);
+			VSYNCOSD_WR_MPEG_REG(OSDSR_CTRL_MODE, 0);
+			OSD_SUPER_SCALER_MEM_POWER_OFF();
+		}
+		remove_from_update_list(OSD2, DISP_FREESCALE_ENABLE);
+		return;
+	}
+#endif
+
+	/* config osd sc control reg */
+	data32 = 0x0;
+	if (osd_hw.free_scale_enable[OSD2]) {
+		/* enable osd scaler */
+		if (osd_hw.free_scale_mode[OSD2] & 0x1) {
+			data32 |= 1;      //select osd2 input
+			data32 |= 1 << 2; //enable osd scaler
+			data32 |= 1 << 3; //enable osd scaler path
+			VSYNCOSD_WR_MPEG_REG(VPP_OSD_SC_CTRL0, data32);
+		}
+
+	} else {
+		/* disable osd scaler path */
+		VSYNCOSD_WR_MPEG_REG(VPP_OSD_SC_CTRL0, 0);
+	}
+
+	hf_phase_step = (src_w << 18) / dst_w;
+	hf_phase_step = (hf_phase_step << 6);
+	vf_phase_step = (src_h << 20) / dst_h;
+
+	if (osd_hw.field_out_en)   //interface output
+		bot_ini_phase = ((vf_phase_step / 2) >> 4);
+	else
+		bot_ini_phase = 0;
+	vf_phase_step = (vf_phase_step << 4);
+
+	/* config osd scaler in/out hv size */
+	data32 = 0x0;
+	if (osd_hw.free_scale_enable[OSD2]) {
+		data32 = (((src_h - 1) & 0x1fff) | ((src_w - 1) & 0x1fff) << 16);
+		VSYNCOSD_WR_MPEG_REG(VPP_OSD_SCI_WH_M1, data32);
+
+		data32 = ((osd_hw.free_dst_data[OSD2].x_end & 0xfff) |
+			  (osd_hw.free_dst_data[OSD2].x_start & 0xfff) << 16);
+		VSYNCOSD_WR_MPEG_REG(VPP_OSD_SCO_H_START_END, data32);
+
+		data32 = ((osd_hw.free_dst_data[OSD2].y_end & 0xfff) |
+			  (osd_hw.free_dst_data[OSD2].y_start & 0xfff) << 16);
+		VSYNCOSD_WR_MPEG_REG(VPP_OSD_SCO_V_START_END, data32);
+	}
+
+	data32 = 0x0;
+	if (osd_hw.free_scale[OSD2].hfs_enable) {
+		data32 |= (hf_bank_len & 0x7) | ((hsc_ini_rcv_num & 0xf) << 3) | ((
+					hsc_ini_rpt_p0_num & 0x3) << 8);
+		data32 |= 1 << 22;
+	}
+	VSYNCOSD_WR_MPEG_REG(VPP_OSD_HSC_CTRL0, data32);
+
+	data32 = 0x0;
+	if (osd_hw.free_scale[OSD2].vfs_enable) {
+		data32 |= (vf_bank_len & 0x7) | ((vsc_ini_rcv_num & 0xf) << 3) | ((
+					vsc_ini_rpt_p0_num & 0x3) << 8);
+		if (osd_hw.field_out_en)   //interface output
+			data32 |= ((vsc_bot_rcv_num & 0xf) << 11) | ((vsc_bot_rpt_p0_num & 0x3) << 16)
+				  | (1 << 23);
+
+		if (osd_hw.scale_workaround)
+			data32 |= 1 << 21;
+		data32 |= 1 << 24;
+	}
+	VSYNCOSD_WR_MPEG_REG(VPP_OSD_VSC_CTRL0, data32);
+
+	data32 = 0x0;
+	if (osd_hw.free_scale_enable[OSD2]) {
+		data32 |= (bot_ini_phase & 0xffff) << 16;
+		VSYNCOSD_WR_MPEG_REG_BITS(VPP_OSD_HSC_PHASE_STEP, hf_phase_step, 0, 28);
+		VSYNCOSD_WR_MPEG_REG_BITS(VPP_OSD_HSC_INI_PHASE, 0, 0, 16);
+
+		VSYNCOSD_WR_MPEG_REG_BITS(VPP_OSD_VSC_PHASE_STEP, vf_phase_step, 0, 28);
+		VSYNCOSD_WR_MPEG_REG(VPP_OSD_VSC_INI_PHASE, data32);
+	}
+	remove_from_update_list(OSD2, DISP_FREESCALE_ENABLE);
+}
+
+static void osd2_update_coef(void)
+{
+	int i;
+	bool need_update_coef = false;
+	int hf_coef_wren = 1;
+
+	int vf_coef_wren = 1;
+	int *hf_coef, *vf_coef;
+
+	if (osd_hw.scale_workaround) {
+		if (use_v_filter_mode != 3) {
+			use_v_filter_mode = 3;
+			need_update_coef = true;
+		} else
+			need_update_coef = false;
+	} else {
+		if (use_v_filter_mode != osd_v_filter_mode) {
+			use_v_filter_mode = osd_v_filter_mode;
+			need_update_coef = true;
+		} else
+			need_update_coef = false;
+	}
+
+	vf_coef = filter_table[use_v_filter_mode];
+
+	if (need_update_coef) {
+		if (vf_coef_wren) {
+			aml_set_reg32_bits(P_VPP_OSD_SCALE_COEF_IDX, 0x0000, 0, 9);
+			for (i = 0; i < 33; i++)
+				aml_write_reg32(P_VPP_OSD_SCALE_COEF, vf_coef[i]);
+		}
+	}
+
+	need_update_coef = false;
+	if (use_h_filter_mode != osd_h_filter_mode) {
+		use_h_filter_mode = osd_h_filter_mode;
+		need_update_coef = true;
+	}
+	hf_coef = filter_table[use_h_filter_mode];
+
+	if (need_update_coef) {
+		if (hf_coef_wren) {
+			aml_set_reg32_bits(P_VPP_OSD_SCALE_COEF_IDX, 0x0100, 0, 9);
+			for (i = 0; i < 33; i++)
+				aml_write_reg32(P_VPP_OSD_SCALE_COEF, hf_coef[i]);
+		}
+	}
+	remove_from_update_list(OSD2, OSD_FREESCALE_COEF);
+}
+
+static   void  osd1_update_color_mode(void)
+{
+	u32  data32 = 0;
+
+	if (osd_hw.color_info[OSD1] != NULL) {
+		data32 = (osd_hw.scan_mode == SCAN_MODE_INTERLACE) ? 2 : 0;
+		data32 |= VSYNCOSD_RD_MPEG_REG(VIU_OSD1_BLK0_CFG_W0) & 0x30007040;
+		data32 |= osd_hw.fb_gem[OSD1].canvas_idx << 16;
+
+		if (!osd_hw.rotate[OSD1].on_off)
+			data32 |= OSD_DATA_LITTLE_ENDIAN << 15;
+
+		data32 |= osd_hw.color_info[OSD1]->hw_colormat << 2;
+		if (osd_hw.color_info[OSD1]->color_index < COLOR_INDEX_YUV_422) {
+			data32 |= 1 << 7; /* rgb enable */
+		}
+		data32 |=  osd_hw.color_info[OSD1]->hw_blkmode << 8; /* osd_blk_mode */
+		VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W0, data32);
+		VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK1_CFG_W0, data32);
+		VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK2_CFG_W0, data32);
+		VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK3_CFG_W0, data32);
+		{
+			u32 idx = osd_hw.color_info[OSD1]->color_index;
+
+			if (idx >= COLOR_INDEX_32_BGRX && idx <= COLOR_INDEX_32_XRGB)
+			{
+				printk("OSD1 set XRGB idx=%d\n", idx);
+				/* This code works for get_cpu_type() >= MESON_CPU_MAJOR_GXBB !!!
+				 * What we have to do here for M201 board with S805 ?????????????
+				   VSYNCOSD_WR_MPEG_REG_BITS(VIU_OSD1_CTRL_STAT2, 0x1ff, 6, 9);
+				 */
+				VSYNCOSD_SET_MPEG_REG_MASK(VPP_MISC, 1<<9); /* enable OSD1 premultiplied alpha */
+			}
+			else
+			{
+				printk("OSD1 set ARGB idx=%d\n", idx);
+				/* This code works for get_cpu_type() >= MESON_CPU_MAJOR_GXBB !!!
+				 * What we have to do here for M201 board with S805 ?????????????
+				   VSYNCOSD_WR_MPEG_REG_BITS(VIU_OSD1_CTRL_STAT2, 0, 6, 9);
+				 */
+				VSYNCOSD_CLR_MPEG_REG_MASK(VPP_MISC, 1<<9); /* disable OSD1 premultiplied alpha */
+			}
+		}
+	}
+	remove_from_update_list(OSD1, OSD_COLOR_MODE);
+}
+static   void  osd2_update_color_mode(void)
+{
+	u32  data32 = 0;
+	if (osd_hw.color_info[OSD2] != NULL) {
+		data32 = (osd_hw.scan_mode == SCAN_MODE_INTERLACE) ? 2 : 0;
+		data32 |= VSYNCOSD_RD_MPEG_REG(VIU_OSD2_BLK0_CFG_W0) & 0x30007040;
+		data32 |= osd_hw.fb_gem[OSD2].canvas_idx << 16;
+
+		if (!osd_hw.rotate[OSD2].on_off)
+			data32 |= OSD_DATA_LITTLE_ENDIAN << 15;
+
+		data32 |= osd_hw.color_info[OSD2]->hw_colormat << 2;
+		if (osd_hw.color_info[OSD2]->color_index < COLOR_INDEX_YUV_422) {
+			data32 |= 1 << 7; /* rgb enable */
+		}
+		data32 |=  osd_hw.color_info[OSD2]->hw_blkmode << 8; /* osd_blk_mode */
+		VSYNCOSD_WR_MPEG_REG(VIU_OSD2_BLK0_CFG_W0, data32);
+		{
+			u32 idx = osd_hw.color_info[OSD2]->color_index;
+
+			if (idx >= COLOR_INDEX_32_BGRX && idx <= COLOR_INDEX_32_XRGB)
+			{
+				printk("OSD2 set XRGB idx=%d\n", idx);
+				/* This code works for get_cpu_type() >= MESON_CPU_MAJOR_GXBB !!!
+				 * What we have to do here for M201 board with S805 ?????????????
+				   VSYNCOSD_WR_MPEG_REG_BITS(VIU_OSD2_CTRL_STAT2, 0x1ff, 6, 9);
+				 */
+				VSYNCOSD_SET_MPEG_REG_MASK(VPP_MISC, 1<<8); /* enable OSD2 premultiplied alpha */
+			}
+			else
+			{
+				printk("OSD2 set ARGB idx=%d\n", idx);
+				/* This code works for get_cpu_type() >= MESON_CPU_MAJOR_GXBB !!!
+				 * What we have to do here for M201 board with S805 ?????????????
+				   VSYNCOSD_WR_MPEG_REG_BITS(VIU_OSD2_CTRL_STAT2, 0, 6, 9);
+				 */
+				VSYNCOSD_CLR_MPEG_REG_MASK(VPP_MISC, 1<<8); /* disable OSD2 premultiplied alpha */
+			}
+		}
+	}
+	remove_from_update_list(OSD2, OSD_COLOR_MODE);
+}
+
+static void osd1_update_enable(void)
+{
+	u32 video_enable = 0;
+
+	if (osd_hw.free_scale_mode[OSD1]) {
+		if (osd_hw.enable[OSD1] == ENABLE) {
+			VSYNCOSD_SET_MPEG_REG_MASK(VPP_MISC, VPP_OSD1_POSTBLEND | VPP_POSTBLEND_EN);
+			VSYNCOSD_SET_MPEG_REG_MASK(VIU_OSD1_CTRL_STAT, 1 << 21);
+		} else {
+			VSYNCOSD_CLR_MPEG_REG_MASK(VIU_OSD1_CTRL_STAT, 1 << 21);
+			VSYNCOSD_CLR_MPEG_REG_MASK(VPP_MISC, VPP_OSD1_POSTBLEND);
+		}
+	} else {
+		video_enable |= VSYNCOSD_RD_MPEG_REG(VPP_MISC)&VPP_VD1_PREBLEND;
+		if (osd_hw.enable[OSD1] == ENABLE) {
+			if (osd_hw.free_scale_enable[OSD1]) {
+				VSYNCOSD_CLR_MPEG_REG_MASK(VPP_MISC, VPP_OSD1_POSTBLEND);
+				VSYNCOSD_SET_MPEG_REG_MASK(VPP_MISC,
+							   VPP_OSD1_PREBLEND | VPP_VD1_POSTBLEND | VPP_PREBLEND_EN);
+			} else {
+				VSYNCOSD_CLR_MPEG_REG_MASK(VPP_MISC, VPP_OSD1_PREBLEND);
+				if (!video_enable)
+					VSYNCOSD_CLR_MPEG_REG_MASK(VPP_MISC, VPP_VD1_POSTBLEND);
+				VSYNCOSD_SET_MPEG_REG_MASK(VPP_MISC, VPP_OSD1_POSTBLEND);
+			}
+		} else {
+			if (osd_hw.free_scale_enable[OSD1])
+				VSYNCOSD_CLR_MPEG_REG_MASK(VPP_MISC, VPP_OSD1_PREBLEND);
+			else
+				VSYNCOSD_CLR_MPEG_REG_MASK(VPP_MISC, VPP_OSD1_POSTBLEND);
+		}
+	}
+	remove_from_update_list(OSD1, OSD_ENABLE);
+}
+
+static void osd2_update_enable(void)
+{
+	u32 video_enable = 0;
+
+	if (osd_hw.free_scale_mode[OSD2]) {
+		if (osd_hw.enable[OSD2] == ENABLE) {
+			if (osd_hw.free_scale_enable[OSD2]) {
+				VSYNCOSD_SET_MPEG_REG_MASK(VPP_MISC, VPP_OSD1_POSTBLEND | VPP_POSTBLEND_EN);
+				VSYNCOSD_SET_MPEG_REG_MASK(VIU_OSD2_CTRL_STAT, 1 << 21);
+			} else {
+				VSYNCOSD_CLR_MPEG_REG_MASK(VIU_OSD2_CTRL_STAT, 1 << 21);
+#ifndef CONFIG_FB_OSD2_CURSOR
+				VSYNCOSD_CLR_MPEG_REG_MASK(VPP_MISC, VPP_OSD1_POSTBLEND);
+#endif
+				VSYNCOSD_SET_MPEG_REG_MASK(VPP_MISC, VPP_OSD2_POSTBLEND | VPP_POSTBLEND_EN);
+			}
+		} else {
+			if (osd_hw.enable[OSD1] == ENABLE)
+				VSYNCOSD_CLR_MPEG_REG_MASK(VPP_MISC, VPP_OSD2_POSTBLEND);
+			else
+				VSYNCOSD_CLR_MPEG_REG_MASK(VPP_MISC, VPP_OSD1_POSTBLEND | VPP_OSD2_POSTBLEND);
+		}
+	} else {
+		video_enable |= VSYNCOSD_RD_MPEG_REG(VPP_MISC)&VPP_VD1_PREBLEND;
+		if (osd_hw.enable[OSD2] == ENABLE) {
+			if (osd_hw.free_scale_enable[OSD2]) {
+				VSYNCOSD_CLR_MPEG_REG_MASK(VPP_MISC, VPP_OSD2_POSTBLEND);
+				VSYNCOSD_SET_MPEG_REG_MASK(VPP_MISC, VPP_OSD2_PREBLEND | VPP_VD1_POSTBLEND);
+			} else {
+				VSYNCOSD_CLR_MPEG_REG_MASK(VPP_MISC, VPP_OSD2_PREBLEND);
+				if (!video_enable)
+					VSYNCOSD_CLR_MPEG_REG_MASK(VPP_MISC, VPP_VD1_POSTBLEND);
+				VSYNCOSD_SET_MPEG_REG_MASK(VPP_MISC, VPP_OSD2_POSTBLEND);
+			}
+		} else {
+			if (osd_hw.free_scale_enable[OSD2])
+				VSYNCOSD_CLR_MPEG_REG_MASK(VPP_MISC, VPP_OSD2_PREBLEND);
+			else
+				VSYNCOSD_CLR_MPEG_REG_MASK(VPP_MISC, VPP_OSD2_POSTBLEND);
+		}
+	}
+	remove_from_update_list(OSD2, OSD_ENABLE);
+}
+
+static void osd1_update_disp_osd_reverse(void)
+{
+	if (osd_hw.osd_reverse[OSD1])
+		VSYNCOSD_WR_MPEG_REG_BITS(VIU_OSD1_BLK0_CFG_W0, 3, 28, 2);
+	else
+		VSYNCOSD_CLR_MPEG_REG_MASK(VIU_OSD1_BLK0_CFG_W0, 3 << 28);
+	remove_from_update_list(OSD1, DISP_OSD_REVERSE);
+}
+
+static void osd2_update_disp_osd_reverse(void)
+{
+	if (osd_hw.osd_reverse[OSD2])
+		VSYNCOSD_WR_MPEG_REG_BITS(VIU_OSD2_BLK0_CFG_W0, 3, 28, 2);
+	else
+		VSYNCOSD_CLR_MPEG_REG_MASK(VIU_OSD2_BLK0_CFG_W0, 3 << 28);
+	remove_from_update_list(OSD2, DISP_OSD_REVERSE);
+}
+static void osd1_update_disp_osd_rotate(void)
+{
+	unsigned char 	x_rev = 0, y_rev = 0;
+	unsigned char 	bpp = 32;
+	unsigned int	x_start;
+	unsigned int	x_end;
+	unsigned int	y_start;
+	unsigned int	y_end;
+	unsigned int	y_len_m1;
+
+	if (osd_hw.color_info[OSD1]->color_index <= COLOR_INDEX_08_PAL256)
+		bpp = 8;
+	else if (osd_hw.color_info[OSD1]->color_index <= COLOR_INDEX_16_565)
+		bpp = 16;
+	else if (osd_hw.color_info[OSD1]->color_index <= COLOR_INDEX_24_RGB)
+		bpp = 24;
+	else if (osd_hw.color_info[OSD1]->color_index <= COLOR_INDEX_32_ARGB)
+		bpp = 32;
+
+	switch (osd_hw.rotate[OSD1].angle) {
+	case 0://clockwise H flip (dst )
+		x_rev = 0;
+		y_rev = 0;
+		break;//clockwise
+	case 1:
+		y_rev = 1;
+		break;
+	case 2://anti-clockwise
+		x_rev = 1;
+		break;
+	case 3://anti-clockwise H flip(dst)
+		x_rev = 1;
+		y_rev = 1;
+		break;
+	}
+
+	x_start = osd_hw.rotation_pandata[OSD1].x_start;
+	x_end = osd_hw.rotation_pandata[OSD1].x_end;
+	y_start = osd_hw.rotation_pandata[OSD1].y_start;
+	y_end = osd_hw.rotation_pandata[OSD1].y_end;
+	y_len_m1 = y_end - y_start;
+
+#if (MESON_CPU_TYPE == MESON_CPU_TYPE_MESON8)
+	{
+		if (IS_MESON_M8_CPU) {
+			osd_set_prot(
+				x_rev,
+				y_rev,
+				(bpp >> 3) - 1,				//unsigned char   bytes_per_pixel,
+				0,				//unsigned char   conv_422to444,
+				OSD_DATA_LITTLE_ENDIAN,		//unsigned char   little_endian,
+				HOLD_LINES,			//unsigned int    hold_lines,
+				x_start,
+				x_end,
+				y_start,
+				y_end,
+				y_len_m1,
+				Y_STEP,
+				PAT_START_PTR,
+				PAT_END_PTR,
+				PAT_VAL,
+				osd_hw.fb_gem[OSD1].canvas_idx,
+				CID_VALUE,
+				CID_MODE,
+				CUGT,				//urgent bit
+				REQ_ONOFF_EN,
+				REQ_ON_MAX,
+				REQ_OFF_MIN,
+				OSD1,
+				osd_hw.rotate[OSD1].on_off);
+		}
+	}
+#endif
+	remove_from_update_list(OSD1, DISP_OSD_ROTATE);
+}
+static void osd2_update_disp_osd_rotate(void)
+{
+	unsigned char 	x_rev = 0, y_rev = 0;
+	unsigned char 	bpp = 32;
+	unsigned int	x_start;
+	unsigned int	x_end;
+	unsigned int	y_start;
+	unsigned int	y_end;
+	unsigned int	y_len_m1;
+
+	if (osd_hw.color_info[OSD2]->color_index <= COLOR_INDEX_08_PAL256)
+		bpp = 8;
+	else if (osd_hw.color_info[OSD2]->color_index <= COLOR_INDEX_16_565)
+		bpp = 16;
+	else if (osd_hw.color_info[OSD2]->color_index <= COLOR_INDEX_24_RGB)
+		bpp = 24;
+	else if (osd_hw.color_info[OSD2]->color_index <= COLOR_INDEX_32_ARGB)
+		bpp = 32;
+	switch (osd_hw.rotate[OSD2].angle) {
+	case 0://clockwise H flip (dst )
+		x_rev = 0;
+		y_rev = 0;
+		break;//clockwise
+	case 1:
+		y_rev = 1;
+		break;
+	case 2://anti-clockwise
+		x_rev = 1;
+		break;
+	case 3://anti-clockwise H flip(dst)
+		x_rev = 1;
+		y_rev = 1;
+		break;
+	}
+
+	x_start = osd_hw.rotation_pandata[OSD2].x_start;
+	x_end = osd_hw.rotation_pandata[OSD2].x_end;
+	y_start = osd_hw.rotation_pandata[OSD2].y_start;
+	y_end = osd_hw.rotation_pandata[OSD2].y_end;
+	y_len_m1 = y_end - y_start;
+
+#if (MESON_CPU_TYPE == MESON_CPU_TYPE_MESON8)
+	{
+		if (IS_MESON_M8_CPU) {
+			osd_set_prot(
+				x_rev,
+				y_rev,
+				(bpp >> 3) - 1,				//unsigned char   bytes_per_pixel,
+				0,				//unsigned char   conv_422to444,
+				OSD_DATA_LITTLE_ENDIAN,		//unsigned char   little_endian,
+				HOLD_LINES,			//unsigned int    hold_lines,
+				x_start,
+				x_end,
+				y_start,
+				y_end,
+				y_len_m1,
+				Y_STEP,
+				PAT_START_PTR,
+				PAT_END_PTR,
+				PAT_VAL,
+				osd_hw.fb_gem[OSD2].canvas_idx,
+				CID_VALUE,
+				CID_MODE,
+				CUGT,				//urgent bit
+				REQ_ONOFF_EN,
+				REQ_ON_MAX,
+				REQ_OFF_MIN,
+				OSD2,
+				osd_hw.rotate[OSD2].on_off);
+		}
+	}
+#endif
+	remove_from_update_list(OSD2, DISP_OSD_ROTATE);
+}
+
+
+static  void  osd1_update_color_key(void)
+{
+	VSYNCOSD_WR_MPEG_REG(VIU_OSD1_TCOLOR_AG0, osd_hw.color_key[OSD1]);
+	remove_from_update_list(OSD1, OSD_COLOR_KEY);
+}
+static   void  osd2_update_color_key(void)
+{
+	VSYNCOSD_WR_MPEG_REG(VIU_OSD2_TCOLOR_AG0, osd_hw.color_key[OSD2]);
+	remove_from_update_list(OSD2, OSD_COLOR_KEY);
+}
+static  void  osd1_update_color_key_enable(void)
+{
+	u32  data32;
+	data32 = VSYNCOSD_RD_MPEG_REG(VIU_OSD1_BLK0_CFG_W0);
+	data32 &= ~(1 << 6);
+	data32 |= (osd_hw.color_key_enable[OSD1] << 6);
+	VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W0, data32);
+	VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK1_CFG_W0, data32);
+	VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK2_CFG_W0, data32);
+	VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK3_CFG_W0, data32);
+	remove_from_update_list(OSD1, OSD_COLOR_KEY_ENABLE);
+}
+static  void  osd2_update_color_key_enable(void)
+{
+	u32  data32;
+	data32 = VSYNCOSD_RD_MPEG_REG(VIU_OSD2_BLK0_CFG_W0);
+	data32 &= ~(1 << 6);
+	data32 |= (osd_hw.color_key_enable[OSD2] << 6);
+	VSYNCOSD_WR_MPEG_REG(VIU_OSD2_BLK0_CFG_W0, data32);
+	remove_from_update_list(OSD2, OSD_COLOR_KEY_ENABLE);
+}
+static   void  osd1_update_gbl_alpha(void)
+{
+	u32  data32;
+
+	data32 = VSYNCOSD_RD_MPEG_REG(VIU_OSD1_CTRL_STAT);
+	data32 &= ~(0x1ff << 12);
+	data32 |= osd_hw.gbl_alpha[OSD1] << 12;
+	VSYNCOSD_WR_MPEG_REG(VIU_OSD1_CTRL_STAT, data32);
+	/* VSYNCOSD_SET_MPEG_REG_MASK(VPP_MISC, 1<<9); */ /* enable OSD1 premultiplied alpha */
+	remove_from_update_list(OSD1, OSD_GBL_ALPHA);
+}
+static   void  osd2_update_gbl_alpha(void)
+{
+	u32  data32;
+
+	data32 = VSYNCOSD_RD_MPEG_REG(VIU_OSD2_CTRL_STAT);
+	data32 &= ~(0x1ff << 12);
+	data32 |= osd_hw.gbl_alpha[OSD2] << 12;
+	VSYNCOSD_WR_MPEG_REG(VIU_OSD2_CTRL_STAT, data32);
+	/* VSYNCOSD_SET_MPEG_REG_MASK(VPP_MISC, 1<<8); */ /* enable OSD2 premultiplied alpha */
+	remove_from_update_list(OSD2, OSD_GBL_ALPHA);
+}
+static   void  osd2_update_order(void)
+{
+	unsigned long flags;
+	spin_lock_irqsave(&osd_onoff_lock, flags);
+	switch (osd_hw.osd_order) {
+	case  OSD_ORDER_01:
+		aml_clr_reg32_mask(P_VPP_MISC, VPP_POST_FG_OSD2 | VPP_PRE_FG_OSD2);
+		break;
+	case  OSD_ORDER_10:
+		aml_clr_reg32_mask(P_VPP_MISC, VPP_POST_FG_OSD2 | VPP_PRE_FG_OSD2);
+		break;
+	default:
+		break;
+	}
+	spin_unlock_irqrestore(&osd_onoff_lock, flags);
+	remove_from_update_list(OSD2, OSD_CHANGE_ORDER);
+}
+static   void  osd1_update_order(void)
+{
+	unsigned long flags;
+	spin_lock_irqsave(&osd_onoff_lock, flags);
+	switch (osd_hw.osd_order) {
+	case  OSD_ORDER_01:
+		aml_clr_reg32_mask(P_VPP_MISC, VPP_POST_FG_OSD2 | VPP_PRE_FG_OSD2);
+		break;
+	case  OSD_ORDER_10:
+		aml_clr_reg32_mask(P_VPP_MISC, VPP_POST_FG_OSD2 | VPP_PRE_FG_OSD2);
+		break;
+	default:
+		break;
+	}
+	spin_unlock_irqrestore(&osd_onoff_lock, flags);
+	remove_from_update_list(OSD1, OSD_CHANGE_ORDER);
+}
+
+static void osd_block_update_disp_geometry(u32 index)
+{
+	u32 data32;
+	u32 data_w1, data_w2, data_w3, data_w4;
+	u32 coef[4][2] = {{0, 0}, {1, 0}, {0, 1}, {1, 1}};
+	u32 xoff, yoff;
+	u32 i;
+
+	switch (osd_hw.block_mode[index] & HW_OSD_BLOCK_LAYOUT_MASK) {
+	case HW_OSD_BLOCK_LAYOUT_HORIZONTAL:
+		yoff = ((osd_hw.pandata[index].y_end & 0x1fff) - (osd_hw.pandata[index].y_start
+				& 0x1fff) + 1) >> 2;
+		data_w1 = (osd_hw.pandata[index].x_start & 0x1fff) |
+			  (osd_hw.pandata[index].x_end & 0x1fff) << 16 ;
+		data_w3 = (osd_hw.dispdata[index].x_start & 0xfff) |
+			  (osd_hw.dispdata[index].x_end & 0xfff) << 16;
+		for (i = 0; i < 4; i++) {
+			if (i == 3) {
+				data_w2 = ((osd_hw.pandata[index].y_start + yoff * i) & 0x1fff)
+					  | (osd_hw.pandata[index].y_end & 0x1fff) << 16;
+				data_w4 = ((osd_hw.dispdata[index].y_start + yoff * i) & 0xfff)
+					  | (osd_hw.dispdata[index].y_end & 0xfff) << 16;
+			} else {
+				data_w2 = ((osd_hw.pandata[index].y_start + yoff * i) & 0x1fff)
+					  | ((osd_hw.pandata[index].y_start + yoff * (i + 1) - 1) & 0x1fff) << 16;
+				data_w4 = ((osd_hw.dispdata[index].y_start + yoff * i) & 0xfff)
+					  | ((osd_hw.dispdata[index].y_start + yoff * (i + 1) - 1) & 0xfff) << 16;
+			}
+			if (osd_hw.scan_mode == SCAN_MODE_INTERLACE) {
+				data32 = data_w4;
+				data_w4 = ((data32 & 0xfff) >> 1) | ((((((data32 >> 16) & 0xfff) + 1) >> 1) - 1)
+								     << 16);
+			}
+
+			VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W1 + (i << 4), data_w1);
+			VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W2 + (i << 4), data_w2);
+			VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W3 + (i << 4), data_w3);
+			VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W4 + (i << 2), data_w4);
+
+			osd_hw.block_windows[index][i << 1] = data_w1;
+			osd_hw.block_windows[index][(i << 1) + 1] = data_w2;
+		}
+		break;
+	case HW_OSD_BLOCK_LAYOUT_VERTICAL:
+		xoff = ((osd_hw.pandata[index].x_end & 0x1fff) - (osd_hw.pandata[index].x_start
+				& 0x1fff) + 1) >> 2;
+		data_w2 = (osd_hw.pandata[index].y_start & 0x1fff) |
+			  (osd_hw.pandata[index].y_end & 0x1fff) << 16 ;
+		data_w4 = (osd_hw.dispdata[index].y_start & 0xfff) |
+			  (osd_hw.dispdata[index].y_end & 0xfff) << 16;
+		if (osd_hw.scan_mode == SCAN_MODE_INTERLACE) {
+			data32 = data_w4;
+			data_w4 = ((data32 & 0xfff) >> 1) | ((((((data32 >> 16) & 0xfff) + 1) >> 1) - 1)
+							     << 16);
+		}
+		for (i = 0; i < 4; i++) {
+			data_w1 = ((osd_hw.pandata[index].x_start  + xoff * i) & 0x1fff)
+				  | ((osd_hw.pandata[index].x_start + xoff * (i + 1) - 1) & 0x1fff) << 16;
+			data_w3 = ((osd_hw.dispdata[index].x_start + xoff * i) & 0xfff)
+				  | ((osd_hw.dispdata[index].x_start + xoff * (i + 1) - 1) & 0xfff) << 16;
+
+			VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W1 + (i << 4), data_w1);
+			VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W2 + (i << 4), data_w2);
+			VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W3 + (i << 4), data_w3);
+			VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W4 + (i << 2), data_w4);
+
+			osd_hw.block_windows[index][i << 1] = data_w1;
+			osd_hw.block_windows[index][(i << 1) + 1] = data_w2;
+		}
+		break;
+	case HW_OSD_BLOCK_LAYOUT_GRID:
+		xoff = ((osd_hw.pandata[index].x_end & 0x1fff) - (osd_hw.pandata[index].x_start
+				& 0x1fff) + 1) >> 1;
+		yoff = ((osd_hw.pandata[index].y_end & 0x1fff) - (osd_hw.pandata[index].y_start
+				& 0x1fff) + 1) >> 1;
+		for (i = 0; i < 4; i++) {
+			data_w1 = ((osd_hw.pandata[index].x_start + xoff * coef[i][0]) & 0x1fff)
+				  | ((osd_hw.pandata[index].x_start + xoff * (coef[i][0] + 1) - 1) & 0x1fff) <<
+				  16;
+			data_w2 = ((osd_hw.pandata[index].y_start + yoff * coef[i][1]) & 0x1fff)
+				  | ((osd_hw.pandata[index].y_start + yoff * (coef[i][1] + 1) - 1) & 0x1fff) <<
+				  16;
+			data_w3 = ((osd_hw.dispdata[index].x_start + xoff * coef[i][0]) & 0xfff)
+				  | ((osd_hw.dispdata[index].x_start + xoff * (coef[i][0] + 1) - 1) & 0xfff) <<
+				  16;
+			data_w4 = ((osd_hw.dispdata[index].y_start + yoff * coef[i][1]) & 0xfff)
+				  | ((osd_hw.dispdata[index].y_start + yoff * (coef[i][1] + 1) - 1) & 0xfff) <<
+				  16;
+
+			if (osd_hw.scan_mode == SCAN_MODE_INTERLACE) {
+				data32 = data_w4;
+				data_w4 = ((data32 & 0xfff) >> 1) | ((((((data32 >> 16) & 0xfff) + 1) >> 1) - 1)
+								     << 16);
+			}
+			VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W1 + (i << 4), data_w1);
+			VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W2 + (i << 4), data_w2);
+			VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W3 + (i << 4), data_w3);
+			VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W4 + (i << 2), data_w4);
+
+			osd_hw.block_windows[index][i << 1] = data_w1;
+			osd_hw.block_windows[index][(i << 1) + 1] = data_w2;
+		}
+		break;
+	case HW_OSD_BLOCK_LAYOUT_CUSTOMER:
+		for (i = 0; i < 4; i++) {
+			if (((osd_hw.block_windows[index][i << 1] >> 16) & 0x1fff) >
+			    osd_hw.pandata[index].x_end) {
+				osd_hw.block_windows[index][i << 1] = (osd_hw.block_windows[index][i << 1] &
+								       0x1fff)
+								      | ((osd_hw.pandata[index].x_end & 0x1fff) << 16);
+			}
+			data_w1 = osd_hw.block_windows[index][i << 1] & 0x1fff1fff;
+			data_w2 = ((osd_hw.pandata[index].y_start & 0x1fff) +
+				   (osd_hw.block_windows[index][(i << 1) + 1] & 0x1fff))
+				  | (((osd_hw.pandata[index].y_start & 0x1fff) << 16) +
+				     (osd_hw.block_windows[index][(i << 1) + 1] & 0x1fff0000));
+			data_w3 = (osd_hw.dispdata[index].x_start + (data_w1 & 0xfff))
+				  | (((osd_hw.dispdata[index].x_start & 0xfff) << 16) + (data_w1 & 0xfff0000));
+			data_w4 = (osd_hw.dispdata[index].y_start + (osd_hw.block_windows[index][(i <<
+					1) + 1] & 0xfff))
+				  | (((osd_hw.dispdata[index].y_start & 0xfff) << 16) +
+				     (osd_hw.block_windows[index][(i << 1) + 1] & 0xfff0000));
+			if (osd_hw.scan_mode == SCAN_MODE_INTERLACE) {
+				data32 = data_w4;
+				data_w4 = ((data32 & 0xfff) >> 1) | ((((((data32 >> 16) & 0xfff) + 1) >> 1) - 1)
+								     << 16);
+			}
+			VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W1 + (i << 4), data_w1);
+			VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W2 + (i << 4), data_w2);
+			VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W3 + (i << 4), data_w3);
+			VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W4 + (i << 2), data_w4);
+		}
+		break;
+
+	default:
+		amlog_level(LOG_LEVEL_HIGH, "ERROR block_mode: 0x%x\n",
+			    osd_hw.block_mode[index]);
+		break;
+	}
+}
+
+static void osd1_update_disp_geometry(void)
+{
+	u32 data32;
+	/* enable osd multi block */
+	if (osd_hw.block_mode[OSD1]) {
+		osd_block_update_disp_geometry(OSD1);
+		data32 = VSYNCOSD_RD_MPEG_REG(VIU_OSD1_CTRL_STAT);
+		data32 &= 0xfffffff0;
+		data32 |= (osd_hw.block_mode[OSD1] & HW_OSD_BLOCK_ENABLE_MASK);
+		VSYNCOSD_WR_MPEG_REG(VIU_OSD1_CTRL_STAT, data32);
+	} else {
+#if (MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON8)
+		data32 = (osd_hw.dispdata[OSD1].x_start & 0xfff) | (osd_hw.dispdata[OSD1].x_end
+				& 0xfff) << 16 ;
+		VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W3 , data32);
+		if (osd_hw.scan_mode == SCAN_MODE_INTERLACE)
+			data32 = ((osd_hw.dispdata[OSD1].y_start >> 1) & 0xfff) | ((((
+						osd_hw.dispdata[OSD1].y_end + 1) >> 1) - 1) & 0xfff) << 16 ;
+		else
+			data32 = (osd_hw.dispdata[OSD1].y_start & 0xfff) | (osd_hw.dispdata[OSD1].y_end
+					& 0xfff) << 16 ;
+		VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W4, data32);
+#else
+		if (osd_hw.free_scale_mode[OSD1] == 0) {
+			if (osd_hw.free_scale_enable[OSD1] == 1) {
+				data32 = (osd_hw.free_scale_data[OSD1].x_start & 0xfff) |
+					 (osd_hw.free_scale_data[OSD1].x_end & 0xfff) << 16 ;
+				VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W3 , data32);
+				data32 = (osd_hw.free_scale_data[OSD1].y_start & 0xfff) |
+					 (osd_hw.free_scale_data[OSD1].y_end & 0xfff) << 16 ;
+				VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W4, data32);
+			} else {
+				data32 = (osd_hw.dispdata[OSD1].x_start & 0xfff) | (osd_hw.dispdata[OSD1].x_end
+						& 0xfff) << 16 ;
+				VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W3 , data32);
+				if (osd_hw.scan_mode == SCAN_MODE_INTERLACE)
+					data32 = ((osd_hw.dispdata[OSD1].y_start >> 1) & 0xfff) | ((((
+								osd_hw.dispdata[OSD1].y_end + 1) >> 1) - 1) & 0xfff) << 16 ;
+				else
+					data32 = (osd_hw.dispdata[OSD1].y_start & 0xfff) | (osd_hw.dispdata[OSD1].y_end
+							& 0xfff) << 16 ;
+				VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W4, data32);
+			}
+		} else {
+			data32 = (osd_hw.dispdata[OSD1].x_start & 0xfff) | (osd_hw.dispdata[OSD1].x_end
+					& 0xfff) << 16 ;
+			VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W3 , data32);
+			if (osd_hw.scan_mode == SCAN_MODE_INTERLACE)
+				data32 = ((osd_hw.dispdata[OSD1].y_start >> 1) & 0xfff) | ((((
+							osd_hw.dispdata[OSD1].y_end + 1) >> 1) - 1) & 0xfff) << 16 ;
+			else
+				data32 = (osd_hw.dispdata[OSD1].y_start & 0xfff) | (osd_hw.dispdata[OSD1].y_end
+						& 0xfff) << 16 ;
+			VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W4, data32);
+		}
+#endif
+		/* enable osd 2x scale */
+		if (osd_hw.scale[OSD1].h_enable || osd_hw.scale[OSD1].v_enable) {
+			data32 = (osd_hw.scaledata[OSD1].x_start & 0x1fff) |
+				 (osd_hw.scaledata[OSD1].x_end & 0x1fff) << 16;
+			VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W1, data32);
+			data32 = ((osd_hw.scaledata[OSD1].y_start + osd_hw.pandata[OSD1].y_start) &
+				  0x1fff)
+				 | ((osd_hw.scaledata[OSD1].y_end  + osd_hw.pandata[OSD1].y_start) & 0x1fff) <<
+				 16 ;
+			VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W2, data32);
+			/* adjust display x-axis */
+			if (osd_hw.scale[OSD1].h_enable) {
+				data32 = (osd_hw.dispdata[OSD1].x_start & 0xfff)
+					 | ((osd_hw.dispdata[OSD1].x_start + (osd_hw.scaledata[OSD1].x_end -
+							 osd_hw.scaledata[OSD1].x_start) * 2 + 1) & 0xfff) << 16 ;
+				VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W3 , data32);
+				if (osd_hw.scan_mode == SCAN_MODE_INTERLACE) {
+					data32 = ((osd_hw.dispdata[OSD1].y_start >> 1) & 0xfff)
+						 | (((((osd_hw.dispdata[OSD1].y_start + (osd_hw.scaledata[OSD1].y_end -
+								 osd_hw.scaledata[OSD1].y_start) * 2) + 1) >> 1) - 1) & 0xfff) << 16 ;
+				} else {
+					data32 = (osd_hw.dispdata[OSD1].y_start & 0xfff)
+						 | (((osd_hw.dispdata[OSD1].y_start  + (osd_hw.scaledata[OSD1].y_end -
+								 osd_hw.scaledata[OSD1].y_start) * 2)) & 0xfff) << 16 ;
+				}
+				VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W4, data32);
+			}
+
+			/* adjust display y-axis */
+			if (osd_hw.scale[OSD1].v_enable) {
+				data32 = (osd_hw.dispdata[OSD1].x_start & 0xfff)
+					 | ((osd_hw.dispdata[OSD1].x_start + (osd_hw.scaledata[OSD1].x_end -
+							 osd_hw.scaledata[OSD1].x_start) * 2 + 1) & 0xfff) << 16 ;
+				VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W3 , data32);
+				if (osd_hw.scan_mode == SCAN_MODE_INTERLACE) {
+					data32 = ((osd_hw.dispdata[OSD1].y_start >> 1) & 0xfff)
+						 | (((((osd_hw.dispdata[OSD1].y_start + (osd_hw.scaledata[OSD1].y_end -
+								 osd_hw.scaledata[OSD1].y_start) * 2) + 1) >> 1) - 1) & 0xfff) << 16 ;
+				} else {
+					data32 = (osd_hw.dispdata[OSD1].y_start & 0xfff)
+						 | (((osd_hw.dispdata[OSD1].y_start  + (osd_hw.scaledata[OSD1].y_end -
+								 osd_hw.scaledata[OSD1].y_start) * 2)) & 0xfff) << 16 ;
+				}
+				VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W4, data32);
+			}
+		} else if (osd_hw.free_scale_enable[OSD1]
+			   && (osd_hw.free_scale_data[OSD1].x_end > 0)
+			   && (osd_hw.free_scale_data[OSD1].y_end > 0)
+			   && (!osd_hw.rotate[OSD1].on_off)) {
+			/* enable osd free scale */
+			data32 = (osd_hw.free_scale_data[OSD1].x_start & 0x1fff) |
+				 (osd_hw.free_scale_data[OSD1].x_end & 0x1fff) << 16;
+			VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W1, data32);
+			data32 = ((osd_hw.free_scale_data[OSD1].y_start + osd_hw.pandata[OSD1].y_start)
+				  & 0x1fff)
+				 | ((osd_hw.free_scale_data[OSD1].y_end  + osd_hw.pandata[OSD1].y_start) &
+				    0x1fff) << 16;
+			VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W2, data32);
+		} else if (osd_hw.free_scale_enable[OSD1]
+			   && (osd_hw.free_scale_data[OSD1].x_end > 0)
+			   && (osd_hw.free_scale_data[OSD1].y_end > 0)
+			   && (osd_hw.rotate[OSD1].on_off
+			       && osd_hw.rotate[OSD1].angle > 0)) {
+			data32 = (osd_hw.rotation_pandata[OSD1].x_start & 0x1fff) |
+				 (osd_hw.rotation_pandata[OSD1].x_end & 0x1fff) << 16;
+			VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W1, data32);
+			data32 = ((osd_hw.rotation_pandata[OSD1].y_start + osd_hw.pandata[OSD1].y_start)
+				  & 0x1fff)
+				 | ((osd_hw.rotation_pandata[OSD1].y_end  + osd_hw.pandata[OSD1].y_start) &
+				    0x1fff) << 16 ;
+			VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W2, data32);
+#if (MESON_CPU_TYPE == MESON_CPU_TYPE_MESON8)
+			{
+				if (IS_MESON_M8_CPU)
+					VSYNCOSD_WR_MPEG_REG(VPU_PROT1_Y_START_END, data32);
+			}
+#endif
+		} else if (osd_hw.rotate[OSD1].on_off
+			   && osd_hw.rotate[OSD1].angle > 0) {
+			/* enable osd rotation */
+			data32 = (osd_hw.rotation_pandata[OSD1].x_start & 0x1fff) |
+				 (osd_hw.rotation_pandata[OSD1].x_end & 0x1fff) << 16;
+			VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W1, data32);
+			data32 = ((osd_hw.rotation_pandata[OSD1].y_start + osd_hw.pandata[OSD1].y_start)
+				  & 0x1fff)
+				 | ((osd_hw.rotation_pandata[OSD1].y_end  + osd_hw.pandata[OSD1].y_start) &
+				    0x1fff) << 16 ;
+			VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W2, data32);
+#if (MESON_CPU_TYPE == MESON_CPU_TYPE_MESON8)
+			{
+				if (IS_MESON_M8_CPU)
+					VSYNCOSD_WR_MPEG_REG(VPU_PROT1_Y_START_END, data32);
+			}
+#endif
+		} else {
+			/* normal mode */
+			data32 = (osd_hw.pandata[OSD1].x_start & 0x1fff) | (osd_hw.pandata[OSD1].x_end &
+					0x1fff) << 16;
+			VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W1, data32);
+			data32 = (osd_hw.pandata[OSD1].y_start & 0x1fff) | (osd_hw.pandata[OSD1].y_end &
+					0x1fff) << 16 ;
+			VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W2, data32);
+		}
+
+		data32 = aml_read_reg32(P_VIU_OSD1_CTRL_STAT);
+		data32 &= 0xfffffff0;
+		data32 |= HW_OSD_BLOCK_ENABLE_0;
+		aml_write_reg32(P_VIU_OSD1_CTRL_STAT, data32);
+	}
+
+	remove_from_update_list(OSD1, DISP_GEOMETRY);
+}
+
+static   void  osd2_update_disp_geometry(void)
+{
+	u32 data32;
+	data32 = (osd_hw.dispdata[OSD2].x_start & 0xfff) | (osd_hw.dispdata[OSD2].x_end
+			& 0xfff) << 16 ;
+	VSYNCOSD_WR_MPEG_REG(VIU_OSD2_BLK0_CFG_W3 , data32);
+	if (osd_hw.scan_mode == SCAN_MODE_INTERLACE)
+		data32 = ((osd_hw.dispdata[OSD2].y_start >> 1) & 0xfff) | ((((
+					osd_hw.dispdata[OSD2].y_end + 1) >> 1) - 1) & 0xfff) << 16 ;
+	else
+		data32 = (osd_hw.dispdata[OSD2].y_start & 0xfff) | (osd_hw.dispdata[OSD2].y_end
+				& 0xfff) << 16 ;
+	VSYNCOSD_WR_MPEG_REG(VIU_OSD2_BLK0_CFG_W4, data32);
+
+	if (osd_hw.scale[OSD2].h_enable || osd_hw.scale[OSD2].v_enable) {
+#if defined(CONFIG_FB_OSD2_CURSOR)
+		data32 = (osd_hw.pandata[OSD2].x_start & 0x1fff) | (osd_hw.pandata[OSD2].x_end &
+				0x1fff) << 16;
+		VSYNCOSD_WR_MPEG_REG(VIU_OSD2_BLK0_CFG_W1, data32);
+		data32 = (osd_hw.pandata[OSD2].y_start & 0x1fff) | (osd_hw.pandata[OSD2].y_end &
+				0x1fff) << 16 ;
+		VSYNCOSD_WR_MPEG_REG(VIU_OSD2_BLK0_CFG_W2, data32);
+#else
+		data32 = (osd_hw.scaledata[OSD2].x_start & 0x1fff) |
+			 (osd_hw.scaledata[OSD2].x_end & 0x1fff) << 16;
+		VSYNCOSD_WR_MPEG_REG(VIU_OSD2_BLK0_CFG_W1, data32);
+		data32 = ((osd_hw.scaledata[OSD2].y_start + osd_hw.pandata[OSD2].y_start) &
+			  0x1fff)
+			 | ((osd_hw.scaledata[OSD2].y_end  + osd_hw.pandata[OSD2].y_start) & 0x1fff) <<
+			 16 ;
+		VSYNCOSD_WR_MPEG_REG(VIU_OSD2_BLK0_CFG_W2, data32);
+#endif
+	} else if (osd_hw.free_scale_enable[OSD2]
+		   && (osd_hw.free_scale_data[OSD2].x_end > 0)
+		   && (osd_hw.free_scale_data[OSD2].y_end > 0)) {
+		/* enable osd free scale */
+		data32 = (osd_hw.free_scale_data[OSD2].x_start & 0x1fff) |
+			 (osd_hw.free_scale_data[OSD2].x_end & 0x1fff) << 16;
+		VSYNCOSD_WR_MPEG_REG(VIU_OSD2_BLK0_CFG_W1, data32);
+		data32 = ((osd_hw.free_scale_data[OSD2].y_start + osd_hw.pandata[OSD2].y_start)
+			  & 0x1fff)
+			 | ((osd_hw.free_scale_data[OSD2].y_end  + osd_hw.pandata[OSD2].y_start) &
+			    0x1fff) << 16 ;
+		VSYNCOSD_WR_MPEG_REG(VIU_OSD2_BLK0_CFG_W2, data32);
+	} else {
+		data32 = (osd_hw.pandata[OSD2].x_start & 0x1fff) | (osd_hw.pandata[OSD2].x_end &
+				0x1fff) << 16;
+		VSYNCOSD_WR_MPEG_REG(VIU_OSD2_BLK0_CFG_W1, data32);
+		data32 = (osd_hw.pandata[OSD2].y_start & 0x1fff) | (osd_hw.pandata[OSD2].y_end &
+				0x1fff) << 16 ;
+		VSYNCOSD_WR_MPEG_REG(VIU_OSD2_BLK0_CFG_W2, data32);
+	}
+	remove_from_update_list(OSD2, DISP_GEOMETRY);
+}
+static  void  osd1_update_disp_3d_mode(void)
+{
+	/*step 1 . set pan data */
+	u32  data32;
+
+	if (osd_hw.mode_3d[OSD1].left_right == LEFT) {
+		data32 = (osd_hw.mode_3d[OSD1].l_start & 0x1fff) | (osd_hw.mode_3d[OSD1].l_end &
+				0x1fff) << 16;
+		VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W1, data32);
+	} else {
+		data32 = (osd_hw.mode_3d[OSD1].r_start & 0x1fff) | (osd_hw.mode_3d[OSD1].r_end &
+				0x1fff) << 16;
+		VSYNCOSD_WR_MPEG_REG(VIU_OSD1_BLK0_CFG_W1, data32);
+	}
+	osd_hw.mode_3d[OSD1].left_right ^= 1;
+}
+static  void  osd2_update_disp_3d_mode(void)
+{
+	u32  data32;
+
+	if (osd_hw.mode_3d[OSD2].left_right == LEFT) {
+		data32 = (osd_hw.mode_3d[OSD2].l_start & 0x1fff) | (osd_hw.mode_3d[OSD2].l_end &
+				0x1fff) << 16;
+		VSYNCOSD_WR_MPEG_REG(VIU_OSD2_BLK0_CFG_W1, data32);
+	} else {
+		data32 = (osd_hw.mode_3d[OSD2].r_start & 0x1fff) | (osd_hw.mode_3d[OSD2].r_end &
+				0x1fff) << 16;
+		VSYNCOSD_WR_MPEG_REG(VIU_OSD2_BLK0_CFG_W1, data32);
+	}
+	osd_hw.mode_3d[OSD2].left_right ^= 1;
+}
+
+#if MESON_CPU_TYPE < MESON_CPU_TYPE_MESON8
+void osd_init_scan_mode(void)
+{
+#define  	VOUT_ENCI	1
+#define   	VOUT_ENCP	2
+#define	VOUT_ENCT	3
+	unsigned  char output_type = 0;
+	output_type = aml_read_reg32(P_VPU_VIU_VENC_MUX_CTRL) & 0x3;
+	osd_hw.scan_mode = SCAN_MODE_PROGRESSIVE;
+	switch (output_type) {
+	case VOUT_ENCP:
+		if (aml_read_reg32(P_ENCP_VIDEO_MODE) & (1 << 12)) //1080i
+			osd_hw.scan_mode = SCAN_MODE_INTERLACE;
+		break;
+	case VOUT_ENCI:
+		if (aml_read_reg32(P_ENCI_VIDEO_EN) & 1)
+			osd_hw.scan_mode = SCAN_MODE_INTERLACE;
+		break;
+	}
+}
+#endif
+
+void osd_init_hw(u32  logo_loaded)
+{
+	u32 group, idx, data32;
+
+	for (group = 0; group < HW_OSD_COUNT; group++)
+		for (idx = 0; idx < HW_REG_INDEX_MAX; idx++)
+			osd_hw.reg[group][idx].update_func = hw_func_array[group][idx];
+	osd_hw.updated[OSD1] = 0;
+	osd_hw.updated[OSD2] = 0;
+	//here we will init default value ,these value only set once .
+#if defined(CONFIG_ARCH_MESON6TVD)||(defined(CONFIG_ARCH_MESON6TV))
+	aml_set_reg32_mask(P_VPU_OSD1_MMC_CTRL, 1 << 12); // set OSD to vdisp2
+#endif
+	if (!logo_loaded) {
+		data32 = 1;          // Set DDR request priority to be urgent
+#if defined(CONFIG_ARCH_MESON6TVD)||(defined(CONFIG_ARCH_MESON6TV))
+		data32 |= 18  << 5;  // hold_fifo_lines
+#else
+		data32 |= 4   << 5;  // hold_fifo_lines
+#endif
+		data32 |= 3   << 10; // burst_len_sel: 3=64
+		data32 |= 32  << 12; // fifo_depth_val: 32*8=256
+
+		aml_write_reg32(P_VIU_OSD1_FIFO_CTRL_STAT, data32);
+		aml_write_reg32(P_VIU_OSD2_FIFO_CTRL_STAT, data32);
+
+		aml_set_reg32_mask(P_VPP_MISC, VPP_POSTBLEND_EN);
+		aml_clr_reg32_mask(P_VPP_MISC, VPP_PREBLEND_EN);
+		aml_clr_reg32_mask(P_VPP_MISC, VPP_OSD1_POSTBLEND | VPP_OSD2_POSTBLEND);
+		// just disable osd to avoid booting hang up
+#if defined(CONFIG_ARCH_MESON6TVD)||(defined(CONFIG_ARCH_MESON6TV))
+		data32 = 0x0 << 0; // osd_blk_enable
+#else
+		data32 = 0x1 << 0;
+#endif
+		data32 |= OSD_GLOBAL_ALPHA_DEF << 12;
+		data32 |= (1 << 21);
+		aml_write_reg32(P_VIU_OSD1_CTRL_STAT , data32);
+		aml_write_reg32(P_VIU_OSD2_CTRL_STAT , data32);
+	}
+
+#if defined(CONFIG_FB_OSD2_CURSOR)
+	aml_set_reg32_mask(P_VPP_MISC, VPP_POST_FG_OSD2 | VPP_PRE_FG_OSD2);
+	osd_hw.osd_order = OSD_ORDER_10;
+#else
+	aml_clr_reg32_mask(P_VPP_MISC, VPP_POST_FG_OSD2 | VPP_PRE_FG_OSD2);
+	osd_hw.osd_order = OSD_ORDER_01;
+#endif
+
+	osd_hw.enable[OSD2] = osd_hw.enable[OSD1] = DISABLE;
+	osd_hw.fb_gem[OSD1].canvas_idx = OSD1_CANVAS_INDEX;
+	osd_hw.fb_gem[OSD2].canvas_idx = OSD2_CANVAS_INDEX;
+	osd_hw.gbl_alpha[OSD1] = OSD_GLOBAL_ALPHA_DEF;
+	osd_hw.gbl_alpha[OSD2] = OSD_GLOBAL_ALPHA_DEF;
+	osd_hw.color_info[OSD1] = NULL;
+	osd_hw.color_info[OSD2] = NULL;
+	vf.width = vf.height = 0;
+	osd_hw.color_key[OSD1] = osd_hw.color_key[OSD2] = 0xffffffff;
+	osd_hw.scale[OSD1].h_enable = osd_hw.scale[OSD1].v_enable = 0;
+	osd_hw.scale[OSD2].h_enable = osd_hw.scale[OSD2].v_enable = 0;
+	osd_hw.mode_3d[OSD2].enable = osd_hw.mode_3d[OSD1].enable = 0;
+	osd_hw.block_mode[OSD1] = osd_hw.block_mode[OSD2] = 0;
+	osd_hw.free_scale[OSD1].hfs_enable = 0;
+	osd_hw.free_scale[OSD1].hfs_enable = 0;
+	osd_hw.free_scale[OSD2].vfs_enable = 0;
+	osd_hw.free_scale[OSD2].vfs_enable = 0;
+	osd_hw.osd_reverse[OSD1] = osd_hw.osd_reverse[OSD2] = 0;
+	osd_hw.rotation_pandata[OSD1].x_start = osd_hw.rotation_pandata[OSD1].y_start =
+			0;
+	osd_hw.rotation_pandata[OSD2].x_start = osd_hw.rotation_pandata[OSD2].y_start =
+			0;
+	osd_hw.antiflicker_mode = 0;
+#if MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON8
+	osd_hw.free_scale_data[OSD1].x_start = osd_hw.free_scale_data[OSD1].x_end = 0;
+	osd_hw.free_scale_data[OSD1].y_start = osd_hw.free_scale_data[OSD1].y_end = 0;
+	osd_hw.free_scale_data[OSD2].x_start = osd_hw.free_scale_data[OSD2].x_end = 0;
+	osd_hw.free_scale_data[OSD2].y_start = osd_hw.free_scale_data[OSD2].y_end = 0;
+	osd_hw.free_scale_mode[OSD1] = osd_hw.free_scale_mode[OSD2] = 1;
+	aml_write_reg32(P_VPP_OSD_SC_DUMMY_DATA, 0x00808000);
+#else
+	osd_hw.free_scale_mode[OSD1] = osd_hw.free_scale_mode[OSD2] = 0;
+#endif
+
+#if MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON8
+    osd_hw.free_scale_mode[OSD1] = osd_hw.free_scale_mode[OSD2] = 1;
+#else
+    osd_hw.free_scale_mode[OSD1] = osd_hw.free_scale_mode[OSD2] = 0;
+#endif
+	memset(osd_hw.rotate, 0, sizeof(osd_rotate_t));
+
+#ifdef  CONFIG_FB_OSD_SUPPORT_SYNC_FENCE
+	INIT_LIST_HEAD(&post_fence_list);
+	mutex_init(&post_fence_list_lock);
+#endif
+
+#ifdef FIQ_VSYNC
+	osd_hw.fiq_handle_item.handle = vsync_isr;
+	osd_hw.fiq_handle_item.key = (u32)vsync_isr;
+	osd_hw.fiq_handle_item.name = "osd_vsync";
+	if (register_fiq_bridge_handle(&osd_hw.fiq_handle_item))
+#else
+	if (request_irq(INT_VIU_VSYNC, &vsync_isr,
+			IRQF_SHARED , "am_osd_vsync", osd_setup))
+#endif
+	{
+		amlog_level(LOG_LEVEL_HIGH, "can't request irq for vsync\n");
+	}
+
+#ifdef FIQ_VSYNC
+	request_fiq(INT_VIU_VSYNC, &osd_fiq_isr);
+#endif
+
+#ifdef CONFIG_VSYNC_RDMA
+	osd_rdma_enable(1);
+#endif
+
+#ifdef CONFIG_VSYNC_RDMA
+	if (request_irq(INT_RDMA, &osd_rdma_isr,
+			IRQF_SHARED, "osd_rdma", (void *)"osd_rdma"))
+		amlog_level(LOG_LEVEL_HIGH, "can't request irq for rdma\n");
+#endif
+	return ;
+}
+
+
+#if defined(CONFIG_FB_OSD2_CURSOR)
+void osd_cursor_hw(s16 x, s16 y, s16 xstart, s16 ystart, u32 osd_w, u32 osd_h,
+		   int index)
+{
+	dispdata_t disp_tmp;
+
+	if (index != 1)
+		return;
+
+	if (osd_hw.free_scale_mode[OSD1]) {
+		if (osd_hw.free_scale_enable[OSD1])
+			memcpy(&disp_tmp, &osd_hw.cursor_dispdata[OSD1], sizeof(dispdata_t));
+		else
+			memcpy(&disp_tmp, &osd_hw.dispdata[OSD1], sizeof(dispdata_t));
+	} else
+		memcpy(&disp_tmp, &osd_hw.dispdata[OSD1], sizeof(dispdata_t));
+
+	if (osd_hw.scale[OSD2].h_enable && (osd_hw.scaledata[OSD2].x_start > 0)
+	    && (osd_hw.scaledata[OSD2].x_end > 0)) {
+		x = x * osd_hw.scaledata[OSD2].x_end / osd_hw.scaledata[OSD2].x_start;
+		if (osd_hw.scaledata[OSD2].x_end > osd_hw.scaledata[OSD2].x_start) {
+			disp_tmp.x_start = osd_hw.dispdata[OSD1].x_start *
+					   osd_hw.scaledata[OSD2].x_end / osd_hw.scaledata[OSD2].x_start;
+			disp_tmp.x_end = osd_hw.dispdata[OSD1].x_end * osd_hw.scaledata[OSD2].x_end /
+					 osd_hw.scaledata[OSD2].x_start;
+		}
+	}
+
+	if (osd_hw.scale[OSD2].v_enable && (osd_hw.scaledata[OSD2].y_start > 0)
+	    && (osd_hw.scaledata[OSD2].y_end > 0)) {
+		y = y * osd_hw.scaledata[OSD2].y_end / osd_hw.scaledata[OSD2].y_start;
+		if (osd_hw.scaledata[OSD2].y_end > osd_hw.scaledata[OSD2].y_start) {
+			disp_tmp.y_start = osd_hw.dispdata[OSD1].y_start *
+					   osd_hw.scaledata[OSD2].y_end / osd_hw.scaledata[OSD2].y_start;
+			disp_tmp.y_end = osd_hw.dispdata[OSD1].y_end * osd_hw.scaledata[OSD2].y_end /
+					 osd_hw.scaledata[OSD2].y_start;
+		}
+	}
+
+	x += xstart;
+	y += ystart;
+	/**
+	 * Use pandata to show a partial cursor when it is at the edge because the
+	 * registers can't have negative values and because we need to manually
+	 * clip the cursor when it is past the edge.  The edge is hardcoded
+	 * to the OSD0 area.
+	 */
+	osd_hw.dispdata[OSD2].x_start = x;
+	osd_hw.dispdata[OSD2].y_start = y;
+	if (x <  disp_tmp.x_start) {
+		// if negative position, set osd to 0,y and pan.
+		if ((disp_tmp.x_start - x) < osd_w) {
+			osd_hw.pandata[OSD2].x_start = disp_tmp.x_start - x;
+			osd_hw.pandata[OSD2].x_end = osd_w - 1;
+		}
+		osd_hw.dispdata[OSD2].x_start = 0;
+	} else {
+		osd_hw.pandata[OSD2].x_start = 0;
+		if (x + osd_w > disp_tmp.x_end) {
+			// if past positive edge, set osd to inside of the edge and pan.
+			if (x < disp_tmp.x_end)
+				osd_hw.pandata[OSD2].x_end = disp_tmp.x_end - x;
+		} else
+			osd_hw.pandata[OSD2].x_end = osd_w - 1;
+	}
+	if (y < disp_tmp.y_start) {
+		if ((disp_tmp.y_start - y) < osd_h) {
+			osd_hw.pandata[OSD2].y_start = disp_tmp.y_start - y;
+			osd_hw.pandata[OSD2].y_end = osd_h - 1;
+		}
+		osd_hw.dispdata[OSD2].y_start = 0;
+	} else {
+		osd_hw.pandata[OSD2].y_start = 0;
+		if (y + osd_h > disp_tmp.y_end) {
+			if (y < disp_tmp.y_end)
+				osd_hw.pandata[OSD2].y_end = disp_tmp.y_end - y;
+		} else
+			osd_hw.pandata[OSD2].y_end = osd_h - 1;
+	}
+	osd_hw.dispdata[OSD2].x_end = osd_hw.dispdata[OSD2].x_start +
+				      osd_hw.pandata[OSD2].x_end - osd_hw.pandata[OSD2].x_start;
+	osd_hw.dispdata[OSD2].y_end = osd_hw.dispdata[OSD2].y_start +
+				      osd_hw.pandata[OSD2].y_end - osd_hw.pandata[OSD2].y_start;
+	add_to_update_list(OSD2, DISP_GEOMETRY);
+}
+#endif //CONFIG_FB_OSD2_CURSOR
+
+void osddev_copy_data_tocursor_hw(u32 cursor_mem_vaddr, aml_hwc_addr_t *hwc_mem)
+{
+	u32 tmp;
+	u32 i;
+	u32 value_pixel = 0;
+	u32 size = 32*32*4;
+
+	if (hwc_mem->addr & 0x3) { /* Address not 32bit aligned */
+		for (i = 0; i < size; i += 4) {
+			tmp = readb(hwc_mem->addr + i);
+			value_pixel = tmp;
+			tmp = readb(hwc_mem->addr + i + 1);
+			value_pixel |= (tmp << 8);
+			tmp = readb(hwc_mem->addr + i + 2);
+			value_pixel |= (tmp << 16);
+			tmp = readb(hwc_mem->addr + i + 3);
+			value_pixel |= (tmp << 24);
+			writel(value_pixel, cursor_mem_vaddr+ i);
+		}
+	} else {
+		for (i = 0; i < size; i += 4) {
+			tmp = readl(hwc_mem->addr + i);
+			writel(tmp, cursor_mem_vaddr+ i);
+		}
+	}
+}
+
+void  osd_suspend_hw(void)
+{
+	osd_hw.reg_status_save = aml_read_reg32(P_VPP_MISC) & OSD_RELATIVE_BITS;
+
+	//aml_clr_reg32_mask(P_VPP_MISC, OSD_RELATIVE_BITS);
+	VSYNCOSD_CLR_MPEG_REG_MASK(VPP_MISC, OSD_RELATIVE_BITS);
+
+	printk("osd_suspended\n");
+
+	return ;
+
+}
+void osd_resume_hw(void)
+{
+	//aml_set_reg32_mask(P_VPP_MISC, osd_hw.reg_status_save);
+	VSYNCOSD_SET_MPEG_REG_MASK(VPP_MISC, osd_hw.reg_status_save);
+
+	printk("osd_resumed\n");
+
+	return ;
+}
+
+MODULE_PARM_DESC(osd_h_filter_mode, "\n osd_h_filter_mode \n");
+module_param(osd_h_filter_mode, int, 0664);
+
+MODULE_PARM_DESC(osd_v_filter_mode, "\n osd_v_filter_mode \n");
+module_param(osd_v_filter_mode, int, 0664);
+
diff --git a/sources/Linux/Amlogic/M201/create-3.10.33-20160716-osd-xrgb-patch/linux-aml-3.10.33-20160716-new/drivers/amlogic/display/osd/osd_main.c b/sources/Linux/Amlogic/M201/create-3.10.33-20160716-osd-xrgb-patch/linux-aml-3.10.33-20160716-new/drivers/amlogic/display/osd/osd_main.c
new file mode 100644
index 000000000..da3c53c8b
--- /dev/null
+++ b/sources/Linux/Amlogic/M201/create-3.10.33-20160716-osd-xrgb-patch/linux-aml-3.10.33-20160716-new/drivers/amlogic/display/osd/osd_main.c
@@ -0,0 +1,2108 @@
+/*
+ * Amlogic osd
+ * frame buffer driver
+ *
+ * Copyright (C) 2009 Amlogic, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the named License,
+ * or any later version.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
+ *
+ * Author:  Tim Yao <timyao@amlogic.com>
+ *		   
+ *		    jianfeng_wang : add ge2d support 09/05/21	
+ */
+
+#include <linux/version.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/io.h>
+#include <linux/mm.h>
+#include <linux/interrupt.h>
+#include <linux/mutex.h>
+#include <linux/platform_device.h>
+#include <linux/fb.h>
+#include <linux/spinlock.h>
+#include <asm/cacheflush.h>
+#include <mach/am_regs.h>
+#include <linux/fs.h>
+#include <linux/sysfs.h>
+#include <linux/file.h>
+#include <linux/fdtable.h>
+#include <linux/console.h>
+#include <linux/amlogic/osd/osd_main.h>
+#include <linux/amlogic/osd/osd_dev.h>
+#include <linux/slab.h>
+#include <asm/uaccess.h>
+#include <linux/of.h>
+#include <linux/of_fdt.h>
+#include "osd_log.h"
+#include "osd_sync.h"
+#include <linux/amlogic/amlog.h>
+#include <linux/amlogic/logo/logo_dev.h>
+#include <linux/amlogic/logo/logo_dev_osd.h>
+
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+#include <linux/earlysuspend.h>
+static struct early_suspend early_suspend;
+static int early_suspend_flag = 0;
+#endif
+#ifdef CONFIG_SCREEN_ON_EARLY
+static int early_resume_flag = 0;
+#endif
+
+osd_info_t  osd_info={
+	.index = 0,
+	.osd_reverse = 0,
+};
+
+MODULE_AMLOG(AMLOG_DEFAULT_LEVEL, 0x0, LOG_LEVEL_DESC, LOG_MASK_DESC);
+
+static myfb_dev_t  *gp_fbdev_list[OSD_COUNT]={NULL,NULL};
+
+static DEFINE_MUTEX(dbg_mutex);
+static char request2XScaleValue[32];
+static char videohole[32];
+
+
+const color_bit_define_t*	
+_find_color_format(struct fb_var_screeninfo * var)
+{
+	u32	upper_margin,lower_margin,i,level;
+	const color_bit_define_t *ret=NULL;
+	
+	level=(var->bits_per_pixel -1)/8; 
+	switch(level)
+	{
+		case 0:
+		upper_margin=COLOR_INDEX_08_PAL256;
+		lower_margin=COLOR_INDEX_02_PAL4;
+		break;
+		case 1:
+		upper_margin=COLOR_INDEX_16_565;
+		lower_margin=COLOR_INDEX_16_655;
+		break;	
+		case 2:
+		upper_margin=COLOR_INDEX_24_RGB;
+		lower_margin=COLOR_INDEX_24_6666_A;
+		break;		
+		case 3:
+		if ((var->nonstd != 0)
+		    && (var->transp.length == 0)) {
+			/* RGBX Mode */
+#ifdef CONFIG_FB_AMLOGIC_UMP
+			upper_margin = COLOR_INDEX_32_XRGB;
+#else
+			upper_margin = COLOR_INDEX_32_XBGR;
+#endif
+			lower_margin = COLOR_INDEX_32_BGRX;
+		} else {
+#ifdef CONFIG_FB_AMLOGIC_UMP
+			upper_margin = COLOR_INDEX_32_ARGB;
+#else
+			upper_margin = COLOR_INDEX_32_ABGR;
+#endif
+			lower_margin = COLOR_INDEX_32_BGRA;
+		}
+		break;
+		case 4:
+		upper_margin=COLOR_INDEX_YUV_422;
+		lower_margin=COLOR_INDEX_YUV_422;	
+		break;
+		default :
+		return NULL;
+	}
+
+	/*
+	 * if not provide color component length
+	 * then we find the first depth match.
+	 */
+	if ((var->nonstd != 0) && (level == 3)
+	    && (var->transp.length == 0)) {
+		/* RGBX Mode */
+		for (i = upper_margin; i >= lower_margin; i--) {
+			if ((default_color_format_array[i].red_length == var->red.length) &&
+			    (default_color_format_array[i].green_length == var->green.length) &&
+			    (default_color_format_array[i].blue_length == var->blue.length) &&
+			    (default_color_format_array[i].transp_offset == var->transp.offset) &&
+			    (default_color_format_array[i].green_offset == var->green.offset) &&
+			    (default_color_format_array[i].blue_offset == var->blue.offset) &&
+			    (default_color_format_array[i].red_offset == var->red.offset)) {
+				 ret = &default_color_format_array[i];
+				break;
+			}
+		}
+	} else if((var->red.length==0)||(var->green.length==0)||(var->blue.length==0)||
+		var->bits_per_pixel != (var->red.length+var->green.length+var->blue.length+var->transp.length))
+	{
+		amlog_mask_level(LOG_MASK_PARA,LOG_LEVEL_LOW,"not provide color component length,use default color \n");
+		ret =&default_color_format_array[upper_margin];
+	}
+	else
+	{
+		for ( i=upper_margin;i>=lower_margin;i--)
+		{
+			if( (default_color_format_array[i].red_length==var->red.length)&&
+			(default_color_format_array[i].green_length==var->green.length)&&
+			(default_color_format_array[i].blue_length==var->blue.length)&&
+			(default_color_format_array[i].transp_length ==var->transp.length)&&
+			(default_color_format_array[i].transp_offset==var->transp.offset)&&
+			(default_color_format_array[i].green_offset==var->green.offset)&&
+			(default_color_format_array[i].blue_offset==var->blue.offset)&&
+			(default_color_format_array[i].red_offset==var->red.offset))
+			{
+				 ret = &default_color_format_array[i];
+				 break;
+			}
+		}
+	}
+	return ret;
+}
+static void __init
+_fbdev_set_default(struct myfb_dev *fbdev,int index )
+{
+    	/* setup default value */
+	fbdev->fb_info->var = mydef_var[index];
+	fbdev->fb_info->fix = mydef_fix;
+	fbdev->color=_find_color_format(&fbdev->fb_info->var);
+}
+
+static int
+osd_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
+{
+	struct fb_fix_screeninfo *fix;
+    	struct myfb_dev *fbdev=( struct myfb_dev*)info->par;
+	const color_bit_define_t   *color_format_pt;
+
+	fix = &info->fix;
+	
+	color_format_pt=_find_color_format(var);
+	if (color_format_pt == NULL || color_format_pt->color_index==0)
+	{
+		return -EFAULT ;
+	}
+	amlog_mask_level(LOG_MASK_PARA,LOG_LEVEL_LOW,"select color format :index%d,bpp %d\r\n",color_format_pt->color_index, \
+												color_format_pt->bpp) ;
+	fbdev->color=color_format_pt;
+	var->red.offset = color_format_pt->red_offset;
+	var->red.length = color_format_pt->red_length;
+	var->red.msb_right= color_format_pt->red_msb_right ;
+	var->green.offset  = color_format_pt->green_offset;
+	var->green.length  = color_format_pt->green_length;
+	var->green.msb_right = color_format_pt->green_msb_right;
+	var->blue.offset   = color_format_pt->blue_offset;
+	var->blue.length   = color_format_pt->blue_length;
+	var->blue.msb_right = color_format_pt->blue_msb_right;
+	var->transp.offset= color_format_pt->transp_offset ;
+	var->transp.length = color_format_pt->transp_length ;
+	var->transp.msb_right = color_format_pt->transp_msb_right ;
+	var->bits_per_pixel=color_format_pt->bpp ;
+	amlog_mask_level(LOG_MASK_PARA,LOG_LEVEL_LOW,"rgba(L/O):%d/%d-%d/%d-%d/%d-%d/%d\n",
+					var->red.length,var->red.offset,
+					var->green.length,var->green.offset,
+					var->blue.length,var->blue.offset,
+					var->transp.length,var->transp.offset);
+	fix->visual=color_format_pt->color_type ;
+	//adjust memory length.	
+ 	fix->line_length = var->xres_virtual*var->bits_per_pixel/8;
+	amlog_mask_level(LOG_MASK_PARA,LOG_LEVEL_HIGH,"xvirtual=%d,bpp:%d,kernel_line_length=%d\r\n",var->xres_virtual,var->bits_per_pixel,fix->line_length);
+	if(var->xres_virtual*var->yres_virtual*var->bits_per_pixel/8> fbdev->fb_len )
+	{
+		amlog_mask_level(LOG_MASK_PARA,LOG_LEVEL_HIGH,"no enough memory for %d*%d*%d\r\n",var->xres,var->yres,var->bits_per_pixel);
+		return  -ENOMEM;
+	}
+	if (var->xres_virtual < var->xres)
+		var->xres_virtual = var->xres;
+
+	if (var->yres_virtual < var->yres)
+		var->yres_virtual = var->yres;
+
+    	var->left_margin = var->right_margin = var->upper_margin = var->lower_margin = 0;
+    
+	if (var->xres + var->xoffset > var->xres_virtual)
+		var->xoffset = var->xres_virtual - var->xres;
+	if (var->yres + var->yoffset > var->yres_virtual)
+		var->yoffset = var->yres_virtual - var->yres;
+    
+    	return 0;
+}
+
+static int
+osd_set_par(struct fb_info *info)
+{
+	const vinfo_t *vinfo;
+	struct myfb_dev *fbdev = (struct myfb_dev *)info->par;
+	osd_ctl_t *osd_ctrl=&fbdev->osd_ctl; 
+	u32  virt_end_x,virt_end_y;
+	
+	vinfo = get_current_vinfo();
+	virt_end_x=osd_ctrl->disp_start_x+info->var.xres;
+	virt_end_y=osd_ctrl->disp_start_y+info->var.yres;
+	
+	if(virt_end_x > vinfo->width)
+	{
+		osd_ctrl->disp_end_x=vinfo->width - 1 ;
+	}
+	else
+	{
+		osd_ctrl->disp_end_x=virt_end_x -1;
+	}
+	if(virt_end_y  >vinfo->height)
+	{
+		osd_ctrl->disp_end_y=vinfo->height - 1;
+	}
+	else
+	{     
+		osd_ctrl->disp_end_y=virt_end_y - 1; 
+	}
+	osddev_set((struct myfb_dev *)info->par);
+	return  0;
+}
+
+static int
+osd_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue,
+        unsigned transp, struct fb_info *info)
+{
+    return osddev_setcolreg(regno, red, green, blue,
+                        transp, (struct myfb_dev *)info->par);
+}
+
+static int
+osd_setcmap(struct fb_cmap *cmap, struct fb_info *info)
+{
+	int count, index, r;
+	u16 *red, *green, *blue, *transp;
+	u16 trans = 0xffff;
+
+	red     = cmap->red;
+	green   = cmap->green;
+	blue    = cmap->blue;
+	transp  = cmap->transp;
+	index   = cmap->start;
+
+	for (count = 0; count < cmap->len; count++) {
+		if (transp)
+			trans = *transp++;
+		r = osddev_setcolreg(index++, *red++, *green++, *blue++, trans,
+				(struct myfb_dev *)info->par);
+		if (r != 0)
+			return r;
+	}
+
+	return 0;
+}
+
+#ifdef CONFIG_FB_AMLOGIC_UMP
+int (*disp_get_ump_secure_id) (struct fb_info *info, myfb_dev_t *g_fbi,
+					unsigned long arg, int buf);
+EXPORT_SYMBOL(disp_get_ump_secure_id);
+#endif
+
+static int
+osd_ioctl(struct fb_info *info, unsigned int cmd,
+               unsigned long arg)
+{
+	 struct myfb_dev *fbdev = (struct myfb_dev *)info->par;
+	 void __user *argp = (void __user *)arg;
+   	 u32  src_colorkey;//16 bit or 24 bit 
+   	 u32  srckey_enable;
+	 u32  gbl_alpha;
+	 u32  osd_order;
+	 s32  osd_axis[4] = {0};
+	 s32  osd_dst_axis[4] = {0};
+	 u32  block_windows[8] = {0};
+	 u32  block_mode;
+        unsigned long  ret;
+	 u32  flush_rate;
+	fb_sync_request_t  sync_request;
+
+	unsigned int karg = 0;
+#ifdef CONFIG_FB_AMLOGIC_UMP
+	int secure_id_buf_num = 0;
+#endif
+
+    switch (cmd)
+  	{
+   		case  FBIOPUT_OSD_SRCKEY_ENABLE:
+			ret=copy_from_user(&srckey_enable,argp,sizeof(u32));
+			break;
+   		case  FBIOPUT_OSD_SRCCOLORKEY:
+			ret=copy_from_user(&src_colorkey,argp,sizeof(u32));
+			break ;
+		case FBIOPUT_OSD_SET_GBL_ALPHA:
+			ret=copy_from_user(&gbl_alpha,argp,sizeof(u32));
+			break;
+		case FBIOPUT_OSD_SCALE_AXIS:
+			ret=copy_from_user(&osd_axis, argp, 4 * sizeof(s32));
+			break;
+		case FBIOPUT_OSD_SYNC_ADD:
+			ret=copy_from_user(&sync_request,argp,sizeof(fb_sync_request_t));
+			//printk("osd_mai request offset:%d\n", sync_request.offset);
+			break;
+		case FBIO_WAITFORVSYNC:
+		case FBIOGET_OSD_SCALE_AXIS:
+		case FBIOPUT_OSD_ORDER:
+		case FBIOGET_OSD_ORDER:
+		case FBIOGET_OSD_GET_GBL_ALPHA:
+		case FBIOPUT_OSD_2X_SCALE:	
+		case FBIOPUT_OSD_ENABLE_3D_MODE:
+		case FBIOPUT_OSD_FREE_SCALE_ENABLE:
+		case FBIOPUT_OSD_FREE_SCALE_MODE:
+		case FBIOPUT_OSD_FREE_SCALE_WIDTH:
+		case FBIOPUT_OSD_FREE_SCALE_HEIGHT:
+		case FBIOGET_OSD_BLOCK_WINDOWS:
+		case FBIOGET_OSD_BLOCK_MODE:
+		case FBIOGET_OSD_FREE_SCALE_AXIS:
+		case FBIOGET_OSD_WINDOW_AXIS:
+		case FBIOPUT_OSD_REVERSE:
+		case FBIOPUT_OSD_ROTATE_ON:
+		case FBIOPUT_OSD_ROTATE_ANGLE:
+			break;
+		case FBIOPUT_OSD_BLOCK_MODE:
+			block_mode = (u32)argp;
+			break;
+		case FBIOPUT_OSD_BLOCK_WINDOWS:
+			ret=copy_from_user(&block_windows, argp, 8 * sizeof(u32));
+			break;
+		case FBIOPUT_OSD_FREE_SCALE_AXIS:
+			ret=copy_from_user(&osd_axis, argp, 4 * sizeof(s32));
+			break;
+		case FBIOPUT_OSD_WINDOW_AXIS:
+			ret=copy_from_user(&osd_dst_axis, argp, 4 * sizeof(s32));
+			break;
+#ifdef CONFIG_FB_AMLOGIC_UMP
+		case GET_UMP_SECURE_ID_BUF2:	/* flow trough */
+		{
+			secure_id_buf_num = 1;
+			if (!disp_get_ump_secure_id)
+				request_module("osd_ump");
+			if (disp_get_ump_secure_id)
+				return disp_get_ump_secure_id(info, fbdev, arg,
+							      secure_id_buf_num);
+			else
+				return -ENOTSUPP;
+		}
+		break;
+		case GET_UMP_SECURE_ID_BUF1:	/* flow trough */
+		{
+			secure_id_buf_num = 0;
+			if (!disp_get_ump_secure_id)
+				request_module("osd_ump");
+			if (disp_get_ump_secure_id)
+				return disp_get_ump_secure_id(info, fbdev, arg,
+							      secure_id_buf_num);
+			else
+				return -ENOTSUPP;
+		}
+		break;
+#endif
+		case FBIOPUT_OSD2_CURSOR_DATA:
+		{
+			aml_hwc_addr_t para;
+			if (copy_from_user(&karg, argp, sizeof(unsigned int))) {
+				return -EFAULT;
+			}
+			if (copy_from_user(&para, (void __user *)karg, sizeof(aml_hwc_addr_t))) {
+				return -EFAULT;
+			}
+			ret = osddev_copy_data_tocursor(fbdev, &para);
+		}
+		break;
+		default :
+			amlog_mask_level(LOG_MASK_IOCTL,LOG_LEVEL_HIGH,"command not supported\r\n ");
+			return -1;
+	}
+	mutex_lock(&fbdev->lock);
+
+  	switch (cmd)
+    	{
+    		case FBIOPUT_OSD_ORDER:
+		osddev_change_osd_order(info->node,arg);	
+		break;
+		case FBIOGET_OSD_ORDER:
+		osd_order=osddev_get_osd_order(info->node);
+		ret=copy_to_user(argp, &osd_order, sizeof(u32));
+		break;	
+		case FBIOPUT_OSD_FREE_SCALE_WIDTH:
+		osddev_free_scale_width(info->node,arg);
+		break;
+		case FBIOPUT_OSD_FREE_SCALE_HEIGHT:
+		osddev_free_scale_height(info->node,arg);
+		break;
+    		case FBIOPUT_OSD_FREE_SCALE_ENABLE:
+		osddev_free_scale_enable(info->node,arg);
+		break;
+		case FBIOPUT_OSD_FREE_SCALE_MODE:
+		osddev_free_scale_mode(info->node, arg);
+		break;
+    		case FBIOPUT_OSD_ENABLE_3D_MODE:
+		osddev_enable_3d_mode(info->node,arg);
+		break;
+    		case FBIOPUT_OSD_2X_SCALE: //arg :higher 16 bit h_scale_enable, lower 16 bit v_scale_enable
+		osddev_set_2x_scale(info->node,arg&0xffff0000?1:0,arg&0xffff?1:0);
+		break;
+		case FBIOGET_OSD_FLUSH_RATE:
+		osddev_get_flush_rate(&flush_rate);
+		if(copy_to_user(argp, &flush_rate, sizeof(u32)))
+			return -EFAULT;
+		break;
+		case FBIOPUT_OSD_REVERSE:
+		osddev_set_osd_reverse(info->node, arg);
+		break;
+		case FBIOPUT_OSD_ROTATE_ON:
+		osddev_set_osd_rotate_on(info->node, arg);
+		break;
+		case FBIOPUT_OSD_ROTATE_ANGLE:
+		osddev_set_osd_rotate_angle(info->node, arg);
+		break;
+		case FBIOPUT_OSD_SRCCOLORKEY:
+		switch(fbdev->color->color_index)
+	  	{
+	 		case COLOR_INDEX_16_655:
+			case COLOR_INDEX_16_844:
+			case COLOR_INDEX_16_565:
+			case COLOR_INDEX_24_888_B:
+			case COLOR_INDEX_24_RGB:
+			case COLOR_INDEX_YUV_422:
+	  	   	amlog_mask_level(LOG_MASK_IOCTL,LOG_LEVEL_LOW,"set osd color key 0x%x\r\n",src_colorkey);
+            fbdev->color_key = src_colorkey;
+	  	 	osddev_set_colorkey(info->node,fbdev->color->color_index,src_colorkey);
+			break;
+			default: break;
+	  	}
+	   	break ;
+	  	case FBIOPUT_OSD_SRCKEY_ENABLE:
+	   	switch(fbdev->color->color_index)
+	  	{
+	 		case COLOR_INDEX_16_655:
+			case COLOR_INDEX_16_844:
+			case COLOR_INDEX_16_565:
+			case COLOR_INDEX_24_888_B:
+			case COLOR_INDEX_24_RGB:
+			case COLOR_INDEX_YUV_422:	
+			amlog_mask_level(LOG_MASK_IOCTL,LOG_LEVEL_LOW,"set osd color key %s\r\n",srckey_enable?"enable":"disable");
+			if (srckey_enable != 0) {
+				fbdev->enable_key_flag |= KEYCOLOR_FLAG_TARGET;
+				if (!(fbdev->enable_key_flag & KEYCOLOR_FLAG_ONHOLD)) {
+					osddev_srckey_enable(info->node, 1);
+					fbdev->enable_key_flag |= KEYCOLOR_FLAG_CURRENT;
+				}
+			} else {
+				osddev_srckey_enable(info->node, 0);
+				fbdev->enable_key_flag &= ~(KEYCOLOR_FLAG_TARGET | KEYCOLOR_FLAG_CURRENT);
+			}
+			break;
+			default:break;
+	 	}
+	   	break;
+	 	case FBIOPUT_OSD_SET_GBL_ALPHA:
+	 	osddev_set_gbl_alpha(info->node,gbl_alpha);
+	 	break;
+	 	case  FBIOGET_OSD_GET_GBL_ALPHA:
+	 	gbl_alpha=osddev_get_gbl_alpha(info->node);
+	 	ret=copy_to_user(argp, &gbl_alpha, sizeof(u32));
+	  	break;
+
+		case FBIOGET_OSD_SCALE_AXIS:
+			osddev_get_scale_axis(info->node, &osd_axis[0], &osd_axis[1], &osd_axis[2], &osd_axis[3]);
+			ret=copy_to_user(argp, &osd_axis, 4 * sizeof(s32));
+			break;
+		case FBIOPUT_OSD_SCALE_AXIS:
+			osddev_set_scale_axis(info->node, osd_axis[0], osd_axis[1], osd_axis[2], osd_axis[3]);
+			break;
+		case FBIOGET_OSD_BLOCK_WINDOWS:
+			osddev_get_block_windows(info->node, block_windows);
+			ret=copy_to_user(argp, &block_windows, 8 * sizeof(u32));
+			break;
+		case FBIOPUT_OSD_BLOCK_WINDOWS:
+			osddev_set_block_windows(info->node, block_windows);
+			break;
+		case FBIOPUT_OSD_BLOCK_MODE:
+			osddev_set_block_mode(info->node, block_mode);
+			break;
+		case FBIOGET_OSD_BLOCK_MODE:
+			osddev_get_block_mode(info->node, &block_mode);
+			ret=copy_to_user(argp, &block_mode, sizeof(u32));
+			break;
+		case FBIOGET_OSD_FREE_SCALE_AXIS:
+			osddev_get_free_scale_axis(info->node, &osd_axis[0], &osd_axis[1], &osd_axis[2], &osd_axis[3]);
+			ret=copy_to_user(argp, &osd_axis, 4 * sizeof(s32));
+			break;
+		case FBIOGET_OSD_WINDOW_AXIS:
+			osddev_get_window_axis(info->node, &osd_dst_axis[0], &osd_dst_axis[1], &osd_dst_axis[2], &osd_dst_axis[3]);
+			ret=copy_to_user(argp, &osd_dst_axis, 4 * sizeof(s32));
+			break;
+		case FBIOPUT_OSD_FREE_SCALE_AXIS:
+			osddev_set_free_scale_axis(info->node, osd_axis[0], osd_axis[1], osd_axis[2], osd_axis[3]);
+			break;
+		case FBIOPUT_OSD_WINDOW_AXIS:
+			osddev_set_window_axis(info->node, osd_dst_axis[0], osd_dst_axis[1], osd_dst_axis[2], osd_dst_axis[3]);
+			break;
+		 case FBIOPUT_OSD_SYNC_ADD:
+		 	sync_request.out_fen_fd=osddev_sync_request(info, sync_request.xoffset,sync_request.yoffset,sync_request.in_fen_fd);
+			ret=copy_to_user(argp, &sync_request, sizeof(fb_sync_request_t));
+			if(sync_request.out_fen_fd  <0 ) // fence create fail.
+			ret=-1;
+			break;
+		case FBIO_WAITFORVSYNC:
+			osddev_wait_for_vsync();
+			ret=1;
+			ret=copy_to_user(argp,&ret,sizeof(u32));
+
+		default:
+			break;
+    	}
+
+   	mutex_unlock(&fbdev->lock);
+	
+	return  ret;
+}
+static int osd_open(struct fb_info *info, int arg)
+{
+	return 0;
+	
+}
+
+
+static int
+osd_blank(int blank_mode, struct fb_info *info)
+{
+ 	osddev_enable((blank_mode != 0) ? 0 : 1,info->node);
+
+    	return 0;
+}
+
+static int osd_pan_display(struct fb_var_screeninfo *var,
+                        struct fb_info *fbi)
+{
+	osddev_pan_display(var,fbi);
+	amlog_mask_level(LOG_MASK_PARA,LOG_LEVEL_LOW,"osd_pan_display:=>osd%d\r\n",fbi->node);
+	return 0;
+}
+
+#if defined(CONFIG_FB_OSD2_CURSOR)
+static int osd_cursor(struct fb_info *fbi, struct fb_cursor *var)
+{
+	s16 startx = 0, starty = 0;
+	myfb_dev_t *fb_dev = gp_fbdev_list[1];
+	if (fb_dev) {
+		startx = fb_dev->osd_ctl.disp_start_x;
+		starty = fb_dev->osd_ctl.disp_start_y;
+	}
+	osddev_cursor((struct myfb_dev *)fbi->par,
+                  (s16)var->hot.x, (s16)var->hot.y,
+                  startx, starty,
+                  fbi->var.xres, fbi->var.yres);
+	return 0;
+}
+#endif
+
+static int osd_sync(struct fb_info *info)
+{
+	return 0;
+}
+
+
+/* fb_ops structures */
+static struct fb_ops osd_ops = {
+	.owner          = THIS_MODULE,
+	.fb_check_var   = osd_check_var,
+	.fb_set_par     = osd_set_par,
+	.fb_setcolreg   = osd_setcolreg,
+	.fb_setcmap     = osd_setcmap,
+	.fb_fillrect    = cfb_fillrect,
+	.fb_copyarea    = cfb_copyarea,
+	.fb_imageblit   = cfb_imageblit,
+#ifdef CONFIG_FB_SOFT_CURSOR
+	.fb_cursor      = soft_cursor,
+#elif defined(CONFIG_FB_OSD2_CURSOR)
+	.fb_cursor      = osd_cursor,
+#endif
+	.fb_ioctl       = osd_ioctl,
+	.fb_open        = osd_open,
+	.fb_blank       = osd_blank,
+	.fb_pan_display = osd_pan_display,
+	.fb_sync        = osd_sync,
+};
+
+static  void  set_default_display_axis(struct fb_var_screeninfo *var,osd_ctl_t *osd_ctrl,const vinfo_t *vinfo)
+{
+	u32  virt_end_x=osd_ctrl->disp_start_x + var->xres;
+	u32  virt_end_y=osd_ctrl->disp_start_y+var->yres;
+
+	if(virt_end_x > vinfo->width)
+	{
+		osd_ctrl->disp_end_x=vinfo->width- 1 ;//screen axis 
+	}
+	else
+	{
+		osd_ctrl->disp_end_x=virt_end_x- 1 ;//screen axis 
+	}
+	if(virt_end_y > vinfo->height)
+	{
+		osd_ctrl->disp_end_y=vinfo->height- 1 ;
+	}
+	else
+	{
+		osd_ctrl->disp_end_y=virt_end_y- 1 ;//screen axis 
+	}
+	return ;
+}
+
+int osd_notify_callback(struct notifier_block *block, unsigned long cmd , void *para)
+{
+	const vinfo_t *vinfo;
+	myfb_dev_t *fb_dev;
+	int  i,blank;
+	disp_rect_t  *disp_rect;
+	
+	vinfo = get_current_vinfo();
+	amlog_mask_level(LOG_MASK_PARA,LOG_LEVEL_LOW,"tv_server:vmode=%s\r\n", vinfo->name);
+	
+	switch(cmd)
+	{
+		case  VOUT_EVENT_MODE_CHANGE:
+		amlog_mask_level(LOG_MASK_PARA,LOG_LEVEL_LOW,"recevie change mode  message \r\n");
+		for(i=0;i<OSD_COUNT;i++)
+		{
+			if(NULL==(fb_dev=gp_fbdev_list[i])) continue;
+			set_default_display_axis(&fb_dev->fb_info->var,&fb_dev->osd_ctl,vinfo);
+			console_lock();
+			osddev_update_disp_axis(fb_dev,1);
+			osddev_set_osd_antiflicker(OSD1, vinfo->mode, gp_fbdev_list[OSD1]->fb_info->var.yres);
+			console_unlock();
+		}
+		break;
+
+		case VOUT_EVENT_OSD_BLANK:
+		blank=*(int*)para ;	
+		for(i=0;i<OSD_COUNT;i++)
+		{
+			if(NULL==(fb_dev=gp_fbdev_list[i])) continue;
+			console_lock();
+			osd_blank(blank,fb_dev->fb_info);
+			console_unlock();
+		}
+		break;
+		case   VOUT_EVENT_OSD_DISP_AXIS:
+		disp_rect=(disp_rect_t*)para;	
+		
+		for(i=0;i<OSD_COUNT;i++)
+		{	
+			if(!disp_rect)  break;
+			fb_dev=gp_fbdev_list[i];
+			if(fb_dev->preblend_enable) break;  //if osd layer preblend ,it's position is controled by vpp.
+			fb_dev->osd_ctl.disp_start_x=disp_rect->x  ;
+			fb_dev->osd_ctl.disp_start_y=disp_rect->y  ;
+			amlog_mask_level(LOG_MASK_PARA,LOG_LEVEL_LOW,"set disp axis: x:%d y:%d w:%d h:%d\r\n"  , \
+					disp_rect->x, disp_rect->y,\
+					disp_rect->w, disp_rect->h );
+			if(disp_rect->x+disp_rect->w > vinfo->width)
+			{
+				fb_dev->osd_ctl.disp_end_x=vinfo->width - 1;
+			}
+			else
+			{
+				fb_dev->osd_ctl.disp_end_x=fb_dev->osd_ctl.disp_start_x+disp_rect->w -1 ; 
+			}
+			if(disp_rect->y+ disp_rect->h>vinfo->height)
+			{
+				fb_dev->osd_ctl.disp_end_y=vinfo->height- 1;
+			}
+			else
+			{
+				fb_dev->osd_ctl.disp_end_y=fb_dev->osd_ctl.disp_start_y + disp_rect->h - 1 ;
+			}
+			disp_rect ++;
+			amlog_mask_level(LOG_MASK_PARA,LOG_LEVEL_LOW,"new disp axis: startx:%d starty:%d endx:%d endy:%d\r\n"  , \
+					fb_dev->osd_ctl.disp_start_x, fb_dev->osd_ctl.disp_start_y,\
+					fb_dev->osd_ctl.disp_end_x,fb_dev->osd_ctl.disp_end_y);
+			console_lock();
+			osddev_update_disp_axis(fb_dev,0);
+			console_unlock();
+		}
+		
+		break;
+	}
+	return 0;
+}
+
+static struct notifier_block osd_notifier_nb = {
+	.notifier_call	= osd_notify_callback,
+};
+static ssize_t store_preblend_enable(struct device *device, struct device_attribute *attr,
+			 const char *buf, size_t count)
+{
+	struct fb_info *fb_info = dev_get_drvdata(device);
+	struct myfb_dev *fbdev = (struct myfb_dev *)fb_info->par;
+	fbdev->preblend_enable= simple_strtoul(buf, NULL, 0);
+	vout_notifier_call_chain(VOUT_EVENT_OSD_PREBLEND_ENABLE,&fbdev->preblend_enable) ;
+	return count;
+}
+
+static ssize_t show_preblend_enable(struct device *device, struct device_attribute *attr,
+			char *buf)
+{
+	struct fb_info *fb_info = dev_get_drvdata(device);
+	struct myfb_dev *fbdev = (struct myfb_dev *)fb_info->par;
+	return snprintf(buf, PAGE_SIZE, "preblend[%s]\n",fbdev->preblend_enable?"enable":"disable");
+}
+
+static ssize_t store_enable_3d(struct device *device, struct device_attribute *attr,
+			 const char *buf, size_t count)
+{
+	struct fb_info *fb_info = dev_get_drvdata(device);
+	struct myfb_dev *fbdev = (struct myfb_dev *)fb_info->par;
+	fbdev->enable_3d= simple_strtoul(buf, NULL, 0);
+	osddev_enable_3d_mode(fb_info->node, fbdev->enable_3d);
+	return count;
+}
+
+static ssize_t show_enable_3d(struct device *device, struct device_attribute *attr,
+			char *buf)
+{
+	struct fb_info *fb_info = dev_get_drvdata(device);
+	struct myfb_dev *fbdev = (struct myfb_dev *)fb_info->par;
+	return snprintf(buf, PAGE_SIZE, "3d_enable:[0x%x]\n",fbdev->enable_3d);
+}
+
+static ssize_t store_color_key(struct device *device, struct device_attribute *attr,
+			 const char *buf, size_t count)
+{
+	struct fb_info *fb_info = dev_get_drvdata(device);
+	struct myfb_dev *fbdev = (struct myfb_dev *)fb_info->par;
+	int r = simple_strtoul(buf, NULL, 16);
+	switch(fbdev->color->color_index)
+	  	{
+	 		case COLOR_INDEX_16_655:
+			case COLOR_INDEX_16_844:
+			case COLOR_INDEX_16_565:
+			case COLOR_INDEX_24_888_B:
+			case COLOR_INDEX_24_RGB:
+			case COLOR_INDEX_YUV_422:
+            fbdev->color_key = r;
+	  	 	osddev_set_colorkey(fb_info->node, fbdev->color->color_index, fbdev->color_key);
+			break;
+			default: break;
+	  	}
+	return count;
+}
+
+static ssize_t show_color_key(struct device *device, struct device_attribute *attr,
+			char *buf)
+{
+	struct fb_info *fb_info = dev_get_drvdata(device);
+	struct myfb_dev *fbdev = (struct myfb_dev *)fb_info->par;
+	return snprintf(buf, PAGE_SIZE, "0x%x\n", fbdev->color_key);
+}
+
+static ssize_t store_enable_key(struct device *device, struct device_attribute *attr,
+			 const char *buf, size_t count)
+{
+	struct fb_info *fb_info = dev_get_drvdata(device);
+	struct myfb_dev *fbdev = (struct myfb_dev *)fb_info->par;
+	int r = simple_strtoul(buf, NULL, 0);
+
+	mutex_lock(&fbdev->lock);
+
+	if (r != 0) {
+		fbdev->enable_key_flag |= KEYCOLOR_FLAG_TARGET;
+		if (!(fbdev->enable_key_flag & KEYCOLOR_FLAG_ONHOLD)) {
+			osddev_srckey_enable(fb_info->node, 1);
+			fbdev->enable_key_flag |= KEYCOLOR_FLAG_CURRENT;
+		}
+	} else {
+		fbdev->enable_key_flag &= ~(KEYCOLOR_FLAG_TARGET | KEYCOLOR_FLAG_CURRENT);
+		osddev_srckey_enable(fb_info->node, 0);
+	}
+
+	mutex_unlock(&fbdev->lock);
+
+	return count;
+}
+
+static ssize_t show_enable_key(struct device *device, struct device_attribute *attr,
+			char *buf)
+{
+	struct fb_info *fb_info = dev_get_drvdata(device);
+	struct myfb_dev *fbdev = (struct myfb_dev *)fb_info->par;
+	return snprintf(buf, PAGE_SIZE, (fbdev->enable_key_flag & KEYCOLOR_FLAG_TARGET) ? "1\n" : "0\n");
+}
+
+static ssize_t store_enable_key_onhold(struct device *device, struct device_attribute *attr,
+			 const char *buf, size_t count)
+{
+	struct fb_info *fb_info = dev_get_drvdata(device);
+	struct myfb_dev *fbdev = (struct myfb_dev *)fb_info->par;
+	int r = simple_strtoul(buf, NULL, 0);
+
+	mutex_lock(&fbdev->lock);
+
+	if (r != 0) {
+		/* hold all the calls to enable color key */
+		fbdev->enable_key_flag |= KEYCOLOR_FLAG_ONHOLD;
+		fbdev->enable_key_flag &= ~KEYCOLOR_FLAG_CURRENT;
+		osddev_srckey_enable(fb_info->node, 0);
+
+	} else {
+		fbdev->enable_key_flag &= ~KEYCOLOR_FLAG_ONHOLD;
+
+		/* if target and current mistach then recover the pending key settings */
+		if (fbdev->enable_key_flag & KEYCOLOR_FLAG_TARGET) {
+			if ((fbdev->enable_key_flag & KEYCOLOR_FLAG_CURRENT) == 0) {
+				fbdev->enable_key_flag |= KEYCOLOR_FLAG_CURRENT;
+				osddev_srckey_enable(fb_info->node, 1);
+			}
+		} else {
+			if (fbdev->enable_key_flag & KEYCOLOR_FLAG_CURRENT) {
+				fbdev->enable_key_flag &= ~KEYCOLOR_FLAG_CURRENT;
+				osddev_srckey_enable(fb_info->node, 0);
+			}
+		}
+	}
+
+	mutex_unlock(&fbdev->lock);
+
+	return count;
+}
+
+static ssize_t show_enable_key_onhold(struct device *device, struct device_attribute *attr,
+			char *buf)
+{
+	struct fb_info *fb_info = dev_get_drvdata(device);
+	struct myfb_dev *fbdev = (struct myfb_dev *)fb_info->par;
+	return snprintf(buf, PAGE_SIZE, (fbdev->enable_key_flag & KEYCOLOR_FLAG_ONHOLD) ? "1\n" : "0\n");
+}
+
+
+static int parse_para(const char *para, int para_num, int *result)
+{
+	char *endp;
+	const char *startp = para;
+	int *out = result;
+	int len = 0, count = 0;
+
+	if (!startp)
+		return 0;
+
+	len = strlen(startp);
+
+	do {
+		while (startp && (isspace(*startp) || !isgraph(*startp)) && len) {
+			startp++;
+			len--;
+		}
+
+		if (len == 0)
+			break;
+
+		*out++ = simple_strtol(startp, &endp, 0);
+
+		len -= endp - startp;
+		startp = endp;
+		count++;
+
+	} while ((endp) && (count < para_num) && (len > 0));
+
+	return count;
+}
+static ssize_t show_request_2xscale(struct device *device, struct device_attribute *attr,
+			 char *buf)
+{
+	memcpy(buf,request2XScaleValue,32);
+    return 32;
+}
+
+static ssize_t store__request_2xscale(struct device *device, struct device_attribute *attr,
+			 const char *buf, size_t count)
+{
+	memset(request2XScaleValue,0,32);
+	memcpy(request2XScaleValue,buf,count);
+    return count;
+}
+
+static ssize_t  show_video_hole(struct device *device, struct device_attribute *attr,
+			 char *buf)
+{
+	memcpy(buf,videohole,32);
+    return 32;
+}
+
+static ssize_t store__video_hole(struct device *device, struct device_attribute *attr,
+			 const char *buf, size_t count)
+{
+	memset(videohole,0,32);
+	memcpy(videohole,buf,count);
+    return count;
+}
+
+
+static ssize_t show_free_scale_axis(struct device *device, struct device_attribute *attr,
+			 char *buf)
+{
+	struct fb_info *fb_info = dev_get_drvdata(device);
+	int x, y, w, h;
+
+	osddev_get_free_scale_axis(fb_info->node, &x, &y, &w, &h);
+
+    return snprintf(buf, PAGE_SIZE, "%d %d %d %d\n", x, y, w, h);
+}
+
+static ssize_t store_free_scale_axis(struct device *device, struct device_attribute *attr,
+			 const char *buf, size_t count)
+{
+	struct fb_info *fb_info = dev_get_drvdata(device);
+	int parsed[4];
+
+	if (likely(parse_para(buf, 4, parsed) == 4)) {
+		osddev_set_free_scale_axis(fb_info->node, parsed[0], parsed[1], parsed[2], parsed[3]);
+	} else {
+		amlog_level(LOG_LEVEL_HIGH, "set free scale axis error\n");
+	}
+
+	return count;
+}
+
+static ssize_t show_scale_axis(struct device *device, struct device_attribute *attr,
+			 char *buf)
+{
+	struct fb_info *fb_info = dev_get_drvdata(device);
+	int x0, y0, x1, y1;
+
+	osddev_get_scale_axis(fb_info->node, &x0, &y0, &x1, &y1);
+
+    return snprintf(buf, PAGE_SIZE, "%d %d %d %d\n", x0, y0, x1, y1);
+}
+
+static ssize_t store_scale_axis(struct device *device, struct device_attribute *attr,
+			 const char *buf, size_t count)
+{
+	struct fb_info *fb_info = dev_get_drvdata(device);
+	int parsed[4];
+
+	if (likely(parse_para(buf, 4, parsed) == 4)) {
+		osddev_set_scale_axis(fb_info->node, parsed[0], parsed[1], parsed[2], parsed[3]);
+	} else {
+		amlog_level(LOG_LEVEL_HIGH, "set scale axis error\n");
+	}
+
+	return count;
+}
+
+static ssize_t store_scale_width(struct device *device, struct device_attribute *attr,
+			 const char *buf, size_t count)
+{
+	struct fb_info *fb_info = dev_get_drvdata(device);
+	unsigned int free_scale_width=0;
+    
+	free_scale_width= simple_strtoul(buf, NULL, 0);
+	osddev_free_scale_width(fb_info->node, free_scale_width);
+
+	return count;
+}
+
+static ssize_t show_scale_width(struct device *device, struct device_attribute *attr,
+			  char *buf)
+{
+	struct fb_info *fb_info = dev_get_drvdata(device);
+	unsigned int free_scale_width=0;
+
+	osddev_get_free_scale_width(fb_info->node, &free_scale_width);
+	return snprintf(buf, PAGE_SIZE, "free_scale_width:%d\n",free_scale_width);
+	
+}
+
+static ssize_t store_scale_height(struct device *device, struct device_attribute *attr,
+			 const char *buf, size_t count)
+{
+	struct fb_info *fb_info = dev_get_drvdata(device);
+	unsigned int free_scale_height=0;
+
+	free_scale_height= simple_strtoul(buf, NULL, 0);
+	osddev_free_scale_height(fb_info->node, free_scale_height);
+
+	return count;
+}
+
+static ssize_t show_scale_height(struct device *device, struct device_attribute *attr,
+			  char *buf)
+{
+	struct fb_info *fb_info = dev_get_drvdata(device);
+	unsigned int free_scale_height=0;
+
+	osddev_get_free_scale_height(fb_info->node, &free_scale_height);
+	return snprintf(buf, PAGE_SIZE, "free_scale_height:%d\n",free_scale_height);
+}
+
+static ssize_t store_free_scale(struct device *device, struct device_attribute *attr,
+			 const char *buf, size_t count)
+{
+	struct fb_info *fb_info = dev_get_drvdata(device);
+	unsigned int free_scale_enable=0;
+
+	free_scale_enable= simple_strtoul(buf, NULL, 0);
+	osddev_free_scale_enable(fb_info->node, free_scale_enable);
+
+	return count;
+}
+
+static ssize_t show_free_scale(struct device *device, struct device_attribute *attr,
+			 char *buf)
+{
+	struct fb_info *fb_info = dev_get_drvdata(device);
+	unsigned int free_scale_enable=0;
+
+	osddev_get_free_scale_enable(fb_info->node, &free_scale_enable);
+	return snprintf(buf, PAGE_SIZE, "free_scale_enable:[0x%x]\n",free_scale_enable);
+}
+
+static ssize_t store_freescale_mode(struct device *device, struct device_attribute *attr,
+			 const char *buf, size_t count)
+{
+	struct fb_info *fb_info = dev_get_drvdata(device);
+	unsigned int free_scale_mode=0;
+    
+	free_scale_mode= simple_strtoul(buf, NULL, 0);
+	osddev_free_scale_mode(fb_info->node, free_scale_mode);
+
+	return count;
+}
+
+static ssize_t show_freescale_mode(struct device *device, struct device_attribute *attr,
+			 char *buf)
+{
+	struct fb_info *fb_info = dev_get_drvdata(device);
+	unsigned int free_scale_mode=0;
+	char *help_info = "free scale mode:\n"\
+						"    0: VPU free scaler\n" \
+						"    1: OSD free scaler\n" \
+						"    2: OSD super scaler\n";
+
+	osddev_get_free_scale_mode(fb_info->node, &free_scale_mode);
+
+	return snprintf(buf, PAGE_SIZE, "%scurrent free_scale_mode:%d\n", help_info, free_scale_mode);
+}
+
+static ssize_t store_scale(struct device *device, struct device_attribute *attr,
+			 const char *buf, size_t count)
+{
+	struct fb_info *fb_info = dev_get_drvdata(device);
+	struct myfb_dev *fbdev = (struct myfb_dev *)fb_info->par;
+
+	fbdev->scale = simple_strtoul(buf, NULL, 0);
+	osddev_set_2x_scale(fb_info->node,fbdev->scale&0xffff0000?1:0,fbdev->scale&0xffff?1:0);
+
+	return count;
+}
+
+static ssize_t show_scale(struct device *device, struct device_attribute *attr,
+			char *buf)
+{
+	struct fb_info *fb_info = dev_get_drvdata(device);
+	struct myfb_dev *fbdev = (struct myfb_dev *)fb_info->par;
+	return snprintf(buf, PAGE_SIZE, "scale:[0x%x]\n",fbdev->scale);
+}
+
+static ssize_t show_window_axis(struct device *device, struct device_attribute *attr,
+			char *buf)
+{
+	struct fb_info *fb_info = dev_get_drvdata(device);
+	int x0, y0, x1, y1;
+
+	osddev_get_window_axis(fb_info->node, &x0, &y0, &x1, &y1);
+
+	return snprintf(buf, PAGE_SIZE, "window axis is [%d %d %d %d]\n", x0, y0, x1, y1);
+}
+
+static ssize_t store_window_axis(struct device *device, struct device_attribute *attr,
+			 const char *buf, size_t count)
+{
+	struct fb_info *fb_info = dev_get_drvdata(device);
+	s32 parsed[4];
+
+	if (likely(parse_para(buf, 4, parsed) == 4)) {
+		osddev_set_window_axis(fb_info->node, parsed[0], parsed[1], parsed[2], parsed[3]);
+	} else {
+		amlog_level(LOG_LEVEL_HIGH, "set window axis error\n");
+	}
+
+	return count;
+}
+
+
+static ssize_t store_osd_info(struct device *device, struct device_attribute *attr,
+			 const char *buf, size_t count)
+{
+	struct fb_info *fb_info = dev_get_drvdata(device);
+	int osd_val[3][4] = {}; unsigned int osd_reg[2][5] = {}; int osd_info_flag = 0;
+
+	if (NULL != buf) {
+		if(strncmp(buf, "val", 3) == 0){
+			osd_info_flag = 0;
+		}else if(strncmp(buf, "reg", 3) == 0){
+			osd_info_flag = 1;
+		}else{
+			osd_info_flag = 2;
+		}
+		osddev_get_osd_info(fb_info->node, osd_val, osd_reg, osd_info_flag);
+	} else {
+		amlog_level(LOG_LEVEL_HIGH, "set store_osd_info *buf* is NULL error\n");
+	}
+	
+	if (osd_info_flag == 0){
+		amlog_level(LOG_LEVEL_HIGH, "pandata[%d].x_start :  %d\n"
+									  "pandata[%d].x_end   :  %d\n"
+									  "pandata[%d].y_start :  %d\n"
+									  "pandata[%d].y_end   :  %d\n",
+									fb_info->node, osd_val[0][0], fb_info->node, 
+									osd_val[0][1], fb_info->node, osd_val[0][2],
+									fb_info->node, osd_val[0][3]);
+		amlog_level(LOG_LEVEL_HIGH, "dispdata[%d].x_start :  %d\n"
+									  "dispdata[%d].x_end   :  %d\n"
+									  "dispdata[%d].y_start :  %d\n"
+									  "dispdata[%d].y_end   :  %d\n",
+									fb_info->node, osd_val[1][0], fb_info->node,
+									osd_val[1][1], fb_info->node, osd_val[1][2],
+									fb_info->node, osd_val[1][3]);
+		amlog_level(LOG_LEVEL_HIGH, "scaledata[%d].x_start :  %d\n"
+									  "scaledata[%d].x_end   :  %d\n"
+									  "scaledata[%d].y_start :  %d\n"
+									  "scaledata[%d].y_end   :  %d\n",
+									fb_info->node, osd_val[2][0], fb_info->node,
+									osd_val[2][1], fb_info->node, osd_val[2][2],
+									fb_info->node, osd_val[2][3]);
+	}else if(osd_info_flag == 1){
+		amlog_level(LOG_LEVEL_HIGH,  " [0x1a1b] : *0x%x*\n"
+									  " [0x1a1c] : *0x%x*\n"
+									  " [0x1a1d] : *0x%x*\n"
+									  " [0x1a1e] : *0x%x*\n"
+									  " [0x1a13] : *0x%x*\n",
+									osd_reg[0][0], osd_reg[0][1], osd_reg[0][2], osd_reg[0][3], osd_reg[0][4]);
+		amlog_level(LOG_LEVEL_HIGH, "  [0x1a3b] : *0x%x*\n"
+									 "  [0x1a3c] : *0x%x*\n"
+									 "  [0x1a3d] : *0x%x*\n"
+									 "  [0x1a3e] : *0x%x*\n"
+									 "  [0x1a64] : *0x%x*\n",
+									osd_reg[1][0], osd_reg[1][1], osd_reg[1][2], osd_reg[1][3], osd_reg[1][4]);
+	}else if(osd_info_flag == 2){
+		amlog_level(LOG_LEVEL_HIGH, "set store_osd_info osd_info_flag is error\n");
+	}
+	
+	return count;
+}
+
+static ssize_t store_order(struct device *device, struct device_attribute *attr,
+			 const char *buf, size_t count)
+{
+	struct fb_info *fb_info = dev_get_drvdata(device);
+	struct myfb_dev *fbdev = (struct myfb_dev *)fb_info->par;
+
+	fbdev->order = simple_strtoul(buf, NULL, 0);
+	osddev_change_osd_order(fb_info->node, fbdev->order);
+
+	return count;
+}
+
+static ssize_t show_order(struct device *device, struct device_attribute *attr,
+			char *buf)
+{
+	struct fb_info *fb_info = dev_get_drvdata(device);
+	struct myfb_dev *fbdev = (struct myfb_dev *)fb_info->par;
+
+	fbdev->order = osddev_get_osd_order(fb_info->node);
+
+	return snprintf(buf, PAGE_SIZE, "order:[0x%x]\n",fbdev->order);
+}
+
+static ssize_t show_block_windows(struct device *device, struct device_attribute *attr,
+			 char *buf)
+{
+	struct fb_info *fb_info = dev_get_drvdata(device);
+	u32 wins[8];
+
+	osddev_get_block_windows(fb_info->node, wins);
+
+    return snprintf(buf, PAGE_SIZE, "0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", 
+			wins[0], wins[1], wins[2], wins[3], wins[4], wins[5], wins[6], wins[7]);
+}
+
+static ssize_t store_block_windows(struct device *device, struct device_attribute *attr,
+			 const char *buf, size_t count)
+{
+	struct fb_info *fb_info = dev_get_drvdata(device);
+	int parsed[8];
+
+	if (likely(parse_para(buf, 8, parsed) == 8)) {
+		osddev_set_block_windows(fb_info->node, parsed);
+	} else {
+		amlog_level(LOG_LEVEL_HIGH, "set block windows error\n");
+	}
+
+	return count;
+}
+
+static ssize_t show_block_mode(struct device *device, struct device_attribute *attr,
+			 char *buf)
+{
+	struct fb_info *fb_info = dev_get_drvdata(device);
+	u32 mode;
+
+	osddev_get_block_mode(fb_info->node, &mode);
+
+    return snprintf(buf, PAGE_SIZE, "0x%x\n", mode);
+}
+
+static ssize_t store_block_mode(struct device *device, struct device_attribute *attr,
+			 const char *buf, size_t count)
+{
+	struct fb_info *fb_info = dev_get_drvdata(device);
+	u32 mode;
+
+	mode = simple_strtoul(buf, NULL, 0);
+	osddev_set_block_mode(fb_info->node, mode);
+
+	return count;
+}
+
+static ssize_t show_flush_rate(struct device *device, struct device_attribute *attr,
+			 char *buf)
+{
+	u32 flush_rate = 0;
+	osddev_get_flush_rate(&flush_rate);
+	return snprintf(buf, PAGE_SIZE, "flush_rate:[%d]\n", flush_rate);
+}
+
+static ssize_t show_osd_reverse(struct device *device, struct device_attribute *attr,
+			char *buf)
+{
+	struct fb_info *fb_info = dev_get_drvdata(device);
+	unsigned int osd_reverse = 0;
+
+	osddev_get_osd_reverse(fb_info->node, &osd_reverse);
+	return snprintf(buf, PAGE_SIZE, "osd_reverse:[%s]\n", osd_reverse?"TRUE":"FALSE");
+}
+
+static ssize_t store_osd_reverse(struct device *device, struct device_attribute *attr,
+			 const char *buf, size_t count)
+{
+	struct fb_info *fb_info = dev_get_drvdata(device);
+	unsigned int osd_reverse = 0;
+
+	osd_reverse = simple_strtoul(buf, NULL, 0);
+	osddev_set_osd_reverse(fb_info->node, osd_reverse);
+
+	return count;
+}
+static ssize_t show_rotate_on(struct device *device, struct device_attribute *attr,
+                        char *buf)
+{
+        struct fb_info *fb_info = dev_get_drvdata(device);
+        unsigned int osd_rotate = 0;
+
+        osddev_get_osd_rotate_on(fb_info->node, &osd_rotate);
+        return snprintf(buf, PAGE_SIZE, "osd_rotate:[%s]\n", osd_rotate?"ON":"OFF");
+}
+
+static ssize_t store_rotate_on(struct device *device, struct device_attribute *attr,
+                         const char *buf, size_t count)
+{
+        struct fb_info *fb_info = dev_get_drvdata(device);
+        unsigned int osd_rotate = 0;
+
+        osd_rotate = simple_strtoul(buf, NULL, 0);
+        osddev_set_osd_rotate_on(fb_info->node, osd_rotate);
+
+        return count;
+}
+
+static ssize_t show_prot_state(struct device *device, struct device_attribute *attr,
+                        char *buf)
+{
+	int pos=0;
+	unsigned int osd_rotate = 0;
+	struct fb_info *fb_info = dev_get_drvdata(device);
+
+	osddev_get_osd_rotate_on(fb_info->node, &osd_rotate);
+	pos += snprintf(buf+pos, PAGE_SIZE, "%d", osd_rotate);
+	return pos;
+}
+
+static ssize_t show_rotate_angle(struct device *device, struct device_attribute *attr,
+                        char *buf)
+{
+        struct fb_info *fb_info = dev_get_drvdata(device);
+        unsigned int osd_rotate_angle = 0;
+                
+        osddev_get_osd_rotate_angle(fb_info->node, &osd_rotate_angle);
+        return snprintf(buf, PAGE_SIZE, "osd_rotate:%d\n", osd_rotate_angle);
+}
+
+static ssize_t store_rotate_angle(struct device *device, struct device_attribute *attr,
+                         const char *buf, size_t count)
+{
+        struct fb_info *fb_info = dev_get_drvdata(device);
+        unsigned int osd_rotate_angle = 0;
+
+        osd_rotate_angle = simple_strtoul(buf, NULL, 0);
+        osddev_set_osd_rotate_angle(fb_info->node, osd_rotate_angle);
+
+        return count;
+}
+
+static ssize_t show_prot_canvas(struct device *device, struct device_attribute *attr,
+			char *buf)
+{
+	struct fb_info *fb_info = dev_get_drvdata(device);
+	int x_start, y_start, x_end, y_end;
+
+	osddev_get_prot_canvas(fb_info->node, &x_start, &y_start, &x_end, &y_end);
+
+	return snprintf(buf, PAGE_SIZE, "%d %d %d %d\n", x_start, y_start, x_end, y_end);
+}
+
+static ssize_t store_prot_canvas(struct device *device, struct device_attribute *attr,
+                         const char *buf, size_t count)
+{
+	struct fb_info *fb_info = dev_get_drvdata(device);
+	int parsed[4];
+
+	if (likely(parse_para(buf, 4, parsed) == 4)) {
+		osddev_set_prot_canvas(fb_info->node, parsed[0], parsed[1], parsed[2], parsed[3]);
+	} else {
+		amlog_level(LOG_LEVEL_HIGH, "set prot canvas error\n");
+	}
+
+	return count;
+}
+
+static ssize_t show_antiflicker(struct device *device, struct device_attribute *attr,
+                        char *buf)
+{
+	unsigned int osd_antiflicker = 0;
+	struct fb_info *fb_info = dev_get_drvdata(device);
+
+	osddev_get_osd_antiflicker(fb_info->node, &osd_antiflicker);
+	return snprintf(buf, PAGE_SIZE, "osd_antifliter:[%s]\n", osd_antiflicker?"ON":"OFF");
+}
+
+static ssize_t store_antiflicker(struct device *device, struct device_attribute *attr,
+                         const char *buf, size_t count)
+{
+	const vinfo_t *vinfo;
+	unsigned int osd_antiflicker = 0;
+	struct fb_info *fb_info = dev_get_drvdata(device);
+
+	osd_antiflicker = simple_strtoul(buf, NULL, 0);
+	vinfo = get_current_vinfo();
+
+	if(osd_antiflicker == 2){
+		osddev_set_osd_antiflicker(fb_info->node, osd_antiflicker, fb_info->var.yres);
+	}else{
+		osddev_set_osd_antiflicker(fb_info->node, vinfo->mode, fb_info->var.yres);
+	}
+
+	return count;
+}
+
+ static ssize_t show_update_freescale(struct device *device, struct device_attribute *attr,
+     char *buf)
+{
+  struct fb_info *fb_info = dev_get_drvdata(device);
+  unsigned int update_state = 0;
+  osddev_get_update_state(fb_info->node, &update_state);
+  return snprintf(buf, PAGE_SIZE, "update_state:[%s]\n", update_state?"TRUE":"FALSE");
+}
+
+static ssize_t store_update_freescale(struct device *device, struct device_attribute *attr,
+  const char *buf, size_t count)
+{
+  struct fb_info *fb_info = dev_get_drvdata(device);
+  unsigned int update_state = 0;
+  update_state = simple_strtoul(buf, NULL, 0);
+  osddev_set_update_state(fb_info->node, update_state);
+  return count;
+}
+static ssize_t show_ver_angle(struct device *device, struct device_attribute *attr,
+                        char *buf)
+{
+	unsigned int osd_angle = 0;
+	struct fb_info *fb_info = dev_get_drvdata(device);
+
+	osddev_get_osd_angle(fb_info->node, &osd_angle);
+	return snprintf(buf, PAGE_SIZE, "osd_angle:[%d]\n", osd_angle);
+}
+
+static ssize_t store_ver_angle(struct device *device, struct device_attribute *attr,
+                         const char *buf, size_t count)
+{
+	unsigned int osd_angle = 0;
+	struct fb_info *fb_info = dev_get_drvdata(device);
+
+	osd_angle = simple_strtoul(buf, NULL, 0);
+
+	memset((char*)fb_info->screen_base, 0x80, fb_info->screen_size);
+	osddev_set_osd_angle(fb_info->node, osd_angle, mydef_var[OSD1].yres, fb_info->var.yres);
+
+	return count;
+}
+
+static ssize_t show_ver_clone(struct device *device, struct device_attribute *attr,
+                        char *buf)
+{
+	unsigned int osd_clone = 0;
+	struct fb_info *fb_info = dev_get_drvdata(device);
+
+	osddev_get_osd_clone(fb_info->node, &osd_clone);
+	return snprintf(buf, PAGE_SIZE, "osd_clone:[%s]\n", osd_clone?"ON":"OFF");
+}
+
+static ssize_t store_ver_clone(struct device *device, struct device_attribute *attr,
+                         const char *buf, size_t count)
+{
+	unsigned int osd_clone = 0;
+	struct fb_info *fb_info = dev_get_drvdata(device);
+
+	osd_clone = simple_strtoul(buf, NULL, 0);
+
+	osddev_set_osd_clone(fb_info->node, osd_clone);
+
+	return count;
+}
+
+static ssize_t store_ver_update_pan(struct device *device, struct device_attribute *attr,
+                         const char *buf, size_t count)
+{
+	struct fb_info *fb_info = dev_get_drvdata(device);
+
+	osddev_set_osd_update_pan(fb_info->node);
+
+	return count;
+}
+
+static inline  int str2lower(char *str)
+{
+	while(*str != '\0')
+	{
+		*str= TOLOWER(*str);
+		str++;
+	}
+	return 0;
+}
+
+static inline int install_osd_reverse_info(osd_info_t *init_osd_info,char *para)
+{
+	static  para_osd_info_t para_osd_info[OSD_END+2]={
+//head
+	{"head",	OSD_INVALID_INFO,	OSD_END+1,						1,								0,								OSD_END+1},
+//dev
+	{"osd0",	DEV_OSD0,			OSD_FIRST_GROUP_START-1,	OSD_FIRST_GROUP_START+1,	OSD_FIRST_GROUP_START,		OSD_SECOND_GROUP_START-1},
+	{"osd1",	DEV_OSD1,			OSD_FIRST_GROUP_START,		OSD_FIRST_GROUP_START+2,	OSD_FIRST_GROUP_START,		OSD_SECOND_GROUP_START-1},
+	{"all",	DEV_ALL,			OSD_FIRST_GROUP_START+1,	OSD_FIRST_GROUP_START+3,	OSD_FIRST_GROUP_START,		OSD_SECOND_GROUP_START-1},
+//reverse_mode
+	{"true",	REVERSE_TRUE,		OSD_SECOND_GROUP_START-1,	OSD_SECOND_GROUP_START+1,	OSD_SECOND_GROUP_START,	OSD_END},
+	{"false",	REVERSE_FALSE,	OSD_SECOND_GROUP_START,	OSD_SECOND_GROUP_START+2,	OSD_SECOND_GROUP_START,	OSD_END},
+	{"tail",	OSD_INVALID_INFO,	OSD_END,						0,								0,								OSD_END+1},
+	};
+
+	u32 i = 0;
+	static u32 tail = OSD_END+1;
+	u32 first = para_osd_info[0].next_idx;
+
+	for(i=first; i<tail; i=para_osd_info[i].next_idx)
+	{
+		if(strcmp(para_osd_info[i].name,para)==0)
+		{
+			u32 group_start = para_osd_info[i].cur_group_start ;
+			u32 group_end = para_osd_info[i].cur_group_end;
+			u32	prev = para_osd_info[group_start].prev_idx;
+			u32  next = para_osd_info[group_end].next_idx;
+			switch(para_osd_info[i].cur_group_start)
+			{
+				case OSD_FIRST_GROUP_START:
+				init_osd_info->index = (osd_dev_t)para_osd_info[i].info;
+				break;
+				case OSD_SECOND_GROUP_START:
+				init_osd_info->osd_reverse = (reverse_info_t)para_osd_info[i].info;
+				break;
+			}
+			para_osd_info[prev].next_idx=next;
+			para_osd_info[next].prev_idx=prev;
+			return 0;
+		}
+	}
+
+	return 0;
+}
+
+/* --------------------------------------------------------------------------*/
+/**
+ * @brief  set_osd_reverse
+ *
+ * @param  str
+ *
+ * @return
+ */
+/* --------------------------------------------------------------------------*/
+static int __init osd_info_setup(char *str)
+{
+	char	*ptr=str;
+	char	sep[2];
+	char	*option;
+	int count=2;
+	char find=0;
+	osd_info_t *init_osd_info;
+
+	if(NULL==str){
+		return -EINVAL;
+	}
+
+	init_osd_info = &osd_info;
+	memset(init_osd_info,0,sizeof(osd_info_t));
+
+	do
+	{
+		if(!isalpha(*ptr)&&!isdigit(*ptr))
+		{
+			find=1;
+			break;
+		}
+	}while(*++ptr != '\0');
+
+	if(!find){
+		return -EINVAL;
+	}
+
+	sep[0]=*ptr; sep[1]='\0';
+
+	while((count--) && (option=strsep(&str, sep)))
+	{
+		str2lower(option);
+		install_osd_reverse_info(init_osd_info, option);
+	}
+
+	return 0;
+}
+
+__setup("osd_reverse=", osd_info_setup);
+
+static struct device_attribute osd_attrs[] = {
+	__ATTR(scale, S_IRUGO|S_IWUSR|S_IWGRP, show_scale, store_scale),
+	__ATTR(order, S_IRUGO|S_IWUSR|S_IWGRP, show_order, store_order),
+	__ATTR(enable_3d, S_IRUGO|S_IWUSR, show_enable_3d, store_enable_3d),
+	__ATTR(preblend_enable,S_IRUGO|S_IWUSR, show_preblend_enable, store_preblend_enable),
+	__ATTR(free_scale, S_IRUGO|S_IWUSR|S_IWGRP, show_free_scale, store_free_scale),
+	__ATTR(scale_axis, S_IRUGO|S_IWUSR, show_scale_axis, store_scale_axis),
+	__ATTR(scale_width, S_IRUGO|S_IWUSR|S_IWGRP, show_scale_width, store_scale_width),
+	__ATTR(scale_height, S_IRUGO|S_IWUSR|S_IWGRP, show_scale_height, store_scale_height),
+    __ATTR(color_key, S_IRUGO|S_IWUSR, show_color_key, store_color_key),
+    __ATTR(enable_key, S_IRUGO|S_IWUSR|S_IWGRP, show_enable_key, store_enable_key),
+    __ATTR(enable_key_onhold, S_IRUGO|S_IWUSR|S_IWGRP, show_enable_key_onhold, store_enable_key_onhold),
+	__ATTR(block_windows, S_IRUGO|S_IWUSR, show_block_windows, store_block_windows),
+	__ATTR(block_mode, S_IRUGO|S_IWUSR|S_IWGRP, show_block_mode, store_block_mode),
+	__ATTR(free_scale_axis, S_IRUGO|S_IWUSR|S_IWGRP, show_free_scale_axis, store_free_scale_axis),
+	__ATTR(request2XScale, S_IRUGO|S_IWUSR|S_IWGRP, show_request_2xscale, store__request_2xscale),
+	__ATTR(osd_info_msg, S_IRUGO|S_IWUSR, NULL, store_osd_info),
+	__ATTR(video_hole, S_IRUGO|S_IWUSR, show_video_hole, store__video_hole),
+	__ATTR(window_axis, S_IRUGO|S_IWUSR|S_IWGRP, show_window_axis, store_window_axis),
+	__ATTR(freescale_mode, S_IRUGO|S_IWUSR|S_IWGRP, show_freescale_mode, store_freescale_mode),
+	__ATTR(flush_rate, S_IRUGO|S_IWUSR, show_flush_rate, NULL),
+	__ATTR(prot_on, S_IRUGO|S_IWUSR|S_IWGRP, show_rotate_on, store_rotate_on),
+	__ATTR(prot_angle, S_IRUGO|S_IWUSR|S_IWGRP, show_rotate_angle, store_rotate_angle),
+	__ATTR(prot_canvas, S_IRUGO|S_IWUSR|S_IWGRP, show_prot_canvas, store_prot_canvas),
+	__ATTR(osd_reverse, S_IRUGO|S_IWUSR, show_osd_reverse, store_osd_reverse),
+	__ATTR(prot_state, S_IRUGO|S_IWUSR, show_prot_state, NULL),
+	__ATTR(osd_antiflicker, S_IRUGO|S_IWUSR, show_antiflicker, store_antiflicker),
+	__ATTR(update_freescale, S_IRUGO|S_IWUSR, show_update_freescale, store_update_freescale),
+	__ATTR(ver_angle, S_IRUGO|S_IWUSR, show_ver_angle, store_ver_angle),
+	__ATTR(ver_clone, S_IRUGO|S_IWUSR, show_ver_clone, store_ver_clone),
+	__ATTR(ver_update_pan, S_IRUGO|S_IWUSR, NULL, store_ver_update_pan),
+};		
+
+#ifdef  CONFIG_PM
+static int osd_suspend(struct platform_device *dev, pm_message_t state)
+{
+#ifdef CONFIG_HAS_EARLYSUSPEND
+    if (early_suspend_flag)
+        return 0;
+#endif
+       osddev_suspend();
+       return 0;
+}
+
+static int osd_resume(struct platform_device * dev)
+{
+#ifdef CONFIG_SCREEN_ON_EARLY
+	if (early_resume_flag) {
+		early_resume_flag = 0;
+		return 0;
+	}
+#endif
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+    if (early_suspend_flag)
+        return 0;
+#endif
+       osddev_resume();
+       return 0;
+}
+#endif 
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+static void osd_early_suspend(struct early_suspend *h)
+{
+    if (early_suspend_flag)
+        return;
+    //osd_suspend(NULL,PMSG_SUSPEND);
+    osddev_suspend();
+    early_suspend_flag = 1;
+}
+
+static void osd_late_resume(struct early_suspend *h)
+{
+    if (!early_suspend_flag)
+        return;
+    early_suspend_flag = 0;
+    //osd_resume(NULL);
+    osddev_resume();
+}
+#endif
+
+#ifdef CONFIG_SCREEN_ON_EARLY
+void osd_resume_early(void)
+{
+#ifdef CONFIG_HAS_EARLYSUSPEND
+	osddev_resume();
+	early_suspend_flag = 0;
+#endif
+	early_resume_flag = 1;
+	return ;
+}
+EXPORT_SYMBOL(osd_resume_early);
+#endif
+
+static struct resource memobj;
+static int 
+osd_probe(struct platform_device *pdev)
+{
+#ifdef CONFIG_AM_HDMI_ONLY
+	extern int read_hpd_gpio(void);
+#endif
+	int r;
+	int ret;
+    struct fb_info *fbi=NULL;
+	const vinfo_t *vinfo;
+    struct fb_var_screeninfo *var;
+  	struct fb_fix_screeninfo *fix;
+	struct resource *mem;
+	int  index,Bpp;
+	logo_object_t  *init_logo_obj=NULL;
+	int  logo_osd_index=0,i;
+	myfb_dev_t 	*fbdev = NULL;
+	vmode_t current_mode = VMODE_MASK;
+#ifdef CONFIG_AM_HDMI_ONLY
+	vmode_t cvbs_mode = VMODE_MASK;
+	int hpd_state = 0;
+#endif
+	const void *prop;
+	int prop_idx=0;
+	int rotation = 0;
+	
+	vout_register_client(&osd_notifier_nb);
+
+#ifdef CONFIG_AM_LOGO
+	init_logo_obj = get_current_logo_obj();
+	if( init_logo_obj )
+	{
+		if(init_logo_obj->para.output_dev_type<LOGO_DEV_VID) //osd0 or osd1
+		{
+			logo_osd_index = init_logo_obj->para.output_dev_type;
+		}else{
+			if(init_logo_obj->para.output_dev_type==LOGO_DEV_VID)
+			init_logo_obj=NULL; //if logo device on video layer ,
+		}					 //we cant use it .
+	}
+#endif
+
+	{
+		prop = of_get_property(pdev->dev.of_node, "scale_mode", NULL);
+		if(prop){
+			prop_idx = of_read_ulong(prop, 1);
+		}
+		osddev_free_scale_mode(OSD0, prop_idx);
+
+		prop = of_get_property(pdev->dev.of_node, "4k2k_fb", NULL);
+		if(prop){
+			prop_idx = of_read_ulong(prop, 1);
+		}
+		osddev_4k2k_fb_mode(prop_idx);
+	}
+
+	if (NULL==init_logo_obj )
+	{
+    		prop = of_get_property(pdev->dev.of_node, "vmode", NULL);
+		if(prop){
+			prop_idx = of_read_ulong(prop,1);
+		}
+
+		if(prop_idx == 3){
+			if(get_current_mode_state() == VMODE_SETTED){
+				amlog_level(LOG_LEVEL_HIGH,"vmode has setted in aml logo module\r\n");
+			}else{
+				DisableVideoLayer();
+				#ifdef CONFIG_AM_HDMI_ONLY
+					hpd_state = read_hpd_gpio();
+					cvbs_mode = get_current_cvbs_vmode();
+					current_mode = get_current_hdmi_vmode();
+
+					if (hpd_state == 0)
+						set_current_vmode(cvbs_mode);
+					else
+						set_current_vmode(current_mode);
+				#else
+					current_mode = get_resolution_vmode();
+					set_current_vmode(current_mode);
+				#endif
+			}
+		}
+		else if(prop_idx == 1){
+			current_mode = VMODE_LCD;
+			set_current_vmode(VMODE_LCD);
+		}
+		else if(prop_idx == 2){
+			current_mode = VMODE_LVDS_1080P;
+			set_current_vmode(VMODE_LVDS_1080P);
+		}
+		osddev_init();
+    	}
+	vinfo = get_current_vinfo();
+	printk("%s, vinfo:%p\n", __func__, vinfo);
+
+    	for (index=0;index<OSD_COUNT;index++)
+    	{
+#if 0
+    		//platform resource 
+		if (!(mem = platform_get_resource(pdev, IORESOURCE_MEM, index)))
+		{
+			amlog_level(LOG_LEVEL_HIGH,"No frame buffer memory define.\n");
+			r = -EFAULT;
+			goto failed2;
+		}
+
+		//if we have no resource then no need to create this device.
+		amlog_level(LOG_LEVEL_HIGH,"[osd%d] 0x%x-0x%x\n",index,mem->start,mem->end);
+		if (!mem || mem->start== 0 || mem->end==0 || mem->start==mem->end)
+		{
+			continue ;
+		}
+#else
+		mem = &memobj;
+		ret = find_reserve_block(pdev->dev.of_node->name,index);
+		if(ret < 0){
+			amlog_level(LOG_LEVEL_HIGH,"can not find %s%d reserve block\n",pdev->dev.of_node->name,index);
+			r = -EFAULT;
+			goto failed2;
+		}
+
+		mem->start = (phys_addr_t)get_reserve_block_addr(ret);
+		mem->end = mem->start+ (phys_addr_t)get_reserve_block_size(ret)-1;
+#endif
+		fbi = framebuffer_alloc(sizeof(struct myfb_dev), &pdev->dev);
+		if(!fbi){
+			r = -ENOMEM;
+			goto failed1;
+		}
+
+		fbdev = (struct myfb_dev *)fbi->par;
+		fbdev->fb_info = fbi;
+		fbdev->dev = pdev;
+
+		mutex_init(&fbdev->lock);
+
+    		var = &fbi->var;
+    		fix = &fbi->fix;
+
+		gp_fbdev_list[index]=fbdev;
+		fbdev->fb_mem_paddr = mem->start;
+		fbdev->fb_len = mem->end - mem->start + 1;
+		fbdev->fb_mem_vaddr = ioremap_wc(fbdev->fb_mem_paddr, fbdev->fb_len);
+
+		if (!fbdev->fb_mem_vaddr)
+		{
+			amlog_level(LOG_LEVEL_HIGH,"failed to ioremap framebuffer\n");
+			r = -ENOMEM;
+			goto failed1;
+		}
+	
+		//clear framebuffer memory
+		amlog_level(LOG_LEVEL_HIGH,"Frame buffer memory assigned at phy:0x%08x, vir:0x%p, size=%dK\n",
+	    	fbdev->fb_mem_paddr, fbdev->fb_mem_vaddr, fbdev->fb_len >> 10);
+		printk("%s, mydef_var:%p, vinfo:%p\n", __func__, mydef_var, vinfo);
+
+		mydef_var[index].width=vinfo->screen_real_width;
+		mydef_var[index].height=vinfo->screen_real_height;
+		if( init_logo_obj && index==logo_osd_index ) //adjust default var info
+		{
+			int  bpp=init_logo_obj->dev->output_dev.osd.color_depth;//bytes per pixel
+			printk("don't find to display_size_default from mesonfb-dts\n");
+			mydef_var[index].xres=init_logo_obj->dev->vinfo->width;
+			mydef_var[index].yres=init_logo_obj->dev->vinfo->height;	
+			mydef_var[index].xres_virtual=init_logo_obj->dev->vinfo->width;
+			mydef_var[index].yres_virtual=init_logo_obj->dev->vinfo->height<<1;//logo always use double buffer
+			mydef_var[index].bits_per_pixel=bpp;
+			
+			amlog_level(LOG_LEVEL_HIGH,"init fbdev bpp is :%d\r\n",mydef_var[index].bits_per_pixel);
+			if(mydef_var[index].bits_per_pixel>32){
+				mydef_var[index].bits_per_pixel=32;
+			}
+		} else {
+			if (index == OSD0){
+				ret = of_property_read_u32_array(pdev->dev.of_node, "display_size_default", &var_screeninfo[0], 5);
+				if(ret){
+					printk("don't find to display_size_default from mesonfb-dts\n");
+				}
+				else {			
+					int  bpp=var_screeninfo[4];//bytes per pixel
+					mydef_var[index].xres=var_screeninfo[0];
+					mydef_var[index].yres=var_screeninfo[1];	
+					mydef_var[index].xres_virtual=var_screeninfo[2];
+					mydef_var[index].yres_virtual=var_screeninfo[3];//logo always use double buffer
+					mydef_var[index].bits_per_pixel=bpp;
+				
+					amlog_level(LOG_LEVEL_HIGH,"init fbdev bpp is :%d\r\n",mydef_var[index].bits_per_pixel);
+					if(mydef_var[index].bits_per_pixel>32) 
+					{
+						mydef_var[index].bits_per_pixel=32;
+					}
+				}
+			}
+			amlog_level(LOG_LEVEL_HIGH,"---------------clear framebuffer%d memory  \r\n",index);
+			memset((char*)fbdev->fb_mem_vaddr, 0x00, fbdev->fb_len);
+		}
+
+		if (index == OSD0){
+			prop = of_get_property(pdev->dev.of_node, "rotation", NULL);
+			if(prop)
+				prop_idx = of_read_ulong(prop,1);
+
+			rotation = prop_idx;
+		}
+		_fbdev_set_default(fbdev,index);
+		if(NULL==fbdev->color)
+		{
+			r = -ENOENT;
+			goto failed1;
+		}
+
+		Bpp=(fbdev->color->color_index >8?(fbdev->color->color_index>16?(fbdev->color->color_index>24?4:3):2):1);
+		fix->line_length=var->xres_virtual*Bpp;
+		fix->smem_start = fbdev->fb_mem_paddr;
+		fix->smem_len = fbdev->fb_len;
+		if (fb_alloc_cmap(&fbi->cmap, 16, 0) != 0) {
+			amlog_level(LOG_LEVEL_HIGH,"unable to allocate color map memory\n");
+			r = -ENOMEM;
+			goto failed2;
+    		}
+
+		if (!(fbi->pseudo_palette = kmalloc(sizeof(u32) * 16, GFP_KERNEL))) {
+			amlog_level(LOG_LEVEL_HIGH,"unable to allocate pseudo palette memory\n");
+			r = -ENOMEM;
+			goto failed2;
+		}
+		memset(fbi->pseudo_palette, 0, sizeof(u32) * 16);
+
+	   	fbi->fbops = &osd_ops;
+    		fbi->screen_base = (char __iomem *)fbdev->fb_mem_vaddr ;
+		fbi->screen_size = fix->smem_len;
+		set_default_display_axis(&fbdev->fb_info->var,&fbdev->osd_ctl,vinfo);
+		osd_check_var(var, fbi);
+    		register_framebuffer(fbi);
+		if(index == OSD0 && init_logo_obj != NULL)
+		{
+			osddev_set(fbdev);
+		}
+		else if(NULL==init_logo_obj)//if we have init a logo object ,then no need to setup hardware .
+		{
+			osddev_set(fbdev);
+		}
+
+		if(index == OSD0 && (rotation == 90 || rotation == 270)){
+			osddev_set(fbdev);
+		}
+		for(i=0;i<ARRAY_SIZE(osd_attrs);i++)
+		r=device_create_file(fbi->dev, &osd_attrs[i]);
+		
+   	}	
+
+	index=0;
+#ifdef CONFIG_HAS_EARLYSUSPEND
+	early_suspend.level = EARLY_SUSPEND_LEVEL_STOP_DRAWING;
+	early_suspend.suspend = osd_early_suspend;
+	early_suspend.resume = osd_late_resume;
+	register_early_suspend(&early_suspend);
+#endif
+	if (rotation == 90 || rotation == 270){
+		osddev_set_prot_canvas(0, 0,0,var_screeninfo[0]-1,var_screeninfo[1]-1);
+		if(rotation == 90){
+			osddev_set_osd_rotate_angle(0, 1);
+		}
+		else{
+			osddev_set_osd_rotate_angle(0, 2);
+			osddev_set_osd_rotate_on(0, 1);
+		}
+	}
+
+	if (osd_info.index == DEV_ALL){
+		osddev_set_osd_reverse(0, osd_info.osd_reverse);
+		osddev_set_osd_reverse(1, osd_info.osd_reverse);
+	}else{
+		osddev_set_osd_reverse(osd_info.index, osd_info.osd_reverse);
+	}
+	amlog_level(LOG_LEVEL_HIGH,"osd probe ok  \r\n");
+	return 0;
+
+failed2:
+	fb_dealloc_cmap(&fbi->cmap);
+failed1:
+    	amlog_level(LOG_LEVEL_HIGH,"Driver module insert failed.\n");
+   	return r;
+}
+
+static int
+osd_remove(struct platform_device *pdev)
+{
+   	struct fb_info *fbi;
+	int i=0;
+
+    	amlog_level(LOG_LEVEL_HIGH,"osd_remove.\n");
+	if (!pdev)
+		return -ENODEV;
+
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+    unregister_early_suspend(&early_suspend);
+#endif
+	
+	vout_unregister_client(&osd_notifier_nb);
+	
+	
+	for(i=0;i<OSD_COUNT;i++)
+	{
+		int j;
+		
+		if(gp_fbdev_list[i])
+		{
+			myfb_dev_t * fbdev=gp_fbdev_list[i];
+
+			fbi = fbdev->fb_info;
+			for(j=0;j<ARRAY_SIZE(osd_attrs);j++)
+			device_remove_file(fbi->dev, &osd_attrs[j]);
+			iounmap(fbdev->fb_mem_vaddr);
+      			kfree(fbi->pseudo_palette);
+     			fb_dealloc_cmap(&fbi->cmap);
+         		unregister_framebuffer(fbi);
+			framebuffer_release(fbi);
+		}
+	}
+	return 0;
+}
+
+#ifndef MODULE
+
+/* Process kernel command line parameters */
+static int __init
+osd_setup_attribute(char *options)
+{
+    char *this_opt = NULL;
+    int r = 0;
+
+    if (!options || !*options)
+        goto exit;
+
+    while (!r && (this_opt = strsep(&options, ",")) != NULL) {
+        if (!strncmp(this_opt, "xres:", 5))
+            mydef_var[0].xres = mydef_var[0].xres_virtual = simple_strtoul(this_opt + 5, NULL, 0);
+        else if (!strncmp(this_opt, "yres:", 5))
+            mydef_var[0].yres = mydef_var[0].yres_virtual = simple_strtoul(this_opt + 5, NULL, 0);
+        else {
+            amlog_level(LOG_LEVEL_HIGH,"invalid option\n");
+            r = -1;
+        }
+    }
+exit:
+    return r;
+}
+
+#endif
+
+/****************************************/
+static const struct of_device_id meson_fb_dt_match[]={
+	{	.compatible 	= "amlogic,mesonfb",
+	},
+	{},
+};
+
+static struct platform_driver
+osd_driver = {
+    .probe      = osd_probe,
+    .remove     = osd_remove,
+#ifdef  CONFIG_PM      
+    .suspend  =osd_suspend,
+    .resume    =osd_resume,
+#endif    
+    .driver     = {
+        .name   = "mesonfb",
+        .of_match_table=meson_fb_dt_match,
+    }
+};
+
+static int __init
+osd_init_module(void)
+{
+	amlog_level(LOG_LEVEL_HIGH,"osd_init\n");
+
+#ifndef MODULE
+    {
+      	char *option;
+      if (fb_get_options("mesonfb", &option)) {
+           return -ENODEV;
+   	}
+	  
+   	osd_setup_attribute(option);
+    }
+#endif
+
+    if (platform_driver_register(&osd_driver)) {
+        amlog_level(LOG_LEVEL_HIGH,"failed to register osd driver\n");
+        return -ENODEV;
+    }
+
+    return 0;
+}
+
+static void __exit
+osd_remove_module(void)
+{
+    amlog_level(LOG_LEVEL_HIGH,"osd_remove_module.\n");
+
+    platform_driver_unregister(&osd_driver);
+}
+
+/****************************************/
+module_init(osd_init_module);
+module_exit(osd_remove_module);
+
+MODULE_DESCRIPTION("AMLOGIC framebuffer driver");
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Tim Yao <timyao@amlogic.com>");
diff --git a/sources/Linux/Amlogic/M201/create-3.10.33-20160716-osd-xrgb-patch/linux-aml-3.10.33-20160716-new/include/linux/amlogic/osd/osd.h b/sources/Linux/Amlogic/M201/create-3.10.33-20160716-osd-xrgb-patch/linux-aml-3.10.33-20160716-new/include/linux/amlogic/osd/osd.h
new file mode 100644
index 000000000..a0e51b464
--- /dev/null
+++ b/sources/Linux/Amlogic/M201/create-3.10.33-20160716-osd-xrgb-patch/linux-aml-3.10.33-20160716-new/include/linux/amlogic/osd/osd.h
@@ -0,0 +1,166 @@
+/*
+ * Amlogic OSD
+ * frame buffer driver
+ *
+ * Copyright (C) 2009 Amlogic, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the named License,
+ * or any later version.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
+ *
+ * Author:	Tim Yao <timyao@amlogic.com>
+ *
+ */
+
+#ifndef OSD_H
+#define OSD_H
+#include  <linux/fb.h>
+
+typedef  enum {
+	COLOR_INDEX_02_PAL4    = 2,  // 0
+    	COLOR_INDEX_04_PAL16   = 4, // 0
+	COLOR_INDEX_08_PAL256=8,
+	COLOR_INDEX_16_655 =9,
+	COLOR_INDEX_16_844 =10,
+	COLOR_INDEX_16_6442 =11 ,
+	COLOR_INDEX_16_4444_R = 12,
+	COLOR_INDEX_16_4642_R = 13,
+	COLOR_INDEX_16_1555_A=14,
+	COLOR_INDEX_16_4444_A = 15,
+	COLOR_INDEX_16_565 =16,
+	
+	COLOR_INDEX_24_6666_A=19,
+	COLOR_INDEX_24_6666_R=20,
+	COLOR_INDEX_24_8565 =21,
+	COLOR_INDEX_24_5658 = 22,
+	COLOR_INDEX_24_888_B = 23,
+	COLOR_INDEX_24_RGB = 24,
+
+	COLOR_INDEX_32_BGRX = 25,
+	COLOR_INDEX_32_XBGR = 26,
+	COLOR_INDEX_32_RGBX = 27,
+	COLOR_INDEX_32_XRGB = 28,
+
+	COLOR_INDEX_32_BGRA=29,
+	COLOR_INDEX_32_ABGR = 30,
+	COLOR_INDEX_32_RGBA=31,
+	COLOR_INDEX_32_ARGB=32,
+
+	COLOR_INDEX_YUV_422=33,
+	
+}color_index_t;
+
+typedef struct {
+	unsigned int addr;
+} aml_hwc_addr_t;
+
+typedef  struct {
+	color_index_t	color_index;
+	u8	hw_colormat;
+	u8	hw_blkmode;
+
+	u8	red_offset ;
+	u8	red_length;
+	u8	red_msb_right;
+	
+	u8	green_offset;
+	u8	green_length;
+	u8	green_msb_right;
+
+	u8	blue_offset;
+	u8	blue_length;
+	u8	blue_msb_right;
+
+	u8	transp_offset;
+	u8	transp_length;
+	u8	transp_msb_right;
+
+	u8	color_type;
+	u8	bpp;
+}color_bit_define_t;
+
+typedef struct osd_ctl_s {
+    u32  xres_virtual;
+    u32  yres_virtual;
+    u32  xres;
+    u32  yres;
+    u32  disp_start_x; //coordinate of screen 
+    u32  disp_start_y;
+    u32  disp_end_x;
+    u32  disp_end_y;
+    u32  addr;
+    u32  index;
+} osd_ctl_t;
+#define  INVALID_BPP_ITEM    {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
+
+static const  color_bit_define_t   default_color_format_array[]={
+	INVALID_BPP_ITEM,
+	INVALID_BPP_ITEM,
+	{COLOR_INDEX_02_PAL4,0,0,/*red*/ 0,2,0,/*green*/0,2,0,/*blue*/0,2,0,/*trans*/0,0,0,FB_VISUAL_PSEUDOCOLOR,2},
+	INVALID_BPP_ITEM,	
+	{COLOR_INDEX_04_PAL16,0,1,/*red*/ 0,4,0,/*green*/0,4,0,/*blue*/0,4,0,/*trans*/0,0,0,FB_VISUAL_PSEUDOCOLOR,4},
+	INVALID_BPP_ITEM,	
+	INVALID_BPP_ITEM,	
+	INVALID_BPP_ITEM,	
+	{COLOR_INDEX_08_PAL256,0,2,/*red*/ 0,8,0,/*green*/0,8,0,/*blue*/0,8,0,/*trans*/0,0,0,FB_VISUAL_PSEUDOCOLOR,8},
+/*16 bit color*/
+	{COLOR_INDEX_16_655,0,4,/*red*/ 10,6,0,/*green*/5,5,0,/*blue*/0,5,0,/*trans*/0,0,0,FB_VISUAL_TRUECOLOR,16},
+	{COLOR_INDEX_16_844,1,4,/*red*/ 8,8,0,/*green*/4,4,0,/*blue*/0,4,0,/*trans*/0,0,0,FB_VISUAL_TRUECOLOR,16},
+	{COLOR_INDEX_16_6442,2,4,/*red*/ 10,6,0,/*green*/6,4,0,/*blue*/2,4,0,/*trans*/0,2,0,FB_VISUAL_TRUECOLOR,16},
+	{COLOR_INDEX_16_4444_R,3,4,/*red*/ 12,4,0,/*green*/8,4,0,/*blue*/4,4,0,/*trans*/0,4,0,FB_VISUAL_TRUECOLOR,16,},
+	{COLOR_INDEX_16_4642_R,7,4,/*red*/ 12,4,0,/*green*/6,6,0,/*blue*/2,4,0,/*trans*/0,2,0,FB_VISUAL_TRUECOLOR,16},
+	{COLOR_INDEX_16_1555_A,6,4,/*red*/ 10,5,0,/*green*/5,5,0,/*blue*/0,5,0,/*trans*/15,1,0,FB_VISUAL_TRUECOLOR,16},
+	{COLOR_INDEX_16_4444_A,5,4,/*red*/ 8,4,0,/*green*/4,4,0,/*blue*/0,4,0,/*trans*/12,4,0,FB_VISUAL_TRUECOLOR,16},
+	{COLOR_INDEX_16_565,4,4,/*red*/ 11,5,0,/*green*/5,6,0,/*blue*/0,5,0,/*trans*/0,0,0,FB_VISUAL_TRUECOLOR,16},
+/*24 bit color*/
+	INVALID_BPP_ITEM,
+	INVALID_BPP_ITEM,
+	{COLOR_INDEX_24_6666_A,4,7,/*red*/ 12,6,0,/*green*/6,6,0,/*blue*/0,6,0,/*trans*/18,6,0,FB_VISUAL_TRUECOLOR,24},
+	{COLOR_INDEX_24_6666_R,3,7,/*red*/ 18,6,0,/*green*/12,6,0,/*blue*/6,6,0,/*trans*/0,6,0,FB_VISUAL_TRUECOLOR,24},
+	{COLOR_INDEX_24_8565,2,7,/*red*/ 11,5,0,/*green*/5,6,0,/*blue*/0,5,0,/*trans*/16,8,0,FB_VISUAL_TRUECOLOR,24},
+	{COLOR_INDEX_24_5658,1,7,/*red*/ 19,5,0,/*green*/13,6,0,/*blue*/8,5,0,/*trans*/0,8,0,FB_VISUAL_TRUECOLOR,24},
+	{COLOR_INDEX_24_888_B,5,7,/*red*/ 0,8,0,/*green*/8,8,0,/*blue*/16,8,0,/*trans*/0,0,0,FB_VISUAL_TRUECOLOR,24},
+	{COLOR_INDEX_24_RGB,0,7,/*red*/ 16,8,0,/*green*/8,8,0,/*blue*/0,8,0,/*trans*/0,0,0,FB_VISUAL_TRUECOLOR,24},
+/*32 bit color RGBX*/
+	{COLOR_INDEX_32_BGRX,3,5,/*red*/ 8,8,0,/*green*/16,8,0,/*blue*/24,8,0,/*trans*/0,0,0,FB_VISUAL_TRUECOLOR,32},
+	{COLOR_INDEX_32_XBGR,2,5,/*red*/ 0,8,0,/*green*/8,8,0,/*blue*/16,8,0,/*trans*/24,0,0,FB_VISUAL_TRUECOLOR,32},
+	{COLOR_INDEX_32_RGBX,0,5,/*red*/ 24,8,0,/*green*/16,8,0,/*blue*/8,8,0,/*trans*/0,0,0,FB_VISUAL_TRUECOLOR,32},
+	{COLOR_INDEX_32_XRGB,1,5,/*red*/ 16,8,0,/*green*/8,8,0,/*blue*/0,8,0,/*trans*/24,0,0,FB_VISUAL_TRUECOLOR,32},
+/*32 bit color RGBA*/
+	{COLOR_INDEX_32_BGRA,3,5,/*red*/ 8,8,0,/*green*/16,8,0,/*blue*/24,8,0,/*trans*/0,8,0,FB_VISUAL_TRUECOLOR,32},
+	{COLOR_INDEX_32_ABGR,2,5,/*red*/ 0,8,0,/*green*/8,8,0,/*blue*/16,8,0,/*trans*/24,8,0,FB_VISUAL_TRUECOLOR,32},
+	{COLOR_INDEX_32_RGBA,0,5,/*red*/ 24,8,0,/*green*/16,8,0,/*blue*/8,8,0,/*trans*/0,8,0,FB_VISUAL_TRUECOLOR,32},
+	{COLOR_INDEX_32_ARGB,1,5,/*red*/ 16,8,0,/*green*/8,8,0,/*blue*/0,8,0,/*trans*/24,8,0,FB_VISUAL_TRUECOLOR,32},
+/*YUV color*/
+	{COLOR_INDEX_YUV_422,0,3,0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,16},
+};
+
+typedef struct reg_val_pair{
+    uint reg;
+    uint val;
+} reg_val_pair_t;	
+
+#ifdef CONFIG_VSYNC_RDMA
+int VSYNCOSD_WR_MPEG_REG(unsigned long adr, unsigned long val);
+int VSYNCOSD_WR_MPEG_REG_BITS(unsigned long adr, unsigned long val, unsigned long start, unsigned long len);
+u32  VSYNCOSD_RD_MPEG_REG(unsigned long addr);
+int VSYNCOSD_SET_MPEG_REG_MASK(unsigned long adr, unsigned long _mask);
+int VSYNCOSD_CLR_MPEG_REG_MASK(unsigned long adr, unsigned long _mask);
+#else
+#define VSYNCOSD_WR_MPEG_REG(adr,val) aml_write_reg32(P_##adr, val)
+#define VSYNCOSD_WR_MPEG_REG_BITS(adr, val, start, len)  aml_set_reg32_bits(P_##adr, val, start, len)
+#define VSYNCOSD_RD_MPEG_REG(adr) aml_read_reg32(P_##adr)
+#define VSYNCOSD_SET_MPEG_REG_MASK(adr, _mask) aml_set_reg32_mask(P_##adr, _mask)
+#define VSYNCOSD_CLR_MPEG_REG_MASK(adr,  _mask) aml_clr_reg32_mask(P_##adr, _mask)
+#endif
+#endif /* OSD1_H */
diff --git a/sources/Linux/Amlogic/M201/create-3.10.33-20160716-osd-xrgb-patch/linux-aml-3.10.33-20160716-new/include/linux/amlogic/osd/osd_main.h b/sources/Linux/Amlogic/M201/create-3.10.33-20160716-osd-xrgb-patch/linux-aml-3.10.33-20160716-new/include/linux/amlogic/osd/osd_main.h
new file mode 100644
index 000000000..eca3659c8
--- /dev/null
+++ b/sources/Linux/Amlogic/M201/create-3.10.33-20160716-osd-xrgb-patch/linux-aml-3.10.33-20160716-new/include/linux/amlogic/osd/osd_main.h
@@ -0,0 +1,206 @@
+/*
+ * Amlogic osd
+ * frame buffer driver
+ *
+ * Copyright (C) 2009 Amlogic, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the named License,
+ * or any later version.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
+ *
+ * Author:  Tim Yao <timyao@amlogic.com>
+ *
+ */
+
+#ifndef OSD_MAIN_H
+#define OSD_MAIN_H
+#include  <linux/list.h>
+#include  <linux/amlogic/vout/vout_notify.h>
+#include  <linux/amlogic/osd/osd_dev.h>
+#include  <linux/fb.h>
+
+static __u32 var_screeninfo[5];
+
+static struct fb_var_screeninfo mydef_var[] = {
+{
+	.xres            = 1200,
+	.yres            = 690,
+	.xres_virtual    = 1200,
+	.yres_virtual    = 1380,
+	.xoffset         = 0,
+	.yoffset         = 0,
+	.bits_per_pixel = 16,
+	.grayscale       = 0,
+	.red             = {0, 0, 0},
+	.green           = {0, 0, 0},
+	.blue            = {0, 0, 0},
+	.transp          = {0, 0, 0},
+	.nonstd          = 0,
+	.activate        = FB_ACTIVATE_NOW,
+	.height          = -1,
+	.width           = -1,
+	.accel_flags     = 0,
+	.pixclock        = 0,
+	.left_margin     = 0,
+	.right_margin    = 0,
+	.upper_margin    = 0,
+	.lower_margin    = 0,
+	.hsync_len       = 0,
+	.vsync_len       = 0,
+	.sync            = 0,
+	.vmode           = FB_VMODE_NONINTERLACED,
+	.rotate          = 0,
+	
+}
+
+#ifdef  CONFIG_FB_OSD2_ENABLE
+,
+{
+#if defined(CONFIG_FB_OSD2_DEFAULT_WIDTH)
+	.xres            = CONFIG_FB_OSD2_DEFAULT_WIDTH,
+#else
+	.xres            = 32,
+#endif
+#if defined(CONFIG_FB_OSD2_DEFAULT_HEIGHT)
+	.yres            = CONFIG_FB_OSD2_DEFAULT_HEIGHT,
+#else
+	.yres            = 32,
+#endif
+#if defined(CONFIG_FB_OSD2_DEFAULT_WIDTH_VIRTUAL)
+	.xres_virtual    = CONFIG_FB_OSD2_DEFAULT_WIDTH_VIRTUAL,
+#else
+	.xres_virtual    = 32,
+#endif
+#if defined(CONFIG_FB_OSD2_DEFAULT_HEIGHT_VIRTUAL)
+	.yres_virtual    = CONFIG_FB_OSD2_DEFAULT_HEIGHT_VIRTUAL,
+#else
+	.yres_virtual    = 32,
+#endif
+	.xoffset         = 0,
+	.yoffset         = 0,
+#if defined(CONFIG_FB_OSD2_DEFAULT_BITS_PER_PIXEL)
+	.bits_per_pixel  = CONFIG_FB_OSD2_DEFAULT_BITS_PER_PIXEL,
+#else
+	.bits_per_pixel = 32,
+#endif
+	.grayscale       = 0,
+	.red             = {0, 0, 0},  //leave as it is ,set by system.
+	.green           = {0, 0, 0},
+	.blue            = {0, 0, 0},
+	.transp          = {0, 0, 0},
+	.nonstd          = 0,
+	.activate        = FB_ACTIVATE_NOW,
+	.height          = -1,
+	.width           = -1,
+	.accel_flags     = 0,
+	.pixclock        = 0,
+	.left_margin     = 0,
+	.right_margin    = 0,
+	.upper_margin    = 0,
+	.lower_margin    = 0,
+	.hsync_len       = 0,
+	.vsync_len       = 0,
+	.sync            = 0,
+	.vmode           = FB_VMODE_NONINTERLACED,
+	.rotate          = 0,
+}
+#endif 
+};
+
+
+static struct fb_fix_screeninfo mydef_fix = {
+	.id		    = "OSD FB",
+	.xpanstep 	= 1,
+	.ypanstep 	= 1,
+	.type		= FB_TYPE_PACKED_PIXELS,
+	.visual		= FB_VISUAL_TRUECOLOR,
+	.accel		= FB_ACCEL_NONE,
+};
+
+typedef  struct {
+	int x ;
+	int y ;
+	int w ;
+	int h ;
+}disp_rect_t;
+#define DRIVER_NAME "osdfb"
+#define MODULE_NAME "osdfb"
+#define  FBIOPUT_OSD_SRCCOLORKEY	0x46fb
+#define  FBIOPUT_OSD_SRCKEY_ENABLE	0x46fa
+#define  FBIOPUT_OSD_SET_GBL_ALPHA	0x4500
+#define  FBIOGET_OSD_GET_GBL_ALPHA	0x4501
+#define  FBIOPUT_OSD_2X_SCALE		0x4502
+#define  FBIOPUT_OSD_ENABLE_3D_MODE	0x4503
+#define  FBIOPUT_OSD_FREE_SCALE_ENABLE	0x4504
+#define  FBIOPUT_OSD_FREE_SCALE_WIDTH	0x4505
+#define  FBIOPUT_OSD_FREE_SCALE_HEIGHT	0x4506
+#define  FBIOPUT_OSD_ORDER  		0x4507
+#define  FBIOGET_OSD_ORDER  		0x4508
+#define  FBIOGET_OSD_SCALE_AXIS		0x4509
+#define  FBIOPUT_OSD_SCALE_AXIS		0x450a
+#define  FBIOGET_OSD_BLOCK_WINDOWS	0x450b
+#define  FBIOPUT_OSD_BLOCK_WINDOWS	0x450c
+#define  FBIOGET_OSD_BLOCK_MODE		0x450d
+#define  FBIOPUT_OSD_BLOCK_MODE		0x450e
+#define  FBIOGET_OSD_FREE_SCALE_AXIS 0x450f
+#define  FBIOPUT_OSD_FREE_SCALE_AXIS  0x4510
+#define  FBIOPUT_OSD_FREE_SCALE_MODE  0x4511
+#define  FBIOGET_OSD_WINDOW_AXIS  	0x4512
+#define  FBIOPUT_OSD_WINDOW_AXIS  	0x4513
+#define  FBIOGET_OSD_FLUSH_RATE	0x4514
+#define  FBIOPUT_OSD_REVERSE		0x4515
+#define  FBIOPUT_OSD_ROTATE_ON   	0x4516
+#define  FBIOPUT_OSD_ROTATE_ANGLE	0x4517
+#define  FBIOPUT_OSD_SYNC_ADD	0x4518
+#define GET_UMP_SECURE_ID_BUF1 _IOWR('m', 311, unsigned int)
+#define GET_UMP_SECURE_ID_BUF2 _IOWR('m', 312, unsigned int)
+#define FBIOPUT_OSD2_CURSOR_DATA _IOWR('m', 313, unsigned int)
+#define  OSD_INVALID_INFO   		0xffffffff
+
+#define  OSD_FIRST_GROUP_START   	1
+#define  OSD_SECOND_GROUP_START 	4
+#define  OSD_END			5
+
+typedef  struct {
+	u32 index;
+	u32 osd_reverse;
+}osd_info_t;
+
+typedef  struct {
+	char *name;
+	u32   info;
+	u32   prev_idx;
+	u32   next_idx;
+	u32   cur_group_start;
+	u32   cur_group_end;
+}para_osd_info_t;
+
+typedef enum{
+	DEV_OSD0 = 0,
+	DEV_OSD1,
+	DEV_ALL,
+	DEV_MAX
+}osd_dev_t;
+
+typedef enum{
+	REVERSE_FALSE = 0,
+	REVERSE_TRUE,
+	REVERSE_MAX
+}reverse_info_t;
+
+#ifdef CONFIG_FB_AMLOGIC_UMP
+extern int (*disp_get_ump_secure_id) (struct fb_info *info, myfb_dev_t *g_fbi,
+                                       unsigned long arg, int buf);
+#endif
+
+#endif /* OSD_MAIN_H */
diff --git a/sources/hal/Mali/xf86-video-mali/DX/r4p0-00rel0/create-0.4.2-amlogic-patch/xf86-video-mali-0.4.2-new/src/mali_exa.c b/sources/hal/Mali/xf86-video-mali/DX/r4p0-00rel0/create-0.4.2-amlogic-patch/xf86-video-mali-0.4.2-new/src/mali_exa.c
index ea59809a9..1a02cd912 100644
--- a/sources/hal/Mali/xf86-video-mali/DX/r4p0-00rel0/create-0.4.2-amlogic-patch/xf86-video-mali-0.4.2-new/src/mali_exa.c
+++ b/sources/hal/Mali/xf86-video-mali/DX/r4p0-00rel0/create-0.4.2-amlogic-patch/xf86-video-mali-0.4.2-new/src/mali_exa.c
@@ -27,6 +27,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <xorg-server.h>
 #include <xf86.h>
 
 #include "mali_def.h"
diff --git a/sources/hal/Mali/xf86-video-mali/DX/r4p0-00rel0/create-0.4.2-amlogic-patch/xf86-video-mali-0.4.2-new/src/mali_fbdev.c b/sources/hal/Mali/xf86-video-mali/DX/r4p0-00rel0/create-0.4.2-amlogic-patch/xf86-video-mali-0.4.2-new/src/mali_fbdev.c
index 46bf8f365..90437a7f3 100644
--- a/sources/hal/Mali/xf86-video-mali/DX/r4p0-00rel0/create-0.4.2-amlogic-patch/xf86-video-mali-0.4.2-new/src/mali_fbdev.c
+++ b/sources/hal/Mali/xf86-video-mali/DX/r4p0-00rel0/create-0.4.2-amlogic-patch/xf86-video-mali-0.4.2-new/src/mali_fbdev.c
@@ -1590,9 +1590,9 @@ static Bool MaliScreenInit(SCREEN_INIT_ARGS_DECL)
 	/* mi layer */
 	miClearVisualTypes();
 
-	if (pScrn->bitsPerPixel > 8)
+	if (pScrn->bitsPerPixel > 25)
 	{
-		if (!miSetVisualTypes(pScrn->depth, TrueColorMask, pScrn->rgbBits, TrueColor))
+		if (!miSetVisualTypes(32, TrueColorMask, pScrn->rgbBits, TrueColor))
 		{
 			ERROR_MSG("visual type setup failed for %d bits per pixel [1]", pScrn->bitsPerPixel);
 			return FALSE;
diff --git a/sources/hal/Mali/xf86-video-mali/DX/r4p0-00rel0/patches/README b/sources/hal/Mali/xf86-video-mali/DX/r4p0-00rel0/patches/README
index 596359803..1f9b2e7ba 100644
--- a/sources/hal/Mali/xf86-video-mali/DX/r4p0-00rel0/patches/README
+++ b/sources/hal/Mali/xf86-video-mali/DX/r4p0-00rel0/patches/README
@@ -5,4 +5,42 @@
                                          [http://openlinux.amlogic.com:8000/download/ARM/filesystem/arm-buildroot-2015-01-20-4a5990f135.tar.gz]
                                          for Amlogic kernel 2015-01-15.
 
+   Additionaly this pach adds solution related to XRGB mode from Hardkernel:
+
+---------------------------------------------------------------------------------
+diff -bu -Nr a/mali_exa.c b/mali_exa.c
+--- a/mali_exa.c	2015-04-04 17:00:45.000000000 +0300
++++ b/mali_exa.c	2016-11-01 20:56:55.599705462 +0300
+@@ -27,6 +27,7 @@
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <fcntl.h>
++#include <xorg-server.h>
+ #include <xf86.h>
+ 
+ #include "mali_def.h"
+diff -bu -Nr a/mali_fbdev.c b/mali_fbdev.c
+--- a/mali_fbdev.c	2016-11-01 20:55:11.000000000 +0300
++++ b/mali_fbdev.c	2016-11-01 20:56:55.599705462 +0300
+@@ -1590,9 +1590,9 @@
+ 	/* mi layer */
+ 	miClearVisualTypes();
+ 
+-	if (pScrn->bitsPerPixel > 8)
++	if (pScrn->bitsPerPixel > 25)
+ 	{
+-		if (!miSetVisualTypes(pScrn->depth, TrueColorMask, pScrn->rgbBits, TrueColor))
++		if (!miSetVisualTypes(32, TrueColorMask, pScrn->rgbBits, TrueColor))
+ 		{
+ 			ERROR_MSG("visual type setup failed for %d bits per pixel [1]", pScrn->bitsPerPixel);
+ 			return FALSE;
+@@ -1788,3 +1788,4 @@
+ 	}
+ 	return TRUE;
+ }
++
+---------------------------------------------------------------------------------
+
+   But this is not enough if we use SWCursor rendered by X server.
+
  * end */
diff --git a/sources/packages/m/amlogic/Makefile b/sources/packages/m/amlogic/Makefile
new file mode 100644
index 000000000..78f51bc23
--- /dev/null
+++ b/sources/packages/m/amlogic/Makefile
@@ -0,0 +1,13 @@
+
+COMPONENT_TARGETS = $(HARDWARE_NOARCH)
+
+SOURCE_REQUIRES += ALL_DIRS
+
+
+include ../../../../build-system/core.mk
+
+
+download_clean:
+	@true
+
+.PHONY: download_clean
diff --git a/sources/packages/m/amlogic/aml-libs/Makefile b/sources/packages/m/amlogic/aml-libs/Makefile
new file mode 100644
index 000000000..ede30ce41
--- /dev/null
+++ b/sources/packages/m/amlogic/aml-libs/Makefile
@@ -0,0 +1,47 @@
+
+COMPONENT_TARGETS = $(HARDWARE_NOARCH)
+
+
+include ../../../../../build-system/constants.mk
+
+
+url         = $(DOWNLOAD_SERVER)/sources/packages/m/amlogic/aml-libs
+
+versions    = 0.4.0-20160716
+pkgname     = aml-libs
+suffix      = tar.xz
+
+tarballs    = $(addsuffix .$(suffix), $(addprefix $(pkgname)-, $(versions)))
+sha1s       = $(addsuffix .sha1sum, $(tarballs))
+
+
+BUILD_TARGETS = $(tarballs) $(sha1s)
+
+
+include ../../../../../build-system/core.mk
+
+
+.PHONY: download_clean
+
+
+$(tarballs):
+	@echo -e "\n======= Downloading source tarballs =======" ; \
+	 for tarball in $(tarballs) ; do \
+	   echo "$(url)/$$tarball" | xargs -n 1 -P 100 wget $(WGET_OPTIONS) -i & \
+	 done ; wait
+
+$(sha1s): $(tarballs)
+	@for sha in $@ ; do \
+	   echo -e "\n======= Downloading '$$sha' signature =======\n" ; \
+	   echo "$(url)/$$sha" | xargs -n 1 -P 100 wget $(WGET_OPTIONS) -i & wait %1 ; \
+	   touch $$sha ; \
+	   echo -e "\n======= Check the '$$sha' sha1sum =======\n" ; \
+	   sha1sum --check $$sha ; ret="$$?" ; \
+	   if [ "$$ret" == "1" ]; then \
+	     echo -e "\n======= ERROR: Bad '$$sha' sha1sum =======\n" ; \
+	     exit 1 ; \
+	   fi ; \
+	 done
+
+download_clean:
+	@rm -f $(tarballs) $(sha1s)