Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
drm_encoder_slave.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2009 Francisco Jerez.
3  * All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining
6  * a copy of this software and associated documentation files (the
7  * "Software"), to deal in the Software without restriction, including
8  * without limitation the rights to use, copy, modify, merge, publish,
9  * distribute, sublicense, and/or sell copies of the Software, and to
10  * permit persons to whom the Software is furnished to do so, subject to
11  * the following conditions:
12  *
13  * The above copyright notice and this permission notice (including the
14  * next paragraph) shall be included in all copies or substantial
15  * portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20  * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
21  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
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 
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 
96  struct drm_encoder base;
97 
99  void *slave_priv;
100  void *bus_priv;
101 };
102 #define to_encoder_slave(x) container_of((x), struct drm_encoder_slave, base)
103 
105  struct drm_encoder_slave *encoder,
106  struct i2c_adapter *adap,
107  const struct i2c_board_info *info);
108 
109 
122 
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 
135 static 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 
145 static inline int drm_i2c_encoder_register(struct module *owner,
147 {
148  return i2c_register_driver(owner, &driver->i2c_driver);
149 }
150 
155 static inline void drm_i2c_encoder_unregister(struct drm_i2c_encoder_driver *driver)
156 {
157  i2c_del_driver(&driver->i2c_driver);
158 }
159 
160 void drm_i2c_encoder_destroy(struct drm_encoder *encoder);
161 
162 #endif