Message ID | 20200512084258.12673-13-tzimmermann@suse.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/mgag200: Convert to atomic modesetting | expand |
Hi Thomas, On Tue, 12 May 2020 at 09:43, Thomas Zimmermann <tzimmermann@suse.de> wrote: > > The suspend/resume helpers are unused. Also remove associated state > from struct mga_device. > Although DPMS in it's traditional sense is no longer a thing, would it make sense to keep this around for documentation purposes? In particular, the pci magic and associated PLL/DAC/pixel clock could be used for dynamic PM. -Emil
Hi Am 12.05.20 um 12:14 schrieb Emil Velikov: > Hi Thomas, > > On Tue, 12 May 2020 at 09:43, Thomas Zimmermann <tzimmermann@suse.de> wrote: >> >> The suspend/resume helpers are unused. Also remove associated state >> from struct mga_device. >> > Although DPMS in it's traditional sense is no longer a thing, would it > make sense to keep this around for documentation purposes? > In particular, the pci magic and associated PLL/DAC/pixel clock could > be used for dynamic PM. That patch is not about DPMS. The DPMS code is still there. The suspend/resume helpers were outcommented and I don't know if they ever worked. Let's remove them. Best regards Thomas > > -Emil >
On Tue, 12 May 2020 at 19:47, Thomas Zimmermann <tzimmermann@suse.de> wrote: > > Hi > > Am 12.05.20 um 12:14 schrieb Emil Velikov: > > Hi Thomas, > > > > On Tue, 12 May 2020 at 09:43, Thomas Zimmermann <tzimmermann@suse.de> wrote: > >> > >> The suspend/resume helpers are unused. Also remove associated state > >> from struct mga_device. > >> > > Although DPMS in it's traditional sense is no longer a thing, would it > > make sense to keep this around for documentation purposes? > > In particular, the pci magic and associated PLL/DAC/pixel clock could > > be used for dynamic PM. > > That patch is not about DPMS. The DPMS code is still there. The > suspend/resume helpers were outcommented and I don't know if they ever > worked. Let's remove them. > Seems like the idea is to suspend/resume the device on DPMS off/on. A rather moot point IMHO. As the DPMS semantics and the whole modeset, got more subtle with atomic modeset, the idea gets even more moot. If the documentation has that process - sure nuke it. Although for dynPM, this code is essential. Considering a) one has interest in dynPM and b) the code is (close to) working. The last two are very big ifs so I'll leave it there. -Emil
On Wed, May 13, 2020 at 10:15:25AM +0100, Emil Velikov wrote: > On Tue, 12 May 2020 at 19:47, Thomas Zimmermann <tzimmermann@suse.de> wrote: > > > > Hi > > > > Am 12.05.20 um 12:14 schrieb Emil Velikov: > > > Hi Thomas, > > > > > > On Tue, 12 May 2020 at 09:43, Thomas Zimmermann <tzimmermann@suse.de> wrote: > > >> > > >> The suspend/resume helpers are unused. Also remove associated state > > >> from struct mga_device. > > >> > > > Although DPMS in it's traditional sense is no longer a thing, would it > > > make sense to keep this around for documentation purposes? > > > In particular, the pci magic and associated PLL/DAC/pixel clock could > > > be used for dynamic PM. > > > > That patch is not about DPMS. The DPMS code is still there. The > > suspend/resume helpers were outcommented and I don't know if they ever > > worked. Let's remove them. > > > Seems like the idea is to suspend/resume the device on DPMS off/on. A > rather moot point IMHO. > As the DPMS semantics and the whole modeset, got more subtle with > atomic modeset, the idea gets even more moot. With atomic it's actually a lot easier to do runtime pm in your modesetting code, since the flow is a lot more structured. There's even a helper function for that with drm_atomic_helper_commit_tail_rpm, since the default is optimized for max compatability with old legacy helpers. Maybe we should switch that around actually. -Daniel > If the documentation has that process - sure nuke it. Although for > dynPM, this code is essential. > Considering a) one has interest in dynPM and b) the code is (close to) working. > > The last two are very big ifs so I'll leave it there. > > -Emil
diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.h b/drivers/gpu/drm/mgag200/mgag200_drv.h index cf71a4ec84158..0cf498d1e900c 100644 --- a/drivers/gpu/drm/mgag200/mgag200_drv.h +++ b/drivers/gpu/drm/mgag200/mgag200_drv.h @@ -164,7 +164,6 @@ struct mga_device { size_t vram_fb_available; - bool suspended; enum mga_type type; int has_sdram; diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c index 199ae08976e16..d6f9763a4a450 100644 --- a/drivers/gpu/drm/mgag200/mgag200_mode.c +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c @@ -1357,65 +1357,6 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc, return 0; } -#if 0 /* code from mjg to attempt D3 on crtc dpms off - revisit later */ -static int mga_suspend(struct drm_crtc *crtc) -{ - struct mga_crtc *mga_crtc = to_mga_crtc(crtc); - struct drm_device *dev = crtc->dev; - struct mga_device *mdev = dev->dev_private; - struct pci_dev *pdev = dev->pdev; - int option; - - if (mdev->suspended) - return 0; - - WREG_SEQ(1, 0x20); - WREG_ECRT(1, 0x30); - /* Disable the pixel clock */ - WREG_DAC(0x1a, 0x05); - /* Power down the DAC */ - WREG_DAC(0x1e, 0x18); - /* Power down the pixel PLL */ - WREG_DAC(0x1a, 0x0d); - - /* Disable PLLs and clocks */ - pci_read_config_dword(pdev, PCI_MGA_OPTION, &option); - option &= ~(0x1F8024); - pci_write_config_dword(pdev, PCI_MGA_OPTION, option); - pci_set_power_state(pdev, PCI_D3hot); - pci_disable_device(pdev); - - mdev->suspended = true; - - return 0; -} - -static int mga_resume(struct drm_crtc *crtc) -{ - struct mga_crtc *mga_crtc = to_mga_crtc(crtc); - struct drm_device *dev = crtc->dev; - struct mga_device *mdev = dev->dev_private; - struct pci_dev *pdev = dev->pdev; - int option; - - if (!mdev->suspended) - return 0; - - pci_set_power_state(pdev, PCI_D0); - pci_enable_device(pdev); - - /* Disable sysclk */ - pci_read_config_dword(pdev, PCI_MGA_OPTION, &option); - option &= ~(0x4); - pci_write_config_dword(pdev, PCI_MGA_OPTION, option); - - mdev->suspended = false; - - return 0; -} - -#endif - static void mga_crtc_dpms(struct drm_crtc *crtc, int mode) { struct drm_device *dev = crtc->dev; @@ -1442,11 +1383,6 @@ static void mga_crtc_dpms(struct drm_crtc *crtc, int mode) break; } -#if 0 - if (mode == DRM_MODE_DPMS_OFF) { - mga_suspend(crtc); - } -#endif WREG8(MGAREG_SEQ_INDEX, 0x01); seq1 |= RREG8(MGAREG_SEQ_DATA) & ~0x20; mga_wait_vsync(mdev); @@ -1456,13 +1392,6 @@ static void mga_crtc_dpms(struct drm_crtc *crtc, int mode) WREG8(MGAREG_CRTCEXT_INDEX, 0x01); crtcext1 |= RREG8(MGAREG_CRTCEXT_DATA) & ~0x30; WREG8(MGAREG_CRTCEXT_DATA, crtcext1); - -#if 0 - if (mode == DRM_MODE_DPMS_ON && mdev->suspended == true) { - mga_resume(crtc); - drm_helper_resume_force_mode(dev); - } -#endif } /*