These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / gpu / drm / nouveau / dispnv04 / dac.c
index af7249c..78cb033 100644 (file)
@@ -65,8 +65,8 @@ int nv04_dac_output_offset(struct drm_encoder *encoder)
 
 static int sample_load_twice(struct drm_device *dev, bool sense[2])
 {
-       struct nvif_device *device = &nouveau_drm(dev)->device;
-       struct nvkm_timer *ptimer = nvxx_timer(device);
+       struct nouveau_drm *drm = nouveau_drm(dev);
+       struct nvif_object *device = &drm->device.object;
        int i;
 
        for (i = 0; i < 2; i++) {
@@ -80,17 +80,22 @@ static int sample_load_twice(struct drm_device *dev, bool sense[2])
                 * use a 10ms timeout (guards against crtc being inactive, in
                 * which case blank state would never change)
                 */
-               if (!nvkm_timer_wait_eq(ptimer, 10000000,
-                                       NV_PRMCIO_INP0__COLOR,
-                                       0x00000001, 0x00000000))
+               if (nvif_msec(&drm->device, 10,
+                       if (!(nvif_rd32(device, NV_PRMCIO_INP0__COLOR) & 1))
+                               break;
+               ) < 0)
                        return -EBUSY;
-               if (!nvkm_timer_wait_eq(ptimer, 10000000,
-                                       NV_PRMCIO_INP0__COLOR,
-                                       0x00000001, 0x00000001))
+
+               if (nvif_msec(&drm->device, 10,
+                       if ( (nvif_rd32(device, NV_PRMCIO_INP0__COLOR) & 1))
+                               break;
+               ) < 0)
                        return -EBUSY;
-               if (!nvkm_timer_wait_eq(ptimer, 10000000,
-                                       NV_PRMCIO_INP0__COLOR,
-                                       0x00000001, 0x00000000))
+
+               if (nvif_msec(&drm->device, 10,
+                       if (!(nvif_rd32(device, NV_PRMCIO_INP0__COLOR) & 1))
+                               break;
+               ) < 0)
                        return -EBUSY;
 
                udelay(100);
@@ -128,7 +133,7 @@ static enum drm_connector_status nv04_dac_detect(struct drm_encoder *encoder,
                                                 struct drm_connector *connector)
 {
        struct drm_device *dev = encoder->dev;
-       struct nvif_device *device = &nouveau_drm(dev)->device;
+       struct nvif_object *device = &nouveau_drm(dev)->device.object;
        struct nouveau_drm *drm = nouveau_drm(dev);
        uint8_t saved_seq1, saved_pi, saved_rpc1, saved_cr_mode;
        uint8_t saved_palette0[3], saved_palette_mask;
@@ -231,8 +236,8 @@ uint32_t nv17_dac_sample_load(struct drm_encoder *encoder)
 {
        struct drm_device *dev = encoder->dev;
        struct nouveau_drm *drm = nouveau_drm(dev);
-       struct nvif_device *device = &nouveau_drm(dev)->device;
-       struct nvkm_gpio *gpio = nvxx_gpio(device);
+       struct nvif_object *device = &nouveau_drm(dev)->device.object;
+       struct nvkm_gpio *gpio = nvxx_gpio(&drm->device);
        struct dcb_output *dcb = nouveau_encoder(encoder)->dcb;
        uint32_t sample, testval, regoffset = nv04_dac_output_offset(encoder);
        uint32_t saved_powerctrl_2 = 0, saved_powerctrl_4 = 0, saved_routput,
@@ -265,10 +270,10 @@ uint32_t nv17_dac_sample_load(struct drm_encoder *encoder)
        }
 
        if (gpio) {
-               saved_gpio1 = gpio->get(gpio, 0, DCB_GPIO_TVDAC1, 0xff);
-               saved_gpio0 = gpio->get(gpio, 0, DCB_GPIO_TVDAC0, 0xff);
-               gpio->set(gpio, 0, DCB_GPIO_TVDAC1, 0xff, dcb->type == DCB_OUTPUT_TV);
-               gpio->set(gpio, 0, DCB_GPIO_TVDAC0, 0xff, dcb->type == DCB_OUTPUT_TV);
+               saved_gpio1 = nvkm_gpio_get(gpio, 0, DCB_GPIO_TVDAC1, 0xff);
+               saved_gpio0 = nvkm_gpio_get(gpio, 0, DCB_GPIO_TVDAC0, 0xff);
+               nvkm_gpio_set(gpio, 0, DCB_GPIO_TVDAC1, 0xff, dcb->type == DCB_OUTPUT_TV);
+               nvkm_gpio_set(gpio, 0, DCB_GPIO_TVDAC0, 0xff, dcb->type == DCB_OUTPUT_TV);
        }
 
        msleep(4);
@@ -320,8 +325,8 @@ uint32_t nv17_dac_sample_load(struct drm_encoder *encoder)
        nvif_wr32(device, NV_PBUS_POWERCTRL_2, saved_powerctrl_2);
 
        if (gpio) {
-               gpio->set(gpio, 0, DCB_GPIO_TVDAC1, 0xff, saved_gpio1);
-               gpio->set(gpio, 0, DCB_GPIO_TVDAC0, 0xff, saved_gpio0);
+               nvkm_gpio_set(gpio, 0, DCB_GPIO_TVDAC1, 0xff, saved_gpio1);
+               nvkm_gpio_set(gpio, 0, DCB_GPIO_TVDAC0, 0xff, saved_gpio0);
        }
 
        return sample;