platform/kernel/linux-starfive.git
6 years agodt-bindings: display: add HPD gpio to DVI connector
Tomi Valkeinen [Fri, 15 Dec 2017 14:08:22 +0000 (16:08 +0200)]
dt-bindings: display: add HPD gpio to DVI connector

Add hpd-gpios property to dvi-connector.txt.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: devicetree@vger.kernel.org
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
6 years agodrm/omap: add HPD support to connector-dvi
Tomi Valkeinen [Fri, 15 Dec 2017 14:08:23 +0000 (16:08 +0200)]
drm/omap: add HPD support to connector-dvi

Add HPD support to the DVI connector driver. The code is almost
identical to the HPD code in the HDMI connector driver.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
6 years agodrm/omap: Init fbdev emulation only when we have displays
Peter Ujfalusi [Fri, 15 Dec 2017 14:08:31 +0000 (16:08 +0200)]
drm/omap: Init fbdev emulation only when we have displays

Do not try to init the fbdev if either num_crtcs or num_connectors is 0.
In this case we do not have display so the fbdev init would fail anyways.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
6 years agodrm/omap: cleanup fbdev init/free
Tomi Valkeinen [Fri, 9 Feb 2018 07:36:23 +0000 (09:36 +0200)]
drm/omap: cleanup fbdev init/free

omap_fbdev_init() and omap_fbdev_free() use priv->fbdev directly.
However, omap_fbdev_init() returns the fbdev, and omap_drv.c also
assigns the return value to priv->fbdev. This is slightly confusing.

Clean this up by removing the omap_fbdev_init() return value, as we
don't care whether fbdev init succeeded or not. Also change omap_drv.c
to call omap_fbdev_free() always, and omap_fbdev_free() does the check
if fbdev was initialized.

While at it, rename omap_fbdev_free() to omap_fbdev_fini() to better
match the "init" counterpart.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
6 years agodrm/omap: fix omap_fbdev_free() when omap_fbdev_create() wasn't called
Tomi Valkeinen [Fri, 9 Feb 2018 07:30:44 +0000 (09:30 +0200)]
drm/omap: fix omap_fbdev_free() when omap_fbdev_create() wasn't called

If we have no crtcs/connectors, fbdev init goes fine, but
omap_fbdev_create() is never called. This means that omap_fbdev->bo is
NULL and omap_fbdev_free() crashes.

Add a check to omap_fbdev_free() to handle the NULL case.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
6 years agodrm/omap: fbdev: avoid double initializer entry
Tomi Valkeinen [Mon, 12 Feb 2018 07:55:45 +0000 (09:55 +0200)]
drm/omap: fbdev: avoid double initializer entry

Fix sparse warning:

drivers/gpu/drm/omapdrm/omap_fbdev.c:83:9: warning: Initializer entry defined twice
drivers/gpu/drm/omapdrm/omap_fbdev.c:91:10:   also defined here

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
6 years agodrm/omap: fbdev: use 'screen_buffer' field
Tomi Valkeinen [Mon, 12 Feb 2018 07:52:57 +0000 (09:52 +0200)]
drm/omap: fbdev: use 'screen_buffer' field

Fix sparse warning:

drivers/gpu/drm/omapdrm/omap_fbdev.c:191:26: warning: incorrect type in assignment (different address spaces)
drivers/gpu/drm/omapdrm/omap_fbdev.c:191:26:    expected char [noderef] <asn:2>*screen_base
drivers/gpu/drm/omapdrm/omap_fbdev.c:191:26:    got void *

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
6 years agodrm/omap: acx565akm: use __be32 when reading status
Tomi Valkeinen [Mon, 12 Feb 2018 07:19:52 +0000 (09:19 +0200)]
drm/omap: acx565akm:  use __be32 when reading status

Fix sparse warning:

drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c:224:23: warning: cast to restricted __be32

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
6 years agodrm/omap: reorganize locking in mgr_fld_write
Tomi Valkeinen [Mon, 12 Feb 2018 07:16:08 +0000 (09:16 +0200)]
drm/omap: reorganize locking in mgr_fld_write

Fix sparse warning:

drivers/gpu/drm/omapdrm/dss/dispc.c:387:9: warning: context imbalance in 'mgr_fld_write' - different lock contexts for basic block

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
6 years agodrm: omapdrm: venc: Allocate the venc private data structure dynamically
Laurent Pinchart [Tue, 13 Feb 2018 12:00:48 +0000 (14:00 +0200)]
drm: omapdrm: venc: Allocate the venc private data structure dynamically

The venc private data structure is currently stored as a global
variable. While no platform with multiple VENC encoders currently exists
nor is planned, this doesn't comply with the kernel device model and
should thus be fixed.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agodrm: omapdrm: sdi: Allocate the sdi private data structure dynamically
Laurent Pinchart [Tue, 13 Feb 2018 12:00:47 +0000 (14:00 +0200)]
drm: omapdrm: sdi: Allocate the sdi private data structure dynamically

The sdi private data structure is currently stored as a global
variable. While no platform with multiple SDI encoders currently exists
nor is planned, this doesn't comply with the kernel device model and
should thus be fixed.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agodrm: omapdrm: hdmi5: Allocate the omap_hdmi data structure dynamically
Laurent Pinchart [Tue, 13 Feb 2018 12:00:46 +0000 (14:00 +0200)]
drm: omapdrm: hdmi5: Allocate the omap_hdmi data structure dynamically

The omap_hdmi private data structure is currently stored as a global
variable. While no platform with multiple HDMI5 encoders currently
exists nor is planned, this doesn't comply with the kernel device model
and should thus be fixed.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agodrm: omapdrm: hdmi4: Allocate the omap_hdmi data structure dynamically
Laurent Pinchart [Tue, 13 Feb 2018 12:00:45 +0000 (14:00 +0200)]
drm: omapdrm: hdmi4: Allocate the omap_hdmi data structure dynamically

The omap_hdmi private data structure is currently stored as a global
variable. While no platform with multiple HDMI4 encoders currently
exists nor is planned, this doesn't comply with the kernel device model
and should thus be fixed.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agodrm: omapdrm: dispc: Allocate the dispc private data structure dynamically
Laurent Pinchart [Tue, 13 Feb 2018 12:00:44 +0000 (14:00 +0200)]
drm: omapdrm: dispc: Allocate the dispc private data structure dynamically

The dispc private data structure is currently stored as a global
variable. While no platform with multiple DISPC currently exists
nor is planned, this doesn't comply with the kernel device model and
should thus be fixed.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agodrm: omapdrm: dispc: Pass DISPC pointer to remaining dispc API functions
Laurent Pinchart [Tue, 13 Feb 2018 12:00:43 +0000 (14:00 +0200)]
drm: omapdrm: dispc: Pass DISPC pointer to remaining dispc API functions

This removes the need to access the global DISPC private data in those
functions (both for the current accesses and the future ones that will
be introduced when allocating the DISPC private data dynamically).

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agodrm: omapdrm: dispc: Pass DISPC pointer to dispc_ops operations
Laurent Pinchart [Tue, 13 Feb 2018 12:00:42 +0000 (14:00 +0200)]
drm: omapdrm: dispc: Pass DISPC pointer to dispc_ops operations

This removes the need to access the global DISPC private data in those
functions (both for the current accesses and the future ones that will
be introduced when allocating the DISPC private data dynamically).

In order to allow the omapdrm side to call the dispc_ops with a DISPC
pointer, we also introduce a new function dss_get_dispc() to retrieve
the DISPC corresponding to the DSS.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agodrm: omapdrm: dss: Store dispc ops in dss_device structure
Laurent Pinchart [Tue, 13 Feb 2018 12:00:41 +0000 (14:00 +0200)]
drm: omapdrm: dss: Store dispc ops in dss_device structure

