All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Reviving the PWM_LPSS patches yet again
@ 2017-05-31  9:27 Shobhit Kumar
  2017-05-31  9:27 ` [PATCH 1/3] drm/i915: Encapsulate the pwm_device in a pwm_info structure Shobhit Kumar
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Shobhit Kumar @ 2017-05-31  9:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: daniel.vetter, viric, jari.tahvanainen

Hi All,
Its been long since I have been sitting on these after I had received Tested-by
for the same by Lluís for atleast the backlight working fine. The related bugs 
are - 

https://bugs.freedesktop.org/show_bug.cgi?id=96571
https://bugs.freedesktop.org/show_bug.cgi?id=90075

Rebased the code on latest code and sending again. Still display was not working
on devices referenced in these bugs but backlight control was tested to be working
at that time. DSI issues of panel display not comming up is tracked separately at -
https://bugs.freedesktop.org/show_bug.cgi?id=96923 and should be again tested with 
latest drm-tip.

Module ordering problem remains still and for testing we should for now enable
LPSS_PWM as in built with i915 as module.

Regards
Shobhit

Shobhit Kumar (3):
  drm/i915: Encapsulate the pwm_device in a pwm_info structure
  pwm: lpss: Add intel-gfx as consumer device in lookup table
  drm/i915: Add support for LPSS PWM on devices that support it

 drivers/gpu/drm/i915/intel_drv.h   |  8 ++++-
 drivers/gpu/drm/i915/intel_panel.c | 61 +++++++++++++++++++++++++++-----------
 drivers/pwm/pwm-lpss-platform.c    | 12 ++++++++
 3 files changed, 62 insertions(+), 19 deletions(-)

-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/3] drm/i915: Encapsulate the pwm_device in a pwm_info structure
  2017-05-31  9:27 [PATCH 0/3] Reviving the PWM_LPSS patches yet again Shobhit Kumar
@ 2017-05-31  9:27 ` Shobhit Kumar
  2017-05-31  9:27 ` [PATCH 2/3] pwm: lpss: Add intel-gfx as consumer device in lookup table Shobhit Kumar
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Shobhit Kumar @ 2017-05-31  9:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: daniel.vetter, viric, jari.tahvanainen

pwm_info helps in encapsulating the PWM period_ns values and will form
basis of adding new pwm devices which can then be genrically used by
initializing proper pwm_info structure in the backlight setup call.

v2: Rebase on latest code. Add BZ details

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_drv.h   |  8 ++++++-
 drivers/gpu/drm/i915/intel_panel.c | 47 +++++++++++++++++++++++---------------
 2 files changed, 36 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index cc13706..17af59c 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -263,6 +263,12 @@ struct intel_encoder {
 	const struct drm_connector *audio_connector;
 };
 
+struct intel_pwm_info {
+	struct pwm_device *dev;
+	unsigned int period_ns;
+	char *name;
+};
+
 struct intel_panel {
 	struct drm_display_mode *fixed_mode;
 	struct drm_display_mode *downclock_mode;
@@ -282,7 +288,7 @@ struct intel_panel {
 		/* PWM chip */
 		bool util_pin_active_low;	/* bxt+ */
 		u8 controller;		/* bxt+ only */
-		struct pwm_device *pwm;
+		struct intel_pwm_info *pwm;
 
 		struct backlight_device *device;
 
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index c8103f8..d56d1c2 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -37,6 +37,13 @@
 
 #define CRC_PMIC_PWM_PERIOD_NS	21333
 
+/* CRC PMIC based PWM Information */
+struct intel_pwm_info crc_pwm_info = {
+	.period_ns = CRC_PMIC_PWM_PERIOD_NS,
+	.name = "pwm_backlight",
+	.dev = NULL,
+};
+
 void
 intel_fixed_panel_mode(const struct drm_display_mode *fixed_mode,
 		       struct drm_display_mode *adjusted_mode)
@@ -536,10 +543,11 @@ static u32 bxt_get_backlight(struct intel_connector *connector)
 static u32 pwm_get_backlight(struct intel_connector *connector)
 {
 	struct intel_panel *panel = &connector->panel;
+	struct intel_pwm_info *pwm = panel->backlight.pwm;
 	int duty_ns;
 
-	duty_ns = pwm_get_duty_cycle(panel->backlight.pwm);
-	return DIV_ROUND_UP(duty_ns * 100, CRC_PMIC_PWM_PERIOD_NS);
+	duty_ns = pwm_get_duty_cycle(pwm->dev);
+	return DIV_ROUND_UP(duty_ns * 100, pwm->period_ns);
 }
 
 static u32 intel_panel_get_backlight(struct intel_connector *connector)
@@ -628,9 +636,10 @@ static void bxt_set_backlight(struct intel_connector *connector, u32 level)
 static void pwm_set_backlight(struct intel_connector *connector, u32 level)
 {
 	struct intel_panel *panel = &connector->panel;
-	int duty_ns = DIV_ROUND_UP(level * CRC_PMIC_PWM_PERIOD_NS, 100);
+	struct intel_pwm_info *pwm = panel->backlight.pwm;
+	int duty_ns = DIV_ROUND_UP(level * pwm->period_ns, 100);
 
-	pwm_config(panel->backlight.pwm, duty_ns, CRC_PMIC_PWM_PERIOD_NS);
+	pwm_config(pwm->dev, duty_ns, pwm->period_ns);
 }
 
 static void
@@ -799,11 +808,12 @@ static void bxt_disable_backlight(struct intel_connector *connector)
 static void pwm_disable_backlight(struct intel_connector *connector)
 {
 	struct intel_panel *panel = &connector->panel;
+	struct intel_pwm_info *pwm = panel->backlight.pwm;
 
 	/* Disable the backlight */
-	pwm_config(panel->backlight.pwm, 0, CRC_PMIC_PWM_PERIOD_NS);
+	pwm_config(pwm->dev, 0, pwm->period_ns);
 	usleep_range(2000, 3000);
-	pwm_disable(panel->backlight.pwm);
+	pwm_disable(pwm->dev);
 }
 
 void intel_panel_disable_backlight(struct intel_connector *connector)
@@ -1090,7 +1100,7 @@ static void pwm_enable_backlight(struct intel_connector *connector)
 {
 	struct intel_panel *panel = &connector->panel;
 
-	pwm_enable(panel->backlight.pwm);
+	pwm_enable(panel->backlight.pwm->dev);
 	intel_panel_actually_set_backlight(connector, panel->backlight.level);
 }
 
@@ -1649,12 +1659,13 @@ static int pwm_setup_backlight(struct intel_connector *connector,
 {
 	struct drm_device *dev = connector->base.dev;
 	struct intel_panel *panel = &connector->panel;
+	struct intel_pwm_info *pwm = &crc_pwm_info;
 	int retval;
 
 	/* Get the PWM chip for backlight control */
-	panel->backlight.pwm = pwm_get(dev->dev, "pwm_backlight");
-	if (IS_ERR(panel->backlight.pwm)) {
-		DRM_ERROR("Failed to own the pwm chip\n");
+	pwm->dev = pwm_get(dev->dev, pwm->name);
+	if (IS_ERR(pwm->dev)) {
+		DRM_ERROR("Failed to own the pwm chip: %s\n", pwm->name);
 		panel->backlight.pwm = NULL;
 		return -ENODEV;
 	}
@@ -1663,13 +1674,12 @@ static int pwm_setup_backlight(struct intel_connector *connector,
 	 * FIXME: pwm_apply_args() should be removed when switching to
 	 * the atomic PWM API.
 	 */
-	pwm_apply_args(panel->backlight.pwm);
+	pwm_apply_args(pwm->dev);
 
-	retval = pwm_config(panel->backlight.pwm, CRC_PMIC_PWM_PERIOD_NS,
-			    CRC_PMIC_PWM_PERIOD_NS);
+	retval = pwm_config(pwm->dev, pwm->period_ns, pwm->period_ns);
 	if (retval < 0) {
-		DRM_ERROR("Failed to configure the pwm chip\n");
-		pwm_put(panel->backlight.pwm);
+		DRM_ERROR("Failed to configure the pwm chip: %s\n", pwm->name);
+		pwm_put(pwm->dev);
 		panel->backlight.pwm = NULL;
 		return retval;
 	}
@@ -1677,10 +1687,11 @@ static int pwm_setup_backlight(struct intel_connector *connector,
 	panel->backlight.min = 0; /* 0% */
 	panel->backlight.max = 100; /* 100% */
 	panel->backlight.level = DIV_ROUND_UP(
-				 pwm_get_duty_cycle(panel->backlight.pwm) * 100,
-				 CRC_PMIC_PWM_PERIOD_NS);
+				 pwm_get_duty_cycle(pwm->dev) * 100, pwm->period_ns);
 	panel->backlight.enabled = panel->backlight.level != 0;
 
+	panel->backlight.pwm = pwm;
+
 	return 0;
 }
 
@@ -1732,7 +1743,7 @@ void intel_panel_destroy_backlight(struct drm_connector *connector)
 
 	/* dispose of the pwm */
 	if (panel->backlight.pwm)
-		pwm_put(panel->backlight.pwm);
+		pwm_put(panel->backlight.pwm->dev);
 
 	panel->backlight.present = false;
 }
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/3] pwm: lpss: Add intel-gfx as consumer device in lookup table
  2017-05-31  9:27 [PATCH 0/3] Reviving the PWM_LPSS patches yet again Shobhit Kumar
  2017-05-31  9:27 ` [PATCH 1/3] drm/i915: Encapsulate the pwm_device in a pwm_info structure Shobhit Kumar
