platform/kernel/linux-starfive.git
15 months agoMerge tag 'amd-drm-next-6.4-2023-03-31' of https://gitlab.freedesktop.org/agd5f/linux...
Daniel Vetter [Mon, 3 Apr 2023 08:25:44 +0000 (10:25 +0200)]
Merge tag 'amd-drm-next-6.4-2023-03-31' of https://gitlab.freedesktop.org/agd5f/linux into drm-next

amd-drm-next-6.4-2023-03-31:

amdgpu:
- Misc code cleanups
- S4 fixes
- MES fixes
- SR-IOV fixes
- Link DC backlight to connector device rather than PCI device
- W=1 fixes
- ASPM quirk
- RAS fixes
- DC dynamic split fixes and enablement for remaining chips
- Navi1x SMU fix
- Initial NBIO 7.9 support
- Initial GC 9.4.3 support
- Initial GFXHUB 1.2 support
- Initial MMHUB 1.8 support
- DCN 3.1.5 fixes
- Initial DC FAMs infrastructure
- Add support for 6.75Gbps link rates
- Add sysfs nodes for secondary VCN clocks

amdkfd:
- Initial support for GC 9.4.3

radeon:
- Convert to client-based fbdev emulation

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
From: Alex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230331221955.7896-1-alexander.deucher@amd.com
15 months agoMerge tag 'drm-misc-next-2023-03-31' of git://anongit.freedesktop.org/drm/drm-misc...
Daniel Vetter [Mon, 3 Apr 2023 07:20:51 +0000 (09:20 +0200)]
Merge tag 'drm-misc-next-2023-03-31' of git://anongit.freedesktop.org/drm/drm-misc into drm-next

drm-misc-next for v6.4-rc1:

Cross-subsystem Changes:
- DT bindings update for adding Mali MT81xx devices.
- Assorted DT binding updates.

Core Changes:
- Documentation update to scheduler.

Driver Changes:
- Add support for the same mali devices.
- Add support for speed binning to panfrost.
- Add B133UAN01.0 eDP panel.
- Assorted small fixes to bridge/ps8640, bridge/it6505, panel/magnachip.
- Use of_property_read_bool in ps8622 and ofdrm.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/36f4efa4-26e9-49df-287e-d193422c990d@linux.intel.com
15 months agodrm/amd/pm: enable sysfs node vclk1 and dclk1 for NV3X
Tong Liu01 [Thu, 30 Mar 2023 03:10:31 +0000 (11:10 +0800)]
drm/amd/pm: enable sysfs node vclk1 and dclk1 for NV3X

Enable node pp_dpm_vclk1 and pp_dpm_dclk1 for gc11.0.2 and gc11.0.3

Signed-off-by: Tong Liu01 <Tong.Liu01@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amd/pm: enable sysfs node vclk1 and dclk1 for NV2X
Tong Liu01 [Thu, 30 Mar 2023 03:09:37 +0000 (11:09 +0800)]
drm/amd/pm: enable sysfs node vclk1 and dclk1 for NV2X

Enable vclk1 and dclk1 node for gc10.3.0 and gc10.3.1

Signed-off-by: Tong Liu01 <Tong.Liu01@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amd/pm: add sysfs node vclk1 and dclk1
Tong Liu01 [Thu, 30 Mar 2023 03:07:08 +0000 (11:07 +0800)]
drm/amd/pm: add sysfs node vclk1 and dclk1

User can check pp_dpm_vclk1 and pp_dpm_dclk1 for DPM frequency of
vcn and dcn

Signed-off-by: Tong Liu01 <Tong.Liu01@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amd/display: Mark function 'optc3_wait_drr_doublebuffer_pending_clear' as static
Caio Novais [Wed, 29 Mar 2023 18:05:34 +0000 (15:05 -0300)]
drm/amd/display: Mark function 'optc3_wait_drr_doublebuffer_pending_clear' as static

Compiling AMD GPU drivers displays a warning:

drivers/gpu/drm/amd/amdgpu/../display/dc/dcn30/dcn30_optc.c:294:6: warning: no previous prototype for ‘optc3_wait_drr_doublebuffer_pending_clear’ [-Wmissing-prototypes]

Get rid of it by marking the function as static

Signed-off-by: Caio Novais <caionovais@usp.br>
Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amdkfd: Set TG_CHUNK_SIZE for GC 9.4.3
Amber Lin [Mon, 6 Dec 2021 09:22:42 +0000 (17:22 +0800)]
drm/amdkfd: Set TG_CHUNK_SIZE for GC 9.4.3

On GC 9.4.3, DW 41 in MQD is repurposed as compute_tg_chunk_size
for cooperative dispatch. When it's a AQL queue, set compute_tg_chunk_size
as 1 to spread work groups evenly among XCCs. If it's PM4 queue, unset
compute_tg_chunk_size to disable cooperative mode.

v3: set compute_tg_chunk_size as 1 instead of #CUs per XCC
v2: set compute_tg_chunk_size as #CUs per XCC instead of total wave
slots per XCC

Signed-off-by: Amber Lin <Amber.Lin@amd.com>
Reviewed-by: Sean Keely <Sean.Keely@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amdkfd: Trap handler changes for GC 9.4.3 v2
Jay Cornwall [Sat, 23 Jul 2022 09:29:43 +0000 (17:29 +0800)]
drm/amdkfd: Trap handler changes for GC 9.4.3 v2

v1:
Check new exception bits in TRAPSTS register
Remove single step exception workaround, now part of
exception bits

v2:
GC 9.4.3 uses ttmp11 to store {1’b0, dispatch index [24:0],
wave_id_in_workgroup[5:0]}, so use ttmp13 instead of ttmp11 to
preserve ib_sts. (Laurent)

Signed-off-by: Jay Cornwall <jay.cornwall@amd.com>
Signed-off-by: Laurent Morichetti <Laurent.Morichetti@amd.com>
Reviewed-by: Laurent Morichetti <laurent.morichetti@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amd/display: Remove unused variable 'scl_enable'
Caio Novais [Tue, 28 Mar 2023 22:09:46 +0000 (19:09 -0300)]
drm/amd/display: Remove unused variable 'scl_enable'

Compiling AMD GPU drivers displays a warning:

drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn314/display_rq_dlg_calc_314.c: In function ‘dml_rq_dlg_get_dlg_params’:
drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn314/display_rq_dlg_calc_314.c:991:14: warning: variable ‘scl_enable’ set but not used [-Wunused-but-set-variable]

Get rid of it by removing the variable 'scl_enable'.

Signed-off-by: Caio Novais <caionovais@usp.br>
Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amdkfd: Set noretry/xnack for GC 9.4.3
Amber Lin [Wed, 9 Jun 2021 16:36:35 +0000 (12:36 -0400)]
drm/amdkfd: Set noretry/xnack for GC 9.4.3

For GC 9.4.3, disable retry as default and XNACK can be different
modes per process.

Signed-off-by: Amber Lin <Amber.Lin@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amd/display: Whitespace cleanup
Uwe Kleine-König [Mon, 27 Mar 2023 16:07:54 +0000 (18:07 +0200)]
drm/amd/display: Whitespace cleanup

