Skip to contentSkip to conversation

LPSS PWM support for devices that support it

PATCH New Shobhit Kumar 3 participants 6 messages Jan 12, 2016

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover LPSS PWM support for devices that support it

Hi,
This is an untested attempt to enable LPSS PWM in the driver. As part of this did some restructuring for encapsulating the pwm_info inside the panel->backlight itself. This makes enabling LPSS PWM clean and simple.

Not sending yet to pwm mailing list as this is all untested. C.B. please test the patches and see if they work at all for you. For testing Please enable -

CONFIG_PWM_LPSS=y
CONFIG_PWM_LPSS_PLATFORM=y

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 | 59 +++++++++++++++++++++++++++-----------
 drivers/pwm/pwm-lpss-platform.c    |  8 ++++++
 3 files changed, 57 insertions(+), 18 deletions(-)
Signature · 6 lines
2.4.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 1/3 drm/i915: Encapsulate the pwm_device in a pwm_info structure

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.

---
 drivers/gpu/drm/i915/intel_drv.h   |  8 ++++++-
 drivers/gpu/drm/i915/intel_panel.c | 45 ++++++++++++++++++++++++--------------
 2 files changed, 35 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/intel_drv.h +7 -1
index bdfe403..6f96769 100644
@@ -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;
 
drivers/gpu/drm/i915/intel_panel.c +28 -17

109 lines not on this page · raw message

Signature · 6 lines
2.4.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

PATCH 2/3 pwm: lpss: Add intel-gfx as consumer device in lookup table

In reply to Shobhit Kumar
---
 drivers/pwm/pwm-lpss-platform.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/pwm/pwm-lpss-platform.c +8 -0
index 54433fc..910bc14 100644
@@ -18,6 +18,11 @@
 
 #include "pwm-lpss.h"
 
+/* PWM consumed by the Intel GFX */
+static struct pwm_lookup lpss_pwm_lookup[] = {
+	PWM_LOOKUP("pwm-lpss", 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;
@@ -38,6 +43,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);
 
Signature · 6 lines
2.4.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

Re: [PATCH 2/3] pwm: lpss: Add intel-gfx as consumer device in lookup table

reproduce:

Hi Shobhit,

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

url:    https://github.com/0day-ci/linux/commits/Shobhit-Kumar/LPSS-PWM-support-for-devices-that-support-it/20160112-230336
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: x86_64-randconfig-s3-01122324 (attached as .config)
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!

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

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

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

In reply to Shobhit Kumar
---
 drivers/gpu/drm/i915/intel_panel.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_panel.c +15 -1
index 9e24c59..16473fa 100644
@@ -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)
@@ -1639,10 +1647,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)) {
Signature · 6 lines
2.4.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw

✓ success: Fi.CI.BAT

In reply to Shobhit Kumar
== Summary ==

== Summary ==

Built on 37f6c2ae666fbba9eff4355115252b8b0fd43050 drm-intel-nightly: 2016y-01m-12d-14h-25m-44s UTC integration manifest

Test gem_storedw_loop:

        Subgroup basic-render:
                dmesg-warn -> PASS       (bdw-nuci7)
Test kms_pipe_crc_basic:
        Subgroup read-crc-pipe-a-frame-sequence:
                dmesg-warn -> PASS       (byt-nuc)
        Subgroup read-crc-pipe-c:
                dmesg-warn -> PASS       (bdw-ultra)
bdw-nuci7        total:138  pass:129  dwarn:0   dfail:0   fail:0   skip:9  
bdw-ultra        total:138  pass:132  dwarn:0   dfail:0   fail:0   skip:6  
bsw-nuc-2        total:141  pass:115  dwarn:2   dfail:0   fail:0   skip:24 
byt-nuc          total:141  pass:123  dwarn:3   dfail:0   fail:0   skip:15 
hsw-brixbox      total:141  pass:134  dwarn:0   dfail:0   fail:0   skip:7  
hsw-gt2          total:141  pass:137  dwarn:0   dfail:0   fail:0   skip:4  
ilk-hp8440p      total:141  pass:101  dwarn:3   dfail:0   fail:0   skip:37 
ivb-t430s        total:135  pass:122  dwarn:3   dfail:4   fail:0   skip:6  
skl-i5k-2        total:141  pass:108  dwarn:25  dfail:0   fail:0   skip:8  
skl-i7k-2        total:141  pass:107  dwarn:26  dfail:0   fail:0   skip:8  
snb-dellxps      total:141  pass:122  dwarn:5   dfail:0   fail:0   skip:14 
snb-x220t        total:141  pass:122  dwarn:5   dfail:0   fail:1   skip:13 

Results at /archive/results/CI_IGT_test/Patchwork_1150/

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx