Skip to content
Snippets Groups Projects
  1. Nov 02, 2023
  2. Oct 31, 2023
    • Bryan O'Donoghue's avatar
      media: qcom: camss: Use common VFE pm_domain_on/pm_domain_off where applicable · b178f0ad
      Bryan O'Donoghue authored
      
      For the various versions of VFE we have a boiler-plate
      pm_domain_on/pm_domain_off callback pair of the general form.
      
      - Error check.
        Not always done but applicable to all.
      
      - device_link_add (DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME |
                         DL_FLAG_RPM_ACTIVE);
      
      - Error check returning -EINVAL on error.
      
      - Return 0
      
      Reduce the pattern down to a common callback. VFE 4.1 is a special case
      which to me also indicates that it is worthwhile maintaining an indirection
      for the vfe_pm_domain_{on|off} for now.
      
      Otherwise lets chuck out a bunch of needlessly replicated code.
      
      Reviewed-by: default avatarKonrad Dybcio <konrad.dybcio@linaro.org>
      Suggested-by: default avatarMatti Lehtimäki <matti.lehtimaki@gmail.com>
      Signed-off-by: default avatarBryan O'Donoghue <bryan.odonoghue@linaro.org>
      b178f0ad
    • Bryan O'Donoghue's avatar
      media: qcom: camss: Convert to per-VFE pointer for power-domain linkages · 86f26350
      Bryan O'Donoghue authored
      
      Right now we use the top-level camss structure to provide pointers via
      VFE id index back to genpd linkages.
      
      In effect this hard-codes VFE indexes to power-domain indexes in the
      dtsi and mandates a very particular ordering of power domains in the
      dtsi, which bears no relationship to a real hardware dependency.
      
      As a first step to rationalising the VFE power-domain code and breaking
      the magic indexing in dtsi use per-VFE pointers to genpd linkages.
      
      The top-level index in msm_vfe_subdev_init is still used to attain the
      initial so no functional or logical change arises from this change.
      
      Reviewed-by: default avatarKonrad Dybcio <konrad.dybcio@linaro.org>
      Signed-off-by: default avatarBryan O'Donoghue <bryan.odonoghue@linaro.org>
      86f26350
    • Bryan O'Donoghue's avatar
      media: qcom: camss: Flag which VFEs require a power-domain · 999af692
      Bryan O'Donoghue authored
      
      At the moment we have some complex code for determining if a VFE requires a
      power-domain attachment. Particularly discordant in this scheme is the
      subtle reliance on VFE and VFE Lite declaration ordering in our resources.
      
      VFE id is used to determine if a VFE is lite or not and consequently if a
      VFE requires power-domain attachment. VFE Lite though is not a correct
      delineation between power-domain and non power-domain state since early
      SoCs have neither VFE Lite nor power-domains attached to VFEs.
      
      Introduce has_pd to the VFE resource structure to allow the CAMSS code to
      understand if it needs to try to attach a power-domain for a given VFE.
      
      As a side-effect from this we no longer need to care about VFE Lite or
      non-Lite or the id number associated with either and which order the
      VFE/VFE Lite was declared in.
      
      Reviewed-by: default avatarKonrad Dybcio <konrad.dybcio@linaro.org>
      Signed-off-by: default avatarBryan O'Donoghue <bryan.odonoghue@linaro.org>
      999af692
    • Bryan O'Donoghue's avatar
      media: qcom: camss: Introduce support for named power-domains · 5296fdf4
      Bryan O'Donoghue authored
      V3:
      - Includes bugfix reported on IRC
        genpd_link and genpd should be checked for NULL on the cleanup path.
        Matti Lehtimäki 
      - Retains NULL check before dev_pm_domain_attach_by_name()
        I experimented with the suggested drop but of_property_match_string()
        chokes
        Link: https://lore.kernel.org/lkml/883ce8a7-80e1-4065-a957-424d0b4a6535@linaro.org/T/#m10e5a43d0245f13eca177ef2f65b24259c641030
        Konrad
      - Fixes spelling caught by codespell - Konrad
      
      Link: https://git.codelinaro.org/bryan.odonoghue/kernel/-/tree/b4/b4-camss-named-power-domains-v3
      sm8250-testable: https://git.codelinaro.org/bryan.odonoghue/kernel/-/tree/b4/b4-camss-named-power-domains-v3+sm8250
      
      V2:
      - Incorporates Konrad's suggestion re: removing 'id'
      - Adds RB - Konrad
      - Adds in a flag to indicate if a VFE has a power domain.
        As I rebased this series I realised we had some magic indexing for VFE v
        VFE Lite, which isn't the root cause of my bug bear in this series but is
        the same sin - inferring functionality from indexing.
        Once we transition fully to named pds we won't need a 'has_pd' to flag
        which VFEs need power-domain attachment and which don't.
        That transition will require populating all upstream dtsi with pd-names
        and then deprecating the old way.
        has_pd is a far better choice than inferring from indexes so, I've added.
      
      Link: https://git.codelinaro.org/bryan.odonoghue/kernel/-/commits/aa45a2b58aa1e187a2698a65164d694251f08fa1
      
      V1:
      At the moment the Qcom CAMSS driver relies on the declaration order of
      power-domains within the dtsi to determine which power-domain relates to a
      VFE and which power-domain relates to the top-level (top) CAMSS
      power-domain.
      
      VFE power-domains must be declared prior to the top power-domain. The top
      power-domain must be declared last. Early SoCs have just one top
      power-domain with later SoCs introducing VFE specific power-domains.
      
      Differentiating between the number of power-domains results in lots of code
      which is brittle and which we can mostly get rid of with named
      power-domains.
      
      The reliance on declaration ordering is in-effect magic number indexing.
      
      This series introduces named power-domains for CAMSS and refactors some of
      the code in CAMSS to support the new named power-domains. We continue to
      support the legacy indexing model with an intention to remove after a
      reasonable transition period.
      
      New SoC additions should use named power-domains from now on.
      
      Tested on x13s, rb5, db410c
      
      Link: https://git.codelinaro.org/bryan.odonoghue/kernel/-/tree/linux-next-23-10-23-camss-named-power-domains
      
      Bryan O'Donoghue (5):
        media: qcom: camss: Flag which VFEs require a power-domain
        media: qcom: camss: Convert to per-VFE pointer for power-domain
          linkages
        media: qcom: camss: Use common VFE pm_domain_on/pm_domain_off where
          applicable
        media: qcom: camss: Move VFE power-domain specifics into vfe.c
        media: qcom: camss: Add support for named power-domains
      
       .../media/platform/qcom/camss/camss-vfe-170.c | 36 --------
       .../media/platform/qcom/camss/camss-vfe-4-1.c |  8 +-
       .../media/platform/qcom/camss/camss-vfe-4-7.c | 36 --------
       .../media/platform/qcom/camss/camss-vfe-4-8.c | 31 -------
       .../media/platform/qcom/camss/camss-vfe-480.c | 36 --------
       drivers/media/platform/qcom/camss/camss-vfe.c | 77 ++++++++++++++++
       drivers/media/platform/qcom/camss/camss-vfe.h | 16 ++++
       drivers/media/platform/qcom/camss/camss.c     | 87 ++++++++++++-------
       drivers/media/platform/qcom/camss/camss.h     |  7 +-
       9 files changed, 156 insertions(+), 178 deletions(-)
      
      --
      2.42.0
      
      To: hverkuil-cisco@xs4all.nl
      To: laurent.pinchart@ideasonboard.com
      To: Robert Foss <rfoss@kernel.org>
      To: Todor Tomov <todor.too@gmail.com>
      To: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
      To: Andy Gross <agross@kernel.org>
      To: Bjorn Andersson <andersson@kernel.org>
      To: Konrad Dybcio <konrad.dybcio@linaro.org>
      To: Mauro Carvalho Chehab <mchehab@kernel.org>
      To: matti.lehtimaki@gmail.com
      Cc: linux-media@vger.kernel.org
      Cc: linux-arm-msm@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      
      ---
      Changes in v4:
      - EDITME: describe what is new in this series revision.
      - EDITME: use bulletpoints and terse descriptions.
      - Link to v3: https://lore.kernel.org/r/20231101-b4-camss-named-power-domains-v3-0-bbdf5f22462a@linaro.org
      
      
      
      --- b4-submit-tracking ---
      # This section is used internally by b4 prep for tracking purposes.
      {
        "series": {
          "revision": 4,
          "change-id": "20231031-b4-camss-named-power-domains-cc2ac2722543",
          "prefixes": [],
          "from-thread": "20231026155042.551731-1-bryan.odonoghue@linaro.org",
          "history": {
            "v3": [
              "20231101-b4-camss-named-power-domains-v3-0-bbdf5f22462a@linaro.org"
            ]
          }
        }
      }
      5296fdf4
  3. Oct 18, 2023
  4. Oct 13, 2023
  5. Oct 12, 2023
Loading