AngeloGioacchino Del Regno
4708b01a49
drm/mediatek: gamma: Support multi-bank gamma LUT
...
Newer Gamma IP have got multiple LUT banks: support specifying the
size of the LUT banks and handle bank-switching before programming
the LUT in mtk_gamma_set_common() in preparation for adding support
for MT8195 and newer SoCs.
Suggested-by: Jason-JH.Lin <jason-jh.lin@mediatek.com >
[Angelo: Refactored original commit]
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20231012095736.100784-10-angelogioacchino.delregno@collabora.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-10-16 15:19:13 +00:00
AngeloGioacchino Del Regno
a6b39cd248
drm/mediatek: De-commonize disp_aal/disp_gamma gamma_set functions
...
In preparation for adding a 12-bits gamma support for the DISP_GAMMA
IP, remove the mtk_gamma_set_common() function and move the relevant
bits in mtk_gamma_set() for DISP_GAMMA and mtk_aal_gamma_set() for
DISP_AAL: since the latter has no more support for gamma manipulation
(being moved to a different IP) in newer revisions, those functions
are about to diverge and it makes no sense to keep a common one (with
all the complications of passing common data and making exclusions
for device driver data) for just a few bits.
This commit brings no functional changes.
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Reviewed-by: Nícolas F. R. A. Prado <nfraprado@collabora.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20231012095736.100784-9-angelogioacchino.delregno@collabora.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-10-16 15:10:36 +00:00
AngeloGioacchino Del Regno
36e5da1377
drm/mediatek: aal: Use bitfield macros
...
Make the code more robust and improve readability by using bitfield
macros instead of open coding bit operations.
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Reviewed-by: Nícolas F. R. A. Prado <nfraprado@collabora.com >
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20231012095736.100784-8-angelogioacchino.delregno@collabora.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-10-16 15:06:02 +00:00
AngeloGioacchino Del Regno
6e46998c13
drm/mediatek: gamma: Use bitfield macros
...
Make the code more robust and improve readability by using bitfield
macros instead of open coding bit operations.
Reviewed-by: Jason-JH.Lin <jason-jh.lin@mediatek.com >
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com >
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20231012095736.100784-7-angelogioacchino.delregno@collabora.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-10-16 15:04:03 +00:00
AngeloGioacchino Del Regno
0d4caaaf61
drm/mediatek: gamma: Enable the Gamma LUT table only after programming
...
Move the write to DISP_GAMMA_CFG to enable the Gamma LUT to after
programming the actual table to avoid potential visual glitches during
table modification.
Note:
GAMMA should get enabled in between vblanks, but this requires many
efforts in order to make this happen, as that requires migrating all
of the writes to make use of CMDQ instead of cpu writes and that's
not trivial. For this reason, this patch only moves the LUT enable.
The CMDQ rework will come at a later time.
Reviewed-by: Jason-JH.Lin <jason-jh.lin@mediatek.com >
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20231012095736.100784-6-angelogioacchino.delregno@collabora.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-10-16 14:59:14 +00:00
AngeloGioacchino Del Regno
c18119dee1
drm/mediatek: gamma: Improve and simplify HW LUT calculation
...
Use drm_color_lut_extract() to avoid open-coding the bits reduction
calculations for each color channel and use a struct drm_color_lut
to temporarily store the information instead of an array of u32.
Also, slightly improve the precision of the HW LUT calculation in the
LUT DIFF case by performing the subtractions on the 16-bits values and
doing the 10 bits conversion later.
Reviewed-by: Jason-JH.Lin <jason-jh.lin@mediatek.com >
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20231012095736.100784-5-angelogioacchino.delregno@collabora.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-10-15 23:57:51 +00:00
AngeloGioacchino Del Regno
d243907bb4
drm/mediatek: gamma: Support SoC specific LUT size
...
Newer SoCs support a bigger Gamma LUT table: wire up a callback
to retrieve the correct LUT size for each different Gamma IP.
Co-developed-by: Jason-JH.Lin <jason-jh.lin@mediatek.com >
Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com >
[Angelo: Rewritten commit message/description + porting]
Reviewed-by: Jason-JH.Lin <jason-jh.lin@mediatek.com >
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20231012095736.100784-4-angelogioacchino.delregno@collabora.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-10-15 23:44:59 +00:00
AngeloGioacchino Del Regno
aa5fb24f97
drm/mediatek: gamma: Reduce indentation in mtk_gamma_set_common()
...
Invert the check for state->gamma_lut and move it at the beginning
of the function to reduce indentation: this prepares the code for
keeping readability on later additions.
This commit brings no functional changes.
Reviewed-by: Jason-JH.Lin <jason-jh.lin@mediatek.com >
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20231012095736.100784-3-angelogioacchino.delregno@collabora.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-10-15 23:40:55 +00:00
Jason-JH.Lin
1c5a880a2a
drm/mediatek: gamma: Adjust mtk_drm_gamma_set_common parameters
...
Adjust the parameters in mtk_drm_gamma_set_common()
- add (struct device *dev) to get lut_diff from gamma's driver data
- remove (bool lut_diff) and use false as default value in the function
Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com >
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20231012095736.100784-2-angelogioacchino.delregno@collabora.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-10-15 23:38:08 +00:00
Jason-JH.Lin
53412dc290
drm/mediatek: Fix iommu fault during crtc enabling
...
The difference between drm_atomic_helper_commit_tail() and
drm_atomic_helper_commit_tail_rpm() is
drm_atomic_helper_commit_tail() will commit plane first and
then enable crtc, drm_atomic_helper_commit_tail_rpm() will
enable crtc first and then commit plane.
Before mediatek-drm enables crtc, the power and clk required
by OVL have not been turned on, so the commit plane cannot be
committed before crtc is enabled. That means OVL layer should
not be enabled before crtc is enabled.
Therefore, the atomic_commit_tail of mediatek-drm is hooked with
drm_atomic_helper_commit_tail_rpm().
Another reason is that the plane_state of drm_atomic_state is not
synchronized with the plane_state stored in mtk_crtc during crtc enablng,
so just set all planes to disabled.
Fixes: 119f517362 ("drm/mediatek: Add DRM Driver for Mediatek SoC MT8173.")
Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com >
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com >
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Link: https://patchwork.kernel.org/project/linux-mediatek/patch/20230809125722.24112-3-jason-jh.lin@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-10-08 01:30:52 +00:00
Jason-JH.Lin
3ec71e05ae
drm/mediatek: Fix iommu fault by swapping FBs after updating plane state
...
According to the comment in drm_atomic_helper_async_commit(),
we should make sure FBs have been swapped, so that cleanups in the
new_state performs a cleanup in the old FB.
So we should move swapping FBs after calling mtk_plane_update_new_state(),
to avoid using the old FB which could be freed.
Fixes: 1a64a7aff8 ("drm/mediatek: Fix cursor plane no update")
Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com >
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com >
Link: https://patchwork.kernel.org/project/linux-mediatek/patch/20230809125722.24112-2-jason-jh.lin@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-10-08 01:28:31 +00:00
Jason-JH.Lin
26fdd23ff8
drm/mediatek: Support dynamic selection of MT8188 VDOSYS0
...
Move DDP_COMPONENT_DP_INTF0 from mt8188_mtk_ddp_main
array to a connector routes array called
mt8188_mtk_ddp_main_routes and add DDP_COMPONENT_DSI0
to mt8188_mtk_ddp_main_routes to support dynamic
selection capability for mt8188.
Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com >
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Signed-off-by: Nathan Lu <nathan.lu@mediatek.com >
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com >
Reviewed-by: Fei Shao <fshao@chromium.org >
Tested-by: Fei Shao <fshao@chromium.org >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20231004024013.18956-8-jason-jh.lin@mediatek.com/
Link: https://patchwork.kernel.org/project/dri-devel/patch/20231004024013.18956-10-jason-jh.lin@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-10-08 01:18:06 +00:00
Jason-JH.Lin
00d035228f
drm/mediatek: dsi: Support dynamic connector selection
...
Add implementation of mtk_dsi_encoder_index to mtk_ddp_comp_func
to make mtk_dsi support dynamic connector selection.
Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Reviewed-by: Fei Shao <fshao@chromium.org >
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Tested-by: Fei Shao <fshao@chromium.org >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20231004024013.18956-9-jason-jh.lin@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-10-08 01:11:26 +00:00
Jason-JH.Lin
f6ec9da1e7
drm/mediatek: dpi: Support dynamic connector selection
...
Add implementation of mtk_dpi_encoder_index to mtk_ddp_comp_func
to make mtk_dpi support dynamic connector selection.
Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com >
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20231004024013.18956-7-jason-jh.lin@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-10-08 00:59:12 +00:00
Jason-JH.Lin
01389b324c
drm/mediatek: Add connector dynamic selection capability
...
Add dynamic select available connector flow in mtk_drm_crtc_create()
and mtk_drm_crtc_atomic_enable().
In mtk_drm_crtc_create(), if there is a connector routes array in drm
driver data, all components definded in the connector routes array will
be checked and their encoder_index will be set.
In mtk_drm_crtc_atomic_enable(), crtc will check its encoder_index to
identify which componet in the connector routes array should append.
Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com >
Signed-off-by: Nancy Lin <nancy.lin@mediatek.com >
Signed-off-by: Nathan Lu <nathan.lu@mediatek.com >
Tested-by: Fei Shao <fshao@chromium.org >
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20231004024013.18956-6-jason-jh.lin@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-10-08 00:57:21 +00:00
Jason-JH.Lin
a260f5624d
drm/mediatek: Add encoder_index interface for mtk_ddp_comp_funcs
...
To support dynamic connector selection function, each ddp_comp need to
get their encoder_index to identify which connector should be selected.
Add encoder_index interface for mtk_ddp_comp_funcs to get the encoder
identifier by drm_encoder_index().
Then drm driver will call mtk_ddp_comp_encoder_index_set() to store the
encoder_index to each ddp_comp in connector routes.
Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com >
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20231004024013.18956-5-jason-jh.lin@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-10-08 00:53:24 +00:00
Jason-JH.Lin
ebba096099
drm/mediatek: Fix using wrong drm private data to bind mediatek-drm
...
According to mtk_drm_kms_init(), the all_drm_private array in each
drm private data stores all drm private data in display path order.
In mtk_drm_get_all_drm_priv(), each element in all_drm_priv should have one
display path private data, such as:
all_drm_priv[CRTC_MAIN] should only have main_path data
all_drm_priv[CRTC_EXT] should only have ext_path data
all_drm_priv[CRTC_THIRD] should only have third_path data
So we need to add the length checking for each display path before
assigning their drm private data into all_drm_priv array.
Then the all_drm_private array in each drm private data needs to be
assigned in their display path order.
Fixes: 1ef7ed4835 ("drm/mediatek: Modify mediatek-drm for mt8195 multi mmsys support")
Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com >
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Tested-by: Fei Shao <fshao@chromium.org >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20231004024013.18956-4-jason-jh.lin@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-10-08 00:50:46 +00:00
Jason-JH.Lin
26c35d1d16
drm/mediatek: Add crtc path enum for all_drm_priv array
...
Add mtk_drm_crtc_path enum for each display path.
Instead of using array index of all_drm_priv in mtk_drm_kms_init(),
mtk_drm_crtc_path enum can make code more readable.
Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com >
Reviewed-by: Fei Shao <fshao@chromium.org >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Tested-by: Fei Shao <fshao@chromium.org >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20231004024013.18956-3-jason-jh.lin@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-10-08 00:47:58 +00:00
Jason-JH.Lin
ff64e4c31d
drm/mediatek: Add mmsys_dev_num to mt8188 vdosys0 driver data
...
Add missing mmsys_dev_num to mt8188 vdosys0 driver data.
Fixes: 54b4808027 ("drm/mediatek: Add mediatek-drm of vdosys0 support for mt8188")
Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Reviewed-by: Fei Shao <fshao@chromium.org >
Tested-by: Fei Shao <fshao@chromium.org >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20231004024013.18956-2-jason-jh.lin@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-10-08 00:45:14 +00:00
Shuijing Li
609252ea46
drm/mediatek: dsi: Add mode_valid callback to DSI bridge
...
Support IGT (Intel GPU Tools) in Mediatek DSI driver.
According to the description of MIPI Alliance Specification for D-PHY
Version 1.1, the maximum supported data rate is 1.5Gbps, so add mode_valid
callback to dsi bridge to filter out the data rate exceeding the
Specification.
Signed-off-by: Shuijing Li <shuijing.li@mediatek.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230823092047.32258-1-shuijing.li@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-09-27 22:53:54 +00:00
Jani Nikula
fcaf9761fd
drm/mediatek/dp: fix memory leak on ->get_edid callback error path
...
Setting new_edid to NULL leaks the buffer.
Fixes: f70ac097a2 ("drm/mediatek: Add MT8195 Embedded DisplayPort driver")
Cc: Markus Schneider-Pargmann <msp@baylibre.com >
Cc: Guillaume Ranquet <granquet@baylibre.com >
Cc: Bo-Chen Chen <rex-bc.chen@mediatek.com >
Cc: CK Hu <ck.hu@mediatek.com >
Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Cc: Dmitry Osipenko <dmitry.osipenko@collabora.com >
Cc: Chun-Kuang Hu <chunkuang.hu@kernel.org >
Cc: Philipp Zabel <p.zabel@pengutronix.de >
Cc: Matthias Brugger <matthias.bgg@gmail.com >
Cc: dri-devel@lists.freedesktop.org
Cc: linux-mediatek@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: <stable@vger.kernel.org > # v6.1+
Signed-off-by: Jani Nikula <jani.nikula@intel.com >
Reviewed-by: Guillaume Ranquet <granquet@baylibre.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230914131058.2472260-1-jani.nikula@intel.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-09-24 14:35:41 +00:00
Jani Nikula
dab12fa8d2
drm/mediatek/dp: fix memory leak on ->get_edid callback audio detection
...
The sads returned by drm_edid_to_sad() needs to be freed.
Fixes: e71a8ebbe0 ("drm/mediatek: dp: Audio support for MT8195")
Cc: Guillaume Ranquet <granquet@baylibre.com >
Cc: Bo-Chen Chen <rex-bc.chen@mediatek.com >
Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Cc: Dmitry Osipenko <dmitry.osipenko@collabora.com >
Cc: Chun-Kuang Hu <chunkuang.hu@kernel.org >
Cc: Philipp Zabel <p.zabel@pengutronix.de >
Cc: Matthias Brugger <matthias.bgg@gmail.com >
Cc: dri-devel@lists.freedesktop.org
Cc: linux-mediatek@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: <stable@vger.kernel.org > # v6.1+
Signed-off-by: Jani Nikula <jani.nikula@intel.com >
Reviewed-by: Chen-Yu Tsai <wenst@chromium.org >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230914155317.2511876-1-jani.nikula@intel.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-09-24 14:19:44 +00:00
Shuijing Li
350c3fe907
drm/mediatek: dp: Add support MT8188 dp/edp function
...
Add support MT8188 dp/edp function
Signed-off-by: Shuijing Li <shuijing.li@mediatek.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230822024155.26670-5-shuijing.li@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-09-24 14:00:23 +00:00
Shuijing Li
d2f7f1ba5c
drm/mediatek: dp: Add the audio divider to mtk_dp_data struct
...
Due to the difference of HW, different dividers need to be set.
Signed-off-by: Shuijing Li <shuijing.li@mediatek.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230822024155.26670-4-shuijing.li@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-09-24 13:58:25 +00:00
Shuijing Li
2d50377348
drm/mediatek: dp: Add the audio packet flag to mtk_dp_data struct
...
The audio packet arrangement function is to only arrange audio
packets into the Hblanking area. In order to align with the HW
default setting of mt8195, this function needs to be turned off.
Signed-off-by: Shuijing Li <shuijing.li@mediatek.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230822024155.26670-3-shuijing.li@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-09-24 13:56:33 +00:00
Jason-JH.Lin
b0b0d811ea
drm/mediatek: Fix coverity issue with unintentional integer overflow
...
1. Instead of multiplying 2 variable of different types. Change to
assign a value of one variable and then multiply the other variable.
2. Add a int variable for multiplier calculation instead of calculating
different types multiplier with dma_addr_t variable directly.
Fixes: 1a64a7aff8 ("drm/mediatek: Fix cursor plane no update")
Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com >
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com >
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230907091425.9526-1-jason-jh.lin@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-09-11 15:02:22 +00:00
Shuijing Li
814d5341f3
drm/mediatek: Add mt8188 dsi compatible to mtk_dsi.c
...
Add the compatible because there are different definitions for cmdq
register bit control in mt8188.
Signed-off-by: Shuijing Li <shuijing.li@mediatek.com >
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230911120800.17369-4-shuijing.li@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-09-11 14:56:33 +00:00
Shuijing Li
2ccf6e2580
drm/mediatek: dsi: Add dsi cmdq_ctl to send panel initial code
...
For mt8188, add dsi cmdq reg control to send long packets to panel
initialization. MT8188 hardware has been changed to automatically
set the cmdq_size value by default when sending long packets.
In this patch, the cmdq_size value is set manually instead.
Remain consistent with previous IC.
Signed-off-by: Shuijing Li <shuijing.li@mediatek.com >
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230911120800.17369-3-shuijing.li@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-09-11 14:54:11 +00:00
Dave Airlie
e1f9c849b5
Merge tag 'mediatek-drm-next-6.6' of https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux into drm-next
...
Mediatek DRM Next for Linux 6.6
1. Small mtk-dpi cleanups
2. DisplayPort: support eDP and aux-bus
3. Fix uninitialized symbol
4. Do not check for 0 return after calling platform_get_irq()
5. Convert to platform remove callback returning void
6. Fix coverity issues
7. Fix potential memory leak if vmap() fail
8. Fix void-pointer-to-enum-cast warning
9. Rid W=1 warnings from GPU
Signed-off-by: Dave Airlie <airlied@redhat.com >
From: Chun-Kuang Hu <chunkuang.hu@kernel.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20230813152726.14802-1-chunkuang.hu@kernel.org
2023-08-15 12:07:19 +10:00
Lee Jones
fb7e600df0
drm/mediatek/mtk_disp_ccorr: Remove half completed incorrect struct header
...
Fixes the following W=1 kernel build warning(s):
drivers/gpu/drm/mediatek/mtk_disp_ccorr.c:47: warning: Function parameter or member 'clk' not described in 'mtk_disp_ccorr'
drivers/gpu/drm/mediatek/mtk_disp_ccorr.c:47: warning: Function parameter or member 'regs' not described in 'mtk_disp_ccorr'
drivers/gpu/drm/mediatek/mtk_disp_ccorr.c:47: warning: Function parameter or member 'cmdq_reg' not described in 'mtk_disp_ccorr'
drivers/gpu/drm/mediatek/mtk_disp_ccorr.c:47: warning: Function parameter or member 'data' not described in 'mtk_disp_ccorr'
Cc: Chun-Kuang Hu <chunkuang.hu@kernel.org >
Cc: Philipp Zabel <p.zabel@pengutronix.de >
Cc: David Airlie <airlied@gmail.com >
Cc: Daniel Vetter <daniel@ffwll.ch >
Cc: Matthias Brugger <matthias.bgg@gmail.com >
Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Cc: dri-devel@lists.freedesktop.org
Cc: linux-mediatek@lists.infradead.org
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Lee Jones <lee@kernel.org >
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230609081732.3842341-6-lee@kernel.org/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-08-13 14:42:43 +00:00
Lee Jones
7bcb838c9a
drm/mediatek/mtk_disp_aal: Remove half completed incorrect struct header
...
Fixes the following W=1 kernel build warning(s):
drivers/gpu/drm/mediatek/mtk_disp_aal.c:39: warning: Function parameter or member 'clk' not described in 'mtk_disp_aal'
drivers/gpu/drm/mediatek/mtk_disp_aal.c:39: warning: Function parameter or member 'regs' not described in 'mtk_disp_aal'
drivers/gpu/drm/mediatek/mtk_disp_aal.c:39: warning: Function parameter or member 'cmdq_reg' not described in 'mtk_disp_aal'
drivers/gpu/drm/mediatek/mtk_disp_aal.c:39: warning: Function parameter or member 'data' not described in 'mtk_disp_aal'
Cc: Chun-Kuang Hu <chunkuang.hu@kernel.org >
Cc: Philipp Zabel <p.zabel@pengutronix.de >
Cc: David Airlie <airlied@gmail.com >
Cc: Daniel Vetter <daniel@ffwll.ch >
Cc: Matthias Brugger <matthias.bgg@gmail.com >
Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Cc: dri-devel@lists.freedesktop.org
Cc: linux-mediatek@lists.infradead.org
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Lee Jones <lee@kernel.org >
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230609081732.3842341-5-lee@kernel.org/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-08-13 14:40:23 +00:00
Jason-JH.Lin
89cba955f8
drm/mediatek: Fix void-pointer-to-enum-cast warning
...
1. Fix build warning message in mtk_disp_ovl_adaptor.c
>> drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c:415:10:
warning: cast to smaller integer type 'enum mtk_ovl_adaptor_comp_type'
from 'const void *' [-Wvoid-pointer-to-enum-cast]
type = (enum mtk_ovl_adaptor_comp_type)of_id->data;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
2. Also fix the same warning message in mtk_drm_drv.c
>> drivers/gpu/drm/mediatek/mtk_drm_drv.c:832:15:
warning: cast to smaller integer type 'enum mtk_ddp_comp_type'
from 'const void *' [-Wvoid-pointer-to-enum-cast]
comp_type = (enum mtk_ddp_comp_type)of_id->data;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com >
Fixes: 453c336463 ("drm/mediatek: Add ovl_adaptor support for MT8195")
Reported-by: kernel test robot <lkp@intel.com >
Closes: https://lore.kernel.org/oe-kbuild-all/202305042054.ZtWME9OU-lkp@intel.com/
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230621075421.1982-1-jason-jh.lin@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-08-13 14:33:59 +00:00
Sui Jingfeng
379091e0f6
drm/mediatek: Fix potential memory leak if vmap() fail
...
Also return -ENOMEM if such a failure happens, the implement should take
responsibility for the error handling.
Fixes: 3df64d7b0a ("drm/mediatek: Implement gem prime vmap/vunmap function")
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com >
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com >
Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230706134000.130098-1-suijingfeng@loongson.cn/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-08-13 14:26:13 +00:00
Jason-JH.Lin
ed6adfb7d4
drm/mediatek: Fix dereference before null check
...
Null-checking state suggests that it may be null, but it has already
been dereferenced on drm_atomic_get_new_plane_state(state, plane).
The parameter state will never be NULL currently, so just remove the
state is NULL flow in this function.
Fixes: 5ddb0bd4dd ("drm/atomic: Pass the full state to planes async atomic check and update")
Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com >
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230714094908.13087-5-jason-jh.lin@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-08-10 23:50:32 +00:00
Jason-JH.Lin
d761b9450e
drm/mediatek: Add cnt checking for coverity issue
...
CERT-C Characters and Strings (CERT STR31-C)
all_drm_priv[cnt] evaluates to an address that could be at negative
offset of an array.
In mtk_drm_get_all_drm_priv():
Guarantee that storage for strings has sufficient space for character
data and the null terminator.
So change cnt to unsigned int and check its max value.
Fixes: 1ef7ed4835 ("drm/mediatek: Modify mediatek-drm for mt8195 multi mmsys support")
Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com >
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230714094908.13087-3-jason-jh.lin@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-08-10 23:47:49 +00:00
Jason-JH.Lin
27b9e2ea3f
drm/mediatek: Remove freeing not dynamic allocated memory
...
Fixing the coverity issue of:
mtk_drm_cmdq_pkt_destroy frees address of mtk_crtc->cmdq_handle
So remove the free function.
Fixes: 7627122fd1 ("drm/mediatek: Add cmdq_handle in mtk_crtc")
Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com >
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230714094908.13087-2-jason-jh.lin@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-08-10 23:46:17 +00:00
Uwe Kleine-König
b3af12a0b4
drm/mediatek: Convert to platform remove callback returning void
...
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.
Trivially convert the mediatek drm drivers from always returning zero in
the remove callback to the void returning variant.
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com >
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de >
Reviewed-by: Jyri Sarha <jyri.sarha@iki.fi >
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de >
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230801110239.831099-8-u.kleine-koenig@pengutronix.de/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-08-10 23:41:55 +00:00
Ruan Jinjie
61a97dec5f
drm/mediatek: Do not check for 0 return after calling platform_get_irq()
...
It is not possible for platform_get_irq() to return 0. Use the
return value from platform_get_irq().
Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230803040401.3067484-3-ruanjinjie@huawei.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-08-10 23:36:10 +00:00
AngeloGioacchino Del Regno
828c91231f
drm/mediatek: dp: Don't register HPD interrupt handler for eDP case
...
The interrupt handler for HPD is useful only if a display is actually
supposed to be hotpluggable, as that manages the machinery to perform
cable (un)plug detection, debouncing and setup for re-training.
Since eDP panels are not supposed to be hotpluggable we can avoid
using the HPD interrupts altogether and rely on HPD polling only
for the suspend/resume case, saving us some spinlocking action and
the overhead of interrupts firing at every suspend/resume cycle,
achieving a faster (even if just slightly) display resume.
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Tested-by: Chen-Yu Tsai <wenst@chromium.org >
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230725073234.55892-12-angelogioacchino.delregno@collabora.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-08-09 23:28:04 +00:00
AngeloGioacchino Del Regno
7eacba9a08
drm/mediatek: dp: Add .wait_hpd_asserted() for AUX bus
...
In order to support usecases in which the panel regulator can be
switched on and off to save power, and usecases in which the panel
regulator is off at boot, add a .wait_hpd_asserted() callback for
the AUX bus: this will make sure to wait until the panel is fully
ready after power-on before trying to communicate with it.
Also, parse the eDP display capabilities in that callback, so that
we can also avoid using the .get_edid() callback from this bridge.
Since at this point the hpd machinery is performed in the new hpd
callback and the detection and edid reading are done outside of
this driver, assign the DRM_BRIDGE_OP_{DETECT, EDID, HPD} ops and
register the bridge unconditionally at probe time only if we are
probing full DisplayPort and not eDP while, for the latter, we
register the bridge in the .done_probing() callback and only if
the panel was found and triggered HPD.
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Tested-by: Chen-Yu Tsai <wenst@chromium.org >
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230725073234.55892-11-angelogioacchino.delregno@collabora.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-08-09 23:26:28 +00:00
AngeloGioacchino Del Regno
caf2ae4867
drm/mediatek: dp: Add support for embedded DisplayPort aux-bus
...
For the eDP case we can support using aux-bus on MediaTek DP: this
gives us the possibility to declare our panel as generic "panel-edp"
which will automatically configure the timings and available modes
via the EDID that we read from it.
To do this, move the panel parsing at the end of the probe function
so that the hardware is initialized beforehand and also initialize
the DPTX AUX block and power both on as, when we populate the
aux-bus, the panel driver will trigger an EDID read to perform
panel detection.
Last but not least, since now the AUX transfers can happen in the
separated aux-bus, it was necessary to add an exclusion for the
cable_plugged_in check in `mtk_dp_aux_transfer()` and the easiest
way to do this is to simply ignore checking that when the bridge
type is eDP.
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Tested-by: Chen-Yu Tsai <wenst@chromium.org >
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230725073234.55892-10-angelogioacchino.delregno@collabora.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-08-09 23:25:00 +00:00
AngeloGioacchino Del Regno
18ccc237cf
drm/mediatek: dp: Move PHY registration to new function
...
In preparation for adding support for eDP, move the PHY registration
code to a new mtk_dp_register_phy() function for better readability.
This commit brings no functional changes.
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Tested-by: Chen-Yu Tsai <wenst@chromium.org >
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230725073234.55892-9-angelogioacchino.delregno@collabora.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-08-09 23:21:58 +00:00
AngeloGioacchino Del Regno
848bc59f77
drm/mediatek: dp: Avoid mutex locks if audio is not supported/enabled
...
If a controller (usually, eDP!) does not support audio, or audio is not
enabled because the endpoint has no audio support, it's useless to lock
a mutex only to unlock it right after because there's no .plugged_cb().
Check if the audio is supported and enabled before locking the mutex in
mtk_dp_update_plugged_status(): if not, we simply return immediately.
While at it, since the update_plugged_status_lock mutex would not be
used if the controller doesn't support audio at all, initialize it
only if `audio_supported` is true.
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Tested-by: Chen-Yu Tsai <wenst@chromium.org >
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230725073234.55892-8-angelogioacchino.delregno@collabora.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-08-09 23:20:30 +00:00
AngeloGioacchino Del Regno
779b8d20ca
drm/mediatek: dp: Enable event interrupt only when bridge attached
...
It is useless and error-prone to enable the DisplayPort event interrupt
before finishing to probe and install the driver, as the DP training
cannot happen before the entire pipeline is correctly set up, as the
interrupt handler also requires the full hardware to be initialized by
mtk_dp_bridge_attach().
Anyway, depending in which state the controller is left from the
bootloader, this may cause an interrupt storm and consequently hang
the kernel during boot, so, avoid enabling the interrupt until we
reach a clean state by adding the IRQ_NOAUTOEN flag before requesting
it at probe time and manage the enablement of the ISR in the .attach()
and .detach() handlers for the DP bridge.
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Tested-by: Chen-Yu Tsai <wenst@chromium.org >
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230725073234.55892-7-angelogioacchino.delregno@collabora.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-08-09 23:17:59 +00:00
AngeloGioacchino Del Regno
c3b9d21ef5
drm/mediatek: dp: Move AUX_P0 setting to mtk_dp_initialize_aux_settings()
...
Move the register write to MTK_DP_AUX_P0_3690 to set the AUX reply mode
to function mtk_dp_initialize_aux_settings(), as this is effectively
part of the DPTX AUX setup sequence.
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Tested-by: Chen-Yu Tsai <wenst@chromium.org >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230725073234.55892-6-angelogioacchino.delregno@collabora.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-08-09 23:16:29 +00:00
AngeloGioacchino Del Regno
214a0944e6
drm/mediatek: dp: Use devm variant of drm_bridge_add()
...
In preparation for adding support for aux-bus, which will add a code
path that may fail after the drm_bridge_add() call, change that to
devm_drm_bridge_add() to simplify failure paths later.
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Tested-by: Chen-Yu Tsai <wenst@chromium.org >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230725073234.55892-5-angelogioacchino.delregno@collabora.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-08-09 23:13:58 +00:00
AngeloGioacchino Del Regno
fd70e2019b
drm/mediatek: dp: Change logging to dev for mtk_dp_aux_transfer()
...
Change logging from drm_{err,info}() to dev_{err,info}() in functions
mtk_dp_aux_transfer() and mtk_dp_aux_do_transfer(): this will be
essential to avoid getting NULL pointer kernel panics if any kind
of error happens during AUX transfers happening before the bridge
is attached.
This may potentially start happening in a later commit implementing
aux-bus support, as AUX transfers will be triggered from the panel
driver (for EDID) before the mtk-dp bridge gets attached, and it's
done in preparation for the same.
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Tested-by: Chen-Yu Tsai <wenst@chromium.org >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230725073234.55892-4-angelogioacchino.delregno@collabora.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-08-09 23:12:21 +00:00
AngeloGioacchino Del Regno
e04b56cd03
drm/mediatek: dp: Move AUX and panel poweron/off sequence to function
...
Everytime we run bridge detection and/or EDID read we run a poweron
and poweroff sequence for both the AUX and the panel; moreover, this
is also done when enabling the bridge in the .atomic_enable() callback.
Move this power on/off sequence to a new mtk_dp_aux_panel_poweron()
function as to commonize it.
Note that, before this commit, in mtk_dp_bridge_atomic_enable() only
the AUX was getting powered on but the panel was left powered off if
the DP cable wasn't plugged in while now we unconditionally send a D0
request and this is done for two reasons:
- First, whether this request fails or not, it takes the same time
and anyway the DP hardware won't produce any error (or, if it
does, it's ignorable because it won't block further commands)
- Second, training the link between a sleeping/standby/unpowered
display makes little sense.
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Tested-by: Chen-Yu Tsai <wenst@chromium.org >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230725073234.55892-3-angelogioacchino.delregno@collabora.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-08-09 23:10:46 +00:00
AngeloGioacchino Del Regno
cfc146137a
drm/mediatek: dp: Add missing error checks in mtk_dp_parse_capabilities
...
If reading the RX capabilities fails the training pattern will be set
wrongly: add error checking for drm_dp_read_dpcd_caps() and return if
anything went wrong with it.
While at it, also add a less critical error check when writing to
clear the ESI0 IRQ vector.
Fixes: f70ac097a2 ("drm/mediatek: Add MT8195 Embedded DisplayPort driver")
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Tested-by: Chen-Yu Tsai <wenst@chromium.org >
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230725073234.55892-2-angelogioacchino.delregno@collabora.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-08-09 23:07:50 +00:00
AngeloGioacchino Del Regno
61d9afafa0
drm/mediatek: mtk_dpi: Compress struct of_device_id entries
...
Reduce line count by compressing the entries of struct of_device_id;
while at it, also add the usual /* sentinel */ comment to the last
entry.
This commit brings no functional changes.
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Reviewed-by: Fei Shao <fshao@chromium.org >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230726082245.550929-7-angelogioacchino.delregno@collabora.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2023-08-09 23:03:27 +00:00