Remove the global dispc ops variable by storing it in the dss_device
structure.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agodrm: omapdrm: dss: Store DSS device pointer in the omapdrm private data
Laurent Pinchart [Tue, 13 Feb 2018 12:00:40 +0000 (14:00 +0200)]
drm: omapdrm: dss: Store DSS device pointer in the omapdrm private data

The dss_device is the top-level component in the omapdss driver. Give
the omapdrm driver access to the dss_device pointer in order to obtain
pointers to all other components from it. This requires a new global
variable in the omapdss driver that will be removed when merging the
omapdrm and omapdss drivers, but will already allow removal of several
other global variables.

As this partly duplicates the omapdss_is_initialized() API, reimplement
it as an inline function wrapping omapdss_get_dss().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agodrm: omapdrm: dss: Pass omap_drm_private pointer to dss_mgr_ops
Laurent Pinchart [Tue, 13 Feb 2018 12:00:39 +0000 (14:00 +0200)]
drm: omapdrm: dss: Pass omap_drm_private pointer to dss_mgr_ops

The dss_mgr_ops operations implemented by the omapdrm side have to look
up the omap_crtc objects from global variables as they are only passed a
channel number. In order to remove global variables in the omapdrm
driver pass the omap_drm_private pointer to the dss_mgr_ops. This
requires storing a pointer to the omap_drm_private in a global variable
on the DSS side as a temporary measure until the omapdrm and omapdss
drivers get merged.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agodrm: omapdrm: dss: Pass omap_dss_device pointer to dss_mgr_*() functions
Laurent Pinchart [Tue, 13 Feb 2018 12:00:38 +0000 (14:00 +0200)]
drm: omapdrm: dss: Pass omap_dss_device pointer to dss_mgr_*() functions

The dss_mgr_*() functions take a channel argument to identify the
channel they operate on. This prevents the functions from accessing
driver data structures without resorting to global variables. In an
effort to remove global variables, pass the omap_dss_device pointer
associated with the channel instead. This will be used to look up the
omap_drm_private data structure to pass to the dss_mgr_ops.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agodrm: omapdrm: dsi: Don't pass channel to dispc init/uninit functions
Laurent Pinchart [Tue, 13 Feb 2018 12:00:37 +0000 (14:00 +0200)]
drm: omapdrm: dsi: Don't pass channel to dispc init/uninit functions

The dsi_display_init_dispc() and dsi_display_uninit_dispc() functions
take a channel argument that is reduntant as it is always identical to
the dsi->output.dispc_channel. Remove the argument and use the field
directly in the functions to avoid misuse.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agodrm: omapdrm: dsi: Store the struct device pointer in struct dsi_data
Laurent Pinchart [Tue, 13 Feb 2018 12:00:36 +0000 (14:00 +0200)]
drm: omapdrm: dsi: Store the struct device pointer in struct dsi_data

The dsi_data structure stores a pointer to a struct platform_device. The
driver only uses the dev member of the platform device structure. Store
the struct device pointer instead and use it directly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agodrm: omapdrm: dsi: Use dev pointer directly in dsi_bind() function
Laurent Pinchart [Tue, 13 Feb 2018 12:00:35 +0000 (14:00 +0200)]
drm: omapdrm: dsi: Use dev pointer directly in dsi_bind() function

The dsi_bind() function receives a pointer to a struct device that it
casts to a struct platform_device, only to use the platform device's dev
field through the code. Use the dev pointer directly.

While at it rename the struct platform_device pointer dsidev to pdev to
make it more explicit.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agodrm: omapdrm: dsi: Combine two commonly used inline functions
Laurent Pinchart [Tue, 13 Feb 2018 12:00:34 +0000 (14:00 +0200)]
drm: omapdrm: dsi: Combine two commonly used inline functions

The dsi_get_dsidrv_data() and dsi_get_dsidev_from_dssdev() inline
functions convert a struct omap_dss_device pointer to the corresponding
struct platform_device, and a struct platform_device pointer to the
corresponding struct dsi_data. They are nearly always called together
without any use of the intermediate platform_device, so combine them
into a single function.

In the three locations where only dsi_get_dsidrv_data() is used, call
dev_get_drvdata() directly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agodrm: omapdrm: dsi: Pass the dsi_data pointer to internal functions
Laurent Pinchart [Tue, 13 Feb 2018 12:00:33 +0000 (14:00 +0200)]
drm: omapdrm: dsi: Pass the dsi_data pointer to internal functions

Internal dsi functions take a pointer to the DSI platform_device and
then cast it to a dsi_data pointer. That's pointless as the caller
already has the dsi_data pointer. Pass it directly instead of the
platform_device pointer.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agodrm: omapdrm: dss: Don't unnecessarily cast to dev to pdev and back
Laurent Pinchart [Tue, 13 Feb 2018 12:00:32 +0000 (14:00 +0200)]
drm: omapdrm: dss: Don't unnecessarily cast to dev to pdev and back

The dss_unbind() function casts the struct device pointer to a struct
platform_device, only to later use the struct device pointer from
platform_device. Don't cast at all.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agodrm: omapdrm: dss: Store the debugfs root directory in struct dss_device
Laurent Pinchart [Tue, 13 Feb 2018 12:00:31 +0000 (14:00 +0200)]
drm: omapdrm: dss: Store the debugfs root directory in struct dss_device

As part of an effort to remove the usage of global variables in the
driver, store the debugfs root directory in the dss_device structure
instead of a global variable.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agodrm: omapdrm: dss: Store the registered plls array in struct dss_device
Laurent Pinchart [Tue, 13 Feb 2018 12:00:30 +0000 (14:00 +0200)]
drm: omapdrm: dss: Store the registered plls array in struct dss_device

As part of an effort to remove the usage of global variables in the
driver, store the registered plls array in the dss_device structure
instead of a global variable.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agodrm: omapdrm: dss: Support passing private data to debugfs show handlers
Laurent Pinchart [Tue, 13 Feb 2018 12:00:29 +0000 (14:00 +0200)]
drm: omapdrm: dss: Support passing private data to debugfs show handlers

To simplify implementation of debugfs seq_file show handlers, the driver
passes the pointer to the show function through the debugfs_create_file
data pointer. This prevents using the pointer to pass driver private
data to the show handler, and requires all handlers to use global
variables to access private data.

To prepare for the removal of global private data in the driver, rework
the debugfs infrastructure to allow passing a private data pointer to
show handlers.

The price to pay is explicit removal of debugfs files to free the
internally allocated memory. This is desirable anyway as debugfs entries
should be removed when a component driver is unbound, otherwise crashes
will occur due to access to freed memory when the components will be
dynamically allocated instead of stored in global variables.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agodrm: omapdrm: dss: Allocate the DSS private data structure dynamically
Laurent Pinchart [Tue, 13 Feb 2018 12:00:28 +0000 (14:00 +0200)]
drm: omapdrm: dss: Allocate the DSS private data structure dynamically

The DSS private data structure is currently stored as a global variable.
While no platform with multiple DSS devices currently exists nor is
planned, this doesn't comply with the kernel device model and should
thus be fixed.

Allocate the DSS private data structure dynamically for each DSS
instance and remove the global variable. All code that need access to
the structure now retrieves it dynamically so we can remove the global
variable.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agodrm: omapdrm: dss: Pass DSS pointer to remaining dss functions
Laurent Pinchart [Tue, 13 Feb 2018 12:00:27 +0000 (14:00 +0200)]
drm: omapdrm: dss: Pass DSS pointer to remaining dss functions

This removes the need to access the global DSS private data in those
functions (both for the current accesses and the future ones that will
be introduced when allocating the DSS device dynamically).

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agodrm: omapdrm: dss: Pass DSS pointer to dss clock functions
Laurent Pinchart [Tue, 13 Feb 2018 12:00:26 +0000 (14:00 +0200)]
drm: omapdrm: dss: Pass DSS pointer to dss clock functions

