Lines Matching refs:hwsq
37 hwsq_cmd(struct nvkm_hwsq *hwsq, int size, u8 data[]) in hwsq_cmd() argument
39 memcpy(&hwsq->c.data[hwsq->c.size], data, size * sizeof(data[0])); in hwsq_cmd()
40 hwsq->c.size += size; in hwsq_cmd()
46 struct nvkm_hwsq *hwsq; in nvkm_hwsq_init() local
48 hwsq = *phwsq = kmalloc(sizeof(*hwsq), GFP_KERNEL); in nvkm_hwsq_init()
49 if (hwsq) { in nvkm_hwsq_init()
50 hwsq->subdev = subdev; in nvkm_hwsq_init()
51 hwsq->addr = ~0; in nvkm_hwsq_init()
52 hwsq->data = ~0; in nvkm_hwsq_init()
53 memset(hwsq->c.data, 0x7f, sizeof(hwsq->c.data)); in nvkm_hwsq_init()
54 hwsq->c.size = 0; in nvkm_hwsq_init()
57 return hwsq ? 0 : -ENOMEM; in nvkm_hwsq_init()
63 struct nvkm_hwsq *hwsq = *phwsq; in nvkm_hwsq_fini() local
65 if (hwsq) { in nvkm_hwsq_fini()
66 struct nvkm_subdev *subdev = hwsq->subdev; in nvkm_hwsq_fini()
68 hwsq->c.size = (hwsq->c.size + 4) / 4; in nvkm_hwsq_fini()
69 if (hwsq->c.size <= bus->func->hwsq_size) { in nvkm_hwsq_fini()
72 (u32 *)hwsq->c.data, in nvkm_hwsq_fini()
73 hwsq->c.size); in nvkm_hwsq_fini()
81 for (i = 0; ret && i < hwsq->c.size; i++) in nvkm_hwsq_fini()
82 nvkm_error(subdev, "\t%08x\n", ((u32 *)hwsq->c.data)[i]); in nvkm_hwsq_fini()
85 kfree(hwsq); in nvkm_hwsq_fini()
91 nvkm_hwsq_wr32(struct nvkm_hwsq *hwsq, u32 addr, u32 data) in nvkm_hwsq_wr32() argument
93 nvkm_debug(hwsq->subdev, "R[%06x] = %08x\n", addr, data); in nvkm_hwsq_wr32()
95 if (hwsq->data != data) { in nvkm_hwsq_wr32()
96 if ((data & 0xffff0000) != (hwsq->data & 0xffff0000)) { in nvkm_hwsq_wr32()
97 hwsq_cmd(hwsq, 5, (u8[]){ 0xe2, data, data >> 8, in nvkm_hwsq_wr32()
100 hwsq_cmd(hwsq, 3, (u8[]){ 0x42, data, data >> 8 }); in nvkm_hwsq_wr32()
104 if ((addr & 0xffff0000) != (hwsq->addr & 0xffff0000)) { in nvkm_hwsq_wr32()
105 hwsq_cmd(hwsq, 5, (u8[]){ 0xe0, addr, addr >> 8, in nvkm_hwsq_wr32()
108 hwsq_cmd(hwsq, 3, (u8[]){ 0x40, addr, addr >> 8 }); in nvkm_hwsq_wr32()
111 hwsq->addr = addr; in nvkm_hwsq_wr32()
112 hwsq->data = data; in nvkm_hwsq_wr32()
116 nvkm_hwsq_setf(struct nvkm_hwsq *hwsq, u8 flag, int data) in nvkm_hwsq_setf() argument
118 nvkm_debug(hwsq->subdev, " FLAG[%02x] = %d\n", flag, data); in nvkm_hwsq_setf()
124 hwsq_cmd(hwsq, 1, (u8[]){ flag }); in nvkm_hwsq_setf()
128 nvkm_hwsq_wait(struct nvkm_hwsq *hwsq, u8 flag, u8 data) in nvkm_hwsq_wait() argument
130 nvkm_debug(hwsq->subdev, " WAIT[%02x] = %d\n", flag, data); in nvkm_hwsq_wait()
131 hwsq_cmd(hwsq, 3, (u8[]){ 0x5f, flag, data }); in nvkm_hwsq_wait()
135 nvkm_hwsq_wait_vblank(struct nvkm_hwsq *hwsq) in nvkm_hwsq_wait_vblank() argument
137 struct nvkm_subdev *subdev = hwsq->subdev; in nvkm_hwsq_wait_vblank()
162 nvkm_hwsq_wait(hwsq, head_sync ? 0x3 : 0x1, 0x0); in nvkm_hwsq_wait_vblank()
163 nvkm_hwsq_wait(hwsq, head_sync ? 0x3 : 0x1, 0x1); in nvkm_hwsq_wait_vblank()
167 nvkm_hwsq_nsec(struct nvkm_hwsq *hwsq, u32 nsec) in nvkm_hwsq_nsec() argument
175 nvkm_debug(hwsq->subdev, " DELAY = %d ns\n", nsec); in nvkm_hwsq_nsec()
176 hwsq_cmd(hwsq, 1, (u8[]){ 0x00 | (shift << 2) | usec }); in nvkm_hwsq_nsec()