Commit 075e2099c32c ("drm/amd/display: Fix race condition in DPIA AUX
transfer") was backported to stable, which I noticed because of git
saying

linux-6.1/.git/rebase-apply/patch:37154: space before tab in indent.

while applying patch-6.1.21. While fixing the code location that issued
that warning, improve in few more places.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amdkfd: Add GC 9.4.3 KFD support
Hawking Zhang [Mon, 6 Dec 2021 09:25:46 +0000 (17:25 +0800)]
drm/amdkfd: Add GC 9.4.3 KFD support

Add initial KFD support
Convert a few structures to IP version checking (Hawking)

Signed-off-by: Elena Sakhnovitch <elena.sakhnovitch@amd.com>
Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Amber Lin <Amber.Lin@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amd/display: Promote DAL to 3.2.229
Aric Cyr [Mon, 20 Mar 2023 05:26:59 +0000 (01:26 -0400)]
drm/amd/display: Promote DAL to 3.2.229

This DC version brings along:
- Enable FPO optimization
- Support for 6.75 GBps link rate
- Fixes to underflow, black screen and more

Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
Signed-off-by: Aric Cyr <aric.cyr@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amd/display: Uncomment assignments after HW headers are promoted
Alvin Lee [Fri, 17 Mar 2023 21:56:39 +0000 (17:56 -0400)]
drm/amd/display: Uncomment assignments after HW headers are promoted

[Description]
Assign the correct info now that FW headers are promoted

Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
Signed-off-by: Alvin Lee <Alvin.Lee2@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amd/display: [FW Promotion] Release 0.0.160.0
Anthony Koo [Sat, 18 Mar 2023 15:17:16 +0000 (11:17 -0400)]
drm/amd/display: [FW Promotion] Release 0.0.160.0

- New parameter to define extra vblank stretch required when
 doing FPO + Vactive
- Pass in pipe index for FPO

Reviewed-by: Alvin Lee <Alvin.Lee2@amd.com>
Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
Signed-off-by: Anthony Koo <Anthony.Koo@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amd/display: skip CLEAR_PAYLOAD_ID_TABLE if device mst_en is 0
Peichen Huang [Mon, 20 Mar 2023 01:34:23 +0000 (09:34 +0800)]
drm/amd/display: skip CLEAR_PAYLOAD_ID_TABLE if device mst_en is 0

[Why]
Some dock and mst monitor don't like to receive CLEAR_PAYLOAD_ID_TABLE
when mst_en is set to 0. It doesn't make sense to do so in source
side, either.

[How]
Don't send CLEAR_PAYLOAD_ID_TABLE if mst_en is 0

Reviewed-by: George Shen <George.Shen@amd.com>
Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
Signed-off-by: Peichen Huang <PeiChen.Huang@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amd/display: Enable FPO optimization
Alvin Lee [Fri, 17 Mar 2023 19:18:03 +0000 (15:18 -0400)]
drm/amd/display: Enable FPO optimization

[Description]
Enable optimization for preferring FPO if it achieves
a lower voltage level

Reviewed-by: George Shen <George.Shen@amd.com>
Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
Signed-off-by: Alvin Lee <Alvin.Lee2@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amd/display: Only keep cursor p-state force for FPO
Alvin Lee [Fri, 17 Mar 2023 18:08:55 +0000 (14:08 -0400)]
drm/amd/display: Only keep cursor p-state force for FPO

[Description]
If transitioning from an FPO config -> FPO config, we want
to keep cursor P-State force disallowed. Any other transition
from FPO config -> non FPO config should unforce the cursor
P-State disallow

Reviewed-by: Wesley Chalmers <Wesley.Chalmers@amd.com>
Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
Signed-off-by: Alvin Lee <Alvin.Lee2@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amd/display: Conditionally enable 6.75 GBps link rate
Artem Grishin [Wed, 15 Mar 2023 22:17:59 +0000 (18:17 -0400)]
drm/amd/display: Conditionally enable 6.75 GBps link rate

[Why]
The 6.75 GBps link rate is part of the new eDP specification
version 1.5 is going to be supported in the future.

Since this standard is very new and there are no existing 6.75 GBps
panels on the market yet, we should put a condition in the driver
on enabling this feature until we can validate it with real hardware.

[How]
- Add boolean flag support_eDP1_5 in struct dc_debug_options.
- Enable the 6.75 link rate in reduce_link_rate(...) only when
  the flag is true.

Reviewed-by: Charlene Liu <Charlene.Liu@amd.com>
Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
Signed-off-by: Artem Grishin <Artem.Grishin@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amd/display: Add support for 6.75 GBps link rate
Artem Grishin [Tue, 14 Mar 2023 20:11:39 +0000 (16:11 -0400)]
drm/amd/display: Add support for 6.75 GBps link rate

[Why]
The latest eDP spec version 1.5 defines a new generic link
rate of 6.75 Gbps/Lane, which needs to be supported in the driver.

[How]
Added new element to the dc_link_rate enum

Reviewed-by: Charlene Liu <Charlene.Liu@amd.com>
Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
Signed-off-by: Artem Grishin <Artem.Grishin@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amd/display: fixed dcn30+ underflow issue
Ayush Gupta [Thu, 16 Mar 2023 19:57:30 +0000 (15:57 -0400)]
drm/amd/display: fixed dcn30+ underflow issue

[Why]
Observing underflow on dcn30+ system config at 4k144hz

[How]
We set the UCLK hardmax on AC/DC switch if softmax is enabled
and also on boot. While booting up the UCLK Hardmax is set
to softmax before the init sequence and the init sequence
resets the hardmax to UCLK max which enables P-state switching.
Just added a conditional check to avoid setting hardmax on init.

Reviewed-by: Alvin Lee <Alvin.Lee2@amd.com>
Reviewed-by: Martin Leung <Martin.Leung@amd.com>
Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
Signed-off-by: Ayush Gupta <ayugupta@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amd/display: Use per pipe P-State force for FPO
Alvin Lee [Wed, 15 Mar 2023 21:40:49 +0000 (17:40 -0400)]
drm/amd/display: Use per pipe P-State force for FPO

[Description]
*  Pass in pipe index for FPO cmd to DMCUB
- This change will pass in the pipe index for each stream
  that is using FPO
- This change is in preparation to enable FPO + VActive

*  Use per pipe P-State force for FPO
- For FPO, instead of using max watermarks value for P-State disallow,
  use per pipe p-state force instead
- This is in preparation to enable FPO + VActive

Reviewed-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
Signed-off-by: Alvin Lee <Alvin.Lee2@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amd/display: Add infrastructure for enabling FAMS for DCN30
Qingqing Zhuo [Mon, 20 Mar 2023 09:24:41 +0000 (05:24 -0400)]
drm/amd/display: Add infrastructure for enabling FAMS for DCN30

As part of the FAMS work, we need code infrastructure in DC.
dcn30_fpu.c changes went missing during previous upstream
activity.

Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
Signed-off-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amd/display: Add 90Mhz to video_optimized_pixel_rates
Taimur Hassan [Tue, 14 Mar 2023 21:39:03 +0000 (17:39 -0400)]
drm/amd/display: Add 90Mhz to video_optimized_pixel_rates

[Why & How]
Needed to get certain EDID to light up during TMDS compliance.

Reviewed-by: Charlene Liu <Charlene.Liu@amd.com>
Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
Signed-off-by: Taimur Hassan <Syed.Hassan@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amd/display: w/a for dcn315 inconsistent smu clock table
Dmytro Laktyushkin [Tue, 14 Mar 2023 14:20:33 +0000 (10:20 -0400)]
drm/amd/display: w/a for dcn315 inconsistent smu clock table

[Why & How]
w/a for dcn315 inconsistent smu clock.

Reviewed-by: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
Signed-off-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amd/display: update dig enable sequence
Charlene Liu [Sat, 11 Mar 2023 02:18:06 +0000 (21:18 -0500)]
drm/amd/display: update dig enable sequence

[why]
HW delta follow up

Reviewed-by: Chris Park <Chris.Park@amd.com>
Reviewed-by: Jun Lei <Jun.Lei@amd.com>
Reviewed-by: Jerry Zuo <Jerry.Zuo@amd.com>
Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
Signed-off-by: Charlene Liu <Charlene.Liu@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amd/display: fix double memory allocation
Martin Leung [Tue, 14 Mar 2023 13:27:20 +0000 (09:27 -0400)]
drm/amd/display: fix double memory allocation

[Why & How]
when trying to fix a nullptr dereference on VMs,
accidentally doubly allocated memory for the non VM
case. removed the extra link_srv creation since
dc_construct_ctx is called in both VM and non VM cases
Also added a proper fail check for if kzalloc fails

Cc: stable@vger.kernel.org
Cc: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Leo Ma <Hanghong.Ma@amd.com>
Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
Signed-off-by: Martin Leung <Martin.Leung@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amd/display: Fix 4to1 MPC black screen with DPP RCO
Nicholas Kazlauskas [Mon, 13 Mar 2023 17:23:45 +0000 (13:23 -0400)]
drm/amd/display: Fix 4to1 MPC black screen with DPP RCO

[Why]
DPP Root clock optimization when combined with 4to1 MPC combine results
in the screen turning black.

This is because the DPPCLK is stopped during the middle of an
optimize_bandwidth sequence during commit_minimal_transition without
going through plane power down/power up.

[How]
The intent of a 0Hz DPP clock through update_clocks is to disable the
DTO. This differs from the behavior of stopping the DPPCLK entirely
(utilizing a 0Hz clock on some ASIC) so it's better to move this logic
to reside next to plane power up/power down where we gate the HUBP/DPP
DOMAIN.

The new  sequence should be:
Power down: PG enabled -> RCO on
Power up: RCO off -> PG disabled

Rename power_on_plane to power_on_plane_resources to reflect the
actual operation that's occurring.

Cc: stable@vger.kernel.org
Cc: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amd/display: Update FCLK change latency
Alvin Lee [Mon, 13 Mar 2023 22:06:34 +0000 (18:06 -0400)]
drm/amd/display: Update FCLK change latency

[Descrtipion]
- Driver hardcoded FCLK P-State latency was incorrect
- Use the value provided by PMFW header instead

Reviewed-by: Nevenko Stupar <Nevenko.Stupar@amd.com>
Reviewed-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
Signed-off-by: Alvin Lee <Alvin.Lee2@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amd/display: Enable FPO for configs that could reduce vlevel
Alvin Lee [Mon, 13 Mar 2023 16:54:49 +0000 (12:54 -0400)]
drm/amd/display: Enable FPO for configs that could reduce vlevel

[Description]
- On high refresh rate DRR displays that support VBLANK naturally,
  UCLK could be idling at DPM1 instead of DPM0 since it doesn't use
  FPO
- To achieve DPM0, enable FPO on these configs even though it can
  support P-State without FPO
- Default disable for now, have debug option to enable

Reviewed-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
Signed-off-by: Alvin Lee <Alvin.Lee2@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amd/display: Add NULL plane_state check for cursor disable logic
Nicholas Kazlauskas [Sat, 11 Mar 2023 14:11:29 +0000 (09:11 -0500)]
drm/amd/display: Add NULL plane_state check for cursor disable logic

[Why]
While scanning the top_pipe connections we can run into a case where
the bottom pipe is still connected to a top_pipe but with a NULL
plane_state.

[How]
Treat a NULL plane_state the same as the plane being invisible for
pipe cursor disable logic.

Cc: stable@vger.kernel.org
Cc: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Charlene Liu <Charlene.Liu@amd.com>
Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amdgpu: Correct xgmi_wafl block name
Hawking Zhang [Tue, 28 Mar 2023 10:47:39 +0000 (18:47 +0800)]
drm/amdgpu: Correct xgmi_wafl block name

Fix backward compatibility issue to stay with
the old name of xgmi_wafl node.

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amd/pm: re-enable the gfx imu when smu resume
Tim Huang [Wed, 22 Mar 2023 06:39:16 +0000 (14:39 +0800)]
drm/amd/pm: re-enable the gfx imu when smu resume

If the gfx imu is poweroff when suspend, then
it need to be re-enabled when resume.

Signed-off-by: Tim Huang <tim.huang@amd.com>
Reviewed-by: Yifan Zhang <yifan1.zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amdgpu: Add JPEG IP block to SRIOV reinit
Yifan Zha [Tue, 28 Mar 2023 03:42:24 +0000 (11:42 +0800)]
drm/amdgpu: Add JPEG IP block to SRIOV reinit

[Why]
Reset(mode1) failed as JPRG IP did not reinit under sriov.

[How]
Add JPEG IP block to sriov reinit function.

Signed-off-by: Yifan Zha <Yifan.Zha@amd.com>
Reviewed-by: Horace Chen <Horace.Chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amd/amdgpu: Remove initialisation of globals to 0 or NULL
Srinivasan Shanmugam [Mon, 27 Mar 2023 17:58:47 +0000 (23:28 +0530)]
drm/amd/amdgpu: Remove initialisation of globals to 0 or NULL

Global variables do not need to be initialized to 0 or NULL and checkpatch
flags this error in drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c:

ERROR: do not initialise globals to NULL
+char *amdgpu_disable_cu = NULL;
+char *amdgpu_virtual_display = NULL;

Fix this checkpatch error.

Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Mario Limonciello <mario.limonciello@amd.com>
Cc: Hamza Mahfooz <Hamza.Mahfooz@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amdgpu: add GMC ip block for GC 9.4.3
Hawking Zhang [Mon, 3 Oct 2022 19:38:50 +0000 (15:38 -0400)]
drm/amdgpu: add GMC ip block for GC 9.4.3

Add GMC IP handling for GC 9.4.3

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Le Ma <Le.Ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amdgpu: initialize gfxhub v1_2 and mmhub v1_8 funcs
Le Ma [Wed, 14 Jul 2021 08:04:39 +0000 (16:04 +0800)]
drm/amdgpu: initialize gfxhub v1_2 and mmhub v1_8 funcs

Initialize gfxhub1.2 and mmhub1.8 function calls

Signed-off-by: Le Ma <le.ma@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amdgpu: add mmhub v1_8 support
Le Ma [Wed, 14 Jul 2021 07:48:28 +0000 (15:48 +0800)]
drm/amdgpu: add mmhub v1_8 support

Hack the mmhub 1.7 reg offset for initial support

v2: squash in header switch, CG funcs (Alex)

Signed-off-by: Le Ma <le.ma@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amdgpu: add mmhub v1_8_0 ip headers
Hawking Zhang [Sun, 24 Apr 2022 06:31:00 +0000 (14:31 +0800)]
drm/amdgpu: add mmhub v1_8_0 ip headers

Add mmhub v1_8_0 register offset and shift masks
header files

v2: update headers (Alex)

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Le Ma <Le.Ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amdgpu: add gfxhub v1_2 support
Le Ma [Wed, 14 Jul 2021 07:46:28 +0000 (15:46 +0800)]
drm/amdgpu: add gfxhub v1_2 support

Hack the gc 9.0 reg offset for initial support

v2: squash in header switch (Alex)

Signed-off-by: Le Ma <le.ma@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amdgpu: add gmc ip block support for GC 9.4.3
Hawking Zhang [Thu, 25 Nov 2021 14:15:49 +0000 (22:15 +0800)]
drm/amdgpu: add gmc ip block support for GC 9.4.3

Initialize various gmc sw/hw settings/configurations
for GC 9.4.3.

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Le Ma <Le.Ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amdgpu: add gc v9_4_3 ip headers
Hawking Zhang [Wed, 11 May 2022 07:02:57 +0000 (15:02 +0800)]
drm/amdgpu: add gc v9_4_3 ip headers

Add gc v9_4_3 register offset and shift masks
header files

v2: update headers (Alex)
v3: more updates (Alex)

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Le Ma <Le.Ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amdgpu: add osssys v4_4_2 ip headers
Hawking Zhang [Sun, 24 Apr 2022 06:40:13 +0000 (14:40 +0800)]
drm/amdgpu: add osssys v4_4_2 ip headers

Add osssys v4_4_2 register offset and shift masks
header files

v2: update headers (Alex)

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Le Ma <Le.Ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amdgpu: add athub v1_8_0 ip headers
Hawking Zhang [Sun, 24 Apr 2022 06:22:37 +0000 (14:22 +0800)]
drm/amdgpu: add athub v1_8_0 ip headers

Add athub v1_8_0 register offset and shift masks
header files

v2: update headers (Alex)

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Le Ma <Le.Ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amdgpu: Set family for GC 9.4.3
Hawking Zhang [Mon, 3 Oct 2022 19:44:40 +0000 (15:44 -0400)]
drm/amdgpu: Set family for GC 9.4.3

Set family for GC 9.4.3

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Le Ma <Le.Ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amdgpu: init nbio v7_9 callbacks
Hawking Zhang [Thu, 25 Nov 2021 15:33:30 +0000 (23:33 +0800)]
drm/amdgpu: init nbio v7_9 callbacks

switch to the new nbio generation for NBIO 7.9.0.

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Le Ma <Le.Ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amdgpu: add nbio v7_9 support
Hawking Zhang [Tue, 17 May 2022 14:13:35 +0000 (22:13 +0800)]
drm/amdgpu: add nbio v7_9 support

v7_9 is a new nbio generation ip.

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Le Ma <Le.Ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amdgpu: add nbio v7_9_0 ip headers
Hawking Zhang [Sun, 24 Apr 2022 06:36:37 +0000 (14:36 +0800)]
drm/amdgpu: add nbio v7_9_0 ip headers

Add nbio v7_9_0 register offset and shift masks
header files

v2: update headers (Alex)
v3: squash in updates (Alex)

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Le Ma <Le.Ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/radeon: Only build fbdev if DRM_FBDEV_EMULATION is set
Thomas Zimmermann [Thu, 16 Mar 2023 09:37:38 +0000 (10:37 +0100)]
drm/radeon: Only build fbdev if DRM_FBDEV_EMULATION is set

Make building fbdev emulation depend on DRM_FBDEV_EMULATION. Also
rename the source file to radeon_fbdev.c to align with other fbdev
files.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/radeon: Implement client-based fbdev emulation
Thomas Zimmermann [Thu, 16 Mar 2023 09:37:37 +0000 (10:37 +0100)]
drm/radeon: Implement client-based fbdev emulation

Implement fbdev emulation on top of struct drm_client and its helpers.
Replaces ad-hoc interfaces for restoring and closing fbdev emulation with
per-client callbacks for hotplugging, restoring and unregistering.

A single function, radeon_fbdev_setup(), starts fbdev emulation after
the DRM device has been registered. Hence, fbdev acts like a regular
DRM client.

The setup call prepares the fbdev emulation and invokes connector
hotplugging. The first successful hotplug event initializes fbdev
emulation with a framebuffer, device file, etc.

Unregistering depends on the hotplug status. Fully initialized emulation
is cleaned up through drm_fb_helper_unregister_info() and fb_destroy.
For prepared-only setups, unregistering unprepares the emulation and
releases all resources. In both cases, fbdev emulation will be cleaned
up.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/radeon: Correctly clean up failed display probing
Thomas Zimmermann [Thu, 16 Mar 2023 09:37:36 +0000 (10:37 +0100)]
drm/radeon: Correctly clean up failed display probing

Improve the fbdev probing function to fully clean up if it failed.
Allows to remove special cases from fb_destroy as well.

This change is reorders the operations within radeonfb_probe(). It
first allocates a buffer object, then builds a DRM framebuffer for
the object and finally creates the fbdev device. If every step
succeeded, the probe function clears the framebuffer memory. This
is the optimal order to rollback any changes if any of the steps
fails.

No functional changes.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/radeon: Move fbdev cleanup code into fb_destroy callback
Thomas Zimmermann [Thu, 16 Mar 2023 09:37:35 +0000 (10:37 +0100)]
drm/radeon: Move fbdev cleanup code into fb_destroy callback

Fbdev calls struct fb_ops.fb_destroy after cleaning up the final
reference to an fbdev framebuffer. Move radeon's fbdev cleanup code
there.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/radeon: Fix coding style in fbdev emulation
Thomas Zimmermann [Thu, 16 Mar 2023 09:37:34 +0000 (10:37 +0100)]
drm/radeon: Fix coding style in fbdev emulation

Fix the coding style in several places in the fbdev-emulation
code. Also rename functions and structure file by comments. No
functional changes.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/radeon: Move fbdev object helpers before struct fb_ops et al
Thomas Zimmermann [Thu, 16 Mar 2023 09:37:33 +0000 (10:37 +0100)]
drm/radeon: Move fbdev object helpers before struct fb_ops et al

Move the helpers for creating and destroying fbdev GEM objects
to the top of the source file. Makes them available to fb_ops
functions. This will allow to implement framebuffer cleanup in
fb_destroy. No functional changes.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/radeon: Remove test for !screen_base in fbdev probing
Thomas Zimmermann [Thu, 16 Mar 2023 09:37:32 +0000 (10:37 +0100)]
drm/radeon: Remove test for !screen_base in fbdev probing

The screen_base field comes from the fbdev BO and contains the fbdev
framebuffer base address. We get the BO memory via radeon_bo_kmap(),
which already reports the error -ENOMEM if the buffer could not be
mapped. So remove the later test for screen_base, which will never
be NULL at this point.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/radeon: Remove struct radeon_fbdev
Thomas Zimmermann [Thu, 16 Mar 2023 09:37:31 +0000 (10:37 +0100)]
drm/radeon: Remove struct radeon_fbdev

Both data fields in struct radeon_fbdev, the framebuffer and the
device, are already available in struct drm_fb_helper. Simplify
radeon by converting all callers and removing struct radeon_fbdev.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/radeon: Improve fbdev object-test helper
Thomas Zimmermann [Thu, 16 Mar 2023 09:37:30 +0000 (10:37 +0100)]
drm/radeon: Improve fbdev object-test helper

Look up the framebuffer GEM object in fbdev object test with the
respective helper drm_gem_fb_get_obj(). The look-up helper warns if
no GEM object has been installed. Upcasting types prevents runtime
type checking, so avoid upcast to struct radeon_bo.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/radeon: Move radeon_align_pitch() next to dumb-buffer helpers
Thomas Zimmermann [Thu, 16 Mar 2023 09:37:29 +0000 (10:37 +0100)]
drm/radeon: Move radeon_align_pitch() next to dumb-buffer helpers

Move radeon_align_pitch() next to its caller in the dumb-buffer
code. Removes the only dependency on the radeon's fbdev source file
that is not related to fbdev emulation. No functional changes.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amd/amdgpu: Fix error do not initialise globals to 0
Srinivasan Shanmugam [Mon, 27 Mar 2023 17:05:33 +0000 (22:35 +0530)]
drm/amd/amdgpu: Fix error do not initialise globals to 0

Global variables do not need to be initialized to 0 and checkpatch
flags this error in drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c:

ERROR: do not initialise globals to 0
+int amdgpu_no_queue_eviction_on_vm_fault = 0;

Fix this checkpatch error.

Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: Hamza Mahfooz <Hamza.Mahfooz@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amdgpu: Return from switch early for EEPROM I2C address
Luben Tuikov [Thu, 23 Mar 2023 05:46:41 +0000 (01:46 -0400)]
drm/amdgpu: Return from switch early for EEPROM I2C address

As soon as control->i2c_address is set, return; remove the "break;" from the
switch--it is unnecessary. This mimics what happens when for some cases in the
switch, we call helper functions with "return <helper function>".

Remove final function "return true;" to indicate that the switch is final and
terminal, and that there should be no code after the switch.

Cc: Candice Li <candice.li@amd.com>
Cc: Kent Russell <kent.russell@amd.com>
Cc: Alex Deucher <Alexander.Deucher@amd.com>
Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
Reviewed-by: Alex Deucher <Alexander.Deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amdgpu: Remove second moot switch to set EEPROM I2C address
Luben Tuikov [Thu, 23 Mar 2023 04:56:26 +0000 (00:56 -0400)]
drm/amdgpu: Remove second moot switch to set EEPROM I2C address

Remove second switch since it already has its own function and case in the
first switch. This also avoids requalifying the EEPROM I2C address for VEGA20,
SIENNA CICHLID, and ALDEBARAN, as those have been set by the first switch and
shouldn't match SMU v13.0.x.

Cc: Candice Li <candice.li@amd.com>
Cc: Kent Russell <kent.russell@amd.com>
Cc: Alex Deucher <Alexander.Deucher@amd.com>
Fixes: 158225294683 ("drm/amdgpu: Add EEPROM I2C address for smu v13_0_0")
Fixes: c9bdc6c3cf39 ("drm/amdgpu: Add EEPROM I2C address support for ip discovery")
Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
Reviewed-by: Alex Deucher <Alexander.Deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amdgpu: print ras drv fw debug info
Stanley.Yang [Thu, 23 Mar 2023 07:51:19 +0000 (15:51 +0800)]
drm/amdgpu: print ras drv fw debug info

Signed-off-by: Stanley.Yang <Stanley.Yang@amd.com>
Reviewed-by: Candice Li <candice.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amdgpu: Add fatal error handling in nbio v4_3
Hawking Zhang [Thu, 23 Mar 2023 02:21:49 +0000 (10:21 +0800)]
drm/amdgpu: Add fatal error handling in nbio v4_3

GPU will stop working once fatal error is detected.
it will inform driver to do reset to recover from
the fatal error.

v2: squash in logic fix (Srinivasan)
v3: squash in logic fix (Dan)

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Candice Li <candice.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amd/display/amdgpu_dm: Pass proper parent for backlight device registration v3
Hans de Goede [Sun, 12 Mar 2023 19:17:51 +0000 (20:17 +0100)]
drm/amd/display/amdgpu_dm: Pass proper parent for backlight device registration v3

The parent for the backlight device should be the drm-connector object,
not the PCI device.

Userspace relies on this to be able to detect which backlight class device
to use on hybrid gfx devices where there may be multiple native (raw)
backlight devices registered.

Specifically gnome-settings-daemon expects the parent device to have
an "enabled" sysfs attribute (as drm_connector devices do) and tests
that this returns "enabled" when read.

This aligns the parent of the backlight device with i915, nouveau, radeon.
Note that drivers/gpu/drm/amd/amdgpu/atombios_encoders.c also already
uses the drm_connector as parent, only amdgpu_dm.c used the PCI device
as parent before this change.

Changes in v3:
Make amdgpu_dm_register_backlight_device() check bl_idx != 1 before
registering the backlight since amdgpu_dm_connector_late_register()
now calls it for _all_ connectors.

Changes in v2:
Together with changing the parent, also move the registration to
drm_connector_funcs.late_register() this is necessary because the parent
device (which now is the drm_connector) must be registered before
the backlight class device is, otherwise the backlight class device ends
up without any parent set at all.

This brings the backlight class device registration timing inline with
nouveau and i915 which also use drm_connector_funcs.late_register()
for this.

Note this slightly changes backlight_device_register() error handling,
instead of not increasing dm->num_of_edps and re-using the current
bl_idx for a potential other backlight device, dm->backlight_dev[bl_idx]
is now simply left NULL on failure. This is ok because all code
looking at dm->backlight_dev[i] also checks it is not NULL.

Link: https://gitlab.gnome.org/GNOME/gnome-settings-daemon/-/issues/730
Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amd/display/amdgpu_dm: Make amdgpu_dm_register_backlight_device() take an amdgpu_...
Hans de Goede [Sun, 12 Mar 2023 19:17:50 +0000 (20:17 +0100)]
drm/amd/display/amdgpu_dm: Make amdgpu_dm_register_backlight_device() take an amdgpu_dm_connector

Make amdgpu_dm_register_backlight_device() take an amdgpu_dm_connector
pointer to the connector for which it should register the backlight
as its only argument.

This is a preparation patch for moving the actual backlight class device
registering to drm_connector_funcs.late_register.

Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amd/display/amdgpu_dm: Move most backlight setup into setup_backlight_device()
Hans de Goede [Sun, 12 Mar 2023 19:17:49 +0000 (20:17 +0100)]
drm/amd/display/amdgpu_dm: Move most backlight setup into setup_backlight_device()

Rename register_backlight_device() to setup_backlight_device()
and move all backlight setup related calls from
amdgpu_dm_register_backlight_device() and from
amdgpu_dm_initialize_drm_device() there.

This leaves amdgpu_dm_register_backlight_device() dealing purely
with registering the actual backlight class device.

This is a preparation patch for moving the actual backlight class device
registering to drm_connector_funcs.late_register.

Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/amd/display/amdgpu_dm: Add a bl_idx to amdgpu_dm_connector
Hans de Goede [Sun, 12 Mar 2023 19:17:48 +0000 (20:17 +0100)]
drm/amd/display/amdgpu_dm: Add a bl_idx to amdgpu_dm_connector

Currently functions like update_connector_ext_caps() and
amdgpu_dm_connector_destroy() are iterating over dm->backlight_link[i]
to find the index of the (optional) backlight_dev associated with
the connector.

Instead make register_backlight_device() store the dm->backlight_dev[]
index used for the connector inside the amdgpu_dm_connector struct.

This removes the need to iterate over the dm->backlight_link[]
array and this is necessary as a preparation patch for moving
the actual backlight_device_register()
call to drm_connector_funcs.late_register.

While reworking update_connector_ext_caps() also remove the aconnector
and aconnector->dc_link NULL checks in this function. These are both
never NULL and are unconditionally derefed in its callers.

Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 months agodrm/panfrost: Add basic support for speed binning
AngeloGioacchino Del Regno [Thu, 23 Mar 2023 09:08:22 +0000 (10:08 +0100)]
drm/panfrost: Add basic support for speed binning

Some SoCs implementing ARM Mali GPUs are subject to speed binning:
this means that some versions of the same SoC model may need to be
limited to a slower frequency compared to the other:
this is being addressed by reading nvmem (usually, an eFuse array)
containing a number that identifies the speed binning of the chip,
which is usually related to silicon quality.

To address such situation, add basic support for reading the
speed-bin through nvmem, as to make it possible to specify the
supported hardware in the OPP table for GPUs.
This commit also keeps compatibility with any platform that does
not specify (and does not even support) speed-binning.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230323090822.61766-3-angelogioacchino.delregno@collabora.com
15 months agodt-bindings: gpu: mali-bifrost: Document nvmem for speedbin support
AngeloGioacchino Del Regno [Thu, 23 Mar 2023 09:08:21 +0000 (10:08 +0100)]
dt-bindings: gpu: mali-bifrost: Document nvmem for speedbin support

Some SoCs implementing ARM Mali GPUs may be subject to speed binning
and the usable bin is read from nvmem: document the addition of nvmem
and nvmem-cells for 'speed-bin'.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230323090822.61766-2-angelogioacchino.delregno@collabora.com
15 months agodrm: Use of_property_read_bool() for boolean properties
Rob Herring [Fri, 10 Mar 2023 14:47:05 +0000 (08:47 -0600)]
drm: Use of_property_read_bool() for boolean properties

It is preferred to use typed property access functions (i.e.
of_property_read_<type> functions) rather than low-level
of_get_property/of_find_property functions for reading properties.
Convert reading boolean properties to of_property_read_bool().

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://lore.kernel.org/r/20230310144706.1542295-1-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>
15 months agodt-bindings: display: seiko,43wvf1g: Change the maintainer's contact
Fabio Estevam [Wed, 29 Mar 2023 20:11:50 +0000 (17:11 -0300)]
dt-bindings: display: seiko,43wvf1g: Change the maintainer's contact

Marco's NXP email is no longer valid.

Marco told me offline that he has no interest to be listed as the
maintainer contact for this binding, so add my contact.

Signed-off-by: Fabio Estevam <festevam@denx.de>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230329201150.741106-1-festevam@gmail.com
15 months agoMerge remote-tracking branch 'drm/drm-next' into drm-misc-next
Maarten Lankhorst [Thu, 30 Mar 2023 06:53:12 +0000 (08:53 +0200)]
Merge remote-tracking branch 'drm/drm-next' into drm-misc-next

Backmerge to get rc4.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
15 months agodt-bindings: display: boe,tv101wum-nl6: document rotation
Krzysztof Kozlowski [Sun, 26 Mar 2023 15:54:25 +0000 (17:54 +0200)]
dt-bindings: display: boe,tv101wum-nl6: document rotation

Allow 'rotation' property (coming from panel-common.yaml) already used
in DTS:

  sc7180-trogdor-quackingstick-r0.dtb: panel@0: 'rotation' does not match any of the regexes: 'pinctrl-[0-9]+'

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20230326155425.91181-6-krzysztof.kozlowski@linaro.org
Signed-off-by: Rob Herring <robh@kernel.org>
15 months agodt-bindings: display: visionox,rm69299: document reg
Krzysztof Kozlowski [Sun, 26 Mar 2023 15:54:24 +0000 (17:54 +0200)]
dt-bindings: display: visionox,rm69299: document reg

Panels are supposed to have one reg.  This fixes dtbs_check warnings
like:

  sc7180-idp.dtb: panel@0: 'reg' does not match any of the regexes: 'pinctrl-[0-9]+'

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20230326155425.91181-5-krzysztof.kozlowski@linaro.org
Signed-off-by: Rob Herring <robh@kernel.org>
15 months agodt-bindings: display: panel-simple-dsi: document port
Krzysztof Kozlowski [Sun, 26 Mar 2023 15:54:23 +0000 (17:54 +0200)]
dt-bindings: display: panel-simple-dsi: document port

Panels are supposed to have one port (coming from panel-common.yaml
binding):

  msm8916-samsung-a3u-eur.dtb: panel@0: 'port' does not match any of the regexes: 'pinctrl-[0-9]+'

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20230326155425.91181-4-krzysztof.kozlowski@linaro.org
Signed-off-by: Rob Herring <robh@kernel.org>
15 months agodt-bindings: display: panel-simple-dsi: allow vddio variant
Krzysztof Kozlowski [Sun, 26 Mar 2023 15:54:22 +0000 (17:54 +0200)]
dt-bindings: display: panel-simple-dsi: allow vddio variant

Few panels like Samsung s6e3fc2x01 and sofef00 use vddio-supply instead
of power-supply (in DTS and Linux driver), so allow it to fix:

  sdm845-oneplus-enchilada.dtb: panel@0: 'power-supply' is a required property

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20230326155425.91181-3-krzysztof.kozlowski@linaro.org
Signed-off-by: Rob Herring <robh@kernel.org>
15 months agodt-bindings: display: novatek,nt36672a: correct VDDIO supply
Krzysztof Kozlowski [Sun, 26 Mar 2023 15:54:21 +0000 (17:54 +0200)]
dt-bindings: display: novatek,nt36672a: correct VDDIO supply

The nt36672a bindings were added with a mistake on VDDIO supply calling
it in one place vddio and in other vddi0.  Typical name is rather vddio
which is also now used by DTS (sdm845-xiaomi-beryllium-common.dtsi) and
Linux driver.

Fixes: c2abcf30efb8 ("dt-bindings: display: novatek,nt36672a: Fix unevaluated properties warning")
Fixes: 9528a02430df ("dt-bindings: display: panel: Add bindings for Novatek nt36672a")
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20230326155425.91181-2-krzysztof.kozlowski@linaro.org
Signed-off-by: Rob Herring <robh@kernel.org>
15 months agodt-bindings: display: panel-simple: merge Innolux p120zdg-bf1
Krzysztof Kozlowski [Sun, 26 Mar 2023 15:54:20 +0000 (17:54 +0200)]
dt-bindings: display: panel-simple: merge Innolux p120zdg-bf1

There is nothing special in Innolux p120zdg-bf1 panel, so just like
other Innolux panels it can be made part of panel-simple.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20230326155425.91181-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Rob Herring <robh@kernel.org>
15 months agoMerge v6.3-rc4 into drm-next
Daniel Vetter [Wed, 29 Mar 2023 14:00:23 +0000 (16:00 +0200)]
Merge v6.3-rc4 into drm-next

I just landed the fence deadline PR from Rob that a bunch of drivers
want/need to apply driver-specific patches. Backmerge -rc4 so that
they don't have to be stuck on -rc2 for no reason at all.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
15 months agoMerge tag 'dma-fence-deadline' of https://gitlab.freedesktop.org/drm/msm into drm...
Daniel Vetter [Wed, 29 Mar 2023 13:45:37 +0000 (15:45 +0200)]
Merge tag 'dma-fence-deadline' of https://gitlab.freedesktop.org/drm/msm into drm-next

This series adds a deadline hint to fences, so realtime deadlines
such as vblank can be communicated to the fence signaller for power/
frequency management decisions.

This is partially inspired by a trick i915 does, but implemented
via dma-fence for a couple of reasons:

1) To continue to be able to use the atomic helpers
2) To support cases where display and gpu are different drivers

