From 5dee744324d41bb69601793d8071d27f6e825ea7 Mon Sep 17 00:00:00 2001 From: Mauro Ribeiro Date: Wed, 15 Oct 2014 01:19:32 -0300 Subject: [PATCH] merge amlogic linux patches Change-Id: I2242478cc6641cf96ca82e4d5e8ecd1fb957d78d --- Makefile | 1 - arch/arm/mach-meson6/include/mach/usbclock.h | 2 +- .../mach-meson6/include/mach/usbclock.h.rej | 11 +++ drivers/amlogic/display/osd/Kconfig | 7 +- drivers/amlogic/display/osd/Makefile | 13 ++-- drivers/amlogic/display/osd/osd_dev.c | 9 +++ drivers/amlogic/display/osd/osd_hw.c | 34 +++++++++- drivers/amlogic/display/osd/osd_main.c | 53 +++++++++++++++ drivers/amlogic/display/osd/osd_ump.c | 68 +++++++++++++++++++ drivers/amlogic/hdmi/hdmi_tx/hdmi_tx_edid.c | 2 +- drivers/gpu/drm/Kconfig | 7 ++ drivers/gpu/drm/Makefile | 1 + include/linux/amlogic/osd/osd.h | 5 +- include/linux/amlogic/osd/osd_dev.h | 8 ++- include/linux/amlogic/osd/osd_hw.h | 1 + include/linux/amlogic/osd/osd_main.h | 10 +++ 16 files changed, 219 insertions(+), 13 deletions(-) create mode 100644 arch/arm/mach-meson6/include/mach/usbclock.h.rej create mode 100644 drivers/amlogic/display/osd/osd_ump.c diff --git a/Makefile b/Makefile index 629bdc273e8c..19bef951c025 100755 --- a/Makefile +++ b/Makefile @@ -380,7 +380,6 @@ KBUILD_CFLAGS += -Werror=enum-compare \ -Werror=implicit-int \ -Werror=missing-braces \ -Werror=unused-value \ - -Werror=maybe-uninitialized \ -Werror=unused-variable \ -Werror=format \ -Werror=unused-function \ diff --git a/arch/arm/mach-meson6/include/mach/usbclock.h b/arch/arm/mach-meson6/include/mach/usbclock.h index bd5dea260be6..03e145d2b512 100755 --- a/arch/arm/mach-meson6/include/mach/usbclock.h +++ b/arch/arm/mach-meson6/include/mach/usbclock.h @@ -207,7 +207,7 @@ typedef union phy_tune_data { #define USB_BC_MODE_CDP 3 /* PC + Charger */ #define USB_CORE_RESET_TIME 200 -#define USB_ID_CHANGE_TIME 100 +#define USB_ID_CHANGE_TIME 200 int clk_enable_usb(struct clk *clk); int clk_disable_usb(struct clk *clk); diff --git a/arch/arm/mach-meson6/include/mach/usbclock.h.rej b/arch/arm/mach-meson6/include/mach/usbclock.h.rej new file mode 100644 index 000000000000..51d1c6aee33e --- /dev/null +++ b/arch/arm/mach-meson6/include/mach/usbclock.h.rej @@ -0,0 +1,11 @@ +--- arch/arm/mach-meson6/include/mach/usbclock.h.orig 2014-07-18 11:36:55.687502450 +0800 ++++ arch/arm/mach-meson6/include/mach/usbclock.h 2014-07-18 11:37:02.943502586 +0800 +@@ -207,7 +207,7 @@ + #define USB_BC_MODE_CDP 3 /* PC + Charger */ + + #define USB_CORE_RESET_TIME 200 +-#define USB_ID_CHANGE_TIME 100 ++#define USB_ID_CHANGE_TIME 200 + + int clk_enable_usb(struct clk *clk); + int clk_disable_usb(struct clk *clk); diff --git a/drivers/amlogic/display/osd/Kconfig b/drivers/amlogic/display/osd/Kconfig index 99645691e0ca..5830f8614d01 100755 --- a/drivers/amlogic/display/osd/Kconfig +++ b/drivers/amlogic/display/osd/Kconfig @@ -103,6 +103,11 @@ config FB_OSD1_DEFAULT_HEIGHT_VIRTUAL ---help--- The default osd1/fb0 virtual height. Does not affect ability to change height using fbset or FBIOPUT ioctl. - +config FB_AMLOGIC_UMP + bool "amlogic ump" + default y + depends on FB_AM + help + enable osd ump when we use mali for x11 endmenu diff --git a/drivers/amlogic/display/osd/Makefile b/drivers/amlogic/display/osd/Makefile index 9c1fec04683f..821ba2f7f2b8 100755 --- a/drivers/amlogic/display/osd/Makefile +++ b/drivers/amlogic/display/osd/Makefile @@ -13,9 +13,12 @@ endif obj-$(CONFIG_VSYNC_RDMA) += osd_rdma.o -EXTRA_CFLAGS += -Iinclude/linux/osd/ - - - - +EXTRA_CFLAGS += -Iinclude/linux/amlogic/osd/ +ifeq ($(CONFIG_FB_AMLOGIC_UMP),y) +fb-objs += osd_ump.o +endif +ifeq ($(CONFIG_FB_AMLOGIC_UMP),y) +EXTRA_CFLAGS += -I../hardware/arm/gpu/ump/include/ +endif + diff --git a/drivers/amlogic/display/osd/osd_dev.c b/drivers/amlogic/display/osd/osd_dev.c index f0e657fa6d9e..794262cc44c6 100755 --- a/drivers/amlogic/display/osd/osd_dev.c +++ b/drivers/amlogic/display/osd/osd_dev.c @@ -343,6 +343,15 @@ void osddev_cursor(struct myfb_dev *fbdev, s16 x, s16 y, s16 xstart, s16 ystart, } #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 ); diff --git a/drivers/amlogic/display/osd/osd_hw.c b/drivers/amlogic/display/osd/osd_hw.c index 1551c981bb86..a062317ca310 100755 --- a/drivers/amlogic/display/osd/osd_hw.c +++ b/drivers/amlogic/display/osd/osd_hw.c @@ -2641,7 +2641,6 @@ void osd_init_hw(u32 logo_loaded) osd_hw.color_info[OSD2]=NULL; vf.width =vf.height=0; osd_hw.color_key[OSD1]=osd_hw.color_key[OSD2]=0xffffffff; - osd_hw.free_scale_enable[OSD1]=osd_hw.free_scale_enable[OSD2]=0; 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; @@ -2660,6 +2659,12 @@ void osd_init_hw(u32 logo_loaded) 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 FIQ_VSYNC @@ -2779,6 +2784,33 @@ void osd_cursor_hw(s16 x, s16 y, s16 xstart, s16 ystart, u32 osd_w, u32 osd_h, i } #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; diff --git a/drivers/amlogic/display/osd/osd_main.c b/drivers/amlogic/display/osd/osd_main.c index f24ddb156f61..7c2ad0b9de19 100755 --- a/drivers/amlogic/display/osd/osd_main.c +++ b/drivers/amlogic/display/osd/osd_main.c @@ -96,7 +96,11 @@ _find_color_format(struct fb_var_screeninfo * var) lower_margin=COLOR_INDEX_24_6666_A; break; case 3: +#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: @@ -267,6 +271,12 @@ osd_setcmap(struct fb_cmap *cmap, struct fb_info *info) 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) @@ -284,6 +294,11 @@ osd_ioctl(struct fb_info *info, unsigned int cmd, unsigned long ret; u32 flush_rate; + unsigned int karg = 0; +#ifdef CONFIG_FB_AMLOGIC_UMP + int secure_id_buf_num = 0; +#endif + switch (cmd) { case FBIOPUT_OSD_SRCKEY_ENABLE: @@ -328,6 +343,44 @@ osd_ioctl(struct fb_info *info, unsigned int cmd, 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: + { + if (copy_from_user(&karg, argp, sizeof(unsigned int))) { + return -EFAULT; + } + aml_hwc_addr_t para; + if (copy_from_user(¶, (void __user *)karg, sizeof(aml_hwc_addr_t))) { + return -EFAULT; + } + ret = osddev_copy_data_tocursor(fbdev, ¶); + } + break; default : amlog_mask_level(LOG_MASK_IOCTL,LOG_LEVEL_HIGH,"command not supported\r\n "); return -1; diff --git a/drivers/amlogic/display/osd/osd_ump.c b/drivers/amlogic/display/osd/osd_ump.c new file mode 100644 index 000000000000..418b4d7d06cf --- /dev/null +++ b/drivers/amlogic/display/osd/osd_ump.c @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2012 Amlogic + * + * 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., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include + +#include +#include +#include +#include +#include +#include + +static int _disp_get_ump_secure_id(struct fb_info *info, myfb_dev_t *g_fbi, + unsigned long arg, int buf) +{ + u32 __user *psecureid = (u32 __user *) arg; + ump_secure_id secure_id; + + if (!g_fbi->ump_wrapped_buffer[info->node][buf]) { + printk("create_disp_get_ump_secure_id******%d\n", buf); + ump_dd_physical_block ump_memory_description; + + ump_memory_description.addr = info->fix.smem_start; + ump_memory_description.size = info->fix.smem_len; + g_fbi->ump_wrapped_buffer[info->node][buf] = + ump_dd_handle_create_from_phys_blocks(&ump_memory_description, 1); + } + secure_id = ump_dd_secure_id_get(g_fbi->ump_wrapped_buffer[info->node][buf]); + return put_user((unsigned int)secure_id, psecureid); +} + +static int __init osd_ump_module_init(void) +{ + int ret = 0; + + disp_get_ump_secure_id = _disp_get_ump_secure_id; + + return ret; +} + +static void __exit osd_ump_module_exit(void) +{ + disp_get_ump_secure_id = NULL; +} + +module_init(osd_ump_module_init); +module_exit(osd_ump_module_exit); + +MODULE_AUTHOR("Amlogic BJ Platform"); +MODULE_DESCRIPTION("amlogic display driver MALI UMP module"); +MODULE_LICENSE("GPL"); + diff --git a/drivers/amlogic/hdmi/hdmi_tx/hdmi_tx_edid.c b/drivers/amlogic/hdmi/hdmi_tx/hdmi_tx_edid.c index 00a7219a861c..0f2b7b4e238e 100755 --- a/drivers/amlogic/hdmi/hdmi_tx/hdmi_tx_edid.c +++ b/drivers/amlogic/hdmi/hdmi_tx/hdmi_tx_edid.c @@ -227,7 +227,7 @@ void Edid_CompareTimingDescriptors(HDMI_TX_INFO_t * info, unsigned char *Data) { for(index2=0;index2<12;index2++) { - if(Data[index2]!=Edid_TimingDescriptors[index1*14+index2]) + if(Data[index2]!=Edid_TimingDescriptors[index1*12+index2]) break; } if(index2==12) diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index b16c50ee769c..6dc188736da4 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -199,6 +199,13 @@ config DRM_SAVAGE Choose this option if you have a Savage3D/4/SuperSavage/Pro/Twister chipset. If M is selected the module will be called savage. +config DRM_MALI + tristate "arm mali cards" + depends on DRM + help + Choose this option if you have a ARM GPU Mali. + If M is selected the module will be called arm. + source "drivers/gpu/drm/exynos/Kconfig" source "drivers/gpu/drm/vmwgfx/Kconfig" diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index 1c9f24396002..af9c107055b9 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile @@ -41,6 +41,7 @@ obj-$(CONFIG_DRM_MGAG200) += mgag200/ obj-$(CONFIG_DRM_CIRRUS_QEMU) += cirrus/ obj-$(CONFIG_DRM_SIS) += sis/ obj-$(CONFIG_DRM_SAVAGE)+= savage/ +obj-$(CONFIG_DRM_MALI) += mali_drm/ obj-$(CONFIG_DRM_VMWGFX)+= vmwgfx/ obj-$(CONFIG_DRM_VIA) +=via/ obj-$(CONFIG_DRM_NOUVEAU) +=nouveau/ diff --git a/include/linux/amlogic/osd/osd.h b/include/linux/amlogic/osd/osd.h index 9832f2c4cfcc..73d3030e0778 100755 --- a/include/linux/amlogic/osd/osd.h +++ b/include/linux/amlogic/osd/osd.h @@ -55,7 +55,10 @@ typedef enum { }color_index_t; - +typedef struct { + unsigned int addr; +} aml_hwc_addr_t; + typedef struct { color_index_t color_index; diff --git a/include/linux/amlogic/osd/osd_dev.h b/include/linux/amlogic/osd/osd_dev.h index a740c17298af..93e0297dac18 100755 --- a/include/linux/amlogic/osd/osd_dev.h +++ b/include/linux/amlogic/osd/osd_dev.h @@ -28,13 +28,14 @@ #include "osd.h" #include #include - +#include "../../../../../hardware/arm/gpu/ump/include/ump/ump_kernel_interface.h" #define OSD_COUNT 2 /* we have two osd layer on hardware*/ #define KEYCOLOR_FLAG_TARGET 1 #define KEYCOLOR_FLAG_ONHOLD 2 #define KEYCOLOR_FLAG_CURRENT 4 +#define OSD_MAX_FB 2 typedef struct myfb_dev { struct mutex lock; @@ -54,6 +55,9 @@ typedef struct myfb_dev { u32 preblend_enable; u32 enable_key_flag; u32 color_key; +#ifdef CONFIG_FB_AMLOGIC_UMP + ump_dd_handle ump_wrapped_buffer[OSD_MAX_FB][2]; +#endif } myfb_dev_t; typedef struct list_head list_head_t ; @@ -125,7 +129,7 @@ extern void osddev_pan_display(struct fb_var_screeninfo *var,struct fb_info *fbi #if defined (CONFIG_FB_OSD2_CURSOR) extern void osddev_cursor(struct myfb_dev *fbdev, s16 x, s16 y, s16 xstart, s16 ystart, u32 osd_w, u32 osd_h); #endif - +extern int osddev_copy_data_tocursor(myfb_dev_t *g_fbi, aml_hwc_addr_t *cursor_mem); extern void osddev_set_colorkey(u32 index,u32 bpp,u32 colorkey ); extern void osddev_srckey_enable(u32 index,u8 enable); extern void osddev_set_gbl_alpha(u32 index,u32 gbl_alpha) ; diff --git a/include/linux/amlogic/osd/osd_hw.h b/include/linux/amlogic/osd/osd_hw.h index d7a6a3662cef..2b94fe2b2b2e 100755 --- a/include/linux/amlogic/osd/osd_hw.h +++ b/include/linux/amlogic/osd/osd_hw.h @@ -121,6 +121,7 @@ extern void osd_pan_display_hw(unsigned int xoffset, unsigned int yoffset,int in #if defined(CONFIG_FB_OSD2_CURSOR) extern void osd_cursor_hw(s16 x, s16 y, s16 xstart, s16 ystart, u32 osd_w, u32 osd_h, int index); #endif +extern void osddev_copy_data_tocursor_hw(u32 cursor_mem_paddr, aml_hwc_addr_t *hwc_mem); extern void osd_suspend_hw(void); extern void osd_resume_hw(void); extern void osd_init_hw(u32 logo_loaded); diff --git a/include/linux/amlogic/osd/osd_main.h b/include/linux/amlogic/osd/osd_main.h index 6346df3970a9..6cb050a4f55c 100755 --- a/include/linux/amlogic/osd/osd_main.h +++ b/include/linux/amlogic/osd/osd_main.h @@ -26,6 +26,7 @@ #define OSD_MAIN_H #include #include +#include #include static __u32 var_screeninfo[5]; @@ -161,6 +162,10 @@ typedef struct { #define FBIOPUT_OSD_ROTATE_ON 0x4516 #define FBIOPUT_OSD_ROTATE_ANGLE 0x4517 +#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 @@ -194,4 +199,9 @@ typedef enum{ 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 */