@ 2017-05-31  9:27 ` Shobhit Kumar
  2017-05-31 16:46   ` kbuild test robot
  2017-05-31  9:27 ` [PATCH 3/3] drm/i915: Add support for LPSS PWM on devices that support it Shobhit Kumar
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Shobhit Kumar @ 2017-05-31  9:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: daniel.vetter, viric, jari.tahvanainen

v2: Rebase on latest code and correct the device name in
    lookup table (viric)
    Remove lookup table on driver remove

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/pwm/pwm-lpss-platform.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/pwm/pwm-lpss-platform.c b/drivers/pwm/pwm-lpss-platform.c
index 5d6ed15..f157a6d 100644
--- a/drivers/pwm/pwm-lpss-platform.c
+++ b/drivers/pwm/pwm-lpss-platform.c
@@ -40,6 +40,11 @@ static const struct pwm_lpss_boardinfo pwm_lpss_bxt_info = {
 	.bypass = true,
 };
 
+/* PWM consumed by the Intel GFX */
+static struct pwm_lookup lpss_pwm_lookup[] = {
+	PWM_LOOKUP("80860F09:00", 0, "0000:00:02.0", "pwm_lpss", 0, PWM_POLARITY_NORMAL),
+};
+
 static int pwm_lpss_probe_platform(struct platform_device *pdev)
 {
 	const struct pwm_lpss_boardinfo *info;
@@ -60,6 +65,9 @@ static int pwm_lpss_probe_platform(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, lpwm);
 
+	/* Register intel-gfx device as allowed consumer */
+	pwm_add_table(lpss_pwm_lookup, ARRAY_SIZE(lpss_pwm_lookup));
+
 	pm_runtime_set_active(&pdev->dev);
 	pm_runtime_enable(&pdev->dev);
 
@@ -71,6 +79,10 @@ static int pwm_lpss_remove_platform(struct platform_device *pdev)
 	struct pwm_lpss_chip *lpwm = platform_get_drvdata(pdev);
 
 	pm_runtime_disable(&pdev->dev);
+
+	/* remove lookup table */
+	pwm_remove_table(lpss_pwm_lookup, ARRAY_SIZE(lpss_pwm_lookup));
+
 	return pwm_lpss_remove(lpwm);
 }
 
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/3] drm/i915: Add support for LPSS PWM on devices that support it
  2017-05-31  9:27 [PATCH 0/3] Reviving the PWM_LPSS patches yet again Shobhit Kumar
  2017-05-31  9:27 ` [PATCH 1/3] drm/i915: Encapsulate the pwm_device in a pwm_info structure Shobhit Kumar
  2017-05-31  9:27 ` [PATCH 2/3] pwm: lpss: Add intel-gfx as consumer device in lookup table Shobhit Kumar
@ 2017-05-31  9:27 ` Shobhit Kumar
  2017-05-31 10:21 ` ✓ Fi.CI.BAT: success for Reviving the PWM_LPSS patches yet again Patchwork
  2017-06-15  6:11 ` [PATCH 0/3] " Kumar, Shobhit
  4 siblings, 0 replies; 9+ messages in thread