See https://patchwork.freedesktop.org/series/93035/

This does not yet add any UAPI, although this will be needed in
a number of cases:

1) Workloads "ping-ponging" between CPU and GPU, where we don't
   want the GPU freq governor to interpret time stalled waiting
   for GPU as "idle" time
2) Cases where the compositor is waiting for fences to be signaled
   before issuing the atomic ioctl, for example to maintain 60fps
   cursor updates even when the GPU is not able to maintain that
   framerate.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
From: Rob Clark <robdclark@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/CAF6AEGt5nDQpa6J86V1oFKPA30YcJzPhAVpmF7N1K1g2N3c=Zg@mail.gmail.com
15 months agodrm/atomic-helper: Set fence deadline for vblank
Rob Clark [Fri, 3 Sep 2021 18:47:54 +0000 (11:47 -0700)]
drm/atomic-helper: Set fence deadline for vblank

For an atomic commit updating a single CRTC (ie. a pageflip) calculate
the next vblank time, and inform the fence(s) of that deadline.

v2: Comment typo fix (danvet)
v3: If there are multiple CRTCs, consider the time of the soonest vblank

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
15 months agodrm/vblank: Add helper to get next vblank time
Rob Clark [Fri, 3 Sep 2021 18:47:53 +0000 (11:47 -0700)]
drm/vblank: Add helper to get next vblank time