This removes the need to access the global DSS private data in those
functions (both for the current accesses and the future ones that will
be introduced when allocating the DSS device dynamically).

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agodrm: omapdrm: dss: Pass DSS pointer to dss_get_*_clk_source()
Laurent Pinchart [Tue, 13 Feb 2018 12:00:25 +0000 (14:00 +0200)]
drm: omapdrm: dss: Pass DSS pointer to dss_get_*_clk_source()

This removes the need to access the global DSS private data in those
functions (both for the current accesses and the future ones that will
be introduced when allocating the DSS device dynamically).

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agodrm: omapdrm: dss: Pass DSS pointer to dss_ops operations
Laurent Pinchart [Tue, 13 Feb 2018 12:00:24 +0000 (14:00 +0200)]
drm: omapdrm: dss: Pass DSS pointer to dss_ops operations

This removes the need to access the global DSS private data in those
functions (both for the current accesses and the future ones that will
be introduced when allocating the DSS device dynamically).

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agodrm: omapdrm: dss: Pass DSS pointer to dss_sdi_*() functions
Laurent Pinchart [Tue, 13 Feb 2018 12:00:23 +0000 (14:00 +0200)]
drm: omapdrm: dss: Pass DSS pointer to dss_sdi_*() functions

This removes the need to access the global DSS private data in those
functions (both for the current accesses and the future ones that will
be introduced when allocating the DSS device dynamically).

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agodrm: omapdrm: dss: Pass PLL pointer to dss_ctrl_pll_enable()
Laurent Pinchart [Tue, 13 Feb 2018 12:00:22 +0000 (14:00 +0200)]
drm: omapdrm: dss: Pass PLL pointer to dss_ctrl_pll_enable()

This will allow accessing the PLL data to get the DSS device pointer,
removing the need to access the global DSS private data.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agodrm: omapdrm: dss: Pass DSS private structure to runtime PM functions
Laurent Pinchart [Tue, 13 Feb 2018 12:00:21 +0000 (14:00 +0200)]
drm: omapdrm: dss: Pass DSS private structure to runtime PM functions

To prepare for the removal of the global variable storing DSS private
data, pass its pointer to the dss_runtime_{get,put}() functions.

As this requires getting hold of the dss_device structure in the
callers, we add a new dss_get_device() function to retrieve it. The
function currently returns a pointer to the global data structure, and
will later be updated to get the pointer from device driver data when
the DSS private structure will be allocated dynamically.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agodrm: omapdrm: dss: Expose DSS data in a dss_device structure
Laurent Pinchart [Tue, 13 Feb 2018 12:00:20 +0000 (14:00 +0200)]
drm: omapdrm: dss: Expose DSS data in a dss_device structure

The anoonymous dss structure in dss.c is the top-level component in the
omapdss driver. As such it should store all internal instance-specific
data that is currently stored in global variables. This however requires
both naming the structure to pass it around functions, and accessing it
from various locations in the omapdss driver. While we could implement
get and set functions for every field that needs to be accessed outside
of dss.c, that would introduce overhead and complexity that we could
avoid by exposing the structure to internal components of the omapdss
driver. Do so to prepare for removal of global variables.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agodrm: omapdrm: Split init and cleanup from probe and remove functions
Laurent Pinchart [Tue, 13 Feb 2018 12:00:19 +0000 (14:00 +0200)]
drm: omapdrm: Split init and cleanup from probe and remove functions

When merging the omapdrm and omapdss drivers there will be not omapdrm
platform device anymore, and thus no associated probe and remove
functions. To prepare for that, split all the initialization code from
the probe function to make it usable without a platform device.
Similarly, split the cleanup code from the remove function.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agodrm: omapdrm: dsi: Make wait_for_bit_change() return a status
Laurent Pinchart [Sun, 11 Feb 2018 13:07:47 +0000 (15:07 +0200)]
drm: omapdrm: dsi: Make wait_for_bit_change() return a status

The wait_for_bit_change() function returns the value of the bit it
polls. This requires the caller to compare the return value to the
expected bit value. As all the existing callers need is to check whether
the bit has reached the expected value, it's easier to return a boolean
status from the function.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
6 years agodrm: omapdrm: dss: Remove unused functions prototypes
Laurent Pinchart [Sun, 11 Feb 2018 13:07:46 +0000 (15:07 +0200)]
drm: omapdrm: dss: Remove unused functions prototypes

The omap_dss_register_driver(), omap_dss_unregister_driver() and
dispc_enable_gamma_table() functions don't exist anymore, remove their
prototypes.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
6 years agodrm: omapdrm: dss: Remove dss_get_hdmi_venc_clk_source() function
Laurent Pinchart [Sun, 11 Feb 2018 13:07:45 +0000 (15:07 +0200)]
drm: omapdrm: dss: Remove dss_get_hdmi_venc_clk_source() function

The function is unused, remove it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
6 years agodrm: omapdrm: dss: Move initialization code from component bind to probe
Laurent Pinchart [Sun, 11 Feb 2018 13:07:44 +0000 (15:07 +0200)]
drm: omapdrm: dss: Move initialization code from component bind to probe

There's no reason to delay initialization of most of the driver (such as
mapping memory I/O, getting clocks or enabling runtime PM) to the
component master bind handler.

This additionally fixes a real PM issue caused enabling runtime PM in
the bind handler.

The bind handler performs the following sequence of PM operations:

pm_runtime_enable(dev);
pm_runtime_get_sync(dev);

... (access the hardware to read the device revision) ...

pm_runtime_put_sync(dev);

If a failure occurs at this point, the error path calls
pm_runtime_disable() to balance the pm_runtime_enable() call.

To understand the problem, it should be noted that the bind handler is
called when one of the component registers itself, which happens in the
component's probe handler. Furthermore, as the components are children
of the DSS, the device core calls pm_runtime_get_sync() on the DSS
platform device before calling the component's probe handler. This
increases the DSS power usage count but doesn't runtime resume the
device, as runtime PM is disabled at that point.

The bind handler is thus called with runtime PM disabled, with the
device runtime suspended, but with the power usage count larger than 0.
The pm_runtime_get_sync() call will thus further increase the power
usage count and runtime resume the device. The pm_runtime_put_sync()
handler will decrease the power usage count to a non-zero value and will
thus not suspend the device. Finally, the pm_runtime_disable() call will
disable runtime PM, preventing the pm_runtime_put() call in the device
core from runtime suspending the device. The DSS device is thus left
powered on.

To fix this, move the initialization code from the bind handler to the
probe handler.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
6 years agodrm: omapdrm: dss: Don't export functions internal to omapdss-base
Laurent Pinchart [Sun, 11 Feb 2018 13:07:43 +0000 (15:07 +0200)]
drm: omapdrm: dss: Don't export functions internal to omapdss-base

A few functions defined in omapdss-base are internal to the module.
Don't export them.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
6 years agodrm: omapdrm: dss: Make omapdss_default_get_timings static
Laurent Pinchart [Sun, 11 Feb 2018 13:07:42 +0000 (15:07 +0200)]
drm: omapdrm: dss: Make omapdss_default_get_timings static

The function isn't used outside of its compilation unit, make it static.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
6 years agodrm: omapdrm: displays: Get encoder source at connect time
Laurent Pinchart [Sun, 11 Feb 2018 13:07:41 +0000 (15:07 +0200)]
drm: omapdrm: displays: Get encoder source at connect time

The encoder drivers need a handle to the source they are connected to in
order to control the source.

All drivers get that handle at probe time, resulting in probe deferral
when the source hasn't been probed yet. However they don't need the
handle until their connect handler is called.

Move retrieval of the source handle to the connect handler to avoid
probe deferrals.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
6 years agodrm: omapdrm: displays: Get panel source at connect time
Laurent Pinchart [Sun, 11 Feb 2018 13:07:40 +0000 (15:07 +0200)]
drm: omapdrm: displays: Get panel source at connect time

The connector drivers need a handle to the source they are connected to
in order to control the source.

