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