#include <linux/ref_tracker.h>
#include <linux/types.h>
#include <drm/drm_atomic_state_helper.h>
#include <drm/drm_atomic.h>
#include <drm/drm_print.h>
#include <drm/display/drm_dp.h>
#include <drm/display/drm_dp_helper.h>
#include <drm/display/drm_dp_tunnel.h>
#define to_group(__private_obj) …
#define to_group_state(__private_state) …
#define is_dp_tunnel_private_obj(__obj) …
#define for_each_new_group_in_state(__state, __new_group_state, __i) …
#define for_each_old_group_in_state(__state, __old_group_state, __i) …
#define for_each_tunnel_in_group(__group, __tunnel) …
#define for_each_tunnel_state(__group_state, __tunnel_state) …
#define for_each_tunnel_state_safe(__group_state, __tunnel_state, __tunnel_state_tmp) …
#define kbytes_to_mbits(__kbytes) …
#define DPTUN_BW_ARG(__bw) …
#define __tun_prn(__tunnel, __level, __type, __fmt, ...) …
#define tun_dbg(__tunnel, __fmt, ...) …
#define tun_dbg_stat(__tunnel, __err, __fmt, ...) …
#define tun_dbg_atomic(__tunnel, __fmt, ...) …
#define tun_grp_dbg(__group, __fmt, ...) …
#define DP_TUNNELING_BASE …
#define __DPTUN_REG_RANGE(__start, __size) …
#define DPTUN_REG_RANGE(__addr, __size) …
#define DPTUN_REG(__addr) …
#define DPTUN_INFO_REG_MASK …
static const DECLARE_BITMAP(dptun_info_regs, 64) = …;
struct drm_dp_tunnel_regs { … };
struct drm_dp_tunnel_group;
struct drm_dp_tunnel { … };
struct drm_dp_tunnel_group_state;
struct drm_dp_tunnel_state { … };
struct drm_dp_tunnel_group_state { … };
struct drm_dp_tunnel_group { … };
struct drm_dp_tunnel_mgr { … };
static int next_reg_area(int *offset)
{ … }
#define tunnel_reg_ptr(__regs, __address) …
static int read_tunnel_regs(struct drm_dp_aux *aux, struct drm_dp_tunnel_regs *regs)
{ … }
static u8 tunnel_reg(const struct drm_dp_tunnel_regs *regs, int address)
{ … }
static u8 tunnel_reg_drv_group_id(const struct drm_dp_tunnel_regs *regs)
{ … }
static int tunnel_reg_bw_granularity(const struct drm_dp_tunnel_regs *regs)
{ … }
static int tunnel_reg_max_dprx_rate(const struct drm_dp_tunnel_regs *regs)
{ … }
static int tunnel_reg_max_dprx_lane_count(const struct drm_dp_tunnel_regs *regs)
{ … }
static bool tunnel_reg_bw_alloc_supported(const struct drm_dp_tunnel_regs *regs)
{ … }
static bool tunnel_reg_bw_alloc_enabled(const struct drm_dp_tunnel_regs *regs)
{ … }
static u8 tunnel_group_drv_id(u8 drv_group_id)
{ … }
static u8 tunnel_group_id(u8 drv_group_id)
{ … }
const char *drm_dp_tunnel_name(const struct drm_dp_tunnel *tunnel)
{ … }
EXPORT_SYMBOL(…);
static const char *drm_dp_tunnel_group_name(const struct drm_dp_tunnel_group *group)
{ … }
static struct drm_dp_tunnel_group *
lookup_or_alloc_group(struct drm_dp_tunnel_mgr *mgr, u8 drv_group_id)
{ … }
static void free_group(struct drm_dp_tunnel_group *group)
{ … }
static struct drm_dp_tunnel *
tunnel_get(struct drm_dp_tunnel *tunnel)
{ … }
static void free_tunnel(struct kref *kref)
{ … }
static void tunnel_put(struct drm_dp_tunnel *tunnel)
{ … }
#ifdef CONFIG_DRM_DISPLAY_DP_TUNNEL_STATE_DEBUG
static void track_tunnel_ref(struct drm_dp_tunnel *tunnel,
struct ref_tracker **tracker)
{ … }
static void untrack_tunnel_ref(struct drm_dp_tunnel *tunnel,
struct ref_tracker **tracker)
{ … }
#else
static void track_tunnel_ref(struct drm_dp_tunnel *tunnel,
struct ref_tracker **tracker)
{
}
static void untrack_tunnel_ref(struct drm_dp_tunnel *tunnel,
struct ref_tracker **tracker)
{
}
#endif
struct drm_dp_tunnel *
drm_dp_tunnel_get(struct drm_dp_tunnel *tunnel,
struct ref_tracker **tracker)
{ … }
EXPORT_SYMBOL(…);
void drm_dp_tunnel_put(struct drm_dp_tunnel *tunnel,
struct ref_tracker **tracker)
{ … }
EXPORT_SYMBOL(…);
static bool add_tunnel_to_group(struct drm_dp_tunnel_mgr *mgr,
u8 drv_group_id,
struct drm_dp_tunnel *tunnel)
{ … }
static struct drm_dp_tunnel *
create_tunnel(struct drm_dp_tunnel_mgr *mgr,
struct drm_dp_aux *aux,
const struct drm_dp_tunnel_regs *regs)
{ … }
static void destroy_tunnel(struct drm_dp_tunnel *tunnel)
{ … }
void drm_dp_tunnel_set_io_error(struct drm_dp_tunnel *tunnel)
{ … }
EXPORT_SYMBOL(…);
#define SKIP_DPRX_CAPS_CHECK …
#define ALLOW_ALLOCATED_BW_CHANGE …
static bool tunnel_regs_are_valid(struct drm_dp_tunnel_mgr *mgr,
const struct drm_dp_tunnel_regs *regs,
unsigned int flags)
{ … }
static int tunnel_allocated_bw(const struct drm_dp_tunnel *tunnel)
{ … }
static bool tunnel_info_changes_are_valid(struct drm_dp_tunnel *tunnel,
const struct drm_dp_tunnel_regs *regs,
unsigned int flags)
{ … }
static int
read_and_verify_tunnel_regs(struct drm_dp_tunnel *tunnel,
struct drm_dp_tunnel_regs *regs,
unsigned int flags)
{ … }
static bool update_dprx_caps(struct drm_dp_tunnel *tunnel, const struct drm_dp_tunnel_regs *regs)
{ … }
static int dev_id_len(const u8 *dev_id, int max_len)
{ … }
static int get_max_dprx_bw(const struct drm_dp_tunnel *tunnel)
{ … }
static int get_max_tunnel_bw(const struct drm_dp_tunnel *tunnel)
{ … }
struct drm_dp_tunnel *
drm_dp_tunnel_detect(struct drm_dp_tunnel_mgr *mgr,
struct drm_dp_aux *aux)
{ … }
EXPORT_SYMBOL(…);
int drm_dp_tunnel_destroy(struct drm_dp_tunnel *tunnel)
{ … }
EXPORT_SYMBOL(…);
static int check_tunnel(const struct drm_dp_tunnel *tunnel)
{ … }
static int group_allocated_bw(struct drm_dp_tunnel_group *group)
{ … }
static int group_free_bw(const struct drm_dp_tunnel *tunnel)
{ … }
static int calc_group_available_bw(const struct drm_dp_tunnel *tunnel)
{ … }
static int update_group_available_bw(struct drm_dp_tunnel *tunnel,
const struct drm_dp_tunnel_regs *regs)
{ … }
static int set_bw_alloc_mode(struct drm_dp_tunnel *tunnel, bool enable)
{ … }
int drm_dp_tunnel_enable_bw_alloc(struct drm_dp_tunnel *tunnel)
{ … }
EXPORT_SYMBOL(…);
int drm_dp_tunnel_disable_bw_alloc(struct drm_dp_tunnel *tunnel)
{ … }
EXPORT_SYMBOL(…);
bool drm_dp_tunnel_bw_alloc_is_enabled(const struct drm_dp_tunnel *tunnel)
{ … }
EXPORT_SYMBOL(…);
static int clear_bw_req_state(struct drm_dp_aux *aux)
{ … }
static int bw_req_complete(struct drm_dp_aux *aux, bool *status_changed)
{ … }
static int allocate_tunnel_bw(struct drm_dp_tunnel *tunnel, int bw)
{ … }
int drm_dp_tunnel_alloc_bw(struct drm_dp_tunnel *tunnel, int bw)
{ … }
EXPORT_SYMBOL(…);
int drm_dp_tunnel_get_allocated_bw(struct drm_dp_tunnel *tunnel)
{ … }
EXPORT_SYMBOL(…);
static int check_and_clear_status_change(struct drm_dp_tunnel *tunnel)
{ … }
int drm_dp_tunnel_update_state(struct drm_dp_tunnel *tunnel)
{ … }
EXPORT_SYMBOL(…);
int drm_dp_tunnel_handle_irq(struct drm_dp_tunnel_mgr *mgr, struct drm_dp_aux *aux)
{ … }
EXPORT_SYMBOL(…);
int drm_dp_tunnel_max_dprx_rate(const struct drm_dp_tunnel *tunnel)
{ … }
EXPORT_SYMBOL(…);
int drm_dp_tunnel_max_dprx_lane_count(const struct drm_dp_tunnel *tunnel)
{ … }
EXPORT_SYMBOL(…);
int drm_dp_tunnel_available_bw(const struct drm_dp_tunnel *tunnel)
{ … }
EXPORT_SYMBOL(…);
static struct drm_dp_tunnel_group_state *
drm_dp_tunnel_atomic_get_group_state(struct drm_atomic_state *state,
const struct drm_dp_tunnel *tunnel)
{ … }
static struct drm_dp_tunnel_state *
add_tunnel_state(struct drm_dp_tunnel_group_state *group_state,
struct drm_dp_tunnel *tunnel)
{ … }
static void free_tunnel_state(struct drm_dp_tunnel_state *tunnel_state)
{ … }
static void free_group_state(struct drm_dp_tunnel_group_state *group_state)
{ … }
static struct drm_dp_tunnel_state *
get_tunnel_state(struct drm_dp_tunnel_group_state *group_state,
const struct drm_dp_tunnel *tunnel)
{ … }
static struct drm_dp_tunnel_state *
get_or_add_tunnel_state(struct drm_dp_tunnel_group_state *group_state,
struct drm_dp_tunnel *tunnel)
{ … }
static struct drm_private_state *
tunnel_group_duplicate_state(struct drm_private_obj *obj)
{ … }
static void tunnel_group_destroy_state(struct drm_private_obj *obj, struct drm_private_state *state)
{ … }
static const struct drm_private_state_funcs tunnel_group_funcs = …;
struct drm_dp_tunnel_state *
drm_dp_tunnel_atomic_get_state(struct drm_atomic_state *state,
struct drm_dp_tunnel *tunnel)
{ … }
EXPORT_SYMBOL(…);
struct drm_dp_tunnel_state *
drm_dp_tunnel_atomic_get_old_state(struct drm_atomic_state *state,
const struct drm_dp_tunnel *tunnel)
{ … }
EXPORT_SYMBOL(…);
struct drm_dp_tunnel_state *
drm_dp_tunnel_atomic_get_new_state(struct drm_atomic_state *state,
const struct drm_dp_tunnel *tunnel)
{ … }
EXPORT_SYMBOL(…);
static bool init_group(struct drm_dp_tunnel_mgr *mgr, struct drm_dp_tunnel_group *group)
{ … }
static void cleanup_group(struct drm_dp_tunnel_group *group)
{ … }
#ifdef CONFIG_DRM_DISPLAY_DP_TUNNEL_STATE_DEBUG
static void check_unique_stream_ids(const struct drm_dp_tunnel_group_state *group_state)
{ … }
#else
static void check_unique_stream_ids(const struct drm_dp_tunnel_group_state *group_state)
{
}
#endif
static int stream_id_to_idx(u32 stream_mask, u8 stream_id)
{ … }
static int resize_bw_array(struct drm_dp_tunnel_state *tunnel_state,
unsigned long old_mask, unsigned long new_mask)
{ … }
static int set_stream_bw(struct drm_dp_tunnel_state *tunnel_state,
u8 stream_id, int bw)
{ … }
static int clear_stream_bw(struct drm_dp_tunnel_state *tunnel_state,
u8 stream_id)
{ … }
int drm_dp_tunnel_atomic_set_stream_bw(struct drm_atomic_state *state,
struct drm_dp_tunnel *tunnel,
u8 stream_id, int bw)
{ … }
EXPORT_SYMBOL(…);
int drm_dp_tunnel_atomic_get_required_bw(const struct drm_dp_tunnel_state *tunnel_state)
{ … }
EXPORT_SYMBOL(…);
int drm_dp_tunnel_atomic_get_group_streams_in_state(struct drm_atomic_state *state,
const struct drm_dp_tunnel *tunnel,
u32 *stream_mask)
{ … }
EXPORT_SYMBOL(…);
static int
drm_dp_tunnel_atomic_check_group_bw(struct drm_dp_tunnel_group_state *new_group_state,
u32 *failed_stream_mask)
{ … }
int drm_dp_tunnel_atomic_check_stream_bws(struct drm_atomic_state *state,
u32 *failed_stream_mask)
{ … }
EXPORT_SYMBOL(…);
static void destroy_mgr(struct drm_dp_tunnel_mgr *mgr)
{ … }
struct drm_dp_tunnel_mgr *
drm_dp_tunnel_mgr_create(struct drm_device *dev, int max_group_count)
{ … }
EXPORT_SYMBOL(…);
void drm_dp_tunnel_mgr_destroy(struct drm_dp_tunnel_mgr *mgr)
{ … }
EXPORT_SYMBOL(…);