From: Shobhit Kumar @ 2017-05-31  9:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: daniel.vetter, viric, jari.tahvanainen

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 --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)) {
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* ✓ Fi.CI.BAT: success for Reviving the PWM_LPSS patches yet again
  2017-05-31  9:27 [PATCH 0/3] Reviving the PWM_LPSS patches yet again Shobhit Kumar
                   ` (2 preceding siblings ...)
  2017-05-31  9:27 ` [PATCH 3/3] drm/i915: Add support for LPSS PWM on devices that support it Shobhit Kumar
@ 2017-05-31 10:21 ` Patchwork
  2017-06-15  6:11 ` [PATCH 0/3] " Kumar, Shobhit
  4 siblings, 0 replies; 9+ messages in thread
From: Patchwork @ 2017-05-31 10:21 UTC (permalink / raw)
  To: Shobhit Kumar; +Cc: intel-gfx

== Series Details ==

Series: Reviving the PWM_LPSS patches yet again
URL   : https://patchwork.freedesktop.org/series/25090/
State : success

== Summary ==

Series 25090v1 Reviving the PWM_LPSS patches yet again
https://patchwork.freedesktop.org/api/1.0/series/25090/revisions/1/mbox/

Test gem_exec_flush:
        Subgroup basic-batch-kernel-default-uc:
                fail       -> PASS       (fi-snb-2600) fdo#100007

fdo#100007 https://bugs.freedesktop.org/show_bug.cgi?id=100007

fi-bdw-5557u     total:278  pass:267  dwarn:0   dfail:0   fail:0   skip:11  time:444s
fi-bdw-gvtdvm    total:278  pass:256  dwarn:8   dfail:0   fail:0   skip:14  time:438s
fi-bsw-n3050     total:278  pass:242  dwarn:0   dfail:0   fail:0   skip:36  time:584s
fi-bxt-j4205     total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  time:515s
fi-byt-j1900     total:278  pass:254  dwarn:0   dfail:0   fail:0   skip:24  time:489s
fi-byt-n2820     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time:487s
fi-hsw-4770      total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time:429s
fi-hsw-4770r     total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time:410s
fi-ilk-650       total:278  pass:228  dwarn:0   dfail:0   fail:0   skip:50  time:417s
fi-ivb-3520m     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:496s
fi-ivb-3770      total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:461s
fi-kbl-7500u     total:278  pass:255  dwarn:5   dfail:0   fail:0   skip:18  time:463s
fi-kbl-7560u     total:278  pass:263  dwarn:5   dfail:0   fail:0   skip:10  time:570s
fi-skl-6260u     total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:460s
fi-skl-6700hq    total:278  pass:239  dwarn:0   dfail:1   fail:17  skip:21  time:426s
fi-skl-6700k     total:278  pass:256  dwarn:4   dfail:0   fail:0   skip:18  time:462s
fi-skl-6770hq    total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:498s
fi-skl-gvtdvm    total:278  pass:265  dwarn:0   dfail:0   fail:0   skip:13  time:441s
fi-snb-2520m     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time:532s
fi-snb-2600      total:278  pass:249  dwarn:0   dfail:0   fail:0   skip:29  time:401s

4aa1d46d3b24bbe545cdf7cbd407c18f5cd5e43d drm-tip: 2017y-05m-31d-08h-58m-36s UTC integration manifest
64799fa drm/i915: Add support for LPSS PWM on devices that support it
ca89437 pwm: lpss: Add intel-gfx as consumer device in lookup table
20ba8a2 drm/i915: Encapsulate the pwm_device in a pwm_info structure

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4840/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/3] pwm: lpss: Add intel-gfx as consumer device in lookup table
  2017-05-31  9:27 ` [PATCH 2/3] pwm: lpss: Add intel-gfx as consumer device in lookup table Shobhit Kumar
@ 2017-05-31 16:46   ` kbuild test robot
  2017-06-01 11:04     ` Kumar, Shobhit
  0 siblings, 1 reply; 9+ messages in thread
From: kbuild test robot @ 2017-05-31 16:46 UTC (permalink / raw)
  To: Shobhit Kumar
  Cc: daniel.vetter, intel-gfx, viric, kbuild-all, jari.tahvanainen

[-- Attachment #1: Type: text/plain, Size: 958 bytes --]

Hi Shobhit,

[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on v4.12-rc3 next-20170531]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Shobhit-Kumar/drm-i915-Encapsulate-the-pwm_device-in-a-pwm_info-structure/20170531-222631
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: x86_64-randconfig-i0-201722 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

>> ERROR: "pwm_add_table" [drivers/pwm/pwm-lpss-platform.ko] undefined!
>> ERROR: "pwm_remove_table" [drivers/pwm/pwm-lpss-platform.ko] undefined!

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 26534 bytes --]

[-- Attachment #3: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/3] pwm: lpss: Add intel-gfx as consumer device in lookup table
  2017-05-31 16:46   ` kbuild test robot
