linux-2.6-microblaze.git
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>
6 years agodrm/amd/powerplay: remove unused headers
Corentin Labbe [Wed, 14 Feb 2018 14:46:17 +0000 (14:46 +0000)]
drm/amd/powerplay: remove unused headers

All thoses headers are not used by any source files.
Lets just remove them.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu_gem: fix error handling path in amdgpu_gem_va_update_vm
Gustavo A. R. Silva [Thu, 15 Feb 2018 05:20:00 +0000 (23:20 -0600)]
drm/amdgpu_gem: fix error handling path in amdgpu_gem_va_update_vm

Currently, if amdgpu_vm_bo_update() fails, the returned error
is being ignored.

Fix this by properly checking _r_ after calling amdgpu_vm_bo_update.
Also, remove redundant code just before label _error_.

Addresses-Coverity-ID: 1464280 ("Unused value")
Fixes: 0abc6878fc2d ("drm/amdgpu: update VM PDs after the PTs")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: update the PASID mapping only on demand
Christian König [Mon, 5 Feb 2018 16:38:01 +0000 (17:38 +0100)]
drm/amdgpu: update the PASID mapping only on demand

Updating the PASID is rather heavyweight and shouldn't be done all the
time.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: separate PASID mapping from VM flush v2
Christian König [Sun, 4 Feb 2018 09:32:35 +0000 (10:32 +0100)]
drm/amdgpu: separate PASID mapping from VM flush v2

Stuffing the PASID mapping into the VM flush isn't flexible enough since
the PASID mapping changes not as often as we need a VM flush.

v2: add missing use of gmc_v7_0_emit_pasid_mapping

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Fix increment when sampling OTF in DCE
Leo (Sunpeng) Li [Fri, 9 Feb 2018 17:51:01 +0000 (12:51 -0500)]
drm/amd/display: Fix increment when sampling OTF in DCE

Previously, the number of software segmets per region was reduced to 16.
This needs to be reflected in the sampling distance (increment) used when
translating to the hardware format.

Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
Reviewed-by: Krunoslav Kovac <Krunoslav.Kovac@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: De PQ implementation
Vitaly Prosyak [Tue, 6 Feb 2018 21:06:23 +0000 (15:06 -0600)]
drm/amd/display: De PQ implementation

Some refactoring and optimizations in color module.
Added de gamma 2.2 & 2.4, also re gamma 2.2.
Added interface for diagnostic for de gamma & de pq.

Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
Reviewed-by: Krunoslav Kovac <Krunoslav.Kovac@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Remove unused dm_pp_ interfaces
Harry Wentland [Mon, 5 Feb 2018 23:41:45 +0000 (18:41 -0500)]
drm/amd/display: Remove unused dm_pp_ interfaces

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Add logging for aux DPCD access
Eric Yang [Tue, 6 Feb 2018 22:28:46 +0000 (17:28 -0500)]
drm/amd/display: Add logging for aux DPCD access

Add basic logging for DPCD access. Does not print
by default.

Currently only prints first byte of the data accessed.

Technical debt: Need to make it so that the entire
data block accessed is printed. Also need to log
address space that's not DPCD.

Signed-off-by: Eric Yang <Eric.Yang2@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Set vsc pack revision when DPCD revision is >= 1.2
Tao [Thu, 8 Feb 2018 21:04:25 +0000 (16:04 -0500)]
drm/amd/display: Set vsc pack revision when DPCD revision is >= 1.2

Brightness couldn't change when booting up in DC mode.
It was because "psr_enabled" flag was not set to true before
setting vsc packet revision, causing packet rev setup was skipped.
Now instead of checking the psr flag, it checks if the DPCD_REV >= 1.2
and set the vsc packet revision.

Signed-off-by: Tao <xtao@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: provide an interface to query firmware version
Anthony Koo [Thu, 8 Feb 2018 04:25:43 +0000 (23:25 -0500)]
drm/amd/display: provide an interface to query firmware version

Signed-off-by: Anthony Koo <Anthony.Koo@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Add missing Vega defines to dal_asic_id
Harry Wentland [Thu, 1 Feb 2018 16:29:58 +0000 (11:29 -0500)]
drm/amd/display: Add missing Vega defines to dal_asic_id

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Hersen Wu <hersenxs.wu@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Treat bad EDID as no EDID
Eric Yang [Thu, 8 Feb 2018 19:05:14 +0000 (14:05 -0500)]
drm/amd/display: Treat bad EDID as no EDID

We have an mst dock firmware that will emulate an EDID with bad
checksum.

v2: Tread -> Treat

Signed-off-by: Eric Yang <Eric.Yang2@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Remove duplicate entries from BIOS function table
Ken Chalmers [Wed, 7 Feb 2018 19:58:53 +0000 (14:58 -0500)]
drm/amd/display: Remove duplicate entries from BIOS function table

Identical to the two entries above them.

Signed-off-by: Ken Chalmers <ken.chalmers@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Make FBC work without fbdev emulation
Roman Li [Tue, 6 Feb 2018 23:47:26 +0000 (18:47 -0500)]
drm/amd/display: Make FBC work without fbdev emulation

