Remove the profiling frequency debugfs control.
Add IVPU_TEST_MODE_PROF_FREQ_HIGH to select
PLL_PROFILING_FREQ_HIGH during driver initialization.
High frequency profiling is for debugging purposes
and it can be set at initialization time - there is
no need to control it via debugfs.

Signed-off-by: Andrzej Kacprowski <[email protected]>
---
 drivers/accel/ivpu/ivpu_debugfs.c | 29 -----------------------------
 drivers/accel/ivpu/ivpu_drv.h     |  1 +
 drivers/accel/ivpu/ivpu_hw.c      | 13 -------------
 drivers/accel/ivpu/ivpu_hw.h      |  1 -
 drivers/accel/ivpu/ivpu_hw_btrs.c |  7 ++++++-
 5 files changed, 7 insertions(+), 44 deletions(-)

diff --git a/drivers/accel/ivpu/ivpu_debugfs.c 
b/drivers/accel/ivpu/ivpu_debugfs.c
index dc20bc73c6ed..ae535fe49274 100644
--- a/drivers/accel/ivpu/ivpu_debugfs.c
+++ b/drivers/accel/ivpu/ivpu_debugfs.c
@@ -226,33 +226,6 @@ static const struct file_operations fw_log_fops = {
        .release = single_release,
 };
 
-static ssize_t
-fw_profiling_freq_fops_write(struct file *file, const char __user *user_buf,
-                            size_t size, loff_t *pos)
-{
-       struct ivpu_device *vdev = file->private_data;
-       bool enable;
-       int ret;
-
-       ret = kstrtobool_from_user(user_buf, size, &enable);
-       if (ret < 0)
-               return ret;
-
-       ivpu_hw_profiling_freq_drive(vdev, enable);
-
-       ret = pci_try_reset_function(to_pci_dev(vdev->drm.dev));
-       if (ret)
-               return ret;
-
-       return size;
-}
-
-static const struct file_operations fw_profiling_freq_fops = {
-       .owner = THIS_MODULE,
-       .open = simple_open,
-       .write = fw_profiling_freq_fops_write,
-};
-
 static ssize_t
 fw_trace_destination_mask_fops_write(struct file *file, const char __user 
*user_buf,
                                     size_t size, loff_t *pos)
@@ -513,8 +486,6 @@ void ivpu_debugfs_init(struct ivpu_device *vdev)
                            &ivpu_resume_engine_fops);
 
        if (ivpu_hw_ip_gen(vdev) >= IVPU_HW_IP_40XX) {
-               debugfs_create_file("fw_profiling_freq_drive", 0200,
-                                   debugfs_root, vdev, 
&fw_profiling_freq_fops);
                debugfs_create_file("dct", 0644, debugfs_root, vdev, 
&ivpu_dct_fops);
        }
 
diff --git a/drivers/accel/ivpu/ivpu_drv.h b/drivers/accel/ivpu/ivpu_drv.h
index ea5b8dc612d1..b33a53101894 100644
--- a/drivers/accel/ivpu/ivpu_drv.h
+++ b/drivers/accel/ivpu/ivpu_drv.h
@@ -238,6 +238,7 @@ extern bool ivpu_force_snoop;
 #define IVPU_TEST_MODE_CLK_RELINQ_DISABLE BIT(11)
 #define IVPU_TEST_MODE_CLK_RELINQ_ENABLE  BIT(12)
 #define IVPU_TEST_MODE_D0I2_DISABLE       BIT(13)
+#define IVPU_TEST_MODE_PROF_FREQ_HIGH     BIT(14)
 extern int ivpu_test_mode;
 
 struct ivpu_file_priv *ivpu_file_priv_get(struct ivpu_file_priv *file_priv);
diff --git a/drivers/accel/ivpu/ivpu_hw.c b/drivers/accel/ivpu/ivpu_hw.c
index 86679d64fc14..2cc2915ab5c5 100644
--- a/drivers/accel/ivpu/ivpu_hw.c
+++ b/drivers/accel/ivpu/ivpu_hw.c
@@ -359,19 +359,6 @@ int ivpu_hw_boot_fw(struct ivpu_device *vdev)
        return ret;
 }
 
-void ivpu_hw_profiling_freq_drive(struct ivpu_device *vdev, bool enable)
-{
-       if (ivpu_hw_ip_gen(vdev) == IVPU_HW_IP_37XX) {
-               vdev->hw->pll.profiling_freq = PLL_PROFILING_FREQ_DEFAULT;
-               return;
-       }
-
-       if (enable)
-               vdev->hw->pll.profiling_freq = PLL_PROFILING_FREQ_HIGH;
-       else
-               vdev->hw->pll.profiling_freq = PLL_PROFILING_FREQ_DEFAULT;
-}
-
 void ivpu_irq_handlers_init(struct ivpu_device *vdev)
 {
        if (ivpu_hw_btrs_gen(vdev) == IVPU_HW_BTRS_MTL)
diff --git a/drivers/accel/ivpu/ivpu_hw.h b/drivers/accel/ivpu/ivpu_hw.h
index 8c1b61df6cd4..de3dcb8e6173 100644
--- a/drivers/accel/ivpu/ivpu_hw.h
+++ b/drivers/accel/ivpu/ivpu_hw.h
@@ -61,7 +61,6 @@ int ivpu_hw_power_up(struct ivpu_device *vdev);
 int ivpu_hw_power_down(struct ivpu_device *vdev);
 int ivpu_hw_reset(struct ivpu_device *vdev);
 int ivpu_hw_boot_fw(struct ivpu_device *vdev);
-void ivpu_hw_profiling_freq_drive(struct ivpu_device *vdev, bool enable);
 void ivpu_irq_handlers_init(struct ivpu_device *vdev);
 void ivpu_hw_irq_enable(struct ivpu_device *vdev);
 void ivpu_hw_irq_disable(struct ivpu_device *vdev);
diff --git a/drivers/accel/ivpu/ivpu_hw_btrs.c 
b/drivers/accel/ivpu/ivpu_hw_btrs.c
index 840983a618ca..602d09e511e5 100644
--- a/drivers/accel/ivpu/ivpu_hw_btrs.c
+++ b/drivers/accel/ivpu/ivpu_hw_btrs.c
@@ -153,7 +153,12 @@ static int info_init_lnl(struct ivpu_device *vdev)
                return ret;
 
        hw->tile_fuse = tile_fuse_config;
-       hw->pll.profiling_freq = PLL_PROFILING_FREQ_DEFAULT;
+
+       if (ivpu_test_mode & IVPU_TEST_MODE_PROF_FREQ_HIGH)
+               hw->pll.profiling_freq = PLL_PROFILING_FREQ_HIGH;
+       else
+               hw->pll.profiling_freq = PLL_PROFILING_FREQ_DEFAULT;
+
        hw->btrs_irq_mask = BTRS_LNL_IRQ_MASK;
 
        if (ivpu_test_mode & IVPU_TEST_MODE_FREQ_CHANGE_ENABLE)
-- 
2.43.0

Reply via email to