All drivers get that handle at probe time, resulting in probe deferral
when the source hasn't been probed yet. However they don't need the
handle until their connect handler is called.

Move retrieval of the source handle to the connect handler to avoid
probe deferrals.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
6 years agodrm: omapdrm: displays: Get connector source at connect time
Laurent Pinchart [Sun, 11 Feb 2018 13:07:39 +0000 (15:07 +0200)]
drm: omapdrm: displays: Get connector source at connect time

The connector drivers need a handle to the source they are connected to
in order to control the source.

All drivers get that handle at probe time, resulting in probe deferral
when the source hasn't been probed yet. However they don't need the
handle until their connect handler is called.

Move retrieval of the source handle to the connect handler to avoid
probe deferrals.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
6 years agodrm: omapdrm: displays: Remove OF node check in panel drivers
Laurent Pinchart [Sun, 11 Feb 2018 13:07:38 +0000 (15:07 +0200)]
drm: omapdrm: displays: Remove OF node check in panel drivers

No panel is instantiated through platform data anymore, there is no
need to check for OF node presence.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
6 years agodrm: omapdrm: displays: Remove OF node check in encoder drivers
Laurent Pinchart [Sun, 11 Feb 2018 13:07:37 +0000 (15:07 +0200)]
drm: omapdrm: displays: Remove OF node check in encoder drivers

No encoder is instantiated through platform data anymore, there is no
need to check for OF node presence.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
6 years agodrm: omapdrm: displays: Remove OF node check in connector drivers
Laurent Pinchart [Sun, 11 Feb 2018 13:07:36 +0000 (15:07 +0200)]
drm: omapdrm: displays: Remove OF node check in connector drivers

No connector is instantiated through platform data anymore, there is no
need to check for OF node presence.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
6 years agodrm: omapdrm: connector-analog-tv: Remove tvc_of_match forward declaration
Laurent Pinchart [Sun, 11 Feb 2018 13:07:35 +0000 (15:07 +0200)]
drm: omapdrm: connector-analog-tv: Remove tvc_of_match forward declaration

The tvc_of_match variable is never referenced before its definition.
Remove the forward declaration.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
6 years agodrm: omapdrm: Use unsigned int type
Laurent Pinchart [Sun, 11 Feb 2018 13:07:34 +0000 (15:07 +0200)]
drm: omapdrm: Use unsigned int type

The kernel favours 'unsigned int' over plain 'unsigned'. Replace all
occurences of the latter by the former. This avoid lots of checkpatch
complaints in patches that touch lines where a plain 'unsigned' is used.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
6 years agodrm: omapdrm: Use kernel integer types
Laurent Pinchart [Sun, 11 Feb 2018 13:07:33 +0000 (15:07 +0200)]
drm: omapdrm: Use kernel integer types

The standard kernel integer types are [us]{8,16,32}. Use them instead of
the u?int{8,16,32}_t types.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
6 years agoMerge tag 'drm-intel-next-2018-02-21' of git://anongit.freedesktop.org/drm/drm-intel...
Dave Airlie [Thu, 1 Mar 2018 04:07:22 +0000 (14:07 +1000)]
Merge tag 'drm-intel-next-2018-02-21' of git://anongit.freedesktop.org/drm/drm-intel into drm-next

Driver Changes:

- Lift alpha_support protection from Cannonlake (Rodrigo)
* Meaning the driver should mostly work for the hardware we had
  at our disposal when testing
* Used to be preliminary_hw_support
- Add missing Cannonlake PCI device ID of 0x5A4C (Rodrigo)
- Cannonlake port register fix (Mahesh)

- Fix Dell Venue 8 Pro black screen after modeset (Hans)
- Fix for always returning zero out-fence from execbuf (Daniele)
- Fix HDMI audio when no no relevant video output is active (Jani)
- Fix memleak of VBT data on driver_unload (Hans)

- Fix for KASAN found locking issue (Maarten)
- RCU barrier consolidation to improve igt/gem_sync/idle (Chris)
- Optimizations to IRQ handlers (Chris)
- vblank tracking improvements (64-bit resolution, PM) (Dhinakaran)
- Pipe select bit corrections (Ville)
- Reduce runtime computed device_info fields (Chris)
- Tune down some WARN_ONs to GEM_BUG_ON now that CI has good coverage (Chris)
- A bunch of kerneldoc warning fixes (Chris)

* tag 'drm-intel-next-2018-02-21' of git://anongit.freedesktop.org/drm/drm-intel: (113 commits)
  drm/i915: Update DRIVER_DATE to 20180221
  drm/i915/fbc: Use PLANE_HAS_FENCE to determine if the plane is fenced
  drm/i915/fbdev: Use the PLANE_HAS_FENCE flags from the time of pinning
  drm/i915: Move the policy for placement of the GGTT vma into the caller
  drm/i915: Also check view->type for a normal GGTT view
  drm/i915: Drop WaDoubleCursorLP3Latency:ivb
  drm/i915: Set the primary plane pipe select bits on gen4
  drm/i915: Don't set cursor pipe select bits on g4x+
  drm/i915: Assert that we don't overflow frontbuffer tracking bits
  drm/i915: Track number of pending freed objects
  drm/i915/: Initialise trans_min for skl_compute_transition_wm()
  drm/i915: Clear the in-use marker on execbuf failure
  drm/i915: Prune gen8_gt_irq_handler
  drm/i915: Track GT interrupt handling using the master iir
  drm/i915: Remove WARN_ONCE for failing to pm_runtime_if_in_use
  drm: intel_dpio_phy: fix kernel-doc comments at nested struct
  drm/i915: Release connector iterator on a digital port conflict.
  drm/i915/execlists: Remove too early assert
  drm/i915: Assert that we always complete a submission to guc/execlists
  drm: move read_domains and write_domain into i915
  ...

6 years agoMerge tag 'tilcdc-4.17' of https://github.com/jsarha/linux into drm-next
Dave Airlie [Thu, 1 Mar 2018 04:04:30 +0000 (14:04 +1000)]
Merge tag 'tilcdc-4.17' of https://github.com/jsarha/linux into drm-next

drm/tilcdc changes to v4.17

* tag 'tilcdc-4.17' of https://github.com/jsarha/linux:
  drm/tilcdc: tilcdc_panel: Rename device from "panel" to "tilcdc-panel"
  drm/tilcdc: Add support for drm panels
  drm/tilcdc: panel: Use common error handling code in of_get_panel_info()
  drm/tilcdc: Delete an error message for a failed memory allocation in seven functions

6 years agodrm/tilcdc: tilcdc_panel: Rename device from "panel" to "tilcdc-panel"
Jyri Sarha [Wed, 21 Feb 2018 16:38:24 +0000 (18:38 +0200)]
drm/tilcdc: tilcdc_panel: Rename device from "panel" to "tilcdc-panel"

Rename the bundled tilcdc_panel driver from just "panel" to
"tilcdc-panel" to avoid noisy error messages from the driver trying to
probe all device nodes named "panel".

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
6 years agodrm/tilcdc: Add support for drm panels
Jyri Sarha [Sun, 18 Feb 2018 17:48:32 +0000 (19:48 +0200)]
drm/tilcdc: Add support for drm panels

Add support for drm panels to tilcdc. Adding the support on top of the
existing bridge support needs only couple of lines of code when using
using the drm panel bridge helpers.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
6 years agodrm/tilcdc: panel: Use common error handling code in of_get_panel_info()
Markus Elfring [Tue, 6 Feb 2018 21:10:11 +0000 (22:10 +0100)]
drm/tilcdc: panel: Use common error handling code in of_get_panel_info()

Add a jump target so that a bit of exception handling can be better reused
at the end of this function.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Jyri Sarha <jsarha@ti.com>
6 years agodrm/tilcdc: Delete an error message for a failed memory allocation in seven functions
Markus Elfring [Tue, 6 Feb 2018 20:51:15 +0000 (21:51 +0100)]
drm/tilcdc: Delete an error message for a failed memory allocation in seven functions

