video: driver: cleanup driver remove sequence
Remove deinit sequence calls and register devm managed callbacks, so that kernel can invoke then, when dev scope ends and cleansup all associated resources. Change-Id: I729fd21fe32d9f39240d0b743f910409d93a00c5 Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
This commit is contained in:
@@ -170,9 +170,7 @@ struct msm_platform_inst_cap_dependency {
|
|||||||
struct msm_vidc_compat_handle {
|
struct msm_vidc_compat_handle {
|
||||||
const char *compat;
|
const char *compat;
|
||||||
int (*init_platform)(struct msm_vidc_core *core);
|
int (*init_platform)(struct msm_vidc_core *core);
|
||||||
int (*deinit_platform)(struct msm_vidc_core *core);
|
|
||||||
int (*init_iris)(struct msm_vidc_core *core);
|
int (*init_iris)(struct msm_vidc_core *core);
|
||||||
int (*deinit_iris)(struct msm_vidc_core *core);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct msm_vidc_csc_coeff {
|
struct msm_vidc_csc_coeff {
|
||||||
@@ -281,8 +279,7 @@ static inline bool is_mmrm_supported(struct msm_vidc_core *core)
|
|||||||
return !!core->platform->data.supports_mmrm;
|
return !!core->platform->data.supports_mmrm;
|
||||||
}
|
}
|
||||||
|
|
||||||
int msm_vidc_init_platform(struct platform_device *pdev);
|
int msm_vidc_init_platform(struct msm_vidc_core *core);
|
||||||
int msm_vidc_deinit_platform(struct platform_device *pdev);
|
|
||||||
|
|
||||||
/* control framework support functions */
|
/* control framework support functions */
|
||||||
|
|
||||||
|
@@ -211,41 +211,31 @@ static const struct msm_vidc_compat_handle compat_handle[] = {
|
|||||||
{
|
{
|
||||||
.compat = "qcom,sm8650-vidc",
|
.compat = "qcom,sm8650-vidc",
|
||||||
.init_platform = msm_vidc_init_platform_pineapple,
|
.init_platform = msm_vidc_init_platform_pineapple,
|
||||||
.deinit_platform = msm_vidc_deinit_platform_pineapple,
|
|
||||||
.init_iris = msm_vidc_init_iris33,
|
.init_iris = msm_vidc_init_iris33,
|
||||||
.deinit_iris = msm_vidc_deinit_iris33,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.compat = "qcom,sm8650-vidc-v2",
|
.compat = "qcom,sm8650-vidc-v2",
|
||||||
.init_platform = msm_vidc_init_platform_pineapple,
|
.init_platform = msm_vidc_init_platform_pineapple,
|
||||||
.deinit_platform = msm_vidc_deinit_platform_pineapple,
|
|
||||||
.init_iris = msm_vidc_init_iris33,
|
.init_iris = msm_vidc_init_iris33,
|
||||||
.deinit_iris = msm_vidc_deinit_iris33,
|
|
||||||
},
|
},
|
||||||
#endif
|
#endif
|
||||||
#if defined(CONFIG_MSM_VIDC_KALAMA)
|
#if defined(CONFIG_MSM_VIDC_KALAMA)
|
||||||
{
|
{
|
||||||
.compat = "qcom,sm8550-vidc",
|
.compat = "qcom,sm8550-vidc",
|
||||||
.init_platform = msm_vidc_init_platform_kalama,
|
.init_platform = msm_vidc_init_platform_kalama,
|
||||||
.deinit_platform = msm_vidc_deinit_platform_kalama,
|
|
||||||
.init_iris = msm_vidc_init_iris3,
|
.init_iris = msm_vidc_init_iris3,
|
||||||
.deinit_iris = msm_vidc_deinit_iris3,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.compat = "qcom,sm8550-vidc-v2",
|
.compat = "qcom,sm8550-vidc-v2",
|
||||||
.init_platform = msm_vidc_init_platform_kalama,
|
.init_platform = msm_vidc_init_platform_kalama,
|
||||||
.deinit_platform = msm_vidc_deinit_platform_kalama,
|
|
||||||
.init_iris = msm_vidc_init_iris3,
|
.init_iris = msm_vidc_init_iris3,
|
||||||
.deinit_iris = msm_vidc_deinit_iris3,
|
|
||||||
},
|
},
|
||||||
#endif
|
#endif
|
||||||
#if defined(CONFIG_MSM_VIDC_WAIPIO)
|
#if defined(CONFIG_MSM_VIDC_WAIPIO)
|
||||||
{
|
{
|
||||||
.compat = "qcom,sm8450-vidc",
|
.compat = "qcom,sm8450-vidc",
|
||||||
.init_platform = msm_vidc_init_platform_waipio,
|
.init_platform = msm_vidc_init_platform_waipio,
|
||||||
.deinit_platform = msm_vidc_deinit_platform_waipio,
|
|
||||||
.init_iris = msm_vidc_init_iris2,
|
.init_iris = msm_vidc_init_iris2,
|
||||||
.deinit_iris = msm_vidc_deinit_iris2,
|
|
||||||
},
|
},
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
@@ -285,41 +275,6 @@ static int msm_vidc_init_ops(struct msm_vidc_core *core)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int msm_vidc_deinit_platform_variant(struct msm_vidc_core *core)
|
|
||||||
{
|
|
||||||
struct device *dev = NULL;
|
|
||||||
int i, rc = 0;
|
|
||||||
|
|
||||||
if (!core || !core->pdev) {
|
|
||||||
d_vpr_e("%s: Invalid params\n", __func__);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
dev = &core->pdev->dev;
|
|
||||||
|
|
||||||
d_vpr_h("%s()\n", __func__);
|
|
||||||
|
|
||||||
/* select platform based on compatible match */
|
|
||||||
for (i = 0; i < ARRAY_SIZE(compat_handle); i++) {
|
|
||||||
if (of_device_is_compatible(dev->of_node, compat_handle[i].compat)) {
|
|
||||||
rc = compat_handle[i].deinit_platform(core);
|
|
||||||
if (rc) {
|
|
||||||
d_vpr_e("%s: (%s) init failed with %d\n",
|
|
||||||
__func__, compat_handle[i].compat, rc);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* handle unknown compat type */
|
|
||||||
if (i == ARRAY_SIZE(compat_handle)) {
|
|
||||||
d_vpr_e("%s: Unsupported device: (%s)\n", __func__, dev_name(dev));
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int msm_vidc_init_platform_variant(struct msm_vidc_core *core)
|
static int msm_vidc_init_platform_variant(struct msm_vidc_core *core)
|
||||||
{
|
{
|
||||||
struct device *dev = NULL;
|
struct device *dev = NULL;
|
||||||
@@ -355,39 +310,6 @@ static int msm_vidc_init_platform_variant(struct msm_vidc_core *core)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int msm_vidc_deinit_vpu(struct msm_vidc_core *core)
|
|
||||||
{
|
|
||||||
struct device *dev = NULL;
|
|
||||||
int i, rc = 0;
|
|
||||||
|
|
||||||
if (!core || !core->pdev) {
|
|
||||||
d_vpr_e("%s: Invalid params\n", __func__);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
dev = &core->pdev->dev;
|
|
||||||
|
|
||||||
/* select platform based on compatible match */
|
|
||||||
for (i = 0; i < ARRAY_SIZE(compat_handle); i++) {
|
|
||||||
if (of_device_is_compatible(dev->of_node, compat_handle[i].compat)) {
|
|
||||||
rc = compat_handle[i].deinit_iris(core);
|
|
||||||
if (rc) {
|
|
||||||
d_vpr_e("%s: (%s) init failed with %d\n",
|
|
||||||
__func__, compat_handle[i].compat, rc);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* handle unknown compat type */
|
|
||||||
if (i == ARRAY_SIZE(compat_handle)) {
|
|
||||||
d_vpr_e("%s: Unsupported device: (%s)\n", __func__, dev_name(dev));
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int msm_vidc_init_vpu(struct msm_vidc_core *core)
|
static int msm_vidc_init_vpu(struct msm_vidc_core *core)
|
||||||
{
|
{
|
||||||
struct device *dev = NULL;
|
struct device *dev = NULL;
|
||||||
@@ -421,55 +343,24 @@ static int msm_vidc_init_vpu(struct msm_vidc_core *core)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int msm_vidc_deinit_platform(struct platform_device *pdev)
|
int msm_vidc_init_platform(struct msm_vidc_core *core)
|
||||||
{
|
|
||||||
struct msm_vidc_core *core;
|
|
||||||
|
|
||||||
if (!pdev) {
|
|
||||||
d_vpr_e("%s: invalid params\n", __func__);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
core = dev_get_drvdata(&pdev->dev);
|
|
||||||
if (!core) {
|
|
||||||
d_vpr_e("%s: core not found in device %s",
|
|
||||||
__func__, dev_name(&pdev->dev));
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
d_vpr_h("%s()\n", __func__);
|
|
||||||
|
|
||||||
msm_vidc_deinit_vpu(core);
|
|
||||||
msm_vidc_deinit_platform_variant(core);
|
|
||||||
|
|
||||||
msm_vidc_vmem_free((void **)&core->platform);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int msm_vidc_init_platform(struct platform_device *pdev)
|
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
struct msm_vidc_platform *platform = NULL;
|
struct msm_vidc_platform *platform = NULL;
|
||||||
struct msm_vidc_core *core;
|
|
||||||
|
|
||||||
if (!pdev) {
|
|
||||||
d_vpr_e("%s: invalid params\n", __func__);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
d_vpr_h("%s()\n", __func__);
|
d_vpr_h("%s()\n", __func__);
|
||||||
|
|
||||||
core = dev_get_drvdata(&pdev->dev);
|
|
||||||
if (!core) {
|
if (!core) {
|
||||||
d_vpr_e("%s: core not found in device %s",
|
d_vpr_e("%s: invalid param\n", __func__);
|
||||||
__func__, dev_name(&pdev->dev));
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = msm_vidc_vmem_alloc(sizeof(struct msm_vidc_platform),
|
platform = devm_kzalloc(&core->pdev->dev,
|
||||||
(void **)&platform, __func__);
|
sizeof(struct msm_vidc_platform), GFP_KERNEL);
|
||||||
if (rc)
|
if (!platform) {
|
||||||
return rc;
|
d_vpr_e("%s: failed to alloc memory for platform\n", __func__);
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
core->platform = platform;
|
core->platform = platform;
|
||||||
platform->core = core;
|
platform->core = core;
|
||||||
|
@@ -11,17 +11,11 @@
|
|||||||
|
|
||||||
#if defined(CONFIG_MSM_VIDC_KALAMA)
|
#if defined(CONFIG_MSM_VIDC_KALAMA)
|
||||||
int msm_vidc_init_platform_kalama(struct msm_vidc_core *core);
|
int msm_vidc_init_platform_kalama(struct msm_vidc_core *core);
|
||||||
int msm_vidc_deinit_platform_kalama(struct msm_vidc_core *core);
|
|
||||||
#else
|
#else
|
||||||
int msm_vidc_init_platform_kalama(struct msm_vidc_core *core)
|
int msm_vidc_init_platform_kalama(struct msm_vidc_core *core)
|
||||||
{
|
{
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int msm_vidc_deinit_platform_kalama(struct msm_vidc_core *core)
|
|
||||||
{
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // _MSM_VIDC_KALAMA_H_
|
#endif // _MSM_VIDC_KALAMA_H_
|
||||||
|
@@ -2822,9 +2822,3 @@ int msm_vidc_init_platform_kalama(struct msm_vidc_core *core)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int msm_vidc_deinit_platform_kalama(struct msm_vidc_core *core)
|
|
||||||
{
|
|
||||||
/* do nothing */
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
@@ -11,17 +11,11 @@
|
|||||||
|
|
||||||
#if defined(CONFIG_MSM_VIDC_PINEAPPLE)
|
#if defined(CONFIG_MSM_VIDC_PINEAPPLE)
|
||||||
int msm_vidc_init_platform_pineapple(struct msm_vidc_core *core);
|
int msm_vidc_init_platform_pineapple(struct msm_vidc_core *core);
|
||||||
int msm_vidc_deinit_platform_pineapple(struct msm_vidc_core *core);
|
|
||||||
#else
|
#else
|
||||||
int msm_vidc_init_platform_pineapple(struct msm_vidc_core *core)
|
int msm_vidc_init_platform_pineapple(struct msm_vidc_core *core)
|
||||||
{
|
{
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int msm_vidc_deinit_platform_pineapple(struct msm_vidc_core *core)
|
|
||||||
{
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // _MSM_VIDC_PINEAPPLE_H_
|
#endif // _MSM_VIDC_PINEAPPLE_H_
|
||||||
|
@@ -3009,9 +3009,3 @@ int msm_vidc_init_platform_pineapple(struct msm_vidc_core *core)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int msm_vidc_deinit_platform_pineapple(struct msm_vidc_core *core)
|
|
||||||
{
|
|
||||||
/* do nothing */
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
@@ -1767,10 +1767,3 @@ int msm_vidc_init_platform_pineapple(struct msm_vidc_core *core)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int msm_vidc_deinit_platform_pineapple(struct msm_vidc_core *core)
|
|
||||||
{
|
|
||||||
/* do nothing */
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@@ -14,7 +14,6 @@
|
|||||||
struct context_bank_info *msm_vidc_context_bank(struct msm_vidc_core *core,
|
struct context_bank_info *msm_vidc_context_bank(struct msm_vidc_core *core,
|
||||||
enum msm_vidc_buffer_region region);
|
enum msm_vidc_buffer_region region);
|
||||||
int msm_vidc_init_platform_waipio(struct msm_vidc_core *core);
|
int msm_vidc_init_platform_waipio(struct msm_vidc_core *core);
|
||||||
int msm_vidc_deinit_platform_waipio(struct msm_vidc_core *core);
|
|
||||||
#else
|
#else
|
||||||
struct context_bank_info *msm_vidc_context_bank(struct msm_vidc_core *core,
|
struct context_bank_info *msm_vidc_context_bank(struct msm_vidc_core *core,
|
||||||
enum msm_vidc_buffer_region region)
|
enum msm_vidc_buffer_region region)
|
||||||
@@ -26,11 +25,6 @@ int msm_vidc_init_platform_waipio(struct msm_vidc_core *core)
|
|||||||
{
|
{
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int msm_vidc_deinit_platform_waipio(struct msm_vidc_core *core)
|
|
||||||
{
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // _MSM_VIDC_WAIPIO_H_
|
#endif // _MSM_VIDC_WAIPIO_H_
|
||||||
|
@@ -1857,9 +1857,3 @@ int msm_vidc_init_platform_waipio(struct msm_vidc_core *core)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int msm_vidc_deinit_platform_waipio(struct msm_vidc_core *core)
|
|
||||||
{
|
|
||||||
/* do nothing */
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
@@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
#if defined(CONFIG_MSM_VIDC_WAIPIO)
|
#if defined(CONFIG_MSM_VIDC_WAIPIO)
|
||||||
int msm_vidc_init_iris2(struct msm_vidc_core *core);
|
int msm_vidc_init_iris2(struct msm_vidc_core *core);
|
||||||
int msm_vidc_deinit_iris2(struct msm_vidc_core *core);
|
|
||||||
int msm_vidc_adjust_blur_type_iris2(void *instance, struct v4l2_ctrl *ctrl);
|
int msm_vidc_adjust_blur_type_iris2(void *instance, struct v4l2_ctrl *ctrl);
|
||||||
#else
|
#else
|
||||||
static inline int msm_vidc_init_iris2(struct msm_vidc_core *core)
|
static inline int msm_vidc_init_iris2(struct msm_vidc_core *core)
|
||||||
@@ -19,11 +18,6 @@ static inline int msm_vidc_init_iris2(struct msm_vidc_core *core)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int msm_vidc_deinit_iris2(struct msm_vidc_core *core)
|
|
||||||
{
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int msm_vidc_adjust_blur_type_iris2(void *instance, struct v4l2_ctrl *ctrl)
|
static inline int msm_vidc_adjust_blur_type_iris2(void *instance, struct v4l2_ctrl *ctrl)
|
||||||
{
|
{
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@@ -1014,9 +1014,3 @@ int msm_vidc_init_iris2(struct msm_vidc_core *core)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int msm_vidc_deinit_iris2(struct msm_vidc_core *core)
|
|
||||||
{
|
|
||||||
/* do nothing */
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
@@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
#if defined(CONFIG_MSM_VIDC_KALAMA)
|
#if defined(CONFIG_MSM_VIDC_KALAMA)
|
||||||
int msm_vidc_init_iris3(struct msm_vidc_core *core);
|
int msm_vidc_init_iris3(struct msm_vidc_core *core);
|
||||||
int msm_vidc_deinit_iris3(struct msm_vidc_core *core);
|
|
||||||
int msm_vidc_adjust_bitrate_boost_iris3(void *instance, struct v4l2_ctrl *ctrl);
|
int msm_vidc_adjust_bitrate_boost_iris3(void *instance, struct v4l2_ctrl *ctrl);
|
||||||
#else
|
#else
|
||||||
static inline int msm_vidc_init_iris3(struct msm_vidc_core *core)
|
static inline int msm_vidc_init_iris3(struct msm_vidc_core *core)
|
||||||
@@ -19,11 +18,6 @@ static inline int msm_vidc_init_iris3(struct msm_vidc_core *core)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int msm_vidc_deinit_iris3(struct msm_vidc_core *core)
|
|
||||||
{
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int msm_vidc_adjust_bitrate_boost_iris3(void *instance, struct v4l2_ctrl *ctrl)
|
static inline int msm_vidc_adjust_bitrate_boost_iris3(void *instance, struct v4l2_ctrl *ctrl)
|
||||||
{
|
{
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@@ -1095,9 +1095,3 @@ int msm_vidc_init_iris3(struct msm_vidc_core *core)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int msm_vidc_deinit_iris3(struct msm_vidc_core *core)
|
|
||||||
{
|
|
||||||
/* do nothing */
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
@@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
#if defined(CONFIG_MSM_VIDC_PINEAPPLE)
|
#if defined(CONFIG_MSM_VIDC_PINEAPPLE)
|
||||||
int msm_vidc_init_iris33(struct msm_vidc_core *core);
|
int msm_vidc_init_iris33(struct msm_vidc_core *core);
|
||||||
int msm_vidc_deinit_iris33(struct msm_vidc_core *core);
|
|
||||||
int msm_vidc_adjust_bitrate_boost_iris33(void *instance, struct v4l2_ctrl *ctrl);
|
int msm_vidc_adjust_bitrate_boost_iris33(void *instance, struct v4l2_ctrl *ctrl);
|
||||||
#else
|
#else
|
||||||
static inline int msm_vidc_init_iris33(struct msm_vidc_core *core)
|
static inline int msm_vidc_init_iris33(struct msm_vidc_core *core)
|
||||||
@@ -19,11 +18,6 @@ static inline int msm_vidc_init_iris33(struct msm_vidc_core *core)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int msm_vidc_deinit_iris33(struct msm_vidc_core *core)
|
|
||||||
{
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int msm_vidc_adjust_bitrate_boost_iris33(void *instance, struct v4l2_ctrl *ctrl)
|
static inline int msm_vidc_adjust_bitrate_boost_iris33(void *instance, struct v4l2_ctrl *ctrl)
|
||||||
{
|
{
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@@ -1344,9 +1344,3 @@ int msm_vidc_init_iris33(struct msm_vidc_core *core)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int msm_vidc_deinit_iris33(struct msm_vidc_core *core)
|
|
||||||
{
|
|
||||||
/* do nothing */
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
@@ -562,7 +562,6 @@ bool msm_vidc_is_super_buffer(struct msm_vidc_inst *inst);
|
|||||||
int msm_vidc_init_core_caps(struct msm_vidc_core *core);
|
int msm_vidc_init_core_caps(struct msm_vidc_core *core);
|
||||||
int msm_vidc_init_instance_caps(struct msm_vidc_core *core);
|
int msm_vidc_init_instance_caps(struct msm_vidc_core *core);
|
||||||
int msm_vidc_deinit_core_caps(struct msm_vidc_core *core);
|
int msm_vidc_deinit_core_caps(struct msm_vidc_core *core);
|
||||||
int msm_vidc_deinit_instance_caps(struct msm_vidc_core *core);
|
|
||||||
int msm_vidc_update_debug_str(struct msm_vidc_inst *inst);
|
int msm_vidc_update_debug_str(struct msm_vidc_inst *inst);
|
||||||
void msm_vidc_allow_dcvs(struct msm_vidc_inst *inst);
|
void msm_vidc_allow_dcvs(struct msm_vidc_inst *inst);
|
||||||
bool msm_vidc_allow_decode_batch(struct msm_vidc_inst *inst);
|
bool msm_vidc_allow_decode_batch(struct msm_vidc_inst *inst);
|
||||||
|
@@ -3575,22 +3575,6 @@ static int update_inst_cap_dependency(
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int msm_vidc_deinit_instance_caps(struct msm_vidc_core *core)
|
|
||||||
{
|
|
||||||
int rc = 0;
|
|
||||||
|
|
||||||
if (!core) {
|
|
||||||
d_vpr_e("%s: invalid params\n", __func__);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
msm_vidc_vmem_free((void **)&core->inst_caps);
|
|
||||||
core->inst_caps = NULL;
|
|
||||||
d_vpr_h("%s: core->inst_caps freed\n", __func__);
|
|
||||||
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
int msm_vidc_init_instance_caps(struct msm_vidc_core *core)
|
int msm_vidc_init_instance_caps(struct msm_vidc_core *core)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
@@ -3635,10 +3619,13 @@ int msm_vidc_init_instance_caps(struct msm_vidc_core *core)
|
|||||||
core->dec_codecs_count = dec_codecs_count;
|
core->dec_codecs_count = dec_codecs_count;
|
||||||
|
|
||||||
codecs_count = enc_codecs_count + dec_codecs_count;
|
codecs_count = enc_codecs_count + dec_codecs_count;
|
||||||
rc = msm_vidc_vmem_alloc(codecs_count * sizeof(struct msm_vidc_inst_capability),
|
core->inst_caps = devm_kzalloc(&core->pdev->dev,
|
||||||
(void **)&core->inst_caps, __func__);
|
codecs_count * sizeof(struct msm_vidc_inst_capability), GFP_KERNEL);
|
||||||
if (rc)
|
if (!core->inst_caps) {
|
||||||
|
d_vpr_e("%s: failed to alloc memory for instance caps\n", __func__);
|
||||||
|
rc = -ENOMEM;
|
||||||
goto error;
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
check_bit = 0;
|
check_bit = 0;
|
||||||
/* determine codecs for enc domain */
|
/* determine codecs for enc domain */
|
||||||
|
@@ -361,11 +361,6 @@ static int msm_vidc_deinitialize_core(struct msm_vidc_core *core)
|
|||||||
mutex_destroy(&core->lock);
|
mutex_destroy(&core->lock);
|
||||||
msm_vidc_update_core_state(core, MSM_VIDC_CORE_DEINIT, __func__);
|
msm_vidc_update_core_state(core, MSM_VIDC_CORE_DEINIT, __func__);
|
||||||
|
|
||||||
msm_vidc_vmem_free((void **)&core->response_packet);
|
|
||||||
msm_vidc_vmem_free((void **)&core->packet);
|
|
||||||
core->response_packet = NULL;
|
|
||||||
core->packet = NULL;
|
|
||||||
|
|
||||||
if (core->batch_workq)
|
if (core->batch_workq)
|
||||||
destroy_workqueue(core->batch_workq);
|
destroy_workqueue(core->batch_workq);
|
||||||
|
|
||||||
@@ -405,15 +400,19 @@ static int msm_vidc_initialize_core(struct msm_vidc_core *core)
|
|||||||
}
|
}
|
||||||
|
|
||||||
core->packet_size = VIDC_IFACEQ_VAR_HUGE_PKT_SIZE;
|
core->packet_size = VIDC_IFACEQ_VAR_HUGE_PKT_SIZE;
|
||||||
rc = msm_vidc_vmem_alloc(core->packet_size,
|
core->packet = devm_kzalloc(&core->pdev->dev, core->packet_size, GFP_KERNEL);
|
||||||
(void **)&core->packet, "core packet");
|
if (!core->packet) {
|
||||||
if (rc)
|
d_vpr_e("%s: failed to alloc core packet\n", __func__);
|
||||||
|
rc = -ENOMEM;
|
||||||
goto exit;
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
rc = msm_vidc_vmem_alloc(core->packet_size,
|
core->response_packet = devm_kzalloc(&core->pdev->dev, core->packet_size, GFP_KERNEL);
|
||||||
(void **)&core->response_packet, "core response packet");
|
if (!core->packet) {
|
||||||
if (rc)
|
d_vpr_e("%s: failed to alloc core response packet\n", __func__);
|
||||||
|
rc = -ENOMEM;
|
||||||
goto exit;
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
mutex_init(&core->lock);
|
mutex_init(&core->lock);
|
||||||
INIT_LIST_HEAD(&core->instances);
|
INIT_LIST_HEAD(&core->instances);
|
||||||
@@ -425,10 +424,6 @@ static int msm_vidc_initialize_core(struct msm_vidc_core *core)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
exit:
|
exit:
|
||||||
msm_vidc_vmem_free((void **)&core->response_packet);
|
|
||||||
msm_vidc_vmem_free((void **)&core->packet);
|
|
||||||
core->response_packet = NULL;
|
|
||||||
core->packet = NULL;
|
|
||||||
if (core->batch_workq)
|
if (core->batch_workq)
|
||||||
destroy_workqueue(core->batch_workq);
|
destroy_workqueue(core->batch_workq);
|
||||||
if (core->pm_workq)
|
if (core->pm_workq)
|
||||||
@@ -439,6 +434,65 @@ exit:
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void msm_vidc_devm_deinit_core(void *res)
|
||||||
|
{
|
||||||
|
struct msm_vidc_core *core = res;
|
||||||
|
|
||||||
|
d_vpr_h("%s()\n", __func__);
|
||||||
|
msm_vidc_deinitialize_core(core);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int msm_vidc_devm_init_core(struct device *dev, struct msm_vidc_core *core)
|
||||||
|
{
|
||||||
|
int rc = 0;
|
||||||
|
|
||||||
|
if (!dev || !core) {
|
||||||
|
d_vpr_e("%s: invalid params\n", __func__);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = msm_vidc_initialize_core(core);
|
||||||
|
if (rc) {
|
||||||
|
d_vpr_e("%s: init failed with %d\n", __func__, rc);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = devm_add_action_or_reset(dev, msm_vidc_devm_deinit_core, (void *)core);
|
||||||
|
if (rc)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void msm_vidc_devm_debugfs_put(void *res)
|
||||||
|
{
|
||||||
|
struct dentry *parent = res;
|
||||||
|
|
||||||
|
d_vpr_h("%s()\n", __func__);
|
||||||
|
debugfs_remove_recursive(parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct dentry *msm_vidc_devm_debugfs_get(struct device *dev)
|
||||||
|
{
|
||||||
|
struct dentry *parent = NULL;
|
||||||
|
int rc = 0;
|
||||||
|
|
||||||
|
if (!dev) {
|
||||||
|
d_vpr_e("%s: invalid params\n", __func__);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
parent = msm_vidc_debugfs_init_drv();
|
||||||
|
if (!parent)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
rc = devm_add_action_or_reset(dev, msm_vidc_devm_debugfs_put, (void *)parent);
|
||||||
|
if (rc)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return parent;
|
||||||
|
}
|
||||||
|
|
||||||
static int msm_vidc_setup_context_bank(struct msm_vidc_core *core,
|
static int msm_vidc_setup_context_bank(struct msm_vidc_core *core,
|
||||||
struct device *dev)
|
struct device *dev)
|
||||||
{
|
{
|
||||||
@@ -674,14 +728,7 @@ static int msm_vidc_remove_video_device(struct platform_device *pdev)
|
|||||||
|
|
||||||
sysfs_remove_group(&pdev->dev.kobj, &msm_vidc_core_attr_group);
|
sysfs_remove_group(&pdev->dev.kobj, &msm_vidc_core_attr_group);
|
||||||
|
|
||||||
msm_vidc_deinit_instance_caps(core);
|
|
||||||
|
|
||||||
msm_vidc_deinit_platform(pdev);
|
|
||||||
msm_vidc_deinitialize_core(core);
|
|
||||||
|
|
||||||
dev_set_drvdata(&pdev->dev, NULL);
|
dev_set_drvdata(&pdev->dev, NULL);
|
||||||
debugfs_remove_recursive(core->debugfs_parent);
|
|
||||||
msm_vidc_vmem_free((void **)&core);
|
|
||||||
g_core = NULL;
|
g_core = NULL;
|
||||||
d_vpr_h("%s(): succssful\n", __func__);
|
d_vpr_h("%s(): succssful\n", __func__);
|
||||||
|
|
||||||
@@ -724,25 +771,27 @@ static int msm_vidc_probe_video_device(struct platform_device *pdev)
|
|||||||
|
|
||||||
d_vpr_h("%s: %s\n", __func__, dev_name(&pdev->dev));
|
d_vpr_h("%s: %s\n", __func__, dev_name(&pdev->dev));
|
||||||
|
|
||||||
rc = msm_vidc_vmem_alloc(sizeof(*core), (void **)&core, __func__);
|
core = devm_kzalloc(&pdev->dev, sizeof(struct msm_vidc_core), GFP_KERNEL);
|
||||||
if (rc)
|
if (!core) {
|
||||||
return rc;
|
d_vpr_e("%s: failed to alloc memory for core\n", __func__);
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
g_core = core;
|
g_core = core;
|
||||||
|
|
||||||
core->debugfs_parent = msm_vidc_debugfs_init_drv();
|
|
||||||
if (!core->debugfs_parent)
|
|
||||||
d_vpr_h("Failed to create debugfs for msm_vidc\n");
|
|
||||||
|
|
||||||
core->pdev = pdev;
|
core->pdev = pdev;
|
||||||
dev_set_drvdata(&pdev->dev, core);
|
dev_set_drvdata(&pdev->dev, core);
|
||||||
|
|
||||||
rc = msm_vidc_initialize_core(core);
|
core->debugfs_parent = msm_vidc_devm_debugfs_get(&pdev->dev);
|
||||||
|
if (!core->debugfs_parent)
|
||||||
|
d_vpr_h("Failed to create debugfs for msm_vidc\n");
|
||||||
|
|
||||||
|
rc = msm_vidc_devm_init_core(&pdev->dev, core);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
d_vpr_e("%s: init core failed with %d\n", __func__, rc);
|
d_vpr_e("%s: init core failed with %d\n", __func__, rc);
|
||||||
goto init_core_failed;
|
goto init_core_failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = msm_vidc_init_platform(pdev);
|
rc = msm_vidc_init_platform(core);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
d_vpr_e("%s: init platform failed with %d\n", __func__, rc);
|
d_vpr_e("%s: init platform failed with %d\n", __func__, rc);
|
||||||
rc = -EINVAL;
|
rc = -EINVAL;
|
||||||
@@ -839,16 +888,11 @@ master_add_failed:
|
|||||||
sub_dev_failed:
|
sub_dev_failed:
|
||||||
sysfs_remove_group(&pdev->dev.kobj, &msm_vidc_core_attr_group);
|
sysfs_remove_group(&pdev->dev.kobj, &msm_vidc_core_attr_group);
|
||||||
init_group_failed:
|
init_group_failed:
|
||||||
msm_vidc_deinit_instance_caps(core);
|
|
||||||
init_inst_caps_fail:
|
init_inst_caps_fail:
|
||||||
init_res_failed:
|
init_res_failed:
|
||||||
msm_vidc_deinit_platform(pdev);
|
|
||||||
init_plat_failed:
|
init_plat_failed:
|
||||||
msm_vidc_deinitialize_core(core);
|
|
||||||
init_core_failed:
|
init_core_failed:
|
||||||
dev_set_drvdata(&pdev->dev, NULL);
|
dev_set_drvdata(&pdev->dev, NULL);
|
||||||
debugfs_remove_recursive(core->debugfs_parent);
|
|
||||||
msm_vidc_vmem_free((void **)&core);
|
|
||||||
g_core = NULL;
|
g_core = NULL;
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
Reference in New Issue
Block a user