Previously, FBC dynamic allocation relied on connector modes
populated during dm init. This is only the case if
DRM_FBDEV_EMULATION config flag is enabled.
Moving fbc allocation from dm_late_init() to
amdgpu_dm_connector_get_modes() where actual modes init happens.

Signed-off-by: Roman Li <Roman.Li@amd.com>
Reviewed-by: Shirish Shankarappa <Shirish.S@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Remove delay on disconnect patch
John Barberiz [Tue, 6 Feb 2018 17:25:17 +0000 (12:25 -0500)]
drm/amd/display: Remove delay on disconnect patch

HDMI HPD's generic solution makes the monitor
patch code unnecessary so anything related has
been removed.

Signed-off-by: John Barberiz <jbarberi@amd.com>
Reviewed-by: John Barberiz <jbarberi@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Skip 2 frames when first reading CRC
Leo (Sunpeng) Li [Tue, 6 Feb 2018 15:20:46 +0000 (10:20 -0500)]
drm/amd/display: Skip 2 frames when first reading CRC

Skipping the first frame will prevent uncoooked values most of the time.
However, in some unlikely cases, the second frame will be uncooked as
well.

Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Expose DCE110 CRC functions for DCE8
Leo (Sunpeng) Li [Mon, 5 Feb 2018 21:11:19 +0000 (16:11 -0500)]
drm/amd/display: Expose DCE110 CRC functions for DCE8

Implement CRC for DCE8. Registers remain the same, so call DCE110 code
directly.

Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Rework DCE transform bit depth reduction programming.
Leo (Sunpeng) Li [Tue, 6 Feb 2018 21:35:21 +0000 (16:35 -0500)]
drm/amd/display: Rework DCE transform bit depth reduction programming.

Clear up the logic, and enable programming truncation as a bit reduction
mode.

Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: When enabling CRC, disable dither & enable truncation
Leo (Sunpeng) Li [Tue, 23 Jan 2018 22:43:37 +0000 (17:43 -0500)]
drm/amd/display: When enabling CRC, disable dither & enable truncation

When user-mode is using 8bpc, the hardware represents it internally
using a higher bit depth. This causes problems when comparing CRCs for
color managment tests.

We need to disable dithering as well, since it makes CRC values
non-deterministic.

It's easy to see why dithering needs to be disabled, The reason why
truncation also needs to be enabled is better described with an example.
Consider the folowing which tests the color transform matrix (CTM):

Expected CRC = FB_A -> Degamma (Bypassed) -> CTM (Bypassed)
                                                  |
                                                  v
                            Obtain CRC  <- Regamma(Bypassed)

Actual CRC = FB_B -> Degamma (Bypassed) -> CTM (0.5*Identity)
                                                  |
                                                  v
                            Obtain CRC  <- Regamma(Bypassed)

FB_A contains a solid red color at half intensity (127 @ 8bpc)
FB_B contains a solid red color at full intensity (255 @ 8bpc)

We expect that Expected CRC = Actual CRC, but that's not the case. When
the CTM is applied, the output is at half intensity, but also at a
higher bit depth within hardware. i.e. 255/2 = 127.5: not representable
in 8bpc, but can be at 10bpc. This causes the two CRC's to be different.

The solution is to truncate the output bit depth to the same as input
when enabling CRC capture. Since Linux only supports 8bpc, hard code
that for now.

Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Expose dither setting functionality to Linux
Leo (Sunpeng) Li [Tue, 6 Feb 2018 14:50:49 +0000 (09:50 -0500)]
drm/amd/display: Expose dither setting functionality to Linux

We will need this to disable dither for CRC capture.

Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Refactor max color lut entries into a macro.
Leo (Sunpeng) Li [Tue, 30 Jan 2018 16:14:27 +0000 (11:14 -0500)]
drm/amd/display: Refactor max color lut entries into a macro.

Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Hookup color management functions
Leo (Sunpeng) Li [Fri, 2 Feb 2018 15:18:56 +0000 (10:18 -0500)]
drm/amd/display: Hookup color management functions

Hookup new color management functions into amdgpu_dm:

- Notify DRM that we support CRTC color management during CRTC init
- Call color management functions within atomic check to update dc
  states in preparation for a commit

Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Implement color management
Leo (Sunpeng) Li [Fri, 2 Feb 2018 15:18:05 +0000 (10:18 -0500)]
drm/amd/display: Implement color management

Implement color management functionalities within amdgpu_dm_color, and
expose functions within amdgpu_dm.h.

Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Add color module's gamma helpers to Linux build
Leo (Sunpeng) Li [Mon, 5 Feb 2018 19:29:57 +0000 (14:29 -0500)]
drm/amd/display: Add color module's gamma helpers to Linux build

Also guard includes that we don't need.

Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Use hardware max low point when sampling OTF
Leo (Sunpeng) Li [Fri, 2 Feb 2018 14:46:41 +0000 (09:46 -0500)]
drm/amd/display: Use hardware max low point when sampling OTF

The MAX_LOW_POINT macro should reflect the maximum low point within
hardware. Otherwise, sampling for the hardware points from the output
transfer function (OTF) will be incorrect.

Also, fix usage of MAX_LOW_POINT accordingly.

Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
Reviewed-by: Krunoslav Kovac <Krunoslav.Kovac@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>