Omit an extra message for a memory allocation failure in these functions.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Jyri Sarha <jsarha@ti.com>
6 years agoMerge branch 'drm-next-4.17' of git://people.freedesktop.org/~agd5f/linux into drm...
Dave Airlie [Wed, 28 Feb 2018 01:44:29 +0000 (11:44 +1000)]
Merge branch 'drm-next-4.17' of git://people.freedesktop.org/~agd5f/linux into drm-next

- Expose thermal thresholds through hwmon properly
- Rework HDP flushing for rings and CPU
- Improved dual-link DVI handling in DC
- Lots of code clean up
- Additional DC clean up
- Allow scanout from system memory on CZ/BR/ST
- Improved PASID/VM integration
- Expose GPU voltage and power via hwmon
- Initial wattman-like support
- Initial power profiles for use-case optimized performance
- Rework GPUVM TLB flushing
- Rework IP offset handling for SOC15 asics
- Add CRC support in DC
- Fixes for mmhub powergating
- Initial regamma/degamma/CTM support in DC
- ttm cleanups and simplifications
- ttm OOM avoidance fixes

* 'drm-next-4.17' of git://people.freedesktop.org/~agd5f/linux: (348 commits)
  Revert "drm/radeon/pm: autoswitch power state when in balanced mode"
  drm/radeon: use drm_gem_private_object_init
  drm/amdgpu: use drm_gem_private_object_init
  drm/amdgpu: mitigate workaround for i915
  drm/amdgpu: implement amdgpu_gem_map_(attach/detach)
  drm/amdgpu/powerplay/smu7: drop refresh rate checks for mclk switching
  drm/amdgpu/cgs: add refresh rate checking to non-DC display code
  drm/amd/powerplay/smu7: allow mclk switching with no displays
  drm/amd/powerplay/vega10: allow mclk switching with no displays
  drm/amd/powerplay: use PP_CAP macro for disable_mclk_switching_for_frame_lock
  drm/amd/powerplay: remove unused headers
  drm/amdgpu_gem: fix error handling path in amdgpu_gem_va_update_vm
  drm/amdgpu: update the PASID mapping only on demand
  drm/amdgpu: separate PASID mapping from VM flush v2
  drm/amd/display: Fix increment when sampling OTF in DCE
  drm/amd/display: De PQ implementation
  drm/amd/display: Remove unused dm_pp_ interfaces
  drm/amd/display: Add logging for aux DPCD access
  drm/amd/display: Set vsc pack revision when DPCD revision is >= 1.2
  drm/amd/display: provide an interface to query firmware version
  ...

6 years agoMerge tag 'drm-misc-next-2018-02-21' of git://anongit.freedesktop.org/drm/drm-misc...
Dave Airlie [Fri, 23 Feb 2018 01:12:52 +0000 (11:12 +1000)]
Merge tag 'drm-misc-next-2018-02-21' of git://anongit.freedesktop.org/drm/drm-misc into drm-next

drm-misc-next for 4.17:

Cross-subsystem Changes:
- Backlight helpers to enable/disable and find devices in dt (Meghana)

Core Changes:
- Documentation improvements (Chris/Daniel/Jani)
- simple_kms_helper: Add mode_valid() support (Linus)
- mm: Fix bug in interval_tree causing nodes to be out-of-order (Chris)

Driver Changes:
- tinydrm/panel: Use the new backlight helpers (Meghana)
- rockchip: Support gem_prime_import_sg_table + some fixes (Various)
- sun4i: Add A83T HDMI support using dw-hdmi (Jernej)

Cc: Meghana Madhyastha <meghana.madhyastha@gmail.com>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: Jernej Skrabec <jernej.skrabec@siol.net>
* tag 'drm-misc-next-2018-02-21' of git://anongit.freedesktop.org/drm/drm-misc: (41 commits)
  drm/omapdrm: Use of_find_backlight helper
  drm/panel: Use of_find_backlight helper
  drm/omapdrm: Use backlight_enable/disable helpers
  drm/panel: Use backlight_enable/disable helpers
  drm/tinydrm: Call devres version of of_find_backlight
  drm/tinydrm: Replace tinydrm_of_find_backlight with of_find_backlight
  drm/tinydrm: Convert tinydrm_enable/disable_backlight to backlight_enable/disable
  drm: add documentation for tv connector state margins
  drm/doc: Use new substruct support
  drm/doc: Polish for drm_mode_parse_command_line_for_connector
  drm/docs: Document "scaling mode" property better
  drm/docs: Align layout of optional plane blending properties
  drm/docs: Discourage adding more to kms-properties.csv
  drm: simple_kms_helper: Add mode_valid() callback support
  drm/todo: Add idr_init_base todo
  drm: Use idr_init_base(1) when using id==0 for invalid
  drm: NULL pointer dereference [null-pointer-deref] (CWE 476) problem
  drm: NULL pointer dereference [null-pointer-deref] (CWE 476) problem
  dma-buf/sw_sync: Fix kerneldoc warnings
  drm: Fix kerneldoc warnings for drm_lease
  ...

6 years agodrm/i915: Update DRIVER_DATE to 20180221
Joonas Lahtinen [Wed, 21 Feb 2018 13:21:30 +0000 (15:21 +0200)]
drm/i915: Update DRIVER_DATE to 20180221

Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
6 years agoRevert "drm/radeon/pm: autoswitch power state when in balanced mode"
Alex Deucher [Thu, 15 Feb 2018 13:40:30 +0000 (08:40 -0500)]
Revert "drm/radeon/pm: autoswitch power state when in balanced mode"

This reverts commit 1c331f75aa6ccbf64ebcc5a019183e617c9d818a.

Breaks resume on some systems.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=100759
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
6 years agoMerge branch 'drm/next/du' of git://linuxtv.org/pinchartl/media into drm-next
Dave Airlie [Tue, 20 Feb 2018 21:03:35 +0000 (07:03 +1000)]
Merge branch 'drm/next/du' of git://linuxtv.org/pinchartl/media into drm-next

LVDS startup fixes, enable VSP compositor on GEN3

* 'drm/next/du' of git://linuxtv.org/pinchartl/media:
  drm: rcar-du: lvds: Refactor LVDS startup
  drm: rcar-du: lvds: Fix LVDS startup on R-Car Gen3
  drm: rcar-du: lvds: Fix LVDS startup on R-Car Gen2
  drm: rcar-du: lvds: Fix LVDS clock frequency range
  drm: rcar-du: lvds: Fix LVDCR1 for R-Car gen3
  drm: rcar-du: Enable VSP compositor by default on Gen3
  drm: rcar-du: Calculate DPLLCR to be more small jitter
  drm: rcar-du: Use 1000 to avoid misunderstanding in rcar_du_dpll_divider()
  drm: rcar-du: Remove zpos field from rcar_du_vsp_plane_state structure

6 years agodrm/radeon: use drm_gem_private_object_init
Christian König [Fri, 16 Feb 2018 09:08:24 +0000 (10:08 +0100)]
drm/radeon: use drm_gem_private_object_init

We use our own backing store and don't need the shmem file.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: use drm_gem_private_object_init
Christian König [Fri, 16 Feb 2018 08:52:51 +0000 (09:52 +0100)]
drm/amdgpu: use drm_gem_private_object_init

We use our own backing store and don't need the shmem file.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: mitigate workaround for i915
Christian König [Mon, 19 Feb 2018 10:29:35 +0000 (11:29 +0100)]
drm/amdgpu: mitigate workaround for i915

To be able to use DRI_PRIME with amdgpu and i915 we add all our fences
only as exclusive ones.

Disable that behavior when sharing between amdgpu itself cause it
hinders concurrent execution.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: implement amdgpu_gem_map_(attach/detach)
Christian König [Fri, 16 Feb 2018 12:16:11 +0000 (13:16 +0100)]
drm/amdgpu: implement amdgpu_gem_map_(attach/detach)

