1facaed62SBen Skeggs /*
2facaed62SBen Skeggs * Copyright 2018 Red Hat Inc.
3facaed62SBen Skeggs *
4facaed62SBen Skeggs * Permission is hereby granted, free of charge, to any person obtaining a
5facaed62SBen Skeggs * copy of this software and associated documentation files (the "Software"),
6facaed62SBen Skeggs * to deal in the Software without restriction, including without limitation
7facaed62SBen Skeggs * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8facaed62SBen Skeggs * and/or sell copies of the Software, and to permit persons to whom the
9facaed62SBen Skeggs * Software is furnished to do so, subject to the following conditions:
10facaed62SBen Skeggs *
11facaed62SBen Skeggs * The above copyright notice and this permission notice shall be included in
12facaed62SBen Skeggs * all copies or substantial portions of the Software.
13facaed62SBen Skeggs *
14facaed62SBen Skeggs * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15facaed62SBen Skeggs * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16facaed62SBen Skeggs * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17facaed62SBen Skeggs * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18facaed62SBen Skeggs * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19facaed62SBen Skeggs * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20facaed62SBen Skeggs * OTHER DEALINGS IN THE SOFTWARE.
21facaed62SBen Skeggs */
22facaed62SBen Skeggs #include "core.h"
23facaed62SBen Skeggs
24*344c2e5aSBen Skeggs #include <nvif/pushc37b.h>
25*344c2e5aSBen Skeggs
26*344c2e5aSBen Skeggs #include <nvhw/class/clc37d.h>
279ec5e820SBen Skeggs
289ec5e820SBen Skeggs static int
sorc37d_ctrl(struct nv50_core * core,int or,u32 ctrl,struct nv50_head_atom * asyh)29facaed62SBen Skeggs sorc37d_ctrl(struct nv50_core *core, int or, u32 ctrl,
30facaed62SBen Skeggs struct nv50_head_atom *asyh)
31facaed62SBen Skeggs {
329ec5e820SBen Skeggs struct nvif_push *push = core->chan.push;
339ec5e820SBen Skeggs int ret;
349ec5e820SBen Skeggs
359ec5e820SBen Skeggs if ((ret = PUSH_WAIT(push, 2)))
369ec5e820SBen Skeggs return ret;
379ec5e820SBen Skeggs
38*344c2e5aSBen Skeggs PUSH_MTHD(push, NVC37D, SOR_SET_CONTROL(or), ctrl);
399ec5e820SBen Skeggs return 0;
40facaed62SBen Skeggs }
41facaed62SBen Skeggs
424a2cb418SLyude Paul static void
sorc37d_get_caps(struct nv50_disp * disp,struct nouveau_encoder * outp,int or)434a2cb418SLyude Paul sorc37d_get_caps(struct nv50_disp *disp, struct nouveau_encoder *outp, int or)
444a2cb418SLyude Paul {
454a2cb418SLyude Paul u32 tmp = nvif_rd32(&disp->caps, 0x000144 + (or * 8));
464a2cb418SLyude Paul
474a2cb418SLyude Paul outp->caps.dp_interlace = !!(tmp & 0x04000000);
484a2cb418SLyude Paul }
494a2cb418SLyude Paul
50facaed62SBen Skeggs const struct nv50_outp_func
51facaed62SBen Skeggs sorc37d = {
52facaed62SBen Skeggs .ctrl = sorc37d_ctrl,
534a2cb418SLyude Paul .get_caps = sorc37d_get_caps,
54facaed62SBen Skeggs };
55