Ben Skeggs | 7a014a8 | 2014-05-16 14:36:15 +1000 | [diff] [blame] | 1 | #ifndef __NVKM_DISP_OUTP_H__ |
| 2 | #define __NVKM_DISP_OUTP_H__ |
Ben Skeggs | 878da15 | 2015-01-14 15:24:57 +1000 | [diff] [blame] | 3 | #include <core/object.h> |
Ben Skeggs | 7a014a8 | 2014-05-16 14:36:15 +1000 | [diff] [blame] | 4 | |
Ben Skeggs | 878da15 | 2015-01-14 15:24:57 +1000 | [diff] [blame] | 5 | #include <subdev/bios.h> |
| 6 | #include <subdev/bios/dcb.h> |
Ben Skeggs | 7a014a8 | 2014-05-16 14:36:15 +1000 | [diff] [blame] | 7 | |
| 8 | struct nvkm_output { |
Ben Skeggs | 878da15 | 2015-01-14 15:24:57 +1000 | [diff] [blame] | 9 | struct nvkm_object base; |
Ben Skeggs | 7a014a8 | 2014-05-16 14:36:15 +1000 | [diff] [blame] | 10 | struct list_head head; |
| 11 | |
| 12 | struct dcb_output info; |
| 13 | int index; |
Ben Skeggs | bf0eb89 | 2014-08-10 04:10:26 +1000 | [diff] [blame] | 14 | int or; |
Ben Skeggs | 7a014a8 | 2014-05-16 14:36:15 +1000 | [diff] [blame] | 15 | |
Ben Skeggs | 878da15 | 2015-01-14 15:24:57 +1000 | [diff] [blame] | 16 | struct nvkm_i2c_port *port; |
| 17 | struct nvkm_i2c_port *edid; |
Ben Skeggs | 7a014a8 | 2014-05-16 14:36:15 +1000 | [diff] [blame] | 18 | |
| 19 | struct nvkm_connector *conn; |
| 20 | }; |
| 21 | |
| 22 | #define nvkm_output_create(p,e,c,b,i,d) \ |
| 23 | nvkm_output_create_((p), (e), (c), (b), (i), sizeof(**d), (void **)d) |
| 24 | #define nvkm_output_destroy(d) ({ \ |
| 25 | struct nvkm_output *_outp = (d); \ |
| 26 | _nvkm_output_dtor(nv_object(_outp)); \ |
| 27 | }) |
| 28 | #define nvkm_output_init(d) ({ \ |
| 29 | struct nvkm_output *_outp = (d); \ |
| 30 | _nvkm_output_init(nv_object(_outp)); \ |
| 31 | }) |
| 32 | #define nvkm_output_fini(d,s) ({ \ |
| 33 | struct nvkm_output *_outp = (d); \ |
| 34 | _nvkm_output_fini(nv_object(_outp), (s)); \ |
| 35 | }) |
| 36 | |
Ben Skeggs | 878da15 | 2015-01-14 15:24:57 +1000 | [diff] [blame] | 37 | int nvkm_output_create_(struct nvkm_object *, struct nvkm_object *, |
| 38 | struct nvkm_oclass *, struct dcb_output *, |
Ben Skeggs | 7a014a8 | 2014-05-16 14:36:15 +1000 | [diff] [blame] | 39 | int, int, void **); |
| 40 | |
Ben Skeggs | 878da15 | 2015-01-14 15:24:57 +1000 | [diff] [blame] | 41 | int _nvkm_output_ctor(struct nvkm_object *, struct nvkm_object *, |
| 42 | struct nvkm_oclass *, void *, u32, |
| 43 | struct nvkm_object **); |
| 44 | void _nvkm_output_dtor(struct nvkm_object *); |
| 45 | int _nvkm_output_init(struct nvkm_object *); |
| 46 | int _nvkm_output_fini(struct nvkm_object *, bool); |
Ben Skeggs | 7a014a8 | 2014-05-16 14:36:15 +1000 | [diff] [blame] | 47 | |
| 48 | struct nvkm_output_impl { |
Ben Skeggs | 878da15 | 2015-01-14 15:24:57 +1000 | [diff] [blame] | 49 | struct nvkm_oclass base; |
Ben Skeggs | 7a014a8 | 2014-05-16 14:36:15 +1000 | [diff] [blame] | 50 | }; |
| 51 | |
| 52 | #ifndef MSG |
| 53 | #define MSG(l,f,a...) do { \ |
| 54 | struct nvkm_output *_outp = (void *)outp; \ |
Ben Skeggs | bdda470 | 2014-12-05 12:12:23 +1000 | [diff] [blame] | 55 | nv_##l(_outp, "%02x:%04x:%04x: "f, _outp->index, \ |
Ben Skeggs | 7a014a8 | 2014-05-16 14:36:15 +1000 | [diff] [blame] | 56 | _outp->info.hasht, _outp->info.hashm, ##a); \ |
| 57 | } while(0) |
| 58 | #define DBG(f,a...) MSG(debug, f, ##a) |
| 59 | #define ERR(f,a...) MSG(error, f, ##a) |
| 60 | #endif |
Ben Skeggs | 7a014a8 | 2014-05-16 14:36:15 +1000 | [diff] [blame] | 61 | #endif |