Instead of the pin/unpin callback implement the attach/detach ones.

Functional identical, but allows us access to the attachment.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/i915/fbc: Use PLANE_HAS_FENCE to determine if the plane is fenced
Chris Wilson [Tue, 20 Feb 2018 13:42:08 +0000 (13:42 +0000)]
drm/i915/fbc: Use PLANE_HAS_FENCE to determine if the plane is fenced

Rather than trusting the cached value of plane_state->vma->fence to
imply whether the plane_state itself holds a reference on the
framebuffer's fence, use the information provided in the
plane_state->flags (PLANE_HAS_FENCE). Note that we still assume that FBC
is entirely bounded by the plane_state active life span; it's not clear
if that is a safe assumption.

Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180220134208.24988-4-chris@chris-wilson.co.uk
6 years agodrm/i915/fbdev: Use the PLANE_HAS_FENCE flags from the time of pinning
Chris Wilson [Tue, 20 Feb 2018 13:42:07 +0000 (13:42 +0000)]
drm/i915/fbdev: Use the PLANE_HAS_FENCE flags from the time of pinning

Use the information about the fence state from the time of pinning to
determine if the fbdev writes are going through a fence. This avoids any
confusion in cases where the fence may appear or disappear unconnected
to the use by fbdev.

Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180220134208.24988-3-chris@chris-wilson.co.uk
6 years agodrm/i915: Move the policy for placement of the GGTT vma into the caller
Chris Wilson [Tue, 20 Feb 2018 13:42:06 +0000 (13:42 +0000)]
drm/i915: Move the policy for placement of the GGTT vma into the caller

Currently we make the unilateral decision inside
i915_gem_object_pin_to_display() where the VMA should resided (inside
the fence and mappable region or above?). This is not our decision to
make as it impacts on how the display engine can use the resulting
scanout object, and it would rather instruct us where to place the VMA so
that it can enable the features it wants. As such, make the pin flags an
argument to i915_gem_object_pin_to_display() and control them from
intel_pin_and_fence_fb_obj()

Whilst taking control of the mapping for ourselves, start tracking how
we use it to avoid trying to free a fence we never claimed:

<3>[  227.151869] GEM_BUG_ON(vma->fence->pin_count <= 0)
<4>[  227.152064] ------------[ cut here ]------------
<2>[  227.152068] kernel BUG at drivers/gpu/drm/i915/i915_vma.h:391!
<4>[  227.152084] invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI
<0>[  227.152092] Dumping ftrace buffer:
<0>[  227.152099]    (ftrace buffer empty)
<4>[  227.152102] Modules linked in: i915 snd_hda_codec_analog snd_hda_codec_generic coretemp snd_hda_intel snd_hda_codec snd_hwdep snd_hda_core snd_pcm lpc_ich e1000e mei_me mei prime_numbers
<4>[  227.152131] CPU: 1 PID: 1587 Comm: kworker/u16:49 Tainted: G     U           4.16.0-rc1-gbab67b2f6177-kasan_7+ #1
<4>[  227.152134] Hardware name: Dell Inc. OptiPlex 755                 /0PU052, BIOS A08 02/19/2008
<4>[  227.152236] Workqueue: events_unbound intel_atomic_commit_work [i915]
<4>[  227.152292] RIP: 0010:intel_unpin_fb_vma+0x23a/0x2a0 [i915]
<4>[  227.152295] RSP: 0018:ffff88005aad7b68 EFLAGS: 00010286
<4>[  227.152300] RAX: 0000000000000026 RBX: ffff88005c359580 RCX: 0000000000000000
<4>[  227.152304] RDX: 0000000000000026 RSI: ffffffff8707d840 RDI: ffffed000b55af63
<4>[  227.152307] RBP: ffff880056817e58 R08: 0000000000000001 R09: 0000000000000000
<4>[  227.152311] R10: ffff88005aad7b88 R11: 0000000000000000 R12: ffff8800568184d0
<4>[  227.152314] R13: ffff880065b5ab08 R14: 0000000000000000 R15: dffffc0000000000
<4>[  227.152318] FS:  0000000000000000(0000) GS:ffff88006ac40000(0000) knlGS:0000000000000000
<4>[  227.152322] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
<4>[  227.152325] CR2: 00007f5fb25550a8 CR3: 0000000068c78000 CR4: 00000000000006e0
<4>[  227.152328] Call Trace:
<4>[  227.152385]  intel_cleanup_plane_fb+0x6b/0xd0 [i915]
<4>[  227.152395]  drm_atomic_helper_cleanup_planes+0x166/0x280
<4>[  227.152452]  intel_atomic_commit_tail+0x159d/0x3380 [i915]
<4>[  227.152463]  ? process_one_work+0x66e/0x1460
<4>[  227.152516]  ? skl_update_crtcs+0x9c0/0x9c0 [i915]
<4>[  227.152523]  ? lock_acquire+0x13d/0x390
<4>[  227.152527]  ? lock_acquire+0x13d/0x390
<4>[  227.152534]  process_one_work+0x71a/0x1460
<4>[  227.152540]  ? __schedule+0x815/0x1e20
<4>[  227.152547]  ? pwq_dec_nr_in_flight+0x2b0/0x2b0
<4>[  227.152553]  ? _raw_spin_lock_irq+0xa/0x40
<4>[  227.152559]  worker_thread+0xdf/0xf60
<4>[  227.152569]  ? process_one_work+0x1460/0x1460
<4>[  227.152573]  kthread+0x2cf/0x3c0
<4>[  227.152578]  ? _kthread_create_on_node+0xa0/0xa0
<4>[  227.152583]  ret_from_fork+0x3a/0x50
<4>[  227.152591] Code: c6 00 11 86 c0 48 c7 c7 e0 bd 85 c0 e8 60 e7 a9 c4 0f ff e9 1f fe ff ff 48 c7 c6 40 10 86 c0 48 c7 c7 e0 ca 85 c0 e8 2b 95 bd c4 <0f> 0b 48 89 ef e8 4c 44 e8 c4 e9 ef fd ff ff e8 42 44 e8 c4 e9
<1>[  227.152720] RIP: intel_unpin_fb_vma+0x23a/0x2a0 [i915] RSP: ffff88005aad7b68

v2: i915_vma_pin_fence() is a no-op if a fence isn't required, so check
vma->fence as well.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180220134208.24988-2-chris@chris-wilson.co.uk
6 years agodrm/i915: Also check view->type for a normal GGTT view
Chris Wilson [Tue, 20 Feb 2018 13:42:05 +0000 (13:42 +0000)]
drm/i915: Also check view->type for a normal GGTT view

We cannot simply use !view as shorthand for all normal GGTT views as a
few callers will always populate a i915_ggtt_view struct and set the
type to NORMAL instead. So check for (!view || view->type == NORMAL)
inside i915_gem_object_ggtt_pin().

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180220134208.24988-1-chris@chris-wilson.co.uk
6 years agodrm/i915: Drop WaDoubleCursorLP3Latency:ivb
Ville Syrjälä [Tue, 30 Jan 2018 20:38:06 +0000 (22:38 +0200)]
drm/i915: Drop WaDoubleCursorLP3Latency:ivb

WaDoubleCursorLP3Latency was meant for pre-production hardware.
Drop it.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180130203807.13721-6-ville.syrjala@linux.intel.com
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
6 years agodrm/i915: Set the primary plane pipe select bits on gen4
Ville Syrjälä [Tue, 30 Jan 2018 20:38:02 +0000 (22:38 +0200)]
drm/i915: Set the primary plane pipe select bits on gen4

i965 and g4x still have the pipe select bits in the plane control
registers, they're just hardcoded to select a specific pipe. However
plane C on i965 can still move between the pipes, thus we should
program the pipe select bits on i965 if we want to expose plane C
some day.

