anx_dp.h revision 1.2 1 1.2 jmcneill /* $NetBSD: anx_dp.h,v 1.2 2020/01/04 12:08:32 jmcneill 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.1 jakllsch #include <drm/drmP.h>
37 1.1 jakllsch #include <drm/drm_dp_helper.h>
38 1.1 jakllsch #include <drm/drm_panel.h>
39 1.1 jakllsch
40 1.1 jakllsch struct anxdp_softc;
41 1.1 jakllsch
42 1.1 jakllsch struct anxdp_connector {
43 1.1 jakllsch struct drm_connector base;
44 1.1 jakllsch struct anxdp_softc *sc;
45 1.1 jakllsch #if ANXDP_AUDIO
46 1.1 jakllsch
47 1.1 jakllsch bool monitor_audio;
48 1.1 jakllsch #endif
49 1.1 jakllsch };
50 1.1 jakllsch
51 1.1 jakllsch struct anxdp_softc {
52 1.1 jakllsch device_t sc_dev;
53 1.1 jakllsch bus_space_tag_t sc_bst;
54 1.1 jakllsch bus_space_handle_t sc_bsh;
55 1.1 jakllsch u_int sc_flags;
56 1.1 jakllsch #define ANXDP_FLAG_ROCKCHIP __BIT(0)
57 1.1 jakllsch
58 1.1 jakllsch #if ANXDP_AUDIO
59 1.1 jakllsch struct audio_dai_device sc_dai;
60 1.1 jakllsch uint8_t sc_swvol;
61 1.1 jakllsch
62 1.1 jakllsch #endif
63 1.1 jakllsch struct anxdp_connector sc_connector;
64 1.1 jakllsch struct drm_bridge sc_bridge;
65 1.1 jakllsch struct drm_dp_aux sc_dpaux;
66 1.1 jakllsch struct drm_panel * sc_panel;
67 1.1 jakllsch uint8_t sc_dpcd[DP_RECEIVER_CAP_SIZE];
68 1.1 jakllsch
69 1.1 jakllsch struct drm_display_mode sc_curmode;
70 1.1 jakllsch };
71 1.1 jakllsch
72 1.1 jakllsch #define to_anxdp_connector(x) container_of(x, struct anxdp_connector, base)
73 1.1 jakllsch
74 1.1 jakllsch int anxdp_attach(struct anxdp_softc *);
75 1.1 jakllsch int anxdp_bind(struct anxdp_softc *, struct drm_encoder *);
76 1.1 jakllsch
77 1.2 jmcneill void anxdp_dpms(struct anxdp_softc *, int);
78 1.2 jmcneill
79 1.1 jakllsch #endif /* !_DEV_IC_ANXDP_H */
80