Enable lspcon support for GEN9 devices
Subsystems (3)
v5 cover Enable lspcon support for GEN9 devices
LSPCON is essentially a dp++->hdmi adapter with dual mode of operation.
These modes are:
- Level Shifter mode: In LS mode, this device works as a type2 dp->hdmi passive dongle, which steps up DP++ output to appropriate HDMI 1.4 signal. This mode doesn't do any conversion at the protocol level.
- Protocol Converter mode: In PCON mode, this device acts as an active DP++->HDMI 2.0 dongle, which converts the DP++ output to compatible HDMI 2.0 output. In PCON mode, lspcon can support 4k@60 outputs, using DP HBR2 mode.
Many of Intel GEN9 devices come with in-built lspcon card in motherboartd down mode. This patch series adds support for lspcon devices in I915 driver.
While unit-testing this code, I was able to see a 4k@60 modeset with:
- BXT-T board
- Single HDMI 4k@60 display (ACER S)
- Ubuntu 14.04 desktop
V2: Worked on review comments from Ville
- In general, Ville suggested not to use the dual personality of DDI to drive lspcon, so this patch set drives it just as DP++ display. There is no separate detection for lspcon (hpd_pulse is good enough), and its being driven as a DP display with special initialization and EDID read sequence. To be able to do this, we driving lspcon in PCON mode only, where it can serve both HDMI1.3/HDMI1.4 sinks as well as 4k@60 capable HDMI 2.0 sinks. So compared to previous series, there is one patch less, as we have dropped lspcon detection patch.
V3: Addressed review comments from Rodrigo
Details available with respective patch.
V4: Addressed review comments from Ville
Details available with respective patch.
V5: Rebase, added a new patch for suspend/resume
Shashank Sharma (5):
drm: Helper for lspcon in drm_dp_dual_mode
drm/i915: Add lspcon support for I915 driver
drm/i915: Parse VBT data for lspcon
drm/i915: Enable lspcon initialization
drm/i915: Add lspcon resume function
drivers/gpu/drm/drm_dp_dual_mode_helper.c | 103 +++++++++++++++++++ drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/i915_drv.c | 2 + drivers/gpu/drm/i915/i915_drv.h | 5 + drivers/gpu/drm/i915/intel_bios.c | 49 +++++++++ drivers/gpu/drm/i915/intel_ddi.c | 29 +++++- drivers/gpu/drm/i915/intel_drv.h | 10 ++ drivers/gpu/drm/i915/intel_lspcon.c | 165 ++++++++++++++++++++++++++++++ include/drm/drm_dp_dual_mode_helper.h | 26 +++++ 9 files changed, 389 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/i915/intel_lspcon.c
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v5 1/5 drm: Helper for lspcon in drm_dp_dual_mode
This patch adds lspcon support in dp_dual_mode helper. lspcon is essentially a dp->hdmi dongle with dual personality.
LS mode: It works as a passive dongle, by level shifting DP++ signals to HDMI signals, in LS mode.
PCON mode: It works as a protocol converter active dongle in pcon mode, by converting DP++ outputs to HDMI 2.0 outputs.
This patch adds support for lspcon detection and mode set switch operations, as a dp dual mode dongle.
v2: Addressed review comments from Ville
- add adaptor id for lspcon devices (0x08), use it to identify lspcon
- change function names
old: drm_lspcon_get_current_mode/drm_lspcon_change_mode
new: drm_lspcon_get_mode/drm_lspcon_set_mode
- change drm_lspcon_get_mode type to int, to match drm_dp_dual_mode_get_tmds_output
- change 'err' to 'ret' to match the rest of the functions
- remove pointless typecasting during call to dual_mode_read
- fix the but while setting value of data, while writing lspcon mode
- fix indentation
- change mdelay(10) -> msleep(10)
- return ETIMEDOUT instead of EFAULT, when lspcon mode change times out
- Add an empty line to separate std regs macros and lspcon regs macros Indent bit definition
v3: Addressed review comments from Rodrigo
- change macro name from DP_DUAL_MODE_TYPE_LSPCON to DP_DUAL_MODE_TYPE_HAS_DPCD for better readability
- change macro name from DP_DUAL_MODE_LSPCON_MODE_PCON to DP_DUAL_MODE_LSPCON_MODE_PCON for better readability
- add comment for MCA specific offsets like 0x40 and 0x41
- remove DP_DUAL_MODE_REV_TYPE2 check while checking lspcon adapter id
v4: Addressed review comments from Ville
- Fixed indentation at few places
- s/current_mode/mode
- s/reqd_mode/mode
- remove unnecessary void* cast
- remove drm_edid.h from includes
- Add a comment for _HAS_DPCD
- Fix enum description, for lspcon_mode.
v5: Rebase
--- drivers/gpu/drm/drm_dp_dual_mode_helper.c | 103 ++++++++++++++++++++++++++++++ include/drm/drm_dp_dual_mode_helper.h | 26 ++++++++ 2 files changed, 129 insertions(+)
drivers/gpu/drm/drm_dp_dual_mode_helper.c +103 -0
@@ -148,6 +148,14 @@ static bool is_type2_adaptor(uint8_t adaptor_id) DP_DUAL_MODE_REV_TYPE2); } +bool is_lspcon_adaptor (const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN ], +const uint8_t adaptor_id) +{ +return is_hdmi_adaptor (hdmi_id) && + (adaptor_id == (DP_DUAL_MODE_TYPE_TYPE2 | +DP_DUAL_MODE_TYPE_HAS_DPCD )); +} +/** * drm_dp_dual_mode_detect - Identify the DP dual mode adaptor * @adapter: I2C adapter for the DDC bus
@@ -203,6 +211,8 @@ enum drm_dp_dual_mode_type drm_dp_dual_mode_detect(struct i2c_adapter *adapter) ret =drm_dp_dual_mode_read (adapter,DP_DUAL_MODE_ADAPTOR_ID , &adaptor_id,sizeof (adaptor_id));if (ret ==0 ) { +if (is_lspcon_adaptor (hdmi_id, adaptor_id)) +return DRM_DP_DUAL_MODE_LSPCON ;if (is_type2_adaptor (adaptor_id)) {if (is_hdmi_adaptor (hdmi_id))return DRM_DP_DUAL_MODE_TYPE2_HDMI ;
@@ -364,3 +374,96 @@ const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type) } }EXPORT_SYMBOL (drm_dp_get_dual_mode_type_name); + +/** +* drm_lspcon_get_mode: Get LSPCON's current mode of operation by +* by reading offset (0x80, 0x41) +* @i2c_adapter: I2C-over-aux adapter +* @current_mode: out vaiable, current lspcon mode of operation +* +* Returns: +* 0 on success, sets the current_mode value to appropriate mode +* -error on failure +*/ +int drm_lspcon_get_mode (struct i2c_adapter *adapter, +enum drm_lspcon_mode *mode) +{ +u8 data; +int ret =0 ; + +if (!mode) { +DRM_ERROR ("NULL input\n" ); +return -EINVAL ; + } + +/* Read Status: i2c over aux */ + ret =drm_dp_dual_mode_read (adapter,DP_DUAL_MODE_LSPCON_CURRENT_MODE , + &data,sizeof (data)); +if (ret <0 ) { +DRM_ERROR ("LSPCON read(0x80, 0x41) failed\n" ); +return -EFAULT ; + } + +if (data &DP_DUAL_MODE_LSPCON_MODE_PCON ) + *mode =DRM_LSPCON_MODE_PCON ; +else + *mode =DRM_LSPCON_MODE_LS ; +return 0 ; +} +EXPORT_SYMBOL (drm_lspcon_get_mode); + +/** +* drm_lspcon_change_mode: Change LSPCON's mode of operation by +* by writing offset (0x80, 0x40) +* @i2c_adapter: I2C-over-aux adapter +* @reqd_mode: required mode of operation +* +* Returns: +* 0 on success, -error on failure/timeout +*/ +int drm_lspcon_set_mode (struct i2c_adapter *adapter, +enum drm_lspcon_mode mode) +{ +u8 data =0 ; +int ret; +int time_out =200 ; +enum drm_lspcon_mode current_mode; + +if (mode ==DRM_LSPCON_MODE_PCON ) + data =DP_DUAL_MODE_LSPCON_MODE_PCON ; + +/* Change mode */ + ret =drm_dp_dual_mode_write (adapter,DP_DUAL_MODE_LSPCON_MODE_CHANGE , + &data,sizeof (data)); +if (ret <0 ) { +DRM_ERROR ("LSPCON mode change failed\n" ); +return ret; + } + +/* +* Confirm mode change by reading the status bit. +* Sometimes, it takes a while to change the mode, +* so wait and retry until time out or done. +*/ +do { + ret =drm_lspcon_get_mode (adapter, ¤t_mode); +if (ret) { +DRM_ERROR ("can't confirm LSPCON mode change\n" ); +return ret; + }else { +if (current_mode != mode) { +msleep (10 ); + time_out -=10 ; + }else { +DRM_DEBUG_KMS ("LSPCON mode changed to %s\n" , + mode ==DRM_LSPCON_MODE_LS ? +"LS" :"PCON" ); +return 0 ; + } + } + }while (time_out); + +DRM_ERROR ("LSPCON mode change timed out\n" ); +return -ETIMEDOUT ; +} +EXPORT_SYMBOL (drm_lspcon_set_mode);
include/drm/drm_dp_dual_mode_helper.h +26 -0
@@ -40,6 +40,8 @@#define DP_DUAL_MODE_REV_TYPE2 0x00#define DP_DUAL_MODE_TYPE_MASK 0xf0#define DP_DUAL_MODE_TYPE_TYPE2 0xa0 +/* This field is marked reserved in dual mode spec, used in LSPCON */ +#define DP_DUAL_MODE_TYPE_HAS_DPCD 0x08#define DP_DUAL_MODE_IEEE_OUI 0x11/* 11-13*/ #define DP_DUAL_IEEE_OUI_LEN 3#define DP_DUAL_DEVICE_ID 0x14/* 14-19 */
@@ -55,6 +57,11 @@#define DP_DUAL_MODE_CEC_ENABLE 0x01#define DP_DUAL_MODE_I2C_SPEED_CTRL 0x22 +/* LSPCON specific registers, defined by MCA */ +#define DP_DUAL_MODE_LSPCON_MODE_CHANGE 0x40 +#define DP_DUAL_MODE_LSPCON_CURRENT_MODE 0x41 +#define DP_DUAL_MODE_LSPCON_MODE_PCON 0x1 +struct i2c_adapter ; ssize_t drm_dp_dual_mode_read(struct i2c_adapter *adapter,
@@ -63,6 +70,19 @@ ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter, u8 offset, const void *buffer, size_t size);/** +* enum drm_lspcon_mode +* @lspcon_mode_ls: Level shifter mode of LSPCON +* which drives DP++ to HDMI 1.4 conversion. +* @lspcon_mode_pcon: Protocol converter mode of LSPCON +* which drives DP++ to HDMI 2.0 active conversion. +*/ +enum drm_lspcon_mode { +DRM_LSPCON_MODE_INVALID , +DRM_LSPCON_MODE_LS , +DRM_LSPCON_MODE_PCON , +}; + +/** * enum drm_dp_dual_mode_type - Type of the DP dual mode adaptor * @DRM_DP_DUAL_MODE_NONE: No DP dual mode adaptor * @DRM_DP_DUAL_MODE_UNKNOWN: Could be either none or type 1 DVI adaptor
@@ -70,6 +90,7 @@ ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter,* @DRM_DP_DUAL_MODE_TYPE1_HDMI: Type 1 HDMI adaptor * @DRM_DP_DUAL_MODE_TYPE2_DVI: Type 2 DVI adaptor * @DRM_DP_DUAL_MODE_TYPE2_HDMI: Type 2 HDMI adaptor +* @DRM_DP_DUAL_MODE_TYPE2_LSPCON: Level shifter /protocol converter */ enum drm_dp_dual_mode_type {DRM_DP_DUAL_MODE_NONE ,
@@ -78,6 +99,7 @@ enum drm_dp_dual_mode_type {DRM_DP_DUAL_MODE_TYPE1_HDMI ,DRM_DP_DUAL_MODE_TYPE2_DVI ,DRM_DP_DUAL_MODE_TYPE2_HDMI , + DRM_DP_DUAL_MODE_LSPCON, };enum drm_dp_dual_mode_type drm_dp_dual_mode_detect (struct i2c_adapter *adapter);
@@ -89,4 +111,8 @@ int drm_dp_dual_mode_set_tmds_output(enum drm_dp_dual_mode_type type, struct i2c_adapter *adapter, bool enable);const char *drm_dp_get_dual_mode_type_name (enum drm_dp_dual_mode_type type); +int drm_lspcon_get_mode (struct i2c_adapter *adapter, +enum drm_lspcon_mode *current_mode); +int drm_lspcon_set_mode (struct i2c_adapter *adapter, +enum drm_lspcon_mode reqd_mode);#endif
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v5 2/5 drm/i915: Add lspcon support for I915 driver
In reply to Shashank SharmaThis patch adds a new file, to accommodate lspcon support for I915 driver. These functions probe, detect, initialize and configure an on-board lspcon device during the driver init time.
Also, this patch adds a small structure for lspcon device, which will provide the runtime status of the device.
V2: addressed ville's review comments
- Clean the leftover macros from previous patch set
V3: Rebase
V4: addressed ville's review comments
- make internal functions static
- remove lspcon_detect_identifier, make it inline with lspcon_probe
- remove is_lspcon_active function
- remove force check while setting a lspcon mode
V5: Rebase
--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/intel_drv.h | 9 +++ drivers/gpu/drm/i915/intel_lspcon.c | 127 ++++++++++++++++++++++++++++++++++++ 3 files changed, 137 insertions(+) create mode 100644 drivers/gpu/drm/i915/intel_lspcon.c
drivers/gpu/drm/i915/Makefile +1 -0
@@ -101,6 +101,7 @@ i915-y += dvo_ch7017.o \ intel_dvo.o \ intel_hdmi.o \ intel_i2c.o \ + intel_lspcon.o \ intel_lvds.o \ intel_panel.o \ intel_sdvo.o \
drivers/gpu/drm/i915/intel_drv.h +9 -0
@@ -953,12 +953,19 @@ struct intel_dp {bool compliance_test_active; }; +struct intel_lspcon { +bool active; +enum drm_lspcon_mode mode; +struct drm_dp_aux *aux; +}; +struct intel_digital_port {struct intel_encoder base;enum port port;u32 saved_port_bits;struct intel_dp dp;struct intel_hdmi hdmi; +struct intel_lspcon lspcon;enum irqreturn (*hpd_pulse)(struct intel_digital_port *,bool );bool release_cl2_override;uint8_t max_lanes;
@@ -1841,4 +1848,6 @@ int intel_color_check(struct drm_crtc *crtc, struct drm_crtc_state *state);void intel_color_set_csc (struct drm_crtc_state *crtc_state);void intel_color_load_luts (struct drm_crtc_state *crtc_state); +/* intel_lspcon.c */ +bool lspcon_init (struct intel_digital_port *intel_dig_port);#endif /* __INTEL_DRV_H__ */
drivers/gpu/drm/i915/intel_lspcon.c new file +127 -0
127 lines not on this page · raw message
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v5 3/5 drm/i915: Parse VBT data for lspcon
In reply to Shashank SharmaMany GEN9 boards come with on-board lspcon cards.
Fot these boards, VBT configuration should properly point out if a particular port contains lspcon device, so that driver can initialize it properly.
This patch adds a utility function, which checks the VBT flag for lspcon bit, and tells us if a port is configured to have a lspcon device or not.
V2: Fixed review comments from Ville
- Do not forget PORT_D while checking lspcon for GEN9
V3: Addressed review comments from Rodrigo
- Create a HAS_LSPCON() macro for better use case handling.
- Do not dump warnings for non-gen-9 platforms, it will be noise.
V4: Rebase
V5: Rebase
--- drivers/gpu/drm/i915/i915_drv.h | 5 ++++ drivers/gpu/drm/i915/intel_bios.c | 49 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +5 -0
@@ -2867,6 +2867,8 @@ struct drm_i915_cmd_table {#define HAS_GMCH_DISPLAY (dev) (INTEL_INFO(dev)->has_gmch_display) +#define HAS_LSPCON (dev) (IS_GEN9(dev)) +/* DPF == dynamic parity feature */ #define HAS_L3_DPF (dev) (INTEL_INFO(dev)->has_l3_dpf)#define NUM_L3_SLICES (dev) (IS_HSW_GT3(dev) ? 2 : HAS_L3_DPF(dev))
@@ -3633,6 +3635,9 @@ bool intel_bios_is_port_dp_dual_mode(struct drm_i915_private *dev_priv, enum porbool intel_bios_is_dsi_present (struct drm_i915_private *dev_priv,enum port *port);bool intel_bios_is_port_hpd_inverted (struct drm_i915_private *dev_priv,enum port port); +bool intel_bios_is_lspcon_present (struct drm_i915_private *dev_priv, +enum port port); +/* intel_opregion.c */ #ifdef CONFIG_ACPI
drivers/gpu/drm/i915/intel_bios.c +49 -0
52 lines not on this page · raw message
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v5 4/5 drm/i915: Enable lspcon initialization
In reply to Shashank SharmaThis patch adds initialization code for lspcon.
What we are doing here is:
- Check if lspcon is configured in VBT for this port
- If lspcon is configured, initialize it and configure it as DP port.
V2: Addressed Ville's review comments:
- Not adding AVI IF functions for LSPCON display now. This part will be added once the dig_port level AVI-IF series gets merged.
V3: Rebase
V4: Rebase
V5: Rebase
--- drivers/gpu/drm/i915/intel_ddi.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_ddi.c +28 -1
@@ -2438,7 +2438,7 @@ void intel_ddi_init(struct drm_device *dev, enum port port)struct intel_digital_port *intel_dig_port;struct intel_encoder *intel_encoder;struct drm_encoder *encoder; -bool init_hdmi, init_dp; +bool init_hdmi, init_dp, init_lspcon = false;int max_lanes;if (I915_READ (DDI_BUF_CTL (PORT_A )) &DDI_A_4_LANES ) {
@@ -2470,6 +2470,19 @@ void intel_ddi_init(struct drm_device *dev, enum port port) init_hdmi = (dev_priv->vbt.ddi_port_info[port].supports_dvi || dev_priv->vbt.ddi_port_info[port].supports_hdmi); init_dp = dev_priv->vbt.ddi_port_info[port].supports_dp; + +if (intel_bios_is_lspcon_present (dev_priv, port)) { +/* +* Lspcon device needs to be driven with DP connector +* with special detection sequence. So make sure DP +* is initialized before lspcon. +*/ + init_dp = true; + init_lspcon = true; + init_hdmi = false; +DRM_DEBUG_KMS ("VBT says port %c has lspcon\n" ,port_name (port)); + } +if (!init_dp && !init_hdmi) {DRM_DEBUG_KMS ("VBT says port %c is not DVI/HDMI/DP compatible, respect it\n" ,port_name (port));
@@ -2546,6 +2559,20 @@ void intel_ddi_init(struct drm_device *dev, enum port port) goto err; } +if (init_lspcon) { +if (lspcon_init (intel_dig_port)) +/* TODO: handle hdmi info frame part */ +DRM_DEBUG_KMS ("LSPCON init success on port %c\n" , +port_name (port)); +else +/* +* LSPCON init faied, but DP init was success, so +* lets try to drive as DP++ port. +*/ +DRM_ERROR ("LSPCON init failed on port %c\n" , +port_name (port)); + } +return ; err:
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v5 5/5 drm/i915: Add lspcon resume function
In reply to Shashank SharmaAs per the software design, we are driving lspcon in PCON mode. But while resuming from suspend, lspcon can go in LS mode (which is its default operating mode on power on)
This patch adds a resume function for lspcon, which makes sure its operating in PCON mode, post resume.
--- drivers/gpu/drm/i915/i915_drv.c | 2 ++ drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_lspcon.c | 38 +++++++++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+)
drivers/gpu/drm/i915/i915_drv.c +2 -0
@@ -1574,6 +1574,8 @@ static int i915_drm_resume(struct drm_device *dev) dev_priv->display.hpd_irq_setup (dev_priv);spin_unlock_irq (&dev_priv->irq_lock); +lspcon_resume (dev); +intel_dp_mst_resume (dev);intel_display_resume (dev);
drivers/gpu/drm/i915/intel_drv.h +1 -0
@@ -1850,4 +1850,5 @@ void intel_color_load_luts(struct drm_crtc_state *crtc_state);/* intel_lspcon.c */ bool lspcon_init (struct intel_digital_port *intel_dig_port); +void lspcon_resume (struct drm_device *dev);#endif /* __INTEL_DRV_H__ */
drivers/gpu/drm/i915/intel_lspcon.c +38 -0
@@ -27,6 +27,29 @@#include <drm/drm_dp_dual_mode_helper.h> #include "intel_drv.h" +/* +* This function assumes only one LSPCON port on the device, +* and returns the first active LSPCON port. +*/ +static struct intel_lspcon *find_active_lspcon (struct drm_device *dev) +{ +struct intel_lspcon *lspcon =NULL ; +struct intel_encoder *intel_encoder; + +for_each_intel_encoder (dev, intel_encoder) { +struct intel_digital_port *intel_dig_port; + + intel_dig_port =enc_to_dig_port (&intel_encoder->base); + lspcon = &intel_dig_port->lspcon; +if (lspcon->active) { +DRM_DEBUG_KMS ("LSPCON active : port %c\n" , +port_name (intel_dig_port->port)); +break ; + } + } +return lspcon; +} +enum drm_lspcon_mode lspcon_get_current_mode (struct intel_lspcon *lspcon) {enum drm_lspcon_mode current_mode =DRM_LSPCON_MODE_INVALID ;
@@ -89,6 +112,21 @@ static bool lspcon_probe(struct intel_lspcon *lspcon)return true; } +void lspcon_resume (struct drm_device *dev) +{ +if (IS_GEN9 (dev)) { +struct intel_lspcon *lspcon =find_active_lspcon (dev); + +if (lspcon) { +if (lspcon_change_mode (lspcon,DRM_LSPCON_MODE_PCON , + true)) +DRM_ERROR ("LSPCON resume failed\n" ); +else +DRM_DEBUG_KMS ("LSPCON resume success\n" ); + } + } +} +bool lspcon_init (struct intel_digital_port *intel_dig_port) {struct intel_dp *dp = &intel_dig_port->dp;
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v5 5/5] drm/i915: Add lspcon resume function
Quoted 22 lines · Shashank Sharma
As per the software design, we are driving lspcon in PCON mode. But while resuming from suspend, lspcon can go in LS mode (which is its default operating mode on power on)
This patch adds a resume function for lspcon, which makes sure its operating in PCON mode, post resume.
Signed-off-by Shashank Sharma <[email protected]>---
drivers/gpu/drm/i915/i915_drv.c | 2 ++ drivers/gpu/drm/i915/intel_drv.h | 1 +drivers/gpu/drm/i915/intel_lspcon.c| 38 +++++++++++++++++++++++++++++++++++++3 files changed, 41 insertions(+)drivers/gpu/drm/i915/i915_drv.c +0
-0@@ -1574,6 +1574,8 @@ static int i915_drm_resume(struct drm_device *dev) dev_priv->display.hpd_irq_setup(dev_priv); spin_unlock_irq(&dev_priv->irq_lock);
drivers/gpu/drm/i915/i915_drv.c static int i915_drm_resume(struct drm_device *dev) · line 1578
Quoted 2 lines
drivers/gpu/drm/i915/i915_drv.c +2
-0+lspcon_resume (dev); +
This should go to the encoder reset hook.
Quoted 55 lines
intel_dp_mst_resume(dev);
intel_display_resume(dev);drivers/gpu/drm/i915/intel_drv.h +0
-0@@ -1850,4 +1850,5 @@ void intel_color_load_luts(struct drm_crtc_state *crtc_state);
/*intel_lspcon.c*/
boollspcon_init(struct intel_digital_port *intel_dig_port); +voidlspcon_resume(struct drm_device *dev);
#endif /*__INTEL_DRV_H__*/drivers/gpu/drm/i915/intel_lspcon.c +0
-0@@ -27,6 +27,29 @@ #include #include "intel_drv.h"drivers/gpu/drm/i915/intel_lspcon.c +23
-0+/* +* This function assumes only one LSPCON port on the device, +* and returns the first active LSPCON port. +*/ +static struct intel_lspcon *find_active_lspcon (struct drm_device *dev) +{ +struct intel_lspcon *lspcon =NULL ; +struct intel_encoder *intel_encoder; + +for_each_intel_encoder (dev, intel_encoder) { +struct intel_digital_port *intel_dig_port; + + intel_dig_port =enc_to_dig_port (&intel_encoder->base); + lspcon = &intel_dig_port->lspcon; +if (lspcon->active) { +DRM_DEBUG_KMS ("LSPCON active : port %c\n" , +port_name (intel_dig_port->port)); +break ; + } + } +return lspcon; +} +enum
drm_lspcon_modelspcon_get_current_mode(struct intel_lspcon *lspcon){
enumdrm_lspcon_modecurrent_mode=DRM_LSPCON_MODE_INVALID;drivers/gpu/drm/i915/intel_lspcon.c +0
-0@@ -89,6 +112,21 @@ static bool lspcon_probe(struct intel_lspcon *lspcon) return true; }drivers/gpu/drm/i915/intel_lspcon.c +4
-0+void lspcon_resume (struct drm_device *dev) +{ +if (IS_GEN9 (dev)) { +struct intel_lspcon *lspcon =find_active_lspcon (dev);
drivers/gpu/drm/i915/intel_lspcon.c static bool lspcon_probe(struct intel_lspcon *lspcon) · line 128
Quoted 10 lines
drivers/gpu/drm/i915/intel_lspcon.c +10
-0+ +if (lspcon) { +if (lspcon_change_mode (lspcon,DRM_LSPCON_MODE_PCON , + true)) +DRM_ERROR ("LSPCON resume failed\n" ); +else +DRM_DEBUG_KMS ("LSPCON resume success\n" ); + } + } +}
Nitpick: you could reduce indentation above by using early returns.
Quoted 4 lines
+
boollspcon_init(struct intel_digital_port *intel_dig_port){
structintel_dp*dp =&intel_dig_port->dp;
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v5 5/5] drm/i915: Add lspcon resume function
Regards
Shashak
Quoted 23 lines · Imre Deak
Quoted 22 lines · Shashank Sharma
As per the software design, we are driving lspcon in PCON mode. But while resuming from suspend, lspcon can go in LS mode (which is its default operating mode on power on)
This patch adds a resume function for lspcon, which makes sure its operating in PCON mode, post resume.
Signed-off-by Shashank Sharma <[email protected]>--- drivers/gpu/drm/i915/i915_drv.c | 2 ++ drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_lspcon.c | 38 +++++++++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+)drivers/gpu/drm/i915/i915_drv.c +0
-0@@ -1574,6 +1574,8 @@ static int i915_drm_resume(struct drm_device *dev) dev_priv->display.hpd_irq_setup (dev_priv);spin_unlock_irq (&dev_priv->irq_lock);
Quoted 3 lines
drivers/gpu/drm/i915/i915_drv.c static int i915_drm_resume(struct drm_device *dev) · line 1578
Quoted 2 lines
drivers/gpu/drm/i915/i915_drv.c +2
-0+lspcon_resume (dev); +This should go to the encoder reset hook.
Oh, sorry, I forgot about this suggestion.
Will move it.
Quoted 51 lines
Quoted 51 lines
drivers/gpu/drm/i915/i915_drv.c +0
-0intel_dp_mst_resume (dev);intel_display_resume (dev);drivers/gpu/drm/i915/intel_drv.h +1
-0@@ -1850,4 +1850,5 @@ void intel_color_load_luts(struct drm_crtc_state *crtc_state);/* intel_lspcon.c */ bool lspcon_init (struct intel_digital_port *intel_dig_port); +void lspcon_resume (struct drm_device *dev);#endif /* __INTEL_DRV_H__ */ drivers/gpu/drm/i915/intel_lspcon.c +23
-0@@ -27,6 +27,29 @@ #include#include "intel_drv.h" +/* +* This function assumes only one LSPCON port on the device, +* and returns the first active LSPCON port. +*/ +static struct intel_lspcon *find_active_lspcon (struct drm_device *dev) +{ +struct intel_lspcon *lspcon =NULL ; +struct intel_encoder *intel_encoder; + +for_each_intel_encoder (dev, intel_encoder) { +struct intel_digital_port *intel_dig_port; + + intel_dig_port =enc_to_dig_port (&intel_encoder->base); + lspcon = &intel_dig_port->lspcon; +if (lspcon->active) { +DRM_DEBUG_KMS ("LSPCON active : port %c\n" , +port_name (intel_dig_port->port)); +break ; + } + } +return lspcon; +} +enum drm_lspcon_mode lspcon_get_current_mode (struct intel_lspcon *lspcon) {enum drm_lspcon_mode current_mode =DRM_LSPCON_MODE_INVALID ;@@ -89,6 +112,21 @@ static bool lspcon_probe(struct intel_lspcon *lspcon)return true; }
Quoted 15 lines
Quoted 4 lines
drivers/gpu/drm/i915/intel_lspcon.c +4
-0+void lspcon_resume (struct drm_device *dev) +{ +if (IS_GEN9 (dev)) { +struct intel_lspcon *lspcon =find_active_lspcon (dev);drivers/gpu/drm/i915/intel_lspcon.c static bool lspcon_probe(struct intel_lspcon *lspcon) · line 128
Quoted 10 lines
drivers/gpu/drm/i915/intel_lspcon.c +10
-0+ +if (lspcon) { +if (lspcon_change_mode (lspcon,DRM_LSPCON_MODE_PCON , + true)) +DRM_ERROR ("LSPCON resume failed\n" ); +else +DRM_DEBUG_KMS ("LSPCON resume success\n" ); + } + } +}Nitpick: you could reduce indentation above by using early returns.
Sure.
- Shashank
Quoted 6 lines
drivers/gpu/drm/i915/intel_lspcon.c static bool lspcon_probe(struct intel_lspcon *lspcon) · line 132
Quoted 6 lines
drivers/gpu/drm/i915/intel_lspcon.c +1
-0+bool lspcon_init (struct intel_digital_port *intel_dig_port) {struct intel_dp *dp = &intel_dig_port->dp;
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: failure for Enable lspcon support for GEN9 devices (rev5)
In reply to Shashank Sharma== Series Details ==
== Series Details ==
Series: Enable lspcon support for GEN9 devices (rev5)
URL : https://patchwork.freedesktop.org/series/8024/
State : failure
== Summary ==
LD drivers/thermal/built-in.o
LD drivers/iommu/built-in.o
LD [M] drivers/net/ethernet/intel/e1000e/e1000e.o
In file included from drivers/gpu/drm/i915/intel_drv.h:32:0,
from drivers/gpu/drm/i915/intel_lspcon.c:28:
drivers/gpu/drm/i915/intel_lspcon.c: In function ‘lspcon_resume’:
drivers/gpu/drm/i915/i915_drv.h:2748:41: error: ‘struct drm_device’ has no member named ‘info’
#define IS_GEN9(dev_priv) (!!((dev_priv)->info.gen_mask & BIT(8)))
^
drivers/gpu/drm/i915/intel_lspcon.c:117:6: note: in expansion of macro ‘IS_GEN9’
if (IS_GEN9(dev)) {
^
drivers/gpu/drm/i915/intel_lspcon.c: In function ‘lspcon_init’:
drivers/gpu/drm/i915/i915_drv.h:2748:41: error: ‘struct drm_device’ has no member named ‘info’
#define IS_GEN9(dev_priv) (!!((dev_priv)->info.gen_mask & BIT(8)))
^
drivers/gpu/drm/i915/intel_lspcon.c:136:7: note: in expansion of macro ‘IS_GEN9’
if (!IS_GEN9(dev)) {
^
scripts/Makefile.build:289: recipe for target 'drivers/gpu/drm/i915/intel_lspcon.o' failed
make[4]: *** [drivers/gpu/drm/i915/intel_lspcon.o] Error 1
make[4]: *** Waiting for unfinished jobs....
LD [M] drivers/net/ethernet/intel/igb/igb.o
LD [M] drivers/net/ethernet/broadcom/genet/genet.o
LD fs/btrfs/built-in.o
LD drivers/tty/serial/8250/built-in.o
LD drivers/tty/serial/built-in.o
LD drivers/scsi/built-in.o
LD drivers/tty/vt/built-in.o
LD drivers/video/fbdev/core/fb.o
LD drivers/tty/built-in.o
LD drivers/video/fbdev/core/built-in.o
LD drivers/video/fbdev/built-in.o
LD drivers/video/built-in.o
LD fs/ext4/ext4.o
LD drivers/usb/core/usbcore.o
LD drivers/usb/core/built-in.o
LD net/core/built-in.o
LD fs/ext4/built-in.o
LD fs/built-in.o
AR lib/lib.a
CC arch/x86/kernel/cpu/capflags.o
LD arch/x86/kernel/cpu/built-in.o
LD arch/x86/kernel/built-in.o
LD arch/x86/built-in.o
LD drivers/usb/host/xhci-hcd.o
LD drivers/usb/host/built-in.o
LD drivers/usb/built-in.o
LD net/ipv4/built-in.o
LD net/built-in.o
LD drivers/net/ethernet/built-in.o
LD drivers/net/built-in.oscripts/Makefile.build:440: recipe for target 'drivers/gpu/drm/i915' failed make[3]: *** [drivers/gpu/drm/i915] Error 2 scripts/Makefile.build:440: recipe for target 'drivers/gpu/drm' failed make[2]: *** [drivers/gpu/drm] Error 2 scripts/Makefile.build:440: recipe for target 'drivers/gpu' failed make[1]: *** [drivers/gpu] Error 2
Makefile:968: recipe for target 'drivers' failed
make: *** [drivers] Error 2
Full logs at /archive/deploy/logs/Patchwork_2717
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Jani Nikula
maintainerRe: ✗ Fi.CI.BAT: failure for Enable lspcon support for GEN9 devices (rev5)
Quoted 19 lines · Patchwork
== Series Details ==
Series: Enable lspcon support for GEN9 devices (rev5)
URL : https://patchwork.freedesktop.org/series/8024/
State : failure== Summary ==
LD drivers/thermal/built-in.o LD drivers/iommu/built-in.o LD [M] drivers/net/ethernet/intel/e1000e/e1000e.o In file included from drivers/gpu/drm/i915/intel_drv.h:32:0, from drivers/gpu/drm/i915/intel_lspcon.c:28: drivers/gpu/drm/i915/intel_lspcon.c: In function ‘lspcon_resume’: drivers/gpu/drm/i915/i915_drv.h:2748:41: error: ‘struct drm_device’ has no member named ‘info’ #define IS_GEN9(dev_priv) (!!((dev_priv)->info.gen_mask & BIT(8))) ^ drivers/gpu/drm/i915/intel_lspcon.c:117:6: note: in expansion of macro ‘IS_GEN9’ if (IS_GEN9(dev)) {
Quoted 8 lines
^
drivers/gpu/drm/i915/intel_lspcon.c: In function ‘lspcon_init’:
drivers/gpu/drm/i915/i915_drv.h:2748:41: error: ‘struct drm_device’ has no member named ‘info’
#define IS_GEN9(dev_priv) (!!((dev_priv)->info.gen_mask & BIT(8)))
^
drivers/gpu/drm/i915/intel_lspcon.c:136:7: note: in expansion of macro ‘IS_GEN9’
if (!IS_GEN9(dev)) {
^This conflicts with Tvrtko's recent changes to only accept dev_priv pointers in various macros.
I hope we can apply patch 3/5 first to add debug logging. I posted the rebased version of that [1].
BR,
Jani.
[1] http://patchwork.freedesktop.org/patch/msgid/[email protected]
Quoted 48 lines
scripts/Makefile.build:289: recipe for target 'drivers/gpu/drm/i915/intel_lspcon.o' failed make[4]: *** [drivers/gpu/drm/i915/intel_lspcon.o] Error 1
make[4]: *** Waiting for unfinished jobs....LD [M] drivers/net/ethernet/intel/igb/igb.o LD [M] drivers/net/ethernet/broadcom/genet/genet.o LD fs/btrfs/built-in.o LD drivers/tty/serial/8250/built-in.o LD drivers/tty/serial/built-in.o LD drivers/scsi/built-in.o LD drivers/tty/vt/built-in.o LD drivers/video/fbdev/core/fb.o LD drivers/tty/built-in.o LD drivers/video/fbdev/core/built-in.o LD drivers/video/fbdev/built-in.o LD drivers/video/built-in.o LD fs/ext4/ext4.o LD drivers/usb/core/usbcore.o LD drivers/usb/core/built-in.o LD net/core/built-in.o LD fs/ext4/built-in.o LD fs/built-in.o AR lib/lib.a CC arch/x86/kernel/cpu/capflags.o LD arch/x86/kernel/cpu/built-in.o LD arch/x86/kernel/built-in.o LD arch/x86/built-in.o LD drivers/usb/host/xhci-hcd.o LD drivers/usb/host/built-in.o LD drivers/usb/built-in.o LD net/ipv4/built-in.o LD net/built-in.o LD drivers/net/ethernet/built-in.o LD drivers/net/built-in.o
scripts/Makefile.build:440: recipe for target 'drivers/gpu/drm/i915' failed make[3]: *** [drivers/gpu/drm/i915] Error 2scripts/Makefile.build:440: recipe for target 'drivers/gpu/drm' failed make[2]: *** [drivers/gpu/drm] Error 2scripts/Makefile.build:440: recipe for target 'drivers/gpu' failed make[1]: *** [drivers/gpu] Error 2
Makefile:968: recipe for target 'drivers' failed
make: *** [drivers] Error 2Full logs at /archive/deploy/logs/Patchwork_2717
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: ✗ Fi.CI.BAT: failure for Enable lspcon support for GEN9 devices (rev5)
I was about to send another series to address Imre's patches. There I have addressed this problems.
Please wait for some time, I will re-sync and send V6 for all patches.
Even though I am not sure why it dint apply on nightly, as I did a git-pull few hours ago.
Regards
Shashank
-----Original Message-----
From: Jani Nikula [mailto:[email protected]]
Sent: Friday, October 14, 2016 7:10 PM
To: Patchwork <[email protected]>; Sharma, Shashank <[email protected]>
Cc: [email protected]
Subject: Re: [Intel-gfx] ✗ Fi.CI.BAT: failure for Enable lspcon support for GEN9 devices (rev5)
Quoted 19 lines · Patchwork
== Series Details ==
Series: Enable lspcon support for GEN9 devices (rev5)
URL : https://patchwork.freedesktop.org/series/8024/
State : failure== Summary ==
LD drivers/thermal/built-in.o LD drivers/iommu/built-in.o LD [M] drivers/net/ethernet/intel/e1000e/e1000e.o In file included from drivers/gpu/drm/i915/intel_drv.h:32:0, from drivers/gpu/drm/i915/intel_lspcon.c:28: drivers/gpu/drm/i915/intel_lspcon.c: In function ‘lspcon_resume’: drivers/gpu/drm/i915/i915_drv.h:2748:41: error: ‘struct drm_device’ has no member named ‘info’ #define IS_GEN9(dev_priv) (!!((dev_priv)->info.gen_mask & BIT(8))) ^ drivers/gpu/drm/i915/intel_lspcon.c:117:6: note: in expansion of macro ‘IS_GEN9’ if (IS_GEN9(dev)) {
Quoted 8 lines
^
drivers/gpu/drm/i915/intel_lspcon.c: In function ‘lspcon_init’:
drivers/gpu/drm/i915/i915_drv.h:2748:41: error: ‘struct drm_device’ has no member named ‘info’
#define IS_GEN9(dev_priv) (!!((dev_priv)->info.gen_mask & BIT(8)))
^
drivers/gpu/drm/i915/intel_lspcon.c:136:7: note: in expansion of macro ‘IS_GEN9’
if (!IS_GEN9(dev)) {
^This conflicts with Tvrtko's recent changes to only accept dev_priv pointers in various macros.
I hope we can apply patch 3/5 first to add debug logging. I posted the rebased version of that [1].
BR,
Jani.
[1] http://patchwork.freedesktop.org/patch/msgid/[email protected]
Quoted 44 lines
scripts/Makefile.build:289: recipe for target 'drivers/gpu/drm/i915/intel_lspcon.o' failed make[4]: *** [drivers/gpu/drm/i915/intel_lspcon.o] Error 1 make[4]: *** Waiting for unfinished jobs....LD [M] drivers/net/ethernet/intel/igb/igb.o LD [M] drivers/net/ethernet/broadcom/genet/genet.o LD fs/btrfs/built-in.o LD drivers/tty/serial/8250/built-in.o LD drivers/tty/serial/built-in.o LD drivers/scsi/built-in.o LD drivers/tty/vt/built-in.o LD drivers/video/fbdev/core/fb.o LD drivers/tty/built-in.o LD drivers/video/fbdev/core/built-in.o LD drivers/video/fbdev/built-in.o LD drivers/video/built-in.o LD fs/ext4/ext4.o LD drivers/usb/core/usbcore.o LD drivers/usb/core/built-in.o LD net/core/built-in.o LD fs/ext4/built-in.o LD fs/built-in.o AR lib/lib.a CC arch/x86/kernel/cpu/capflags.o LD arch/x86/kernel/cpu/built-in.o LD arch/x86/kernel/built-in.o LD arch/x86/built-in.o LD drivers/usb/host/xhci-hcd.o LD drivers/usb/host/built-in.o LD drivers/usb/built-in.o LD net/ipv4/built-in.o LD net/built-in.o LD drivers/net/ethernet/built-in.o LD drivers/net/built-in.o
scripts/Makefile.build:440: recipe for target 'drivers/gpu/drm/i915' failed
make[3]: *** [drivers/gpu/drm/i915] Error 2scripts/Makefile.build:440: recipe for target 'drivers/gpu/drm' failed make[2]: *** [drivers/gpu/drm] Error 2scripts/Makefile.build:440: recipe for target 'drivers/gpu' failed make[1]: *** [drivers/gpu] Error 2
Makefile:968: recipe for target 'drivers' failed
make: *** [drivers] Error 2
Quoted 6 lines
Full logs at /archive/deploy/logs/Patchwork_2717
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx