1 /* SPDX-License-Identifier: GPL-2.0-or-later * << 2 /* 1 /* 3 * Copyright 2008 Freescale Semiconductor, Inc 2 * Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved. 4 * 3 * 5 * Freescale DIU Frame Buffer device driver 4 * Freescale DIU Frame Buffer device driver 6 * 5 * 7 * Authors: Hongjun Chen <hong-jun.chen@frees 6 * Authors: Hongjun Chen <hong-jun.chen@freescale.com> 8 * Paul Widmer <paul.widmer@freescal 7 * Paul Widmer <paul.widmer@freescale.com> 9 * Srikanth Srinivasan <srikanth.sri 8 * Srikanth Srinivasan <srikanth.srinivasan@freescale.com> 10 * York Sun <yorksun@freescale.com> 9 * York Sun <yorksun@freescale.com> 11 * 10 * 12 * Based on imxfb.c Copyright (C) 2004 S.Hau 11 * Based on imxfb.c Copyright (C) 2004 S.Hauer, Pengutronix >> 12 * >> 13 * This program is free software; you can redistribute it and/or modify it >> 14 * under the terms of the GNU General Public License as published by the >> 15 * Free Software Foundation; either version 2 of the License, or (at your >> 16 * option) any later version. >> 17 * 13 */ 18 */ 14 19 15 #ifndef __FSL_DIU_FB_H__ 20 #ifndef __FSL_DIU_FB_H__ 16 #define __FSL_DIU_FB_H__ 21 #define __FSL_DIU_FB_H__ 17 22 18 #include <linux/types.h> 23 #include <linux/types.h> 19 24 20 struct mfb_chroma_key { 25 struct mfb_chroma_key { 21 int enable; 26 int enable; 22 __u8 red_max; 27 __u8 red_max; 23 __u8 green_max; 28 __u8 green_max; 24 __u8 blue_max; 29 __u8 blue_max; 25 __u8 red_min; 30 __u8 red_min; 26 __u8 green_min; 31 __u8 green_min; 27 __u8 blue_min; 32 __u8 blue_min; 28 }; 33 }; 29 34 30 struct aoi_display_offset { 35 struct aoi_display_offset { 31 __s32 x_aoi_d; 36 __s32 x_aoi_d; 32 __s32 y_aoi_d; 37 __s32 y_aoi_d; 33 }; 38 }; 34 39 35 #define MFB_SET_CHROMA_KEY _IOW('M', 1, s 40 #define MFB_SET_CHROMA_KEY _IOW('M', 1, struct mfb_chroma_key) 36 #define MFB_SET_BRIGHTNESS _IOW('M', 3, _ 41 #define MFB_SET_BRIGHTNESS _IOW('M', 3, __u8) 37 #define MFB_SET_ALPHA _IOW('M', 0, _ 42 #define MFB_SET_ALPHA _IOW('M', 0, __u8) 38 #define MFB_GET_ALPHA _IOR('M', 0, _ 43 #define MFB_GET_ALPHA _IOR('M', 0, __u8) 39 #define MFB_SET_AOID _IOW('M', 4, s 44 #define MFB_SET_AOID _IOW('M', 4, struct aoi_display_offset) 40 #define MFB_GET_AOID _IOR('M', 4, s 45 #define MFB_GET_AOID _IOR('M', 4, struct aoi_display_offset) 41 #define MFB_SET_PIXFMT _IOW('M', 8, _ 46 #define MFB_SET_PIXFMT _IOW('M', 8, __u32) 42 #define MFB_GET_PIXFMT _IOR('M', 8, _ 47 #define MFB_GET_PIXFMT _IOR('M', 8, __u32) 43 48 44 /* 49 /* 45 * The MPC5121 BSP comes with a gamma_set util 50 * The MPC5121 BSP comes with a gamma_set utility that initializes the 46 * gamma table. Unfortunately, it uses bad va 51 * gamma table. Unfortunately, it uses bad values for the IOCTL commands, 47 * but there's nothing we can do about it now. 52 * but there's nothing we can do about it now. These ioctls are only 48 * supported on the MPC5121. 53 * supported on the MPC5121. 49 */ 54 */ 50 #define MFB_SET_GAMMA _IOW('M', 1, _ 55 #define MFB_SET_GAMMA _IOW('M', 1, __u8) 51 #define MFB_GET_GAMMA _IOR('M', 1, _ 56 #define MFB_GET_GAMMA _IOR('M', 1, __u8) 52 57 53 /* 58 /* 54 * The original definitions of MFB_SET_PIXFMT 59 * The original definitions of MFB_SET_PIXFMT and MFB_GET_PIXFMT used the 55 * wrong value for 'size' field of the ioctl. 60 * wrong value for 'size' field of the ioctl. The current macros above use the 56 * right size, but we still need to provide ba 61 * right size, but we still need to provide backwards compatibility, at least 57 * for a while. 62 * for a while. 58 */ 63 */ 59 #define MFB_SET_PIXFMT_OLD 0x80014d08 64 #define MFB_SET_PIXFMT_OLD 0x80014d08 60 #define MFB_GET_PIXFMT_OLD 0x40014d08 65 #define MFB_GET_PIXFMT_OLD 0x40014d08 61 66 62 #ifdef __KERNEL__ 67 #ifdef __KERNEL__ 63 68 64 /* 69 /* 65 * These are the fields of area descriptor(in 70 * These are the fields of area descriptor(in DDR memory) for every plane 66 */ 71 */ 67 struct diu_ad { 72 struct diu_ad { 68 /* Word 0(32-bit) in DDR memory */ 73 /* Word 0(32-bit) in DDR memory */ 69 /* __u16 comp; */ 74 /* __u16 comp; */ 70 /* __u16 pixel_s:2; */ 75 /* __u16 pixel_s:2; */ 71 /* __u16 palette:1; */ 76 /* __u16 palette:1; */ 72 /* __u16 red_c:2; */ 77 /* __u16 red_c:2; */ 73 /* __u16 green_c:2; */ 78 /* __u16 green_c:2; */ 74 /* __u16 blue_c:2; */ 79 /* __u16 blue_c:2; */ 75 /* __u16 alpha_c:3; */ 80 /* __u16 alpha_c:3; */ 76 /* __u16 byte_f:1; */ 81 /* __u16 byte_f:1; */ 77 /* __u16 res0:3; */ 82 /* __u16 res0:3; */ 78 83 79 __be32 pix_fmt; /* hard coding pixel f 84 __be32 pix_fmt; /* hard coding pixel format */ 80 85 81 /* Word 1(32-bit) in DDR memory */ 86 /* Word 1(32-bit) in DDR memory */ 82 __le32 addr; 87 __le32 addr; 83 88 84 /* Word 2(32-bit) in DDR memory */ 89 /* Word 2(32-bit) in DDR memory */ 85 /* __u32 delta_xs:11; */ 90 /* __u32 delta_xs:11; */ 86 /* __u32 res1:1; */ 91 /* __u32 res1:1; */ 87 /* __u32 delta_ys:11; */ 92 /* __u32 delta_ys:11; */ 88 /* __u32 res2:1; */ 93 /* __u32 res2:1; */ 89 /* __u32 g_alpha:8; */ 94 /* __u32 g_alpha:8; */ 90 __le32 src_size_g_alpha; 95 __le32 src_size_g_alpha; 91 96 92 /* Word 3(32-bit) in DDR memory */ 97 /* Word 3(32-bit) in DDR memory */ 93 /* __u32 delta_xi:11; */ 98 /* __u32 delta_xi:11; */ 94 /* __u32 res3:5; */ 99 /* __u32 res3:5; */ 95 /* __u32 delta_yi:11; */ 100 /* __u32 delta_yi:11; */ 96 /* __u32 res4:3; */ 101 /* __u32 res4:3; */ 97 /* __u32 flip:2; */ 102 /* __u32 flip:2; */ 98 __le32 aoi_size; 103 __le32 aoi_size; 99 104 100 /* Word 4(32-bit) in DDR memory */ 105 /* Word 4(32-bit) in DDR memory */ 101 /*__u32 offset_xi:11; 106 /*__u32 offset_xi:11; 102 __u32 res5:5; 107 __u32 res5:5; 103 __u32 offset_yi:11; 108 __u32 offset_yi:11; 104 __u32 res6:5; 109 __u32 res6:5; 105 */ 110 */ 106 __le32 offset_xyi; 111 __le32 offset_xyi; 107 112 108 /* Word 5(32-bit) in DDR memory */ 113 /* Word 5(32-bit) in DDR memory */ 109 /*__u32 offset_xd:11; 114 /*__u32 offset_xd:11; 110 __u32 res7:5; 115 __u32 res7:5; 111 __u32 offset_yd:11; 116 __u32 offset_yd:11; 112 __u32 res8:5; */ 117 __u32 res8:5; */ 113 __le32 offset_xyd; 118 __le32 offset_xyd; 114 119 115 120 116 /* Word 6(32-bit) in DDR memory */ 121 /* Word 6(32-bit) in DDR memory */ 117 __u8 ckmax_r; 122 __u8 ckmax_r; 118 __u8 ckmax_g; 123 __u8 ckmax_g; 119 __u8 ckmax_b; 124 __u8 ckmax_b; 120 __u8 res9; 125 __u8 res9; 121 126 122 /* Word 7(32-bit) in DDR memory */ 127 /* Word 7(32-bit) in DDR memory */ 123 __u8 ckmin_r; 128 __u8 ckmin_r; 124 __u8 ckmin_g; 129 __u8 ckmin_g; 125 __u8 ckmin_b; 130 __u8 ckmin_b; 126 __u8 res10; 131 __u8 res10; 127 /* __u32 res10:8; */ 132 /* __u32 res10:8; */ 128 133 129 /* Word 8(32-bit) in DDR memory */ 134 /* Word 8(32-bit) in DDR memory */ 130 __le32 next_ad; 135 __le32 next_ad; 131 136 132 /* Word 9(32-bit) in DDR memory, just 137 /* Word 9(32-bit) in DDR memory, just for 64-bit aligned */ 133 __u32 paddr; 138 __u32 paddr; 134 } __attribute__ ((packed)); 139 } __attribute__ ((packed)); 135 140 136 /* DIU register map */ 141 /* DIU register map */ 137 struct diu { 142 struct diu { 138 __be32 desc[3]; 143 __be32 desc[3]; 139 __be32 gamma; 144 __be32 gamma; 140 __be32 palette; 145 __be32 palette; 141 __be32 cursor; 146 __be32 cursor; 142 __be32 curs_pos; 147 __be32 curs_pos; 143 __be32 diu_mode; 148 __be32 diu_mode; 144 __be32 bgnd; 149 __be32 bgnd; 145 __be32 bgnd_wb; 150 __be32 bgnd_wb; 146 __be32 disp_size; 151 __be32 disp_size; 147 __be32 wb_size; 152 __be32 wb_size; 148 __be32 wb_mem_addr; 153 __be32 wb_mem_addr; 149 __be32 hsyn_para; 154 __be32 hsyn_para; 150 __be32 vsyn_para; 155 __be32 vsyn_para; 151 __be32 syn_pol; 156 __be32 syn_pol; 152 __be32 thresholds; 157 __be32 thresholds; 153 __be32 int_status; 158 __be32 int_status; 154 __be32 int_mask; 159 __be32 int_mask; 155 __be32 colorbar[8]; 160 __be32 colorbar[8]; 156 __be32 filling; 161 __be32 filling; 157 __be32 plut; 162 __be32 plut; 158 } __attribute__ ((packed)); 163 } __attribute__ ((packed)); 159 164 160 /* 165 /* 161 * Modes of operation of DIU. The DIU support 166 * Modes of operation of DIU. The DIU supports five different modes, but 162 * the driver only supports modes 0 and 1. 167 * the driver only supports modes 0 and 1. 163 */ 168 */ 164 #define MFB_MODE0 0 /* DIU off */ 169 #define MFB_MODE0 0 /* DIU off */ 165 #define MFB_MODE1 1 /* All three p 170 #define MFB_MODE1 1 /* All three planes output to display */ 166 171 167 #endif /* __KERNEL__ */ 172 #endif /* __KERNEL__ */ 168 #endif /* __FSL_DIU_FB_H__ */ 173 #endif /* __FSL_DIU_FB_H__ */ 169 174
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.