Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Staging: crystalhd: Remove typedefs from driver

Remove typedefs from driver

Signed-of-by: Lior Dotan <liodot@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Lior Dotan and committed by
Greg Kroah-Hartman
abfc768d 973267a2

+442 -462
+29 -39
drivers/staging/crystalhd/bc_dts_defs.h
··· 26 26 #ifndef _BC_DTS_DEFS_H_ 27 27 #define _BC_DTS_DEFS_H_ 28 28 29 - #include "bc_dts_types.h" 30 - 31 29 /* BIT Mask */ 32 30 #define BC_BIT(_x) (1 << (_x)) 33 31 34 - typedef enum _BC_STATUS { 32 + enum BC_STATUS { 35 33 BC_STS_SUCCESS = 0, 36 34 BC_STS_INV_ARG = 1, 37 35 BC_STS_BUSY = 2, ··· 60 62 61 63 /* Must be the last one.*/ 62 64 BC_STS_ERROR = -1 63 - } BC_STATUS; 65 + }; 64 66 65 67 /*------------------------------------------------------* 66 68 * Registry Key Definitions * ··· 79 81 * 80 82 */ 81 83 82 - typedef enum _BC_SW_OPTIONS { 84 + enum BC_SW_OPTIONS { 83 85 BC_OPT_DOSER_OUT_ENCRYPT = BC_BIT(3), 84 86 BC_OPT_LINK_OUT_ENCRYPT = BC_BIT(29), 85 - } BC_SW_OPTIONS; 87 + }; 86 88 87 - typedef struct _BC_REG_CONFIG{ 89 + struct BC_REG_CONFIG{ 88 90 uint32_t DbgOptions; 89 - } BC_REG_CONFIG; 91 + }; 90 92 91 93 #if defined(__KERNEL__) || defined(__LINUX_USER__) 92 94 #else ··· 106 108 */ 107 109 108 110 /* To allow multiple apps to open the device. */ 109 - enum _DtsDeviceOpenMode { 111 + enum DtsDeviceOpenMode { 110 112 DTS_PLAYBACK_MODE = 0, 111 113 DTS_DIAG_MODE, 112 114 DTS_MONITOR_MODE, ··· 114 116 }; 115 117 116 118 /* To enable the filter to selectively enable/disable fixes or erratas */ 117 - enum _DtsDeviceFixMode { 119 + enum DtsDeviceFixMode { 118 120 DTS_LOAD_NEW_FW = BC_BIT(8), 119 121 DTS_LOAD_FILE_PLAY_FW = BC_BIT(9), 120 122 DTS_DISK_FMT_BD = BC_BIT(10), ··· 131 133 #define DTS_DFLT_CLOCK(x) (x<<19) 132 134 133 135 /* F/W File Version corresponding to S/W Releases */ 134 - enum _FW_FILE_VER { 136 + enum FW_FILE_VER { 135 137 /* S/W release: 02.04.02 F/W release 2.12.2.0 */ 136 138 BC_FW_VER_020402 = ((12<<16) | (2<<8) | (0)) 137 139 }; ··· 139 141 /*------------------------------------------------------* 140 142 * Stream Types for DtsOpenDecoder() * 141 143 *------------------------------------------------------*/ 142 - enum _DtsOpenDecStreamTypes { 144 + enum DtsOpenDecStreamTypes { 143 145 BC_STREAM_TYPE_ES = 0, 144 146 BC_STREAM_TYPE_PES = 1, 145 147 BC_STREAM_TYPE_TS = 2, ··· 149 151 /*------------------------------------------------------* 150 152 * Video Algorithms for DtsSetVideoParams() * 151 153 *------------------------------------------------------*/ 152 - enum _DtsSetVideoParamsAlgo { 154 + enum DtsSetVideoParamsAlgo { 153 155 BC_VID_ALGO_H264 = 0, 154 156 BC_VID_ALGO_MPEG2 = 1, 155 157 BC_VID_ALGO_VC1 = 4, ··· 161 163 *------------------------------------------------------*/ 162 164 #define BC_MPEG_VALID_PANSCAN (1) 163 165 164 - typedef struct _BC_PIB_EXT_MPEG { 166 + struct BC_PIB_EXT_MPEG { 165 167 uint32_t valid; 166 168 /* Always valid, defaults to picture size if no 167 169 * sequence display extension in the stream. */ ··· 173 175 uint32_t offset_count; 174 176 int32_t horizontal_offset[3]; 175 177 int32_t vertical_offset[3]; 176 - 177 - } BC_PIB_EXT_MPEG; 178 + }; 178 179 179 180 /*------------------------------------------------------* 180 181 * H.264 Extension to the PPB * ··· 183 186 #define H264_VALID_SPS_CROP (2) 184 187 #define H264_VALID_VUI (4) 185 188 186 - typedef struct _BC_PIB_EXT_H264 { 189 + struct BC_PIB_EXT_H264 { 187 190 /* 'valid' specifies which fields (or sets of 188 191 * fields) below are valid. If the corresponding 189 192 * bit in 'valid' is NOT set then that field(s) ··· 206 209 /* H264_VALID_VUI */ 207 210 uint32_t chroma_top; 208 211 uint32_t chroma_bottom; 209 - 210 - } BC_PIB_EXT_H264; 212 + }; 211 213 212 214 /*------------------------------------------------------* 213 215 * VC1 Extension to the PPB * 214 216 *------------------------------------------------------*/ 215 217 #define VC1_VALID_PANSCAN (1) 216 218 217 - typedef struct _BC_PIB_EXT_VC1 { 219 + struct BC_PIB_EXT_VC1 { 218 220 uint32_t valid; 219 221 220 222 /* Always valid, defaults to picture size if no ··· 227 231 int32_t ps_vert_offset[4]; 228 232 int32_t ps_width[4]; 229 233 int32_t ps_height[4]; 230 - 231 - } BC_PIB_EXT_VC1; 232 - 234 + }; 233 235 234 236 /*------------------------------------------------------* 235 237 * Picture Information Block * ··· 360 366 MODE422_UYVY = 0x2, 361 367 }; 362 368 363 - typedef struct _BC_PIC_INFO_BLOCK { 369 + struct BC_PIC_INFO_BLOCK { 364 370 /* Common fields. */ 365 371 uint64_t timeStamp; /* Timestamp */ 366 372 uint32_t picture_number; /* Ordinal display number */ ··· 380 386 381 387 /* Protocol-specific extensions. */ 382 388 union { 383 - BC_PIB_EXT_H264 h264; 384 - BC_PIB_EXT_MPEG mpeg; 385 - BC_PIB_EXT_VC1 vc1; 389 + struct BC_PIB_EXT_H264 h264; 390 + struct BC_PIB_EXT_MPEG mpeg; 391 + struct BC_PIB_EXT_VC1 vc1; 386 392 } other; 387 393 388 - } BC_PIC_INFO_BLOCK, *PBC_PIC_INFO_BLOCK; 394 + }; 389 395 390 396 /*------------------------------------------------------* 391 397 * ProcOut Info * 392 398 *------------------------------------------------------*/ 393 399 /* Optional flags for ProcOut Interface.*/ 394 - enum _POUT_OPTIONAL_IN_FLAGS_{ 400 + enum POUT_OPTIONAL_IN_FLAGS_{ 395 401 /* Flags from App to Device */ 396 402 BC_POUT_FLAGS_YV12 = 0x01, /* Copy Data in YV12 format */ 397 403 BC_POUT_FLAGS_STRIDE = 0x02, /* Stride size is valid. */ ··· 406 412 BC_POUT_FLAGS_FLD_BOT = 0x80000, /* Bottom Field data */ 407 413 }; 408 414 409 - #if defined(__KERNEL__) || defined(__LINUX_USER__) 410 - typedef BC_STATUS(*dts_pout_callback)(void *shnd, uint32_t width, uint32_t height, uint32_t stride, void *pOut); 411 - #else 412 - typedef BC_STATUS(*dts_pout_callback)(void *shnd, uint32_t width, uint32_t height, uint32_t stride, struct _BC_DTS_PROC_OUT *pOut); 413 - #endif 415 + typedef enum BC_STATUS(*dts_pout_callback)(void *shnd, uint32_t width, uint32_t height, uint32_t stride, void *pOut); 414 416 415 417 /* Line 21 Closed Caption */ 416 418 /* User Data */ 417 419 #define MAX_UD_SIZE 1792 /* 1920 - 128 */ 418 420 419 - typedef struct _BC_DTS_PROC_OUT { 421 + struct BC_DTS_PROC_OUT { 420 422 uint8_t *Ybuff; /* Caller Supplied buffer for Y data */ 421 423 uint32_t YbuffSz; /* Caller Supplied Y buffer size */ 422 424 uint32_t YBuffDoneSz; /* Transferred Y datasize */ ··· 426 436 427 437 uint32_t discCnt; /* Picture discontinuity count */ 428 438 429 - BC_PIC_INFO_BLOCK PicInfo; /* Picture Information Block Data */ 439 + struct BC_PIC_INFO_BLOCK PicInfo; /* Picture Information Block Data */ 430 440 431 441 /* Line 21 Closed Caption */ 432 442 /* User Data */ ··· 440 450 uint8_t bPibEnc; /* PIB encrypted */ 441 451 uint8_t bRevertScramble; 442 452 443 - } BC_DTS_PROC_OUT; 453 + }; 444 454 445 - typedef struct _BC_DTS_STATUS { 455 + struct BC_DTS_STATUS { 446 456 uint8_t ReadyListCount; /* Number of frames in ready list (reported by driver) */ 447 457 uint8_t FreeListCount; /* Number of frame buffers free. (reported by driver) */ 448 458 uint8_t PowerStateChange; /* Number of active state power transitions (reported by driver) */ ··· 469 479 * back from the driver */ 470 480 uint8_t reserved__[16]; 471 481 472 - } BC_DTS_STATUS; 482 + }; 473 483 474 484 #define BC_SWAP32(_v) \ 475 485 ((((_v) & 0xFF000000)>>24)| \
+58 -59
drivers/staging/crystalhd/bc_dts_glob_lnx.h
··· 58 58 * These are SW stack tunable parameters shared 59 59 * between the driver and the application. 60 60 */ 61 - enum _BC_DTS_GLOBALS { 61 + enum BC_DTS_GLOBALS { 62 62 BC_MAX_FW_CMD_BUFF_SZ = 0x40, /* FW passthrough cmd/rsp buffer size */ 63 63 PCI_CFG_SIZE = 256, /* PCI config size buffer */ 64 64 BC_IOCTL_DATA_POOL_SIZE = 8, /* BC_IOCTL_DATA Pool size */ ··· 70 70 BC_INFIFO_THRESHOLD = 0x10000, 71 71 }; 72 72 73 - typedef struct _BC_CMD_REG_ACC { 73 + struct BC_CMD_REG_ACC { 74 74 uint32_t Offset; 75 75 uint32_t Value; 76 - } BC_CMD_REG_ACC; 76 + }; 77 77 78 - typedef struct _BC_CMD_DEV_MEM { 78 + struct BC_CMD_DEV_MEM { 79 79 uint32_t StartOff; 80 80 uint32_t NumDwords; 81 81 uint32_t Rsrd; 82 - } BC_CMD_DEV_MEM; 82 + }; 83 83 84 84 /* FW Passthrough command structure */ 85 - enum _bc_fw_cmd_flags { 85 + enum bc_fw_cmd_flags { 86 86 BC_FW_CMD_FLAGS_NONE = 0, 87 87 BC_FW_CMD_PIB_QS = 0x01, 88 88 }; 89 89 90 - typedef struct _BC_FW_CMD { 90 + struct BC_FW_CMD { 91 91 uint32_t cmd[BC_MAX_FW_CMD_BUFF_SZ]; 92 92 uint32_t rsp[BC_MAX_FW_CMD_BUFF_SZ]; 93 93 uint32_t flags; 94 94 uint32_t add_data; 95 - } BC_FW_CMD, *PBC_FW_CMD; 95 + }; 96 96 97 - typedef struct _BC_HW_TYPE { 97 + struct BC_HW_TYPE { 98 98 uint16_t PciDevId; 99 99 uint16_t PciVenId; 100 100 uint8_t HwRev; 101 101 uint8_t Align[3]; 102 - } BC_HW_TYPE; 102 + }; 103 103 104 - typedef struct _BC_PCI_CFG { 104 + struct BC_PCI_CFG { 105 105 uint32_t Size; 106 106 uint32_t Offset; 107 107 uint8_t pci_cfg_space[PCI_CFG_SIZE]; 108 - } BC_PCI_CFG; 108 + }; 109 109 110 - typedef struct _BC_VERSION_INFO_ { 110 + struct BC_VERSION_INFO { 111 111 uint8_t DriverMajor; 112 112 uint8_t DriverMinor; 113 113 uint16_t DriverRevision; 114 - } BC_VERSION_INFO; 114 + }; 115 115 116 - typedef struct _BC_START_RX_CAP_ { 116 + struct BC_START_RX_CAP { 117 117 uint32_t Rsrd; 118 118 uint32_t StartDeliveryThsh; 119 119 uint32_t PauseThsh; 120 120 uint32_t ResumeThsh; 121 - } BC_START_RX_CAP; 121 + }; 122 122 123 - typedef struct _BC_FLUSH_RX_CAP_ { 123 + struct BC_FLUSH_RX_CAP { 124 124 uint32_t Rsrd; 125 125 uint32_t bDiscardOnly; 126 - } BC_FLUSH_RX_CAP; 126 + }; 127 127 128 - typedef struct _BC_DTS_STATS { 128 + struct BC_DTS_STATS { 129 129 uint8_t drvRLL; 130 130 uint8_t drvFLL; 131 131 uint8_t eosDetected; ··· 154 154 uint32_t DrvRepeatedFrms; 155 155 uint32_t res1[13]; 156 156 157 - } BC_DTS_STATS; 157 + }; 158 158 159 - typedef struct _BC_PROC_INPUT_ { 159 + struct BC_PROC_INPUT { 160 160 uint8_t *pDmaBuff; 161 161 uint32_t BuffSz; 162 162 uint8_t Mapped; 163 163 uint8_t Encrypted; 164 164 uint8_t Rsrd[2]; 165 165 uint32_t DramOffset; /* For debug use only */ 166 - } BC_PROC_INPUT, *PBC_PROC_INPUT; 166 + }; 167 167 168 - typedef struct _BC_DEC_YUV_BUFFS { 168 + struct BC_DEC_YUV_BUFFS { 169 169 uint32_t b422Mode; 170 170 uint8_t *YuvBuff; 171 171 uint32_t YuvBuffSz; ··· 173 173 uint32_t YBuffDoneSz; 174 174 uint32_t UVBuffDoneSz; 175 175 uint32_t RefCnt; 176 - } BC_DEC_YUV_BUFFS; 176 + }; 177 177 178 - enum _DECOUT_COMPLETION_FLAGS{ 178 + enum DECOUT_COMPLETION_FLAGS{ 179 179 COMP_FLAG_NO_INFO = 0x00, 180 180 COMP_FLAG_FMT_CHANGE = 0x01, 181 181 COMP_FLAG_PIB_VALID = 0x02, ··· 184 184 COMP_FLAG_DATA_BOT = 0x10, 185 185 }; 186 186 187 - typedef struct _BC_DEC_OUT_BUFF{ 188 - BC_DEC_YUV_BUFFS OutPutBuffs; 189 - BC_PIC_INFO_BLOCK PibInfo; 187 + struct BC_DEC_OUT_BUFF{ 188 + struct BC_DEC_YUV_BUFFS OutPutBuffs; 189 + struct BC_PIC_INFO_BLOCK PibInfo; 190 190 uint32_t Flags; 191 191 uint32_t BadFrCnt; 192 - } BC_DEC_OUT_BUFF; 192 + }; 193 193 194 - typedef struct _BC_NOTIFY_MODE { 194 + struct BC_NOTIFY_MODE { 195 195 uint32_t Mode; 196 196 uint32_t Rsvr[3]; 197 - } BC_NOTIFY_MODE; 197 + }; 198 198 199 - typedef struct _BC_CLOCK { 199 + struct BC_CLOCK { 200 200 uint32_t clk; 201 201 uint32_t Rsvr[3]; 202 - } BC_CLOCK; 202 + }; 203 203 204 - typedef struct _BC_IOCTL_DATA { 205 - BC_STATUS RetSts; 204 + struct BC_IOCTL_DATA { 205 + enum BC_STATUS RetSts; 206 206 uint32_t IoctlDataSz; 207 207 uint32_t Timeout; 208 208 union { 209 - BC_CMD_REG_ACC regAcc; 210 - BC_CMD_DEV_MEM devMem; 211 - BC_FW_CMD fwCmd; 212 - BC_HW_TYPE hwType; 213 - BC_PCI_CFG pciCfg; 214 - BC_VERSION_INFO VerInfo; 215 - BC_PROC_INPUT ProcInput; 216 - BC_DEC_YUV_BUFFS RxBuffs; 217 - BC_DEC_OUT_BUFF DecOutData; 218 - BC_START_RX_CAP RxCap; 219 - BC_FLUSH_RX_CAP FlushRxCap; 220 - BC_DTS_STATS drvStat; 221 - BC_NOTIFY_MODE NotifyMode; 222 - BC_CLOCK clockValue; 209 + struct BC_CMD_REG_ACC regAcc; 210 + struct BC_CMD_DEV_MEM devMem; 211 + struct BC_FW_CMD fwCmd; 212 + struct BC_HW_TYPE hwType; 213 + struct BC_PCI_CFG pciCfg; 214 + struct BC_VERSION_INFO VerInfo; 215 + struct BC_PROC_INPUT ProcInput; 216 + struct BC_DEC_YUV_BUFFS RxBuffs; 217 + struct BC_DEC_OUT_BUFF DecOutData; 218 + struct BC_START_RX_CAP RxCap; 219 + struct BC_FLUSH_RX_CAP FlushRxCap; 220 + struct BC_DTS_STATS drvStat; 221 + struct BC_NOTIFY_MODE NotifyMode; 222 + struct BC_CLOCK clockValue; 223 223 } u; 224 224 struct _BC_IOCTL_DATA *next; 225 - } BC_IOCTL_DATA; 225 + }; 226 226 227 - typedef enum _BC_DRV_CMD{ 227 + enum BC_DRV_CMD { 228 228 DRV_CMD_VERSION = 0, /* Get SW version */ 229 229 DRV_CMD_GET_HWTYPE, /* Get HW version and type Dozer/Tank */ 230 230 DRV_CMD_REG_RD, /* Read Device Register */ ··· 249 249 250 250 /* MUST be the last one.. */ 251 251 DRV_CMD_END, /* End of the List.. */ 252 - } BC_DRV_CMD; 252 + }; 253 253 254 254 #define BC_IOC_BASE 'b' 255 255 #define BC_IOC_VOID _IOC_NONE 256 256 #define BC_IOC_IOWR(nr, type) _IOWR(BC_IOC_BASE, nr, type) 257 - #define BC_IOCTL_MB BC_IOCTL_DATA 257 + #define BC_IOCTL_MB struct BC_IOCTL_DATA 258 258 259 259 #define BCM_IOC_GET_VERSION BC_IOC_IOWR(DRV_CMD_VERSION, BC_IOCTL_MB) 260 260 #define BCM_IOC_GET_HWTYPE BC_IOC_IOWR(DRV_CMD_GET_HWTYPE, BC_IOCTL_MB) ··· 280 280 #define BCM_IOC_END BC_IOC_VOID 281 281 282 282 /* Wrapper for main IOCTL data */ 283 - typedef struct _crystalhd_ioctl_data { 284 - BC_IOCTL_DATA udata; /* IOCTL from App..*/ 283 + struct crystalhd_ioctl_data { 284 + struct BC_IOCTL_DATA udata; /* IOCTL from App..*/ 285 285 uint32_t u_id; /* Driver specific user ID */ 286 286 uint32_t cmd; /* Cmd ID for driver's use. */ 287 287 void *add_cdata; /* Additional command specific data..*/ 288 288 uint32_t add_cdata_sz; /* Additional command specific data size */ 289 - struct _crystalhd_ioctl_data *next; /* List/Fifo management */ 290 - } crystalhd_ioctl_data; 289 + struct crystalhd_ioctl_data *next; /* List/Fifo management */ 290 + }; 291 291 292 - 293 - enum _crystalhd_kmod_ver{ 292 + enum crystalhd_kmod_ver{ 294 293 crystalhd_kmod_major = 0, 295 294 crystalhd_kmod_minor = 9, 296 295 crystalhd_kmod_rev = 27,
+82 -78
drivers/staging/crystalhd/crystalhd_cmds.c
··· 69 69 } 70 70 } 71 71 72 - static BC_STATUS bc_cproc_notify_mode(struct crystalhd_cmd *ctx, 73 - crystalhd_ioctl_data *idata) 72 + static enum BC_STATUS bc_cproc_notify_mode(struct crystalhd_cmd *ctx, 73 + struct crystalhd_ioctl_data *idata) 74 74 { 75 75 int rc = 0, i = 0; 76 76 ··· 111 111 return crystalhd_hw_setup_dma_rings(&ctx->hw_ctx); 112 112 } 113 113 114 - static BC_STATUS bc_cproc_get_version(struct crystalhd_cmd *ctx, 115 - crystalhd_ioctl_data *idata) 114 + static enum BC_STATUS bc_cproc_get_version(struct crystalhd_cmd *ctx, 115 + struct crystalhd_ioctl_data *idata) 116 116 { 117 117 118 118 if (!ctx || !idata) { ··· 126 126 } 127 127 128 128 129 - static BC_STATUS bc_cproc_get_hwtype(struct crystalhd_cmd *ctx, crystalhd_ioctl_data *idata) 129 + static enum BC_STATUS bc_cproc_get_hwtype(struct crystalhd_cmd *ctx, 130 + struct crystalhd_ioctl_data *idata) 130 131 { 131 132 if (!ctx || !idata) { 132 133 BCMLOG_ERR("Invalid Arg!!\n"); ··· 144 143 return BC_STS_SUCCESS; 145 144 } 146 145 147 - static BC_STATUS bc_cproc_reg_rd(struct crystalhd_cmd *ctx, 148 - crystalhd_ioctl_data *idata) 146 + static enum BC_STATUS bc_cproc_reg_rd(struct crystalhd_cmd *ctx, 147 + struct crystalhd_ioctl_data *idata) 149 148 { 150 149 if (!ctx || !idata) 151 150 return BC_STS_INV_ARG; ··· 154 153 return BC_STS_SUCCESS; 155 154 } 156 155 157 - static BC_STATUS bc_cproc_reg_wr(struct crystalhd_cmd *ctx, 158 - crystalhd_ioctl_data *idata) 156 + static enum BC_STATUS bc_cproc_reg_wr(struct crystalhd_cmd *ctx, 157 + struct crystalhd_ioctl_data *idata) 159 158 { 160 159 if (!ctx || !idata) 161 160 return BC_STS_INV_ARG; ··· 166 165 return BC_STS_SUCCESS; 167 166 } 168 167 169 - static BC_STATUS bc_cproc_link_reg_rd(struct crystalhd_cmd *ctx, 170 - crystalhd_ioctl_data *idata) 168 + static enum BC_STATUS bc_cproc_link_reg_rd(struct crystalhd_cmd *ctx, 169 + struct crystalhd_ioctl_data *idata) 171 170 { 172 171 if (!ctx || !idata) 173 172 return BC_STS_INV_ARG; ··· 177 176 return BC_STS_SUCCESS; 178 177 } 179 178 180 - static BC_STATUS bc_cproc_link_reg_wr(struct crystalhd_cmd *ctx, 181 - crystalhd_ioctl_data *idata) 179 + static enum BC_STATUS bc_cproc_link_reg_wr(struct crystalhd_cmd *ctx, 180 + struct crystalhd_ioctl_data *idata) 182 181 { 183 182 if (!ctx || !idata) 184 183 return BC_STS_INV_ARG; ··· 189 188 return BC_STS_SUCCESS; 190 189 } 191 190 192 - static BC_STATUS bc_cproc_mem_rd(struct crystalhd_cmd *ctx, 193 - crystalhd_ioctl_data *idata) 191 + static enum BC_STATUS bc_cproc_mem_rd(struct crystalhd_cmd *ctx, 192 + struct crystalhd_ioctl_data *idata) 194 193 { 195 - BC_STATUS sts = BC_STS_SUCCESS; 194 + enum BC_STATUS sts = BC_STS_SUCCESS; 196 195 197 196 if (!ctx || !idata || !idata->add_cdata) 198 197 return BC_STS_INV_ARG; ··· 208 207 209 208 } 210 209 211 - static BC_STATUS bc_cproc_mem_wr(struct crystalhd_cmd *ctx, 212 - crystalhd_ioctl_data *idata) 210 + static enum BC_STATUS bc_cproc_mem_wr(struct crystalhd_cmd *ctx, 211 + struct crystalhd_ioctl_data *idata) 213 212 { 214 - BC_STATUS sts = BC_STS_SUCCESS; 213 + enum BC_STATUS sts = BC_STS_SUCCESS; 215 214 216 215 if (!ctx || !idata || !idata->add_cdata) 217 216 return BC_STS_INV_ARG; ··· 227 226 return sts; 228 227 } 229 228 230 - static BC_STATUS bc_cproc_cfg_rd(struct crystalhd_cmd *ctx, 231 - crystalhd_ioctl_data *idata) 229 + static enum BC_STATUS bc_cproc_cfg_rd(struct crystalhd_cmd *ctx, 230 + struct crystalhd_ioctl_data *idata) 232 231 { 233 232 uint32_t ix, cnt, off, len; 234 - BC_STATUS sts = BC_STS_SUCCESS; 233 + enum BC_STATUS sts = BC_STS_SUCCESS; 235 234 uint32_t *temp; 236 235 237 236 if (!ctx || !idata) ··· 259 258 return sts; 260 259 } 261 260 262 - static BC_STATUS bc_cproc_cfg_wr(struct crystalhd_cmd *ctx, 263 - crystalhd_ioctl_data *idata) 261 + static enum BC_STATUS bc_cproc_cfg_wr(struct crystalhd_cmd *ctx, 262 + struct crystalhd_ioctl_data *idata) 264 263 { 265 264 uint32_t ix, cnt, off, len; 266 - BC_STATUS sts = BC_STS_SUCCESS; 265 + enum BC_STATUS sts = BC_STS_SUCCESS; 267 266 uint32_t *temp; 268 267 269 268 if (!ctx || !idata) ··· 291 290 return sts; 292 291 } 293 292 294 - static BC_STATUS bc_cproc_download_fw(struct crystalhd_cmd *ctx, 295 - crystalhd_ioctl_data *idata) 293 + static enum BC_STATUS bc_cproc_download_fw(struct crystalhd_cmd *ctx, 294 + struct crystalhd_ioctl_data *idata) 296 295 { 297 - BC_STATUS sts = BC_STS_SUCCESS; 296 + enum BC_STATUS sts = BC_STS_SUCCESS; 298 297 299 298 if (!ctx || !idata || !idata->add_cdata || !idata->add_cdata_sz) { 300 299 BCMLOG_ERR("Invalid Arg!!\n"); ··· 330 329 * Abort pending input transfers and issue decoder flush command. 331 330 * 332 331 */ 333 - static BC_STATUS bc_cproc_do_fw_cmd(struct crystalhd_cmd *ctx, crystalhd_ioctl_data *idata) 332 + static enum BC_STATUS bc_cproc_do_fw_cmd(struct crystalhd_cmd *ctx, 333 + struct crystalhd_ioctl_data *idata) 334 334 { 335 - BC_STATUS sts; 335 + enum BC_STATUS sts; 336 336 uint32_t *cmd; 337 337 338 338 if (!(ctx->state & BC_LINK_INIT)) { ··· 373 371 return sts; 374 372 } 375 373 376 - static void bc_proc_in_completion(crystalhd_dio_req *dio_hnd, 377 - wait_queue_head_t *event, BC_STATUS sts) 374 + static void bc_proc_in_completion(struct crystalhd_dio_req *dio_hnd, 375 + wait_queue_head_t *event, enum BC_STATUS sts) 378 376 { 379 377 if (!dio_hnd || !event) { 380 378 BCMLOG_ERR("Invalid Arg!!\n"); ··· 388 386 crystalhd_set_event(event); 389 387 } 390 388 391 - static BC_STATUS bc_cproc_codein_sleep(struct crystalhd_cmd *ctx) 389 + static enum BC_STATUS bc_cproc_codein_sleep(struct crystalhd_cmd *ctx) 392 390 { 393 391 wait_queue_head_t sleep_ev; 394 392 int rc = 0; ··· 408 406 return BC_STS_SUCCESS; 409 407 } 410 408 411 - static BC_STATUS bc_cproc_hw_txdma(struct crystalhd_cmd *ctx, 412 - crystalhd_ioctl_data *idata, 413 - crystalhd_dio_req *dio) 409 + static enum BC_STATUS bc_cproc_hw_txdma(struct crystalhd_cmd *ctx, 410 + struct crystalhd_ioctl_data *idata, 411 + struct crystalhd_dio_req *dio) 414 412 { 415 413 uint32_t tx_listid = 0; 416 - BC_STATUS sts = BC_STS_SUCCESS; 414 + enum BC_STATUS sts = BC_STS_SUCCESS; 417 415 wait_queue_head_t event; 418 416 int rc = 0; 419 417 ··· 473 471 } 474 472 475 473 /* Helper function to check on user buffers */ 476 - static BC_STATUS bc_cproc_check_inbuffs(bool pin, void *ubuff, uint32_t ub_sz, 474 + static enum BC_STATUS bc_cproc_check_inbuffs(bool pin, void *ubuff, uint32_t ub_sz, 477 475 uint32_t uv_off, bool en_422) 478 476 { 479 477 if (!ubuff || !ub_sz) { ··· 504 502 return BC_STS_SUCCESS; 505 503 } 506 504 507 - static BC_STATUS bc_cproc_proc_input(struct crystalhd_cmd *ctx, crystalhd_ioctl_data *idata) 505 + static enum BC_STATUS bc_cproc_proc_input(struct crystalhd_cmd *ctx, 506 + struct crystalhd_ioctl_data *idata) 508 507 { 509 508 void *ubuff; 510 509 uint32_t ub_sz; 511 - crystalhd_dio_req *dio_hnd = NULL; 512 - BC_STATUS sts = BC_STS_SUCCESS; 510 + struct crystalhd_dio_req *dio_hnd = NULL; 511 + enum BC_STATUS sts = BC_STS_SUCCESS; 513 512 514 513 if (!ctx || !idata) { 515 514 BCMLOG_ERR("Invalid Arg!!\n"); ··· 540 537 return sts; 541 538 } 542 539 543 - static BC_STATUS bc_cproc_add_cap_buff(struct crystalhd_cmd *ctx, 544 - crystalhd_ioctl_data *idata) 540 + static enum BC_STATUS bc_cproc_add_cap_buff(struct crystalhd_cmd *ctx, 541 + struct crystalhd_ioctl_data *idata) 545 542 { 546 543 void *ubuff; 547 544 uint32_t ub_sz, uv_off; 548 545 bool en_422; 549 - crystalhd_dio_req *dio_hnd = NULL; 550 - BC_STATUS sts = BC_STS_SUCCESS; 546 + struct crystalhd_dio_req *dio_hnd = NULL; 547 + enum BC_STATUS sts = BC_STS_SUCCESS; 551 548 552 549 if (!ctx || !idata) { 553 550 BCMLOG_ERR("Invalid Arg!!\n"); ··· 582 579 return BC_STS_SUCCESS; 583 580 } 584 581 585 - static BC_STATUS bc_cproc_fmt_change(struct crystalhd_cmd *ctx, 586 - crystalhd_dio_req *dio) 582 + static enum BC_STATUS bc_cproc_fmt_change(struct crystalhd_cmd *ctx, 583 + struct crystalhd_dio_req *dio) 587 584 { 588 - BC_STATUS sts = BC_STS_SUCCESS; 585 + enum BC_STATUS sts = BC_STS_SUCCESS; 589 586 590 587 sts = crystalhd_hw_add_cap_buffer(&ctx->hw_ctx, dio, 0); 591 588 if (sts != BC_STS_SUCCESS) ··· 598 595 return sts; 599 596 } 600 597 601 - static BC_STATUS bc_cproc_fetch_frame(struct crystalhd_cmd *ctx, 602 - crystalhd_ioctl_data *idata) 598 + static enum BC_STATUS bc_cproc_fetch_frame(struct crystalhd_cmd *ctx, 599 + struct crystalhd_ioctl_data *idata) 603 600 { 604 - crystalhd_dio_req *dio = NULL; 605 - BC_STATUS sts = BC_STS_SUCCESS; 606 - BC_DEC_OUT_BUFF *frame; 601 + struct crystalhd_dio_req *dio = NULL; 602 + enum BC_STATUS sts = BC_STS_SUCCESS; 603 + struct BC_DEC_OUT_BUFF *frame; 607 604 608 605 if (!ctx || !idata) { 609 606 BCMLOG_ERR("Invalid Arg!!\n"); ··· 639 636 return BC_STS_SUCCESS; 640 637 } 641 638 642 - static BC_STATUS bc_cproc_start_capture(struct crystalhd_cmd *ctx, 643 - crystalhd_ioctl_data *idata) 639 + static enum BC_STATUS bc_cproc_start_capture(struct crystalhd_cmd *ctx, 640 + struct crystalhd_ioctl_data *idata) 644 641 { 645 642 ctx->state |= BC_LINK_CAP_EN; 646 643 if (ctx->state == BC_LINK_READY) ··· 649 646 return BC_STS_SUCCESS; 650 647 } 651 648 652 - static BC_STATUS bc_cproc_flush_cap_buffs(struct crystalhd_cmd *ctx, 653 - crystalhd_ioctl_data *idata) 649 + static enum BC_STATUS bc_cproc_flush_cap_buffs(struct crystalhd_cmd *ctx, 650 + struct crystalhd_ioctl_data *idata) 654 651 { 655 - crystalhd_dio_req *dio = NULL; 656 - BC_STATUS sts = BC_STS_SUCCESS; 657 - BC_DEC_OUT_BUFF *frame; 652 + struct crystalhd_dio_req *dio = NULL; 653 + enum BC_STATUS sts = BC_STS_SUCCESS; 654 + struct BC_DEC_OUT_BUFF *frame; 658 655 uint32_t count; 659 656 660 657 if (!ctx || !idata) { ··· 684 681 return crystalhd_hw_stop_capture(&ctx->hw_ctx); 685 682 } 686 683 687 - static BC_STATUS bc_cproc_get_stats(struct crystalhd_cmd *ctx, 688 - crystalhd_ioctl_data *idata) 684 + static enum BC_STATUS bc_cproc_get_stats(struct crystalhd_cmd *ctx, 685 + struct crystalhd_ioctl_data *idata) 689 686 { 690 - BC_DTS_STATS *stats; 687 + struct BC_DTS_STATS *stats; 691 688 struct crystalhd_hw_stats hw_stats; 692 689 693 690 if (!ctx || !idata) { ··· 716 713 return BC_STS_SUCCESS; 717 714 } 718 715 719 - static BC_STATUS bc_cproc_reset_stats(struct crystalhd_cmd *ctx, 720 - crystalhd_ioctl_data *idata) 716 + static enum BC_STATUS bc_cproc_reset_stats(struct crystalhd_cmd *ctx, 717 + struct crystalhd_ioctl_data *idata) 721 718 { 722 719 crystalhd_hw_stats(&ctx->hw_ctx, NULL); 723 720 724 721 return BC_STS_SUCCESS; 725 722 } 726 723 727 - static BC_STATUS bc_cproc_chg_clk(struct crystalhd_cmd *ctx, 728 - crystalhd_ioctl_data *idata) 724 + static enum BC_STATUS bc_cproc_chg_clk(struct crystalhd_cmd *ctx, 725 + struct crystalhd_ioctl_data *idata) 729 726 { 730 - BC_CLOCK *clock; 727 + struct BC_CLOCK *clock; 731 728 uint32_t oldClk; 732 - BC_STATUS sts = BC_STS_SUCCESS; 729 + enum BC_STATUS sts = BC_STS_SUCCESS; 733 730 734 731 if (!ctx || !idata) { 735 732 BCMLOG_ERR("Invalid Arg!!\n"); ··· 752 749 } 753 750 754 751 /*=============== Cmd Proc Table.. ======================================*/ 755 - static const crystalhd_cmd_tbl_t g_crystalhd_cproc_tbl[] = { 752 + static const struct crystalhd_cmd_tbl g_crystalhd_cproc_tbl[] = { 756 753 { BCM_IOC_GET_VERSION, bc_cproc_get_version, 0}, 757 754 { BCM_IOC_GET_HWTYPE, bc_cproc_get_hwtype, 0}, 758 755 { BCM_IOC_REG_RD, bc_cproc_reg_rd, 0}, ··· 799 796 * we pass on the power mangement notification to our plug-in by completing 800 797 * all outstanding requests with BC_STS_IO_USER_ABORT return code. 801 798 */ 802 - BC_STATUS crystalhd_suspend(struct crystalhd_cmd *ctx, crystalhd_ioctl_data *idata) 799 + enum BC_STATUS crystalhd_suspend(struct crystalhd_cmd *ctx, 800 + struct crystalhd_ioctl_data *idata) 803 801 { 804 - BC_STATUS sts = BC_STS_SUCCESS; 802 + enum BC_STATUS sts = BC_STS_SUCCESS; 805 803 806 804 if (!ctx || !idata) { 807 805 BCMLOG_ERR("Invalid Parameters\n"); ··· 858 854 * start a new playback session from the pre-suspend clip position. 859 855 * 860 856 */ 861 - BC_STATUS crystalhd_resume(struct crystalhd_cmd *ctx) 857 + enum BC_STATUS crystalhd_resume(struct crystalhd_cmd *ctx) 862 858 { 863 859 BCMLOG(BCMLOG_DBG, "crystalhd_resume Success %x\n", ctx->state); 864 860 ··· 879 875 * application specific resources. HW layer initialization 880 876 * is done for the first open request. 881 877 */ 882 - BC_STATUS crystalhd_user_open(struct crystalhd_cmd *ctx, 878 + enum BC_STATUS crystalhd_user_open(struct crystalhd_cmd *ctx, 883 879 struct crystalhd_user **user_ctx) 884 880 { 885 881 struct crystalhd_user *uc; ··· 917 913 * Closer aplication handle and release app specific 918 914 * resources. 919 915 */ 920 - BC_STATUS crystalhd_user_close(struct crystalhd_cmd *ctx, struct crystalhd_user *uc) 916 + enum BC_STATUS crystalhd_user_close(struct crystalhd_cmd *ctx, struct crystalhd_user *uc) 921 917 { 922 918 uint32_t mode = uc->mode; 923 919 ··· 952 948 * 953 949 * Called at the time of driver load. 954 950 */ 955 - BC_STATUS __devinit crystalhd_setup_cmd_context(struct crystalhd_cmd *ctx, 951 + enum BC_STATUS __devinit crystalhd_setup_cmd_context(struct crystalhd_cmd *ctx, 956 952 struct crystalhd_adp *adp) 957 953 { 958 954 int i = 0; ··· 987 983 * 988 984 * Called at the time of driver un-load. 989 985 */ 990 - BC_STATUS __devexit crystalhd_delete_cmd_context(struct crystalhd_cmd *ctx) 986 + enum BC_STATUS __devexit crystalhd_delete_cmd_context(struct crystalhd_cmd *ctx) 991 987 { 992 988 BCMLOG(BCMLOG_DBG, "Deleting Command context..\n"); 993 989 ··· 1025 1021 return NULL; 1026 1022 } 1027 1023 1028 - tbl_sz = sizeof(g_crystalhd_cproc_tbl) / sizeof(crystalhd_cmd_tbl_t); 1024 + tbl_sz = sizeof(g_crystalhd_cproc_tbl) / sizeof(struct crystalhd_cmd_tbl); 1029 1025 for (i = 0; i < tbl_sz; i++) { 1030 1026 if (g_crystalhd_cproc_tbl[i].cmd_id == cmd) { 1031 1027 if ((uc->mode == DTS_MONITOR_MODE) &&
+10 -11
drivers/staging/crystalhd/crystalhd_cmds.h
··· 36 36 #include "crystalhd_misc.h" 37 37 #include "crystalhd_hw.h" 38 38 39 - enum _crystalhd_state{ 39 + enum crystalhd_state{ 40 40 BC_LINK_INVALID = 0x00, 41 41 BC_LINK_INIT = 0x01, 42 42 BC_LINK_CAP_EN = 0x02, ··· 66 66 struct crystalhd_hw hw_ctx; 67 67 }; 68 68 69 - typedef BC_STATUS(*crystalhd_cmd_proc)(struct crystalhd_cmd *, crystalhd_ioctl_data *); 69 + typedef enum BC_STATUS(*crystalhd_cmd_proc)(struct crystalhd_cmd *, struct crystalhd_ioctl_data *); 70 70 71 - typedef struct _crystalhd_cmd_tbl { 71 + struct crystalhd_cmd_tbl { 72 72 uint32_t cmd_id; 73 73 const crystalhd_cmd_proc cmd_proc; 74 74 uint32_t block_mon; 75 - } crystalhd_cmd_tbl_t; 75 + }; 76 76 77 - 78 - BC_STATUS crystalhd_suspend(struct crystalhd_cmd *ctx, crystalhd_ioctl_data *idata); 79 - BC_STATUS crystalhd_resume(struct crystalhd_cmd *ctx); 77 + enum BC_STATUS crystalhd_suspend(struct crystalhd_cmd *ctx, struct crystalhd_ioctl_data *idata); 78 + enum BC_STATUS crystalhd_resume(struct crystalhd_cmd *ctx); 80 79 crystalhd_cmd_proc crystalhd_get_cmd_proc(struct crystalhd_cmd *ctx, uint32_t cmd, 81 80 struct crystalhd_user *uc); 82 - BC_STATUS crystalhd_user_open(struct crystalhd_cmd *ctx, struct crystalhd_user **user_ctx); 83 - BC_STATUS crystalhd_user_close(struct crystalhd_cmd *ctx, struct crystalhd_user *uc); 84 - BC_STATUS crystalhd_setup_cmd_context(struct crystalhd_cmd *ctx, struct crystalhd_adp *adp); 85 - BC_STATUS crystalhd_delete_cmd_context(struct crystalhd_cmd *ctx); 81 + enum BC_STATUS crystalhd_user_open(struct crystalhd_cmd *ctx, struct crystalhd_user **user_ctx); 82 + enum BC_STATUS crystalhd_user_close(struct crystalhd_cmd *ctx, struct crystalhd_user *uc); 83 + enum BC_STATUS crystalhd_setup_cmd_context(struct crystalhd_cmd *ctx, struct crystalhd_adp *adp); 84 + enum BC_STATUS crystalhd_delete_cmd_context(struct crystalhd_cmd *ctx); 86 85 bool crystalhd_cmd_interrupt(struct crystalhd_cmd *ctx); 87 86 88 87 #endif
+27 -33
drivers/staging/crystalhd/crystalhd_fw_if.h
··· 29 29 30 30 /* TBD: Pull in only required defs into this file.. */ 31 31 32 - 33 - 34 32 /* User Data Header */ 35 - typedef struct user_data { 33 + struct user_data { 36 34 struct user_data *next; 37 35 uint32_t type; 38 36 uint32_t size; 39 - } UD_HDR; 40 - 41 - 37 + }; 42 38 43 39 /*------------------------------------------------------* 44 40 * MPEG Extension to the PPB * 45 41 *------------------------------------------------------*/ 46 - typedef struct { 42 + struct ppb_mpeg { 47 43 uint32_t to_be_defined; 48 44 uint32_t valid; 49 45 ··· 57 61 /* MPEG_VALID_USERDATA 58 62 User data is in the form of a linked list. */ 59 63 int32_t userDataSize; 60 - UD_HDR *userData; 64 + struct user_data *userData; 61 65 62 - } PPB_MPEG; 66 + }; 63 67 64 68 65 69 /*------------------------------------------------------* 66 70 * VC1 Extension to the PPB * 67 71 *------------------------------------------------------*/ 68 - typedef struct { 72 + struct ppb_vc1 { 69 73 uint32_t to_be_defined; 70 74 uint32_t valid; 71 75 ··· 84 88 /* VC1_VALID_USERDATA 85 89 User data is in the form of a linked list. */ 86 90 int32_t userDataSize; 87 - UD_HDR *userData; 91 + struct user_data *userData; 88 92 89 - } PPB_VC1; 93 + }; 90 94 91 95 /*------------------------------------------------------* 92 96 * H.264 Extension to the PPB * ··· 104 108 /* maximum number of intervals(as many as 256 intervals?) */ 105 109 #define MAX_FGT_VALUE_INTERVAL (256) 106 110 107 - typedef struct FGT_SEI { 108 - struct FGT_SEI *next; 111 + struct fgt_sei { 112 + struct fgt_sei *next; 109 113 unsigned char model_values[3][MAX_FGT_VALUE_INTERVAL][MAX_FGT_MODEL_VALUE]; 110 114 unsigned char upper_bound[3][MAX_FGT_VALUE_INTERVAL]; 111 115 unsigned char lower_bound[3][MAX_FGT_VALUE_INTERVAL]; ··· 130 134 unsigned char num_model_values[3]; /* Number of model values. */ 131 135 uint16_t repetition_period; /* Repetition period (0-16384) */ 132 136 133 - } FGT_SEI; 137 + }; 134 138 135 - typedef struct { 139 + struct ppb_h264 { 136 140 /* 'valid' specifies which fields (or sets of 137 141 * fields) below are valid. If the corresponding 138 142 * bit in 'valid' is NOT set then that field(s) ··· 166 170 167 171 /* H264_VALID_USER */ 168 172 uint32_t user_data_size; 169 - UD_HDR *user_data; 173 + struct user_data *user_data; 170 174 171 175 /* H264 VALID FGT */ 172 - FGT_SEI *pfgt; 176 + struct fgt_sei *pfgt; 173 177 174 - } PPB_H264; 178 + }; 175 179 176 - typedef struct { 180 + struct ppb { 177 181 /* Common fields. */ 178 182 uint32_t picture_number; /* Ordinal display number */ 179 183 uint32_t video_buffer; /* Video (picbuf) number */ ··· 211 215 212 216 /* Protocol-specific extensions. */ 213 217 union { 214 - PPB_H264 h264; 215 - PPB_MPEG mpeg; 216 - PPB_VC1 vc1; 218 + struct ppb_h264 h264; 219 + struct ppb_mpeg mpeg; 220 + struct ppb_vc1 vc1; 217 221 } other; 218 222 219 - } PPB; 223 + }; 220 224 221 - typedef struct { 225 + struct c011_pib { 222 226 uint32_t bFormatChange; 223 227 uint32_t resolution; 224 228 uint32_t channelId; ··· 227 231 uint32_t zeroPanscanValid; 228 232 uint32_t dramOutBufAddr; 229 233 uint32_t yComponent; 230 - PPB ppb; 234 + struct ppb ppb; 231 235 232 - } C011_PIB; 236 + }; 233 237 234 - 235 - 236 - typedef struct { 238 + struct dec_rsp_channel_start_video { 237 239 uint32_t command; 238 240 uint32_t sequence; 239 241 uint32_t status; ··· 245 251 uint32_t transportStreamCaptureAddr; 246 252 uint32_t asyncEventQ; 247 253 248 - } DecRspChannelStartVideo; 254 + }; 249 255 250 256 #define eCMD_C011_CMD_BASE (0x73763000) 251 257 252 258 /* host commands */ 253 - typedef enum { 259 + enum c011_ts_cmd { 254 260 eCMD_TS_GET_NEXT_PIC = 0x7376F100, /* debug get next picture */ 255 261 eCMD_TS_GET_LAST_PIC = 0x7376F102, /* debug get last pic status */ 256 262 eCMD_TS_READ_WRITE_MEM = 0x7376F104, /* debug read write memory */ ··· 358 364 359 365 eNOTIFY_C011_ENC_CHAN_EVENT = eCMD_C011_CMD_BASE + 0x210, 360 366 361 - } eC011_TS_CMD; 367 + }; 362 368 363 369 #endif
+92 -91
drivers/staging/crystalhd/crystalhd_hw.c
··· 61 61 62 62 static bool crystalhd_bring_out_of_rst(struct crystalhd_adp *adp) 63 63 { 64 - link_misc_perst_deco_ctrl rst_deco_cntrl; 65 - link_misc_perst_clk_ctrl rst_clk_cntrl; 64 + union link_misc_perst_deco_ctrl rst_deco_cntrl; 65 + union link_misc_perst_clk_ctrl rst_clk_cntrl; 66 66 uint32_t temp; 67 67 68 68 /* ··· 122 122 123 123 static bool crystalhd_put_in_reset(struct crystalhd_adp *adp) 124 124 { 125 - link_misc_perst_deco_ctrl rst_deco_cntrl; 126 - link_misc_perst_clk_ctrl rst_clk_cntrl; 125 + union link_misc_perst_deco_ctrl rst_deco_cntrl; 126 + union link_misc_perst_clk_ctrl rst_clk_cntrl; 127 127 uint32_t temp; 128 128 129 129 /* ··· 178 178 179 179 static void crystalhd_disable_interrupts(struct crystalhd_adp *adp) 180 180 { 181 - intr_mask_reg intr_mask; 181 + union intr_mask_reg intr_mask; 182 182 intr_mask.whole_reg = crystalhd_reg_rd(adp, INTR_INTR_MSK_STS_REG); 183 183 intr_mask.mask_pcie_err = 1; 184 184 intr_mask.mask_pcie_rbusmast_err = 1; ··· 194 194 195 195 static void crystalhd_enable_interrupts(struct crystalhd_adp *adp) 196 196 { 197 - intr_mask_reg intr_mask; 197 + union intr_mask_reg intr_mask; 198 198 intr_mask.whole_reg = crystalhd_reg_rd(adp, INTR_INTR_MSK_STS_REG); 199 199 intr_mask.mask_pcie_err = 1; 200 200 intr_mask.mask_pcie_rbusmast_err = 1; ··· 348 348 return true; 349 349 } 350 350 351 - static crystalhd_rx_dma_pkt *crystalhd_hw_alloc_rx_pkt(struct crystalhd_hw *hw) 351 + static struct crystalhd_rx_dma_pkt *crystalhd_hw_alloc_rx_pkt(struct crystalhd_hw *hw) 352 352 { 353 353 unsigned long flags = 0; 354 - crystalhd_rx_dma_pkt *temp = NULL; 354 + struct crystalhd_rx_dma_pkt *temp = NULL; 355 355 356 356 if (!hw) 357 357 return NULL; ··· 370 370 } 371 371 372 372 static void crystalhd_hw_free_rx_pkt(struct crystalhd_hw *hw, 373 - crystalhd_rx_dma_pkt *pkt) 373 + struct crystalhd_rx_dma_pkt *pkt) 374 374 { 375 375 unsigned long flags = 0; 376 376 ··· 406 406 static void crystalhd_rx_pkt_rel_call_back(void *context, void *data) 407 407 { 408 408 struct crystalhd_hw *hw = (struct crystalhd_hw *)context; 409 - crystalhd_rx_dma_pkt *pkt = (crystalhd_rx_dma_pkt *)data; 409 + struct crystalhd_rx_dma_pkt *pkt = (struct crystalhd_rx_dma_pkt *)data; 410 410 411 411 if (!pkt || !hw) { 412 412 BCMLOG_ERR("Invalid arg - %p %p\n", hw, pkt); ··· 453 453 * TX - Active & Free 454 454 * RX - Active, Ready and Free. 455 455 */ 456 - static BC_STATUS crystalhd_hw_create_ioqs(struct crystalhd_hw *hw) 456 + static enum BC_STATUS crystalhd_hw_create_ioqs(struct crystalhd_hw *hw) 457 457 { 458 - BC_STATUS sts = BC_STS_SUCCESS; 458 + enum BC_STATUS sts = BC_STS_SUCCESS; 459 459 460 460 if (!hw) { 461 461 BCMLOG_ERR("Invalid Arg!!\n"); ··· 523 523 return false; 524 524 } 525 525 526 - static BC_STATUS crystalhd_hw_tx_req_complete(struct crystalhd_hw *hw, 527 - uint32_t list_id, BC_STATUS cs) 526 + static enum BC_STATUS crystalhd_hw_tx_req_complete(struct crystalhd_hw *hw, 527 + uint32_t list_id, enum BC_STATUS cs) 528 528 { 529 - tx_dma_pkt *tx_req; 529 + struct tx_dma_pkt *tx_req; 530 530 531 531 if (!hw || !list_id) { 532 532 BCMLOG_ERR("Invalid Arg..\n"); ··· 535 535 536 536 hw->pwr_lock--; 537 537 538 - tx_req = (tx_dma_pkt *)crystalhd_dioq_find_and_fetch(hw->tx_actq, list_id); 538 + tx_req = (struct tx_dma_pkt *)crystalhd_dioq_find_and_fetch(hw->tx_actq, list_id); 539 539 if (!tx_req) { 540 540 if (cs != BC_STS_IO_USER_ABORT) 541 541 BCMLOG_ERR("Find and Fetch Did not find req\n"); ··· 654 654 hw->stats.tx_errors++; 655 655 } 656 656 657 - static void crystalhd_hw_dump_desc(pdma_descriptor p_dma_desc, 657 + static void crystalhd_hw_dump_desc(struct dma_descriptor *p_dma_desc, 658 658 uint32_t ul_desc_index, uint32_t cnt) 659 659 { 660 660 uint32_t ix, ll = 0; ··· 682 682 683 683 } 684 684 685 - static BC_STATUS crystalhd_hw_fill_desc(crystalhd_dio_req *ioreq, 686 - dma_descriptor *desc, 685 + static enum BC_STATUS crystalhd_hw_fill_desc(struct crystalhd_dio_req *ioreq, 686 + struct dma_descriptor *desc, 687 687 dma_addr_t desc_paddr_base, 688 688 uint32_t sg_cnt, uint32_t sg_st_ix, 689 689 uint32_t sg_st_off, uint32_t xfr_sz) 690 690 { 691 691 uint32_t count = 0, ix = 0, sg_ix = 0, len = 0, last_desc_ix = 0; 692 692 dma_addr_t desc_phy_addr = desc_paddr_base; 693 - addr_64 addr_temp; 693 + union addr_64 addr_temp; 694 694 695 695 if (!ioreq || !desc || !desc_paddr_base || !xfr_sz || 696 696 (!sg_cnt && !ioreq->uinfo.dir_tx)) { ··· 721 721 desc[ix].dma_dir = ioreq->uinfo.dir_tx; 722 722 723 723 /* Chain DMA descriptor. */ 724 - addr_temp.full_addr = desc_phy_addr + sizeof(dma_descriptor); 724 + addr_temp.full_addr = desc_phy_addr + sizeof(struct dma_descriptor); 725 725 desc[ix].next_desc_addr_low = addr_temp.low_part; 726 726 desc[ix].next_desc_addr_high = addr_temp.high_part; 727 727 ··· 740 740 crystalhd_hw_dump_desc(desc, ix, 1); 741 741 742 742 count += len; 743 - desc_phy_addr += sizeof(dma_descriptor); 743 + desc_phy_addr += sizeof(struct dma_descriptor); 744 744 } 745 745 746 746 last_desc_ix = ix - 1; ··· 773 773 return BC_STS_SUCCESS; 774 774 } 775 775 776 - static BC_STATUS crystalhd_xlat_sgl_to_dma_desc(crystalhd_dio_req *ioreq, 777 - pdma_desc_mem pdesc_mem, 776 + static enum BC_STATUS crystalhd_xlat_sgl_to_dma_desc(struct crystalhd_dio_req *ioreq, 777 + struct dma_desc_mem *pdesc_mem, 778 778 uint32_t *uv_desc_index) 779 779 { 780 - dma_descriptor *desc = NULL; 780 + struct dma_descriptor *desc = NULL; 781 781 dma_addr_t desc_paddr_base = 0; 782 782 uint32_t sg_cnt = 0, sg_st_ix = 0, sg_st_off = 0; 783 783 uint32_t xfr_sz = 0; 784 - BC_STATUS sts = BC_STS_SUCCESS; 784 + enum BC_STATUS sts = BC_STS_SUCCESS; 785 785 786 786 /* Check params.. */ 787 787 if (!ioreq || !pdesc_mem || !uv_desc_index) { ··· 821 821 /* Prepare for UV mapping.. */ 822 822 desc = &pdesc_mem->pdma_desc_start[sg_cnt]; 823 823 desc_paddr_base = pdesc_mem->phy_addr + 824 - (sg_cnt * sizeof(dma_descriptor)); 824 + (sg_cnt * sizeof(struct dma_descriptor)); 825 825 826 826 /* Done with desc addr.. now update sg stuff.*/ 827 827 sg_cnt = ioreq->sg_cnt - ioreq->uinfo.uv_sg_ix; ··· 858 858 * Verify if the Stop generates a completion interrupt or not. 859 859 * if it does not generate an interrupt, then add polling here. 860 860 */ 861 - static BC_STATUS crystalhd_stop_tx_dma_engine(struct crystalhd_hw *hw) 861 + static enum BC_STATUS crystalhd_stop_tx_dma_engine(struct crystalhd_hw *hw) 862 862 { 863 863 uint32_t dma_cntrl, cnt = 30; 864 864 uint32_t l1 = 1, l2 = 1; ··· 1021 1021 return true; 1022 1022 } 1023 1023 1024 - static void cpy_pib_to_app(C011_PIB *src_pib, BC_PIC_INFO_BLOCK *dst_pib) 1024 + static void cpy_pib_to_app(struct c011_pib *src_pib, struct BC_PIC_INFO_BLOCK *dst_pib) 1025 1025 { 1026 1026 if (!src_pib || !dst_pib) { 1027 1027 BCMLOG_ERR("Invalid Arguments\n"); ··· 1046 1046 static void crystalhd_hw_proc_pib(struct crystalhd_hw *hw) 1047 1047 { 1048 1048 unsigned int cnt; 1049 - C011_PIB src_pib; 1049 + struct c011_pib src_pib; 1050 1050 uint32_t pib_addr, pib_cnt; 1051 - BC_PIC_INFO_BLOCK *AppPib; 1052 - crystalhd_rx_dma_pkt *rx_pkt = NULL; 1051 + struct BC_PIC_INFO_BLOCK *AppPib; 1052 + struct crystalhd_rx_dma_pkt *rx_pkt = NULL; 1053 1053 1054 1054 pib_cnt = crystalhd_get_pib_avail_cnt(hw); 1055 1055 ··· 1059 1059 for (cnt = 0; cnt < pib_cnt; cnt++) { 1060 1060 1061 1061 pib_addr = crystalhd_get_addr_from_pib_Q(hw); 1062 - crystalhd_mem_rd(hw->adp, pib_addr, sizeof(C011_PIB) / 4, 1062 + crystalhd_mem_rd(hw->adp, pib_addr, sizeof(struct c011_pib) / 4, 1063 1063 (uint32_t *)&src_pib); 1064 1064 1065 1065 if (src_pib.bFormatChange) { 1066 - rx_pkt = (crystalhd_rx_dma_pkt *)crystalhd_dioq_fetch(hw->rx_freeq); 1066 + rx_pkt = (struct crystalhd_rx_dma_pkt *)crystalhd_dioq_fetch(hw->rx_freeq); 1067 1067 if (!rx_pkt) 1068 1068 return; 1069 1069 rx_pkt->flags = 0; ··· 1168 1168 count, hw->rx_list_sts[0], hw->rx_list_sts[1]); 1169 1169 } 1170 1170 1171 - static BC_STATUS crystalhd_hw_prog_rxdma(struct crystalhd_hw *hw, crystalhd_rx_dma_pkt *rx_pkt) 1171 + static enum BC_STATUS crystalhd_hw_prog_rxdma(struct crystalhd_hw *hw, struct crystalhd_rx_dma_pkt *rx_pkt) 1172 1172 { 1173 1173 uint32_t y_low_addr_reg, y_high_addr_reg; 1174 1174 uint32_t uv_low_addr_reg, uv_high_addr_reg; 1175 - addr_64 desc_addr; 1175 + union addr_64 desc_addr; 1176 1176 unsigned long flags; 1177 1177 1178 1178 if (!hw || !rx_pkt) { ··· 1228 1228 return BC_STS_SUCCESS; 1229 1229 } 1230 1230 1231 - static BC_STATUS crystalhd_hw_post_cap_buff(struct crystalhd_hw *hw, 1232 - crystalhd_rx_dma_pkt *rx_pkt) 1231 + static enum BC_STATUS crystalhd_hw_post_cap_buff(struct crystalhd_hw *hw, 1232 + struct crystalhd_rx_dma_pkt *rx_pkt) 1233 1233 { 1234 - BC_STATUS sts = crystalhd_hw_prog_rxdma(hw, rx_pkt); 1234 + enum BC_STATUS sts = crystalhd_hw_prog_rxdma(hw, rx_pkt); 1235 1235 1236 1236 if (sts == BC_STS_BUSY) 1237 1237 crystalhd_dioq_add(hw->rx_freeq, (void *)rx_pkt, ··· 1287 1287 crystalhd_reg_wr(hw->adp, PCIE_DLL_DATA_LINK_CONTROL, aspm); 1288 1288 } 1289 1289 1290 - static BC_STATUS crystalhd_rx_pkt_done(struct crystalhd_hw *hw, uint32_t list_index, 1291 - BC_STATUS comp_sts) 1290 + static enum BC_STATUS crystalhd_rx_pkt_done(struct crystalhd_hw *hw, uint32_t list_index, 1291 + enum BC_STATUS comp_sts) 1292 1292 { 1293 - crystalhd_rx_dma_pkt *rx_pkt = NULL; 1293 + struct crystalhd_rx_dma_pkt *rx_pkt = NULL; 1294 1294 uint32_t y_dw_dnsz, uv_dw_dnsz; 1295 - BC_STATUS sts = BC_STS_SUCCESS; 1295 + enum BC_STATUS sts = BC_STS_SUCCESS; 1296 1296 1297 1297 if (!hw || list_index >= DMA_ENGINE_CNT) { 1298 1298 BCMLOG_ERR("Invalid Arguments\n"); ··· 1328 1328 uint32_t y_err_sts, uint32_t uv_err_sts) 1329 1329 { 1330 1330 uint32_t tmp; 1331 - list_sts tmp_lsts; 1331 + enum list_sts tmp_lsts; 1332 1332 1333 1333 if (!(y_err_sts & GET_Y0_ERR_MSK) && !(uv_err_sts & GET_UV0_ERR_MSK)) 1334 1334 return false; ··· 1396 1396 uint32_t y_err_sts, uint32_t uv_err_sts) 1397 1397 { 1398 1398 uint32_t tmp; 1399 - list_sts tmp_lsts; 1399 + enum list_sts tmp_lsts; 1400 1400 1401 1401 if (!(y_err_sts & GET_Y1_ERR_MSK) && !(uv_err_sts & GET_UV1_ERR_MSK)) 1402 1402 return false; ··· 1467 1467 { 1468 1468 unsigned long flags; 1469 1469 uint32_t i, list_avail = 0; 1470 - BC_STATUS comp_sts = BC_STS_NO_DATA; 1470 + enum BC_STATUS comp_sts = BC_STS_NO_DATA; 1471 1471 uint32_t y_err_sts, uv_err_sts, y_dn_sz = 0, uv_dn_sz = 0; 1472 1472 bool ret = 0; 1473 1473 ··· 1535 1535 } 1536 1536 } 1537 1537 1538 - static BC_STATUS crystalhd_fw_cmd_post_proc(struct crystalhd_hw *hw, 1539 - BC_FW_CMD *fw_cmd) 1538 + static enum BC_STATUS crystalhd_fw_cmd_post_proc(struct crystalhd_hw *hw, 1539 + struct BC_FW_CMD *fw_cmd) 1540 1540 { 1541 - BC_STATUS sts = BC_STS_SUCCESS; 1542 - DecRspChannelStartVideo *st_rsp = NULL; 1541 + enum BC_STATUS sts = BC_STS_SUCCESS; 1542 + struct dec_rsp_channel_start_video *st_rsp = NULL; 1543 1543 1544 1544 switch (fw_cmd->cmd[0]) { 1545 1545 case eCMD_C011_DEC_CHAN_START_VIDEO: 1546 - st_rsp = (DecRspChannelStartVideo *)fw_cmd->rsp; 1546 + st_rsp = (struct dec_rsp_channel_start_video *)fw_cmd->rsp; 1547 1547 hw->pib_del_Q_addr = st_rsp->picInfoDeliveryQ; 1548 1548 hw->pib_rel_Q_addr = st_rsp->picInfoReleaseQ; 1549 1549 BCMLOG(BCMLOG_DBG, "DelQAddr:%x RelQAddr:%x\n", ··· 1561 1561 return sts; 1562 1562 } 1563 1563 1564 - static BC_STATUS crystalhd_put_ddr2sleep(struct crystalhd_hw *hw) 1564 + static enum BC_STATUS crystalhd_put_ddr2sleep(struct crystalhd_hw *hw) 1565 1565 { 1566 1566 uint32_t reg; 1567 - link_misc_perst_decoder_ctrl rst_cntrl_reg; 1567 + union link_misc_perst_decoder_ctrl rst_cntrl_reg; 1568 1568 1569 1569 /* Pulse reset pin of 7412 (MISC_PERST_DECODER_CTRL) */ 1570 1570 rst_cntrl_reg.whole_reg = crystalhd_reg_rd(hw->adp, MISC_PERST_DECODER_CTRL); ··· 1622 1622 ** 1623 1623 *************************************************/ 1624 1624 1625 - BC_STATUS crystalhd_download_fw(struct crystalhd_adp *adp, void *buffer, uint32_t sz) 1625 + enum BC_STATUS crystalhd_download_fw(struct crystalhd_adp *adp, void *buffer, uint32_t sz) 1626 1626 { 1627 1627 uint32_t reg_data, cnt, *temp_buff; 1628 1628 uint32_t fw_sig_len = 36; ··· 1714 1714 return BC_STS_SUCCESS;; 1715 1715 } 1716 1716 1717 - BC_STATUS crystalhd_do_fw_cmd(struct crystalhd_hw *hw, BC_FW_CMD *fw_cmd) 1717 + enum BC_STATUS crystalhd_do_fw_cmd(struct crystalhd_hw *hw, 1718 + struct BC_FW_CMD *fw_cmd) 1718 1719 { 1719 1720 uint32_t cnt = 0, cmd_res_addr; 1720 1721 uint32_t *cmd_buff, *res_buff; 1721 1722 wait_queue_head_t fw_cmd_event; 1722 1723 int rc = 0; 1723 - BC_STATUS sts; 1724 + enum BC_STATUS sts; 1724 1725 1725 1726 crystalhd_create_event(&fw_cmd_event); 1726 1727 ··· 1855 1854 return rc; 1856 1855 } 1857 1856 1858 - BC_STATUS crystalhd_hw_open(struct crystalhd_hw *hw, struct crystalhd_adp *adp) 1857 + enum BC_STATUS crystalhd_hw_open(struct crystalhd_hw *hw, struct crystalhd_adp *adp) 1859 1858 { 1860 1859 if (!hw || !adp) { 1861 1860 BCMLOG_ERR("Invalid Arguments\n"); ··· 1887 1886 return BC_STS_SUCCESS; 1888 1887 } 1889 1888 1890 - BC_STATUS crystalhd_hw_close(struct crystalhd_hw *hw) 1889 + enum BC_STATUS crystalhd_hw_close(struct crystalhd_hw *hw) 1891 1890 { 1892 1891 if (!hw) { 1893 1892 BCMLOG_ERR("Invalid Arguments\n"); ··· 1904 1903 return BC_STS_SUCCESS; 1905 1904 } 1906 1905 1907 - BC_STATUS crystalhd_hw_setup_dma_rings(struct crystalhd_hw *hw) 1906 + enum BC_STATUS crystalhd_hw_setup_dma_rings(struct crystalhd_hw *hw) 1908 1907 { 1909 1908 unsigned int i; 1910 1909 void *mem; 1911 1910 size_t mem_len; 1912 1911 dma_addr_t phy_addr; 1913 - BC_STATUS sts = BC_STS_SUCCESS; 1914 - crystalhd_rx_dma_pkt *rpkt; 1912 + enum BC_STATUS sts = BC_STS_SUCCESS; 1913 + struct crystalhd_rx_dma_pkt *rpkt; 1915 1914 1916 1915 if (!hw || !hw->adp) { 1917 1916 BCMLOG_ERR("Invalid Arguments\n"); ··· 1924 1923 return sts; 1925 1924 } 1926 1925 1927 - mem_len = BC_LINK_MAX_SGLS * sizeof(dma_descriptor); 1926 + mem_len = BC_LINK_MAX_SGLS * sizeof(struct dma_descriptor); 1928 1927 1929 1928 for (i = 0; i < BC_TX_LIST_CNT; i++) { 1930 1929 mem = bc_kern_dma_alloc(hw->adp, mem_len, &phy_addr); ··· 1939 1938 hw->tx_pkt_pool[i].desc_mem.pdma_desc_start = mem; 1940 1939 hw->tx_pkt_pool[i].desc_mem.phy_addr = phy_addr; 1941 1940 hw->tx_pkt_pool[i].desc_mem.sz = BC_LINK_MAX_SGLS * 1942 - sizeof(dma_descriptor); 1941 + sizeof(struct dma_descriptor); 1943 1942 hw->tx_pkt_pool[i].list_tag = 0; 1944 1943 1945 1944 /* Add TX dma requests to Free Queue..*/ ··· 1969 1968 } 1970 1969 rpkt->desc_mem.pdma_desc_start = mem; 1971 1970 rpkt->desc_mem.phy_addr = phy_addr; 1972 - rpkt->desc_mem.sz = BC_LINK_MAX_SGLS * sizeof(dma_descriptor); 1971 + rpkt->desc_mem.sz = BC_LINK_MAX_SGLS * sizeof(struct dma_descriptor); 1973 1972 rpkt->pkt_tag = hw->rx_pkt_tag_seed + i; 1974 1973 crystalhd_hw_free_rx_pkt(hw, rpkt); 1975 1974 } ··· 1977 1976 return BC_STS_SUCCESS; 1978 1977 } 1979 1978 1980 - BC_STATUS crystalhd_hw_free_dma_rings(struct crystalhd_hw *hw) 1979 + enum BC_STATUS crystalhd_hw_free_dma_rings(struct crystalhd_hw *hw) 1981 1980 { 1982 1981 unsigned int i; 1983 - crystalhd_rx_dma_pkt *rpkt = NULL; 1982 + struct crystalhd_rx_dma_pkt *rpkt = NULL; 1984 1983 1985 1984 if (!hw || !hw->adp) { 1986 1985 BCMLOG_ERR("Invalid Arguments\n"); ··· 2015 2014 return BC_STS_SUCCESS; 2016 2015 } 2017 2016 2018 - BC_STATUS crystalhd_hw_post_tx(struct crystalhd_hw *hw, crystalhd_dio_req *ioreq, 2017 + enum BC_STATUS crystalhd_hw_post_tx(struct crystalhd_hw *hw, struct crystalhd_dio_req *ioreq, 2019 2018 hw_comp_callback call_back, 2020 2019 wait_queue_head_t *cb_event, uint32_t *list_id, 2021 2020 uint8_t data_flags) 2022 2021 { 2023 - tx_dma_pkt *tx_dma_packet = NULL; 2022 + struct tx_dma_pkt *tx_dma_packet = NULL; 2024 2023 uint32_t first_desc_u_addr, first_desc_l_addr; 2025 2024 uint32_t low_addr, high_addr; 2026 - addr_64 desc_addr; 2027 - BC_STATUS sts, add_sts; 2025 + union addr_64 desc_addr; 2026 + enum BC_STATUS sts, add_sts; 2028 2027 uint32_t dummy_index = 0; 2029 2028 unsigned long flags; 2030 2029 bool rc; ··· 2049 2048 } 2050 2049 2051 2050 /* Get a list from TxFreeQ */ 2052 - tx_dma_packet = (tx_dma_pkt *)crystalhd_dioq_fetch(hw->tx_freeq); 2051 + tx_dma_packet = (struct tx_dma_pkt *)crystalhd_dioq_fetch(hw->tx_freeq); 2053 2052 if (!tx_dma_packet) { 2054 2053 BCMLOG_ERR("No empty elements..\n"); 2055 2054 return BC_STS_ERR_USAGE; ··· 2122 2121 * 2123 2122 * FIX_ME: Not Tested the actual condition.. 2124 2123 */ 2125 - BC_STATUS crystalhd_hw_cancel_tx(struct crystalhd_hw *hw, uint32_t list_id) 2124 + enum BC_STATUS crystalhd_hw_cancel_tx(struct crystalhd_hw *hw, uint32_t list_id) 2126 2125 { 2127 2126 if (!hw || !list_id) { 2128 2127 BCMLOG_ERR("Invalid Arguments\n"); ··· 2135 2134 return BC_STS_SUCCESS; 2136 2135 } 2137 2136 2138 - BC_STATUS crystalhd_hw_add_cap_buffer(struct crystalhd_hw *hw, 2139 - crystalhd_dio_req *ioreq, bool en_post) 2137 + enum BC_STATUS crystalhd_hw_add_cap_buffer(struct crystalhd_hw *hw, 2138 + struct crystalhd_dio_req *ioreq, bool en_post) 2140 2139 { 2141 - crystalhd_rx_dma_pkt *rpkt; 2140 + struct crystalhd_rx_dma_pkt *rpkt; 2142 2141 uint32_t tag, uv_desc_ix = 0; 2143 - BC_STATUS sts; 2142 + enum BC_STATUS sts; 2144 2143 2145 2144 if (!hw || !ioreq) { 2146 2145 BCMLOG_ERR("Invalid Arguments\n"); ··· 2165 2164 /* Store the address of UV in the rx packet for post*/ 2166 2165 if (uv_desc_ix) 2167 2166 rpkt->uv_phy_addr = rpkt->desc_mem.phy_addr + 2168 - (sizeof(dma_descriptor) * (uv_desc_ix + 1)); 2167 + (sizeof(struct dma_descriptor) * (uv_desc_ix + 1)); 2169 2168 2170 2169 if (en_post) 2171 2170 sts = crystalhd_hw_post_cap_buff(hw, rpkt); ··· 2175 2174 return sts; 2176 2175 } 2177 2176 2178 - BC_STATUS crystalhd_hw_get_cap_buffer(struct crystalhd_hw *hw, 2179 - BC_PIC_INFO_BLOCK *pib, 2180 - crystalhd_dio_req **ioreq) 2177 + enum BC_STATUS crystalhd_hw_get_cap_buffer(struct crystalhd_hw *hw, 2178 + struct BC_PIC_INFO_BLOCK *pib, 2179 + struct crystalhd_dio_req **ioreq) 2181 2180 { 2182 - crystalhd_rx_dma_pkt *rpkt; 2181 + struct crystalhd_rx_dma_pkt *rpkt; 2183 2182 uint32_t timeout = BC_PROC_OUTPUT_TIMEOUT / 1000; 2184 2183 uint32_t sig_pending = 0; 2185 2184 ··· 2211 2210 return BC_STS_SUCCESS; 2212 2211 } 2213 2212 2214 - BC_STATUS crystalhd_hw_start_capture(struct crystalhd_hw *hw) 2213 + enum BC_STATUS crystalhd_hw_start_capture(struct crystalhd_hw *hw) 2215 2214 { 2216 - crystalhd_rx_dma_pkt *rx_pkt; 2217 - BC_STATUS sts; 2215 + struct crystalhd_rx_dma_pkt *rx_pkt; 2216 + enum BC_STATUS sts; 2218 2217 uint32_t i; 2219 2218 2220 2219 if (!hw) { ··· 2236 2235 return BC_STS_SUCCESS; 2237 2236 } 2238 2237 2239 - BC_STATUS crystalhd_hw_stop_capture(struct crystalhd_hw *hw) 2238 + enum BC_STATUS crystalhd_hw_stop_capture(struct crystalhd_hw *hw) 2240 2239 { 2241 2240 void *temp = NULL; 2242 2241 ··· 2256 2255 return BC_STS_SUCCESS; 2257 2256 } 2258 2257 2259 - BC_STATUS crystalhd_hw_pause(struct crystalhd_hw *hw) 2258 + enum BC_STATUS crystalhd_hw_pause(struct crystalhd_hw *hw) 2260 2259 { 2261 2260 hw->stats.pause_cnt++; 2262 2261 hw->stop_pending = 1; ··· 2268 2267 return BC_STS_SUCCESS; 2269 2268 } 2270 2269 2271 - BC_STATUS crystalhd_hw_unpause(struct crystalhd_hw *hw) 2270 + enum BC_STATUS crystalhd_hw_unpause(struct crystalhd_hw *hw) 2272 2271 { 2273 - BC_STATUS sts; 2272 + enum BC_STATUS sts; 2274 2273 uint32_t aspm; 2275 2274 2276 2275 hw->stop_pending = 0; ··· 2284 2283 return sts; 2285 2284 } 2286 2285 2287 - BC_STATUS crystalhd_hw_suspend(struct crystalhd_hw *hw) 2286 + enum BC_STATUS crystalhd_hw_suspend(struct crystalhd_hw *hw) 2288 2287 { 2289 - BC_STATUS sts; 2288 + enum BC_STATUS sts; 2290 2289 2291 2290 if (!hw) { 2292 2291 BCMLOG_ERR("Invalid Arguments\n"); ··· 2325 2324 memcpy(stats, &hw->stats, sizeof(*stats)); 2326 2325 } 2327 2326 2328 - BC_STATUS crystalhd_hw_set_core_clock(struct crystalhd_hw *hw) 2327 + enum BC_STATUS crystalhd_hw_set_core_clock(struct crystalhd_hw *hw) 2329 2328 { 2330 2329 uint32_t reg, n, i; 2331 2330 uint32_t vco_mg, refresh_reg;
+57 -64
drivers/staging/crystalhd/crystalhd_hw.h
··· 109 109 #define DecHt_HostSwReset 0x340000 110 110 #define BC_DRAM_FW_CFG_ADDR 0x001c2000 111 111 112 - typedef union _addr_64_ { 112 + union addr_64 { 113 113 struct { 114 114 uint32_t low_part; 115 115 uint32_t high_part; ··· 117 117 118 118 uint64_t full_addr; 119 119 120 - } addr_64; 120 + }; 121 121 122 - typedef union _intr_mask_reg_ { 122 + union intr_mask_reg { 123 123 struct { 124 124 uint32_t mask_tx_done:1; 125 125 uint32_t mask_tx_err:1; ··· 133 133 134 134 uint32_t whole_reg; 135 135 136 - } intr_mask_reg; 136 + }; 137 137 138 - typedef union _link_misc_perst_deco_ctrl_ { 138 + union link_misc_perst_deco_ctrl { 139 139 struct { 140 140 uint32_t bcm7412_rst:1; /* 1 -> BCM7412 is held in reset. Reset value 1.*/ 141 141 uint32_t reserved0:3; /* Reserved.No Effect*/ ··· 145 145 146 146 uint32_t whole_reg; 147 147 148 - } link_misc_perst_deco_ctrl; 148 + }; 149 149 150 - typedef union _link_misc_perst_clk_ctrl_ { 150 + union link_misc_perst_clk_ctrl { 151 151 struct { 152 152 uint32_t sel_alt_clk:1; /* When set, selects a 6.75MHz clock as the source of core_clk */ 153 153 uint32_t stop_core_clk:1; /* When set, stops the branch of core_clk that is not needed for low power operation */ ··· 161 161 162 162 uint32_t whole_reg; 163 163 164 - } link_misc_perst_clk_ctrl; 164 + }; 165 165 166 - 167 - typedef union _link_misc_perst_decoder_ctrl_ { 166 + union link_misc_perst_decoder_ctrl { 168 167 struct { 169 168 uint32_t bcm_7412_rst:1; /* 1 -> BCM7412 is held in reset. Reset value 1.*/ 170 169 uint32_t res0:3; /* Reserved.No Effect*/ ··· 173 174 174 175 uint32_t whole_reg; 175 176 176 - } link_misc_perst_decoder_ctrl; 177 + }; 177 178 178 - 179 - typedef union _desc_low_addr_reg_ { 179 + union desc_low_addr_reg { 180 180 struct { 181 181 uint32_t list_valid:1; 182 182 uint32_t reserved:4; ··· 184 186 185 187 uint32_t whole_reg; 186 188 187 - } desc_low_addr_reg; 189 + }; 188 190 189 - typedef struct _dma_descriptor_ { /* 8 32-bit values */ 191 + struct dma_descriptor { /* 8 32-bit values */ 190 192 /* 0th u32 */ 191 193 uint32_t sdram_buff_addr:28; /* bits 0-27: SDRAM Address */ 192 194 uint32_t res0:4; /* bits 28-31: Reserved */ ··· 218 220 /* 7th u32 */ 219 221 uint32_t res8; /* Last 32bits reserved */ 220 222 221 - } dma_descriptor, *pdma_descriptor; 223 + }; 222 224 223 225 /* 224 226 * We will allocate the memory in 4K pages 225 227 * the linked list will be a list of 32 byte descriptors. 226 228 * The virtual address will determine what should be freed. 227 229 */ 228 - typedef struct _dma_desc_mem_ { 229 - pdma_descriptor pdma_desc_start; /* 32-bytes for dma descriptor. should be first element */ 230 + struct dma_desc_mem { 231 + struct dma_descriptor *pdma_desc_start; /* 32-bytes for dma descriptor. should be first element */ 230 232 dma_addr_t phy_addr; /* physical address of each DMA desc */ 231 233 uint32_t sz; 232 234 struct _dma_desc_mem_ *Next; /* points to Next Descriptor in chain */ 233 235 234 - } dma_desc_mem, *pdma_desc_mem; 236 + }; 235 237 236 - 237 - 238 - typedef enum _list_sts_ { 238 + enum list_sts { 239 239 sts_free = 0, 240 240 241 241 /* RX-Y Bits 0:7 */ ··· 249 253 250 254 rx_y_mask = 0x000000FF, 251 255 rx_uv_mask = 0x0000FF00, 256 + }; 252 257 253 - } list_sts; 254 - 255 - typedef struct _tx_dma_pkt_ { 256 - dma_desc_mem desc_mem; 258 + struct tx_dma_pkt { 259 + struct dma_desc_mem desc_mem; 257 260 hw_comp_callback call_back; 258 - crystalhd_dio_req *dio_req; 261 + struct crystalhd_dio_req *dio_req; 259 262 wait_queue_head_t *cb_event; 260 263 uint32_t list_tag; 264 + }; 261 265 262 - } tx_dma_pkt; 263 - 264 - typedef struct _crystalhd_rx_dma_pkt { 265 - dma_desc_mem desc_mem; 266 - crystalhd_dio_req *dio_req; 266 + struct crystalhd_rx_dma_pkt { 267 + struct dma_desc_mem desc_mem; 268 + struct crystalhd_dio_req *dio_req; 267 269 uint32_t pkt_tag; 268 270 uint32_t flags; 269 - BC_PIC_INFO_BLOCK pib; 271 + struct BC_PIC_INFO_BLOCK pib; 270 272 dma_addr_t uv_phy_addr; 271 - struct _crystalhd_rx_dma_pkt *next; 273 + struct crystalhd_rx_dma_pkt *next; 274 + }; 272 275 273 - } crystalhd_rx_dma_pkt; 274 - 275 - struct crystalhd_hw_stats{ 276 + struct crystalhd_hw_stats { 276 277 uint32_t rx_errors; 277 278 uint32_t tx_errors; 278 279 uint32_t freeq_count; ··· 281 288 }; 282 289 283 290 struct crystalhd_hw { 284 - tx_dma_pkt tx_pkt_pool[DMA_ENGINE_CNT]; 291 + struct tx_dma_pkt tx_pkt_pool[DMA_ENGINE_CNT]; 285 292 spinlock_t lock; 286 293 287 294 uint32_t tx_ioq_tag_seed; 288 295 uint32_t tx_list_post_index; 289 296 290 - crystalhd_rx_dma_pkt *rx_pkt_pool_head; 297 + struct crystalhd_rx_dma_pkt *rx_pkt_pool_head; 291 298 uint32_t rx_pkt_tag_seed; 292 299 293 300 bool dev_started; ··· 299 306 uint32_t pib_del_Q_addr; 300 307 uint32_t pib_rel_Q_addr; 301 308 302 - crystalhd_dioq_t *tx_freeq; 303 - crystalhd_dioq_t *tx_actq; 309 + struct crystalhd_dioq *tx_freeq; 310 + struct crystalhd_dioq *tx_actq; 304 311 305 312 /* Rx DMA Engine Specific Locks */ 306 313 spinlock_t rx_lock; 307 314 uint32_t rx_list_post_index; 308 - list_sts rx_list_sts[DMA_ENGINE_CNT]; 309 - crystalhd_dioq_t *rx_rdyq; 310 - crystalhd_dioq_t *rx_freeq; 311 - crystalhd_dioq_t *rx_actq; 315 + enum list_sts rx_list_sts[DMA_ENGINE_CNT]; 316 + struct crystalhd_dioq *rx_rdyq; 317 + struct crystalhd_dioq *rx_freeq; 318 + struct crystalhd_dioq *rx_actq; 312 319 uint32_t stop_pending; 313 320 314 321 /* HW counters.. */ ··· 357 364 358 365 359 366 /**** API Exposed to the other layers ****/ 360 - BC_STATUS crystalhd_download_fw(struct crystalhd_adp *adp, 367 + enum BC_STATUS crystalhd_download_fw(struct crystalhd_adp *adp, 361 368 void *buffer, uint32_t sz); 362 - BC_STATUS crystalhd_do_fw_cmd(struct crystalhd_hw *hw, BC_FW_CMD *fw_cmd); 369 + enum BC_STATUS crystalhd_do_fw_cmd(struct crystalhd_hw *hw, struct BC_FW_CMD *fw_cmd); 363 370 bool crystalhd_hw_interrupt(struct crystalhd_adp *adp, struct crystalhd_hw *hw); 364 - BC_STATUS crystalhd_hw_open(struct crystalhd_hw *, struct crystalhd_adp *); 365 - BC_STATUS crystalhd_hw_close(struct crystalhd_hw *); 366 - BC_STATUS crystalhd_hw_setup_dma_rings(struct crystalhd_hw *); 367 - BC_STATUS crystalhd_hw_free_dma_rings(struct crystalhd_hw *); 371 + enum BC_STATUS crystalhd_hw_open(struct crystalhd_hw *, struct crystalhd_adp *); 372 + enum BC_STATUS crystalhd_hw_close(struct crystalhd_hw *); 373 + enum BC_STATUS crystalhd_hw_setup_dma_rings(struct crystalhd_hw *); 374 + enum BC_STATUS crystalhd_hw_free_dma_rings(struct crystalhd_hw *); 368 375 369 376 370 - BC_STATUS crystalhd_hw_post_tx(struct crystalhd_hw *hw, crystalhd_dio_req *ioreq, 377 + enum BC_STATUS crystalhd_hw_post_tx(struct crystalhd_hw *hw, struct crystalhd_dio_req *ioreq, 371 378 hw_comp_callback call_back, 372 379 wait_queue_head_t *cb_event, 373 380 uint32_t *list_id, uint8_t data_flags); 374 381 375 - BC_STATUS crystalhd_hw_pause(struct crystalhd_hw *hw); 376 - BC_STATUS crystalhd_hw_unpause(struct crystalhd_hw *hw); 377 - BC_STATUS crystalhd_hw_suspend(struct crystalhd_hw *hw); 378 - BC_STATUS crystalhd_hw_cancel_tx(struct crystalhd_hw *hw, uint32_t list_id); 379 - BC_STATUS crystalhd_hw_add_cap_buffer(struct crystalhd_hw *hw, 380 - crystalhd_dio_req *ioreq, bool en_post); 381 - BC_STATUS crystalhd_hw_get_cap_buffer(struct crystalhd_hw *hw, 382 - BC_PIC_INFO_BLOCK *pib, 383 - crystalhd_dio_req **ioreq); 384 - BC_STATUS crystalhd_hw_stop_capture(struct crystalhd_hw *hw); 385 - BC_STATUS crystalhd_hw_start_capture(struct crystalhd_hw *hw); 382 + enum BC_STATUS crystalhd_hw_pause(struct crystalhd_hw *hw); 383 + enum BC_STATUS crystalhd_hw_unpause(struct crystalhd_hw *hw); 384 + enum BC_STATUS crystalhd_hw_suspend(struct crystalhd_hw *hw); 385 + enum BC_STATUS crystalhd_hw_cancel_tx(struct crystalhd_hw *hw, uint32_t list_id); 386 + enum BC_STATUS crystalhd_hw_add_cap_buffer(struct crystalhd_hw *hw, 387 + struct crystalhd_dio_req *ioreq, bool en_post); 388 + enum BC_STATUS crystalhd_hw_get_cap_buffer(struct crystalhd_hw *hw, 389 + struct BC_PIC_INFO_BLOCK *pib, 390 + struct crystalhd_dio_req **ioreq); 391 + enum BC_STATUS crystalhd_hw_stop_capture(struct crystalhd_hw *hw); 392 + enum BC_STATUS crystalhd_hw_start_capture(struct crystalhd_hw *hw); 386 393 void crystalhd_hw_stats(struct crystalhd_hw *hw, struct crystalhd_hw_stats *stats); 387 394 388 395 /* API to program the core clock on the decoder */ 389 - BC_STATUS crystalhd_hw_set_core_clock(struct crystalhd_hw *); 396 + enum BC_STATUS crystalhd_hw_set_core_clock(struct crystalhd_hw *); 390 397 391 398 #endif
+17 -17
drivers/staging/crystalhd/crystalhd_lnx.c
··· 73 73 return 0; 74 74 } 75 75 76 - crystalhd_ioctl_data *chd_dec_alloc_iodata(struct crystalhd_adp *adp, bool isr) 76 + struct crystalhd_ioctl_data *chd_dec_alloc_iodata(struct crystalhd_adp *adp, bool isr) 77 77 { 78 78 unsigned long flags = 0; 79 - crystalhd_ioctl_data *temp; 79 + struct crystalhd_ioctl_data *temp; 80 80 81 81 if (!adp) 82 82 return NULL; ··· 93 93 return temp; 94 94 } 95 95 96 - void chd_dec_free_iodata(struct crystalhd_adp *adp, crystalhd_ioctl_data *iodata, 96 + void chd_dec_free_iodata(struct crystalhd_adp *adp, struct crystalhd_ioctl_data *iodata, 97 97 bool isr) 98 98 { 99 99 unsigned long flags = 0; ··· 129 129 return rc; 130 130 } 131 131 132 - static int chd_dec_fetch_cdata(struct crystalhd_adp *adp, crystalhd_ioctl_data *io, 132 + static int chd_dec_fetch_cdata(struct crystalhd_adp *adp, struct crystalhd_ioctl_data *io, 133 133 uint32_t m_sz, unsigned long ua) 134 134 { 135 135 unsigned long ua_off; ··· 163 163 } 164 164 165 165 static int chd_dec_release_cdata(struct crystalhd_adp *adp, 166 - crystalhd_ioctl_data *io, unsigned long ua) 166 + struct crystalhd_ioctl_data *io, unsigned long ua) 167 167 { 168 168 unsigned long ua_off; 169 169 int rc; ··· 193 193 } 194 194 195 195 static int chd_dec_proc_user_data(struct crystalhd_adp *adp, 196 - crystalhd_ioctl_data *io, 196 + struct crystalhd_ioctl_data *io, 197 197 unsigned long ua, int set) 198 198 { 199 199 int rc; ··· 231 231 uint32_t uid, uint32_t cmd, crystalhd_cmd_proc func) 232 232 { 233 233 int rc; 234 - crystalhd_ioctl_data *temp; 235 - BC_STATUS sts = BC_STS_SUCCESS; 234 + struct crystalhd_ioctl_data *temp; 235 + enum BC_STATUS sts = BC_STS_SUCCESS; 236 236 237 237 temp = chd_dec_alloc_iodata(adp, 0); 238 238 if (!temp) { ··· 296 296 { 297 297 struct crystalhd_adp *adp = chd_get_adp(); 298 298 int rc = 0; 299 - BC_STATUS sts = BC_STS_SUCCESS; 299 + enum BC_STATUS sts = BC_STS_SUCCESS; 300 300 struct crystalhd_user *uc = NULL; 301 301 302 302 BCMLOG_ENTER; ··· 356 356 357 357 static int __devinit chd_dec_init_chdev(struct crystalhd_adp *adp) 358 358 { 359 - crystalhd_ioctl_data *temp; 359 + struct crystalhd_ioctl_data *temp; 360 360 struct device *dev; 361 361 int rc = -ENODEV, i = 0; 362 362 ··· 394 394 /* Allocate general purpose ioctl pool. */ 395 395 for (i = 0; i < CHD_IODATA_POOL_SZ; i++) { 396 396 /* FIXME: jarod: why atomic? */ 397 - temp = kzalloc(sizeof(crystalhd_ioctl_data), GFP_ATOMIC); 397 + temp = kzalloc(sizeof(struct crystalhd_ioctl_data), GFP_ATOMIC); 398 398 if (!temp) { 399 399 BCMLOG_ERR("ioctl data pool kzalloc failed\n"); 400 400 rc = -ENOMEM; ··· 418 418 419 419 static void __devexit chd_dec_release_chdev(struct crystalhd_adp *adp) 420 420 { 421 - crystalhd_ioctl_data *temp = NULL; 421 + struct crystalhd_ioctl_data *temp = NULL; 422 422 if (!adp) 423 423 return; 424 424 ··· 513 513 static void __devexit chd_dec_pci_remove(struct pci_dev *pdev) 514 514 { 515 515 struct crystalhd_adp *pinfo; 516 - BC_STATUS sts = BC_STS_SUCCESS; 516 + enum BC_STATUS sts = BC_STS_SUCCESS; 517 517 518 518 BCMLOG_ENTER; 519 519 ··· 543 543 { 544 544 struct crystalhd_adp *pinfo; 545 545 int rc; 546 - BC_STATUS sts = BC_STS_SUCCESS; 546 + enum BC_STATUS sts = BC_STS_SUCCESS; 547 547 548 548 BCMLOG(BCMLOG_DBG, "PCI_INFO: Vendor:0x%04x Device:0x%04x " 549 549 "s_vendor:0x%04x s_device: 0x%04x\n", ··· 623 623 int chd_dec_pci_suspend(struct pci_dev *pdev, pm_message_t state) 624 624 { 625 625 struct crystalhd_adp *adp; 626 - crystalhd_ioctl_data *temp; 627 - BC_STATUS sts = BC_STS_SUCCESS; 626 + struct crystalhd_ioctl_data *temp; 627 + enum BC_STATUS sts = BC_STS_SUCCESS; 628 628 629 629 adp = (struct crystalhd_adp *)pci_get_drvdata(pdev); 630 630 if (!adp) { ··· 657 657 int chd_dec_pci_resume(struct pci_dev *pdev) 658 658 { 659 659 struct crystalhd_adp *adp; 660 - BC_STATUS sts = BC_STS_SUCCESS; 660 + enum BC_STATUS sts = BC_STS_SUCCESS; 661 661 int rc; 662 662 663 663 adp = (struct crystalhd_adp *)pci_get_drvdata(pdev);
+3 -3
drivers/staging/crystalhd/crystalhd_lnx.h
··· 79 79 unsigned int chd_dec_major; 80 80 unsigned int cfg_users; 81 81 82 - crystalhd_ioctl_data *idata_free_head; /* ioctl data pool */ 83 - crystalhd_elem_t *elem_pool_head; /* Queue element pool */ 82 + struct crystalhd_ioctl_data *idata_free_head; /* ioctl data pool */ 83 + struct crystalhd_elem *elem_pool_head; /* Queue element pool */ 84 84 85 85 struct crystalhd_cmd cmds; 86 86 87 - crystalhd_dio_req *ua_map_free_head; 87 + struct crystalhd_dio_req *ua_map_free_head; 88 88 struct pci_pool *fill_byte_pool; 89 89 }; 90 90
+40 -40
drivers/staging/crystalhd/crystalhd_misc.c
··· 43 43 bc_dec_reg_wr(adp, (0x00380000 | (mem_off & 0x0007FFFF)), val); 44 44 } 45 45 46 - static inline BC_STATUS bc_chk_dram_range(struct crystalhd_adp *adp, uint32_t start_off, uint32_t cnt) 46 + static inline enum BC_STATUS bc_chk_dram_range(struct crystalhd_adp *adp, uint32_t start_off, uint32_t cnt) 47 47 { 48 48 return BC_STS_SUCCESS; 49 49 } 50 50 51 - static crystalhd_dio_req *crystalhd_alloc_dio(struct crystalhd_adp *adp) 51 + static struct crystalhd_dio_req *crystalhd_alloc_dio(struct crystalhd_adp *adp) 52 52 { 53 53 unsigned long flags = 0; 54 - crystalhd_dio_req *temp = NULL; 54 + struct crystalhd_dio_req *temp = NULL; 55 55 56 56 if (!adp) { 57 57 BCMLOG_ERR("Invalid Arg!!\n"); ··· 67 67 return temp; 68 68 } 69 69 70 - static void crystalhd_free_dio(struct crystalhd_adp *adp, crystalhd_dio_req *dio) 70 + static void crystalhd_free_dio(struct crystalhd_adp *adp, struct crystalhd_dio_req *dio) 71 71 { 72 72 unsigned long flags = 0; 73 73 ··· 83 83 spin_unlock_irqrestore(&adp->lock, flags); 84 84 } 85 85 86 - static crystalhd_elem_t *crystalhd_alloc_elem(struct crystalhd_adp *adp) 86 + static struct crystalhd_elem *crystalhd_alloc_elem(struct crystalhd_adp *adp) 87 87 { 88 88 unsigned long flags = 0; 89 - crystalhd_elem_t *temp = NULL; 89 + struct crystalhd_elem *temp = NULL; 90 90 91 91 if (!adp) 92 92 return temp; ··· 100 100 101 101 return temp; 102 102 } 103 - static void crystalhd_free_elem(struct crystalhd_adp *adp, crystalhd_elem_t *elem) 103 + static void crystalhd_free_elem(struct crystalhd_adp *adp, struct crystalhd_elem *elem) 104 104 { 105 105 unsigned long flags = 0; 106 106 ··· 230 230 * 231 231 * 7412's Dram read routine. 232 232 */ 233 - BC_STATUS crystalhd_mem_rd(struct crystalhd_adp *adp, uint32_t start_off, 233 + enum BC_STATUS crystalhd_mem_rd(struct crystalhd_adp *adp, uint32_t start_off, 234 234 uint32_t dw_cnt, uint32_t *rd_buff) 235 235 { 236 236 uint32_t ix = 0; ··· 258 258 * 259 259 * 7412's Dram write routine. 260 260 */ 261 - BC_STATUS crystalhd_mem_wr(struct crystalhd_adp *adp, uint32_t start_off, 261 + enum BC_STATUS crystalhd_mem_wr(struct crystalhd_adp *adp, uint32_t start_off, 262 262 uint32_t dw_cnt, uint32_t *wr_buff) 263 263 { 264 264 uint32_t ix = 0; ··· 286 286 * 287 287 * Get value from Link's PCIe config space. 288 288 */ 289 - BC_STATUS crystalhd_pci_cfg_rd(struct crystalhd_adp *adp, uint32_t off, 289 + enum BC_STATUS crystalhd_pci_cfg_rd(struct crystalhd_adp *adp, uint32_t off, 290 290 uint32_t len, uint32_t *val) 291 291 { 292 - BC_STATUS sts = BC_STS_SUCCESS; 292 + enum BC_STATUS sts = BC_STS_SUCCESS; 293 293 int rc = 0; 294 294 295 295 if (!adp || !val) { ··· 331 331 * 332 332 * Set value to Link's PCIe config space. 333 333 */ 334 - BC_STATUS crystalhd_pci_cfg_wr(struct crystalhd_adp *adp, uint32_t off, 334 + enum BC_STATUS crystalhd_pci_cfg_wr(struct crystalhd_adp *adp, uint32_t off, 335 335 uint32_t len, uint32_t val) 336 336 { 337 - BC_STATUS sts = BC_STS_SUCCESS; 337 + enum BC_STATUS sts = BC_STS_SUCCESS; 338 338 int rc = 0; 339 339 340 340 if (!adp || !val) { ··· 429 429 * Initialize Generic DIO queue to hold any data. Callback 430 430 * will be used to free elements while deleting the queue. 431 431 */ 432 - BC_STATUS crystalhd_create_dioq(struct crystalhd_adp *adp, 433 - crystalhd_dioq_t **dioq_hnd, 432 + enum BC_STATUS crystalhd_create_dioq(struct crystalhd_adp *adp, 433 + struct crystalhd_dioq **dioq_hnd, 434 434 crystalhd_data_free_cb cb, void *cbctx) 435 435 { 436 - crystalhd_dioq_t *dioq = NULL; 436 + struct crystalhd_dioq *dioq = NULL; 437 437 438 438 if (!adp || !dioq_hnd) { 439 439 BCMLOG_ERR("Invalid arg!!\n"); ··· 446 446 447 447 spin_lock_init(&dioq->lock); 448 448 dioq->sig = BC_LINK_DIOQ_SIG; 449 - dioq->head = (crystalhd_elem_t *)&dioq->head; 450 - dioq->tail = (crystalhd_elem_t *)&dioq->head; 449 + dioq->head = (struct crystalhd_elem *)&dioq->head; 450 + dioq->tail = (struct crystalhd_elem *)&dioq->head; 451 451 crystalhd_create_event(&dioq->event); 452 452 dioq->adp = adp; 453 453 dioq->data_rel_cb = cb; ··· 470 470 * by calling the call back provided during creation. 471 471 * 472 472 */ 473 - void crystalhd_delete_dioq(struct crystalhd_adp *adp, crystalhd_dioq_t *dioq) 473 + void crystalhd_delete_dioq(struct crystalhd_adp *adp, struct crystalhd_dioq *dioq) 474 474 { 475 475 void *temp; 476 476 ··· 498 498 * 499 499 * Insert new element to Q tail. 500 500 */ 501 - BC_STATUS crystalhd_dioq_add(crystalhd_dioq_t *ioq, void *data, 501 + enum BC_STATUS crystalhd_dioq_add(struct crystalhd_dioq *ioq, void *data, 502 502 bool wake, uint32_t tag) 503 503 { 504 504 unsigned long flags = 0; 505 - crystalhd_elem_t *tmp; 505 + struct crystalhd_elem *tmp; 506 506 507 507 if (!ioq || (ioq->sig != BC_LINK_DIOQ_SIG) || !data) { 508 508 BCMLOG_ERR("Invalid arg!!\n"); ··· 518 518 tmp->data = data; 519 519 tmp->tag = tag; 520 520 spin_lock_irqsave(&ioq->lock, flags); 521 - tmp->flink = (crystalhd_elem_t *)&ioq->head; 521 + tmp->flink = (struct crystalhd_elem *)&ioq->head; 522 522 tmp->blink = ioq->tail; 523 523 tmp->flink->blink = tmp; 524 524 tmp->blink->flink = tmp; ··· 540 540 * 541 541 * Remove an element from Queue. 542 542 */ 543 - void *crystalhd_dioq_fetch(crystalhd_dioq_t *ioq) 543 + void *crystalhd_dioq_fetch(struct crystalhd_dioq *ioq) 544 544 { 545 545 unsigned long flags = 0; 546 - crystalhd_elem_t *tmp; 547 - crystalhd_elem_t *ret = NULL; 546 + struct crystalhd_elem *tmp; 547 + struct crystalhd_elem *ret = NULL; 548 548 void *data = NULL; 549 549 550 550 if (!ioq || (ioq->sig != BC_LINK_DIOQ_SIG)) { ··· 554 554 555 555 spin_lock_irqsave(&ioq->lock, flags); 556 556 tmp = ioq->head; 557 - if (tmp != (crystalhd_elem_t *)&ioq->head) { 557 + if (tmp != (struct crystalhd_elem *)&ioq->head) { 558 558 ret = tmp; 559 559 tmp->flink->blink = tmp->blink; 560 560 tmp->blink->flink = tmp->flink; ··· 578 578 * 579 579 * Search TAG and remove the element. 580 580 */ 581 - void *crystalhd_dioq_find_and_fetch(crystalhd_dioq_t *ioq, uint32_t tag) 581 + void *crystalhd_dioq_find_and_fetch(struct crystalhd_dioq *ioq, uint32_t tag) 582 582 { 583 583 unsigned long flags = 0; 584 - crystalhd_elem_t *tmp; 585 - crystalhd_elem_t *ret = NULL; 584 + struct crystalhd_elem *tmp; 585 + struct crystalhd_elem *ret = NULL; 586 586 void *data = NULL; 587 587 588 588 if (!ioq || (ioq->sig != BC_LINK_DIOQ_SIG)) { ··· 592 592 593 593 spin_lock_irqsave(&ioq->lock, flags); 594 594 tmp = ioq->head; 595 - while (tmp != (crystalhd_elem_t *)&ioq->head) { 595 + while (tmp != (struct crystalhd_elem *)&ioq->head) { 596 596 if (tmp->tag == tag) { 597 597 ret = tmp; 598 598 tmp->flink->blink = tmp->blink; ··· 623 623 * Return element from head if Q is not empty. Wait for new element 624 624 * if Q is empty for Timeout seconds. 625 625 */ 626 - void *crystalhd_dioq_fetch_wait(crystalhd_dioq_t *ioq, uint32_t to_secs, 626 + void *crystalhd_dioq_fetch_wait(struct crystalhd_dioq *ioq, uint32_t to_secs, 627 627 uint32_t *sig_pend) 628 628 { 629 629 unsigned long flags = 0; ··· 673 673 * This routine maps user address and lock pages for DMA. 674 674 * 675 675 */ 676 - BC_STATUS crystalhd_map_dio(struct crystalhd_adp *adp, void *ubuff, 676 + enum BC_STATUS crystalhd_map_dio(struct crystalhd_adp *adp, void *ubuff, 677 677 uint32_t ubuff_sz, uint32_t uv_offset, 678 678 bool en_422mode, bool dir_tx, 679 - crystalhd_dio_req **dio_hnd) 679 + struct crystalhd_dio_req **dio_hnd) 680 680 { 681 - crystalhd_dio_req *dio; 681 + struct crystalhd_dio_req *dio; 682 682 /* FIXME: jarod: should some of these unsigned longs be uint32_t or uintptr_t? */ 683 683 unsigned long start = 0, end = 0, uaddr = 0, count = 0; 684 684 unsigned long spsz = 0, uv_start = 0; ··· 820 820 * 821 821 * This routine is to unmap the user buffer pages. 822 822 */ 823 - BC_STATUS crystalhd_unmap_dio(struct crystalhd_adp *adp, crystalhd_dio_req *dio) 823 + enum BC_STATUS crystalhd_unmap_dio(struct crystalhd_adp *adp, struct crystalhd_dio_req *dio) 824 824 { 825 825 struct page *page = NULL; 826 826 int j = 0; ··· 864 864 { 865 865 uint32_t asz = 0, i = 0; 866 866 uint8_t *temp; 867 - crystalhd_dio_req *dio; 867 + struct crystalhd_dio_req *dio; 868 868 869 869 if (!adp || !max_pages) { 870 870 BCMLOG_ERR("Invalid Arg!!\n"); ··· 893 893 return -ENOMEM; 894 894 } 895 895 896 - dio = (crystalhd_dio_req *)temp; 896 + dio = (struct crystalhd_dio_req *)temp; 897 897 temp += sizeof(*dio); 898 898 dio->pages = (struct page **)temp; 899 899 temp += (sizeof(*dio->pages) * max_pages); ··· 923 923 */ 924 924 void crystalhd_destroy_dio_pool(struct crystalhd_adp *adp) 925 925 { 926 - crystalhd_dio_req *dio; 926 + struct crystalhd_dio_req *dio; 927 927 int count = 0; 928 928 929 929 if (!adp) { ··· 965 965 uint32_t pool_size) 966 966 { 967 967 uint32_t i; 968 - crystalhd_elem_t *temp; 968 + struct crystalhd_elem *temp; 969 969 970 970 if (!adp || !pool_size) 971 971 return -EINVAL; ··· 993 993 */ 994 994 void crystalhd_delete_elem_pool(struct crystalhd_adp *adp) 995 995 { 996 - crystalhd_elem_t *temp; 996 + struct crystalhd_elem *temp; 997 997 int dbg_cnt = 0; 998 998 999 999 if (!adp)
+27 -27
drivers/staging/crystalhd/crystalhd_misc.h
··· 54 54 /* Scatter Gather memory pool size for Tx and Rx */ 55 55 #define BC_LINK_SG_POOL_SZ (BC_TX_LIST_CNT + BC_RX_LIST_CNT) 56 56 57 - enum _crystalhd_dio_sig { 57 + enum crystalhd_dio_sig { 58 58 crystalhd_dio_inv = 0, 59 59 crystalhd_dio_locked, 60 60 crystalhd_dio_sg_mapped, ··· 76 76 bool b422mode; 77 77 }; 78 78 79 - typedef struct _crystalhd_dio_req { 79 + struct crystalhd_dio_req { 80 80 uint32_t sig; 81 81 uint32_t max_pages; 82 82 struct page **pages; ··· 88 88 void *fb_va; 89 89 uint32_t fb_size; 90 90 dma_addr_t fb_pa; 91 - struct _crystalhd_dio_req *next; 92 - } crystalhd_dio_req; 91 + struct crystalhd_dio_req *next; 92 + }; 93 93 94 94 #define BC_LINK_DIOQ_SIG (0x09223280) 95 95 96 - typedef struct _crystalhd_elem_s { 97 - struct _crystalhd_elem_s *flink; 98 - struct _crystalhd_elem_s *blink; 96 + struct crystalhd_elem { 97 + struct crystalhd_elem *flink; 98 + struct crystalhd_elem *blink; 99 99 void *data; 100 100 uint32_t tag; 101 - } crystalhd_elem_t; 101 + }; 102 102 103 103 typedef void (*crystalhd_data_free_cb)(void *context, void *data); 104 104 105 - typedef struct _crystalhd_dioq_s { 105 + struct crystalhd_dioq { 106 106 uint32_t sig; 107 107 struct crystalhd_adp *adp; 108 - crystalhd_elem_t *head; 109 - crystalhd_elem_t *tail; 108 + struct crystalhd_elem *head; 109 + struct crystalhd_elem *tail; 110 110 uint32_t count; 111 111 spinlock_t lock; 112 112 wait_queue_head_t event; 113 113 crystalhd_data_free_cb data_rel_cb; 114 114 void *cb_context; 115 - } crystalhd_dioq_t; 115 + }; 116 116 117 - typedef void (*hw_comp_callback)(crystalhd_dio_req *, 118 - wait_queue_head_t *event, BC_STATUS sts); 117 + typedef void (*hw_comp_callback)(struct crystalhd_dio_req *, 118 + wait_queue_head_t *event, enum BC_STATUS sts); 119 119 120 120 /*========= Decoder (7412) register access routines.================= */ 121 121 uint32_t bc_dec_reg_rd(struct crystalhd_adp *, uint32_t); ··· 126 126 void crystalhd_reg_wr(struct crystalhd_adp *, uint32_t, uint32_t); 127 127 128 128 /*========= Decoder (7412) memory access routines..=================*/ 129 - BC_STATUS crystalhd_mem_rd(struct crystalhd_adp *, uint32_t, uint32_t, uint32_t *); 130 - BC_STATUS crystalhd_mem_wr(struct crystalhd_adp *, uint32_t, uint32_t, uint32_t *); 129 + enum BC_STATUS crystalhd_mem_rd(struct crystalhd_adp *, uint32_t, uint32_t, uint32_t *); 130 + enum BC_STATUS crystalhd_mem_wr(struct crystalhd_adp *, uint32_t, uint32_t, uint32_t *); 131 131 132 132 /*==========Link (70012) PCIe Config access routines.================*/ 133 - BC_STATUS crystalhd_pci_cfg_rd(struct crystalhd_adp *, uint32_t, uint32_t, uint32_t *); 134 - BC_STATUS crystalhd_pci_cfg_wr(struct crystalhd_adp *, uint32_t, uint32_t, uint32_t); 133 + enum BC_STATUS crystalhd_pci_cfg_rd(struct crystalhd_adp *, uint32_t, uint32_t, uint32_t *); 134 + enum BC_STATUS crystalhd_pci_cfg_wr(struct crystalhd_adp *, uint32_t, uint32_t, uint32_t); 135 135 136 136 /*========= Linux Kernel Interface routines. ======================= */ 137 137 void *bc_kern_dma_alloc(struct crystalhd_adp *, uint32_t, dma_addr_t *); ··· 167 167 /*================ Direct IO mapping routines ==================*/ 168 168 extern int crystalhd_create_dio_pool(struct crystalhd_adp *, uint32_t); 169 169 extern void crystalhd_destroy_dio_pool(struct crystalhd_adp *); 170 - extern BC_STATUS crystalhd_map_dio(struct crystalhd_adp *, void *, uint32_t, 171 - uint32_t, bool, bool, crystalhd_dio_req**); 170 + extern enum BC_STATUS crystalhd_map_dio(struct crystalhd_adp *, void *, uint32_t, 171 + uint32_t, bool, bool, struct crystalhd_dio_req**); 172 172 173 - extern BC_STATUS crystalhd_unmap_dio(struct crystalhd_adp *, crystalhd_dio_req*); 173 + extern enum BC_STATUS crystalhd_unmap_dio(struct crystalhd_adp *, struct crystalhd_dio_req*); 174 174 #define crystalhd_get_sgle_paddr(_dio, _ix) (cpu_to_le64(sg_dma_address(&_dio->sg[_ix]))) 175 175 #define crystalhd_get_sgle_len(_dio, _ix) (cpu_to_le32(sg_dma_len(&_dio->sg[_ix]))) 176 176 177 177 /*================ General Purpose Queues ==================*/ 178 - extern BC_STATUS crystalhd_create_dioq(struct crystalhd_adp *, crystalhd_dioq_t **, crystalhd_data_free_cb , void *); 179 - extern void crystalhd_delete_dioq(struct crystalhd_adp *, crystalhd_dioq_t *); 180 - extern BC_STATUS crystalhd_dioq_add(crystalhd_dioq_t *ioq, void *data, bool wake, uint32_t tag); 181 - extern void *crystalhd_dioq_fetch(crystalhd_dioq_t *ioq); 182 - extern void *crystalhd_dioq_find_and_fetch(crystalhd_dioq_t *ioq, uint32_t tag); 183 - extern void *crystalhd_dioq_fetch_wait(crystalhd_dioq_t *ioq, uint32_t to_secs, uint32_t *sig_pend); 178 + extern enum BC_STATUS crystalhd_create_dioq(struct crystalhd_adp *, struct crystalhd_dioq **, crystalhd_data_free_cb , void *); 179 + extern void crystalhd_delete_dioq(struct crystalhd_adp *, struct crystalhd_dioq *); 180 + extern enum BC_STATUS crystalhd_dioq_add(struct crystalhd_dioq *ioq, void *data, bool wake, uint32_t tag); 181 + extern void *crystalhd_dioq_fetch(struct crystalhd_dioq *ioq); 182 + extern void *crystalhd_dioq_find_and_fetch(struct crystalhd_dioq *ioq, uint32_t tag); 183 + extern void *crystalhd_dioq_fetch_wait(struct crystalhd_dioq *ioq, uint32_t to_secs, uint32_t *sig_pend); 184 184 185 185 #define crystalhd_dioq_count(_ioq) ((_ioq) ? _ioq->count : 0) 186 186