Will be used in the next commit to set a deadline on fences that an
atomic update is waiting on.

v2: Calculate time at *start* of vblank period, not end
v3: Fix kbuild complaints

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Mario Kleiner <mario.kleiner.de@gmail.com>
15 months agodrm/scheduler: Add fence deadline support
Rob Clark [Tue, 21 Sep 2021 16:35:50 +0000 (09:35 -0700)]
drm/scheduler: Add fence deadline support

As the finished fence is the one that is exposed to userspace, and
therefore the one that other operations, like atomic update, would
block on, we need to propagate the deadline from from the finished
fence to the actual hw fence.

v2: Split into drm_sched_fence_set_parent() (ckoenig)
v3: Ensure a thread calling drm_sched_fence_set_deadline_finished() sees
    fence->parent set before drm_sched_fence_set_parent() does this
    test_bit(DMA_FENCE_FLAG_HAS_DEADLINE_BIT).

Signed-off-by: Rob Clark <robdclark@chromium.org>
Acked-by: Luben Tuikov <luben.tuikov@amd.com>
15 months agodma-buf/sync_file: Surface sync-file uABI
Rob Clark [Tue, 28 Feb 2023 18:10:11 +0000 (10:10 -0800)]
dma-buf/sync_file: Surface sync-file uABI

