mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-14 02:27:44 +00:00
drm/i915: panel: Add get_vbt_pwm_freq() helper
Factor the code which checks and drm_dbg_kms-s the VBT PWM frequency out of get_backlight_max_vbt(). This is a preparation patch for honering the VBT PWM frequency for devices which use an external PWM controller (devices using pwm_setup_backlight()). Acked-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200903112337.4113-15-hdegoede@redhat.com
This commit is contained in:
parent
c86b155da7
commit
27a79cbc17
1 changed files with 17 additions and 10 deletions
|
@ -1543,18 +1543,9 @@ static u32 vlv_hz_to_pwm(struct intel_connector *connector, u32 pwm_freq_hz)
|
|||
return DIV_ROUND_CLOSEST(clock, pwm_freq_hz * mul);
|
||||
}
|
||||
|
||||
static u32 get_backlight_max_vbt(struct intel_connector *connector)
|
||||
static u16 get_vbt_pwm_freq(struct drm_i915_private *dev_priv)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
|
||||
struct intel_panel *panel = &connector->panel;
|
||||
u16 pwm_freq_hz = dev_priv->vbt.backlight.pwm_freq_hz;
|
||||
u32 pwm;
|
||||
|
||||
if (!panel->backlight.hz_to_pwm) {
|
||||
drm_dbg_kms(&dev_priv->drm,
|
||||
"backlight frequency conversion not supported\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (pwm_freq_hz) {
|
||||
drm_dbg_kms(&dev_priv->drm,
|
||||
|
@ -1567,6 +1558,22 @@ static u32 get_backlight_max_vbt(struct intel_connector *connector)
|
|||
pwm_freq_hz);
|
||||
}
|
||||
|
||||
return pwm_freq_hz;
|
||||
}
|
||||
|
||||
static u32 get_backlight_max_vbt(struct intel_connector *connector)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
|
||||
struct intel_panel *panel = &connector->panel;
|
||||
u16 pwm_freq_hz = get_vbt_pwm_freq(dev_priv);
|
||||
u32 pwm;
|
||||
|
||||
if (!panel->backlight.hz_to_pwm) {
|
||||
drm_dbg_kms(&dev_priv->drm,
|
||||
"backlight frequency conversion not supported\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
pwm = panel->backlight.hz_to_pwm(connector, pwm_freq_hz);
|
||||
if (!pwm) {
|
||||
drm_dbg_kms(&dev_priv->drm,
|
||||
|
|
Loading…
Add table
Reference in a new issue