linux/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgt215.c
<<
>>
Prefs
   1/*
   2 * Copyright 2017 Red Hat Inc.
   3 *
   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:
  10 *
  11 * The above copyright notice and this permission notice shall be included in
  12 * all copies or substantial portions of the Software.
  13 *
  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.
  21 */
  22#include "ior.h"
  23
  24#include <subdev/timer.h>
  25
  26void
  27gt215_sor_dp_audio(struct nvkm_ior *sor, int head, bool enable)
  28{
  29        struct nvkm_device *device = sor->disp->engine.subdev.device;
  30        const u32 soff = nv50_ior_base(sor);
  31        const u32 data = 0x80000000 | (0x00000001 * enable);
  32        const u32 mask = 0x8000000d;
  33        nvkm_mask(device, 0x61c1e0 + soff, mask, data);
  34        nvkm_msec(device, 2000,
  35                if (!(nvkm_rd32(device, 0x61c1e0 + soff) & 0x80000000))
  36                        break;
  37        );
  38}
  39
  40static const struct nvkm_ior_func
  41gt215_sor = {
  42        .state = g94_sor_state,
  43        .power = nv50_sor_power,
  44        .clock = nv50_sor_clock,
  45        .hdmi = {
  46                .ctrl = gt215_hdmi_ctrl,
  47        },
  48        .dp = {
  49                .lanes = { 2, 1, 0, 3 },
  50                .links = g94_sor_dp_links,
  51                .power = g94_sor_dp_power,
  52                .pattern = g94_sor_dp_pattern,
  53                .drive = g94_sor_dp_drive,
  54                .audio = gt215_sor_dp_audio,
  55                .audio_sym = g94_sor_dp_audio_sym,
  56                .activesym = g94_sor_dp_activesym,
  57                .watermark = g94_sor_dp_watermark,
  58        },
  59        .hda = {
  60                .hpd = gt215_hda_hpd,
  61                .eld = gt215_hda_eld,
  62        },
  63};
  64
  65int
  66gt215_sor_new(struct nvkm_disp *disp, int id)
  67{
  68        return nvkm_ior_new_(&gt215_sor, disp, SOR, id);
  69}
  70