anx_dp.h revision 1.4 1 1.4 riastrad /* $NetBSD: anx_dp.h,v 1.4 2021/12/19 11:01:11 riastradh Exp $ */
2 1.1 jakllsch
3 1.1 jakllsch /*-
4 1.1 jakllsch * Copyright (c) 2019 Jonathan A. Kollasch <jakllsch (at) kollasch.net>
5 1.1 jakllsch * All rights reserved.
6 1.1 jakllsch *
7 1.1 jakllsch * Redistribution and use in source and binary forms, with or without
8 1.1 jakllsch * modification, are permitted provided that the following conditions
9 1.1 jakllsch * are met:
10 1.1 jakllsch * 1. Redistributions of source code must retain the above copyright
11 1.1 jakllsch * notice, this list of conditions and the following disclaimer.
12 1.1 jakllsch * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 jakllsch * notice, this list of conditions and the following disclaimer in the
14 1.1 jakllsch * documentation and/or other materials provided with the distribution.
15 1.1 jakllsch *
16 1.1 jakllsch * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 1.1 jakllsch * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 1.1 jakllsch * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 1.1 jakllsch * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 1.1 jakllsch * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 1.1 jakllsch * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 1.1 jakllsch * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 1.1 jakllsch * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 1.1 jakllsch * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 1.1 jakllsch * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 1.1 jakllsch * SUCH DAMAGE.
27 1.1 jakllsch */
28 1.1 jakllsch
29 1.1 jakllsch #ifndef _DEV_IC_ANXDP_H
30 1.1 jakllsch #define _DEV_IC_ANXDP_H
31 1.1 jakllsch
32 1.1 jakllsch #if ANXDP_AUDIO
33 1.1 jakllsch #include <dev/audio/audio_dai.h>
34 1.1 jakllsch #endif
35 1.1 jakllsch
36 1.3 riastrad #include <drm/drm_bridge.h>
37 1.3 riastrad #include <drm/drm_connector.h>
38 1.1 jakllsch #include <drm/drm_dp_helper.h>
39 1.4 riastrad #include <drm/drm_drv.h>
40 1.1 jakllsch #include <drm/drm_panel.h>
41 1.3 riastrad #include <drm/drm_probe_helper.h>
42 1.1 jakllsch
43 1.1 jakllsch struct anxdp_softc;
44 1.1 jakllsch
45 1.1 jakllsch struct anxdp_connector {
46 1.1 jakllsch struct drm_connector base;
47 1.1 jakllsch struct anxdp_softc *sc;
48 1.1 jakllsch #if ANXDP_AUDIO
49 1.1 jakllsch
50 1.1 jakllsch bool monitor_audio;
51 1.1 jakllsch #endif
52 1.1 jakllsch };
53 1.1 jakllsch
54 1.1 jakllsch struct anxdp_softc {
55 1.1 jakllsch device_t sc_dev;
56 1.1 jakllsch bus_space_tag_t sc_bst;
57 1.1 jakllsch bus_space_handle_t sc_bsh;
58 1.1 jakllsch u_int sc_flags;
59 1.1 jakllsch #define ANXDP_FLAG_ROCKCHIP __BIT(0)
60 1.1 jakllsch
61 1.1 jakllsch #if ANXDP_AUDIO
62 1.1 jakllsch struct audio_dai_device sc_dai;
63 1.1 jakllsch uint8_t sc_swvol;
64 1.1 jakllsch
65 1.1 jakllsch #endif
66 1.1 jakllsch struct anxdp_connector sc_connector;
67 1.1 jakllsch struct drm_bridge sc_bridge;
68 1.1 jakllsch struct drm_dp_aux sc_dpaux;
69 1.1 jakllsch struct drm_panel * sc_panel;
70 1.1 jakllsch uint8_t sc_dpcd[DP_RECEIVER_CAP_SIZE];
71 1.1 jakllsch
72 1.1 jakllsch struct drm_display_mode sc_curmode;
73 1.1 jakllsch };
74 1.1 jakllsch
75 1.1 jakllsch #define to_anxdp_connector(x) container_of(x, struct anxdp_connector, base)
76 1.1 jakllsch
77 1.1 jakllsch int anxdp_attach(struct anxdp_softc *);
78 1.1 jakllsch int anxdp_bind(struct anxdp_softc *, struct drm_encoder *);
79 1.1 jakllsch
80 1.2 jmcneill void anxdp_dpms(struct anxdp_softc *, int);
81 1.2 jmcneill
82 1.1 jakllsch #endif /* !_DEV_IC_ANXDP_H */
83