Drivers using legacy PCI power management .suspend()/.resume() callbacks
have to manage PCI states and device's PM states themselves. They also
need to take care of standard configuration registers.
Switch to generic power management framework using a "struct dev_pm_ops"
variable to take the unnecessary load from the driver.
This also avoids the need for the driver to directly call most of the PCI
helper functions and device power state control functions, as through
the generic framework PCI Core takes care of the necessary operations,
and drivers are required to do only device-specific jobs.
Before the above mentioned patch, codes between the line number 547 and
2803 were already inside "#ifdef CONFIG_PM" container. Thus, addition of
"#if defined(CONFIG_PM)" was not required in the patch. It also affected
the "#ifdef CONFIG_PPC_OF" container (line 1943-2510).
From the current snapshot of radeon_pm.c, remove:
1434 | #if defined(CONFIG_PM)
and,
2213 | #endif
This removes the redundant CONFIG_PM directive as well as fixes the
CONFIG_PPC (earlier CONFIG_PPC_OF) container.
Mike Rapoport [Sun, 30 Aug 2020 11:55:24 +0000 (14:55 +0300)]
fbdev: remove mbx framebuffer driver
The only in-tree user for mbx driver for Intel 2700G graphics chip was
cm-x270 platform. Since this platform was removed by the commit 9d3239147d6d ("ARM: pxa: remove Compulab pxa2xx boards") there is no
point to keep the obsolete framebuffer driver.
Jason Yan [Thu, 27 Aug 2020 13:00:28 +0000 (21:00 +0800)]
video: fbdev: kyro: remove set but not used 'ulCoreClock'
This addresses the following gcc warning with "make W=1":
drivers/video/fbdev/kyro/STG4000InitDevice.c: In function
‘SetCoreClockPLL’:
drivers/video/fbdev/kyro/STG4000InitDevice.c:247:6: warning: variable
‘ulCoreClock’ set but not used [-Wunused-but-set-variable] // yanaijie
fixed
247 | u32 ulCoreClock;
| ^~~~~~~~~~~
Jason Yan [Thu, 27 Aug 2020 13:00:08 +0000 (21:00 +0800)]
video: fbdev: kyro: remove set but not used 'ulBestVCO'
This addresses the following gcc warning with "make W=1":
drivers/video/fbdev/kyro/STG4000InitDevice.c: In function
‘ProgramClock’:
drivers/video/fbdev/kyro/STG4000InitDevice.c:123:6: warning: variable
‘ulBestVCO’ set but not used [-Wunused-but-set-variable]
123 | u32 ulBestVCO = 0, ulBestClk = 0, ulBestScore = 0;
| ^~~~~~~~~
Vaibhav Gupta [Wed, 19 Aug 2020 18:56:54 +0000 (00:26 +0530)]
fbdev: arkfb: use generic power management
Drivers should do only device-specific jobs. But in general, drivers using
legacy PCI PM framework for .suspend()/.resume() have to manage many PCI
PM-related tasks themselves which can be done by PCI Core itself. This
brings extra load on the driver and it directly calls PCI helper functions
to handle them.
Switch to the new generic framework by updating function signatures and
define a "struct dev_pm_ops" variable to bind PM callbacks. Also, remove
unnecessary calls to the PCI Helper functions along with the legacy
.suspend & .resume bindings.
The ark_pci_suspend() is not designed to function in the case of Freeze.
Thus, the code checked for "if (state.event == PM_EVENT_FREEZE....)". This
is because, in the legacy framework, this callback was invoked even in the
event of Freeze. Hence, added the load of unnecessary function-call.
The goal can be achieved by binding the callback with only ".suspend" and
".poweroff" in the "ark_pci_pm_ops" const variable. This also avoids the
step of checking "state.event == PM_EVENT_FREEZE" every time the callback
is invoked.
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com> Cc: Bjorn Helgaas <helgaas@kernel.org> Cc: Bjorn Helgaas <bhelgaas@google.com> Cc: Bjorn Helgaas <bjorn@helgaas.com> Cc: Vaibhav Gupta <vaibhav.varodek@gmail.com> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Russell King <linux@armlinux.org.uk> Cc: Andres Salomon <dilinger@queued.net> CC: Antonino Daplas <adaplas@gmail.com> Cc: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200819185654.151170-13-vaibhavgupta40@gmail.com
Vaibhav Gupta [Wed, 19 Aug 2020 18:56:53 +0000 (00:26 +0530)]
fbdev: s3fb: use generic power management
Drivers should do only device-specific jobs. But in general, drivers using
legacy PCI PM framework for .suspend()/.resume() have to manage many PCI
PM-related tasks themselves which can be done by PCI Core itself. This
brings extra load on the driver and it directly calls PCI helper functions
to handle them.
Switch to the new generic framework by updating function signatures and
define a "struct dev_pm_ops" variable to bind PM callbacks. Also, remove
unnecessary calls to the PCI Helper functions along with the legacy
.suspend & .resume bindings.
The s3_pci_suspend() is not designed to function in the case of Freeze.
Thus, the code checked for "if (state.event == PM_EVENT_FREEZE....)". This
is because, in the legacy framework, this callback was invoked even in the
event of Freeze. Hence, added the load of unnecessary function-call.
The goal can be achieved by binding the callback with only ".suspend" and
".poweroff" in the "s3_pci_pm_ops" const variable. This also avoids the
step of checking "state.event == PM_EVENT_FREEZE" every time the callback
is invoked.
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com> Cc: Bjorn Helgaas <helgaas@kernel.org> Cc: Bjorn Helgaas <bhelgaas@google.com> Cc: Bjorn Helgaas <bjorn@helgaas.com> Cc: Vaibhav Gupta <vaibhav.varodek@gmail.com> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Russell King <linux@armlinux.org.uk> Cc: Andres Salomon <dilinger@queued.net> CC: Antonino Daplas <adaplas@gmail.com> Cc: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200819185654.151170-12-vaibhavgupta40@gmail.com
Vaibhav Gupta [Wed, 19 Aug 2020 18:56:52 +0000 (00:26 +0530)]
fbdev: vt8623fb: use generic power management
Drivers should do only device-specific jobs. But in general, drivers using
legacy PCI PM framework for .suspend()/.resume() have to manage many PCI
PM-related tasks themselves which can be done by PCI Core itself. This
brings extra load on the driver and it directly calls PCI helper functions
to handle them.
Switch to the new generic framework by updating function signatures and
define a "struct dev_pm_ops" variable to bind PM callbacks. Also, remove
unnecessary calls to the PCI Helper functions along with the legacy
.suspend & .resume bindings.
The vt8623_pci_suspend() is not designed to function in the case of Freeze.
Thus, the code checked for "if (state.event == PM_EVENT_FREEZE....)". This
is because, in the legacy framework, this callback was invoked even in the
event of Freeze. Hence, added the load of unnecessary function-call.
The goal can be achieved by binding the callback with only ".suspend" and
".poweroff" in the "vt8623_pci_pm_ops" const variable. This also avoids the
step of checking "state.event == PM_EVENT_FREEZE" every time the callback
is invoked.
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com> Cc: Bjorn Helgaas <helgaas@kernel.org> Cc: Bjorn Helgaas <bhelgaas@google.com> Cc: Bjorn Helgaas <bjorn@helgaas.com> Cc: Vaibhav Gupta <vaibhav.varodek@gmail.com> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Russell King <linux@armlinux.org.uk> Cc: Andres Salomon <dilinger@queued.net> CC: Antonino Daplas <adaplas@gmail.com> Cc: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200819185654.151170-11-vaibhavgupta40@gmail.com
Vaibhav Gupta [Wed, 19 Aug 2020 18:56:51 +0000 (00:26 +0530)]
fbdev: i740fb: use generic power management
Drivers should do only device-specific jobs. But in general, drivers using
legacy PCI PM framework for .suspend()/.resume() have to manage many PCI
PM-related tasks themselves which can be done by PCI Core itself. This
brings extra load on the driver and it directly calls PCI helper functions
to handle them.
Switch to the new generic framework by updating function signatures and
define a "struct dev_pm_ops" variable to bind PM callbacks. Also, remove
unnecessary calls to the PCI Helper functions along with the legacy
.suspend & .resume bindings.
The i740fb_suspend() is not designed to function in the case of Freeze.
Thus, the code checked for "if (state.event == PM_EVENT_FREEZE....)". This
is because, in the legacy framework, this callback was invoked even in the
event of Freeze. Hence, added the load of unnecessary function-call.
The goal can be achieved by binding the callback with only ".suspend" and
".poweroff" in the "i740fb_pm_ops" const variable. This also avoids the
step of checking "if (state.event == PM_EVENT_FREEZE....)" every time the
callback is invoked.
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com> Cc: Bjorn Helgaas <helgaas@kernel.org> Cc: Bjorn Helgaas <bhelgaas@google.com> Cc: Bjorn Helgaas <bjorn@helgaas.com> Cc: Vaibhav Gupta <vaibhav.varodek@gmail.com> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Russell King <linux@armlinux.org.uk> Cc: Andres Salomon <dilinger@queued.net> CC: Antonino Daplas <adaplas@gmail.com> Cc: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200819185654.151170-10-vaibhavgupta40@gmail.com
Vaibhav Gupta [Wed, 19 Aug 2020 18:56:50 +0000 (00:26 +0530)]
fbdev: cyber2000fb: use generic power management
Switch to the new generic framework by updating function signatures and
define a "struct dev_pm_ops" variable to bind PM callbacks. This way we can
remove the legacy .suspend & .resume bindings from "lxfb_driver".
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com> Cc: Bjorn Helgaas <helgaas@kernel.org> Cc: Bjorn Helgaas <bhelgaas@google.com> Cc: Bjorn Helgaas <bjorn@helgaas.com> Cc: Vaibhav Gupta <vaibhav.varodek@gmail.com> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Russell King <linux@armlinux.org.uk> Cc: Andres Salomon <dilinger@queued.net> CC: Antonino Daplas <adaplas@gmail.com> Cc: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200819185654.151170-9-vaibhavgupta40@gmail.com
Vaibhav Gupta [Wed, 19 Aug 2020 18:56:49 +0000 (00:26 +0530)]
fbdev: savagefb: use generic power management
Drivers should do only device-specific jobs. But in general, drivers using
legacy PCI PM framework for .suspend()/.resume() have to manage many PCI
PM-related tasks themselves which can be done by PCI Core itself. This
brings extra load on the driver and it directly calls PCI helper functions
to handle them.
Switch to the new generic framework by updating function signatures and
define a "struct dev_pm_ops" variable to bind PM callbacks. Also, remove
unnecessary calls to the PCI Helper functions along with the legacy
.suspend & .resume bindings.
Now,
- savagefb_suspend() had a "pm_message_t" type parameter as per legacy
PCI PM framework that got deprecated in generic.
- Rename the callback as savagefb_suspend_late() and preserve the
parameter.
- Define 3 new callbacks as:
* savagefb_suspend()
* savagefb_freeze()
* savagefb_hibernate()
which in turn call savagefb_suspend_late() by passing appropriate value
for "pm_message_t" type parameter.
- Bind the callbacks in "struct dev_pm_ops" type variable
"savagefb_pm_ops".
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com> Cc: Bjorn Helgaas <helgaas@kernel.org> Cc: Bjorn Helgaas <bhelgaas@google.com> Cc: Bjorn Helgaas <bjorn@helgaas.com> Cc: Vaibhav Gupta <vaibhav.varodek@gmail.com> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Russell King <linux@armlinux.org.uk> Cc: Andres Salomon <dilinger@queued.net> CC: Antonino Daplas <adaplas@gmail.com> Cc: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200819185654.151170-8-vaibhavgupta40@gmail.com
Vaibhav Gupta [Wed, 19 Aug 2020 18:56:48 +0000 (00:26 +0530)]
fbdev: nvidia: use generic power management
Drivers should do only device-specific jobs. But in general, drivers using
legacy PCI PM framework for .suspend()/.resume() have to manage many PCI
PM-related tasks themselves which can be done by PCI Core itself. This
brings extra load on the driver and it directly calls PCI helper functions
to handle them.
Switch to the new generic framework by updating function signatures and
define a "struct dev_pm_ops" variable to bind PM callbacks. Also, remove
unnecessary calls to the PCI Helper functions along with the legacy
.suspend & .resume bindings.
Now,
- nvidiafb_suspend() had a "pm_message_t" type parameter as per legacy
PCI PM framework that got deprecated in generic.
- Rename the callback as nvidiafb_suspend_late() and preserve the
parameter.
- Define 3 new callbacks as:
* nvidiafb_suspend()
* nvidiafb_freeze()
* nvidiafb_hibernate()
which in turn call nvidiafb_suspend_late() by passing appropriate value
for "pm_message_t" type parameter.
- Bind the callbacks in "struct dev_pm_ops" type variable
"nvidiafb_pm_ops".
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com> Cc: Bjorn Helgaas <helgaas@kernel.org> Cc: Bjorn Helgaas <bhelgaas@google.com> Cc: Bjorn Helgaas <bjorn@helgaas.com> Cc: Vaibhav Gupta <vaibhav.varodek@gmail.com> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Russell King <linux@armlinux.org.uk> Cc: Andres Salomon <dilinger@queued.net> CC: Antonino Daplas <adaplas@gmail.com> Cc: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200819185654.151170-7-vaibhavgupta40@gmail.com
Vaibhav Gupta [Wed, 19 Aug 2020 18:56:47 +0000 (00:26 +0530)]
fbdev: aty128fb: use generic power management
Drivers should do only device-specific jobs. But in general, drivers using
legacy PCI PM framework for .suspend()/.resume() have to manage many PCI
PM-related tasks themselves which can be done by PCI Core itself. This
brings extra load on the driver and it directly calls PCI helper functions
to handle them.
Switch to the new generic framework by updating function signatures and
define a "struct dev_pm_ops" variable to bind PM callbacks. Also, remove
unnecessary calls to the PCI Helper functions along with the legacy
.suspend & .resume bindings.
Now,
- aty128_pci_suspend() had a "pm_message_t" type parameter as per legacy
PCI PM framework that got deprecated in generic.
- Rename the callback as aty128_pci_suspend_late() and preserve the
parameter.
- Define 3 new callbacks as:
* aty128_pci_suspend()
* aty128_pci_freeze()
* aty128_pci_hibernate()
which in turn call aty128_pci_suspend_late() by passing appropriate
value for "pm_message_t" type parameter.
- Bind the callbacks in "struct dev_pm_ops" type variable
"aty128_pci_pm_ops".
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com> Cc: Bjorn Helgaas <helgaas@kernel.org> Cc: Bjorn Helgaas <bhelgaas@google.com> Cc: Bjorn Helgaas <bjorn@helgaas.com> Cc: Vaibhav Gupta <vaibhav.varodek@gmail.com> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Russell King <linux@armlinux.org.uk> Cc: Andres Salomon <dilinger@queued.net> CC: Antonino Daplas <adaplas@gmail.com> Cc: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200819185654.151170-6-vaibhavgupta40@gmail.com
Vaibhav Gupta [Wed, 19 Aug 2020 18:56:46 +0000 (00:26 +0530)]
fbdev: aty: use generic power management
Drivers should do only device-specific jobs. But in general, drivers using
legacy PCI PM framework for .suspend()/.resume() have to manage many PCI
PM-related tasks themselves which can be done by PCI Core itself. This
brings extra load on the driver and it directly calls PCI helper functions
to handle them.
Switch to the new generic framework by updating function signatures and
define a "struct dev_pm_ops" variable to bind PM callbacks. Also, remove
unnecessary calls to the PCI Helper functions along with the legacy
.suspend & .resume bindings.
Now,
- atyfb_pci_suspend() had a "pm_message_t" type parameter as per legacy
PCI PM framework, that got deprecated in generic.
- Rename the callback as atyfb_pci_suspend_late() and preserve the
parameter.
- Define 3 new callbacks as:
* atyfb_pci_suspend()
* atyfb_pci_freeze()
* atyfb_pci_hibernate()
which in turn call atyfb_pci_suspend_late() by passing appropriate
value for "pm_message_t" type parameter.
- Bind the callbacks in "struct dev_pm_ops" type variable
"atyfb_pci_pm_ops".
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com> Cc: Bjorn Helgaas <helgaas@kernel.org> Cc: Bjorn Helgaas <bhelgaas@google.com> Cc: Bjorn Helgaas <bjorn@helgaas.com> Cc: Vaibhav Gupta <vaibhav.varodek@gmail.com> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Russell King <linux@armlinux.org.uk> Cc: Andres Salomon <dilinger@queued.net> CC: Antonino Daplas <adaplas@gmail.com> Cc: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200819185654.151170-5-vaibhavgupta40@gmail.com
Vaibhav Gupta [Wed, 19 Aug 2020 18:56:45 +0000 (00:26 +0530)]
fbdev: via-core: use generic power management
Drivers should do only device-specific jobs. But in general, drivers using
legacy PCI PM framework for .suspend()/.resume() have to manage many PCI
PM-related tasks themselves which can be done by PCI Core itself. This
brings extra load on the driver and it directly calls PCI helper functions
to handle them.
Switch to the new generic framework by updating function signatures and
define a "struct dev_pm_ops" variable to bind PM callbacks.
The via_suspend() is designed to function only in the case of Suspend.
Thus, the code checked for "if (state.event != PM_EVENT_SUSPEND)". This is
because, in the legacy framework, this callback was invoked even in the
event of Freeze and Hibernate. Hence, added the load of unnecessary
function-calls.
The goal can be achieved by binding the callback with only
"via_pm_ops.suspend" in the new framework. This also avoids the step of
checking "if (state.event != PM_EVENT_SUSPEND)" every time the callback is
invoked.
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com> Cc: Bjorn Helgaas <helgaas@kernel.org> Cc: Bjorn Helgaas <bhelgaas@google.com> Cc: Bjorn Helgaas <bjorn@helgaas.com> Cc: Vaibhav Gupta <vaibhav.varodek@gmail.com> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Russell King <linux@armlinux.org.uk> Cc: Andres Salomon <dilinger@queued.net> CC: Antonino Daplas <adaplas@gmail.com> Cc: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200819185654.151170-4-vaibhavgupta40@gmail.com
Vaibhav Gupta [Wed, 19 Aug 2020 18:56:44 +0000 (00:26 +0530)]
fbdev: lxfb: use generic power management
Switch to the new generic framework by updating function signatures and
define a "struct dev_pm_ops" variable to bind PM callbacks. This way we can
remove the legacy .suspend & .resume bindings from "lxfb_driver".
The lxfb_suspend() is designed to function only in the case of Suspend.
Thus, the code was kept inside "if (state.event == PM_EVENT_SUSPEND)"
container. This is because, in the legacy framework, this callback was
invoked even in the event of Freeze and Hibernate. Hence, added the load of
unnecessary function-calls.
The goal can be achieved by binding the callback with only
"lxfb_pm_ops.suspend" in the new framework. This also avoids the step of
checking "if (state.event == PM_EVENT_SUSPEND)" every time the callback is
invoked.
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com> Cc: Bjorn Helgaas <helgaas@kernel.org> Cc: Bjorn Helgaas <bhelgaas@google.com> Cc: Bjorn Helgaas <bjorn@helgaas.com> Cc: Vaibhav Gupta <vaibhav.varodek@gmail.com> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Russell King <linux@armlinux.org.uk> Cc: Andres Salomon <dilinger@queued.net> CC: Antonino Daplas <adaplas@gmail.com> Cc: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200819185654.151170-3-vaibhavgupta40@gmail.com
Vaibhav Gupta [Wed, 19 Aug 2020 18:56:43 +0000 (00:26 +0530)]
fbdev: gxfb: use generic power management
Switch to the new generic framework by updating function signatures and
define a "struct dev_pm_ops" variable to bind PM callbacks. This way we can
remove the legacy .suspend & .resume bindings from "gxfb_driver".
The gxfb_suspend() is designed to function only in the case of Suspend.
Thus, the code was kept inside "if (state.event == PM_EVENT_SUSPEND)"
container. This is because, in the legacy framework, this callback was
invoked even in the event of Freeze and Hibernate. Hence, added the load of
unnecessary function-calls.
The goal can be achieved by binding the callback with only
"gxfb_pm_ops.suspend" in the new framework. This also avoids the step of
checking "if (state.event == PM_EVENT_SUSPEND)" every time the callback is
invoked.
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com> Cc: Bjorn Helgaas <helgaas@kernel.org> Cc: Bjorn Helgaas <bhelgaas@google.com> Cc: Bjorn Helgaas <bjorn@helgaas.com> Cc: Vaibhav Gupta <vaibhav.varodek@gmail.com> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Russell King <linux@armlinux.org.uk> Cc: Andres Salomon <dilinger@queued.net> CC: Antonino Daplas <adaplas@gmail.com> Cc: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200819185654.151170-2-vaibhavgupta40@gmail.com
video: fbdev: ssd1307fb: Added support to Column offset
This patch provides support for displays like VGM128064B0W10,
which requires a column offset of 2, i.e., its segments starts
in SEG2 and ends in SEG129.
Colin Ian King [Thu, 23 Jul 2020 17:02:27 +0000 (18:02 +0100)]
video: fbdev: vga16fb: fix setting of pixclock because a pass-by-value error
The pixclock is being set locally because it is being passed as a
pass-by-value argument rather than pass-by-reference, so the computed
pixclock is never being set in var->pixclock. Fix this by passing
by reference.
[This dates back to 2002, I found the offending commit from the git
history git://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git ]
Addresses-Coverity: ("Unused value") Signed-off-by: Colin Ian King <colin.king@canonical.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Jani Nikula <jani.nikula@intel.com>
[b.zolnierkie: minor patch summary fixup]
[b.zolnierkie: removed "Fixes:" tag (not in upstream tree)] Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200723170227.996229-1-colin.king@canonical.com
George Kennedy [Tue, 7 Jul 2020 19:26:03 +0000 (15:26 -0400)]
fbmem: add margin check to fb_check_caps()
A fb_ioctl() FBIOPUT_VSCREENINFO call with invalid xres setting
or yres setting in struct fb_var_screeninfo will result in a
KASAN: vmalloc-out-of-bounds failure in bitfill_aligned() as
the margins are being cleared. The margins are cleared in
chunks and if the xres setting or yres setting is a value of
zero upto the chunk size, the failure will occur.
Add a margin check to validate xres and yres settings.
Christian König [Mon, 7 Sep 2020 11:44:36 +0000 (13:44 +0200)]
drm/ttm: merge offset and base in ttm_bus_placement
This is used by TTM to communicate the physical address
which should be used with ioremap(), ioremap_wc(). We don't
need to separate the base and offset in any way here.
This fixes the following warnings while building in W=1 :
dw-mipi-dsi.c:1002:5: warning: no previous prototype for 'dw_mipi_dsi_debugfs_write' [-Wmissing-prototypes]
dw-mipi-dsi.c:1027:5: warning: no previous prototype for 'dw_mipi_dsi_debugfs_show' [-Wmissing-prototypes]
Fixes: e2435d69204c ("drm/bridge: dw-mipi-dsi.c: Add VPG runtime config through debugfs") Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Angelo Ribeiro <angelo.ribeiro@synopsys.com> Cc: Maxime Ripard <maxime@cerno.tech> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Thomas Zimmermann <tzimmermann@suse.de> Link: https://patchwork.freedesktop.org/patch/msgid/20200907102711.23748-1-narmstrong@baylibre.com
Rodrigo Siqueira [Sun, 30 Aug 2020 14:20:00 +0000 (10:20 -0400)]
drm/vkms: Add support for writeback
This patch implements the necessary functions to add writeback support
for vkms. This feature is useful for testing compositors if you don't
have hardware with writeback support.
Change in V4 (Emil and Melissa):
- Move signal completion above drm_crtc_add_crc_entry()
- Make writeback always available
- Use appropriate namespace
- Drop fb check in vkms_wb_atomic_commit
- Make vkms_set_composer visible for writeback code
- Enable composer operation on prepare_job and disable it on cleanup_job
- Drop extra space at the end of the file
- Rebase
Change in V3 (Daniel):
- If writeback is enabled, compose everything into the writeback buffer
instead of CRC private buffer
- Guarantees that the CRC will match exactly what we have in the
writeback buffer.
Change in V2:
- Rework signal completion (Brian)
- Integrates writeback with active_planes (Daniel)
- Compose cursor (Daniel)
Rodrigo Siqueira [Sun, 30 Aug 2020 14:19:59 +0000 (10:19 -0400)]
drm/vkms: Compute CRC without change input data
This commit decouples pixel manipulation from compute_crc() for avoiding
any pixel change during the CRC calculation. This commits represents a
preparation work for making VKMS able to support the writeback feature.
Change in V5 (Melissa):
- Rebase and drop bitmap for alpha
Change in V4 (Emil):
- Move bitmap_clear operation and comments to get_pixel function
Rodrigo Siqueira [Sun, 30 Aug 2020 14:19:58 +0000 (10:19 -0400)]
drm/vkms: Decouple crc operations from composer
In the vkms_composer.c, some of the functions related to CRC and compose
have interdependence between each other. This patch reworks some
functions inside vkms_composer to make crc and composer computation
decoupled.
This patch is preparation work for making vkms able to support new
features.
Maxime Ripard [Thu, 3 Sep 2020 08:01:51 +0000 (10:01 +0200)]
drm/vc4: drv: Support BCM2711
The BCM2711 has a reworked display pipeline, and the load tracker needs
some adjustment to operate properly. Let's add a compatible for BCM2711
and disable the load tracker until properly supported.
The HDMI controllers found in the BCM2711 SoC need some adjustments to the
bindings, especially since the registers have been shuffled around in more
register ranges.
The BCM2711 has another clock that needs to be ramped up depending on the
pixel rate: the pixel BVB clock. Add the code to adjust that clock when
changing the mode.
[Maxime: Changed the commit log, used clk_set_min_rate]
Maxime Ripard [Thu, 3 Sep 2020 08:01:46 +0000 (10:01 +0200)]
drm/vc4: hdmi: Switch to blank pixels when disabled
In order to avoid pixels getting stuck in an unflushable FIFO, we need when
we disable the HDMI controller to switch away from getting our pixels from
the pixelvalve and instead use blank pixels, and switch back to the
pixelvalve when we enable the HDMI controller.
Maxime Ripard [Thu, 3 Sep 2020 08:01:45 +0000 (10:01 +0200)]
drm/vc4: hdmi: Do the VID_CTL configuration at once
The VID_CTL setup is done in several places in the driver even though it's
not really required. Let's simplify it a bit to do the configuration in one
go.
Maxime Ripard [Thu, 3 Sep 2020 08:01:44 +0000 (10:01 +0200)]
drm/vc4: hdmi: Implement finer-grained hooks
In order to prevent some pixels getting stuck in an unflushable FIFO on
bcm2711, we need to enable the HVS, the pixelvalve (the CRTC) and the HDMI
controller (the encoder) in an intertwined way, and with tight delays.
However, the atomic callbacks don't really provide a way to work with
either constraints, so we need to roll our own callbacks so that we can
provide those guarantees.
Since those callbacks have been implemented and called in the CRTC code, we
can just implement them in the HDMI driver now.
Maxime Ripard [Thu, 3 Sep 2020 08:01:43 +0000 (10:01 +0200)]
drm/vc4: hdmi: Always recenter the HDMI FIFO
In order to avoid a pixel getting stuck in an unflushable FIFO, we need to
recenter the FIFO every time we're doing a modeset and not only if we're
connected to an HDMI monitor.
Maxime Ripard [Thu, 3 Sep 2020 08:01:42 +0000 (10:01 +0200)]
drm/vc4: hdmi: Remove register dumps in enable
The current code has some logic, disabled by default, to dump the register
setup in the HDMI controller.
However, since we're going to split those functions in multiple, shorter,
functions that only make sense where they are called in sequence, keeping
the register dump makes little sense.
Maxime Ripard [Thu, 3 Sep 2020 08:01:41 +0000 (10:01 +0200)]
drm/vc4: hdmi: Deal with multiple ALSA cards
The HDMI driver was registering a single ALSA card so far with the name
vc4-hdmi.
Obviously, this is not going to work anymore when we will have multiple
HDMI controllers since we will end up trying to register two files with the
same name.
Let's use the variant to avoid that name conflict.
Dave Stevenson [Thu, 3 Sep 2020 08:01:39 +0000 (10:01 +0200)]
drm/vc4: hdmi: Set the b-frame marker to the match ALSA's default.
ALSA's iec958 plugin by default sets the block start preamble
to 8, whilst this driver was programming the hardware to expect
0xF.
Amend the hardware config to match ALSA.
Dave Stevenson [Thu, 3 Sep 2020 08:01:38 +0000 (10:01 +0200)]
drm/vc4: hdmi: Reset audio infoframe on encoder_enable if previously streaming
If the encoder is disabled and re-enabled (eg mode change) all infoframes
are reset, whilst the audio subsystem know nothing about this change.
The driver therefore needs to reinstate the audio infoframe for
itself.
Dave Stevenson [Thu, 3 Sep 2020 08:01:37 +0000 (10:01 +0200)]
drm/vc4: hdmi: Use reg-names to retrieve the HDMI audio registers
The register range used for audio setup in the previous generations of
SoC were always the second range in the device tree. However, now that
the BCM2711 has way more register ranges, it makes sense to retrieve it
by names for it, while preserving the id-based lookup as a fallback.
Maxime Ripard [Thu, 3 Sep 2020 08:01:36 +0000 (10:01 +0200)]
drm/vc4: hdmi: Use clk_set_min_rate instead
The HSM clock needs to be running at 101% the pixel clock of the HDMI
controller, however it's shared between the two HDMI controllers, which
means that if the resolutions are different between the two HDMI
controllers, and the lowest resolution is on the second (in enable order)
controller, the first HDMI controller will end up with a smaller than
expected clock rate.
Since we don't really need an exact frequency there, we can simply change
the minimum rate we expect instead.
Maxime Ripard [Thu, 3 Sep 2020 08:01:35 +0000 (10:01 +0200)]
drm/vc4: hdmi: Adjust HSM clock rate depending on pixel rate
The HSM clock needs to be setup at around 101% of the pixel rate. This
was done previously by setting the clock rate to 163.7MHz at probe time and
only check in mode_valid whether the mode pixel clock was under the pixel
clock +1% or not.
However, with 4k we need to change that frequency to a higher frequency
than 163.7MHz, and yet want to have the lowest clock as possible to have a
decent power saving.
Let's change that logic a bit by setting the clock rate of the HSM clock
to the pixel rate at encoder_enable time. This would work for the
BCM2711 that support 4k resolutions and has a clock that can provide it,
but we still have to take care of a 4k panel plugged on a BCM283x SoCs
that wouldn't be able to use those modes, so let's define the limit in
the variant.
Maxime Ripard [Thu, 3 Sep 2020 08:01:34 +0000 (10:01 +0200)]
drm/vc4: hdmi: Rename drm_encoder pointer in mode_valid
The mode_valid hook on the encoder uses a pointer to a drm_encoder called
crtc, which is pretty confusing. Let's rename it to encoder to make it
clear what it is.
Maxime Ripard [Thu, 3 Sep 2020 08:01:31 +0000 (10:01 +0200)]
drm/vc4: hdmi: Move CEC init to its own function
The CEC init code was put directly into the bind function, which was quite
inconsistent with how the audio support was done, and would prevent us from
further changes to skip that initialisation entirely.
Maxime Ripard [Thu, 3 Sep 2020 08:01:30 +0000 (10:01 +0200)]
drm/vc4: hdmi: Deal with multiple debugfs files
The HDMI driver was registering a single debugfs file so far with the name
hdmi_regs.
Obviously, this is not going to work anymore when will have multiple HDMI
controllers since we will end up trying to register two files with the same
name.
Let's use the variant to avoid that name conflict.
Maxime Ripard [Thu, 3 Sep 2020 08:01:29 +0000 (10:01 +0200)]
drm/vc4: hdmi: Store the encoder type in the variant structure
The vc4 CRTC will use the encoder type to control its output clock
muxing. However, this will be different from HDMI0 to HDMI1, so let's
store our type in the variant structure so that we can support multiple
controllers later on.
Maxime Ripard [Thu, 3 Sep 2020 08:01:28 +0000 (10:01 +0200)]
drm/vc4: hdmi: Add a set_timings callback
Similarly to the previous patches, the timings setup in the HDMI controller
of the BCM2711 is slightly different, mostly because it supports higher
resolutions and thus needed more spaces for the various timings, resulting
in the register layout changing.
Maxime Ripard [Thu, 3 Sep 2020 08:01:23 +0000 (10:01 +0200)]
drm/vc4: hdmi: Implement a register layout abstraction
The HDMI controllers found in the BCM2711 have most of the registers
reorganized in multiple registers areas and at different offsets than
previously found.
The logic however remains pretty much the same, so it doesn't really make
sense to create a whole new driver and we should share the code as much as
possible.
Let's implement some indirection to wrap around a register and depending on
the variant will lookup the associated register on that particular variant.
Maxime Ripard [Thu, 3 Sep 2020 08:01:22 +0000 (10:01 +0200)]
drm/vc4: hdmi: Introduce resource init and variant
The HDMI controllers found in the BCM2711 has a pretty different clock and
registers areas than found in the older BCM283x SoCs.
Let's create a variant structure to store the various adjustments we'll
need later on, and a function to get the resources needed for one
particular version.
Maxime Ripard [Thu, 3 Sep 2020 08:01:21 +0000 (10:01 +0200)]
drm/vc4: hdmi: Remove vc4_hdmi_connector
The vc4_hdmi_connector was only used to switch between drm_connector to
drm_encoder. However, we can now use vc4_hdmi to do the switch, so that
structure is redundant.
Maxime Ripard [Thu, 3 Sep 2020 08:01:19 +0000 (10:01 +0200)]
drm/vc4: hdmi: Retrieve the vc4_hdmi at unbind using our device
The unbind function needs to retrieve a vc4_hdmi structure pointer through
the struct device that we're given since we want to support multiple HDMI
controllers.
However, our optional ASoC support doesn't make that trivial since it will
overwrite the device drvdata if we use it, but obviously won't if we don't
use it.
Let's make sure the fields are at the proper offset to be able to cast
between the snd_soc_card structure and the vc4_hdmi structure
transparently so we can support both cases.
Maxime Ripard [Thu, 3 Sep 2020 08:01:17 +0000 (10:01 +0200)]
drm/vc4: hdmi: Add container_of macros for encoders and connectors
Whenever the code needs to access the vc4_hdmi structure from a DRM
connector or encoder, it first accesses the drm_device associated to the
connector, then retrieve the drm_dev private data which gives it a
pointer to our vc4_dev, and will finally follow the vc4_hdmi pointer in
that structure.
That will also give us some trouble when having multiple controllers,
but now that we have our encoder and connector structures that are part
of vc4_hdmi, we can simply call container_of on the DRM connector or
encoder and retrieve the vc4_hdmi structure directly.
Maxime Ripard [Thu, 3 Sep 2020 08:01:16 +0000 (10:01 +0200)]
drm/vc4: hdmi: Use local vc4_hdmi directly
The function vc4_hdmi_connector_detect access its vc4_hdmi struct by
dereferencing the pointer in the structure vc4_dev. This will cause some
issues when we will have multiple HDMI controllers, so let's just use the
local variable for now instead of dereferencing that pointer all the time,
and we'll fix the local variable later.
Maxime Ripard [Thu, 3 Sep 2020 08:01:15 +0000 (10:01 +0200)]
drm/vc4: hdmi: Move accessors to vc4_hdmi
The current driver only supports a single HDMI controller, and part of
the issue is that the main vc4_dev structure holds a pointer to its
(only) HDMI controller, and the HDMI registers accessors will use it to
retrieve the mapped addresses.
Let's modify those accessors to use directly the vc4_hdmi structure so
that we can eventually get rid of that single global pointer.
Maxime Ripard [Thu, 3 Sep 2020 08:01:13 +0000 (10:01 +0200)]
drm/vc4: hdmi: Remove DDC argument to connector_init
Now that we are passing the vc4_hdmi structure to the connector init
function, we can simply use the pointer in that structure instead of
having the pointer as an argument.
Maxime Ripard [Thu, 3 Sep 2020 08:01:10 +0000 (10:01 +0200)]
drm/vc4: hdmi: Use debugfs private field
We're calling vc4_debugfs_add_file with our struct vc4_hdmi pointer set
in the private field, but we don't use that field and go through the
main struct vc4_dev to get it.
Let's use the private field directly, that will save us some trouble
later on.
Maxime Ripard [Thu, 3 Sep 2020 08:01:07 +0000 (10:01 +0200)]
drm/vc4: drv: Disable the CRTC at boot time
In order to prevent issues during the firmware to KMS transition, we need
to make sure the pixelvalve are disabled at boot time so that the DRM state
matches the hardware state.
Maxime Ripard [Thu, 3 Sep 2020 08:01:05 +0000 (10:01 +0200)]
drm/vc4: hvs: Introduce a function to get the assigned FIFO
At boot time, if we detect that a pixelvalve has been enabled, we need to
be able to retrieve the HVS channel it has been assigned to so that we can
disable that channel too. Let's create that function that returns the FIFO
or an error from a given output.
Maxime Ripard [Thu, 3 Sep 2020 08:01:04 +0000 (10:01 +0200)]
drm/vc4: hvs: Make the stop_channel function public
During the transition from the firmware to the KMS driver, we need to pay
particular attention to how we deal with the pixelvalves that have already
been enabled, otherwise either timeouts or stuck pixels can occur. We'll
thus need to call the function to stop an HVS channel at boot.
Maxime Ripard [Thu, 3 Sep 2020 08:01:03 +0000 (10:01 +0200)]
drm/vc4: crtc: Clear the PixelValve FIFO during configuration
Even though it's not really clear why we need to flush the PV FIFO during
the configuration even though we started by flushing it, experience shows
that without it we get a stale pixel stuck in the FIFO between the HVS and
the PV.
Maxime Ripard [Thu, 3 Sep 2020 08:01:01 +0000 (10:01 +0200)]
drm/vc4: crtc: Add a delay after disabling the PixelValve output
In order to avoid pixels getting stuck in the (unflushable) FIFO between
the HVS and the PV, we need to add some delay after disabling the PV output
and before disabling the HDMI controller. 20ms seems to be good enough so
let's use that.
In the BCM2711, the setup of the HVS, pixelvalve and HDMI controller
requires very precise ordering and timing that the regular atomic callbacks
don't provide. Let's add new callbacks on top of the regular ones to be
able to split the configuration as needed.
Maxime Ripard [Thu, 3 Sep 2020 08:00:59 +0000 (10:00 +0200)]
drm/vc4: crtc: Move HVS channel init before the PV initialisation
In order to avoid stale pixels getting stuck in an intermediate FIFO
between the HVS and the pixelvalve on BCM2711, we need to configure the HVS
channel before the pixelvalve is reset and configured.
Maxime Ripard [Thu, 3 Sep 2020 08:00:58 +0000 (10:00 +0200)]
drm/vc4: crtc: Remove redundant pixelvalve reset
Since we moved the pixelvalve configuration to atomic_enable, we're now
first calling the function that resets the pixelvalve and then the one that
configures it.
However, the first thing the latter is doing is calling the reset function,
meaning that we reset twice our pixelvalve. Let's remove the first call.