linux/include/drm/drm_dp_aux_bus.h
Douglas Anderson aeb33699fc drm: Introduce the DP AUX bus
Historically "simple" eDP panels have been handled by panel-simple
which is a basic platform_device. In the device tree, the panel node
was at the top level and not connected to anything else.

Let's change it so that, instead, panels can be represented as being
children of the "DP AUX bus". Essentially we're saying that the
hierarchy that we're going to represent is the "control" connections
between devices. The DP AUX bus is a control bus provided by an eDP
controller (the parent) and consumed by a device like a panel (the
child).

The primary incentive here is to cleanly provide the panel driver the
ability to communicate over the AUX bus while handling lifetime issues
properly. The panel driver may want the AUX bus for controlling the
backlight or querying the panel's EDID.

The idea for this bus's design was hashed out over IRC [1].

[1] https://people.freedesktop.org/~cbrill/dri-log/?channel=dri-devel&date=2021-05-11

Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Lyude Paul <lyude@redhat.com>
Cc: Rajeev Nandan <rajeevny@codeaurora.org>
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210611101711.v10.4.I787c9ba09ed5ce12500326ded73a4f7c9265b1b3@changeid
2021-06-11 12:30:39 -07:00

58 lines
1.7 KiB
C

/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright 2021 Google Inc.
*
* The DP AUX bus is used for devices that are connected over a DisplayPort
* AUX bus. The devices on the far side of the bus are referred to as
* endpoints in this code.
*/
#ifndef _DP_AUX_BUS_H_
#define _DP_AUX_BUS_H_
#include <linux/device.h>
#include <linux/mod_devicetable.h>
/**
* struct dp_aux_ep_device - Main dev structure for DP AUX endpoints
*
* This is used to instantiate devices that are connected via a DP AUX
* bus. Usually the device is a panel, but conceivable other devices could
* be hooked up there.
*/
struct dp_aux_ep_device {
/** @dev: The normal dev pointer */
struct device dev;
/** @aux: Pointer to the aux bus */
struct drm_dp_aux *aux;
};
struct dp_aux_ep_driver {
int (*probe)(struct dp_aux_ep_device *aux_ep);
void (*remove)(struct dp_aux_ep_device *aux_ep);
void (*shutdown)(struct dp_aux_ep_device *aux_ep);
struct device_driver driver;
};
static inline struct dp_aux_ep_device *to_dp_aux_ep_dev(struct device *dev)
{
return container_of(dev, struct dp_aux_ep_device, dev);
}
static inline struct dp_aux_ep_driver *to_dp_aux_ep_drv(struct device_driver *drv)
{
return container_of(drv, struct dp_aux_ep_driver, driver);
}
int of_dp_aux_populate_ep_devices(struct drm_dp_aux *aux);
void of_dp_aux_depopulate_ep_devices(struct drm_dp_aux *aux);
int devm_of_dp_aux_populate_ep_devices(struct drm_dp_aux *aux);
#define dp_aux_dp_driver_register(aux_ep_drv) \
__dp_aux_dp_driver_register(aux_ep_drv, THIS_MODULE)
int __dp_aux_dp_driver_register(struct dp_aux_ep_driver *aux_ep_drv,
struct module *owner);
void dp_aux_dp_driver_unregister(struct dp_aux_ep_driver *aux_ep_drv);
#endif /* _DP_AUX_BUS_H_ */