1 /* 2 * Copyright (C) 2017 The Android Open Source Project 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 #ifndef __CMD_H__ 17 #define __CMD_H__ 18 19 #define _IOC_NRBITS 8 20 #define _IOC_TYPEBITS 8 21 22 #ifndef _IOC_SIZEBITS 23 # define _IOC_SIZEBITS 14 24 #endif 25 26 #ifndef _IOC_DIRBITS 27 # define _IOC_DIRBITS 2 28 #endif 29 30 #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) 31 #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) 32 #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) 33 #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) 34 35 #define _IOC_NRSHIFT 0 36 #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) 37 #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) 38 #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) 39 40 #ifndef _IOC_NONE 41 # define _IOC_NONE 0U 42 #endif 43 44 #ifndef _IOC_WRITE 45 # define _IOC_WRITE 1U 46 #endif 47 48 #ifndef _IOC_READ 49 # define _IOC_READ 2U 50 #endif 51 52 #define _IOC_TYPECHECK(t) (sizeof(t)) 53 #define _IOC(dir,type,nr,size) \ 54 (((dir) << _IOC_DIRSHIFT) | \ 55 ((type) << _IOC_TYPESHIFT) | \ 56 ((nr) << _IOC_NRSHIFT) | \ 57 ((size) << _IOC_SIZESHIFT)) 58 59 60 #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) 61 #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size))) 62 #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) 63 #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) 64 65 66 67 struct mult_factor { 68 uint32_t numer; 69 uint32_t denom; 70 }; 71 72 struct mdp_rotation_buf_info { 73 uint32_t width; 74 uint32_t height; 75 uint32_t format; 76 struct mult_factor comp_ratio; 77 }; 78 79 struct mdp_rotation_config { 80 uint32_t version; 81 uint32_t session_id; 82 struct mdp_rotation_buf_info input; 83 struct mdp_rotation_buf_info output; 84 uint32_t frame_rate; 85 uint32_t flags; 86 uint32_t reserved[6]; 87 }; 88 89 #define MDSS_ROTATOR_IOCTL_MAGIC 'w' 90 91 #define MDSS_ROTATION_OPEN \ 92 _IOWR(MDSS_ROTATOR_IOCTL_MAGIC, 1, struct mdp_rotation_config *) 93 94 #define MDSS_ROTATION_CONFIG \ 95 _IOWR(MDSS_ROTATOR_IOCTL_MAGIC, 2, struct mdp_rotation_config *) 96 97 #define MDSS_ROTATION_CLOSE _IOW(MDSS_ROTATOR_IOCTL_MAGIC, 4, unsigned int) 98 #endif 99