@ 2017-06-01 11:04     ` Kumar, Shobhit
  0 siblings, 0 replies; 9+ messages in thread
From: Kumar, Shobhit @ 2017-06-01 11:04 UTC (permalink / raw)
  To: kbuild test robot, Shobhit Kumar
  Cc: daniel.vetter, intel-gfx, viric, kbuild-all, jari.tahvanainen

On Wednesday 31 May 2017 10:16 PM, kbuild test robot wrote:
> Hi Shobhit,
> 
> [auto build test ERROR on drm-intel/for-linux-next]
> [also build test ERROR on v4.12-rc3 next-20170531]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

Guess this needs to be built with CONFIG_PWM_LPSS_PLATFORM=y. Else I 
would have to send a patch to do EXPORT_SYMBOL_GPL for missing symbols. 
But then all the drivers that depend on this one are actually in-built.

Any suggestions ?

Regards
Shobhit

> 
> url:    https://github.com/0day-ci/linux/commits/Shobhit-Kumar/drm-i915-Encapsulate-the-pwm_device-in-a-pwm_info-structure/20170531-222631
> base:   git://anongit.freedesktop.org/drm-intel for-linux-next
> config: x86_64-randconfig-i0-201722 (attached as .config)
> compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
> reproduce:
>          # save the attached .config to linux build tree
>          make ARCH=x86_64
> 
> All errors (new ones prefixed by >>):
> 
>>> ERROR: "pwm_add_table" [drivers/pwm/pwm-lpss-platform.ko] undefined!
>>> ERROR: "pwm_remove_table" [drivers/pwm/pwm-lpss-platform.ko] undefined!
> 
> ---
> 0-DAY kernel test infrastructure                Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
> 
> 
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/3] Reviving the PWM_LPSS patches yet again
  2017-05-31  9:27 [PATCH 0/3] Reviving the PWM_LPSS patches yet again Shobhit Kumar
                   ` (3 preceding siblings ...)
  2017-05-31 10:21 ` ✓ Fi.CI.BAT: success for Reviving the PWM_LPSS patches yet again Patchwork
@ 2017-06-15  6:11 ` Kumar, Shobhit
  4 siblings, 0 replies; 9+ messages in thread
