diff mbox

[3/3] drm/i915: Add support for LPSS PWM on devices that support it

Message ID 1496222871-12996-4-git-send-email-shobhit.kumar@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kumar, Shobhit May 31, 2017, 9:27 a.m. UTC
v2: Add bugzilla links

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96571
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90075
Cc: cbrookes@gmail.com
Cc: jani.nikula@linux.intel.com
Tested-by: LluĂ­s Batlle i Rossell <viric@viric.name>
Signed-off-by: Shobhit Kumar <shobhit.kumar@intel.com>
---
 drivers/gpu/drm/i915/intel_panel.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index d56d1c2..4d84c561 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -36,6 +36,7 @@ 
 #include "intel_drv.h"
 
 #define CRC_PMIC_PWM_PERIOD_NS	21333
+#define LPSS_PWM_PERIOD_NS	10240
 
 /* CRC PMIC based PWM Information */
 struct intel_pwm_info crc_pwm_info = {
@@ -44,6 +45,13 @@  struct intel_pwm_info crc_pwm_info = {
 	.dev = NULL,
 };
 
+/* LPSS based PWM Information */
+struct intel_pwm_info lpss_pwm_info = {
+	.period_ns = LPSS_PWM_PERIOD_NS,
+	.name = "pwm_lpss",
+	.dev = NULL,
+};
+
 void
 intel_fixed_panel_mode(const struct drm_display_mode *fixed_mode,
 		       struct drm_display_mode *adjusted_mode)
@@ -1658,10 +1666,16 @@  static int pwm_setup_backlight(struct intel_connector *connector,
 			       enum pipe pipe)
 {
 	struct drm_device *dev = connector->base.dev;
+	struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
 	struct intel_panel *panel = &connector->panel;
-	struct intel_pwm_info *pwm = &crc_pwm_info;
+	struct intel_pwm_info *pwm;
 	int retval;
 
+	if (dev_priv->vbt.dsi.config->pwm_blc == PPS_BLC_PMIC)
+		pwm = &crc_pwm_info;
+	else /* PPS_BLC_SOC */
+		pwm = &lpss_pwm_info;
+
 	/* Get the PWM chip for backlight control */
 	pwm->dev = pwm_get(dev->dev, pwm->name);
 	if (IS_ERR(pwm->dev)) {