Since there is no harm in programming the bits on any plane on
i965/g4x let's just always set them. This will also make our
pre-computed register value match what the hardware register
would read, should we want to cross check the two.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180130203807.13721-2-ville.syrjala@linux.intel.com
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
6 years agodrm/i915: Don't set cursor pipe select bits on g4x+
Ville Syrjälä [Tue, 30 Jan 2018 20:38:01 +0000 (22:38 +0200)]
drm/i915: Don't set cursor pipe select bits on g4x+

G4x cursor control registers still allow us to write to the pipe select
bits even though cursors are supposed to be fixed to a specific pipe.
Bspec tells us that we should only ever write 0 to these bits. Let's
follow that recommendation. On ilk+ the bits become hardwired to 0.

Also looks like ICL repurposes these bits for some other use, so
we had better stop setting them to bogus values there.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180130203807.13721-1-ville.syrjala@linux.intel.com
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
6 years agodrm/i915: Assert that we don't overflow frontbuffer tracking bits
Ville Syrjälä [Wed, 24 Jan 2018 18:36:42 +0000 (20:36 +0200)]
drm/i915: Assert that we don't overflow frontbuffer tracking bits

Add some compile time assrts to the frontbuffer tracking to make sure
that we have enough bits per pipe to cover all the planes, and that we
have enough total bits to cover all the planes across all pipes.

We'll ignore any potential clash between the overlay bit and the
plane bits because that will allow us to keep using a total of 32
bits for the foreseeable future.

While at it change the macros to use BIT() and GENMASK(). The latter
gets rid of the hardcoded 0xff and thus means we can change the
number of bits per pipe by just changing
INTEL_FRONTBUFFER_BITS_PER_PIPE.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180124183642.32549-1-ville.syrjala@linux.intel.com
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
6 years agodrm/omapdrm: Use of_find_backlight helper
Meghana Madhyastha [Wed, 24 Jan 2018 16:41:38 +0000 (16:41 +0000)]
drm/omapdrm: Use of_find_backlight helper

Replace of_find_backlight_by_node and of the code around it
with of_find_backlight helper to avoid repetition of code.

Reviewed-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Meghana Madhyastha <meghana.madhyastha@gmail.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/eb914313f9d0e58d81572ccd3c718a573a891bd7.1516810726.git.meghana.madhyastha@gmail.com
6 years agodrm/panel: Use of_find_backlight helper
Meghana Madhyastha [Wed, 24 Jan 2018 16:40:51 +0000 (16:40 +0000)]
drm/panel: Use of_find_backlight helper

Replace of_find_backlight_by_node and of the code around it
with of_find_backlight helper to avoid repetition of code.

Reviewed-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Meghana Madhyastha <meghana.madhyastha@gmail.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/140d01afb138d687680b2d1776a4c101c9fa9a0a.1516810725.git.meghana.madhyastha@gmail.com
6 years agodrm/omapdrm: Use backlight_enable/disable helpers
Meghana Madhyastha [Wed, 24 Jan 2018 16:40:12 +0000 (16:40 +0000)]
drm/omapdrm: Use backlight_enable/disable helpers

Use backlight_enable/disable helpers instead of changing
the property and calling backlight_update_status for cleaner
and simpler code and also to avoid repetitions.

Reviewed-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Meghana Madhyastha <meghana.madhyastha@gmail.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/30d5b26c3c7d75de3d2ab3cff9dee67084fc3caf.1516810725.git.meghana.madhyastha@gmail.com
6 years agodrm/panel: Use backlight_enable/disable helpers
Meghana Madhyastha [Wed, 24 Jan 2018 16:39:27 +0000 (16:39 +0000)]
drm/panel: Use backlight_enable/disable helpers

Use backlight_enable/disable helpers instead of changing
the property and calling backlight_update_status for cleaner
and simpler code and also to avoid repetitions.

Reviewed-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Meghana Madhyastha <meghana.madhyastha@gmail.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/bc80cdb5cf1a6638dce9fb9f8da674e361e3b749.1516810725.git.meghana.madhyastha@gmail.com
6 years agodrm/tinydrm: Call devres version of of_find_backlight
Meghana Madhyastha [Wed, 24 Jan 2018 16:37:56 +0000 (16:37 +0000)]
drm/tinydrm: Call devres version of of_find_backlight

Call devm_of_find_backlight (the devres version) instead of
of_find_backlight.

Reviewed-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Meghana Madhyastha <meghana.madhyastha@gmail.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/244cd4d567cb3944a8cb7633715ffc8ac4e1ce83.1516810725.git.meghana.madhyastha@gmail.com
6 years agodrm/tinydrm: Replace tinydrm_of_find_backlight with of_find_backlight
Meghana Madhyastha [Wed, 24 Jan 2018 16:36:09 +0000 (16:36 +0000)]
drm/tinydrm: Replace tinydrm_of_find_backlight with of_find_backlight

Remove tinydrm_of_find_backlight from tinydrm-helpers.c. We now have
a generic of_find_backlight defined in backlight.c. Let the callers
of tinydrm_of_find_backlight call of_find_backlight. Also, remove
select BACKLIGHT_LCD_SUPPORT and select BACKLIGHT_CLASS_DEVICE from
tinydrm/Kconfig as it is a hack that is no longer needed.

Reviewed-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Meghana Madhyastha <meghana.madhyastha@gmail.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/11dd1cabd098a730d07ab04c5987b139d14d8b21.1516810725.git.meghana.madhyastha@gmail.com
6 years agodrm/tinydrm: Convert tinydrm_enable/disable_backlight to backlight_enable/disable
Meghana Madhyastha [Wed, 24 Jan 2018 16:34:48 +0000 (16:34 +0000)]
drm/tinydrm: Convert tinydrm_enable/disable_backlight to backlight_enable/disable

Remove tinydrm_enable/disable_backlight and let the callers call the
more generic backlight_enable/disable helpers

Reviewed-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Meghana Madhyastha <meghana.madhyastha@gmail.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/ec700724e47814e6426966e093bd32b2364ba147.1516810725.git.meghana.madhyastha@gmail.com
6 years agoMerge tag 'topic/backlight_for_lag-2018-01-29' of git://anongit.freedesktop.org/drm...
Sean Paul [Tue, 20 Feb 2018 15:33:04 +0000 (10:33 -0500)]
Merge tag 'topic/backlight_for_lag-2018-01-29' of git://anongit.freedesktop.org/drm/drm-misc into drm-misc-next

This contains the backlight portion of Meghana Madhyastha's patch set to
migrate the backlight helpers from tinydrm to the backlight subsystem.

https://patchwork.freedesktop.org/series/36522/

Cc: Meghana Madhyastha <meghana.madhyastha@gmail.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
# gpg: Signature made Mon 29 Jan 2018 02:25:40 PM EST
# gpg:                using RSA key 7F17297CC4A076740CB3E42A96F70DFDA84A070A
# gpg: Good signature from "Sean Paul <seanpaul@chromium.org>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 1C5E AB9E D7C9 DDE9 E7F2  087C 732C 0025 72DC AF79
#      Subkey fingerprint: 7F17 297C C4A0 7674 0CB3  E42A 96F7 0DFD A84A 070A
Link: https://patchwork.freedesktop.org/patch/msgid/20180129192950.bvmhkz3h42t5a25r@art_vandelay
6 years agodrm: add documentation for tv connector state margins
Jani Nikula [Mon, 19 Feb 2018 10:40:09 +0000 (12:40 +0200)]
drm: add documentation for tv connector state margins

A bit boring documentation fix, but gets rid of the warnings:

./include/drm/drm_connector.h:370: warning: Function parameter or member 'margins.left' not described in 'drm_tv_connector_state'
./include/drm/drm_connector.h:370: warning: Function parameter or member 'margins.right' not described in 'drm_tv_connector_state'
./include/drm/drm_connector.h:370: warning: Function parameter or member 'margins.top' not described in 'drm_tv_connector_state'
./include/drm/drm_connector.h:370: warning: Function parameter or member 'margins.bottom' not described in 'drm_tv_connector_state'

