0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef _DP_AUX_BUS_H_
0011 #define _DP_AUX_BUS_H_
0012
0013 #include <linux/device.h>
0014 #include <linux/mod_devicetable.h>
0015
0016
0017
0018
0019
0020
0021
0022
0023 struct dp_aux_ep_device {
0024
0025 struct device dev;
0026
0027 struct drm_dp_aux *aux;
0028 };
0029
0030 struct dp_aux_ep_driver {
0031 int (*probe)(struct dp_aux_ep_device *aux_ep);
0032 void (*remove)(struct dp_aux_ep_device *aux_ep);
0033 void (*shutdown)(struct dp_aux_ep_device *aux_ep);
0034 struct device_driver driver;
0035 };
0036
0037 static inline struct dp_aux_ep_device *to_dp_aux_ep_dev(struct device *dev)
0038 {
0039 return container_of(dev, struct dp_aux_ep_device, dev);
0040 }
0041
0042 static inline struct dp_aux_ep_driver *to_dp_aux_ep_drv(struct device_driver *drv)
0043 {
0044 return container_of(drv, struct dp_aux_ep_driver, driver);
0045 }
0046
0047 int of_dp_aux_populate_bus(struct drm_dp_aux *aux,
0048 int (*done_probing)(struct drm_dp_aux *aux));
0049 void of_dp_aux_depopulate_bus(struct drm_dp_aux *aux);
0050 int devm_of_dp_aux_populate_bus(struct drm_dp_aux *aux,
0051 int (*done_probing)(struct drm_dp_aux *aux));
0052
0053
0054 static inline int of_dp_aux_populate_ep_devices(struct drm_dp_aux *aux)
0055 {
0056 int ret;
0057
0058 ret = of_dp_aux_populate_bus(aux, NULL);
0059
0060
0061 return (ret != -ENODEV) ? ret : 0;
0062 }
0063
0064 static inline int devm_of_dp_aux_populate_ep_devices(struct drm_dp_aux *aux)
0065 {
0066 int ret;
0067
0068 ret = devm_of_dp_aux_populate_bus(aux, NULL);
0069
0070
0071 return (ret != -ENODEV) ? ret : 0;
0072 }
0073
0074 static inline void of_dp_aux_depopulate_ep_devices(struct drm_dp_aux *aux)
0075 {
0076 of_dp_aux_depopulate_bus(aux);
0077 }
0078
0079 #define dp_aux_dp_driver_register(aux_ep_drv) \
0080 __dp_aux_dp_driver_register(aux_ep_drv, THIS_MODULE)
0081 int __dp_aux_dp_driver_register(struct dp_aux_ep_driver *aux_ep_drv,
0082 struct module *owner);
0083 void dp_aux_dp_driver_unregister(struct dp_aux_ep_driver *aux_ep_drv);
0084
0085 #endif