From: Kumar, Shobhit @ 2017-06-15  6:11 UTC (permalink / raw)
  To: Jani Nikula; +Cc: daniel.vetter, intel-gfx, viric, jari.tahvanainen

Hi Jani,

On Wednesday 31 May 2017 02:57 PM, Shobhit Kumar wrote:
> Hi All,
> Its been long since I have been sitting on these after I had received Tested-by
> for the same by Lluís for atleast the backlight working fine. The related bugs

Can you have a look at these patches.

Regards
Shobhit

> are -
> 
> https://bugs.freedesktop.org/show_bug.cgi?id=96571
> https://bugs.freedesktop.org/show_bug.cgi?id=90075
> 
> Rebased the code on latest code and sending again. Still display was not working
> on devices referenced in these bugs but backlight control was tested to be working
> at that time. DSI issues of panel display not comming up is tracked separately at -
> https://bugs.freedesktop.org/show_bug.cgi?id=96923 and should be again tested with
> latest drm-tip.
> 
> Module ordering problem remains still and for testing we should for now enable
> LPSS_PWM as in built with i915 as module.
> 
> Regards
> Shobhit
> 
> Shobhit Kumar (3):
>    drm/i915: Encapsulate the pwm_device in a pwm_info structure
>    pwm: lpss: Add intel-gfx as consumer device in lookup table
>    drm/i915: Add support for LPSS PWM on devices that support it
> 
>   drivers/gpu/drm/i915/intel_drv.h   |  8 ++++-
>   drivers/gpu/drm/i915/intel_panel.c | 61 +++++++++++++++++++++++++++-----------
>   drivers/pwm/pwm-lpss-platform.c    | 12 ++++++++
>   3 files changed, 62 insertions(+), 19 deletions(-)
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/3] drm/i915: Encapsulate the pwm_device in a pwm_info structure
  2016-01-12 15:00 [PATCH 0/3] LPSS PWM support for devices that support it Shobhit Kumar
