Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright 2018 Red Hat Inc.
0003  *
0004  * Permission is hereby granted, free of charge, to any person obtaining a
0005  * copy of this software and associated documentation files (the "Software"),
0006  * to deal in the Software without restriction, including without limitation
0007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
0008  * and/or sell copies of the Software, and to permit persons to whom the
0009  * Software is furnished to do so, subject to the following conditions:
0010  *
0011  * The above copyright notice and this permission notice shall be included in
0012  * all copies or substantial portions of the Software.
0013  *
0014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0015  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
0017  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
0018  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
0019  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
0020  * OTHER DEALINGS IN THE SOFTWARE.
0021  */
0022 #include "core.h"
0023 #include "head.h"
0024 
0025 #include <nvif/push507c.h>
0026 #include <nvif/timer.h>
0027 
0028 #include <nvhw/class/cl907d.h>
0029 
0030 #include "nouveau_bo.h"
0031 
0032 int
0033 core907d_caps_init(struct nouveau_drm *drm, struct nv50_disp *disp)
0034 {
0035     struct nv50_core *core = disp->core;
0036     struct nouveau_bo *bo = disp->sync;
0037     s64 time;
0038     int ret;
0039 
0040     NVBO_WR32(bo, NV50_DISP_CORE_NTFY, NV907D_CORE_NOTIFIER_3, CAPABILITIES_4,
0041                      NVDEF(NV907D_CORE_NOTIFIER_3, CAPABILITIES_4, DONE, FALSE));
0042 
0043     ret = core507d_read_caps(disp);
0044     if (ret < 0)
0045         return ret;
0046 
0047     time = nvif_msec(core->chan.base.device, 2000ULL,
0048              if (NVBO_TD32(bo, NV50_DISP_CORE_NTFY,
0049                        NV907D_CORE_NOTIFIER_3, CAPABILITIES_4, DONE, ==, TRUE))
0050                  break;
0051              usleep_range(1, 2);
0052              );
0053     if (time < 0)
0054         NV_ERROR(drm, "core caps notifier timeout\n");
0055 
0056     return 0;
0057 }
0058 
0059 static const struct nv50_core_func
0060 core907d = {
0061     .init = core507d_init,
0062     .ntfy_init = core507d_ntfy_init,
0063     .caps_init = core907d_caps_init,
0064     .ntfy_wait_done = core507d_ntfy_wait_done,
0065     .update = core507d_update,
0066     .head = &head907d,
0067 #if IS_ENABLED(CONFIG_DEBUG_FS)
0068     .crc = &crc907d,
0069 #endif
0070     .dac = &dac907d,
0071     .sor = &sor907d,
0072 };
0073 
0074 int
0075 core907d_new(struct nouveau_drm *drm, s32 oclass, struct nv50_core **pcore)
0076 {
0077     return core507d_new_(&core907d, drm, oclass, pcore);
0078 }