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/drm_crtc.h>
31#include <drm/drm_encoder.h>
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48struct drm_encoder_slave_funcs {
49 void (*set_config)(struct drm_encoder *encoder,
50 void *params);
51
52 void (*destroy)(struct drm_encoder *encoder);
53 void (*dpms)(struct drm_encoder *encoder, int mode);
54 void (*save)(struct drm_encoder *encoder);
55 void (*restore)(struct drm_encoder *encoder);
56 bool (*mode_fixup)(struct drm_encoder *encoder,
57 const struct drm_display_mode *mode,
58 struct drm_display_mode *adjusted_mode);
59 int (*mode_valid)(struct drm_encoder *encoder,
60 struct drm_display_mode *mode);
61 void (*mode_set)(struct drm_encoder *encoder,
62 struct drm_display_mode *mode,
63 struct drm_display_mode *adjusted_mode);
64
65 enum drm_connector_status (*detect)(struct drm_encoder *encoder,
66 struct drm_connector *connector);
67 int (*get_modes)(struct drm_encoder *encoder,
68 struct drm_connector *connector);
69 int (*create_resources)(struct drm_encoder *encoder,
70 struct drm_connector *connector);
71 int (*set_property)(struct drm_encoder *encoder,
72 struct drm_connector *connector,
73 struct drm_property *property,
74 uint64_t val);
75
76};
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95struct drm_encoder_slave {
96 struct drm_encoder base;
97
98 const struct drm_encoder_slave_funcs *slave_funcs;
99 void *slave_priv;
100 void *bus_priv;
101};
102#define to_encoder_slave(x) container_of((x), struct drm_encoder_slave, base)
103
104int drm_i2c_encoder_init(struct drm_device *dev,
105 struct drm_encoder_slave *encoder,
106 struct i2c_adapter *adap,
107 const struct i2c_board_info *info);
108
109
110
111
112
113
114
115
116
117
118
119
120struct drm_i2c_encoder_driver {
121 struct i2c_driver i2c_driver;
122
123 int (*encoder_init)(struct i2c_client *client,
124 struct drm_device *dev,
125 struct drm_encoder_slave *encoder);
126
127};
128#define to_drm_i2c_encoder_driver(x) container_of((x), \
129 struct drm_i2c_encoder_driver, \
130 i2c_driver)
131
132
133
134
135static inline struct i2c_client *drm_i2c_encoder_get_client(struct drm_encoder *encoder)
136{
137 return (struct i2c_client *)to_encoder_slave(encoder)->bus_priv;
138}
139
140
141
142
143
144
145static inline int drm_i2c_encoder_register(struct module *owner,
146 struct drm_i2c_encoder_driver *driver)
147{
148 return i2c_register_driver(owner, &driver->i2c_driver);
149}
150
151
152
153
154
155static inline void drm_i2c_encoder_unregister(struct drm_i2c_encoder_driver *driver)
156{
157 i2c_del_driver(&driver->i2c_driver);
158}
159
160void drm_i2c_encoder_destroy(struct drm_encoder *encoder);
161
162
163
164
165
166
167void drm_i2c_encoder_dpms(struct drm_encoder *encoder, int mode);
168bool drm_i2c_encoder_mode_fixup(struct drm_encoder *encoder,
169 const struct drm_display_mode *mode,
170 struct drm_display_mode *adjusted_mode);
171void drm_i2c_encoder_prepare(struct drm_encoder *encoder);
172void drm_i2c_encoder_commit(struct drm_encoder *encoder);
173void drm_i2c_encoder_mode_set(struct drm_encoder *encoder,
174 struct drm_display_mode *mode,
175 struct drm_display_mode *adjusted_mode);
176enum drm_connector_status drm_i2c_encoder_detect(struct drm_encoder *encoder,
177 struct drm_connector *connector);
178void drm_i2c_encoder_save(struct drm_encoder *encoder);
179void drm_i2c_encoder_restore(struct drm_encoder *encoder);
180
181
182#endif
183