@ 2016-01-12 15:00 ` Shobhit Kumar
  0 siblings, 0 replies; 9+ messages in thread
From: Shobhit Kumar @ 2016-01-12 15:00 UTC (permalink / raw)
  To: intel-gfx

pwm_info helps in encapsulating the PWM period_ns values and will form
basis of adding new pwm devices which can then be genrically used by
initializing proper pwm_info structure in the backlight setup call.

Cc: cbrookes@gmail.com
Cc: jani.nikula@linux.intel.com
Signed-off-by: Shobhit Kumar <shobhit.kumar@intel.com>
---
 drivers/gpu/drm/i915/intel_drv.h   |  8 ++++++-
 drivers/gpu/drm/i915/intel_panel.c | 45 ++++++++++++++++++++++++--------------
 2 files changed, 35 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index bdfe403..6f96769 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -161,6 +161,12 @@ struct intel_encoder {
 	enum hpd_pin hpd_pin;
 };
 
+struct intel_pwm_info {
+	struct pwm_device *dev;
+	unsigned int period_ns;
+	char *name;
+};
+
 struct intel_panel {
 	struct drm_display_mode *fixed_mode;
 	struct drm_display_mode *downclock_mode;
@@ -179,7 +185,7 @@ struct intel_panel {
 		/* PWM chip */
 		bool util_pin_active_low;	/* bxt+ */
 		u8 controller;		/* bxt+ only */
-		struct pwm_device *pwm;
+		struct intel_pwm_info *pwm;
 
 		struct backlight_device *device;
 
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index 21ee647..9e24c59 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -37,6 +37,13 @@
 
 #define CRC_PMIC_PWM_PERIOD_NS	21333
 
+/* CRC PMIC based PWM Information */
+struct intel_pwm_info crc_pwm_info = {
+	.period_ns = CRC_PMIC_PWM_PERIOD_NS,
+	.name = "pwm_backlight",
+	.dev = NULL,
+};
+
 void
 intel_fixed_panel_mode(const struct drm_display_mode *fixed_mode,
 		       struct drm_display_mode *adjusted_mode)
@@ -538,10 +545,11 @@ static u32 bxt_get_backlight(struct intel_connector *connector)
 static u32 pwm_get_backlight(struct intel_connector *connector)
 {
 	struct intel_panel *panel = &connector->panel;
+	struct intel_pwm_info *pwm = panel->backlight.pwm;
 	int duty_ns;
 
-	duty_ns = pwm_get_duty_cycle(panel->backlight.pwm);
-	return DIV_ROUND_UP(duty_ns * 100, CRC_PMIC_PWM_PERIOD_NS);
+	duty_ns = pwm_get_duty_cycle(pwm->dev);
+	return DIV_ROUND_UP(duty_ns * 100, pwm->period_ns);
 }
 
 static u32 intel_panel_get_backlight(struct intel_connector *connector)
@@ -630,9 +638,10 @@ static void bxt_set_backlight(struct intel_connector *connector, u32 level)
 static void pwm_set_backlight(struct intel_connector *connector, u32 level)
 {
 	struct intel_panel *panel = &connector->panel;
-	int duty_ns = DIV_ROUND_UP(level * CRC_PMIC_PWM_PERIOD_NS, 100);
+	struct intel_pwm_info *pwm = panel->backlight.pwm;
+	int duty_ns = DIV_ROUND_UP(level * pwm->period_ns, 100);
 
-	pwm_config(panel->backlight.pwm, duty_ns, CRC_PMIC_PWM_PERIOD_NS);
+	pwm_config(pwm->dev, duty_ns, pwm->period_ns);
 }
 
 static void
@@ -801,11 +810,12 @@ static void bxt_disable_backlight(struct intel_connector *connector)
 static void pwm_disable_backlight(struct intel_connector *connector)
 {
 	struct intel_panel *panel = &connector->panel;
+	struct intel_pwm_info *pwm = panel->backlight.pwm;
 
 	/* Disable the backlight */
-	pwm_config(panel->backlight.pwm, 0, CRC_PMIC_PWM_PERIOD_NS);
+	pwm_config(pwm->dev, 0, pwm->period_ns);
 	usleep_range(2000, 3000);
-	pwm_disable(panel->backlight.pwm);
+	pwm_disable(pwm->dev);
 }
 
 void intel_panel_disable_backlight(struct intel_connector *connector)
@@ -1069,7 +1079,7 @@ static void pwm_enable_backlight(struct intel_connector *connector)
 {
 	struct intel_panel *panel = &connector->panel;
 
-	pwm_enable(panel->backlight.pwm);
+	pwm_enable(panel->backlight.pwm->dev);
 	intel_panel_actually_set_backlight(connector, panel->backlight.level);
 }
 
@@ -1630,21 +1640,21 @@ static int pwm_setup_backlight(struct intel_connector *connector,
 {
 	struct drm_device *dev = connector->base.dev;
 	struct intel_panel *panel = &connector->panel;
+	struct intel_pwm_info *pwm = &crc_pwm_info;
 	int retval;
 
 	/* Get the PWM chip for backlight control */
-	panel->backlight.pwm = pwm_get(dev->dev, "pwm_backlight");
-	if (IS_ERR(panel->backlight.pwm)) {
-		DRM_ERROR("Failed to own the pwm chip\n");
+	pwm->dev = pwm_get(dev->dev, pwm->name);
+	if (IS_ERR(pwm->dev)) {
+		DRM_ERROR("Failed to own the pwm chip: %s\n", pwm->name);
 		panel->backlight.pwm = NULL;
 		return -ENODEV;
 	}
 
-	retval = pwm_config(panel->backlight.pwm, CRC_PMIC_PWM_PERIOD_NS,
-			    CRC_PMIC_PWM_PERIOD_NS);
+	retval = pwm_config(pwm->dev, pwm->period_ns, pwm->period_ns);
 	if (retval < 0) {
-		DRM_ERROR("Failed to configure the pwm chip\n");
-		pwm_put(panel->backlight.pwm);
+		DRM_ERROR("Failed to configure the pwm chip: %s\n", pwm->name);
+		pwm_put(pwm->dev);
 		panel->backlight.pwm = NULL;
 		return retval;
 	}
@@ -1652,10 +1662,11 @@ static int pwm_setup_backlight(struct intel_connector *connector,
 	panel->backlight.min = 0; /* 0% */
 	panel->backlight.max = 100; /* 100% */
 	panel->backlight.level = DIV_ROUND_UP(
-				 pwm_get_duty_cycle(panel->backlight.pwm) * 100,
-				 CRC_PMIC_PWM_PERIOD_NS);
+				 pwm_get_duty_cycle(pwm->dev) * 100, pwm->period_ns);
 	panel->backlight.enabled = panel->backlight.level != 0;
 
+	panel->backlight.pwm = pwm;
+
 	return 0;
 }
 
@@ -1707,7 +1718,7 @@ void intel_panel_destroy_backlight(struct drm_connector *connector)
 
 	/* dispose of the pwm */
 	if (panel->backlight.pwm)
-		pwm_put(panel->backlight.pwm);
+		pwm_put(panel->backlight.pwm->dev);
 
 	panel->backlight.present = false;
 }
-- 
2.4.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-06-15  6:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-31  9:27 [PATCH 0/3] Reviving the PWM_LPSS patches yet again Shobhit Kumar
2017-05-31  9:27 ` [PATCH 1/3] drm/i915: Encapsulate the pwm_device in a pwm_info structure Shobhit Kumar
2017-05-31  9:27 ` [PATCH 2/3] pwm: lpss: Add intel-gfx as consumer device in lookup table Shobhit Kumar
2017-05-31 16:46   ` kbuild test robot
2017-06-01 11:04     ` Kumar, Shobhit
2017-05-31  9:27 ` [PATCH 3/3] drm/i915: Add support for LPSS PWM on devices that support it Shobhit Kumar
2017-05-31 10:21 ` ✓ Fi.CI.BAT: success for Reviving the PWM_LPSS patches yet again Patchwork
2017-06-15  6:11 ` [PATCH 0/3] " Kumar, Shobhit
  -- strict thread matches above, loose matches on Subject: below --
2016-01-12 15:00 [PATCH 0/3] LPSS PWM support for devices that support it Shobhit Kumar
2016-01-12 15:00 ` [PATCH 1/3] drm/i915: Encapsulate the pwm_device in a pwm_info structure Shobhit Kumar

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.