kernel: samsung moto charger feature
[GitHub/LineageOS/android_kernel_motorola_exynos9610.git] / include / media / exynos_repeater.h
1 /*
2 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * Header file for Exynos Repeater driver
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12 #ifndef _EXYNOS_REPEATER_H_
13 #define _EXYNOS_REPEATER_H_
14
15 #include <linux/dma-buf.h>
16
17 #define MAX_SHARED_BUF_NUM 3
18
19 /**
20 * struct shared_buffer_info
21 *
22 * @pixel_format : pixel_format of bufs
23 * @width : width of bufs
24 * @height : height of bufs
25 * @buffer_count : valid buffer count of bufs
26 * @bufs : pointer of struct dma_buf for buffer sharing.
27 */
28 struct shared_buffer_info {
29 int pixel_format;
30 int width;
31 int height;
32 int buffer_count;
33 struct dma_buf *bufs[MAX_SHARED_BUF_NUM];
34 };
35
36 /**
37 * hwfc_request_buffer - Get infomation of shared buffer
38 * @info: information of shared buffer
39 * owner: G2D is 0, MFC is 1
40 *
41 * G2D/MFC calls it to get shared buffer information.
42 * Repeater increments reference count on the dma-buf.
43 * G2D/MFC should decrement reference count on the dma-buf.
44 * If repeater has valid buffer, it returns a zero.
45 * If repeater don't have valid buffer, it returns a errno.
46 *
47 */
48 #ifdef CONFIG_VIDEO_EXYNOS_REPEATER
49 int hwfc_request_buffer(struct shared_buffer_info *info, int owner);
50 #else
51 static inline int hwfc_request_buffer(struct shared_buffer_info *info, int owner)
52 {
53 return -1;
54 }
55 #endif
56
57 /**
58 * hwfc_get_valid_buffer - Get shared buf idx for capture output
59 * @buf_idx: shared buf idx for capture output
60 *
61 * G2D call it to get shared buffer index for capture output.
62 * If repeater has valid buffer for capture output, it returns a zero.
63 * If repeater don't have valid buffer for capture output, it returns a errno.
64 *
65 */
66 #ifdef CONFIG_VIDEO_EXYNOS_REPEATER
67 int hwfc_get_valid_buffer(int *buf_idx);
68 #else
69 static inline int hwfc_get_valid_buffer(int *buf_idx)
70 {
71 return -1;
72 }
73 #endif
74
75 /**
76 * hwfc_set_valid_buffer - Set shared buf idx & job id for capture output
77 * @buf_idx : shared buf idx for capture output
78 * @capture_idx : hwfc capture idx
79 *
80 * G2D calls it after G2D H/W starts capture.
81 *
82 */
83 #ifdef CONFIG_VIDEO_EXYNOS_REPEATER
84 int hwfc_set_valid_buffer(int buf_idx, int capture_idx);
85 #else
86 static inline int hwfc_set_valid_buffer(int buf_idx, int capture_idx)
87 {
88 return -1;
89 }
90 #endif
91
92 /**
93 * hwfc_encoding_done - Set ret about encoding
94 * @encoding_ret : ret about encoding
95 *
96 * MFC calls it when encoding is done.
97 *
98 */
99 #ifdef CONFIG_VIDEO_EXYNOS_REPEATER
100 int hwfc_encoding_done(int encoding_ret);
101 #else
102 static inline int hwfc_encoding_done(int encoding_ret)
103 {
104 return -1;
105 }
106 #endif
107
108 #endif /* _EXYNOS_REPEATER_H_ */