Message ID | 20230911-topic-mars-v3-18-79f23b81c261@linaro.org (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | Venus cleanups | expand |
On 3/27/2024 11:38 PM, Konrad Dybcio wrote: > This function can be very easily commonized between the supported gens. > Do so! > > Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> > --- > drivers/media/platform/qcom/venus/pm_helpers.c | 19 ------------------- > drivers/media/platform/qcom/venus/pm_helpers.h | 1 - > drivers/media/platform/qcom/venus/venc.c | 9 +++++++-- > 3 files changed, 7 insertions(+), 22 deletions(-) > > diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c > index 3818384bae10..5d174b83926b 100644 > --- a/drivers/media/platform/qcom/venus/pm_helpers.c > +++ b/drivers/media/platform/qcom/venus/pm_helpers.c > @@ -363,13 +363,6 @@ static int vdec_power_v3(struct device *dev, int on) > return ret; > } > > -static int venc_get_v3(struct device *dev) > -{ > - struct venus_core *core = dev_get_drvdata(dev); > - > - return vcodec_clks_get(core, dev, 1); > -} > - > static int venc_power_v3(struct device *dev, int on) > { > struct venus_core *core = dev_get_drvdata(dev); > @@ -389,7 +382,6 @@ static int venc_power_v3(struct device *dev, int on) > > static const struct venus_pm_ops pm_ops_v3 = { > .vdec_power = vdec_power_v3, > - .venc_get = venc_get_v3, > .venc_power = venc_power_v3, > .load_scale = load_scale_v1, > }; > @@ -785,16 +777,6 @@ static int vdec_power_v4(struct device *dev, int on) > return ret; > } > > -static int venc_get_v4(struct device *dev) > -{ > - struct venus_core *core = dev_get_drvdata(dev); > - > - if (!legacy_binding) > - return 0; > - > - return vcodec_clks_get(core, dev, 1); > -} > - > static void venc_put_v4(struct device *dev) > { > struct venus_core *core = dev_get_drvdata(dev); > @@ -1092,7 +1074,6 @@ static int load_scale_v4(struct venus_inst *inst) > static const struct venus_pm_ops pm_ops_v4 = { > .vdec_put = vdec_put_v4, > .vdec_power = vdec_power_v4, > - .venc_get = venc_get_v4, > .venc_put = venc_put_v4, > .venc_power = venc_power_v4, > .coreid_power = coreid_power_v4, > diff --git a/drivers/media/platform/qcom/venus/pm_helpers.h b/drivers/media/platform/qcom/venus/pm_helpers.h > index 4afc57dac865..cbf54e6c6eab 100644 > --- a/drivers/media/platform/qcom/venus/pm_helpers.h > +++ b/drivers/media/platform/qcom/venus/pm_helpers.h > @@ -13,7 +13,6 @@ struct venus_pm_ops { > void (*vdec_put)(struct device *dev); > int (*vdec_power)(struct device *dev, int on); > > - int (*venc_get)(struct device *dev); > void (*venc_put)(struct device *dev); > int (*venc_power)(struct device *dev, int on); > > diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c > index 3ec2fb8d9fab..d17aeba74b49 100644 > --- a/drivers/media/platform/qcom/venus/venc.c > +++ b/drivers/media/platform/qcom/venus/venc.c > @@ -1557,8 +1557,13 @@ static int venc_probe(struct platform_device *pdev) > > platform_set_drvdata(pdev, core); > > - if (core->pm_ops->venc_get) { > - ret = core->pm_ops->venc_get(dev); > + /* > + * If the vcodec core clock is missing by now, it either doesn't exist > + * (8916) or deprecated bindings with pre-assigned core functions and > + * resources under the decoder node are in use. > + */ > + if (!core->vcodec_core_clks[1]) { > + ret = vcodec_clks_get(core, dev, 1); > if (ret) > return ret; > } > same comment as previous patch. Thanks, Dikshita
diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c index 3818384bae10..5d174b83926b 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -363,13 +363,6 @@ static int vdec_power_v3(struct device *dev, int on) return ret; } -static int venc_get_v3(struct device *dev) -{ - struct venus_core *core = dev_get_drvdata(dev); - - return vcodec_clks_get(core, dev, 1); -} - static int venc_power_v3(struct device *dev, int on) { struct venus_core *core = dev_get_drvdata(dev); @@ -389,7 +382,6 @@ static int venc_power_v3(struct device *dev, int on) static const struct venus_pm_ops pm_ops_v3 = { .vdec_power = vdec_power_v3, - .venc_get = venc_get_v3, .venc_power = venc_power_v3, .load_scale = load_scale_v1, }; @@ -785,16 +777,6 @@ static int vdec_power_v4(struct device *dev, int on) return ret; } -static int venc_get_v4(struct device *dev) -{ - struct venus_core *core = dev_get_drvdata(dev); - - if (!legacy_binding) - return 0; - - return vcodec_clks_get(core, dev, 1); -} - static void venc_put_v4(struct device *dev) { struct venus_core *core = dev_get_drvdata(dev); @@ -1092,7 +1074,6 @@ static int load_scale_v4(struct venus_inst *inst) static const struct venus_pm_ops pm_ops_v4 = { .vdec_put = vdec_put_v4, .vdec_power = vdec_power_v4, - .venc_get = venc_get_v4, .venc_put = venc_put_v4, .venc_power = venc_power_v4, .coreid_power = coreid_power_v4, diff --git a/drivers/media/platform/qcom/venus/pm_helpers.h b/drivers/media/platform/qcom/venus/pm_helpers.h index 4afc57dac865..cbf54e6c6eab 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.h +++ b/drivers/media/platform/qcom/venus/pm_helpers.h @@ -13,7 +13,6 @@ struct venus_pm_ops { void (*vdec_put)(struct device *dev); int (*vdec_power)(struct device *dev, int on); - int (*venc_get)(struct device *dev); void (*venc_put)(struct device *dev); int (*venc_power)(struct device *dev, int on); diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index 3ec2fb8d9fab..d17aeba74b49 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -1557,8 +1557,13 @@ static int venc_probe(struct platform_device *pdev) platform_set_drvdata(pdev, core); - if (core->pm_ops->venc_get) { - ret = core->pm_ops->venc_get(dev); + /* + * If the vcodec core clock is missing by now, it either doesn't exist + * (8916) or deprecated bindings with pre-assigned core functions and + * resources under the decoder node are in use. + */ + if (!core->vcodec_core_clks[1]) { + ret = vcodec_clks_get(core, dev, 1); if (ret) return ret; }
This function can be very easily commonized between the supported gens. Do so! Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> --- drivers/media/platform/qcom/venus/pm_helpers.c | 19 ------------------- drivers/media/platform/qcom/venus/pm_helpers.h | 1 - drivers/media/platform/qcom/venus/venc.c | 9 +++++++-- 3 files changed, 7 insertions(+), 22 deletions(-)