1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright 2021 Google Inc.
5 * The DP AUX bus is used for devices that are connected over a DisplayPort
6 * AUX bus. The devices on the far side of the bus are referred to as
7 * endpoints in this code.
10 #ifndef _DP_AUX_BUS_H_
11 #define _DP_AUX_BUS_H_
13 #include <linux/device.h>
14 #include <linux/mod_devicetable.h>
17 * struct dp_aux_ep_device - Main dev structure for DP AUX endpoints
19 * This is used to instantiate devices that are connected via a DP AUX
20 * bus. Usually the device is a panel, but conceivable other devices could
23 struct dp_aux_ep_device {
24 /** @dev: The normal dev pointer */
26 /** @aux: Pointer to the aux bus */
27 struct drm_dp_aux *aux;
30 struct dp_aux_ep_driver {
31 int (*probe)(struct dp_aux_ep_device *aux_ep);
32 void (*remove)(struct dp_aux_ep_device *aux_ep);
33 void (*shutdown)(struct dp_aux_ep_device *aux_ep);
34 struct device_driver driver;
37 static inline struct dp_aux_ep_device *to_dp_aux_ep_dev(struct device *dev)
39 return container_of(dev, struct dp_aux_ep_device, dev);
42 static inline struct dp_aux_ep_driver *to_dp_aux_ep_drv(struct device_driver *drv)
44 return container_of(drv, struct dp_aux_ep_driver, driver);
47 int of_dp_aux_populate_ep_devices(struct drm_dp_aux *aux);
48 void of_dp_aux_depopulate_ep_devices(struct drm_dp_aux *aux);
49 int devm_of_dp_aux_populate_ep_devices(struct drm_dp_aux *aux);
51 #define dp_aux_dp_driver_register(aux_ep_drv) \
52 __dp_aux_dp_driver_register(aux_ep_drv, THIS_MODULE)
53 int __dp_aux_dp_driver_register(struct dp_aux_ep_driver *aux_ep_drv,
54 struct module *owner);
55 void dp_aux_dp_driver_unregister(struct dp_aux_ep_driver *aux_ep_drv);
57 #endif /* _DP_AUX_BUS_H_ */