Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd/display: Add hardware reset interface for DMUB service

[Why]
We'll need this to perform a clean shutdown before unloading the driver.

[How]
It will call reset internally and set hw_init to false. It won't do
anything if the hardware isn't initialized.

Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Nicholas Kazlauskas and committed by
Alex Deucher
0167da49 7527791e

+31
+15
drivers/gpu/drm/amd/display/dmub/inc/dmub_srv.h
··· 419 419 const struct dmub_srv_hw_params *params); 420 420 421 421 /** 422 + * dmub_srv_hw_reset() - puts the DMUB hardware in reset state if initialized 423 + * @dmub: the dmub service 424 + * 425 + * Before destroying the DMUB service or releasing the backing framebuffer 426 + * memory we'll need to put the DMCUB into reset first. 427 + * 428 + * A subsequent call to dmub_srv_hw_init() will re-enable the DMCUB. 429 + * 430 + * Return: 431 + * DMUB_STATUS_OK - success 432 + * DMUB_STATUS_INVALID - unspecified error 433 + */ 434 + enum dmub_status dmub_srv_hw_reset(struct dmub_srv *dmub); 435 + 436 + /** 422 437 * dmub_srv_cmd_queue() - queues a command to the DMUB 423 438 * @dmub: the dmub service 424 439 * @cmd: the command to queue
+16
drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c
··· 415 415 return DMUB_STATUS_OK; 416 416 } 417 417 418 + enum dmub_status dmub_srv_hw_reset(struct dmub_srv *dmub) 419 + { 420 + if (!dmub->sw_init) 421 + return DMUB_STATUS_INVALID; 422 + 423 + if (dmub->hw_init == false) 424 + return DMUB_STATUS_OK; 425 + 426 + if (dmub->hw_funcs.reset) 427 + dmub->hw_funcs.reset(dmub); 428 + 429 + dmub->hw_init = false; 430 + 431 + return DMUB_STATUS_OK; 432 + } 433 + 418 434 enum dmub_status dmub_srv_cmd_queue(struct dmub_srv *dmub, 419 435 const struct dmub_cmd_header *cmd) 420 436 {