[Depends on fe7bc493d979 ("scripts: kernel-doc: support in-line comments
on nested structs/unions") in docs-next to actually fix the warnings.]

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180219104009.4887-1-jani.nikula@intel.com
6 years agodrm/doc: Use new substruct support
Daniel Vetter [Mon, 19 Feb 2018 22:53:56 +0000 (23:53 +0100)]
drm/doc: Use new substruct support

Support for this just recently landed in linux-next.

Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180219225356.24996-5-daniel.vetter@ffwll.ch
6 years agodrm/doc: Polish for drm_mode_parse_command_line_for_connector
Daniel Vetter [Mon, 19 Feb 2018 22:53:55 +0000 (23:53 +0100)]
drm/doc: Polish for drm_mode_parse_command_line_for_connector

Quoting the module option format looks soo much nicer, and avoids
sphinx spewing errors about markup issues.

v2: Fix typo in commit message (Thierry).

Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180219225356.24996-4-daniel.vetter@ffwll.ch
6 years agodrm/docs: Document "scaling mode" property better
Daniel Vetter [Mon, 19 Feb 2018 22:53:54 +0000 (23:53 +0100)]
drm/docs: Document "scaling mode" property better

Move it out of the csv dungeon.

While at it add the missing link to the helper functions for setting
up the "panel rotation" property.

Also OCD how we list enum property values and their corresponding docs.
Going for a nest definition list seams cleanest, no need for also making
it an uordered list.

Cc: Sean Paul <seanpaul@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180219225356.24996-3-daniel.vetter@ffwll.ch
6 years agodrm/docs: Align layout of optional plane blending properties
Daniel Vetter [Mon, 19 Feb 2018 22:53:53 +0000 (23:53 +0100)]
drm/docs: Align layout of optional plane blending properties

Just a bit of drive-by OCD. All the other property docs use enumerations,
for some nice visual consistency. It also neatly highlights the property
name.

Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180219225356.24996-2-daniel.vetter@ffwll.ch
6 years agodrm/docs: Discourage adding more to kms-properties.csv
Daniel Vetter [Mon, 19 Feb 2018 22:53:52 +0000 (23:53 +0100)]
drm/docs: Discourage adding more to kms-properties.csv

Motivated by patch review.

The table is really hard to read in source form, hard to edit, and
we've moved away to more focused sections about specific features and
how they're exposed in properties.

Those sections can then more easily enumerate options, link to helper
functions and other parts of the docs. All things that get ugly real
fast in the docs.

Cc: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180219225356.24996-1-daniel.vetter@ffwll.ch
6 years agodrm/i915: Track number of pending freed objects
Chris Wilson [Mon, 19 Feb 2018 22:06:31 +0000 (22:06 +0000)]
drm/i915: Track number of pending freed objects

During igt, we frequently call into the driver to reset both HW and
driver state (idling the device, waiting for it to become idle and
freeing off old objects) to ensure that we start each test/subtest/pass
from known state. This process incurs an RCU barrier or two to ensure
that any such pending frees are indeed flushed before we return.
However, unconditionally waiting on the RCU barrier adds needless delay
to many callers, which adds up to several seconds when repeated thousands
of times. We can skip the rcu_barrier() if by tracking how many outstanding
frees we have, we know there are none.

The same path is used along suspend, where we may be able to save the
unconditional RCU barrier.

To put it into perspective with a completely meaningless
microbenchmark, igt/gem_sync/idle is improved from 50ms to 30us on bdw.

v2: Remove the extra synchronize_rcu() inside i915_drop_caches_set()

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180219220631.25001-1-chris@chris-wilson.co.uk
6 years agodrm: simple_kms_helper: Add mode_valid() callback support
Linus Walleij [Tue, 20 Feb 2018 07:28:59 +0000 (08:28 +0100)]
drm: simple_kms_helper: Add mode_valid() callback support

The PL111 needs to filter valid modes based on memory bandwidth.
I guess it is a pretty simple operation, so we can still claim
the DRM KMS helper pipeline is simple after adding this (optional)
vtable callback.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180220072859.3386-1-linus.walleij@linaro.org
6 years agodrm/i915/: Initialise trans_min for skl_compute_transition_wm()
Chris Wilson [Wed, 15 Nov 2017 10:50:35 +0000 (10:50 +0000)]
drm/i915/: Initialise trans_min for skl_compute_transition_wm()

clang spots

drivers/gpu/drm/i915/intel_pm.c:4655:6: warning: variable 'trans_min' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
        if (INTEL_GEN(dev_priv) >= 10)

but fortunately for us we skip the function unless on a gen10+ device.
However, to keep the function generic in case we do want to re-enable it
for gen9 again, initialise trans_min to 0.

References: ca47667f523e ("drm/i915/gen10: Calculate and enable transition WM")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mahesh Kumar <mahesh1.kumar@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171115105036.1094-3-chris@chris-wilson.co.uk
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
6 years agodrm/i915: Clear the in-use marker on execbuf failure
Chris Wilson [Mon, 19 Feb 2018 14:01:44 +0000 (14:01 +0000)]
drm/i915: Clear the in-use marker on execbuf failure

If we fail to unbind the vma (due to a signal on an active buffer that
needs to be moved for the next execbuf), then we need to clear the
persistent tracking state we setup for this execbuf.

Fixes: c7c6e46f913b ("drm/i915: Convert execbuf to use struct-of-array packing for critical fields")
Testcase: igt/gem_fenced_exec_thrash/no-spare-fences-busy*
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: <stable@vger.kernel.org> # v4.14+
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180219140144.24004-1-chris@chris-wilson.co.uk
6 years agodrm/amdgpu/powerplay/smu7: drop refresh rate checks for mclk switching
Alex Deucher [Tue, 13 Feb 2018 19:37:36 +0000 (14:37 -0500)]
drm/amdgpu/powerplay/smu7: drop refresh rate checks for mclk switching

The logic has moved to cgs.  mclk switching with DC at higher refresh
rates should work.

Reviewed-by: Eric Huang <JinhuiEric.Huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: Harry Wentland <harry.wentland@amd.com>
6 years agodrm/amdgpu/cgs: add refresh rate checking to non-DC display code
Alex Deucher [Tue, 13 Feb 2018 19:33:51 +0000 (14:33 -0500)]
drm/amdgpu/cgs: add refresh rate checking to non-DC display code

Clamp the vblank period to 0 if the refresh rate is larger than
120 hz for non-DC.  This allows us to remove the refresh rate
checks from powerplay for mclk switching.

Reviewed-by: Eric Huang <JinhuiEric.Huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/powerplay/smu7: allow mclk switching with no displays
Alex Deucher [Tue, 13 Feb 2018 19:26:54 +0000 (14:26 -0500)]
drm/amd/powerplay/smu7: allow mclk switching with no displays

If there are no displays attached, there is no reason to disable
mclk switching.

Fixes mclks getting set to high when there are no displays attached.

Reviewed-by: Eric Huang <JinhuiEric.Huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
6 years agodrm/amd/powerplay/vega10: allow mclk switching with no displays
Alex Deucher [Tue, 13 Feb 2018 19:25:11 +0000 (14:25 -0500)]
drm/amd/powerplay/vega10: allow mclk switching with no displays

If there are no displays attached, there is no reason to disable
mclk switching.

Fixes mclks getting set to high when there are no displays attached.

Reviewed-by: Eric Huang <JinhuiEric.Huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
6 years agodrm/amd/powerplay: use PP_CAP macro for disable_mclk_switching_for_frame_lock
Alex Deucher [Tue, 13 Feb 2018 19:22:46 +0000 (14:22 -0500)]
drm/amd/powerplay: use PP_CAP macro for disable_mclk_switching_for_frame_lock

Rather than open coding it.

Reviewed-by: Eric Huang <JinhuiEric.Huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>