Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / drivers / gpu / drm / nouveau / nvkm / engine / disp / hdmigf119.c
blob6cac0e72b4cc61b84364dc9b5a81cd542dfb55a2
1 /*
2 * Copyright 2012 Red Hat Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
22 * Authors: Ben Skeggs
24 #include "hdmi.h"
26 void
27 gf119_hdmi_ctrl(struct nvkm_ior *ior, int head, bool enable, u8 max_ac_packet,
28 u8 rekey, u8 *avi, u8 avi_size, u8 *vendor, u8 vendor_size)
30 struct nvkm_device *device = ior->disp->engine.subdev.device;
31 const u32 ctrl = 0x40000000 * enable |
32 max_ac_packet << 16 |
33 rekey;
34 const u32 hoff = head * 0x800;
35 struct packed_hdmi_infoframe avi_infoframe;
36 struct packed_hdmi_infoframe vendor_infoframe;
38 pack_hdmi_infoframe(&avi_infoframe, avi, avi_size);
39 pack_hdmi_infoframe(&vendor_infoframe, vendor, vendor_size);
41 if (!(ctrl & 0x40000000)) {
42 nvkm_mask(device, 0x616798 + hoff, 0x40000000, 0x00000000);
43 nvkm_mask(device, 0x616730 + hoff, 0x00000001, 0x00000000);
44 nvkm_mask(device, 0x6167a4 + hoff, 0x00000001, 0x00000000);
45 nvkm_mask(device, 0x616714 + hoff, 0x00000001, 0x00000000);
46 return;
49 /* AVI InfoFrame */
50 nvkm_mask(device, 0x616714 + hoff, 0x00000001, 0x00000000);
51 if (avi_size) {
52 nvkm_wr32(device, 0x61671c + hoff, avi_infoframe.header);
53 nvkm_wr32(device, 0x616720 + hoff, avi_infoframe.subpack0_low);
54 nvkm_wr32(device, 0x616724 + hoff, avi_infoframe.subpack0_high);
55 nvkm_wr32(device, 0x616728 + hoff, avi_infoframe.subpack1_low);
56 nvkm_wr32(device, 0x61672c + hoff, avi_infoframe.subpack1_high);
57 nvkm_mask(device, 0x616714 + hoff, 0x00000001, 0x00000001);
60 /* GENERIC(?) / Vendor InfoFrame? */
61 nvkm_mask(device, 0x616730 + hoff, 0x00010001, 0x00010000);
62 if (vendor_size) {
64 * These appear to be the audio infoframe registers,
65 * but no other set of infoframe registers has yet
66 * been found.
68 nvkm_wr32(device, 0x616738 + hoff, vendor_infoframe.header);
69 nvkm_wr32(device, 0x61673c + hoff, vendor_infoframe.subpack0_low);
70 nvkm_wr32(device, 0x616740 + hoff, vendor_infoframe.subpack0_high);
71 /* Is there a second (or further?) set of subpack registers here? */
72 nvkm_mask(device, 0x616730 + hoff, 0x00000001, 0x00000001);
75 /* ??? InfoFrame? */
76 nvkm_mask(device, 0x6167a4 + hoff, 0x00000001, 0x00000000);
77 nvkm_wr32(device, 0x6167ac + hoff, 0x00000010);
78 nvkm_mask(device, 0x6167a4 + hoff, 0x00000001, 0x00000001);
80 /* HDMI_CTRL */
81 nvkm_mask(device, 0x616798 + hoff, 0x401f007f, ctrl);