11590700dSBen Skeggs /*
21590700dSBen Skeggs * Copyright 2018 Red Hat Inc.
31590700dSBen Skeggs *
41590700dSBen Skeggs * Permission is hereby granted, free of charge, to any person obtaining a
51590700dSBen Skeggs * copy of this software and associated documentation files (the "Software"),
61590700dSBen Skeggs * to deal in the Software without restriction, including without limitation
71590700dSBen Skeggs * the rights to use, copy, modify, merge, publish, distribute, sublicense,
81590700dSBen Skeggs * and/or sell copies of the Software, and to permit persons to whom the
91590700dSBen Skeggs * Software is furnished to do so, subject to the following conditions:
101590700dSBen Skeggs *
111590700dSBen Skeggs * The above copyright notice and this permission notice shall be included in
121590700dSBen Skeggs * all copies or substantial portions of the Software.
131590700dSBen Skeggs *
141590700dSBen Skeggs * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
151590700dSBen Skeggs * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
161590700dSBen Skeggs * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
171590700dSBen Skeggs * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
181590700dSBen Skeggs * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
191590700dSBen Skeggs * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
201590700dSBen Skeggs * OTHER DEALINGS IN THE SOFTWARE.
211590700dSBen Skeggs */
221590700dSBen Skeggs #include "core.h"
231590700dSBen Skeggs
249ec5e820SBen Skeggs #include <nvif/push507c.h>
259ec5e820SBen Skeggs
26*344c2e5aSBen Skeggs #include <nvhw/class/cl507d.h>
27*344c2e5aSBen Skeggs #include <nvhw/class/cl837d.h>
28*344c2e5aSBen Skeggs
299ec5e820SBen Skeggs static int
sor507d_ctrl(struct nv50_core * core,int or,u32 ctrl,struct nv50_head_atom * asyh)301590700dSBen Skeggs sor507d_ctrl(struct nv50_core *core, int or, u32 ctrl,
311590700dSBen Skeggs struct nv50_head_atom *asyh)
321590700dSBen Skeggs {
339ec5e820SBen Skeggs struct nvif_push *push = core->chan.push;
349ec5e820SBen Skeggs int ret;
359ec5e820SBen Skeggs
361590700dSBen Skeggs if (asyh) {
37*344c2e5aSBen Skeggs ctrl |= NVVAL(NV507D, SOR_SET_CONTROL, HSYNC_POLARITY, asyh->or.nhsync);
38*344c2e5aSBen Skeggs ctrl |= NVVAL(NV507D, SOR_SET_CONTROL, VSYNC_POLARITY, asyh->or.nvsync);
39*344c2e5aSBen Skeggs ctrl |= NVVAL(NV837D, SOR_SET_CONTROL, PIXEL_DEPTH, asyh->or.depth);
401590700dSBen Skeggs }
419ec5e820SBen Skeggs
429ec5e820SBen Skeggs if ((ret = PUSH_WAIT(push, 2)))
439ec5e820SBen Skeggs return ret;
449ec5e820SBen Skeggs
45*344c2e5aSBen Skeggs PUSH_MTHD(push, NV507D, SOR_SET_CONTROL(or), ctrl);
469ec5e820SBen Skeggs return 0;
471590700dSBen Skeggs }
481590700dSBen Skeggs
494a2cb418SLyude Paul static void
sor507d_get_caps(struct nv50_disp * core,struct nouveau_encoder * outp,int or)504a2cb418SLyude Paul sor507d_get_caps(struct nv50_disp *core, struct nouveau_encoder *outp, int or)
514a2cb418SLyude Paul {
524a2cb418SLyude Paul outp->caps.dp_interlace = true;
534a2cb418SLyude Paul }
544a2cb418SLyude Paul
551590700dSBen Skeggs const struct nv50_outp_func
561590700dSBen Skeggs sor507d = {
571590700dSBen Skeggs .ctrl = sor507d_ctrl,
584a2cb418SLyude Paul .get_caps = sor507d_get_caps,
591590700dSBen Skeggs };
60