video-driver: diwali: Sort clock corners

Sort allowed clock corners for diwali
v1 & v2 variants.

Change-Id: Ic561cd4a0e7abcb0f239b294fa81807621f3ebdb
Signed-off-by: Priyanka Gujjula <quic_pgujjula@quicinc.com>
This commit is contained in:
Priyanka Gujjula
2021-11-19 21:58:15 +05:30
committed by Govindaraj Rajagopal
parent 58a111c212
commit 0dec23c1bd
3 changed files with 11 additions and 8 deletions

View File

@@ -6,6 +6,7 @@
#include <linux/of.h>
#include <linux/io.h>
#include <linux/sort.h>
#include "msm_vidc_diwali.h"
#include "msm_vidc_platform.h"
@@ -4992,6 +4993,8 @@ static int msm_vidc_init_data(struct msm_vidc_core *core)
}
if (platform_data->sku_version) {
sort(core->dt->allowed_clks_tbl, core->dt->allowed_clks_tbl_size,
sizeof(*core->dt->allowed_clks_tbl), cmp, NULL);
d_vpr_h("Updated allowed clock rates\n");
for (i = 0; i < core->dt->allowed_clks_tbl_size; i++)
d_vpr_h(" %d\n", core->dt->allowed_clks_tbl[i]);

View File

@@ -226,4 +226,12 @@ int msm_vidc_init_dt(struct platform_device *pdev);
int msm_vidc_read_context_bank_resources_from_dt(struct platform_device *pdev);
void msm_vidc_deinit_dt(struct platform_device *pdev);
/* A comparator to compare loads (needed later on) */
static inline int cmp(const void *a, const void *b)
{
/* want to sort in reverse so flip the comparison */
return ((struct allowed_clock_rates_table *)b)->clock_rate -
((struct allowed_clock_rates_table *)a)->clock_rate;
}
#endif // _MSM_VIDC_DT_H_

View File

@@ -91,14 +91,6 @@ static int msm_vidc_load_u32_table(struct platform_device *pdev,
return rc;
}
/* A comparator to compare loads (needed later on) */
static int cmp(const void *a, const void *b)
{
/* want to sort in reverse so flip the comparison */
return ((struct allowed_clock_rates_table *)b)->clock_rate -
((struct allowed_clock_rates_table *)a)->clock_rate;
}
static void msm_vidc_free_allowed_clocks_table(struct msm_vidc_dt *dt)
{
dt->allowed_clks_tbl = NULL;