drm/nouveau/kms/nv50-: convert core head_view() to new push macros
[linux-2.6-microblaze.git] / drivers / gpu / drm / nouveau / dispnv50 / head907d.c
index 3002ec2..6682a67 100644 (file)
  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  * OTHER DEALINGS IN THE SOFTWARE.
  */
+#include <drm/drm_connector.h>
+#include <drm/drm_mode_config.h>
+#include <drm/drm_vblank.h>
+#include "nouveau_drv.h"
+#include "nouveau_bios.h"
+#include "nouveau_connector.h"
 #include "head.h"
 #include "core.h"
+#include "crc.h"
+
+#include <nvif/push507c.h>
 
 void
 head907d_or(struct nv50_head *head, struct nv50_head_atom *asyh)
@@ -29,9 +38,10 @@ head907d_or(struct nv50_head *head, struct nv50_head_atom *asyh)
        u32 *push;
        if ((push = evo_wait(core, 3))) {
                evo_mthd(push, 0x0404 + (head->base.index * 0x300), 2);
-               evo_data(push, 0x00000001 | asyh->or.depth  << 6 |
-                                           asyh->or.nvsync << 4 |
-                                           asyh->or.nhsync << 3);
+               evo_data(push, asyh->or.depth  << 6 |
+                              asyh->or.nvsync << 4 |
+                              asyh->or.nhsync << 3 |
+                              asyh->or.crc_raster);
                evo_data(push, 0x31ec6000 | head->base.index << 25 |
                                            asyh->mode.interlace);
                evo_kick(push, core);
@@ -266,22 +276,22 @@ head907d_mode(struct nv50_head *head, struct nv50_head_atom *asyh)
        }
 }
 
-void
+int
 head907d_view(struct nv50_head *head, struct nv50_head_atom *asyh)
 {
-       struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
-       u32 *push;
-       if ((push = evo_wait(core, 8))) {
-               evo_mthd(push, 0x0494 + (head->base.index * 0x300), 1);
-               evo_data(push, 0x00000000);
-               evo_mthd(push, 0x04b8 + (head->base.index * 0x300), 1);
-               evo_data(push, asyh->view.iH << 16 | asyh->view.iW);
-               evo_mthd(push, 0x04c0 + (head->base.index * 0x300), 3);
-               evo_data(push, asyh->view.oH << 16 | asyh->view.oW);
-               evo_data(push, asyh->view.oH << 16 | asyh->view.oW);
-               evo_data(push, asyh->view.oH << 16 | asyh->view.oW);
-               evo_kick(push, core);
-       }
+       struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push;
+       const int i = head->base.index;
+       int ret;
+
+       if ((ret = PUSH_WAIT(push, 8)))
+               return ret;
+
+       PUSH_NVSQ(push, NV907D, 0x0494 + (i * 0x300), 0x00000000);
+       PUSH_NVSQ(push, NV907D, 0x04b8 + (i * 0x300), asyh->view.iH << 16 | asyh->view.iW);
+       PUSH_NVSQ(push, NV907D, 0x04c0 + (i * 0x300), asyh->view.oH << 16 | asyh->view.oW,
+                               0x04c4 + (i * 0x300), asyh->view.oH << 16 | asyh->view.oW,
+                               0x04c8 + (i * 0x300), asyh->view.oH << 16 | asyh->view.oW);
+       return 0;
 }
 
 const struct nv50_head_func