From: Yongqiang Sun <yongqiang....@amd.com>

[Why & How]
Add emul specific hw function to dmub, in case of
emulator is created, we can runtime switch between
dmub emulator or dmub uC via is_virtual flag in dmub.

Signed-off-by: Yongqiang Sun <yongqiang....@amd.com>
Reviewed-by: Tony Cheng <tony.ch...@amd.com>
Acked-by: Qingqing Zhuo <qingqing.z...@amd.com>
---
 drivers/gpu/drm/amd/display/dmub/dmub_srv.h     |  4 ++++
 drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c | 16 ++++++++--------
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dmub/dmub_srv.h 
b/drivers/gpu/drm/amd/display/dmub/dmub_srv.h
index 93d6ff80b248..c6a8d6c54621 100644
--- a/drivers/gpu/drm/amd/display/dmub/dmub_srv.h
+++ b/drivers/gpu/drm/amd/display/dmub/dmub_srv.h
@@ -256,6 +256,10 @@ struct dmub_srv_hw_funcs {
 
        void (*set_inbox1_wptr)(struct dmub_srv *dmub, uint32_t wptr_offset);
 
+       uint32_t (*emul_get_inbox1_rptr)(struct dmub_srv *dmub);
+
+       void (*emul_set_inbox1_wptr)(struct dmub_srv *dmub, uint32_t 
wptr_offset);
+
        bool (*is_supported)(struct dmub_srv *dmub);
 
        bool (*is_hw_init)(struct dmub_srv *dmub);
diff --git a/drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c 
b/drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c
index 937f6c3c9911..eb51b7920864 100644
--- a/drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c
+++ b/drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c
@@ -199,13 +199,13 @@ enum dmub_status dmub_srv_create(struct dmub_srv *dmub,
 
        /* Override (some) hardware funcs based on user params. */
        if (params->hw_funcs) {
-               if (params->hw_funcs->get_inbox1_rptr)
-                       dmub->hw_funcs.get_inbox1_rptr =
-                               params->hw_funcs->get_inbox1_rptr;
+               if (params->hw_funcs->emul_get_inbox1_rptr)
+                       dmub->hw_funcs.emul_get_inbox1_rptr =
+                               params->hw_funcs->emul_get_inbox1_rptr;
 
-               if (params->hw_funcs->set_inbox1_wptr)
-                       dmub->hw_funcs.set_inbox1_wptr =
-                               params->hw_funcs->set_inbox1_wptr;
+               if (params->hw_funcs->emul_set_inbox1_wptr)
+                       dmub->hw_funcs.emul_set_inbox1_wptr =
+                               params->hw_funcs->emul_set_inbox1_wptr;
 
                if (params->hw_funcs->is_supported)
                        dmub->hw_funcs.is_supported =
@@ -502,7 +502,7 @@ enum dmub_status dmub_srv_cmd_execute(struct dmub_srv *dmub)
         */
        dmub_rb_flush_pending(&dmub->inbox1_rb);
 
-       dmub->hw_funcs.set_inbox1_wptr(dmub, dmub->inbox1_rb.wrpt);
+               dmub->hw_funcs.set_inbox1_wptr(dmub, dmub->inbox1_rb.wrpt);
        return DMUB_STATUS_OK;
 }
 
@@ -557,7 +557,7 @@ enum dmub_status dmub_srv_wait_for_idle(struct dmub_srv 
*dmub,
                return DMUB_STATUS_INVALID;
 
        for (i = 0; i <= timeout_us; ++i) {
-               dmub->inbox1_rb.rptr = dmub->hw_funcs.get_inbox1_rptr(dmub);
+                       dmub->inbox1_rb.rptr = 
dmub->hw_funcs.get_inbox1_rptr(dmub);
                if (dmub_rb_empty(&dmub->inbox1_rb))
                        return DMUB_STATUS_OK;
 
-- 
2.17.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to