We had all of the internal driver APIs, but not the all important
userspace uABI, in the dma-buf doc.  Fix that.  And re-arrange the
comments slightly as otherwise the comments for the ioctl nr defines
would not show up.

v2: Fix docs build warning coming from newly including the uabi header
    in the docs build

Signed-off-by: Rob Clark <robdclark@chromium.org>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.com>
15 months agodma-buf/dma-resv: Add a way to set fence deadline
Rob Clark [Sat, 18 Feb 2023 20:35:04 +0000 (12:35 -0800)]
dma-buf/dma-resv: Add a way to set fence deadline

Add a way to set a deadline on remaining resv fences according to the
requested usage.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Christian König <christian.koenig@amd.com>
15 months agodma-buf/fence-chain: Add fence deadline support
Rob Clark [Fri, 3 Sep 2021 18:47:58 +0000 (11:47 -0700)]
dma-buf/fence-chain: Add fence deadline support

Propagate the deadline to all the fences in the chain.

v2: Use dma_fence_chain_contained [Tvrtko]

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Christian König <christian.koenig@amd.com>
15 months agodrm: Use of_property_present() for testing DT property presence
Rob Herring [Fri, 10 Mar 2023 14:47:05 +0000 (08:47 -0600)]
drm: Use of_property_present() for testing DT property presence

