18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef _AV7110_HW_H_ 38c2ecf20Sopenharmony_ci#define _AV7110_HW_H_ 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#include "av7110.h" 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci/* DEBI transfer mode defs */ 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#define DEBINOSWAP 0x000e0000 108c2ecf20Sopenharmony_ci#define DEBISWAB 0x001e0000 118c2ecf20Sopenharmony_ci#define DEBISWAP 0x002e0000 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#define ARM_WAIT_FREE (HZ) 148c2ecf20Sopenharmony_ci#define ARM_WAIT_SHAKE (HZ/5) 158c2ecf20Sopenharmony_ci#define ARM_WAIT_OSD (HZ) 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_cienum av7110_bootstate 198c2ecf20Sopenharmony_ci{ 208c2ecf20Sopenharmony_ci BOOTSTATE_BUFFER_EMPTY = 0, 218c2ecf20Sopenharmony_ci BOOTSTATE_BUFFER_FULL = 1, 228c2ecf20Sopenharmony_ci BOOTSTATE_AV7110_BOOT_COMPLETE = 2 238c2ecf20Sopenharmony_ci}; 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_cienum av7110_type_rec_play_format 268c2ecf20Sopenharmony_ci{ RP_None, 278c2ecf20Sopenharmony_ci AudioPES, 288c2ecf20Sopenharmony_ci AudioMp2, 298c2ecf20Sopenharmony_ci AudioPCM, 308c2ecf20Sopenharmony_ci VideoPES, 318c2ecf20Sopenharmony_ci AV_PES 328c2ecf20Sopenharmony_ci}; 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_cienum av7110_osd_palette_type 358c2ecf20Sopenharmony_ci{ 368c2ecf20Sopenharmony_ci NoPalet = 0, /* No palette */ 378c2ecf20Sopenharmony_ci Pal1Bit = 2, /* 2 colors for 1 Bit Palette */ 388c2ecf20Sopenharmony_ci Pal2Bit = 4, /* 4 colors for 2 bit palette */ 398c2ecf20Sopenharmony_ci Pal4Bit = 16, /* 16 colors for 4 bit palette */ 408c2ecf20Sopenharmony_ci Pal8Bit = 256 /* 256 colors for 16 bit palette */ 418c2ecf20Sopenharmony_ci}; 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci/* switch defines */ 448c2ecf20Sopenharmony_ci#define SB_GPIO 3 458c2ecf20Sopenharmony_ci#define SB_OFF SAA7146_GPIO_OUTLO /* SlowBlank off (TV-Mode) */ 468c2ecf20Sopenharmony_ci#define SB_ON SAA7146_GPIO_INPUT /* SlowBlank on (AV-Mode) */ 478c2ecf20Sopenharmony_ci#define SB_WIDE SAA7146_GPIO_OUTHI /* SlowBlank 6V (16/9-Mode) (not implemented) */ 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci#define FB_GPIO 1 508c2ecf20Sopenharmony_ci#define FB_OFF SAA7146_GPIO_LO /* FastBlank off (CVBS-Mode) */ 518c2ecf20Sopenharmony_ci#define FB_ON SAA7146_GPIO_OUTHI /* FastBlank on (RGB-Mode) */ 528c2ecf20Sopenharmony_ci#define FB_LOOP SAA7146_GPIO_INPUT /* FastBlank loop-through (PC graphics ???) */ 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_cienum av7110_video_output_mode 558c2ecf20Sopenharmony_ci{ 568c2ecf20Sopenharmony_ci NO_OUT = 0, /* disable analog output */ 578c2ecf20Sopenharmony_ci CVBS_RGB_OUT = 1, 588c2ecf20Sopenharmony_ci CVBS_YC_OUT = 2, 598c2ecf20Sopenharmony_ci YC_OUT = 3 608c2ecf20Sopenharmony_ci}; 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ci/* firmware internal msg q status: */ 638c2ecf20Sopenharmony_ci#define GPMQFull 0x0001 /* Main Message Queue Full */ 648c2ecf20Sopenharmony_ci#define GPMQOver 0x0002 /* Main Message Queue Overflow */ 658c2ecf20Sopenharmony_ci#define HPQFull 0x0004 /* High Priority Msg Queue Full */ 668c2ecf20Sopenharmony_ci#define HPQOver 0x0008 678c2ecf20Sopenharmony_ci#define OSDQFull 0x0010 /* OSD Queue Full */ 688c2ecf20Sopenharmony_ci#define OSDQOver 0x0020 698c2ecf20Sopenharmony_ci#define GPMQBusy 0x0040 /* Queue not empty, FW >= 261d */ 708c2ecf20Sopenharmony_ci#define HPQBusy 0x0080 718c2ecf20Sopenharmony_ci#define OSDQBusy 0x0100 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ci/* hw section filter flags */ 748c2ecf20Sopenharmony_ci#define SECTION_EIT 0x01 758c2ecf20Sopenharmony_ci#define SECTION_SINGLE 0x00 768c2ecf20Sopenharmony_ci#define SECTION_CYCLE 0x02 778c2ecf20Sopenharmony_ci#define SECTION_CONTINUOS 0x04 788c2ecf20Sopenharmony_ci#define SECTION_MODE 0x06 798c2ecf20Sopenharmony_ci#define SECTION_IPMPE 0x0C /* size up to 4k */ 808c2ecf20Sopenharmony_ci#define SECTION_HIGH_SPEED 0x1C /* larger buffer */ 818c2ecf20Sopenharmony_ci#define DATA_PIPING_FLAG 0x20 /* for Data Piping Filter */ 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ci#define PBUFSIZE_NONE 0x0000 848c2ecf20Sopenharmony_ci#define PBUFSIZE_1P 0x0100 858c2ecf20Sopenharmony_ci#define PBUFSIZE_2P 0x0200 868c2ecf20Sopenharmony_ci#define PBUFSIZE_1K 0x0300 878c2ecf20Sopenharmony_ci#define PBUFSIZE_2K 0x0400 888c2ecf20Sopenharmony_ci#define PBUFSIZE_4K 0x0500 898c2ecf20Sopenharmony_ci#define PBUFSIZE_8K 0x0600 908c2ecf20Sopenharmony_ci#define PBUFSIZE_16K 0x0700 918c2ecf20Sopenharmony_ci#define PBUFSIZE_32K 0x0800 928c2ecf20Sopenharmony_ci 938c2ecf20Sopenharmony_ci 948c2ecf20Sopenharmony_ci/* firmware command codes */ 958c2ecf20Sopenharmony_cienum av7110_osd_command { 968c2ecf20Sopenharmony_ci WCreate, 978c2ecf20Sopenharmony_ci WDestroy, 988c2ecf20Sopenharmony_ci WMoveD, 998c2ecf20Sopenharmony_ci WMoveA, 1008c2ecf20Sopenharmony_ci WHide, 1018c2ecf20Sopenharmony_ci WTop, 1028c2ecf20Sopenharmony_ci DBox, 1038c2ecf20Sopenharmony_ci DLine, 1048c2ecf20Sopenharmony_ci DText, 1058c2ecf20Sopenharmony_ci Set_Font, 1068c2ecf20Sopenharmony_ci SetColor, 1078c2ecf20Sopenharmony_ci SetBlend, 1088c2ecf20Sopenharmony_ci SetWBlend, 1098c2ecf20Sopenharmony_ci SetCBlend, 1108c2ecf20Sopenharmony_ci SetNonBlend, 1118c2ecf20Sopenharmony_ci LoadBmp, 1128c2ecf20Sopenharmony_ci BlitBmp, 1138c2ecf20Sopenharmony_ci ReleaseBmp, 1148c2ecf20Sopenharmony_ci SetWTrans, 1158c2ecf20Sopenharmony_ci SetWNoTrans, 1168c2ecf20Sopenharmony_ci Set_Palette 1178c2ecf20Sopenharmony_ci}; 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_cienum av7110_pid_command { 1208c2ecf20Sopenharmony_ci MultiPID, 1218c2ecf20Sopenharmony_ci VideoPID, 1228c2ecf20Sopenharmony_ci AudioPID, 1238c2ecf20Sopenharmony_ci InitFilt, 1248c2ecf20Sopenharmony_ci FiltError, 1258c2ecf20Sopenharmony_ci NewVersion, 1268c2ecf20Sopenharmony_ci CacheError, 1278c2ecf20Sopenharmony_ci AddPIDFilter, 1288c2ecf20Sopenharmony_ci DelPIDFilter, 1298c2ecf20Sopenharmony_ci Scan, 1308c2ecf20Sopenharmony_ci SetDescr, 1318c2ecf20Sopenharmony_ci SetIR, 1328c2ecf20Sopenharmony_ci FlushTSQueue 1338c2ecf20Sopenharmony_ci}; 1348c2ecf20Sopenharmony_ci 1358c2ecf20Sopenharmony_cienum av7110_mpeg_command { 1368c2ecf20Sopenharmony_ci SelAudChannels 1378c2ecf20Sopenharmony_ci}; 1388c2ecf20Sopenharmony_ci 1398c2ecf20Sopenharmony_cienum av7110_audio_command { 1408c2ecf20Sopenharmony_ci AudioDAC, 1418c2ecf20Sopenharmony_ci CabADAC, 1428c2ecf20Sopenharmony_ci ON22K, 1438c2ecf20Sopenharmony_ci OFF22K, 1448c2ecf20Sopenharmony_ci MainSwitch, 1458c2ecf20Sopenharmony_ci ADSwitch, 1468c2ecf20Sopenharmony_ci SendDiSEqC, 1478c2ecf20Sopenharmony_ci SetRegister, 1488c2ecf20Sopenharmony_ci SpdifSwitch 1498c2ecf20Sopenharmony_ci}; 1508c2ecf20Sopenharmony_ci 1518c2ecf20Sopenharmony_cienum av7110_request_command { 1528c2ecf20Sopenharmony_ci AudioState, 1538c2ecf20Sopenharmony_ci AudioBuffState, 1548c2ecf20Sopenharmony_ci VideoState1, 1558c2ecf20Sopenharmony_ci VideoState2, 1568c2ecf20Sopenharmony_ci VideoState3, 1578c2ecf20Sopenharmony_ci CrashCounter, 1588c2ecf20Sopenharmony_ci ReqVersion, 1598c2ecf20Sopenharmony_ci ReqVCXO, 1608c2ecf20Sopenharmony_ci ReqRegister, 1618c2ecf20Sopenharmony_ci ReqSecFilterError, 1628c2ecf20Sopenharmony_ci ReqSTC 1638c2ecf20Sopenharmony_ci}; 1648c2ecf20Sopenharmony_ci 1658c2ecf20Sopenharmony_cienum av7110_encoder_command { 1668c2ecf20Sopenharmony_ci SetVidMode, 1678c2ecf20Sopenharmony_ci SetTestMode, 1688c2ecf20Sopenharmony_ci LoadVidCode, 1698c2ecf20Sopenharmony_ci SetMonitorType, 1708c2ecf20Sopenharmony_ci SetPanScanType, 1718c2ecf20Sopenharmony_ci SetFreezeMode, 1728c2ecf20Sopenharmony_ci SetWSSConfig 1738c2ecf20Sopenharmony_ci}; 1748c2ecf20Sopenharmony_ci 1758c2ecf20Sopenharmony_cienum av7110_rec_play_state { 1768c2ecf20Sopenharmony_ci __Record, 1778c2ecf20Sopenharmony_ci __Stop, 1788c2ecf20Sopenharmony_ci __Play, 1798c2ecf20Sopenharmony_ci __Pause, 1808c2ecf20Sopenharmony_ci __Slow, 1818c2ecf20Sopenharmony_ci __FF_IP, 1828c2ecf20Sopenharmony_ci __Scan_I, 1838c2ecf20Sopenharmony_ci __Continue 1848c2ecf20Sopenharmony_ci}; 1858c2ecf20Sopenharmony_ci 1868c2ecf20Sopenharmony_cienum av7110_fw_cmd_misc { 1878c2ecf20Sopenharmony_ci AV7110_FW_VIDEO_ZOOM = 1, 1888c2ecf20Sopenharmony_ci AV7110_FW_VIDEO_COMMAND, 1898c2ecf20Sopenharmony_ci AV7110_FW_AUDIO_COMMAND 1908c2ecf20Sopenharmony_ci}; 1918c2ecf20Sopenharmony_ci 1928c2ecf20Sopenharmony_cienum av7110_command_type { 1938c2ecf20Sopenharmony_ci COMTYPE_NOCOM, 1948c2ecf20Sopenharmony_ci COMTYPE_PIDFILTER, 1958c2ecf20Sopenharmony_ci COMTYPE_MPEGDECODER, 1968c2ecf20Sopenharmony_ci COMTYPE_OSD, 1978c2ecf20Sopenharmony_ci COMTYPE_BMP, 1988c2ecf20Sopenharmony_ci COMTYPE_ENCODER, 1998c2ecf20Sopenharmony_ci COMTYPE_AUDIODAC, 2008c2ecf20Sopenharmony_ci COMTYPE_REQUEST, 2018c2ecf20Sopenharmony_ci COMTYPE_SYSTEM, 2028c2ecf20Sopenharmony_ci COMTYPE_REC_PLAY, 2038c2ecf20Sopenharmony_ci COMTYPE_COMMON_IF, 2048c2ecf20Sopenharmony_ci COMTYPE_PID_FILTER, 2058c2ecf20Sopenharmony_ci COMTYPE_PES, 2068c2ecf20Sopenharmony_ci COMTYPE_TS, 2078c2ecf20Sopenharmony_ci COMTYPE_VIDEO, 2088c2ecf20Sopenharmony_ci COMTYPE_AUDIO, 2098c2ecf20Sopenharmony_ci COMTYPE_CI_LL, 2108c2ecf20Sopenharmony_ci COMTYPE_MISC = 0x80 2118c2ecf20Sopenharmony_ci}; 2128c2ecf20Sopenharmony_ci 2138c2ecf20Sopenharmony_ci#define VID_NONE_PREF 0x00 /* No aspect ration processing preferred */ 2148c2ecf20Sopenharmony_ci#define VID_PAN_SCAN_PREF 0x01 /* Pan and Scan Display preferred */ 2158c2ecf20Sopenharmony_ci#define VID_VERT_COMP_PREF 0x02 /* Vertical compression display preferred */ 2168c2ecf20Sopenharmony_ci#define VID_VC_AND_PS_PREF 0x03 /* PanScan and vertical Compression if allowed */ 2178c2ecf20Sopenharmony_ci#define VID_CENTRE_CUT_PREF 0x05 /* PanScan with zero vector */ 2188c2ecf20Sopenharmony_ci 2198c2ecf20Sopenharmony_ci/* MPEG video decoder commands */ 2208c2ecf20Sopenharmony_ci#define AV_VIDEO_CMD_STOP 0x000e 2218c2ecf20Sopenharmony_ci#define AV_VIDEO_CMD_PLAY 0x000d 2228c2ecf20Sopenharmony_ci#define AV_VIDEO_CMD_FREEZE 0x0102 2238c2ecf20Sopenharmony_ci#define AV_VIDEO_CMD_FFWD 0x0016 2248c2ecf20Sopenharmony_ci#define AV_VIDEO_CMD_SLOW 0x0022 2258c2ecf20Sopenharmony_ci 2268c2ecf20Sopenharmony_ci/* MPEG audio decoder commands */ 2278c2ecf20Sopenharmony_ci#define AUDIO_CMD_MUTE 0x0001 2288c2ecf20Sopenharmony_ci#define AUDIO_CMD_UNMUTE 0x0002 2298c2ecf20Sopenharmony_ci#define AUDIO_CMD_PCM16 0x0010 2308c2ecf20Sopenharmony_ci#define AUDIO_CMD_STEREO 0x0080 2318c2ecf20Sopenharmony_ci#define AUDIO_CMD_MONO_L 0x0100 2328c2ecf20Sopenharmony_ci#define AUDIO_CMD_MONO_R 0x0200 2338c2ecf20Sopenharmony_ci#define AUDIO_CMD_SYNC_OFF 0x000e 2348c2ecf20Sopenharmony_ci#define AUDIO_CMD_SYNC_ON 0x000f 2358c2ecf20Sopenharmony_ci 2368c2ecf20Sopenharmony_ci/* firmware data interface codes */ 2378c2ecf20Sopenharmony_ci#define DATA_NONE 0x00 2388c2ecf20Sopenharmony_ci#define DATA_FSECTION 0x01 2398c2ecf20Sopenharmony_ci#define DATA_IPMPE 0x02 2408c2ecf20Sopenharmony_ci#define DATA_MPEG_RECORD 0x03 2418c2ecf20Sopenharmony_ci#define DATA_DEBUG_MESSAGE 0x04 2428c2ecf20Sopenharmony_ci#define DATA_COMMON_INTERFACE 0x05 2438c2ecf20Sopenharmony_ci#define DATA_MPEG_PLAY 0x06 2448c2ecf20Sopenharmony_ci#define DATA_BMP_LOAD 0x07 2458c2ecf20Sopenharmony_ci#define DATA_IRCOMMAND 0x08 2468c2ecf20Sopenharmony_ci#define DATA_PIPING 0x09 2478c2ecf20Sopenharmony_ci#define DATA_STREAMING 0x0a 2488c2ecf20Sopenharmony_ci#define DATA_CI_GET 0x0b 2498c2ecf20Sopenharmony_ci#define DATA_CI_PUT 0x0c 2508c2ecf20Sopenharmony_ci#define DATA_MPEG_VIDEO_EVENT 0x0d 2518c2ecf20Sopenharmony_ci 2528c2ecf20Sopenharmony_ci#define DATA_PES_RECORD 0x10 2538c2ecf20Sopenharmony_ci#define DATA_PES_PLAY 0x11 2548c2ecf20Sopenharmony_ci#define DATA_TS_RECORD 0x12 2558c2ecf20Sopenharmony_ci#define DATA_TS_PLAY 0x13 2568c2ecf20Sopenharmony_ci 2578c2ecf20Sopenharmony_ci/* ancient CI command codes, only two are actually still used 2588c2ecf20Sopenharmony_ci * by the link level CI firmware */ 2598c2ecf20Sopenharmony_ci#define CI_CMD_ERROR 0x00 2608c2ecf20Sopenharmony_ci#define CI_CMD_ACK 0x01 2618c2ecf20Sopenharmony_ci#define CI_CMD_SYSTEM_READY 0x02 2628c2ecf20Sopenharmony_ci#define CI_CMD_KEYPRESS 0x03 2638c2ecf20Sopenharmony_ci#define CI_CMD_ON_TUNED 0x04 2648c2ecf20Sopenharmony_ci#define CI_CMD_ON_SWITCH_PROGRAM 0x05 2658c2ecf20Sopenharmony_ci#define CI_CMD_SECTION_ARRIVED 0x06 2668c2ecf20Sopenharmony_ci#define CI_CMD_SECTION_TIMEOUT 0x07 2678c2ecf20Sopenharmony_ci#define CI_CMD_TIME 0x08 2688c2ecf20Sopenharmony_ci#define CI_CMD_ENTER_MENU 0x09 2698c2ecf20Sopenharmony_ci#define CI_CMD_FAST_PSI 0x0a 2708c2ecf20Sopenharmony_ci#define CI_CMD_GET_SLOT_INFO 0x0b 2718c2ecf20Sopenharmony_ci 2728c2ecf20Sopenharmony_ci#define CI_MSG_NONE 0x00 2738c2ecf20Sopenharmony_ci#define CI_MSG_CI_INFO 0x01 2748c2ecf20Sopenharmony_ci#define CI_MSG_MENU 0x02 2758c2ecf20Sopenharmony_ci#define CI_MSG_LIST 0x03 2768c2ecf20Sopenharmony_ci#define CI_MSG_TEXT 0x04 2778c2ecf20Sopenharmony_ci#define CI_MSG_REQUEST_INPUT 0x05 2788c2ecf20Sopenharmony_ci#define CI_MSG_INPUT_COMPLETE 0x06 2798c2ecf20Sopenharmony_ci#define CI_MSG_LIST_MORE 0x07 2808c2ecf20Sopenharmony_ci#define CI_MSG_MENU_MORE 0x08 2818c2ecf20Sopenharmony_ci#define CI_MSG_CLOSE_MMI_IMM 0x09 2828c2ecf20Sopenharmony_ci#define CI_MSG_SECTION_REQUEST 0x0a 2838c2ecf20Sopenharmony_ci#define CI_MSG_CLOSE_FILTER 0x0b 2848c2ecf20Sopenharmony_ci#define CI_PSI_COMPLETE 0x0c 2858c2ecf20Sopenharmony_ci#define CI_MODULE_READY 0x0d 2868c2ecf20Sopenharmony_ci#define CI_SWITCH_PRG_REPLY 0x0e 2878c2ecf20Sopenharmony_ci#define CI_MSG_TEXT_MORE 0x0f 2888c2ecf20Sopenharmony_ci 2898c2ecf20Sopenharmony_ci#define CI_MSG_CA_PMT 0xe0 2908c2ecf20Sopenharmony_ci#define CI_MSG_ERROR 0xf0 2918c2ecf20Sopenharmony_ci 2928c2ecf20Sopenharmony_ci 2938c2ecf20Sopenharmony_ci/* base address of the dual ported RAM which serves as communication 2948c2ecf20Sopenharmony_ci * area between PCI bus and av7110, 2958c2ecf20Sopenharmony_ci * as seen by the DEBI bus of the saa7146 */ 2968c2ecf20Sopenharmony_ci#define DPRAM_BASE 0x4000 2978c2ecf20Sopenharmony_ci 2988c2ecf20Sopenharmony_ci/* boot protocol area */ 2998c2ecf20Sopenharmony_ci#define AV7110_BOOT_STATE (DPRAM_BASE + 0x3F8) 3008c2ecf20Sopenharmony_ci#define AV7110_BOOT_SIZE (DPRAM_BASE + 0x3FA) 3018c2ecf20Sopenharmony_ci#define AV7110_BOOT_BASE (DPRAM_BASE + 0x3FC) 3028c2ecf20Sopenharmony_ci#define AV7110_BOOT_BLOCK (DPRAM_BASE + 0x400) 3038c2ecf20Sopenharmony_ci#define AV7110_BOOT_MAX_SIZE 0xc00 3048c2ecf20Sopenharmony_ci 3058c2ecf20Sopenharmony_ci/* firmware command protocol area */ 3068c2ecf20Sopenharmony_ci#define IRQ_STATE (DPRAM_BASE + 0x0F4) 3078c2ecf20Sopenharmony_ci#define IRQ_STATE_EXT (DPRAM_BASE + 0x0F6) 3088c2ecf20Sopenharmony_ci#define MSGSTATE (DPRAM_BASE + 0x0F8) 3098c2ecf20Sopenharmony_ci#define COMMAND (DPRAM_BASE + 0x0FC) 3108c2ecf20Sopenharmony_ci#define COM_BUFF (DPRAM_BASE + 0x100) 3118c2ecf20Sopenharmony_ci#define COM_BUFF_SIZE 0x20 3128c2ecf20Sopenharmony_ci 3138c2ecf20Sopenharmony_ci/* various data buffers */ 3148c2ecf20Sopenharmony_ci#define BUFF1_BASE (DPRAM_BASE + 0x120) 3158c2ecf20Sopenharmony_ci#define BUFF1_SIZE 0xE0 3168c2ecf20Sopenharmony_ci 3178c2ecf20Sopenharmony_ci#define DATA_BUFF0_BASE (DPRAM_BASE + 0x200) 3188c2ecf20Sopenharmony_ci#define DATA_BUFF0_SIZE 0x0800 3198c2ecf20Sopenharmony_ci 3208c2ecf20Sopenharmony_ci#define DATA_BUFF1_BASE (DATA_BUFF0_BASE+DATA_BUFF0_SIZE) 3218c2ecf20Sopenharmony_ci#define DATA_BUFF1_SIZE 0x0800 3228c2ecf20Sopenharmony_ci 3238c2ecf20Sopenharmony_ci#define DATA_BUFF2_BASE (DATA_BUFF1_BASE+DATA_BUFF1_SIZE) 3248c2ecf20Sopenharmony_ci#define DATA_BUFF2_SIZE 0x0800 3258c2ecf20Sopenharmony_ci 3268c2ecf20Sopenharmony_ci#define DATA_BUFF3_BASE (DATA_BUFF2_BASE+DATA_BUFF2_SIZE) 3278c2ecf20Sopenharmony_ci#define DATA_BUFF3_SIZE 0x0400 3288c2ecf20Sopenharmony_ci 3298c2ecf20Sopenharmony_ci#define Reserved (DPRAM_BASE + 0x1E00) 3308c2ecf20Sopenharmony_ci#define Reserved_SIZE 0x1C0 3318c2ecf20Sopenharmony_ci 3328c2ecf20Sopenharmony_ci 3338c2ecf20Sopenharmony_ci/* firmware status area */ 3348c2ecf20Sopenharmony_ci#define STATUS_BASE (DPRAM_BASE + 0x1FC0) 3358c2ecf20Sopenharmony_ci#define STATUS_LOOPS (STATUS_BASE + 0x08) 3368c2ecf20Sopenharmony_ci 3378c2ecf20Sopenharmony_ci#define STATUS_MPEG_WIDTH (STATUS_BASE + 0x0C) 3388c2ecf20Sopenharmony_ci/* ((aspect_ratio & 0xf) << 12) | (height & 0xfff) */ 3398c2ecf20Sopenharmony_ci#define STATUS_MPEG_HEIGHT_AR (STATUS_BASE + 0x0E) 3408c2ecf20Sopenharmony_ci 3418c2ecf20Sopenharmony_ci/* firmware data protocol area */ 3428c2ecf20Sopenharmony_ci#define RX_TYPE (DPRAM_BASE + 0x1FE8) 3438c2ecf20Sopenharmony_ci#define RX_LEN (DPRAM_BASE + 0x1FEA) 3448c2ecf20Sopenharmony_ci#define TX_TYPE (DPRAM_BASE + 0x1FEC) 3458c2ecf20Sopenharmony_ci#define TX_LEN (DPRAM_BASE + 0x1FEE) 3468c2ecf20Sopenharmony_ci 3478c2ecf20Sopenharmony_ci#define RX_BUFF (DPRAM_BASE + 0x1FF4) 3488c2ecf20Sopenharmony_ci#define TX_BUFF (DPRAM_BASE + 0x1FF6) 3498c2ecf20Sopenharmony_ci 3508c2ecf20Sopenharmony_ci#define HANDSHAKE_REG (DPRAM_BASE + 0x1FF8) 3518c2ecf20Sopenharmony_ci#define COM_IF_LOCK (DPRAM_BASE + 0x1FFA) 3528c2ecf20Sopenharmony_ci 3538c2ecf20Sopenharmony_ci#define IRQ_RX (DPRAM_BASE + 0x1FFC) 3548c2ecf20Sopenharmony_ci#define IRQ_TX (DPRAM_BASE + 0x1FFE) 3558c2ecf20Sopenharmony_ci 3568c2ecf20Sopenharmony_ci/* used by boot protocol to load firmware into av7110 DRAM */ 3578c2ecf20Sopenharmony_ci#define DRAM_START_CODE 0x2e000404 3588c2ecf20Sopenharmony_ci#define DRAM_MAX_CODE_SIZE 0x00100000 3598c2ecf20Sopenharmony_ci 3608c2ecf20Sopenharmony_ci/* saa7146 gpio lines */ 3618c2ecf20Sopenharmony_ci#define RESET_LINE 2 3628c2ecf20Sopenharmony_ci#define DEBI_DONE_LINE 1 3638c2ecf20Sopenharmony_ci#define ARM_IRQ_LINE 0 3648c2ecf20Sopenharmony_ci 3658c2ecf20Sopenharmony_ci 3668c2ecf20Sopenharmony_ci 3678c2ecf20Sopenharmony_ciextern int av7110_bootarm(struct av7110 *av7110); 3688c2ecf20Sopenharmony_ciextern int av7110_firmversion(struct av7110 *av7110); 3698c2ecf20Sopenharmony_ci#define FW_CI_LL_SUPPORT(arm_app) ((arm_app) & 0x80000000) 3708c2ecf20Sopenharmony_ci#define FW_4M_SDRAM(arm_app) ((arm_app) & 0x40000000) 3718c2ecf20Sopenharmony_ci#define FW_VERSION(arm_app) ((arm_app) & 0x0000FFFF) 3728c2ecf20Sopenharmony_ci 3738c2ecf20Sopenharmony_ciextern int av7110_wait_msgstate(struct av7110 *av7110, u16 flags); 3748c2ecf20Sopenharmony_ciextern int av7110_fw_cmd(struct av7110 *av7110, int type, int com, int num, ...); 3758c2ecf20Sopenharmony_ciextern int av7110_fw_request(struct av7110 *av7110, u16 *request_buf, 3768c2ecf20Sopenharmony_ci int request_buf_len, u16 *reply_buf, int reply_buf_len); 3778c2ecf20Sopenharmony_ci 3788c2ecf20Sopenharmony_ci 3798c2ecf20Sopenharmony_ci/* DEBI (saa7146 data extension bus interface) access */ 3808c2ecf20Sopenharmony_ciextern int av7110_debiwrite(struct av7110 *av7110, u32 config, 3818c2ecf20Sopenharmony_ci int addr, u32 val, unsigned int count); 3828c2ecf20Sopenharmony_ciextern u32 av7110_debiread(struct av7110 *av7110, u32 config, 3838c2ecf20Sopenharmony_ci int addr, unsigned int count); 3848c2ecf20Sopenharmony_ci 3858c2ecf20Sopenharmony_ci 3868c2ecf20Sopenharmony_ci/* DEBI during interrupt */ 3878c2ecf20Sopenharmony_ci/* single word writes */ 3888c2ecf20Sopenharmony_cistatic inline void iwdebi(struct av7110 *av7110, u32 config, int addr, u32 val, unsigned int count) 3898c2ecf20Sopenharmony_ci{ 3908c2ecf20Sopenharmony_ci av7110_debiwrite(av7110, config, addr, val, count); 3918c2ecf20Sopenharmony_ci} 3928c2ecf20Sopenharmony_ci 3938c2ecf20Sopenharmony_ci/* buffer writes */ 3948c2ecf20Sopenharmony_cistatic inline void mwdebi(struct av7110 *av7110, u32 config, int addr, 3958c2ecf20Sopenharmony_ci const u8 *val, int count) 3968c2ecf20Sopenharmony_ci{ 3978c2ecf20Sopenharmony_ci memcpy(av7110->debi_virt, val, count); 3988c2ecf20Sopenharmony_ci av7110_debiwrite(av7110, config, addr, 0, count); 3998c2ecf20Sopenharmony_ci} 4008c2ecf20Sopenharmony_ci 4018c2ecf20Sopenharmony_cistatic inline u32 irdebi(struct av7110 *av7110, u32 config, int addr, u32 val, unsigned int count) 4028c2ecf20Sopenharmony_ci{ 4038c2ecf20Sopenharmony_ci u32 res; 4048c2ecf20Sopenharmony_ci 4058c2ecf20Sopenharmony_ci res=av7110_debiread(av7110, config, addr, count); 4068c2ecf20Sopenharmony_ci if (count<=4) 4078c2ecf20Sopenharmony_ci memcpy(av7110->debi_virt, (char *) &res, count); 4088c2ecf20Sopenharmony_ci return res; 4098c2ecf20Sopenharmony_ci} 4108c2ecf20Sopenharmony_ci 4118c2ecf20Sopenharmony_ci/* DEBI outside interrupts, only for count <= 4! */ 4128c2ecf20Sopenharmony_cistatic inline void wdebi(struct av7110 *av7110, u32 config, int addr, u32 val, unsigned int count) 4138c2ecf20Sopenharmony_ci{ 4148c2ecf20Sopenharmony_ci unsigned long flags; 4158c2ecf20Sopenharmony_ci 4168c2ecf20Sopenharmony_ci spin_lock_irqsave(&av7110->debilock, flags); 4178c2ecf20Sopenharmony_ci av7110_debiwrite(av7110, config, addr, val, count); 4188c2ecf20Sopenharmony_ci spin_unlock_irqrestore(&av7110->debilock, flags); 4198c2ecf20Sopenharmony_ci} 4208c2ecf20Sopenharmony_ci 4218c2ecf20Sopenharmony_cistatic inline u32 rdebi(struct av7110 *av7110, u32 config, int addr, u32 val, unsigned int count) 4228c2ecf20Sopenharmony_ci{ 4238c2ecf20Sopenharmony_ci unsigned long flags; 4248c2ecf20Sopenharmony_ci u32 res; 4258c2ecf20Sopenharmony_ci 4268c2ecf20Sopenharmony_ci spin_lock_irqsave(&av7110->debilock, flags); 4278c2ecf20Sopenharmony_ci res=av7110_debiread(av7110, config, addr, count); 4288c2ecf20Sopenharmony_ci spin_unlock_irqrestore(&av7110->debilock, flags); 4298c2ecf20Sopenharmony_ci return res; 4308c2ecf20Sopenharmony_ci} 4318c2ecf20Sopenharmony_ci 4328c2ecf20Sopenharmony_ci/* handle mailbox registers of the dual ported RAM */ 4338c2ecf20Sopenharmony_cistatic inline void ARM_ResetMailBox(struct av7110 *av7110) 4348c2ecf20Sopenharmony_ci{ 4358c2ecf20Sopenharmony_ci unsigned long flags; 4368c2ecf20Sopenharmony_ci 4378c2ecf20Sopenharmony_ci spin_lock_irqsave(&av7110->debilock, flags); 4388c2ecf20Sopenharmony_ci av7110_debiread(av7110, DEBINOSWAP, IRQ_RX, 2); 4398c2ecf20Sopenharmony_ci av7110_debiwrite(av7110, DEBINOSWAP, IRQ_RX, 0, 2); 4408c2ecf20Sopenharmony_ci spin_unlock_irqrestore(&av7110->debilock, flags); 4418c2ecf20Sopenharmony_ci} 4428c2ecf20Sopenharmony_ci 4438c2ecf20Sopenharmony_cistatic inline void ARM_ClearMailBox(struct av7110 *av7110) 4448c2ecf20Sopenharmony_ci{ 4458c2ecf20Sopenharmony_ci iwdebi(av7110, DEBINOSWAP, IRQ_RX, 0, 2); 4468c2ecf20Sopenharmony_ci} 4478c2ecf20Sopenharmony_ci 4488c2ecf20Sopenharmony_cistatic inline void ARM_ClearIrq(struct av7110 *av7110) 4498c2ecf20Sopenharmony_ci{ 4508c2ecf20Sopenharmony_ci irdebi(av7110, DEBINOSWAP, IRQ_RX, 0, 2); 4518c2ecf20Sopenharmony_ci} 4528c2ecf20Sopenharmony_ci 4538c2ecf20Sopenharmony_ci/**************************************************************************** 4548c2ecf20Sopenharmony_ci * Firmware commands 4558c2ecf20Sopenharmony_ci ****************************************************************************/ 4568c2ecf20Sopenharmony_ci 4578c2ecf20Sopenharmony_cistatic inline int SendDAC(struct av7110 *av7110, u8 addr, u8 data) 4588c2ecf20Sopenharmony_ci{ 4598c2ecf20Sopenharmony_ci return av7110_fw_cmd(av7110, COMTYPE_AUDIODAC, AudioDAC, 2, addr, data); 4608c2ecf20Sopenharmony_ci} 4618c2ecf20Sopenharmony_ci 4628c2ecf20Sopenharmony_cistatic inline int av7710_set_video_mode(struct av7110 *av7110, int mode) 4638c2ecf20Sopenharmony_ci{ 4648c2ecf20Sopenharmony_ci return av7110_fw_cmd(av7110, COMTYPE_ENCODER, SetVidMode, 1, mode); 4658c2ecf20Sopenharmony_ci} 4668c2ecf20Sopenharmony_ci 4678c2ecf20Sopenharmony_cistatic inline int vidcom(struct av7110 *av7110, u32 com, u32 arg) 4688c2ecf20Sopenharmony_ci{ 4698c2ecf20Sopenharmony_ci return av7110_fw_cmd(av7110, COMTYPE_MISC, AV7110_FW_VIDEO_COMMAND, 4, 4708c2ecf20Sopenharmony_ci (com>>16), (com&0xffff), 4718c2ecf20Sopenharmony_ci (arg>>16), (arg&0xffff)); 4728c2ecf20Sopenharmony_ci} 4738c2ecf20Sopenharmony_ci 4748c2ecf20Sopenharmony_cistatic inline int audcom(struct av7110 *av7110, u32 com) 4758c2ecf20Sopenharmony_ci{ 4768c2ecf20Sopenharmony_ci return av7110_fw_cmd(av7110, COMTYPE_MISC, AV7110_FW_AUDIO_COMMAND, 2, 4778c2ecf20Sopenharmony_ci (com>>16), (com&0xffff)); 4788c2ecf20Sopenharmony_ci} 4798c2ecf20Sopenharmony_ci 4808c2ecf20Sopenharmony_cistatic inline int Set22K(struct av7110 *av7110, int state) 4818c2ecf20Sopenharmony_ci{ 4828c2ecf20Sopenharmony_ci return av7110_fw_cmd(av7110, COMTYPE_AUDIODAC, (state ? ON22K : OFF22K), 0); 4838c2ecf20Sopenharmony_ci} 4848c2ecf20Sopenharmony_ci 4858c2ecf20Sopenharmony_ci 4868c2ecf20Sopenharmony_ciextern int av7110_diseqc_send(struct av7110 *av7110, int len, u8 *msg, unsigned long burst); 4878c2ecf20Sopenharmony_ci 4888c2ecf20Sopenharmony_ci 4898c2ecf20Sopenharmony_ci#ifdef CONFIG_DVB_AV7110_OSD 4908c2ecf20Sopenharmony_ciextern int av7110_osd_cmd(struct av7110 *av7110, osd_cmd_t *dc); 4918c2ecf20Sopenharmony_ciextern int av7110_osd_capability(struct av7110 *av7110, osd_cap_t *cap); 4928c2ecf20Sopenharmony_ci#endif /* CONFIG_DVB_AV7110_OSD */ 4938c2ecf20Sopenharmony_ci 4948c2ecf20Sopenharmony_ci 4958c2ecf20Sopenharmony_ci 4968c2ecf20Sopenharmony_ci#endif /* _AV7110_HW_H_ */ 497