Petr Havlena | c928814 | 2012-11-15 14:07:10 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2011, Havlena Petr <havlenapetr@gmail.com> |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef ANDROID_HARDWARE_SEC_TV_H |
| 18 | #define ANDROID_HARDWARE_SEC_TV_H |
| 19 | |
| 20 | #include <stdio.h> |
| 21 | #include <string.h> |
| 22 | #include <stdlib.h> |
| 23 | |
| 24 | #include <fcntl.h> |
| 25 | #include <unistd.h> |
| 26 | #include <errno.h> |
| 27 | #include <signal.h> |
| 28 | #include <sys/mman.h> |
| 29 | #include <sys/time.h> |
| 30 | #include <sys/ioctl.h> |
| 31 | #include <sys/poll.h> |
| 32 | #include <sys/stat.h> |
| 33 | |
| 34 | #include <linux/videodev2.h> |
| 35 | #include <s5p_tvout.h> |
| 36 | |
| 37 | #include "fimc.h" |
| 38 | |
| 39 | namespace android { |
| 40 | |
| 41 | enum s5p_tv_standart { |
| 42 | S5P_TV_STD_NTSC_M = 0, |
| 43 | S5P_TV_STD_PAL_BDGHI, |
| 44 | S5P_TV_STD_PAL_M, |
| 45 | S5P_TV_STD_PAL_N, |
| 46 | S5P_TV_STD_PAL_Nc, |
| 47 | S5P_TV_STD_PAL_60, |
| 48 | S5P_TV_STD_NTSC_443, |
| 49 | S5P_TV_STD_480P_60_16_9, |
| 50 | S5P_TV_STD_480P_60_4_3, |
| 51 | S5P_TV_STD_576P_50_16_9, |
| 52 | S5P_TV_STD_576P_50_4_3, |
| 53 | S5P_TV_STD_720P_60, |
| 54 | S5P_TV_STD_720P_50 |
| 55 | }; |
| 56 | |
| 57 | // must match with s5p_tv_outputs in s5p_tv_v4l.c |
| 58 | enum s5p_tv_output { |
| 59 | S5P_TV_OUTPUT_TYPE_COMPOSITE = 0, |
| 60 | S5P_TV_OUTPUT_TYPE_SVIDEO, |
| 61 | S5P_TV_OUTPUT_TYPE_YPBPR_INERLACED, |
| 62 | S5P_TV_OUTPUT_TYPE_YPBPR_PROGRESSIVE, |
| 63 | S5P_TV_OUTPUT_TYPE_RGB_PROGRESSIVE, |
| 64 | S5P_TV_OUTPUT_TYPE_HDMI, |
| 65 | }; |
| 66 | |
| 67 | class SecHDMI { |
| 68 | public: |
| 69 | SecHDMI(); |
| 70 | ~SecHDMI(); |
| 71 | |
| 72 | static int getCableStatus(); |
| 73 | |
| 74 | int create(int width, int height); |
| 75 | int destroy(); |
| 76 | |
| 77 | int connect(); |
| 78 | int disconnect(); |
| 79 | |
| 80 | int flush(int srcW, int srcH, int srcColorFormat, |
| 81 | unsigned int srcYAddr, unsigned int srcCbAddr, unsigned int srcCrAddr, |
| 82 | int dstX, int dstY, |
| 83 | int layer, |
| 84 | int num_of_hwc_layer); |
| 85 | |
| 86 | const __u8* getName(int index); |
| 87 | |
| 88 | private: |
| 89 | enum s5p_tv_layer { |
| 90 | S5P_TV_LAYER_BASE = 0, |
| 91 | S5P_TV_LAYER_VIDEO, |
| 92 | S5P_TV_LAYER_GRAPHIC_0, |
| 93 | S5P_TV_LAYER_GRAPHIC_1, |
| 94 | S5P_TV_LAYER_MAX, |
| 95 | }; |
| 96 | |
| 97 | int mTvOutFd; |
| 98 | int mTvOutVFd; |
| 99 | int mLcdFd; |
| 100 | unsigned int mHdcpEnabled; |
| 101 | bool mFlagConnected; |
| 102 | bool mFlagLayerEnable[S5P_TV_LAYER_MAX]; |
| 103 | |
| 104 | s5p_fimc_t mFimc; |
| 105 | v4l2_streamparm mParams; |
| 106 | |
| 107 | int startLayer(s5p_tv_layer layer); |
| 108 | int stopLayer(s5p_tv_layer layer); |
| 109 | }; |
| 110 | |
| 111 | }; // namespace android |
| 112 | |
| 113 | #endif // ANDROID_HARDWARE_SEC_TV_H |