It is preferred to use typed property access functions (i.e.
of_property_read_<type> functions) rather than low-level
of_get_property/of_find_property functions for reading properties. As
part of this, convert of_get_property/of_find_property calls to the
recently added of_property_present() helper when we just want to test
for presence of a property and nothing more.

Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Reviewed-by: Liu Ying <victor.liu@nxp.com> # i.MX bridge
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://lore.kernel.org/r/20230310144705.1542207-1-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>
15 months agoMerge tag 'exynos-drm-next-for-v6.4' of git://git.kernel.org/pub/scm/linux/kernel...
Daniel Vetter [Tue, 28 Mar 2023 17:23:05 +0000 (19:23 +0200)]
Merge tag 'exynos-drm-next-for-v6.4' of git://git./linux/kernel/git/daeinki/drm-exynos into drm-next

A patch series for moving MIPI-DSI driver for Exynos DRM to drm/bridge
directory so that I.MX SoC family can also share the same device driver.
Samsung MIPI DSIM device is a common IP that can be used by Exynos and I.MX8M
Mini/Nano/Plus SoC. Regarding this, this patch series has added several
things below to existing MIPI DSI driver,
- Add exynos_dsi_type enum type to provide controller data from different
  platforms.
- Add two pipeline detection ways support - existing Exynos DSI child node
  and I.MX family of-graph port or ports.
