1/* $NetBSD: nouveau_nvkm_engine_disp_sorgt215.c,v 1.2 2021/12/18 23:45:35 riastradh Exp $ */ 2 3/* 4 * Copyright 2017 Red Hat Inc. 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a 7 * copy of this software and associated documentation files (the "Software"), 8 * to deal in the Software without restriction, including without limitation 9 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 * and/or sell copies of the Software, and to permit persons to whom the 11 * Software is furnished to do so, subject to the following conditions: 12 * 13 * The above copyright notice and this permission notice shall be included in 14 * all copies or substantial portions of the Software. 15 * 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 * OTHER DEALINGS IN THE SOFTWARE. 23 */ 24#include <sys/cdefs.h> 25__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_engine_disp_sorgt215.c,v 1.2 2021/12/18 23:45:35 riastradh Exp $"); 26 27#include "ior.h" 28 29#include <subdev/timer.h> 30 31void 32gt215_sor_dp_audio(struct nvkm_ior *sor, int head, bool enable) 33{ 34 struct nvkm_device *device = sor->disp->engine.subdev.device; 35 const u32 soff = nv50_ior_base(sor); 36 const u32 data = 0x80000000 | (0x00000001 * enable); 37 const u32 mask = 0x8000000d; 38 nvkm_mask(device, 0x61c1e0 + soff, mask, data); 39 nvkm_msec(device, 2000, 40 if (!(nvkm_rd32(device, 0x61c1e0 + soff) & 0x80000000)) 41 break; 42 ); 43} 44 45static const struct nvkm_ior_func 46gt215_sor = { 47 .state = g94_sor_state, 48 .power = nv50_sor_power, 49 .clock = nv50_sor_clock, 50 .hdmi = { 51 .ctrl = gt215_hdmi_ctrl, 52 }, 53 .dp = { 54 .lanes = { 2, 1, 0, 3 }, 55 .links = g94_sor_dp_links, 56 .power = g94_sor_dp_power, 57 .pattern = g94_sor_dp_pattern, 58 .drive = g94_sor_dp_drive, 59 .audio = gt215_sor_dp_audio, 60 .audio_sym = g94_sor_dp_audio_sym, 61 .activesym = g94_sor_dp_activesym, 62 .watermark = g94_sor_dp_watermark, 63 }, 64 .hda = { 65 .hpd = gt215_hda_hpd, 66 .eld = gt215_hda_eld, 67 }, 68}; 69 70int 71gt215_sor_new(struct nvkm_disp *disp, int id) 72{ 73 return nvkm_ior_new_(>215_sor, disp, SOR, id); 74} 75