All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Foss <robert.foss@linaro.org>
To: "Bryan O'Donoghue" <bryan.odonoghue@linaro.org>
Cc: linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org,
	jonathan@marek.ca, andrey.konovalov@linaro.org,
	todor.too@gmail.com, agross@kernel.org,
	bjorn.andersson@linaro.org, mchehab@kernel.org, jgrahsl@snap.com,
	hfink@snap.com
Subject: Re: [PATCH v2 17/19] media: camss: Add SM8250 bandwdith configuration support
Date: Thu, 25 Nov 2021 11:27:35 +0100	[thread overview]
Message-ID: <CAG3jFytVHxOWw1aymMJtXXZ=4r3gjdjtM6Qpb8mqtzc5jSs-EA@mail.gmail.com> (raw)
In-Reply-To: <20211124175921.1048375-18-bryan.odonoghue@linaro.org>

On Wed, 24 Nov 2021 at 18:57, Bryan O'Donoghue
<bryan.odonoghue@linaro.org> wrote:
>
> Downstream makes some pretty explicit comments about voting for bus
> bandwidth prior to camcc_camnoc_axi_clk_src. Working with camx downstream
> also shows that the bandwidth vote is required to get that root clock
> working.
>
> Add a simple mechanism to declare set and unset named NOCs. Whereas the
> objective is to enable the sm8250 specifically the code has been
> implemented to allow setting of whatever NOCs different SoCs using this
> driver may require.
>
> Tested-by: Julian Grahsl <jgrahsl@snap.com>
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> ---
>  drivers/media/platform/qcom/camss/camss.c | 81 +++++++++++++++++++++++
>  drivers/media/platform/qcom/camss/camss.h | 17 +++++
>  2 files changed, 98 insertions(+)
>
> diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c
> index 066639db9f18..d9905e737d88 100644
> --- a/drivers/media/platform/qcom/camss/camss.c
> +++ b/drivers/media/platform/qcom/camss/camss.c
> @@ -8,6 +8,7 @@
>   * Copyright (C) 2015-2018 Linaro Ltd.
>   */
>  #include <linux/clk.h>
> +#include <linux/interconnect.h>
>  #include <linux/media-bus-format.h>
>  #include <linux/media.h>
>  #include <linux/module.h>
> @@ -841,6 +842,29 @@ static const struct resources vfe_res_8250[] = {
>         },
>  };
>
> +static const struct resources_icc icc_res_sm8250[] = {
> +       {
> +               .name = "cam_ahb",
> +               .icc_bw_tbl.avg = 38400,
> +               .icc_bw_tbl.peak = 76800,
> +       },
> +       {
> +               .name = "cam_hf_0_mnoc",
> +               .icc_bw_tbl.avg = 2097152,
> +               .icc_bw_tbl.peak = 2097152,
> +       },
> +       {
> +               .name = "cam_sf_0_mnoc",
> +               .icc_bw_tbl.avg = 0,
> +               .icc_bw_tbl.peak = 2097152,
> +       },
> +       {
> +               .name = "cam_sf_icp_mnoc",
> +               .icc_bw_tbl.avg = 2097152,
> +               .icc_bw_tbl.peak = 2097152,
> +       },
> +};
> +
>  /*
>   * camss_add_clock_margin - Add margin to clock frequency rate
>   * @rate: Clock frequency rate
> @@ -1470,6 +1494,29 @@ static int camss_configure_pd(struct camss *camss)
>         return ret;
>  }
>
> +static int camss_icc_get(struct camss *camss)
> +{
> +       const struct resources_icc *icc_res;
> +       int nbr_icc_paths = 0;
> +       int i;
> +
> +       if (camss->version == CAMSS_8250) {
> +               icc_res = &icc_res_sm8250[0];
> +               nbr_icc_paths = ICC_SM8250_COUNT;
> +       }
> +
> +       for (i = 0; i < nbr_icc_paths; i++) {
> +               camss->icc_path[i] = devm_of_icc_get(camss->dev,
> +                                                    icc_res[i].name);
> +               if (IS_ERR(camss->icc_path[i]))
> +                       return PTR_ERR(camss->icc_path[i]);
> +
> +               camss->icc_bw_tbl[i] = icc_res[i].icc_bw_tbl;
> +       }
> +
> +       return 0;
> +}
> +
>  /*
>   * camss_probe - Probe CAMSS platform device
>   * @pdev: Pointer to CAMSS platform device
> @@ -1562,6 +1609,10 @@ static int camss_probe(struct platform_device *pdev)
>                 goto err_cleanup;
>         }
>
> +       ret = camss_icc_get(camss);
> +       if (ret < 0)
> +               goto err_cleanup;
> +
>         ret = camss_init_subdevices(camss);
>         if (ret < 0)
>                 goto err_cleanup;
> @@ -1695,11 +1746,41 @@ MODULE_DEVICE_TABLE(of, camss_dt_match);
>
>  static int __maybe_unused camss_runtime_suspend(struct device *dev)
>  {
> +       struct camss *camss = dev_get_drvdata(dev);
> +       int nbr_icc_paths = 0;
> +       int i;
> +       int ret;
> +
> +       if (camss->version == CAMSS_8250)
> +               nbr_icc_paths = ICC_SM8250_COUNT;
> +
> +       for (i = 0; i < nbr_icc_paths; i++) {
> +               ret = icc_set_bw(camss->icc_path[i], 0, 0);
> +               if (ret)
> +                       return ret;
> +       }
> +
>         return 0;
>  }
>
>  static int __maybe_unused camss_runtime_resume(struct device *dev)
>  {
> +       struct camss *camss = dev_get_drvdata(dev);
> +       int nbr_icc_paths = 0;
> +       int i;
> +       int ret;
> +
> +       if (camss->version == CAMSS_8250)
> +               nbr_icc_paths = ICC_SM8250_COUNT;
> +
> +       for (i = 0; i < nbr_icc_paths; i++) {
> +               ret = icc_set_bw(camss->icc_path[i],
> +                                camss->icc_bw_tbl[i].avg,
> +                                camss->icc_bw_tbl[i].peak);
> +               if (ret)
> +                       return ret;
> +       }
> +
>         return 0;
>  }
>
> diff --git a/drivers/media/platform/qcom/camss/camss.h b/drivers/media/platform/qcom/camss/camss.h
> index 377e2474a485..9c644e638a94 100644
> --- a/drivers/media/platform/qcom/camss/camss.h
> +++ b/drivers/media/platform/qcom/camss/camss.h
> @@ -56,6 +56,16 @@ struct resources_ispif {
>         char *interrupt;
>  };
>
> +struct icc_bw_tbl {
> +       u32 avg;
> +       u32 peak;
> +};
> +
> +struct resources_icc {
> +       char *name;
> +       struct icc_bw_tbl icc_bw_tbl;
> +};
> +
>  enum pm_domain {
>         PM_DOMAIN_VFE0 = 0,
>         PM_DOMAIN_VFE1 = 1,
> @@ -72,6 +82,11 @@ enum camss_version {
>         CAMSS_8250,
>  };
>
> +enum icc_count {
> +       ICC_DEFAULT_COUNT = 0,
> +       ICC_SM8250_COUNT = 4,
> +};
> +
>  struct camss {
>         enum camss_version version;
>         struct v4l2_device v4l2_dev;
> @@ -88,6 +103,8 @@ struct camss {
>         atomic_t ref_count;
>         struct device *genpd[PM_DOMAIN_GEN2_COUNT];
>         struct device_link *genpd_link[PM_DOMAIN_GEN2_COUNT];
> +       struct icc_path *icc_path[ICC_SM8250_COUNT];
> +       struct icc_bw_tbl icc_bw_tbl[ICC_SM8250_COUNT];
>  };
>
>  struct camss_camera_interface {
> --
> 2.33.0
>

Looks good!

Reviewed-by: Robert Foss <robert.foss@linaro.org>

  reply	other threads:[~2021-11-25 10:29 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-24 17:59 [PATCH v2 00/19] CAMSS: Add SM8250 support Bryan O'Donoghue
2021-11-24 17:59 ` [PATCH v2 01/19] media: dt-bindings: media: camss: Add qcom,sm8250-camss binding Bryan O'Donoghue
2021-12-02 13:06   ` Hans Verkuil
2021-12-02 13:11     ` Bryan O'Donoghue
2021-11-24 17:59 ` [PATCH v2 02/19] media: camss: csiphy-3ph: don't print HW version as an error Bryan O'Donoghue
2021-11-24 17:59 ` [PATCH v2 03/19] media: camss: csiphy-3ph: disable interrupts Bryan O'Donoghue
2021-11-24 17:59 ` [PATCH v2 04/19] media: camss: csiphy-3ph: add support for SM8250 CSI DPHY Bryan O'Donoghue
2021-11-24 17:59 ` [PATCH v2 05/19] media: camss: csid-170: fix non-10bit formats Bryan O'Donoghue
2021-11-24 17:59 ` [PATCH v2 06/19] media: camss: csid-170: don't enable unused irqs Bryan O'Donoghue
2021-11-24 17:59 ` [PATCH v2 07/19] media: camss: csid-170: remove stray comment Bryan O'Donoghue
2021-11-24 17:59 ` [PATCH v2 08/19] media: camss: csid-170: support more than one lite vfe Bryan O'Donoghue
2021-11-24 17:59 ` [PATCH v2 09/19] media: camss: csid-170: set the right HALT_CMD when disabled Bryan O'Donoghue
2021-11-24 17:59 ` [PATCH v2 10/19] media: camss: csid: allow csid to work without a regulator Bryan O'Donoghue
2021-11-24 17:59 ` [PATCH v2 11/19] media: camss: remove vdda-csiN from sdm845 resources Bryan O'Donoghue
2021-11-24 17:59 ` [PATCH v2 12/19] media: camss: fix VFE irq name Bryan O'Donoghue
2021-11-24 17:59 ` [PATCH v2 13/19] media: camss: vfe-170: fix "VFE halt timeout" error Bryan O'Donoghue
2021-11-24 17:59 ` [PATCH v2 14/19] media: camss: Add initial support for VFE hardware version Titan 480 Bryan O'Donoghue
2021-11-24 17:59 ` [PATCH v2 15/19] media: camss: add support for V4L2_PIX_FMT_GREY for sdm845 HW Bryan O'Donoghue
2021-11-24 17:59 ` [PATCH v2 16/19] media: camss: add support for SM8250 camss Bryan O'Donoghue
2021-11-24 17:59 ` [PATCH v2 17/19] media: camss: Add SM8250 bandwdith configuration support Bryan O'Donoghue
2021-11-25 10:27   ` Robert Foss [this message]
2021-11-24 17:59 ` [PATCH v2 18/19] media: camss: Do vfe_get/vfe_put for csid on sm8250 Bryan O'Donoghue
2021-11-25 10:43   ` Robert Foss
2021-11-24 17:59 ` [PATCH v2 19/19] media: camss: Apply vfe_get/vfe_put fix to SDM845 Bryan O'Donoghue
2021-11-25 10:45   ` Robert Foss

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAG3jFytVHxOWw1aymMJtXXZ=4r3gjdjtM6Qpb8mqtzc5jSs-EA@mail.gmail.com' \
    --to=robert.foss@linaro.org \
    --cc=agross@kernel.org \
    --cc=andrey.konovalov@linaro.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=bryan.odonoghue@linaro.org \
    --cc=hfink@snap.com \
    --cc=jgrahsl@snap.com \
    --cc=jonathan@marek.ca \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=todor.too@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.