1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27#ifndef __DRM_ENCODER_SLAVE_H__
28#define __DRM_ENCODER_SLAVE_H__
29
30#include <drm/drmP.h>
31#include <drm/drm_crtc.h>
32#include <drm/drm_encoder.h>
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49struct drm_encoder_slave_funcs {
50 void (*set_config)(struct drm_encoder *encoder,
51 void *params);
52
53 void (*destroy)(struct drm_encoder *encoder);
54 void (*dpms)(struct drm_encoder *encoder, int mode);
55 void (*save)(struct drm_encoder *encoder);
56 void (*restore)(struct drm_encoder *encoder);
57 bool (*mode_fixup)(struct drm_encoder *encoder,
58 const struct drm_display_mode *mode,
59 struct drm_display_mode *adjusted_mode);
60 int (*mode_valid)(struct drm_encoder *encoder,
61 struct drm_display_mode *mode);
62 void (*mode_set)(struct drm_encoder *encoder,
63 struct drm_display_mode *mode,
64 struct drm_display_mode *adjusted_mode);
65
66 enum drm_connector_status (*detect)(struct drm_encoder *encoder,
67 struct drm_connector *connector);
68 int (*get_modes)(struct drm_encoder *encoder,
69 struct drm_connector *connector);
70 int (*create_resources)(struct drm_encoder *encoder,
71 struct drm_connector *connector);
72 int (*set_property)(struct drm_encoder *encoder,
73 struct drm_connector *connector,
74 struct drm_property *property,
75 uint64_t val);
76
77};
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96struct drm_encoder_slave {
97 struct drm_encoder base;
98
99 const struct drm_encoder_slave_funcs *slave_funcs;
100 void *slave_priv;
101 void *bus_priv;
102};
103#define to_encoder_slave(x) container_of((x), struct drm_encoder_slave, base)
104
105int drm_i2c_encoder_init(struct drm_device *dev,
106 struct drm_encoder_slave *encoder,
107 struct i2c_adapter *adap,
108 const struct i2c_board_info *info);
109
110
111
112
113
114
115
116
117
118
119
120
121struct drm_i2c_encoder_driver {
122 struct i2c_driver i2c_driver;
123
124 int (*encoder_init)(struct i2c_client *client,
125 struct drm_device *dev,
126 struct drm_encoder_slave *encoder);
127
128};
129#define to_drm_i2c_encoder_driver(x) container_of((x), \
130 struct drm_i2c_encoder_driver, \
131 i2c_driver)
132
133
134
135
136static inline struct i2c_client *drm_i2c_encoder_get_client(struct drm_encoder *encoder)
137{
138 return (struct i2c_client *)to_encoder_slave(encoder)->bus_priv;
139}
140
141
142
143
144
145
146static inline int drm_i2c_encoder_register(struct module *owner,
147 struct drm_i2c_encoder_driver *driver)
148{
149 return i2c_register_driver(owner, &driver->i2c_driver);
150}
151
152
153
154
155
156static inline void drm_i2c_encoder_unregister(struct drm_i2c_encoder_driver *driver)
157{
158 i2c_del_driver(&driver->i2c_driver);
159}
160
161void drm_i2c_encoder_destroy(struct drm_encoder *encoder);
162
163
164
165
166
167
168
169
170
171
172
173
174
175struct drm_platform_encoder_driver {
176 struct platform_driver platform_driver;
177
178 int (*encoder_init)(struct platform_device *pdev,
179 struct drm_device *dev,
180 struct drm_encoder_slave *encoder);
181
182};
183#define to_drm_platform_encoder_driver(x) container_of((x), \
184 struct drm_platform_encoder_driver, \
185 platform_driver)
186
187
188
189
190
191void drm_i2c_encoder_dpms(struct drm_encoder *encoder, int mode);
192bool drm_i2c_encoder_mode_fixup(struct drm_encoder *encoder,
193 const struct drm_display_mode *mode,
194 struct drm_display_mode *adjusted_mode);
195void drm_i2c_encoder_prepare(struct drm_encoder *encoder);
196void drm_i2c_encoder_commit(struct drm_encoder *encoder);
197void drm_i2c_encoder_mode_set(struct drm_encoder *encoder,
198 struct drm_display_mode *mode,
199 struct drm_display_mode *adjusted_mode);
200enum drm_connector_status drm_i2c_encoder_detect(struct drm_encoder *encoder,
201 struct drm_connector *connector);
202void drm_i2c_encoder_save(struct drm_encoder *encoder);
203void drm_i2c_encoder_restore(struct drm_encoder *encoder);
204
205
206#endif
207