Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright 2021 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 <nvif/outp.h>
0023 #include <nvif/disp.h>
0024 #include <nvif/printf.h>
0025 
0026 #include <nvif/class.h>
0027 #include <nvif/if0012.h>
0028 
0029 int
0030 nvif_outp_load_detect(struct nvif_outp *outp, u32 loadval)
0031 {
0032     struct nvif_outp_load_detect_v0 args;
0033     int ret;
0034 
0035     args.version = 0;
0036     args.data = loadval;
0037 
0038     ret = nvif_mthd(&outp->object, NVIF_OUTP_V0_LOAD_DETECT, &args, sizeof(args));
0039     NVIF_ERRON(ret, &outp->object, "[LOAD_DETECT data:%08x] load:%02x", args.data, args.load);
0040     return ret < 0 ? ret : args.load;
0041 }
0042 
0043 void
0044 nvif_outp_dtor(struct nvif_outp *outp)
0045 {
0046     nvif_object_dtor(&outp->object);
0047 }
0048 
0049 int
0050 nvif_outp_ctor(struct nvif_disp *disp, const char *name, int id, struct nvif_outp *outp)
0051 {
0052     struct nvif_outp_v0 args;
0053     int ret;
0054 
0055     args.version = 0;
0056     args.id = id;
0057 
0058     ret = nvif_object_ctor(&disp->object, name ?: "nvifOutp", id, NVIF_CLASS_OUTP,
0059                    &args, sizeof(args), &outp->object);
0060     NVIF_ERRON(ret, &disp->object, "[NEW outp id:%d]", id);
0061     return ret;
0062 }