video: driver: reduce device_tree dependency for video
Only keep minimal entries in dtsi, which is essential for other drivers usage. Move remaining all data into platform resource file. Remove device_tree dependency and maintain platform_data to initialize resources like regulators, interconnects, clocks, reset_clocks, subcaches and context_banks. Read static data like freq_table, firmware_name, pas_id also from platform_data instead of from dtsi. Change-Id: I73a1df10b92c55e55b23e538aea62598a7250ab4 Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
This commit is contained in:
@@ -41,6 +41,61 @@ extern u32 vpe_csc_custom_matrix_coeff[MAX_MATRIX_COEFFS];
|
||||
extern u32 vpe_csc_custom_bias_coeff[MAX_BIAS_COEFFS];
|
||||
extern u32 vpe_csc_custom_limit_coeff[MAX_LIMIT_COEFFS];
|
||||
|
||||
struct bw_table {
|
||||
const char *name;
|
||||
u32 min_kbps;
|
||||
u32 max_kbps;
|
||||
};
|
||||
|
||||
struct regulator_table {
|
||||
const char *name;
|
||||
bool hw_trigger;
|
||||
};
|
||||
|
||||
struct clk_table {
|
||||
const char *name;
|
||||
u32 clk_id;
|
||||
bool scaling;
|
||||
};
|
||||
|
||||
struct clk_rst_table {
|
||||
const char *name;
|
||||
};
|
||||
|
||||
struct subcache_table {
|
||||
const char *name;
|
||||
u32 llcc_id;
|
||||
};
|
||||
|
||||
struct context_bank_table {
|
||||
const char *name;
|
||||
u32 start;
|
||||
u32 size;
|
||||
bool secure;
|
||||
bool dma_coherant;
|
||||
u32 region;
|
||||
};
|
||||
|
||||
struct freq_table {
|
||||
unsigned long freq;
|
||||
};
|
||||
|
||||
struct reg_preset_table {
|
||||
u32 reg;
|
||||
u32 value;
|
||||
u32 mask;
|
||||
};
|
||||
|
||||
struct msm_vidc_ubwc_config_data {
|
||||
u32 max_channels;
|
||||
u32 mal_length;
|
||||
u32 highest_bank_bit;
|
||||
u32 bank_swzl_level;
|
||||
u32 bank_swz2_level;
|
||||
u32 bank_swz3_level;
|
||||
u32 bank_spreading;
|
||||
};
|
||||
|
||||
struct codec_info {
|
||||
u32 v4l2_codec;
|
||||
enum msm_vidc_codec_type vidc_codec;
|
||||
@@ -112,16 +167,6 @@ struct msm_vidc_efuse_data {
|
||||
enum efuse_purpose purpose;
|
||||
};
|
||||
|
||||
struct msm_vidc_ubwc_config_data {
|
||||
u32 max_channels;
|
||||
u32 mal_length;
|
||||
u32 highest_bank_bit;
|
||||
u32 bank_swzl_level;
|
||||
u32 bank_swz2_level;
|
||||
u32 bank_swz3_level;
|
||||
u32 bank_spreading;
|
||||
};
|
||||
|
||||
struct msm_vidc_format_capability {
|
||||
struct codec_info *codec_info;
|
||||
u32 codec_info_size;
|
||||
@@ -136,6 +181,26 @@ struct msm_vidc_format_capability {
|
||||
};
|
||||
|
||||
struct msm_vidc_platform_data {
|
||||
const struct bw_table *bw_tbl;
|
||||
unsigned int bw_tbl_size;
|
||||
const struct regulator_table *regulator_tbl;
|
||||
unsigned int regulator_tbl_size;
|
||||
const struct clk_table *clk_tbl;
|
||||
unsigned int clk_tbl_size;
|
||||
const struct clk_rst_table *clk_rst_tbl;
|
||||
unsigned int clk_rst_tbl_size;
|
||||
const struct subcache_table *subcache_tbl;
|
||||
unsigned int subcache_tbl_size;
|
||||
const struct context_bank_table *context_bank_tbl;
|
||||
unsigned int context_bank_tbl_size;
|
||||
struct freq_table *freq_tbl;
|
||||
unsigned int freq_tbl_size;
|
||||
const struct reg_preset_table *reg_prst_tbl;
|
||||
unsigned int reg_prst_tbl_size;
|
||||
struct msm_vidc_ubwc_config_data *ubwc_config;
|
||||
const char *fwname;
|
||||
u32 pas_id;
|
||||
bool supports_mmrm;
|
||||
struct msm_platform_core_capability *core_data;
|
||||
u32 core_data_size;
|
||||
struct msm_platform_inst_capability *inst_cap_data;
|
||||
@@ -143,7 +208,6 @@ struct msm_vidc_platform_data {
|
||||
struct msm_platform_inst_cap_dependency *inst_cap_dependency_data;
|
||||
u32 inst_cap_dependency_data_size;
|
||||
struct msm_vidc_csc_coeff csc_data;
|
||||
struct msm_vidc_ubwc_config_data *ubwc_config;
|
||||
struct msm_vidc_efuse_data *efuse_data;
|
||||
unsigned int efuse_data_size;
|
||||
unsigned int sku_version;
|
||||
@@ -155,9 +219,18 @@ struct msm_vidc_platform {
|
||||
struct msm_vidc_platform_data data;
|
||||
};
|
||||
|
||||
static inline bool is_sys_cache_present(struct msm_vidc_core *core)
|
||||
{
|
||||
return !!core->platform->data.subcache_tbl_size;
|
||||
}
|
||||
|
||||
static inline bool is_mmrm_supported(struct msm_vidc_core *core)
|
||||
{
|
||||
return !!core->platform->data.supports_mmrm;
|
||||
}
|
||||
|
||||
int msm_vidc_init_platform(struct platform_device *pdev);
|
||||
int msm_vidc_deinit_platform(struct platform_device *pdev);
|
||||
int msm_vidc_read_efuse(struct msm_vidc_core *core);
|
||||
void msm_vidc_sort_table(struct msm_vidc_core *core);
|
||||
|
||||
#endif // _MSM_VIDC_PLATFORM_H_
|
||||
|
@@ -5,7 +5,8 @@
|
||||
*/
|
||||
|
||||
#include <linux/io.h>
|
||||
#include <linux/sort.h>
|
||||
#include <linux/of.h>
|
||||
#include <soc/qcom/of_common.h>
|
||||
|
||||
#include "msm_vidc_platform.h"
|
||||
#include "msm_vidc_debug.h"
|
||||
@@ -13,7 +14,6 @@
|
||||
#include "msm_vidc_vb2.h"
|
||||
#include "msm_vidc_control.h"
|
||||
#include "msm_vidc_core.h"
|
||||
#include "msm_vidc_dt.h"
|
||||
#include "msm_vidc_debug.h"
|
||||
#include "msm_vidc_internal.h"
|
||||
#if defined(CONFIG_MSM_VIDC_WAIPIO)
|
||||
@@ -25,9 +25,6 @@
|
||||
#if defined(CONFIG_MSM_VIDC_PINEAPPLE)
|
||||
#include "msm_vidc_pineapple.h"
|
||||
#endif
|
||||
#if defined(CONFIG_MSM_VIDC_PINEAPPLE)
|
||||
#include "msm_vidc_pineapple.h"
|
||||
#endif
|
||||
#if defined(CONFIG_MSM_VIDC_ANORAK)
|
||||
#include "msm_vidc_anorak.h"
|
||||
#endif
|
||||
@@ -221,7 +218,7 @@ static int msm_vidc_deinit_platform_variant(struct msm_vidc_core *core, struct d
|
||||
d_vpr_h("%s()\n", __func__);
|
||||
|
||||
#if defined(CONFIG_MSM_VIDC_WAIPIO)
|
||||
if (of_device_is_compatible(dev->of_node, "qcom,msm-vidc-waipio")) {
|
||||
if (of_device_is_compatible(dev->of_node, "qcom,sm8450-vidc")) {
|
||||
rc = msm_vidc_deinit_platform_waipio(core, dev);
|
||||
if (rc)
|
||||
d_vpr_e("%s: failed with %d\n", __func__, rc);
|
||||
@@ -229,7 +226,8 @@ static int msm_vidc_deinit_platform_variant(struct msm_vidc_core *core, struct d
|
||||
}
|
||||
#endif
|
||||
#if defined(CONFIG_MSM_VIDC_KALAMA)
|
||||
if (of_device_is_compatible(dev->of_node, "qcom,msm-vidc-kalama")) {
|
||||
if (of_device_is_compatible(dev->of_node, "qcom,sm8550-vidc") ||
|
||||
of_device_is_compatible(dev->of_node, "qcom,sm8550-vidc-v2")) {
|
||||
rc = msm_vidc_deinit_platform_kalama(core, dev);
|
||||
if (rc)
|
||||
d_vpr_e("%s: failed with %d\n", __func__, rc);
|
||||
@@ -237,7 +235,7 @@ static int msm_vidc_deinit_platform_variant(struct msm_vidc_core *core, struct d
|
||||
}
|
||||
#endif
|
||||
#if defined(CONFIG_MSM_VIDC_PINEAPPLE)
|
||||
if (of_device_is_compatible(dev->of_node, "qcom,msm-vidc-pineapple")) {
|
||||
if (of_device_is_compatible(dev->of_node, "qcom,sm8650-vidc")) {
|
||||
rc = msm_vidc_deinit_platform_pineapple(core, dev);
|
||||
if (rc)
|
||||
d_vpr_e("%s: failed with %d\n", __func__, rc);
|
||||
@@ -245,7 +243,7 @@ static int msm_vidc_deinit_platform_variant(struct msm_vidc_core *core, struct d
|
||||
}
|
||||
#endif
|
||||
#if defined(CONFIG_MSM_VIDC_ANORAK)
|
||||
if (of_device_is_compatible(dev->of_node, "qcom,msm-vidc-anorak")) {
|
||||
if (of_device_is_compatible(dev->of_node, "qcom,sxr2230p-vidc")) {
|
||||
rc = msm_vidc_deinit_platform_anorak(core, dev);
|
||||
if (rc)
|
||||
d_vpr_e("%s: failed with %d\n", __func__, rc);
|
||||
@@ -268,7 +266,7 @@ static int msm_vidc_init_platform_variant(struct msm_vidc_core *core, struct dev
|
||||
d_vpr_h("%s()\n", __func__);
|
||||
|
||||
#if defined(CONFIG_MSM_VIDC_WAIPIO)
|
||||
if (of_device_is_compatible(dev->of_node, "qcom,msm-vidc-waipio")) {
|
||||
if (of_device_is_compatible(dev->of_node, "qcom,sm8450-vidc")) {
|
||||
rc = msm_vidc_init_platform_waipio(core, dev);
|
||||
if (rc)
|
||||
d_vpr_e("%s: failed with %d\n", __func__, rc);
|
||||
@@ -276,7 +274,8 @@ static int msm_vidc_init_platform_variant(struct msm_vidc_core *core, struct dev
|
||||
}
|
||||
#endif
|
||||
#if defined(CONFIG_MSM_VIDC_KALAMA)
|
||||
if (of_device_is_compatible(dev->of_node, "qcom,msm-vidc-kalama")) {
|
||||
if (of_device_is_compatible(dev->of_node, "qcom,sm8550-vidc") ||
|
||||
of_device_is_compatible(dev->of_node, "qcom,sm8550-vidc-v2")) {
|
||||
rc = msm_vidc_init_platform_kalama(core, dev);
|
||||
if (rc)
|
||||
d_vpr_e("%s: failed with %d\n", __func__, rc);
|
||||
@@ -284,7 +283,7 @@ static int msm_vidc_init_platform_variant(struct msm_vidc_core *core, struct dev
|
||||
}
|
||||
#endif
|
||||
#if defined(CONFIG_MSM_VIDC_PINEAPPLE)
|
||||
if (of_device_is_compatible(dev->of_node, "qcom,msm-vidc-pineapple")) {
|
||||
if (of_device_is_compatible(dev->of_node, "qcom,sm8650-vidc")) {
|
||||
rc = msm_vidc_init_platform_pineapple(core, dev);
|
||||
if (rc)
|
||||
d_vpr_e("%s: failed with %d\n", __func__, rc);
|
||||
@@ -292,7 +291,7 @@ static int msm_vidc_init_platform_variant(struct msm_vidc_core *core, struct dev
|
||||
}
|
||||
#endif
|
||||
#if defined(CONFIG_MSM_VIDC_ANORAK)
|
||||
if (of_device_is_compatible(dev->of_node, "qcom,msm-vidc-anorak")) {
|
||||
if (of_device_is_compatible(dev->of_node, "qcom,sxr2230p-vidc")) {
|
||||
rc = msm_vidc_init_platform_anorak(core, dev);
|
||||
if (rc)
|
||||
d_vpr_e("%s: failed with %d\n", __func__, rc);
|
||||
@@ -315,7 +314,7 @@ static int msm_vidc_deinit_vpu(struct msm_vidc_core *core, struct device *dev)
|
||||
d_vpr_h("%s()\n", __func__);
|
||||
|
||||
#if defined(CONFIG_MSM_VIDC_IRIS2)
|
||||
if (of_device_is_compatible(dev->of_node, "qcom,msm-vidc-iris2")) {
|
||||
if (of_device_is_compatible(dev->of_node, "qcom,sm8450-vidc")) {
|
||||
rc = msm_vidc_deinit_iris2(core);
|
||||
if (rc)
|
||||
d_vpr_e("%s: failed with %d\n", __func__, rc);
|
||||
@@ -323,7 +322,8 @@ static int msm_vidc_deinit_vpu(struct msm_vidc_core *core, struct device *dev)
|
||||
}
|
||||
#endif
|
||||
#if defined(CONFIG_MSM_VIDC_IRIS3)
|
||||
if (of_device_is_compatible(dev->of_node, "qcom,msm-vidc-iris3")) {
|
||||
if (of_device_is_compatible(dev->of_node, "qcom,sm8550-vidc") ||
|
||||
of_device_is_compatible(dev->of_node, "qcom,sm8550-vidc-v2")) {
|
||||
rc = msm_vidc_deinit_iris3(core);
|
||||
if (rc)
|
||||
d_vpr_e("%s: failed with %d\n", __func__, rc);
|
||||
@@ -331,7 +331,7 @@ static int msm_vidc_deinit_vpu(struct msm_vidc_core *core, struct device *dev)
|
||||
}
|
||||
#endif
|
||||
#if defined(CONFIG_MSM_VIDC_IRIS33)
|
||||
if (of_device_is_compatible(dev->of_node, "qcom,msm-vidc-iris33")) {
|
||||
if (of_device_is_compatible(dev->of_node, "qcom,sm8650-vidc")) {
|
||||
rc = msm_vidc_deinit_iris33(core);
|
||||
if (rc)
|
||||
d_vpr_e("%s: failed with %d\n", __func__, rc);
|
||||
@@ -351,7 +351,7 @@ static int msm_vidc_init_vpu(struct msm_vidc_core *core, struct device *dev)
|
||||
}
|
||||
|
||||
#if defined(CONFIG_MSM_VIDC_IRIS2)
|
||||
if (of_device_is_compatible(dev->of_node, "qcom,msm-vidc-iris2")) {
|
||||
if (of_device_is_compatible(dev->of_node, "qcom,sm8450-vidc")) {
|
||||
rc = msm_vidc_init_iris2(core);
|
||||
if (rc)
|
||||
d_vpr_e("%s: failed with %d\n", __func__, rc);
|
||||
@@ -359,7 +359,8 @@ static int msm_vidc_init_vpu(struct msm_vidc_core *core, struct device *dev)
|
||||
}
|
||||
#endif
|
||||
#if defined(CONFIG_MSM_VIDC_IRIS3)
|
||||
if (of_device_is_compatible(dev->of_node, "qcom,msm-vidc-iris3")) {
|
||||
if (of_device_is_compatible(dev->of_node, "qcom,sm8550-vidc") ||
|
||||
of_device_is_compatible(dev->of_node, "qcom,sm8550-vidc-v2")) {
|
||||
rc = msm_vidc_init_iris3(core);
|
||||
if (rc)
|
||||
d_vpr_e("%s: failed with %d\n", __func__, rc);
|
||||
@@ -367,7 +368,7 @@ static int msm_vidc_init_vpu(struct msm_vidc_core *core, struct device *dev)
|
||||
}
|
||||
#endif
|
||||
#if defined(CONFIG_MSM_VIDC_IRIS33)
|
||||
if (of_device_is_compatible(dev->of_node, "qcom,msm-vidc-iris33")) {
|
||||
if (of_device_is_compatible(dev->of_node, "qcom,sm8650-vidc")) {
|
||||
rc = msm_vidc_init_iris33(core);
|
||||
if (rc)
|
||||
d_vpr_e("%s: failed with %d\n", __func__, rc);
|
||||
@@ -494,19 +495,3 @@ int msm_vidc_read_efuse(struct msm_vidc_core *core)
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
void msm_vidc_sort_table(struct msm_vidc_core *core)
|
||||
{
|
||||
u32 i = 0;
|
||||
|
||||
if (!core || !core->dt || !core->dt->allowed_clks_tbl) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
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]);
|
||||
}
|
||||
|
Reference in New Issue
Block a user