aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/omapdrm/dss/dsi.c
AgeCommit message (Collapse)AuthorFilesLines
2020-11-10drm/omap: Fix runtime PM imbalance on errorDinghao Liu1-2/+5
pm_runtime_get_sync() increments the runtime PM usage counter even when it returns an error code. However, users of its direct wrappers in omapdrm assume that PM usage counter will not change on error. Thus a pairing decrement is needed on the error handling path for these wrappers to keep the counter balanced. Signed-off-by: Dinghao Liu <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-11-10drm/omap: dsi: Rework and remove a few unused variablesLee Jones1-7/+2
Fixes the following W=1 kernel build warning(s): drivers/gpu/drm/omapdrm/dss/dsi.c: In function ‘_dsi_print_reset_status’: drivers/gpu/drm/omapdrm/dss/dsi.c:1131:6: warning: variable ‘l’ set but not used [-Wunused-but-set-variable] drivers/gpu/drm/omapdrm/dss/dsi.c: In function ‘dsi_update’: drivers/gpu/drm/omapdrm/dss/dsi.c:3943:10: warning: variable ‘dh’ set but not used [-Wunused-but-set-variable] drivers/gpu/drm/omapdrm/dss/dsi.c:3943:6: warning: variable ‘dw’ set but not used [-Wunused-but-set-variable] Cc: Tomi Valkeinen <[email protected]> Cc: David Airlie <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: Laurent Pinchart <[email protected]> Cc: [email protected] Signed-off-by: Lee Jones <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-08-04drm/omap: force runtime PM suspend on system suspendTomi Valkeinen1-0/+1
Use SET_LATE_SYSTEM_SLEEP_PM_OPS in DSS submodules to force runtime PM suspend and resume. We use suspend late version so that omapdrm's system suspend callback is called first, as that will disable all the display outputs after which it's safe to force DSS into suspend. Signed-off-by: Tomi Valkeinen <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Acked-by: Tony Lindgren <[email protected]> Fixes: cef766300353 ("drm/omap: Prepare DSS for probing without legacy platform data") Cc: [email protected] # v5.7+ Tested-by: Tony Lindgren <[email protected]>
2020-02-26drm/omap: Add infrastructure to support drm_bridge local to DSS outputsLaurent Pinchart1-1/+1
In order to support drm_bridge-based pipeline, the internal HDMI encoders will need to expose the EDID read operation through the drm_bridge API, and thus to expose a drm_bridge instance corresponding to the encoder. The HDMI encoders are however handled as omap_dss_device instances, which conflicts with this requirement. In order to move forward with the drm_bridge transition, add support for creating drm_bridge instances local to DSS outputs. If a local bridge is passed to the omapdss_device_init_output() function, it is used as the first bridge in the chain, and the omap_dss_device.next_bridge field is set to the next bridge for the use of the internal encoders' bridges. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Tested-by: Sebastian Reichel <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-02-26drm/omap: dss: Fix output next device lookup in DTLaurent Pinchart1-1/+1
The DSS core looks up the next device connected to an output by traversing the OF graph. It currently hardcodes the local port number to 0, which breaks any output with a different port number (SDI on OMAP3 and any DPI output but the first one). Fix this by repurposing the currently unused of_ports bitmask in omap_dss_device with an of_port output port number, and use it to traverse the OF graph. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Tested-by: Sebastian Reichel <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-10-14drm/omap: Remove set but not used variable 'tclk_trail'zhengbin1-2/+1
Fixes gcc '-Wunused-but-set-variable' warning: drivers/gpu/drm/omapdrm/dss/dsi.c: In function dsi_proto_timings: drivers/gpu/drm/omapdrm/dss/dsi.c:3562:46: warning: variable tclk_trail set but not used [-Wunused-but-set-variable] It is not used since commit 9960aa7cb58c ("drm/omap: move omapdss & displays under omapdrm") Reported-by: Hulk Robot <[email protected]> Signed-off-by: zhengbin <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-06-19treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 234Thomas Gleixner1-12/+1
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details you should have received a copy of the gnu general public license along with this program if not see http www gnu org licenses extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 503 file(s). Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Alexios Zavras <[email protected]> Reviewed-by: Allison Randal <[email protected]> Reviewed-by: Enrico Weigelt <[email protected]> Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-03-18drm/omap: dsi: Fix PM for display blank with paired dss_pll callsTony Lindgren1-29/+31
Currently dsi_display_init_dsi() calls dss_pll_enable() but it is not paired with dss_pll_disable() in dsi_display_uninit_dsi(). This leaves the DSS clocks enabled when the display is blanked wasting about extra 5mW of power while idle. The clock that is left on by not calling dss_pll_disable() is DSS_CLKCTRL bit 10 OPTFCLKEN_SYS_CLK that is the source clock for DSI PLL. We can fix this issue by by making the current dsi_pll_uninit() into dsi_pll_disable(). This way we can just call dss_pll_disable() from dsi_display_uninit_dsi() and the code becomes a bit easier to follow. However, we need to also consider that DSI PLL can be muxed for DVI too as pointed out by Tomi Valkeinen <[email protected]>. In the DVI case, we want to unconditionally disable the clocks. To get around this issue, we separate out the DSI lane handling from dsi_pll_enable() and dsi_pll_disable() as suggested by Tomi in an earlier experimental patch. So we must only toggle the DSI regulator based on the vdds_dsi_enabled flag from dsi_display_init_dsi() and dsi_display_uninit_dsi(). We need to make these two changes together to avoid breaking things for DVI when fixing the DSI clock handling. And this all causes a slight renumbering of the error path for dsi_display_init_dsi(). Suggested-by: Tomi Valkeinen <[email protected]> Signed-off-by: Tony Lindgren <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]>
2019-03-18drm: Use new DRM_BUS_FLAG_*_(DRIVE|SAMPLE)_(POS|NEG)EDGE flagsLaurent Pinchart1-2/+2
The DRM_BUS_FLAG_PIXDATA_(POS|NEG)EDGE and DRM_BUS_FLAG_SYNC_(POS|NEG)EDGE flags are deprecated in favour of the new DRM_BUS_FLAG_PIXDATA_(DRIVE|SAMPLE)_(POS|NEG)EDGE and new DRM_BUS_FLAG_SYNC_(DRIVE|SAMPLE)_(POS|NEG)EDGE flags. Replace them through the code. This effectively changes the value of the .sampling_edge bridge timings field in the dumb-vga-dac driver. This is safe to do as no driver consumes these values yet. Signed-off-by: Laurent Pinchart <[email protected]> Acked-by: Linus Walleij <[email protected]> Reviewed-by: Stefan Agner <[email protected]> Tested-by: Sebastian Reichel <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]>
2019-03-18drm/omap: Merge omap_dss_device type and output_type fieldsLaurent Pinchart1-1/+1
The omap_dss_device type and output_type fields differ mostly for historical reasons. The output_type field is required for all devices but the display at the end of the pipeline, and must be set to OMAP_DISPLAY_TYPE_NONE for the latter. The type field is required for all devices but the internal encoder, for which it is ignored. The only reason why the output_type field must be set to OMAP_DISPLAY_TYPE_NONE for the display at the end of the pipeline is to identify omap_dss_device instances corresponding to displays. This is not documented and confusing. Clean the code by adding a new display field to the omap_dss_device structure to identify displays, and merge the type and output_type fields. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]> Tested-by: Sebastian Reichel <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]>
2019-03-18drm/omap: Factor out common init/cleanup code for output devicesLaurent Pinchart1-14/+3
All the internal encoders share common init and cleanup code. Factor it out to separate functions. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]> Tested-by: Sebastian Reichel <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]>
2019-03-18drm/omap: Reverse direction of the DSS device enable/disable operationsLaurent Pinchart1-4/+3
The omapdrm and omapdss drivers are architectured based on display pipelines made of multiple components handled from sink (display) to source (DSS output). This is incompatible with the DRM bridge and panel APIs that handle components from source to sink. Reconcile the omapdrm and omapdss drivers with the DRM bridge and panel model by reversing the direction of the DSS device .enable() and .disable() operations. This completes the move to the DRM bridge model, with the notable exception of the DSI pipelines that will require more work. We also adapt the omapdss shutdown handler dss_shutdown() to shut down all active pipelines starting from the pipeline output device instead of the display device. As a consequence the for_each_dss_display() macro isn't used and can be removed, and the omapdss_device_get_next() function underlying the macro can be simplified to search for output devices only. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]> Tested-by: Sebastian Reichel <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]>
2019-03-18drm/omap: Remove connection checks from internal encoders .enable()Laurent Pinchart1-18/+2
The internal encoders return an error from their .enable() handler when their are not connected to a dss manager. As the flag used is set and cleared in the connect and disconnect handlers, this effectively checks whether the omap_dss_device is connected. The .enable() handler is called from code paths that access the dss devices chain from the display device, which is set to NULL when the device isn't connected, making it impossible to access the device in that case. The safety check is thus not needed, remove it. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]> Tested-by: Sebastian Reichel <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]>
2019-02-06drm/omap: dsi: Hack-fix DSI bus flagsTomi Valkeinen1-0/+11
Since commit b4935e3a3cfa ("drm/omap: Store bus flags in the omap_dss_device structure") video mode flags are managed by the omapdss (and later omapdrm) core based on bus flags stored in omap_dss_device. This works fine for all devices whose video modes are set by the omapdss and omapdrm core, but breaks DSI operation as the DSI still uses legacy code paths and sets the DISPC timings manually. To fix the problem properly we should move the DSI encoder to the new encoder model. This will however require a considerable amount of work. Restore DSI operation by adding back video mode flags handling in the DSI encoder driver as a hack in the meantime. Fixes: b4935e3a3cfa ("drm/omap: Store bus flags in the omap_dss_device structure") Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-02-06drm/omap: dsi: Fix OF platform depopulateTomi Valkeinen1-2/+2
Commit edb715dffdee ("drm/omap: dss: dsi: Move initialization code from bind to probe") moved the of_platform_populate() call from dsi_bind() to dsi_probe(), but failed to move the corresponding of_platform_depopulate() from dsi_unbind() to dsi_remove(). This results in OF child devices being potentially removed multiple times. Fix it by placing the of_platform_depopulate() call where it belongs. Fixes: edb715dffdee ("drm/omap: dss: dsi: Move initialization code from bind to probe") Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-02-06drm/omap: dsi: Fix crash in DSI debug dumpsTomi Valkeinen1-6/+6
Reading any of the DSI debugfs files results in a crash, as wrong pointer is passed to the dump functions, and the dump functions use a wrong pointer. This patch fixes DSI debug dumps. Fixes: f3ed97f9ae7d ("drm/omap: dsi: Simplify debugfs implementation") Signed-off-by: Tomi Valkeinen <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Laurent Pinchart <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2018-12-03drm/omap: populate DSI platform bus earlierSebastian Reichel1-10/+10
After the changes from 4.20 the DSI encoder tries to find the attached panel before populating the DSI bus. If the panel is not found -EPROBE_DEFER is returned, so the DSI bus is never populated and the panel never added. Fix this by populating the DSI bus before searching for the video sink in dsi_init_output(). Fixes: 27d624527d992 ("drm/omap: dss: Acquire next dssdev at probe time") Acked-by: Pavel Machek <[email protected]> Tested-by: Tony Lindgren <[email protected]> Tested-by: Pavel Machek <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2018-11-12drm/omap: dsi: Fix missing of_platform_depopulate()Tony Lindgren1-2/+6
We're missing a call to of_platform_depopulate() on errors for dsi. Looks like dss is already doing this. Signed-off-by: Tony Lindgren <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2018-11-12drm/omap: Move DISPC runtime PM handling to omapdrmLaurent Pinchart1-7/+0
The internal encoders (DSI, HDMI4, HDMI5 and VENC) runtime PM handlers attempt to manage the runtime PM state of the connected DISPC, based on the rationale that the DISPC providing data to the encoders requires ensuring that the display is active whenever the encoders are active. While the DISPC provides data to the encoders, it doesn't as such constitute a resource that encoders require in order to be taken out of suspend, contrary to for instance a functional clock or a power supply. Encoders registers can be accessed without the DISPC being active, and while the encoders will not output any video stream without being fed by the DISPC, the DISPC PM state doesn't influence the encoders PM state. For this reason the DISPC PM state is better managed from the omapdrm driver, in the CRTC enable and disable operations. This allows the encoders PM state to be handled separately from the DISPC, and in particular at times when the DISPC may not be available (for instance at probe due to the DSS probe being deferred, or at remove time du to the DISPC being already removed). Fixes: edb715dffdee ("drm/omap: dss: dsi: Move initialization code from bind to probe") Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2018-11-12drm/omap: dsi: Ensure the device is active during probeLaurent Pinchart1-2/+5
The probe function performs hardware access to read the number of supported data lanes from a configuration register and thus requires the device to be active. Ensure this by surrounding the access with dsi_runtime_get() and dsi_runtime_put() calls. Fixes: edb715dffdee ("drm/omap: dss: dsi: Move initialization code from bind to probe") Signed-off-by: Laurent Pinchart <[email protected]> Acked-by: Tony Lindgren <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2018-09-03drm/omap: Store CRTC timings in .set_timings() operationLaurent Pinchart1-4/+2
The video timings are stored in the CRTC structure by the omap_crtc_dss_set_timings() function, called by dss_mgr_set_timings() from the .enable() operation of the internal encoders. This instead belongs to the .set_timings() code paths. Move the omap_crtc_dss_set_timings() calls accordingly. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]>
2018-09-03drm/omap: dsi: Fixup video mode in .set_config() operationLaurent Pinchart1-13/+14
The DSI encoder modifies the passed videomode to take the requirements of the internal DISPC-DSI bus into account in the .enable_video_output() operation. This should be performed in the .check_timings() operation instead. There is however no .check_timings() operation as the DSI encoder uses a custom API, so move it to the closest match which is the .set_config() operation. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]>
2018-09-03drm/omap: Store bus flags in the omap_dss_device structureLaurent Pinchart1-6/+3
Source components in the display pipeline need to configure their output signals polarities and clock driving edge based on the requirements of the sink component. Those requirements are currently shared across the whole pipeline in the flags of a videomode structure, instead of being local to each bus. This both prevents multiple buses from having different configurations (when the hardware supports it), and makes it difficult to move from videomode to drm_display_mode as the latter doesn't contain bus polarities and clock edge flags. Add a bus_flags field to the omap_dss_device structure and move the DISPLAY_FLAGS_DE_(LOW|HIGH), DISPLAY_FLAGS_PIXDATA_(POS|NEG)EDGE and DISPLAY_FLAGS_SYNC_(POS|NEG)EDGE videomode flags to bus_flags in all external encoders, connectors and panels. The videomode flags are still used internally for internal encoders, this will be addressed in a second step. The related videomode flags in the default mode of the DVI connector can simply be dropped, as they are always overridden by the TFP410 driver. Note that this results in both the DISPLAY_FLAGS_SYNC_POSEDGE and DISPLAY_FLAGS_SYNC_NEGEDGE flags being set, which is invalid, but only the former is tested for when programming the DISPC, so the DVI connector flags are effectively overridden by the TFP410 flags. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]>
2018-09-03drm/omap: dss: Remove the dss_mgr_(dis)connect() operationsLaurent Pinchart1-9/+1
The dss_mgr .connect() and .disconnect() are implemented as no-op in omapdrm. The operations are unneeded, remove them. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]>
2018-09-03drm/omap: Set dispc_channel_connect from DSS output connect handlersLaurent Pinchart1-0/+3
The omap_dss_device.dispc_channel_connect field is used by DSS outputs to fail the .enable() operation if they're not connected. Set the field directly from the (dis)connect handlers of the DSS outputs instead of going through the CRTC dss_mgr operations. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]>
2018-09-03drm/omap: dss: Merge two disconnection helpersLaurent Pinchart1-1/+0
To simplify the pipeline disconnection handling merge the omapdss_device_disconnect() and omapdss_output_unset_device() functions. The device state check is now called for every device in the pipeline, extending this sanity check coverage. There is no need to return an error from omapdss_device_disconnect() when the check fails, as omapdss_output_unset_device() used to do, given that we can't prevent disconnection due to device unbinding (the return value of omapdss_output_unset_device() is never checked in the current code for that reason). Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]>
2018-09-03drm/omap: dss: Move display type validation to initialization timeLaurent Pinchart1-14/+11
The display type is validated when the display is connected to the DSS output. We already have all the information we need for validation when initializing the outputs. Move validation to output initialization to simplify pipeline connection handling. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]>
2018-09-03drm/omap: Reverse direction of DSS device (dis)connect operationsLaurent Pinchart1-11/+21
The omapdrm and omapdss drivers are architectured based on display pipelines made of multiple components handled from sink (display) to source (DSS output). This is incompatible with the DRM bridge and panel APIs that handle components from source to sink. To reconcile the omapdrm and omapdss drivers with the DRM bridge and panel model, we need to reverse the direction of the DSS device operations. Start with the connect and disconnect operations. Signed-off-by: Laurent Pinchart <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]>
2018-09-03drm/omap: dss: Get regulators at probe timeLaurent Pinchart1-29/+7
Regulators for the DPI, DSI, HDMI, SDI and VENC outputs are all looked up when connecting the output omap_dss_device. There's no need to delay regulator handling to that time, get the regulators at probe time. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]>
2018-09-03drm/omap: dss: Remove duplicated parameter to dss_mgr_(dis)connect()Laurent Pinchart1-5/+3
The dss_mgr_connect() and dss_mgr_disconnect() functions take two omap_dss_device pointers as parameters, which are always set to the same value by all callers. Remove the duplicated pointer. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]>
2018-09-03drm/omap: dss: Acquire next dssdev at probe timeLaurent Pinchart1-2/+16
Look up the next dssdev at probe time based on device tree links for all DSS outputs and encoders. This will be used to reverse the order of the dssdev connect and disconnect call chains. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]>
2018-09-03drm/omap: dss: dsi: Move initialization code from bind to probeLaurent Pinchart1-140/+161
There's no reason to delay initialization of most of the driver (such as mapping memory I/O or enabling runtime PM) to the component bind handler. Perform as much of the initialization as possible at probe time, initializing at bind time only the parts that depends on the DSS. The cleanup code is moved from unbind to remove in a similar way. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]>
2018-09-03drm/omap: dss: Cleanup error paths in output init functionsLaurent Pinchart1-5/+4
Rename the jump labels according to the cleanup they perform, not the location they're accessed from, and move functions from error checks to cleanup paths, and move reference handling to simplify cleanup. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]>
2018-09-03drm/omap: dss: Replace omap_dss_device port number with bitmaskLaurent Pinchart1-0/+1
The omap_dss_device port_num field stores the DT port number associated with the device. The field is used in different ways depending on the device type: - For DPI outputs, the port number is used as an identifier of the DPI instance - For sources, the port number is used to look up the omap_dss_device by DT port node As omap_dss_device instances are only looked up as sources by sinks, setting the field to the number of the source port works for both use cases. However, to enable looking up sinks, we need to record all the ports associated with an omap_dss_device. Do so by turning the port_num field into an of_ports bitmask. For DPI outputs the port number is additionally stored in the dpi_data structure as the output ID. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]>
2018-09-03drm/omap: dss: Remove output devices listLaurent Pinchart1-2/+2
The output devices list isn't used anymore, all output devices are accessed through the global devices list. Remove it. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]>
2018-09-03drm/omap: Move DSI debugfs clocks dump to dsi%u_clks filesLaurent Pinchart1-34/+9
The DSI clocks are dumped in the DSS-level debugfs clocks file. This complicates the implementation as the DSI private data has to be looked up through the outputs list. Simplify it by creating two debugfs files, dsi1_clks and dsi2_clks, to dump the DSI clocks. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]>
2018-09-03drm/omap: dsi: Simplify debugfs implementationLaurent Pinchart1-49/+14
The DSI debugfs regs and irqs show handlers received a pointer to the DSI private data. There's no need to look it up from the list of DSS outputs. Use the pointer directly, this allows simplifying the implementation of the handlers. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]>
2018-09-03drm/omap: dss: Move src and dst check and set to connection handlersLaurent Pinchart1-5/+0
The encoders duplicate the same omap_dss_device src and dst fields set and checks in their connect and disconnect handlers. Move the code to the connect and disconnect wrappers. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]>
2018-09-03drm/omap: dss: Move common device operations to common structureLaurent Pinchart1-24/+26
The various types of omapdss_*_ops structures define multiple operations that are not specific to a bus type. To simplify the code and remove dependencies on specific bus types move those operations to a common structure. Operations that are specific to a bus type are kept in the specialized ops structures. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]>
2018-06-28drm/omap: fix email addressTomi Valkeinen1-1/+1
Change [email protected] to [email protected]. Signed-off-by: Tomi Valkeinen <[email protected]>
2018-03-01drm: omapdrm: dispc: Pass DISPC pointer to remaining dispc API functionsLaurent Pinchart1-10/+12
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 <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]>
2018-03-01drm: omapdrm: dispc: Pass DISPC pointer to dispc_ops operationsLaurent Pinchart1-2/+2
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 <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]>
2018-03-01drm: omapdrm: dss: Pass omap_dss_device pointer to dss_mgr_*() functionsLaurent Pinchart1-17/+13
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 <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]>
2018-03-01drm: omapdrm: dsi: Don't pass channel to dispc init/uninit functionsLaurent Pinchart1-11/+10
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 <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]>
2018-03-01drm: omapdrm: dsi: Store the struct device pointer in struct dsi_dataLaurent Pinchart1-13/+13
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 <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]>
2018-03-01drm: omapdrm: dsi: Use dev pointer directly in dsi_bind() functionLaurent Pinchart1-17/+18
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 <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]>
2018-03-01drm: omapdrm: dsi: Combine two commonly used inline functionsLaurent Pinchart1-60/+30
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 <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]>
2018-03-01drm: omapdrm: dsi: Pass the dsi_data pointer to internal functionsLaurent Pinchart1-664/+564
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 <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]>
2018-03-01drm: omapdrm: dss: Store the debugfs root directory in struct dss_deviceLaurent Pinchart1-4/+4
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 <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]>
2018-03-01drm: omapdrm: dss: Store the registered plls array in struct dss_deviceLaurent Pinchart1-2/+1
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 <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]>