- Consider component and bridged based DRM drivers.
- Add device tree binding support of I.MX family.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
From: Inki Dae <inki.dae@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230328040524.49278-1-inki.dae@samsung.com
15 months agodrm: bridge: samsung-dsim: Add i.MX8M Plus support
Marek Vasut [Wed, 8 Mar 2023 16:39:53 +0000 (22:09 +0530)]
drm: bridge: samsung-dsim: Add i.MX8M Plus support

Add extras to support i.MX8M Plus. The main change is the removal of
HS/VS/DE signal inversion in the LCDIFv3-DSIM glue logic, otherwise
the implementation of this IP in i.MX8M Plus is very much compatible
with the i.MX8M Mini/Nano one.

Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Acked-by: Robert Foss <robert.foss@linaro.org>
Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <m.szyprowski@samsung.com>
15 months agodt-bindings: display: exynos: dsim: Add NXP i.MX8M Plus support
Jagan Teki [Wed, 8 Mar 2023 16:39:52 +0000 (22:09 +0530)]
dt-bindings: display: exynos: dsim: Add NXP i.MX8M Plus support

Samsung MIPI DSIM bridge can also be found in i.MX8M Plus SoC.

Add dt-bingings for it.

Reviewed-by: Marek Vasut <marex@denx.de>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
15 months agodrm: bridge: samsung-dsim: Add i.MX8M Mini/Nano support
Jagan Teki [Wed, 8 Mar 2023 16:39:51 +0000 (22:09 +0530)]
drm: bridge: samsung-dsim: Add i.MX8M Mini/Nano support

