From: Jani Nikula <jani.nikula@intel.com>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>,
"Vandita Kulkarni" <vandita.kulkarni@intel.com>
Cc: intel-gfx@lists.freedesktop.org, paulo.r.zanoni@intel.com
Subject: Re: [RFC 1/3] drm/i915/icl: Restructure ICL DPLL enable functionality
Date: Wed, 03 Oct 2018 10:54:59 +0300 [thread overview]
Message-ID: <87pnwrqxbg.fsf@intel.com> (raw)
In-Reply-To: <20180914160655.GJ5565@intel.com>
On Fri, 14 Sep 2018, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> On Fri, Sep 14, 2018 at 12:24:12PM +0530, Vandita Kulkarni wrote:
>> From: Madhav Chauhan <madhav.chauhan@intel.com>
>>
>> In Gen11, DPLL 0 and 1 are shared between DDI and DSI.
>> Most of the steps for enabling DPLL are common across DDI
>> and DSI. This patch makes icl_dpll_enable() generic which
>> will be used by all the encoders.
>>
>> Signed-off-by: Madhav Chauhan <madhav.chauhan@intel.com>
>> Signed-off-by: Vandita Kulkarni <vandita.kulkarni@intel.com>
>> ---
>> drivers/gpu/drm/i915/intel_ddi.c | 12 ++++++++++++
>> drivers/gpu/drm/i915/intel_dpll_mgr.c | 19 ++-----------------
>> drivers/gpu/drm/i915/intel_dpll_mgr.h | 2 +-
>> 3 files changed, 15 insertions(+), 18 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
>> index cd01a09..2942a24 100644
>> --- a/drivers/gpu/drm/i915/intel_ddi.c
>> +++ b/drivers/gpu/drm/i915/intel_ddi.c
>> @@ -2810,6 +2810,18 @@ static void intel_ddi_clk_select(struct intel_encoder *encoder,
>> mutex_lock(&dev_priv->dpll_lock);
>>
>> if (IS_ICELAKE(dev_priv)) {
>> + enum intel_dpll_id id = pll->info->id;
>> + i915_reg_t enable_reg = icl_pll_id_to_enable_reg(id);
>> +
>> + val = I915_READ(enable_reg);
>> + val |= PLL_ENABLE;
>> + I915_WRITE(enable_reg, val);
>> +
>> + /* TODO: wait times missing from the spec. */
>> + if (intel_wait_for_register(dev_priv, enable_reg, PLL_LOCK,
>> + PLL_LOCK, 5))
>> + DRM_ERROR("PLL %d not locked\n", id);
>> +
>
> I don't really see why this can't stay in the dpll mgr.
Agreed, I think it should stay in DPLL manager.
The thing is, DPLL enabling for DSI requires encoder specific steps in
the middle of the sequence hidden in DPLL manager. It's not pretty to
add that in DPLL manager.
One approach might be to add encoder hooks to call from the right spot
in the DPLL manager, "mid_pll_enable". It's annoying because it would
have to happen in the middle of the platform specific DPLL manager
pll->info->funcs->enable hook. We'd have to call the hooks from platform
specific code, or split those hooks in two. The former is ugly because
it requires passing crtc to the pll enable hook. So I guess add a pll
post enable hook.
Below's some draft code to give an idea what I mean. You'd move the
above hunk to the post hook instead.
So then we'd add mid_pll_enable hooks and do the required magic in the
DSI mid pll hook.
Overall I'm starting to feel the appeal of driving modeset from
encoders, with library style helpers provided from intel_display.c,
instead of adding more and more encoder hooks to do stuff at specific
places. But I digress.
BR,
Jani.
diff --git a/drivers/gpu/drm/i915/intel_dpll_mgr.c b/drivers/gpu/drm/i915/intel_dpll_mgr.c
index e6cac9225536..a4ca1b4a124c 100644
--- a/drivers/gpu/drm/i915/intel_dpll_mgr.c
+++ b/drivers/gpu/drm/i915/intel_dpll_mgr.c
@@ -191,6 +191,12 @@ void intel_enable_shared_dpll(struct intel_crtc *crtc)
DRM_DEBUG_KMS("enabling %s\n", pll->info->name);
pll->info->funcs->enable(dev_priv, pll);
+
+ intel_encoders_mid_pll_enable(crtc); /* pipe_config, old_state? */
+
+ if (pll->info->funcs->post_enable)
+ pll->info->funcs->post_enable(dev_priv, pll);
+
pll->on = true;
out:
@@ -3199,6 +3205,7 @@ static void icl_dump_hw_state(struct drm_i915_private *dev_priv,
static const struct intel_shared_dpll_funcs icl_pll_funcs = {
.enable = icl_pll_enable,
+ .post_enable = icl_pll_post_enable,
.disable = icl_pll_disable,
.get_hw_state = icl_pll_get_hw_state,
};
diff --git a/drivers/gpu/drm/i915/intel_dpll_mgr.h b/drivers/gpu/drm/i915/intel_dpll_mgr.h
index bf0de8a4dc63..eceeef3b8872 100644
--- a/drivers/gpu/drm/i915/intel_dpll_mgr.h
+++ b/drivers/gpu/drm/i915/intel_dpll_mgr.h
@@ -231,6 +231,16 @@ struct intel_shared_dpll_funcs {
struct intel_shared_dpll *pll);
/**
+ * @post_enable:
+ *
+ * Optional hook to call after encoder specific mid pll hooks have been
+ * called from intel_enable_shared_dpll().
+ */
+ void (*post_enable)(struct drm_i915_private *dev_priv,
+ struct intel_shared_dpll *pll);
+
+
+ /**
* @disable:
*
* Hook for disabling the pll, called from intel_disable_shared_dpll()
--
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2018-10-03 7:55 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-14 6:54 [RFC 0/3] Enable ICL DSI PLL Vandita Kulkarni
2018-09-14 6:54 ` [RFC 1/3] drm/i915/icl: Restructure ICL DPLL enable functionality Vandita Kulkarni
2018-09-14 16:06 ` Ville Syrjälä
2018-09-19 17:31 ` Kulkarni, Vandita
2018-09-26 14:26 ` Ville Syrjälä
2018-10-01 6:38 ` Kulkarni, Vandita
2018-10-03 7:54 ` Jani Nikula [this message]
2018-10-03 8:00 ` Jani Nikula
2018-10-03 11:41 ` Jani Nikula
2018-10-04 2:49 ` Kulkarni, Vandita
2018-10-04 9:01 ` Jani Nikula
2018-09-14 6:54 ` [RFC 2/3] drm/i915/icl: Enable Gen11 DSI PLL Vandita Kulkarni
2018-09-14 6:54 ` [RFC 3/3] drm/i915/icl: Calculate DPLL params for DSI Vandita Kulkarni
2018-09-14 16:09 ` Ville Syrjälä
2018-09-20 8:49 ` Kulkarni, Vandita
2018-09-26 14:21 ` Ville Syrjälä
2018-10-01 11:30 ` Kulkarni, Vandita
2018-10-01 12:29 ` Chauhan, Madhav
2018-09-14 9:32 ` ✗ Fi.CI.BAT: failure for Enable ICL DSI PLL Patchwork
2018-10-03 7:58 ` ✗ Fi.CI.BAT: failure for Enable ICL DSI PLL (rev2) Patchwork
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=87pnwrqxbg.fsf@intel.com \
--to=jani.nikula@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=paulo.r.zanoni@intel.com \
--cc=vandita.kulkarni@intel.com \
--cc=ville.syrjala@linux.intel.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.