Samsung MIPI DSIM master can also be found in i.MX8M Mini/Nano SoC.

Add compatible and associated driver_data for it.

Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Acked-by: Robert Foss <robert.foss@linaro.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Tested-by: Adam Ford <aford173@gmail.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
15 months agodt-bindings: display: exynos: dsim: Add NXP i.MX8M Mini/Nano support
Jagan Teki [Wed, 8 Mar 2023 16:39:50 +0000 (22:09 +0530)]
dt-bindings: display: exynos: dsim: Add NXP i.MX8M Mini/Nano support

Samsung MIPI DSIM bridge can also be found in i.MX8M Mini/Nano SoC.

Add dt-bingings for it.

Reviewed-by: Marek Vasut <marex@denx.de>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
15 months agodrm: bridge: Generalize Exynos-DSI driver into a Samsung DSIM bridge
Jagan Teki [Wed, 8 Mar 2023 16:39:49 +0000 (22:09 +0530)]
drm: bridge: Generalize Exynos-DSI driver into a Samsung DSIM bridge

Samsung MIPI DSIM controller is common DSI IP that can be used in various
SoCs like Exynos, i.MX8M Mini/Nano.

In order to access this DSI controller between various platform SoCs,
the ideal way to incorporate this in the drm stack is via the drm bridge
driver.

We already have a consolidated code for supporting component and bridge
based DRM drivers, so keep the exynos component based code in existing
exynos_drm_dsi.c and move generic bridge code as part of samsung-dsim.c

Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
15 months agodrm: exynos: dsi: Add host helper for te_irq_handler
Jagan Teki [Wed, 8 Mar 2023 16:39:48 +0000 (22:09 +0530)]
drm: exynos: dsi: Add host helper for te_irq_handler

IRQ handler for te-gpio seems to be common across DSIM host.

However, Exynos is handling this via CRTC drivers but there is no clear
evidence on how the same has been handled in i.MX8MM. Keeping the handler
as-it-is can be a viable option but adding DSIM bridge core in upcoming
patches is not possible to call Exynos CRTC handler as DSIM bridge has
to be common across DRM bridge core instead of platform specific DRM
drivers like Exynos here.

So, this patch handles the handler via platform host helper, so-that
handling platform specific hook across Exynos and generic can be
reasonable till it makes it generic across all platforms.

Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
15 months agodrm: exynos: dsi: Consolidate component and bridge
Jagan Teki [Wed, 8 Mar 2023 16:39:47 +0000 (22:09 +0530)]
drm: exynos: dsi: Consolidate component and bridge

DSI host registration, attach and detach operations are quite
different for the component and bridge-based DRM drivers.

Supporting generic bridge driver to use both component and bridge
based DRM drivers can be tricky and would require additional host
related operation hooks.

Add host operation hooks for registering and unregistering Exynos
and generic drivers, where Exynos hooks are used in existing Exynos
component based DRM drivers and generic hooks are used in i.MX8M
bridge based DRM drivers.

Add host attach and detach operation hooks for Exynos component
DRM drivers and those get invoked while DSI core host attach and
detach gets called.

Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
15 months agodrm: exynos: dsi: Add atomic_get_input_bus_fmts
Jagan Teki [Wed, 8 Mar 2023 16:39:46 +0000 (22:09 +0530)]
drm: exynos: dsi: Add atomic_get_input_bus_fmts

Finding the right input bus format throughout the pipeline is hard
so add atomic_get_input_bus_fmts callback and initialize with the
proper input format from list of supported output formats.

This format can be used in pipeline for negotiating bus format between
the DSI-end of this bridge and the other component closer to pipeline
components.

List of Pixel formats are taken from,
AN13573 i.MX 8/RT MIPI DSI/CSI-2, Rev. 0, 21 March 2022
3.7.4 Pixel formats
Table 14. DSI pixel packing formats

Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
15 months agodrm: exynos: dsi: Add input_bus_flags
Jagan Teki [Wed, 8 Mar 2023 16:39:45 +0000 (22:09 +0530)]
drm: exynos: dsi: Add input_bus_flags

LCDIF-DSIM glue logic inverts the HS/VS/DE signals and expecting
the i.MX8M Mini/Nano DSI host to add additional Data Enable signal
active low (DE_LOW). This makes the valid data transfer on each
horizontal line.

So, add additional bus flags DE_LOW setting via input_bus_flags
for i.MX8M Mini/Nano platforms.

Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Suggested-by: Marek Vasut <marex@denx.de>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
15 months agodrm: exynos: dsi: Add atomic check
Jagan Teki [Wed, 8 Mar 2023 16:39:44 +0000 (22:09 +0530)]
drm: exynos: dsi: Add atomic check

Look like an explicit fixing up of mode_flags is required for DSIM IP
present in i.MX8M Mini/Nano SoCs.

At least the LCDIF + DSIM needs active low sync polarities in order
to correlate the correct sync flags of the surrounding components in
the chain to make sure the whole pipeline can work properly.

On the other hand the i.MX 8M Mini Applications Processor Reference Manual,
Rev. 3, 11/2020 says.
"13.6.3.5.2 RGB interface
 Vsync, Hsync, and VDEN are active high signals."

i.MX 8M Mini Applications Processor Reference Manual Rev. 3, 11/2020
3.6.3.5.2 RGB interface
i.MX 8M Nano Applications Processor Reference Manual Rev. 2, 07/2022
13.6.2.7.2 RGB interface
both claim "Vsync, Hsync, and VDEN are active high signals.", the
LCDIF must generate inverted HS/VS/DE signals, i.e. active LOW.

No clear evidence about whether it can be documentation issues or
something, so added proper comments on the code.

Comments are suggested by Marek Vasut.

Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
15 months agodrm: exynos: dsi: Handle proper host initialization
Marek Szyprowski [Wed, 8 Mar 2023 16:39:43 +0000 (22:09 +0530)]
drm: exynos: dsi: Handle proper host initialization

Host transfer() in the DSI master will invoke only when the DSI commands
are sent from DSI devices like DSI Panel or DSI bridges and this host
the transfer wouldn't invoke for I2C-based-DSI bridge drivers.

Handling DSI host initialization in transfer calls misses the controller
setup for I2C configured DSI bridges.

This patch updates the DSI host initialization by calling host to init
from bridge pre_enable as the bridge pre_enable API is invoked by core
as it is common across all classes of DSI device drivers.

The host init during pre_enable is conditional and not invoked for Exynos
as existing downstream drm panels and bridges in Exynos are expecting
the host initialization during DSI transfer.

Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
15 months agodrm: exynos: dsi: Introduce hw_type platform data
Jagan Teki [Wed, 8 Mar 2023 16:39:42 +0000 (22:09 +0530)]
drm: exynos: dsi: Introduce hw_type platform data

Samsung MIPI DSIM controller is common DSI IP that can be used
in various SoCs like Exynos, i.MX8M Mini/Nano/Plus.

Add hw_type enum via platform_data so that accessing the different
controller data between various platforms becomes easy and meaningful.

Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Suggested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>