drm: Add helper for DP++ adaptors
Subsystems (3)
PATCH 1/12 drm: Add helper for DP++ adaptors
From: Ville Syrjälä <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add a helper which aids in he identification of DP dual mode (aka. DP++) adaptors. There are several types of adaptors specified:
type 1 DVI, type 1 HDMI, type 2 DVI, type 2 HDMI
Type 1 adaptors have a max TMDS clock limit of 165MHz, type 2 adaptors may go as high as 300MHz and they provide a register informing the source device what the actual limit is. Supposedly also type 1 adaptors may optionally implement this register. This TMDS clock limit is the main reason why we need to identify these adaptors.
Type 1 adaptors provide access to their internal registers and the sink DDC bus through I2C. Type 2 adaptors provide this access both via I2C and I2C-over-AUX. A type 2 source device may choose to implement either or both of these methods. If a source device implements only the I2C-over-AUX method, then the driver will obviously need specific support for such adaptors since the port is driven like an HDMI port, but DDC communication happes over the AUX channel.
This helper should be enough to identify the adaptor type (some type 1 DVI adaptors may be a slight exception) and the maximum TMDS clock limit. Another feature that may be available is control over the TMDS output buffers on the adaptor, possibly allowing for some power saving when the TMDS link is down.
Other user controllable features that may be available in the adaptors are downstream i2c bus speed control when using i2c-over-aux, and some control over the CEC pin. I chose not to provide any helper functions for those since I have no use for them in i915 at this time. The rest of the registers in the adaptor are mostly just information, eg. IEEE OUI, hardware and firmware revision, etc.
--- drivers/gpu/drm/Makefile | 2 +- drivers/gpu/drm/drm_dp_dual_mode_helper.c | 331 ++++++++++++++++++++++++++++++ include/drm/drm_dp_dual_mode_helper.h | 84 ++++++++ 3 files changed, 416 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/drm_dp_dual_mode_helper.c create mode 100644 include/drm/drm_dp_dual_mode_helper.h
drivers/gpu/drm/Makefile +1 -1
@@ -23,7 +23,7 @@ drm-$(CONFIG_AGP) += drm_agpsupport.o drm_kms_helper-y := drm_crtc_helper.o drm_dp_helper.o drm_probe_helper.o \ drm_plane_helper.o drm_dp_mst_topology.o drm_atomic_helper.o \ - drm_kms_helper_common.o + drm_kms_helper_common.o drm_dp_dual_mode_helper.o drm_kms_helper-$(CONFIG_DRM_LOAD_EDID_FIRMWARE) += drm_edid_load.o drm_kms_helper-$(CONFIG_DRM_FBDEV_EMULATION) += drm_fb_helper.o
drivers/gpu/drm/drm_dp_dual_mode_helper.c new file +331 -0
331 lines not on this page · raw message
include/drm/drm_dp_dual_mode_helper.h new file +84 -0
84 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 2/12 drm/i915: Respect DP++ adaptor TMDS clock limit
From: Ville Syrjälä <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Try to detect the max TMDS clock limit for the DP++ adaptor (if any) and take it into account when checking the port clock.
Note that as with the sink (HDMI vs. DVI) TMDS clock limit we'll ignore the adaptor TMDS clock limit in the modeset path, in case users are already "overclocking" their TMDS links. One subtle change here is that we'll have to respect the adaptor TMDS clock limit when we decide whether to do 12bpc or 8bpc, otherwise we might end up picking 12bpc and accidentally driving the TMDS link out of spec even when the user chose a mode that fits wihting the limits at 8bpc. This means you can't "overclock" your DP++ dongle at 12bpc anymore, but you can continue to do so at 8bpc.
Note that for simplicity we'll use the I2C access method for all dual mode adaptors including type 2. Otherwise we'd have to start mixing DP AUX and HDMI together. In the future we may need to do that if we come across any board designs that don't hook up the DDC pins to the DP++ connectors. Such boards would obviously only work with type 2 dual mode adaptors, and not type 1.
--- drivers/gpu/drm/i915/intel_drv.h | 3 ++ drivers/gpu/drm/i915/intel_hdmi.c | 65 ++++++++++++++++++++++++++++++++++----- 2 files changed, 60 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/intel_drv.h +3 -0
@@ -744,6 +744,9 @@ struct cxsr_latency {struct intel_hdmi {i915_reg_t hdmi_reg;int ddc_bus; +struct { +int max_tmds_clock; + } dp_dual_mode;bool limited_color_range;bool color_range_auto;bool has_hdmi_sink;
drivers/gpu/drm/i915/intel_hdmi.c +57 -8
113 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 3/12 drm/i915: Enable/disable TMDS output buffers in DP++ adaptor as needed
In reply to Shashank SharmaFrom: Ville Syrjälä <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
To save a bit of power, let's try to turn off the TMDS output buffers in DP++ adaptors when we're not driving the port.
--- drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_hdmi.c | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+)
drivers/gpu/drm/i915/intel_drv.h +1 -0
@@ -746,6 +746,7 @@ struct intel_hdmi {int ddc_bus;struct {int max_tmds_clock; +bool tmds_output_control; } dp_dual_mode;bool limited_color_range;bool color_range_auto;
drivers/gpu/drm/i915/intel_hdmi.c +25 -0
@@ -846,6 +846,13 @@ static void intel_hdmi_prepare(struct intel_encoder *encoder)const struct drm_display_mode *adjusted_mode = &crtc->config->base.adjusted_mode;u32 hdmi_val; +if (intel_hdmi->dp_dual_mode.tmds_output_control) { +struct i2c_adapter *adapter = +intel_gmbus_get_adapter (dev_priv, intel_hdmi->ddc_bus); + +drm_dp_dual_mode_set_tmds_output (adapter, true); + } + hdmi_val =SDVO_ENCODING_HDMI ;if (!HAS_PCH_SPLIT (dev) && crtc->config->limited_color_range) hdmi_val |=HDMI_COLOR_RANGE_16_235 ;
@@ -1141,6 +1148,13 @@ static void intel_disable_hdmi(struct intel_encoder *encoder) } intel_hdmi->set_infoframes (&encoder->base, false,NULL ); + +if (intel_hdmi->dp_dual_mode.tmds_output_control) { +struct i2c_adapter *adapter = +intel_gmbus_get_adapter (dev_priv, intel_hdmi->ddc_bus); + +drm_dp_dual_mode_set_tmds_output (adapter, false); + } }static void g4x_disable_hdmi (struct intel_encoder *encoder)
@@ -1366,6 +1380,7 @@ intel_hdmi_unset_edid(struct drm_connector *connector) intel_hdmi->rgb_quant_range_selectable = false; intel_hdmi->dp_dual_mode.max_tmds_clock =0 ; + intel_hdmi->dp_dual_mode.tmds_output_control = false;kfree (to_intel_connector (connector)->detect_edid);to_intel_connector (connector)->detect_edid =NULL ;
@@ -1389,15 +1404,25 @@ intel_hdmi_dp_dual_mode_detect(struct drm_connector *connector)*/ if (type ==DRM_DP_DUAL_MODE_TYPE2_DVI || type ==DRM_DP_DUAL_MODE_TYPE2_HDMI ) { +bool tmds_enabled; + hdmi->dp_dual_mode.max_tmds_clock =drm_dp_dual_mode_max_tmds_clock (adapter); + hdmi->dp_dual_mode.tmds_output_control = +drm_dp_dual_mode_get_tmds_output (adapter, + &tmds_enabled) ==0 && +drm_dp_dual_mode_set_tmds_output (adapter, + tmds_enabled) ==0 ; }else { hdmi->dp_dual_mode.max_tmds_clock =165000 ; + hdmi->dp_dual_mode.tmds_output_control = false; }DRM_DEBUG_KMS ("Adaptor (%s) detected (max TMDS clock: %d kHz)\n" ,drm_dp_get_dual_mode_type_name (type), hdmi->dp_dual_mode.max_tmds_clock); +DRM_DEBUG_KMS ("TMDS OE# control: %s)\n" , +yesno (hdmi->dp_dual_mode.tmds_output_control)); } static bool
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/12 drm/i915: Determine DP++ type 1 DVI adaptor presence based on VBT
In reply to Shashank SharmaFrom: Ville Syrjälä <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
DP dual mode type 1 DVI adaptors aren't required to implement any registers, so it's a bit hard to detect them. The best way would be to check the state of the CONFIG1 pin, but we have no way to do that. So as a last resort, check the VBT to see if the HDMI port is in fact a dual mode capable DP port.
--- drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/intel_bios.c | 32 ++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_dp.c | 5 +++++ drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_hdmi.c | 23 +++++++++++++++++++++-- drivers/gpu/drm/i915/intel_vbt_defs.h | 3 +++ 6 files changed, 64 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +2 -0
@@ -3373,6 +3373,8 @@ bool intel_bios_is_tv_present(struct drm_i915_private *dev_priv);bool intel_bios_is_lvds_present (struct drm_i915_private *dev_priv,u8 *i2c_pin);bool intel_bios_is_port_edp (struct drm_i915_private *dev_priv,enum port port);bool intel_bios_is_dsi_present (struct drm_i915_private *dev_priv,enum port *port); +bool intel_bios_is_dp_dual_mode (struct drm_i915_private *dev_priv, +enum port port);/* intel_opregion.c */ #ifdef CONFIG_ACPI
drivers/gpu/drm/i915/intel_bios.c +32 -0
@@ -1550,6 +1550,38 @@ bool intel_bios_is_port_edp(struct drm_i915_private *dev_priv, enum port port)return false; } +bool intel_bios_is_dp_dual_mode (struct drm_i915_private *dev_priv, +enum port port) +{ +const union child_device_config *p_child; +int i; +static const short port_mapping[] = { + [PORT_B ] =DVO_PORT_DPB , + [PORT_C ] =DVO_PORT_DPC , + [PORT_D ] =DVO_PORT_DPD , + [PORT_E ] =DVO_PORT_DPE , + }; + +if (port ==PORT_A || port >=ARRAY_SIZE (port_mapping)) +return false; + +if (!dev_priv->vbt.child_dev_num) +return false; + +for (i =0 ; i < dev_priv->vbt.child_dev_num; i++) { + p_child = &dev_priv->vbt.child_dev[i]; + +if (p_child->common.dvo_port == port_mapping[port] && + (p_child->common.device_type & +DEVICE_TYPE_DP_DUAL_MODE_BITS ) == + (DEVICE_TYPE_DP_DUAL_MODE & +DEVICE_TYPE_DP_DUAL_MODE_BITS )) +return true; + } +return false; +} + +/** * intel_bios_is_dsi_present - is DSI present in VBT * @dev_priv: i915 device instance
drivers/gpu/drm/i915/intel_dp.c +5 -0
@@ -5007,6 +5007,11 @@ bool intel_dp_is_edp(struct drm_device *dev, enum port port)return intel_bios_is_port_edp (dev_priv, port); } +bool intel_dp_is_dual_mode (struct drm_i915_private *dev_priv,enum port port) +{ +return intel_bios_is_dp_dual_mode (dev_priv, port); +} +void intel_dp_add_properties (struct intel_dp *intel_dp,struct drm_connector *connector) {
drivers/gpu/drm/i915/intel_drv.h +1 -0
@@ -1276,6 +1276,7 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc);bool intel_dp_compute_config (struct intel_encoder *encoder,struct intel_crtc_state *pipe_config);bool intel_dp_is_edp (struct drm_device *dev,enum port port); +bool intel_dp_is_dual_mode (struct drm_i915_private *dev_priv,enum port port);enum irqreturn intel_dp_hpd_pulse (struct intel_digital_port *intel_dig_port,bool long_hpd);void intel_edp_backlight_on (struct intel_dp *intel_dp);
drivers/gpu/drm/i915/intel_hdmi.c +21 -2
@@ -1387,14 +1387,33 @@ intel_hdmi_unset_edid(struct drm_connector *connector) }static void -intel_hdmi_dp_dual_mode_detect (struct drm_connector *connector) +intel_hdmi_dp_dual_mode_detect (struct drm_connector *connector,bool has_edid) {struct drm_i915_private *dev_priv =to_i915 (connector->dev);struct intel_hdmi *hdmi =intel_attached_hdmi (connector); +enum port port =hdmi_to_dig_port (hdmi)->port;struct i2c_adapter *adapter =intel_gmbus_get_adapter (dev_priv, hdmi->ddc_bus);enum drm_dp_dual_mode_type type =drm_dp_dual_mode_detect (adapter); +/* +* Type 1 DVI adaptors are not required to implement any +* registers, so we can't always detect their presence. +* Ideally we should be able to check the state of the +* CONFIG1 pin, but no such luck on our hardware. +* +* The only method left to us is to check the VBT to see +* if the port is a dual mode capable DP port. But let's +* only do that when we sucesfully read the EDID, to avoid +* confusing log messages about DP dual mode adaptors when +* there's nothing connected to the port. +*/ +if (type ==DRM_DP_DUAL_MODE_NONE && has_edid && +intel_dp_is_dual_mode (dev_priv, port)) { +DRM_DEBUG_KMS ("Assuming DP dual mode adaptor (as per VBT)\n" ); + type =DRM_DP_DUAL_MODE_TYPE1_DVI ; + } +if (type ==DRM_DP_DUAL_MODE_NONE )return ;
@@ -1440,7 +1459,7 @@ intel_hdmi_set_edid(struct drm_connector *connector, bool force)intel_gmbus_get_adapter (dev_priv, intel_hdmi->ddc_bus)); -intel_hdmi_dp_dual_mode_detect (connector); +intel_hdmi_dp_dual_mode_detect (connector, edid !=NULL );intel_display_power_put (dev_priv,POWER_DOMAIN_GMBUS ); }
drivers/gpu/drm/i915/intel_vbt_defs.h +3 -0
@@ -734,6 +734,7 @@ struct bdb_psr {#define DEVICE_TYPE_INT_TV 0x1009#define DEVICE_TYPE_HDMI 0x60D2#define DEVICE_TYPE_DP 0x68C6 +#define DEVICE_TYPE_DP_DUAL_MODE 0x60D6#define DEVICE_TYPE_eDP 0x78C6#define DEVICE_TYPE_CLASS_EXTENSION (1 << 15)
@@ -768,6 +769,8 @@ struct bdb_psr { DEVICE_TYPE_DISPLAYPORT_OUTPUT | \ DEVICE_TYPE_ANALOG_OUTPUT) +#define DEVICE_TYPE_DP_DUAL_MODE_BITS ~DEVICE_TYPE_NOT_HDMI_OUTPUT +/* define the DVO port for HDMI output type */ #define DVO_B 1#define DVO_C 2
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Jani Nikula
maintainerRe: [PATCH 04/12] drm/i915: Determine DP++ type 1 DVI adaptor presence based on VBT
Quoted 87 lines · Shashank Sharma
From: Ville Syrjälä <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bitMIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bitDP dual mode type 1 DVI adaptors aren't required to implement any registers, so it's a bit hard to detect them. The best way would be to check the state of the CONFIG1 pin, but we have no way to do that. So as a last resort, check the VBT to see if the HDMI port is in fact a dual mode capable DP port.
Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/intel_bios.c | 32 ++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_dp.c | 5 +++++ drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_hdmi.c | 23 +++++++++++++++++++++-- drivers/gpu/drm/i915/intel_vbt_defs.h | 3 +++ 6 files changed, 64 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/i915_drv.h +2
-0@@ -3373,6 +3373,8 @@ bool intel_bios_is_tv_present(struct drm_i915_private *dev_priv);bool intel_bios_is_lvds_present (struct drm_i915_private *dev_priv,u8 *i2c_pin);bool intel_bios_is_port_edp (struct drm_i915_private *dev_priv,enum port port);bool intel_bios_is_dsi_present (struct drm_i915_private *dev_priv,enum port *port); +bool intel_bios_is_dp_dual_mode (struct drm_i915_private *dev_priv, +enum port port);/* intel_opregion.c */ #ifdef CONFIG_ACPI drivers/gpu/drm/i915/intel_bios.c +32
-0@@ -1550,6 +1550,38 @@ bool intel_bios_is_port_edp(struct drm_i915_private *dev_priv, enum port port)return false; } +bool intel_bios_is_dp_dual_mode (struct drm_i915_private *dev_priv, +enum port port) +{ +const union child_device_config *p_child; +int i; +static const short port_mapping[] = { + [PORT_B ] =DVO_PORT_DPB , + [PORT_C ] =DVO_PORT_DPC , + [PORT_D ] =DVO_PORT_DPD , + [PORT_E ] =DVO_PORT_DPE , + }; + +if (port ==PORT_A || port >=ARRAY_SIZE (port_mapping)) +return false; + +if (!dev_priv->vbt.child_dev_num) +return false; + +for (i =0 ; i < dev_priv->vbt.child_dev_num; i++) { + p_child = &dev_priv->vbt.child_dev[i]; + +if (p_child->common.dvo_port == port_mapping[port] && + (p_child->common.device_type & +DEVICE_TYPE_DP_DUAL_MODE_BITS ) == + (DEVICE_TYPE_DP_DUAL_MODE & +DEVICE_TYPE_DP_DUAL_MODE_BITS )) +return true; + } +return false; +} + +/** * intel_bios_is_dsi_present - is DSI present in VBT * @dev_priv: i915 device instance drivers/gpu/drm/i915/intel_dp.c +0
-0
drivers/gpu/drm/i915/intel_dp.c bool intel_dp_is_edp(struct drm_device *dev, enum port port) · line 5013
Quoted 7 lines
drivers/gpu/drm/i915/intel_dp.c +4
-0@@ -5007,6 +5007,11 @@ bool intel_dp_is_edp(struct drm_device *dev, enum port port)return intel_bios_is_port_edp (dev_priv, port); } +bool intel_dp_is_dual_mode (struct drm_i915_private *dev_priv,enum port port) +{ +return intel_bios_is_dp_dual_mode (dev_priv, port); +}
Just use intel_bios_is_dp_dual_mode() where you need it.
BR,
Jani.
Quoted 85 lines
drivers/gpu/drm/i915/intel_dp.c +1
-0+void intel_dp_add_properties (struct intel_dp *intel_dp,struct drm_connector *connector) {drivers/gpu/drm/i915/intel_drv.h +1
-0@@ -1276,6 +1276,7 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc);bool intel_dp_compute_config (struct intel_encoder *encoder,struct intel_crtc_state *pipe_config);bool intel_dp_is_edp (struct drm_device *dev,enum port port); +bool intel_dp_is_dual_mode (struct drm_i915_private *dev_priv,enum port port);enum irqreturn intel_dp_hpd_pulse (struct intel_digital_port *intel_dig_port,bool long_hpd);void intel_edp_backlight_on (struct intel_dp *intel_dp);drivers/gpu/drm/i915/intel_hdmi.c +21
-2@@ -1387,14 +1387,33 @@ intel_hdmi_unset_edid(struct drm_connector *connector) }static void -intel_hdmi_dp_dual_mode_detect (struct drm_connector *connector) +intel_hdmi_dp_dual_mode_detect (struct drm_connector *connector,bool has_edid) {struct drm_i915_private *dev_priv =to_i915 (connector->dev);struct intel_hdmi *hdmi =intel_attached_hdmi (connector); +enum port port =hdmi_to_dig_port (hdmi)->port;struct i2c_adapter *adapter =intel_gmbus_get_adapter (dev_priv, hdmi->ddc_bus);enum drm_dp_dual_mode_type type =drm_dp_dual_mode_detect (adapter); +/* +* Type 1 DVI adaptors are not required to implement any +* registers, so we can't always detect their presence. +* Ideally we should be able to check the state of the +* CONFIG1 pin, but no such luck on our hardware. +* +* The only method left to us is to check the VBT to see +* if the port is a dual mode capable DP port. But let's +* only do that when we sucesfully read the EDID, to avoid +* confusing log messages about DP dual mode adaptors when +* there's nothing connected to the port. +*/ +if (type ==DRM_DP_DUAL_MODE_NONE && has_edid && +intel_dp_is_dual_mode (dev_priv, port)) { +DRM_DEBUG_KMS ("Assuming DP dual mode adaptor (as per VBT)\n" ); + type =DRM_DP_DUAL_MODE_TYPE1_DVI ; + } +if (type ==DRM_DP_DUAL_MODE_NONE )return ;@@ -1440,7 +1459,7 @@ intel_hdmi_set_edid(struct drm_connector *connector, bool force)intel_gmbus_get_adapter (dev_priv, intel_hdmi->ddc_bus)); -intel_hdmi_dp_dual_mode_detect (connector); +intel_hdmi_dp_dual_mode_detect (connector, edid !=NULL );intel_display_power_put (dev_priv,POWER_DOMAIN_GMBUS ); }drivers/gpu/drm/i915/intel_vbt_defs.h +3
-0@@ -734,6 +734,7 @@ struct bdb_psr {#define DEVICE_TYPE_INT_TV 0x1009#define DEVICE_TYPE_HDMI 0x60D2#define DEVICE_TYPE_DP 0x68C6 +#define DEVICE_TYPE_DP_DUAL_MODE 0x60D6#define DEVICE_TYPE_eDP 0x78C6#define DEVICE_TYPE_CLASS_EXTENSION (1 << 15)@@ -768,6 +769,8 @@ struct bdb_psr { DEVICE_TYPE_DISPLAYPORT_OUTPUT | \ DEVICE_TYPE_ANALOG_OUTPUT) +#define DEVICE_TYPE_DP_DUAL_MODE_BITS ~DEVICE_TYPE_NOT_HDMI_OUTPUT +/* define the DVO port for HDMI output type */ #define DVO_B 1#define DVO_C 2
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: [PATCH 04/12] drm/i915: Determine DP++ type 1 DVI adaptor presence based on VBT
Quoted 91 lines · Jani Nikula
Quoted 90 lines · Shashank Sharma
From: Ville Syrjälä <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bitMIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bitDP dual mode type 1 DVI adaptors aren't required to implement any registers, so it's a bit hard to detect them. The best way would be to check the state of the CONFIG1 pin, but we have no way to do that. So as a last resort, check the VBT to see if the HDMI port is in fact a dual mode capable DP port.
Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/intel_bios.c | 32 ++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_dp.c | 5 +++++ drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_hdmi.c | 23 +++++++++++++++++++++-- drivers/gpu/drm/i915/intel_vbt_defs.h | 3 +++ 6 files changed, 64 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/i915_drv.h +2
-0@@ -3373,6 +3373,8 @@ bool intel_bios_is_tv_present(struct drm_i915_private *dev_priv);bool intel_bios_is_lvds_present (struct drm_i915_private *dev_priv,u8 *i2c_pin);bool intel_bios_is_port_edp (struct drm_i915_private *dev_priv,enum port port);bool intel_bios_is_dsi_present (struct drm_i915_private *dev_priv,enum port *port); +bool intel_bios_is_dp_dual_mode (struct drm_i915_private *dev_priv, +enum port port);/* intel_opregion.c */ #ifdef CONFIG_ACPI drivers/gpu/drm/i915/intel_bios.c +32
-0@@ -1550,6 +1550,38 @@ bool intel_bios_is_port_edp(struct drm_i915_private *dev_priv, enum port port)return false; } +bool intel_bios_is_dp_dual_mode (struct drm_i915_private *dev_priv, +enum port port) +{ +const union child_device_config *p_child; +int i; +static const short port_mapping[] = { + [PORT_B ] =DVO_PORT_DPB , + [PORT_C ] =DVO_PORT_DPC , + [PORT_D ] =DVO_PORT_DPD , + [PORT_E ] =DVO_PORT_DPE , + }; + +if (port ==PORT_A || port >=ARRAY_SIZE (port_mapping)) +return false; + +if (!dev_priv->vbt.child_dev_num) +return false; + +for (i =0 ; i < dev_priv->vbt.child_dev_num; i++) { + p_child = &dev_priv->vbt.child_dev[i]; + +if (p_child->common.dvo_port == port_mapping[port] && + (p_child->common.device_type & +DEVICE_TYPE_DP_DUAL_MODE_BITS ) == + (DEVICE_TYPE_DP_DUAL_MODE & +DEVICE_TYPE_DP_DUAL_MODE_BITS )) +return true; + } +return false; +} + +/** * intel_bios_is_dsi_present - is DSI present in VBT * @dev_priv: i915 device instance drivers/gpu/drm/i915/intel_dp.c +0
-0@@ -5007,6 +5007,11 @@ bool intel_dp_is_edp(struct drm_device *dev, enum port port)return intel_bios_is_port_edp (dev_priv, port); }
Quoted 6 lines
drivers/gpu/drm/i915/intel_dp.c bool intel_dp_is_edp(struct drm_device *dev, enum port port) · line 5013
Quoted 4 lines
drivers/gpu/drm/i915/intel_dp.c +4
-0+bool intel_dp_is_dual_mode (struct drm_i915_private *dev_priv,enum port port) +{ +return intel_bios_is_dp_dual_mode (dev_priv, port); +}Just use
intel_bios_is_dp_dual_mode()where you need it.
That wasn't in my original patch, and the commit message lacks any information that the patch has been modified by someone else than the original author. Such things always need to be documented properly!
Anyways, I should just repost my patches separately (with reviews comments addresses where appropriate) so that we can get the basic dual mode stuff in (to fix the 12bpc regressions).
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 04/12] drm/i915: Determine DP++ type 1 DVI adaptor presence based on VBT
Regards
Shashank
Quoted 99 lines · Ville Syrjälä
Quoted 91 lines · Jani Nikula
Quoted 90 lines · Shashank Sharma
From: Ville Syrjälä <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bitMIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bitDP dual mode type 1 DVI adaptors aren't required to implement any registers, so it's a bit hard to detect them. The best way would be to check the state of the CONFIG1 pin, but we have no way to do that. So as a last resort, check the VBT to see if the HDMI port is in fact a dual mode capable DP port.
Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/intel_bios.c | 32 ++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_dp.c | 5 +++++ drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_hdmi.c | 23 +++++++++++++++++++++-- drivers/gpu/drm/i915/intel_vbt_defs.h | 3 +++ 6 files changed, 64 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/i915_drv.h +2
-0@@ -3373,6 +3373,8 @@ bool intel_bios_is_tv_present(struct drm_i915_private *dev_priv);bool intel_bios_is_lvds_present (struct drm_i915_private *dev_priv,u8 *i2c_pin);bool intel_bios_is_port_edp (struct drm_i915_private *dev_priv,enum port port);bool intel_bios_is_dsi_present (struct drm_i915_private *dev_priv,enum port *port); +bool intel_bios_is_dp_dual_mode (struct drm_i915_private *dev_priv, +enum port port);/* intel_opregion.c */ #ifdef CONFIG_ACPI drivers/gpu/drm/i915/intel_bios.c +32
-0@@ -1550,6 +1550,38 @@ bool intel_bios_is_port_edp(struct drm_i915_private *dev_priv, enum port port)return false; } +bool intel_bios_is_dp_dual_mode (struct drm_i915_private *dev_priv, +enum port port) +{ +const union child_device_config *p_child; +int i; +static const short port_mapping[] = { + [PORT_B ] =DVO_PORT_DPB , + [PORT_C ] =DVO_PORT_DPC , + [PORT_D ] =DVO_PORT_DPD , + [PORT_E ] =DVO_PORT_DPE , + }; + +if (port ==PORT_A || port >=ARRAY_SIZE (port_mapping)) +return false; + +if (!dev_priv->vbt.child_dev_num) +return false; + +for (i =0 ; i < dev_priv->vbt.child_dev_num; i++) { + p_child = &dev_priv->vbt.child_dev[i]; + +if (p_child->common.dvo_port == port_mapping[port] && + (p_child->common.device_type & +DEVICE_TYPE_DP_DUAL_MODE_BITS ) == + (DEVICE_TYPE_DP_DUAL_MODE & +DEVICE_TYPE_DP_DUAL_MODE_BITS )) +return true; + } +return false; +} + +/** * intel_bios_is_dsi_present - is DSI present in VBT * @dev_priv: i915 device instance drivers/gpu/drm/i915/intel_dp.c +0
-0@@ -5007,6 +5007,11 @@ bool intel_dp_is_edp(struct drm_device *dev, enum port port)return intel_bios_is_port_edp (dev_priv, port); }Quoted 6 lines
drivers/gpu/drm/i915/intel_dp.c bool intel_dp_is_edp(struct drm_device *dev, enum port port) · line 5013
Quoted 4 lines
drivers/gpu/drm/i915/intel_dp.c +4
-0+bool intel_dp_is_dual_mode (struct drm_i915_private *dev_priv,enum port port) +{ +return intel_bios_is_dp_dual_mode (dev_priv, port); +}Just use
intel_bios_is_dp_dual_mode()where you need it.
Quoted 8 lines
That wasn't in my original patch, and the commit message lacks any information that the patch has been modified by someone else than the original author. Such things always need to be documented properly!
Anyways, I should just repost my patches separately (with reviews comments addresses where appropriate) so that we can get the basic dual mode stuff in (to fix the 12bpc regressions).
While porting this patch, I had to do some changes, and add wrapper functions due to recent changes in intel_bios.c and code movement to intel_vbt_def.h etc, but I couldn't remember now what was the exact reason. So yeah, having it in the commit message would have been a better idea.
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 5/12 drm/i915: Add lspcon data structures
In reply to Shashank SharmaThis patch adds lspcon structure in intel_dig_port. These strucres will be used to check runtime status of LSPCON device.
--- drivers/gpu/drm/i915/intel_drv.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/gpu/drm/i915/intel_drv.h +16 -0
@@ -859,12 +859,28 @@ struct intel_dp {bool compliance_test_active; }; +/* LSPCON possibe modes of operation */ +enum lspcon_mode { +/* Invalid */ + lspcon_mode_invalid, +/* level shifter mode */ + lspcon_mode_ls, +/* protocol converter mode */ + lspcon_mode_pcon, +}; + +struct intel_lspcon { +bool active; +enum lspcon_mode mode_of_op; +}; +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;
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 6/12 drm/i915: Add new lspcon file
In reply to Shashank SharmaThis patch adds a new file for lspcon with
some basic stuff like:
- Some read/wrire addresses for lspcon device
- Basic read/write functions, using i2c over aux channel
- Utility functions to get lspcon/encoder/connector
--- drivers/gpu/drm/i915/Makefile | 3 +- drivers/gpu/drm/i915/intel_lspcon.c | 56 +++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/i915/intel_lspcon.c
drivers/gpu/drm/i915/Makefile +2 -1
@@ -90,7 +90,8 @@ i915-y += dvo_ch7017.o \ intel_lvds.o \ intel_panel.o \ intel_sdvo.o \ - intel_tv.o + intel_tv.o \ + intel_lspcon.o # virtual gpu code i915-y += i915_vgpu.o
drivers/gpu/drm/i915/intel_lspcon.c new file +56 -0
56 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
Re: [PATCH 06/12] drm/i915: Add new lspcon file
Quoted 63 lines · Shashank Sharma
This patch adds a new file for lspcon with
some basic stuff like:
- Some read/wrire addresses for lspcon device
- Basic read/write functions, using i2c over aux channel
- Utility functions to get lspcon/encoder/connectorSigned-off-by Shashank Sharma <[email protected]>Signed-off-by Akashdeep Sharma <[email protected]>--- drivers/gpu/drm/i915/Makefile | 3 +- drivers/gpu/drm/i915/intel_lspcon.c | 56 +++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/i915/intel_lspcon.cdrivers/gpu/drm/i915/Makefile +2
-1@@ -90,7 +90,8 @@ i915-y += dvo_ch7017.o \ intel_lvds.o \ intel_panel.o \ intel_sdvo.o \ - intel_tv.o + intel_tv.o \ + intel_lspcon.o # virtual gpu code i915-y += i915_vgpu.odrivers/gpu/drm/i915/intel_lspcon.c new file +29
-0@@ -0,0 +1,56 @@ +/* +* Copyright © 2016 Intel Corporation +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* DEALINGS IN THE SOFTWARE. +* +* Authors: +* Shashank Sharma <[email protected]> +* Akashdeep Sharma <[email protected]> +* +*/ +#include <drm/drm_edid.h> +#include <drm/drm_atomic_helper.h>
drivers/gpu/drm/i915/intel_lspcon.c line 39
Quoted 10 lines
drivers/gpu/drm/i915/intel_lspcon.c new file +10
-0+#include <drm/drm_dp_dual_mode_helper.h> +#include "intel_drv.h" + +#define LSPCON_I2C_ADDRESS 0x80 +#define LSPCON_MODE_CHANGE_OFFSET 0x40 +#define LSPCON_MODE_CHECK_OFFSET 0x41 +#define LSPCON_ADAPTER_SIGN_OFFSET 0x00 +#define LSPCON_IDENTIFIER_OFFSET 0x10 +#define LSPCON_IDENTIFIER_LENGTH 0x10 +#define LSPCON_MODE_MASK 0x1
Bunch of these seem like duplicates of the dp++ stuff.
Quoted 19 lines
drivers/gpu/drm/i915/intel_lspcon.c new file +17
-0+ +struct intel_digital_port *lspcon_to_dig_port (struct intel_lspcon *lspcon) +{ + return container_of(lspcon, struct intel_digital_port, lspcon); +} + +struct intel_hdmi *lspcon_to_hdmi (struct intel_lspcon *lspcon) +{ +return &lspcon_to_dig_port (lspcon)->hdmi; +} + +struct intel_lspcon *enc_to_lspcon (struct drm_encoder *encoder) +{ +struct intel_digital_port *intel_dig_port = + container_of(encoder, struct intel_digital_port, base.base); +return &intel_dig_port->lspcon; +}Signature · 1 line
1.9.1
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 06/12] drm/i915: Add new lspcon file
Regards
Shashank
Quoted 68 lines · Ville Syrjälä
Quoted 67 lines · Shashank Sharma
This patch adds a new file for lspcon with
some basic stuff like:
- Some read/wrire addresses for lspcon device
- Basic read/write functions, using i2c over aux channel
- Utility functions to get lspcon/encoder/connectorSigned-off-by Shashank Sharma <[email protected]>Signed-off-by Akashdeep Sharma <[email protected]>--- drivers/gpu/drm/i915/Makefile | 3 +- drivers/gpu/drm/i915/intel_lspcon.c | 56 +++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-)create mode 100644
drivers/gpu/drm/i915/intel_lspcon.cdrivers/gpu/drm/i915/Makefile +2
-1@@ -90,7 +90,8 @@ i915-y += dvo_ch7017.o \ intel_lvds.o \ intel_panel.o \ intel_sdvo.o \ - intel_tv.o + intel_tv.o \ + intel_lspcon.o # virtual gpu code i915-y += i915_vgpu.odrivers/gpu/drm/i915/intel_lspcon.c new file +33
-0@@ -0,0 +1,56 @@ +/* +* Copyright © 2016 Intel Corporation +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* DEALINGS IN THE SOFTWARE. +* +* Authors: +* Shashank Sharma <[email protected]> +* Akashdeep Sharma <[email protected]> +* +*/ +#include <drm/drm_edid.h> +#include <drm/drm_atomic_helper.h> +#include <drm/drm_dp_dual_mode_helper.h> +#include "intel_drv.h" + +#define LSPCON_I2C_ADDRESS 0x80
Quoted 8 lines
drivers/gpu/drm/i915/intel_lspcon.c line 39
Quoted 6 lines
drivers/gpu/drm/i915/intel_lspcon.c new file +6
-0+#define LSPCON_MODE_CHANGE_OFFSET 0x40 +#define LSPCON_MODE_CHECK_OFFSET 0x41 +#define LSPCON_ADAPTER_SIGN_OFFSET 0x00 +#define LSPCON_IDENTIFIER_OFFSET 0x10 +#define LSPCON_IDENTIFIER_LENGTH 0x10 +#define LSPCON_MODE_MASK 0x1Bunch of these seem like duplicates of the dp++ stuff.
Yeah, you are right, 0x80, and 0x10 (identifier offset and length) is same for dp-dual mode adapters. But mode_check and sign offsets are specific to LSPCON. I can reuse few from DP++
Quoted 12 lines
Quoted 12 lines
drivers/gpu/drm/i915/intel_lspcon.c new file +11
-0+ +struct intel_digital_port *lspcon_to_dig_port (struct intel_lspcon *lspcon) +{ + return container_of(lspcon, struct intel_digital_port, lspcon); +} + +struct intel_hdmi *lspcon_to_hdmi (struct intel_lspcon *lspcon) +{ +return &lspcon_to_dig_port (lspcon)->hdmi; +} +
Quoted 9 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_lspcon.c new file +6
-1+struct intel_lspcon *enc_to_lspcon (struct drm_encoder *encoder) +{ +struct intel_digital_port *intel_dig_port = + container_of(encoder, struct intel_digital_port, base.base); +return &intel_dig_port->lspcon; +} --1.9.1
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Jani Nikula
maintainerRe: [PATCH 06/12] drm/i915: Add new lspcon file
In reply to Shashank SharmaQuoted 19 lines · Shashank Sharma
This patch adds a new file for lspcon with
some basic stuff like:
- Some read/wrire addresses for lspcon device
- Basic read/write functions, using i2c over aux channel
- Utility functions to get lspcon/encoder/connectorSigned-off-by Shashank Sharma <[email protected]>Signed-off-by Akashdeep Sharma <[email protected]>--- drivers/gpu/drm/i915/Makefile | 3 +- drivers/gpu/drm/i915/intel_lspcon.c | 56 +++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/i915/intel_lspcon.cdrivers/gpu/drm/i915/Makefile +0
-0
drivers/gpu/drm/i915/Makefile i915-y += dvo_ch7017.o \ · line 94
Quoted 6 lines
drivers/gpu/drm/i915/Makefile +2
-1@@ -90,7 +90,8 @@ i915-y += dvo_ch7017.o \ intel_lvds.o \ intel_panel.o \ intel_sdvo.o \ - intel_tv.o + intel_tv.o \ + intel_lspcon.o
At the top of the Makefile:
# Please keep these build lists sorted!
BR,
Jani.
Quoted 65 lines
drivers/gpu/drm/i915/Makefile +0
-0# virtual gpu code i915-y += i915_vgpu.odrivers/gpu/drm/i915/intel_lspcon.c new file +56
-0@@ -0,0 +1,56 @@ +/* +* Copyright © 2016 Intel Corporation +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* DEALINGS IN THE SOFTWARE. +* +* Authors: +* Shashank Sharma <[email protected]> +* Akashdeep Sharma <[email protected]> +* +*/ +#include <drm/drm_edid.h> +#include <drm/drm_atomic_helper.h> +#include <drm/drm_dp_dual_mode_helper.h> +#include "intel_drv.h" + +#define LSPCON_I2C_ADDRESS 0x80 +#define LSPCON_MODE_CHANGE_OFFSET 0x40 +#define LSPCON_MODE_CHECK_OFFSET 0x41 +#define LSPCON_ADAPTER_SIGN_OFFSET 0x00 +#define LSPCON_IDENTIFIER_OFFSET 0x10 +#define LSPCON_IDENTIFIER_LENGTH 0x10 +#define LSPCON_MODE_MASK 0x1 + +struct intel_digital_port *lspcon_to_dig_port (struct intel_lspcon *lspcon) +{ + return container_of(lspcon, struct intel_digital_port, lspcon); +} + +struct intel_hdmi *lspcon_to_hdmi (struct intel_lspcon *lspcon) +{ +return &lspcon_to_dig_port (lspcon)->hdmi; +} + +struct intel_lspcon *enc_to_lspcon (struct drm_encoder *encoder) +{ +struct intel_digital_port *intel_dig_port = + container_of(encoder, struct intel_digital_port, base.base); +return &intel_dig_port->lspcon; +}
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: [PATCH 06/12] drm/i915: Add new lspcon file
Regards
Shashank
Quoted 29 lines · Jani Nikula
Quoted 19 lines · Shashank Sharma
This patch adds a new file for lspcon with
some basic stuff like:
- Some read/wrire addresses for lspcon device
- Basic read/write functions, using i2c over aux channel
- Utility functions to get lspcon/encoder/connectorSigned-off-by Shashank Sharma <[email protected]>Signed-off-by Akashdeep Sharma <[email protected]>--- drivers/gpu/drm/i915/Makefile | 3 +- drivers/gpu/drm/i915/intel_lspcon.c | 56 +++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-)create mode 100644
drivers/gpu/drm/i915/intel_lspcon.cdrivers/gpu/drm/i915/Makefile +0
-0drivers/gpu/drm/i915/Makefile i915-y += dvo_ch7017.o \ · line 94
Quoted 6 lines
drivers/gpu/drm/i915/Makefile +2
-1@@ -90,7 +90,8 @@ i915-y += dvo_ch7017.o \ intel_lvds.o \ intel_panel.o \ intel_sdvo.o \ - intel_tv.o + intel_tv.o \ + intel_lspcon.oAt the top of the
Makefile:
Quoted 2 lines
# Please keep these build lists sorted!
Ah, dint notice the sorting :), will do that.
Quoted 63 lines
BR,
Jani.Quoted 57 lines
drivers/gpu/drm/i915/Makefile +0
-0# virtual gpu code i915-y += i915_vgpu.odrivers/gpu/drm/i915/intel_lspcon.c new file +48
-0@@ -0,0 +1,56 @@ +/* +* Copyright © 2016 Intel Corporation +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* DEALINGS IN THE SOFTWARE. +* +* Authors: +* Shashank Sharma <[email protected]> +* Akashdeep Sharma <[email protected]> +* +*/ +#include <drm/drm_edid.h> +#include <drm/drm_atomic_helper.h> +#include <drm/drm_dp_dual_mode_helper.h> +#include "intel_drv.h" + +#define LSPCON_I2C_ADDRESS 0x80 +#define LSPCON_MODE_CHANGE_OFFSET 0x40 +#define LSPCON_MODE_CHECK_OFFSET 0x41 +#define LSPCON_ADAPTER_SIGN_OFFSET 0x00 +#define LSPCON_IDENTIFIER_OFFSET 0x10 +#define LSPCON_IDENTIFIER_LENGTH 0x10 +#define LSPCON_MODE_MASK 0x1 + +struct intel_digital_port *lspcon_to_dig_port (struct intel_lspcon *lspcon) +{ + return container_of(lspcon, struct intel_digital_port, lspcon); +} + +struct intel_hdmi *lspcon_to_hdmi (struct intel_lspcon *lspcon) +{ +return &lspcon_to_dig_port (lspcon)->hdmi;
Quoted 9 lines
drivers/gpu/drm/i915/intel_lspcon.c line 56
Quoted 8 lines
drivers/gpu/drm/i915/intel_lspcon.c new file +8
-0+} + +struct intel_lspcon *enc_to_lspcon (struct drm_encoder *encoder) +{ +struct intel_digital_port *intel_dig_port = + container_of(encoder, struct intel_digital_port, base.base); +return &intel_dig_port->lspcon; +}
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 7/12 drm/i915: Add and initialize lspcon connector
In reply to Shashank Sharmalspcon is a device which acts as DP in some cases
and as HDMI in some. Here is how:
- lspcon needs DP(aux) for all the i2c_ove_aux read/write transitions so it needs to have some DP level initializations
- lspcon is detected by userspace/sink as HDMI device, so it needs to be detectd as HDMI device.
This patch adds a custom connector for lspcon device, which can pick and chose what it wants from existing functionality.
This patch also adds functions to initialize dp and hdmi connectors and structures to the minimum required levels, and then play around.
--- drivers/gpu/drm/i915/intel_dp.c | 31 +++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 4 ++ drivers/gpu/drm/i915/intel_hdmi.c | 17 ++++++++ drivers/gpu/drm/i915/intel_lspcon.c | 79 +++++++++++++++++++++++++++++++++++++ 4 files changed, 131 insertions(+)
drivers/gpu/drm/i915/intel_dp.c +31 -0
@@ -5900,6 +5900,37 @@ fail:return false; } +int intel_dp_init_minimum (struct intel_digital_port *intel_dig_port, +struct intel_connector *intel_connector) +{ +int ret; +enum port port = intel_dig_port->port; +struct intel_dp *intel_dp = &intel_dig_port->dp; +struct drm_device *dev = intel_dig_port->base.base.dev; +struct drm_i915_private *dev_priv = dev->dev_private; + + intel_dig_port->dp.output_reg =DDI_BUF_CTL (port); +if (WARN (intel_dig_port->max_lanes <1 , +"Not enough lanes (%d) for DP on port %c\n" , + intel_dig_port->max_lanes,port_name (port))) +return -EINVAL ; + + intel_dp->pps_pipe =INVALID_PIPE ; + intel_dp->get_aux_clock_divider = skl_get_aux_clock_divider; + intel_dp->get_aux_send_ctl = skl_get_aux_send_ctl; + intel_dp->prepare_link_retrain = intel_ddi_prepare_link_retrain; + intel_dp->DP =I915_READ (intel_dp->output_reg); + intel_dp->attached_connector = intel_connector; +INIT_DELAYED_WORK (&intel_dp->panel_vdd_work, + edp_panel_vdd_work); + + ret =intel_dp_aux_init (intel_dp, intel_connector); +if (ret) +DRM_ERROR ("Aux init for LSPCON failed\n" ); + +return ret; +} +void intel_dp_init (struct drm_device *dev,i915_reg_t output_reg,enum port port)
drivers/gpu/drm/i915/intel_drv.h +4 -0
@@ -1332,6 +1332,8 @@ void intel_dp_compute_rate(struct intel_dp *intel_dp, int port_clock,bool intel_dp_source_supports_hbr2 (struct intel_dp *intel_dp);bool intel_dp_get_link_status (struct intel_dp *intel_dp,uint8_t link_status[DP_LINK_STATUS_SIZE ]); +int intel_dp_init_minimum (struct intel_digital_port *intel_dig_port, +struct intel_connector *intel_connector);/* intel_dp_mst.c */ int intel_dp_mst_encoder_init (struct intel_digital_port *intel_dig_port,int conn_id);
@@ -1397,6 +1399,8 @@ void intel_fbc_cleanup_cfb(struct drm_i915_private *dev_priv);void intel_hdmi_init (struct drm_device *dev,i915_reg_t hdmi_reg,enum port port);void intel_hdmi_init_connector (struct intel_digital_port *intel_dig_port,struct intel_connector *intel_connector); +int intel_hdmi_init_minimum (struct intel_digital_port *intel_dig_port, +struct intel_connector *intel_connector);struct intel_hdmi *enc_to_intel_hdmi (struct drm_encoder *encoder);bool intel_hdmi_compute_config (struct intel_encoder *encoder,struct intel_crtc_state *pipe_config);
drivers/gpu/drm/i915/intel_hdmi.c +17 -0
@@ -2128,6 +2128,23 @@ intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *c intel_hdmi->aspect_ratio =HDMI_PICTURE_ASPECT_NONE ; } +int intel_hdmi_init_minimum (struct intel_digital_port *intel_dig_port, +struct intel_connector *intel_connector) +{ +struct intel_hdmi *intel_hdmi = &intel_dig_port->hdmi; + +if (WARN (intel_dig_port->max_lanes <4 , +"Not enough lanes (%d) for HDMI on port %c\n" , + intel_dig_port->max_lanes,port_name (intel_dig_port->port))) +return -EINVAL ; + + intel_hdmi->write_infoframe = hsw_write_infoframe; + intel_hdmi->set_infoframes = hsw_set_infoframes; + intel_hdmi->infoframe_enabled = hsw_infoframe_enabled; + intel_hdmi->attached_connector = intel_connector; +return 0 ; +} +void intel_hdmi_init_connector (struct intel_digital_port *intel_dig_port,struct intel_connector *intel_connector) {
drivers/gpu/drm/i915/intel_lspcon.c +79 -0
82 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
Re: [PATCH 07/12] drm/i915: Add and initialize lspcon connector
Em Seg, 2016-04-04 às 17:31 +0530, Shashank Sharma escreveu:
Quoted 7 lines
lspcon is a device which acts as DP in some cases
and as HDMI in some. Here is how:
- lspcon needs DP(aux) for all thei2c_ove_auxread/write transitions so it needs to have some DP level initializations
- lspcon is detected by userspace/sink as HDMI device, so it needs to be detectd as HDMI device.
Quoted 5 lines
This patch adds a custom connector for lspcon device, which can pick and chose what it wants from existing functionality.
This patch also adds functions to initialize dp and hdmi connectors and structures to the minimum required levels, and then play around.
Hi
I realized I only said this in private discussions, but never in the mailing list, so let's bring it to the list so more people can join:
My problem with this approach of adding a new connector is the amount of duplicated code it brings. Considering our constant never-ending code churn, added with the current plans to rework major pieces of the DP code, I would estimate that this lspcon connector code would very quickly get out-of-sync and, as a consequence, broken, due to the fact that it's very likely that someone would forget to patch the lspcon connector during reworks of DP/HDMI connectors. So my current suggestion would be to just add the necessary LSPCON bits to the HDMI and DP detection functions instead of adding a whole new connector. Maybe we could even merge/integrate the DP and HDMI connector functions since in the end both functions are probing the same port, and if one connector is found, the other connector is certainly not present.
I can also provide are more technical lower-level review of the code itself, but I think we should focus the discussion in the high level design for now.
Thanks,
Paulo
Quoted 207 lines
Signed-off-by Shashank Sharma <[email protected]>---
drivers/gpu/drm/i915/intel_dp.c | 31 +++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 4 ++ drivers/gpu/drm/i915/intel_hdmi.c | 17 ++++++++drivers/gpu/drm/i915/intel_lspcon.c| 79
+++++++++++++++++++++++++++++++++++++4 files changed, 131 insertions(+)drivers/gpu/drm/i915/intel_dp.c +0
-0@@ -5900,6 +5900,37 @@ fail: return false; }drivers/gpu/drm/i915/intel_dp.c +19
-0+int intel_dp_init_minimum (struct intel_digital_port *intel_dig_port, +struct intel_connector *intel_connector) +{ +int ret; +enum port port = intel_dig_port->port; +struct intel_dp *intel_dp = &intel_dig_port->dp; +struct drm_device *dev = intel_dig_port->base.base.dev; +struct drm_i915_private *dev_priv = dev->dev_private; + + intel_dig_port->dp.output_reg =DDI_BUF_CTL (port); +if (WARN (intel_dig_port->max_lanes <1 , + "Not enough lanes (%d) for DP on port %c\n", + intel_dig_port->max_lanes, port_name(port))) +return -EINVAL ; + + intel_dp->pps_pipe =INVALID_PIPE ; + intel_dp->get_aux_clock_divider = skl_get_aux_clock_divider; + intel_dp->get_aux_send_ctl = skl_get_aux_send_ctl; + intel_dp->prepare_link_retrain =
intel_ddi_prepare_link_retrain;drivers/gpu/drm/i915/intel_dp.c +12
-0+ intel_dp->DP =I915_READ (intel_dp->output_reg); + intel_dp->attached_connector = intel_connector; +INIT_DELAYED_WORK (&intel_dp->panel_vdd_work, + edp_panel_vdd_work); + + ret =intel_dp_aux_init (intel_dp, intel_connector); +if (ret) +DRM_ERROR ("Aux init for LSPCON failed\n" ); + +return ret; +} +void
intel_dp_init(structdrm_device*dev,i915_reg_toutput_reg, enum port port)drivers/gpu/drm/i915/intel_drv.h +0
-0@@ -1332,6 +1332,8 @@ void intel_dp_compute_rate(struct intel_dp *intel_dp, int port_clock, bool intel_dp_source_supports_hbr2(struct intel_dp *intel_dp);bool
intel_dp_get_link_status(structintel_dp*intel_dp,uint8_tlink_status[DP_LINK_STATUS_SIZE]);drivers/gpu/drm/i915/intel_drv.h +2
-0+int intel_dp_init_minimum (struct intel_digital_port *intel_dig_port, +struct intel_connector *intel_connector);
/*intel_dp_mst.c*/
intintel_dp_mst_encoder_init(struct intel_digital_port *intel_dig_port, int conn_id);drivers/gpu/drm/i915/intel_drv.h +0
-0@@ -1397,6 +1399,8 @@ void intel_fbc_cleanup_cfb(struct drm_i915_private *dev_priv); void intel_hdmi_init(struct drm_device *dev, i915_reg_t hdmi_reg,enum port port);void intel_hdmi_init_connector(struct
intel_digital_port*intel_dig_port,
structintel_connector*intel_connector);
+int intel_hdmi_init_minimum(structintel_digital_port*intel_dig_port,drivers/gpu/drm/i915/intel_drv.h +1
-0+struct intel_connector
*intel_connector);
structintel_hdmi*enc_to_intel_hdmi(structdrm_encoder*encoder); boolintel_hdmi_compute_config(struct intel_encoder *encoder, struct intel_crtc_state *pipe_config);drivers/gpu/drm/i915/intel_hdmi.c +0
-0@@ -2128,6 +2128,23 @@ intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *c intel_hdmi->aspect_ratio = HDMI_PICTURE_ASPECT_NONE; }
+int intel_hdmi_init_minimum(structintel_digital_port*intel_dig_port,drivers/gpu/drm/i915/intel_hdmi.c +1
-0+ struct intel_connector
*intel_connector)drivers/gpu/drm/i915/intel_hdmi.c +6
-0+{ +struct intel_hdmi *intel_hdmi = &intel_dig_port->hdmi; + + if (WARN(intel_dig_port->max_lanes < 4, + "Not enough lanes (%d) for HDMI on port %c\n", + intel_dig_port->max_lanes, port_name(intel_dig_port-Quoted 1 line
port)))
drivers/gpu/drm/i915/intel_hdmi.c +9
-0+return -EINVAL ; + + intel_hdmi->write_infoframe = hsw_write_infoframe; + intel_hdmi->set_infoframes = hsw_set_infoframes; + intel_hdmi->infoframe_enabled = hsw_infoframe_enabled; + intel_hdmi->attached_connector = intel_connector; +return 0 ; +} +void intel_hdmi_init_connector(struct
intel_digital_port*intel_dig_port,
structintel_connector*intel_connector)
{drivers/gpu/drm/i915/intel_lspcon.c +0
-0@@ -54,3 +54,82 @@ struct intel_lspcon *enc_to_lspcon(struct drm_encoder *encoder) container_of(encoder, struct intel_digital_port, base.base);return
&intel_dig_port->lspcon;
}drivers/gpu/drm/i915/intel_lspcon.c +2
-0+ +int intel_lspcon_init_connector(struct intel_digital_port
*intel_dig_port)drivers/gpu/drm/i915/intel_lspcon.c +19
-0+{ +int ret; +struct intel_encoder *intel_encoder = &intel_dig_port->base; +struct drm_device *dev = intel_encoder->base.dev; +struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_connector *intel_connector; +struct drm_connector *connector; +enum port port = intel_dig_port->port; + + intel_connector =intel_connector_alloc (); +if (!intel_connector) +return -ENOMEM ; + + connector = &intel_connector->base; + connector->interlace_allowed = true; + connector->doublescan_allowed =0 ; + +/* init DP */ + ret = intel_dp_init_minimum(intel_dig_port,
intel_connector);drivers/gpu/drm/i915/intel_lspcon.c +7
-0+if (ret) { +DRM_ERROR ("DP init for LSPCON failed\n" ); +return ret; + } + +/* init HDMI */ + ret = intel_hdmi_init_minimum(intel_dig_port,
intel_connector);drivers/gpu/drm/i915/intel_lspcon.c +39
-0+if (ret) { +DRM_ERROR ("HDMI init for LSPCON failed\n" ); +return ret; + } + +/* Set up the hotplug pin. */ +switch (port) { +case PORT_A : + intel_encoder->hpd_pin =HPD_PORT_A ; +break ; +case PORT_B : + intel_encoder->hpd_pin =HPD_PORT_B ; +if (IS_BXT_REVID (dev,0 ,BXT_REVID_A1 )) + intel_encoder->hpd_pin =HPD_PORT_A ; +break ; +case PORT_C : + intel_encoder->hpd_pin =HPD_PORT_C ; +break ; +case PORT_D : + intel_encoder->hpd_pin =HPD_PORT_D ; +break ; +case PORT_E : + intel_encoder->hpd_pin =HPD_PORT_E ; +break ; +default : +DRM_ERROR ("Invalid port to configure LSPCON\n" ); +return -EINVAL ; + } + +/* +* On BXT A0/A1, sw needs to activate DDIA HPD logic and +* interrupts to check the external panel connection. +*/ +if (IS_BXT_REVID (dev,0 ,BXT_REVID_A1 ) && port ==PORT_B ) + dev_priv->hotplug.irq_port[PORT_A ] = intel_dig_port; +else + dev_priv->hotplug.irq_port[port] = intel_dig_port; + +/* For G4X desktop chip, PEG_BAND_GAP_DATA 3:0 must first be written
drivers/gpu/drm/i915/intel_lspcon.c +1
-0+* 0xd. Failure to do so will result in spurious interrupts being
drivers/gpu/drm/i915/intel_lspcon.c +1
-0+* generated on the port when a cable is not attached.
drivers/gpu/drm/i915/intel_lspcon.c struct intel_lspcon *enc_to_lspcon(struct drm_encoder *encoder) · line 135
Quoted 10 lines
drivers/gpu/drm/i915/intel_lspcon.c +10
-0+*/ +if (IS_G4X (dev) && !IS_GM45 (dev)) { +u32 temp =I915_READ (PEG_BAND_GAP_DATA ); + +I915_WRITE (PEG_BAND_GAP_DATA , (temp & ~0xf ) |0xd ); + } + +DRM_DEBUG_DRIVER ("Success: LSPCON connector init\n" ); +return 0 ; +}
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 8/12 drm: Add lspcon (custom type2 dp->hdmi) support
In reply to Shashank SharmaThis patch adds support for LSPCON devices in dp++ adaptor helper layer. LSPCON is DP++ type-2 adaptor with some customized functionalities, to provide additional features in Intel Gen9 HW.
LSPCON needs I2C-over-aux support to read/write control and data registers. This patch adds following:
- Functions for I2C over aux read/write
- Function to read EDID using I2c-over-aux
- Function to identify LSPCON among type-2 DP adaptors
--- drivers/gpu/drm/drm_dp_dual_mode_helper.c | 100 ++++++++++++++++++++++++++++++ include/drm/drm_dp_dual_mode_helper.h | 10 +++ 2 files changed, 110 insertions(+)
drivers/gpu/drm/drm_dp_dual_mode_helper.c +100 -0
@@ -132,6 +132,99 @@ ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter, }EXPORT_SYMBOL (drm_dp_dual_mode_write); +int drm_dp_dual_mode_get_edid (void *data, +u8 *buf,unsigned int block,size_t len) +{ +struct i2c_adapter *adapter = data; +unsigned char start = block *EDID_LENGTH ; +unsigned char segment = block >>1 ; +unsigned char xfers = segment ?3 :2 ; +int ret, retries =5 ; + +do { +struct i2c_msg msgs[] = { + { + .addr =DP_DUAL_MODE_DDC_SEGMENT_ADDR , + .flags =0 , + .len =1 , + .buf = &segment, + }, { + .addr =DDC_ADDR , + .flags =0 , + .len =1 , + .buf = &start, + }, { + .addr =DDC_ADDR , + .flags =I2C_M_RD , + .len = len, + .buf = buf, + } + }; + + ret = adapter->algo->master_xfer (adapter, &msgs[3 - xfers], + xfers); + +if (ret == -ENXIO ) { +DRM_ERROR ("Non-existent adapter %s\n" , + adapter->name); +break ; + } + }while (ret != xfers && --retries); + +return ret == xfers ?0 :-1 ; +} +EXPORT_SYMBOL (drm_dp_dual_mode_get_edid); + +/* +* drm_dp_dual_mode_ioa_xfer +* Few dp->hdmi type 2 adaptors allow i2c_over_aux read/write +* to the control and status registers. These functions help +* to read/write from those. +*/ +static int drm_dp_dual_mode_ioa_xfer (struct i2c_adapter *adapter, +u8 *buffer,u8 offset,u8 no_of_bytes,u8 rw_flag) +{ +int err =0 ; + +struct i2c_msg msgs[] = { + { + .addr =DP_DUAL_MODE_SLAVE_ADDRESS , + .flags =0 , + .len =1 , + .buf = &offset, + }, { + .addr =DP_DUAL_MODE_SLAVE_ADDRESS , + .flags = rw_flag, + .len = no_of_bytes, + .buf = buffer, + } + }; + +/* I2C over AUX here */ + err = adapter->algo->master_xfer (adapter, msgs,2 ); +if (err <0 ) +DRM_ERROR ("LSPCON: Failed I2C over Aux read(addr=0x%x)\n" , + (unsigned int )offset); + +return err; +} + +int drm_dp_dual_mode_ioa_read (struct i2c_adapter *adapter,u8 *buffer, +u8 offset,u8 no_of_bytes) +{ +return drm_dp_dual_mode_ioa_xfer (adapter, buffer, offset, + no_of_bytes,I2C_M_RD ); +} +EXPORT_SYMBOL (drm_dp_dual_mode_ioa_read); + +int drm_dp_dual_mode_ioa_write (struct i2c_adapter *adapter,u8 *buffer, +u8 offset,u8 no_of_bytes) +{ +return drm_dp_dual_mode_ioa_xfer (adapter, buffer, offset, + no_of_bytes,0 ); +} +EXPORT_SYMBOL (drm_dp_dual_mode_ioa_write); +static bool is_hdmi_adaptor (const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN ]) { static const char dp_dual_mode_hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN] =
@@ -141,6 +234,11 @@ static bool is_hdmi_adaptor(const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN]) sizeof(dp_dual_mode_hdmi_id)) == 0; } +bool is_lspcon_adaptor (const uint8_t adaptor_id) +{ +return adaptor_id ==0xa8 ; +} +/** * drm_dp_dual_mode_detect - Identyfy the DP dual mode adaptor * adapter: I2C adapter for the DDC bus
@@ -197,6 +295,8 @@ enum drm_dp_dual_mode_type drm_dp_dual_mode_detect(struct i2c_adapter *adapter) &adaptor_id, sizeof(adaptor_id));if (ret || (adaptor_id != (DP_DUAL_MODE_TYPE_TYPE2 |DP_DUAL_MODE_REV_TYPE2 ))) { +if (is_lspcon_adaptor (adaptor_id)) +return DRM_DP_DUAL_MODE_TYPE2_LSPCON ;if (is_hdmi_adaptor (hdmi_id))return DRM_DP_DUAL_MODE_TYPE1_HDMI ;else
include/drm/drm_dp_dual_mode_helper.h +10 -0
@@ -24,6 +24,7 @@#define DRM_DP_DUAL_MODE_HELPER_H #include <linux/types.h> +#include <drm/drm_edid.h> /* * Optional for type 1 DVI adaptors
@@ -55,6 +56,7 @@#define DP_DUAL_MODE_CEC_ENABLE 0x01#define DP_DUAL_MODE_I2C_SPEED_CTRL 0x22#define DP_DUAL_MODE_LAST_RESERVED 0xff +#define DP_DUAL_MODE_DDC_SEGMENT_ADDR 0x30struct i2c_adapter ;
@@ -69,6 +71,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_TYPE2_LSPCON, };enum drm_dp_dual_mode_type drm_dp_dual_mode_detect (struct i2c_adapter *adapter);
@@ -81,4 +84,11 @@ drm_dp_dual_mode_set_tmds_output(struct i2c_adapter *adapter, bool enable);const char *drm_dp_get_dual_mode_type_name (enum drm_dp_dual_mode_type type); +int drm_dp_dual_mode_ioa_read (struct i2c_adapter *adapter,u8 *buffer, +u8 offset,u8 no_of_bytes); +int drm_dp_dual_mode_ioa_write (struct i2c_adapter *adapter,u8 *buffer, +u8 offset,u8 no_of_bytes); +int drm_dp_dual_mode_get_edid (void *data, +u8 *buf,unsigned int block,size_t len); +#endif
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 08/12] drm: Add lspcon (custom type2 dp->hdmi) support
Quoted 56 lines · Shashank Sharma
This patch adds support for LSPCON devices in dp++ adaptor helper layer. LSPCON is DP++ type-2 adaptor with some customized functionalities, to provide additional features in Intel Gen9 HW.
LSPCON needs I2C-over-aux support to read/write control and data registers. This patch adds following:
- Functions for I2C over aux read/write
- Function to read EDID using I2c-over-aux
- Function to identify LSPCON among type-2 DP adaptorsSigned-off-by Shashank Sharma <[email protected]>--- drivers/gpu/drm/drm_dp_dual_mode_helper.c | 100 ++++++++++++++++++++++++++++++ include/drm/drm_dp_dual_mode_helper.h | 10 +++ 2 files changed, 110 insertions(+)drivers/gpu/drm/drm_dp_dual_mode_helper.c +32
-0@@ -132,6 +132,99 @@ ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter, }EXPORT_SYMBOL (drm_dp_dual_mode_write); +int drm_dp_dual_mode_get_edid (void *data, +u8 *buf,unsigned int block,size_t len) +{ +struct i2c_adapter *adapter = data; +unsigned char start = block *EDID_LENGTH ; +unsigned char segment = block >>1 ; +unsigned char xfers = segment ?3 :2 ; +int ret, retries =5 ; + + do { + struct i2c_msg msgs[] = { + { + .addr = DP_DUAL_MODE_DDC_SEGMENT_ADDR, + .flags = 0, + .len = 1, + .buf = &segment, + }, { + .addr = DDC_ADDR, + .flags = 0, + .len = 1, + .buf = &start, + }, { + .addr = DDC_ADDR, + .flags = I2C_M_RD, + .len = len, + .buf = buf, + } + }; + + ret = adapter->algo->master_xfer(adapter, &msgs[3 - xfers], + xfers); +
drivers/gpu/drm/drm_dp_dual_mode_helper.c ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter, · line 176
Quoted 10 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +10
-0+if (ret == -ENXIO ) { +DRM_ERROR ("Non-existent adapter %s\n" , + adapter->name); +break ; + } + }while (ret != xfers && --retries); + +return ret == xfers ?0 :-1 ; +} +EXPORT_SYMBOL (drm_dp_dual_mode_get_edid);
This sort of stuff shouldn't be needed. All that should be needed is passing the right i2c adapter to drm_get_edid() and whatnot.
Quoted 40 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +40
-0+ +/* +* drm_dp_dual_mode_ioa_xfer +* Few dp->hdmi type 2 adaptors allow i2c_over_aux read/write +* to the control and status registers. These functions help +* to read/write from those. +*/ +static int drm_dp_dual_mode_ioa_xfer (struct i2c_adapter *adapter, +u8 *buffer,u8 offset,u8 no_of_bytes,u8 rw_flag) +{ +int err =0 ; + +struct i2c_msg msgs[] = { + { + .addr =DP_DUAL_MODE_SLAVE_ADDRESS , + .flags =0 , + .len =1 , + .buf = &offset, + }, { + .addr =DP_DUAL_MODE_SLAVE_ADDRESS , + .flags = rw_flag, + .len = no_of_bytes, + .buf = buffer, + } + }; + +/* I2C over AUX here */ + err = adapter->algo->master_xfer (adapter, msgs,2 ); +if (err <0 ) +DRM_ERROR ("LSPCON: Failed I2C over Aux read(addr=0x%x)\n" , + (unsigned int )offset); + +return err; +} + +int drm_dp_dual_mode_ioa_read (struct i2c_adapter *adapter,u8 *buffer, +u8 offset,u8 no_of_bytes) +{ +return drm_dp_dual_mode_ioa_xfer (adapter, buffer, offset, + no_of_bytes,I2C_M_RD );
drivers/gpu/drm/drm_dp_dual_mode_helper.c ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter, · line 226
Quoted 10 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +10
-0+} +EXPORT_SYMBOL (drm_dp_dual_mode_ioa_read); + +int drm_dp_dual_mode_ioa_write (struct i2c_adapter *adapter,u8 *buffer, +u8 offset,u8 no_of_bytes) +{ +return drm_dp_dual_mode_ioa_xfer (adapter, buffer, offset, + no_of_bytes,0 ); +} +EXPORT_SYMBOL (drm_dp_dual_mode_ioa_write);
Aren't these just dupes of the dual mode helper read/write functions?
Quoted 17 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +6
-0+static bool is_hdmi_adaptor (const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN ]) { static const char dp_dual_mode_hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN] =@@ -141,6 +234,11 @@ static bool is_hdmi_adaptor(const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN]) sizeof(dp_dual_mode_hdmi_id)) == 0; } +bool is_lspcon_adaptor (const uint8_t adaptor_id) +{ +return adaptor_id ==0xa8 ; +} +/** * drm_dp_dual_mode_detect - Identyfy the DP dual mode adaptor * adapter: I2C adapter for the DDC bus
drivers/gpu/drm/drm_dp_dual_mode_helper.c enum drm_dp_dual_mode_type drm_dp_dual_mode_detect(struct i2c_adapter *adapter) · line 299
Quoted 5 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +2
-0@@ -197,6 +295,8 @@ enum drm_dp_dual_mode_type drm_dp_dual_mode_detect(struct i2c_adapter *adapter) &adaptor_id, sizeof(adaptor_id));if (ret || (adaptor_id != (DP_DUAL_MODE_TYPE_TYPE2 |DP_DUAL_MODE_REV_TYPE2 ))) { +if (is_lspcon_adaptor (adaptor_id)) +return DRM_DP_DUAL_MODE_TYPE2_LSPCON ;
We should reorganize this a bit I think. Probably should end up looking somehting like:
bool is_type2_adaptor();
bool is_lspcon_adaptor();
if (ret == 0) {
if (is_lspcon_adaptor())
return TYPE2_LSPCON;
else if (is_type2_adaptor() && is_hdmi_adaptor)
return TYPE2_HDMI;
else if (is_type2_adaptor())
return TYPE2_DVI;
}if (is_hdmi...)
return TYPE1_HDMI; else return TYPE1_DVI;
Quoted 45 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +0
-0if (is_hdmi_adaptor (hdmi_id))return DRM_DP_DUAL_MODE_TYPE1_HDMI ;else include/drm/drm_dp_dual_mode_helper.h +10
-0@@ -24,6 +24,7 @@#define DRM_DP_DUAL_MODE_HELPER_H #include <linux/types.h> +#include <drm/drm_edid.h> /* * Optional for type 1 DVI adaptors @@ -55,6 +56,7 @@#define DP_DUAL_MODE_CEC_ENABLE 0x01#define DP_DUAL_MODE_I2C_SPEED_CTRL 0x22#define DP_DUAL_MODE_LAST_RESERVED 0xff +#define DP_DUAL_MODE_DDC_SEGMENT_ADDR 0x30struct i2c_adapter ;@@ -69,6 +71,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_TYPE2_LSPCON, };enum drm_dp_dual_mode_type drm_dp_dual_mode_detect (struct i2c_adapter *adapter);@@ -81,4 +84,11 @@ drm_dp_dual_mode_set_tmds_output(struct i2c_adapter *adapter, bool enable);const char *drm_dp_get_dual_mode_type_name (enum drm_dp_dual_mode_type type); +int drm_dp_dual_mode_ioa_read (struct i2c_adapter *adapter,u8 *buffer, +u8 offset,u8 no_of_bytes); +int drm_dp_dual_mode_ioa_write (struct i2c_adapter *adapter,u8 *buffer, +u8 offset,u8 no_of_bytes); +int drm_dp_dual_mode_get_edid (void *data, +u8 *buf,unsigned int block,size_t len); +#endif Signature · 1 line
1.9.1
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 08/12] drm: Add lspcon (custom type2 dp->hdmi) support
Regards
Shashank
Quoted 62 lines · Ville Syrjälä
Quoted 61 lines · Shashank Sharma
This patch adds support for LSPCON devices in dp++ adaptor helper layer. LSPCON is DP++ type-2 adaptor with some customized functionalities, to provide additional features in Intel Gen9 HW.
LSPCON needs I2C-over-aux support to read/write control and data registers. This patch adds following:
- Functions for I2C over aux read/write
- Function to read EDID using I2c-over-aux
- Function to identify LSPCON among type-2 DP adaptorsSigned-off-by Shashank Sharma <[email protected]>--- drivers/gpu/drm/drm_dp_dual_mode_helper.c | 100 ++++++++++++++++++++++++++++++ include/drm/drm_dp_dual_mode_helper.h | 10 +++ 2 files changed, 110 insertions(+)drivers/gpu/drm/drm_dp_dual_mode_helper.c +37
-0@@ -132,6 +132,99 @@ ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter, }EXPORT_SYMBOL (drm_dp_dual_mode_write); +int drm_dp_dual_mode_get_edid (void *data, +u8 *buf,unsigned int block,size_t len) +{ +struct i2c_adapter *adapter = data; +unsigned char start = block *EDID_LENGTH ; +unsigned char segment = block >>1 ; +unsigned char xfers = segment ?3 :2 ; +int ret, retries =5 ; + + do { + struct i2c_msg msgs[] = { + { + .addr = DP_DUAL_MODE_DDC_SEGMENT_ADDR, + .flags = 0, + .len = 1, + .buf = &segment, + }, { + .addr = DDC_ADDR, + .flags = 0, + .len = 1, + .buf = &start, + }, { + .addr = DDC_ADDR, + .flags = I2C_M_RD, + .len = len, + .buf = buf, + } + }; + + ret = adapter->algo->master_xfer(adapter, &msgs[3 - xfers], + xfers); + + if (ret == -ENXIO) { + DRM_ERROR("Non-existent adapter %s\n", + adapter->name); + break; + }
Quoted 9 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter, · line 176
Quoted 5 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +5
-0+ }while (ret != xfers && --retries); + +return ret == xfers ?0 :-1 ; +} +EXPORT_SYMBOL (drm_dp_dual_mode_get_edid);This sort of stuff shouldn't be needed. All that should be needed is passing the right i2c adapter to
drm_get_edid()and whatnot.
Yeah, agree, we can optimize this.
Quoted 44 lines
Quoted 44 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +44
-0+ +/* +* drm_dp_dual_mode_ioa_xfer +* Few dp->hdmi type 2 adaptors allow i2c_over_aux read/write +* to the control and status registers. These functions help +* to read/write from those. +*/ +static int drm_dp_dual_mode_ioa_xfer (struct i2c_adapter *adapter, +u8 *buffer,u8 offset,u8 no_of_bytes,u8 rw_flag) +{ +int err =0 ; + +struct i2c_msg msgs[] = { + { + .addr =DP_DUAL_MODE_SLAVE_ADDRESS , + .flags =0 , + .len =1 , + .buf = &offset, + }, { + .addr =DP_DUAL_MODE_SLAVE_ADDRESS , + .flags = rw_flag, + .len = no_of_bytes, + .buf = buffer, + } + }; + +/* I2C over AUX here */ + err = adapter->algo->master_xfer (adapter, msgs,2 ); +if (err <0 ) +DRM_ERROR ("LSPCON: Failed I2C over Aux read(addr=0x%x)\n" , + (unsigned int )offset); + +return err; +} + +int drm_dp_dual_mode_ioa_read (struct i2c_adapter *adapter,u8 *buffer, +u8 offset,u8 no_of_bytes) +{ +return drm_dp_dual_mode_ioa_xfer (adapter, buffer, offset, + no_of_bytes,I2C_M_RD ); +} +EXPORT_SYMBOL (drm_dp_dual_mode_ioa_read); + +int drm_dp_dual_mode_ioa_write(struct i2c_adapter *adapter, u8 *buffer,
Quoted 8 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter, · line 226
Quoted 6 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +6
-0+ u8 offset, u8 no_of_bytes) +{ +return drm_dp_dual_mode_ioa_xfer (adapter, buffer, offset, + no_of_bytes,0 ); +} +EXPORT_SYMBOL (drm_dp_dual_mode_ioa_write);Aren't these just dupes of the dual mode helper read/write functions?
No, I2C over aux read uses adapter->algo->master_xfer function, which is different in case of aux channel read/write. dp_dual_mode uses i2c_xfer.
Quoted 39 lines
Quoted 18 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +6
-0+static bool is_hdmi_adaptor (const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN ]) { static const char dp_dual_mode_hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN] =@@ -141,6 +234,11 @@ static bool is_hdmi_adaptor(const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN]) sizeof(dp_dual_mode_hdmi_id)) == 0; } +bool is_lspcon_adaptor (const uint8_t adaptor_id) +{ +return adaptor_id ==0xa8 ; +} +/** * drm_dp_dual_mode_detect - Identyfy the DP dual mode adaptor * adapter: I2C adapter for the DDC bus drivers/gpu/drm/drm_dp_dual_mode_helper.c enum drm_dp_dual_mode_type drm_dp_dual_mode_detect(struct i2c_adapter *adapter) · line 299
Quoted 5 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +2
-0@@ -197,6 +295,8 @@ enum drm_dp_dual_mode_type drm_dp_dual_mode_detect(struct i2c_adapter *adapter) &adaptor_id, sizeof(adaptor_id));if (ret || (adaptor_id != (DP_DUAL_MODE_TYPE_TYPE2 |DP_DUAL_MODE_REV_TYPE2 ))) { +if (is_lspcon_adaptor (adaptor_id)) +return DRM_DP_DUAL_MODE_TYPE2_LSPCON ;We should reorganize this a bit I think. Probably should end up looking somehting like:
bool
is_type2_adaptor();
boolis_lspcon_adaptor();if (ret == 0) { if (is_lspcon_adaptor()) return TYPE2_LSPCON; else if (is_type2_adaptor() && is_hdmi_adaptor) return TYPE2_HDMI; else if (is_type2_adaptor()) return TYPE2_DVI; }
Quoted 6 lines
if (
is_hdmi...)return TYPE1_HDMI; else return TYPE1_DVI;
Yep, this is a good suggestion.
Quoted 35 lines
Quoted 35 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +0
-0if (is_hdmi_adaptor (hdmi_id))return DRM_DP_DUAL_MODE_TYPE1_HDMI ;else include/drm/drm_dp_dual_mode_helper.h +3
-0@@ -24,6 +24,7 @@#define DRM_DP_DUAL_MODE_HELPER_H #include <linux/types.h> +#include <drm/drm_edid.h> /* * Optional for type 1 DVI adaptors @@ -55,6 +56,7 @@#define DP_DUAL_MODE_CEC_ENABLE 0x01#define DP_DUAL_MODE_I2C_SPEED_CTRL 0x22#define DP_DUAL_MODE_LAST_RESERVED 0xff +#define DP_DUAL_MODE_DDC_SEGMENT_ADDR 0x30struct i2c_adapter ;@@ -69,6 +71,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_TYPE2_LSPCON, };enum drm_dp_dual_mode_type drm_dp_dual_mode_detect (struct i2c_adapter *adapter);@@ -81,4 +84,11 @@ drm_dp_dual_mode_set_tmds_output(struct i2c_adapter *adapter, bool enable);const char *drm_dp_get_dual_mode_type_name (enum drm_dp_dual_mode_type type);
Quoted 11 lines
Quoted 10 lines
include/drm/drm_dp_dual_mode_helper.h +7
-1+int drm_dp_dual_mode_ioa_read (struct i2c_adapter *adapter,u8 *buffer, +u8 offset,u8 no_of_bytes); +int drm_dp_dual_mode_ioa_write (struct i2c_adapter *adapter,u8 *buffer, +u8 offset,u8 no_of_bytes); +int drm_dp_dual_mode_get_edid (void *data, +u8 *buf,unsigned int block,size_t len); +#endif --1.9.1
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 08/12] drm: Add lspcon (custom type2 dp->hdmi) support
Quoted 128 lines · Shashank
Regards
ShashankQuoted 62 lines · Ville Syrjälä
Quoted 61 lines · Shashank Sharma
This patch adds support for LSPCON devices in dp++ adaptor helper layer. LSPCON is DP++ type-2 adaptor with some customized functionalities, to provide additional features in Intel Gen9 HW.
LSPCON needs I2C-over-aux support to read/write control and data registers. This patch adds following:
- Functions for I2C over aux read/write
- Function to read EDID using I2c-over-aux
- Function to identify LSPCON among type-2 DP adaptorsSigned-off-by Shashank Sharma <[email protected]>--- drivers/gpu/drm/drm_dp_dual_mode_helper.c | 100 ++++++++++++++++++++++++++++++ include/drm/drm_dp_dual_mode_helper.h | 10 +++ 2 files changed, 110 insertions(+)drivers/gpu/drm/drm_dp_dual_mode_helper.c +37
-0@@ -132,6 +132,99 @@ ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter, }EXPORT_SYMBOL (drm_dp_dual_mode_write); +int drm_dp_dual_mode_get_edid (void *data, +u8 *buf,unsigned int block,size_t len) +{ +struct i2c_adapter *adapter = data; +unsigned char start = block *EDID_LENGTH ; +unsigned char segment = block >>1 ; +unsigned char xfers = segment ?3 :2 ; +int ret, retries =5 ; + + do { + struct i2c_msg msgs[] = { + { + .addr = DP_DUAL_MODE_DDC_SEGMENT_ADDR, + .flags = 0, + .len = 1, + .buf = &segment, + }, { + .addr = DDC_ADDR, + .flags = 0, + .len = 1, + .buf = &start, + }, { + .addr = DDC_ADDR, + .flags = I2C_M_RD, + .len = len, + .buf = buf, + } + }; + + ret = adapter->algo->master_xfer(adapter, &msgs[3 - xfers], + xfers); + + if (ret == -ENXIO) { + DRM_ERROR("Non-existent adapter %s\n", + adapter->name); + break; + }Quoted 9 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter, · line 176
Quoted 5 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +5
-0+ }while (ret != xfers && --retries); + +return ret == xfers ?0 :-1 ; +} +EXPORT_SYMBOL (drm_dp_dual_mode_get_edid);This sort of stuff shouldn't be needed. All that should be needed is passing the right i2c adapter to
drm_get_edid()and whatnot.Yeah, agree, we can optimize this.
Quoted 44 lines
Quoted 44 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +44
-0+ +/* +* drm_dp_dual_mode_ioa_xfer +* Few dp->hdmi type 2 adaptors allow i2c_over_aux read/write +* to the control and status registers. These functions help +* to read/write from those. +*/ +static int drm_dp_dual_mode_ioa_xfer (struct i2c_adapter *adapter, +u8 *buffer,u8 offset,u8 no_of_bytes,u8 rw_flag) +{ +int err =0 ; + +struct i2c_msg msgs[] = { + { + .addr =DP_DUAL_MODE_SLAVE_ADDRESS , + .flags =0 , + .len =1 , + .buf = &offset, + }, { + .addr =DP_DUAL_MODE_SLAVE_ADDRESS , + .flags = rw_flag, + .len = no_of_bytes, + .buf = buffer, + } + }; + +/* I2C over AUX here */ + err = adapter->algo->master_xfer (adapter, msgs,2 ); +if (err <0 ) +DRM_ERROR ("LSPCON: Failed I2C over Aux read(addr=0x%x)\n" , + (unsigned int )offset); + +return err; +} + +int drm_dp_dual_mode_ioa_read (struct i2c_adapter *adapter,u8 *buffer, +u8 offset,u8 no_of_bytes) +{ +return drm_dp_dual_mode_ioa_xfer (adapter, buffer, offset, + no_of_bytes,I2C_M_RD ); +} +EXPORT_SYMBOL (drm_dp_dual_mode_ioa_read); + +int drm_dp_dual_mode_ioa_write(struct i2c_adapter *adapter, u8 *buffer,Quoted 8 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter, · line 226
Quoted 6 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +6
-0+ u8 offset, u8 no_of_bytes) +{ +return drm_dp_dual_mode_ioa_xfer (adapter, buffer, offset, + no_of_bytes,0 ); +} +EXPORT_SYMBOL (drm_dp_dual_mode_ioa_write);Aren't these just dupes of the dual mode helper read/write functions?
Quoted 2 lines
No, I2C over aux read uses
adapter->algo->master_xferfunction, which is different in case of aux channel read/write.dp_dual_modeusesi2c_xfer.
.master_xfer() is just an internal implementation detail of the i2c bus/algo driver. You're not meant call it directly. i2c_transfer() is what you call, and it will end up calling .master_xfer() internally.
Quoted 39 lines
Quoted 39 lines
Quoted 18 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +6
-0+static bool is_hdmi_adaptor (const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN ]) { static const char dp_dual_mode_hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN] =@@ -141,6 +234,11 @@ static bool is_hdmi_adaptor(const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN]) sizeof(dp_dual_mode_hdmi_id)) == 0; } +bool is_lspcon_adaptor (const uint8_t adaptor_id) +{ +return adaptor_id ==0xa8 ; +} +/** * drm_dp_dual_mode_detect - Identyfy the DP dual mode adaptor * adapter: I2C adapter for the DDC bus drivers/gpu/drm/drm_dp_dual_mode_helper.c enum drm_dp_dual_mode_type drm_dp_dual_mode_detect(struct i2c_adapter *adapter) · line 299
Quoted 5 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +2
-0@@ -197,6 +295,8 @@ enum drm_dp_dual_mode_type drm_dp_dual_mode_detect(struct i2c_adapter *adapter) &adaptor_id, sizeof(adaptor_id));if (ret || (adaptor_id != (DP_DUAL_MODE_TYPE_TYPE2 |DP_DUAL_MODE_REV_TYPE2 ))) { +if (is_lspcon_adaptor (adaptor_id)) +return DRM_DP_DUAL_MODE_TYPE2_LSPCON ;We should reorganize this a bit I think. Probably should end up looking somehting like:
bool
is_type2_adaptor();
boolis_lspcon_adaptor();if (ret == 0) { if (is_lspcon_adaptor()) return TYPE2_LSPCON; else if (is_type2_adaptor() && is_hdmi_adaptor) return TYPE2_HDMI; else if (is_type2_adaptor()) return TYPE2_DVI; }
Quoted 7 lines
Quoted 6 lines
if (
is_hdmi...)return TYPE1_HDMI; else return TYPE1_DVI;Yep, this is a good suggestion.
I already reogranized the type1/2 detection to match this pattern in my repost of the dp++ stuff, so should be easy to drop this in:
https://lists.freedesktop.org/archives/dri-devel/2016-May/106535.html
Quoted 46 lines
Quoted 46 lines
Quoted 45 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +0
-0if (is_hdmi_adaptor (hdmi_id))return DRM_DP_DUAL_MODE_TYPE1_HDMI ;else include/drm/drm_dp_dual_mode_helper.h +10
-1@@ -24,6 +24,7 @@#define DRM_DP_DUAL_MODE_HELPER_H #include <linux/types.h> +#include <drm/drm_edid.h> /* * Optional for type 1 DVI adaptors @@ -55,6 +56,7 @@#define DP_DUAL_MODE_CEC_ENABLE 0x01#define DP_DUAL_MODE_I2C_SPEED_CTRL 0x22#define DP_DUAL_MODE_LAST_RESERVED 0xff +#define DP_DUAL_MODE_DDC_SEGMENT_ADDR 0x30struct i2c_adapter ;@@ -69,6 +71,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_TYPE2_LSPCON, };enum drm_dp_dual_mode_type drm_dp_dual_mode_detect (struct i2c_adapter *adapter);@@ -81,4 +84,11 @@ drm_dp_dual_mode_set_tmds_output(struct i2c_adapter *adapter, bool enable);const char *drm_dp_get_dual_mode_type_name (enum drm_dp_dual_mode_type type); +int drm_dp_dual_mode_ioa_read (struct i2c_adapter *adapter,u8 *buffer, +u8 offset,u8 no_of_bytes); +int drm_dp_dual_mode_ioa_write (struct i2c_adapter *adapter,u8 *buffer, +u8 offset,u8 no_of_bytes); +int drm_dp_dual_mode_get_edid (void *data, +u8 *buf,unsigned int block,size_t len); +#endif --1.9.1
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 08/12] drm: Add lspcon (custom type2 dp->hdmi) support
Regards
Shashank
Quoted 129 lines · Ville Syrjälä
Quoted 128 lines · Shashank
Regards
ShashankQuoted 62 lines · Ville Syrjälä
Quoted 61 lines · Shashank Sharma
This patch adds support for LSPCON devices in dp++ adaptor helper layer. LSPCON is DP++ type-2 adaptor with some customized functionalities, to provide additional features in Intel Gen9 HW.
LSPCON needs I2C-over-aux support to read/write control and data registers. This patch adds following:
- Functions for I2C over aux read/write
- Function to read EDID using I2c-over-aux
- Function to identify LSPCON among type-2 DP adaptorsSigned-off-by Shashank Sharma <[email protected]>--- drivers/gpu/drm/drm_dp_dual_mode_helper.c | 100 ++++++++++++++++++++++++++++++ include/drm/drm_dp_dual_mode_helper.h | 10 +++ 2 files changed, 110 insertions(+)drivers/gpu/drm/drm_dp_dual_mode_helper.c +37
-0@@ -132,6 +132,99 @@ ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter, }EXPORT_SYMBOL (drm_dp_dual_mode_write); +int drm_dp_dual_mode_get_edid (void *data, +u8 *buf,unsigned int block,size_t len) +{ +struct i2c_adapter *adapter = data; +unsigned char start = block *EDID_LENGTH ; +unsigned char segment = block >>1 ; +unsigned char xfers = segment ?3 :2 ; +int ret, retries =5 ; + + do { + struct i2c_msg msgs[] = { + { + .addr = DP_DUAL_MODE_DDC_SEGMENT_ADDR, + .flags = 0, + .len = 1, + .buf = &segment, + }, { + .addr = DDC_ADDR, + .flags = 0, + .len = 1, + .buf = &start, + }, { + .addr = DDC_ADDR, + .flags = I2C_M_RD, + .len = len, + .buf = buf, + } + }; + + ret = adapter->algo->master_xfer(adapter, &msgs[3 - xfers], + xfers); + + if (ret == -ENXIO) { + DRM_ERROR("Non-existent adapter %s\n", + adapter->name); + break; + }Quoted 9 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter, · line 176
Quoted 5 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +5
-0+ }while (ret != xfers && --retries); + +return ret == xfers ?0 :-1 ; +} +EXPORT_SYMBOL (drm_dp_dual_mode_get_edid);This sort of stuff shouldn't be needed. All that should be needed is passing the right i2c adapter to
drm_get_edid()and whatnot.Yeah, agree, we can optimize this.
Quoted 52 lines
Quoted 40 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +40
-0+ +/* +* drm_dp_dual_mode_ioa_xfer +* Few dp->hdmi type 2 adaptors allow i2c_over_aux read/write +* to the control and status registers. These functions help +* to read/write from those. +*/ +static int drm_dp_dual_mode_ioa_xfer (struct i2c_adapter *adapter, +u8 *buffer,u8 offset,u8 no_of_bytes,u8 rw_flag) +{ +int err =0 ; + +struct i2c_msg msgs[] = { + { + .addr =DP_DUAL_MODE_SLAVE_ADDRESS , + .flags =0 , + .len =1 , + .buf = &offset, + }, { + .addr =DP_DUAL_MODE_SLAVE_ADDRESS , + .flags = rw_flag, + .len = no_of_bytes, + .buf = buffer, + } + }; + +/* I2C over AUX here */ + err = adapter->algo->master_xfer (adapter, msgs,2 ); +if (err <0 ) +DRM_ERROR ("LSPCON: Failed I2C over Aux read(addr=0x%x)\n" , + (unsigned int )offset); + +return err; +} + +int drm_dp_dual_mode_ioa_read (struct i2c_adapter *adapter,u8 *buffer, +u8 offset,u8 no_of_bytes) +{ +return drm_dp_dual_mode_ioa_xfer (adapter, buffer, offset, + no_of_bytes,I2C_M_RD );drivers/gpu/drm/drm_dp_dual_mode_helper.c ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter, · line 226
Quoted 10 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +10
-0+} +EXPORT_SYMBOL (drm_dp_dual_mode_ioa_read); + +int drm_dp_dual_mode_ioa_write (struct i2c_adapter *adapter,u8 *buffer, +u8 offset,u8 no_of_bytes) +{ +return drm_dp_dual_mode_ioa_xfer (adapter, buffer, offset, + no_of_bytes,0 ); +} +EXPORT_SYMBOL (drm_dp_dual_mode_ioa_write);Aren't these just dupes of the dual mode helper read/write functions?
Quoted 7 lines
Quoted 2 lines
No, I2C over aux read uses
adapter->algo->master_xferfunction, which is different in case of aux channel read/write.dp_dual_modeusesi2c_xfer..master_xfer() is just an internal implementation detail of the i2c bus/algo driver. You're not meant call it directly.
i2c_transfer()is what you call, and it will end up calling .master_xfer() internally.
Please correct me if its not the case, but the master_xfer function getting loaded in drm_dp_helper layer is drm_dp_i2c_xfer() which does a lot of stuff. You mean to say i2c_xfer() function call will map to drm_dp_i2c_xfer ?
Quoted 45 lines
Quoted 45 lines
Quoted 45 lines
Quoted 18 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +6
-0+static bool is_hdmi_adaptor (const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN ]) { static const char dp_dual_mode_hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN] =@@ -141,6 +234,11 @@ static bool is_hdmi_adaptor(const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN]) sizeof(dp_dual_mode_hdmi_id)) == 0; } +bool is_lspcon_adaptor (const uint8_t adaptor_id) +{ +return adaptor_id ==0xa8 ; +} +/** * drm_dp_dual_mode_detect - Identyfy the DP dual mode adaptor * adapter: I2C adapter for the DDC bus drivers/gpu/drm/drm_dp_dual_mode_helper.c enum drm_dp_dual_mode_type drm_dp_dual_mode_detect(struct i2c_adapter *adapter) · line 299
Quoted 5 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +2
-0@@ -197,6 +295,8 @@ enum drm_dp_dual_mode_type drm_dp_dual_mode_detect(struct i2c_adapter *adapter) &adaptor_id, sizeof(adaptor_id));if (ret || (adaptor_id != (DP_DUAL_MODE_TYPE_TYPE2 |DP_DUAL_MODE_REV_TYPE2 ))) { +if (is_lspcon_adaptor (adaptor_id)) +return DRM_DP_DUAL_MODE_TYPE2_LSPCON ;We should reorganize this a bit I think. Probably should end up looking somehting like:
bool
is_type2_adaptor();
boolis_lspcon_adaptor();if (ret == 0) { if (is_lspcon_adaptor()) return TYPE2_LSPCON; else if (is_type2_adaptor() && is_hdmi_adaptor) return TYPE2_HDMI; else if (is_type2_adaptor()) return TYPE2_DVI; }if (
is_hdmi...)return TYPE1_HDMI; else return TYPE1_DVI;
Quoted 6 lines
Quoted 1 line
Yep, this is a good suggestion.
I already reogranized the type1/2 detection to match this pattern in my repost of the dp++ stuff, so should be easy to drop this in:
https://lists.freedesktop.org/archives/dri-devel/2016-May/106535.html
Yep, just started looking into these patches, I will reuse this.
Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +0
-0if (is_hdmi_adaptor (hdmi_id))return DRM_DP_DUAL_MODE_TYPE1_HDMI ;else include/drm/drm_dp_dual_mode_helper.h +3
-0@@ -24,6 +24,7 @@#define DRM_DP_DUAL_MODE_HELPER_H #include <linux/types.h> +#include <drm/drm_edid.h> /* * Optional for type 1 DVI adaptors @@ -55,6 +56,7 @@#define DP_DUAL_MODE_CEC_ENABLE 0x01#define DP_DUAL_MODE_I2C_SPEED_CTRL 0x22#define DP_DUAL_MODE_LAST_RESERVED 0xff +#define DP_DUAL_MODE_DDC_SEGMENT_ADDR 0x30struct i2c_adapter ;@@ -69,6 +71,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_TYPE2_LSPCON, };enum drm_dp_dual_mode_type drm_dp_dual_mode_detect (struct i2c_adapter *adapter);@@ -81,4 +84,11 @@ drm_dp_dual_mode_set_tmds_output(struct i2c_adapter *adapter, bool enable);const char *drm_dp_get_dual_mode_type_name (enum drm_dp_dual_mode_type type);
Quoted 12 lines
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
include/drm/drm_dp_dual_mode_helper.h +7
-1+int drm_dp_dual_mode_ioa_read (struct i2c_adapter *adapter,u8 *buffer, +u8 offset,u8 no_of_bytes); +int drm_dp_dual_mode_ioa_write (struct i2c_adapter *adapter,u8 *buffer, +u8 offset,u8 no_of_bytes); +int drm_dp_dual_mode_get_edid (void *data, +u8 *buf,unsigned int block,size_t len); +#endif --1.9.1
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 08/12] drm: Add lspcon (custom type2 dp->hdmi) support
Quoted 136 lines · Shashank
Regards
ShashankQuoted 132 lines · Ville Syrjälä
Quoted 130 lines · Shashank
Regards
ShashankQuoted 62 lines · Ville Syrjälä
Quoted 61 lines · Shashank Sharma
This patch adds support for LSPCON devices in dp++ adaptor helper layer. LSPCON is DP++ type-2 adaptor with some customized functionalities, to provide additional features in Intel Gen9 HW.
LSPCON needs I2C-over-aux support to read/write control and data registers. This patch adds following:
- Functions for I2C over aux read/write
- Function to read EDID using I2c-over-aux
- Function to identify LSPCON among type-2 DP adaptorsSigned-off-by Shashank Sharma <[email protected]>--- drivers/gpu/drm/drm_dp_dual_mode_helper.c | 100 ++++++++++++++++++++++++++++++ include/drm/drm_dp_dual_mode_helper.h | 10 +++ 2 files changed, 110 insertions(+)drivers/gpu/drm/drm_dp_dual_mode_helper.c +37
-0@@ -132,6 +132,99 @@ ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter, }EXPORT_SYMBOL (drm_dp_dual_mode_write); +int drm_dp_dual_mode_get_edid (void *data, +u8 *buf,unsigned int block,size_t len) +{ +struct i2c_adapter *adapter = data; +unsigned char start = block *EDID_LENGTH ; +unsigned char segment = block >>1 ; +unsigned char xfers = segment ?3 :2 ; +int ret, retries =5 ; + + do { + struct i2c_msg msgs[] = { + { + .addr = DP_DUAL_MODE_DDC_SEGMENT_ADDR, + .flags = 0, + .len = 1, + .buf = &segment, + }, { + .addr = DDC_ADDR, + .flags = 0, + .len = 1, + .buf = &start, + }, { + .addr = DDC_ADDR, + .flags = I2C_M_RD, + .len = len, + .buf = buf, + } + }; + + ret = adapter->algo->master_xfer(adapter, &msgs[3 - xfers], + xfers); + + if (ret == -ENXIO) { + DRM_ERROR("Non-existent adapter %s\n", + adapter->name); + break; + }Quoted 9 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter, · line 176
Quoted 5 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +5
-0+ }while (ret != xfers && --retries); + +return ret == xfers ?0 :-1 ; +} +EXPORT_SYMBOL (drm_dp_dual_mode_get_edid);This sort of stuff shouldn't be needed. All that should be needed is passing the right i2c adapter to
drm_get_edid()and whatnot.Yeah, agree, we can optimize this.
Quoted 44 lines
Quoted 44 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +44
-0+ +/* +* drm_dp_dual_mode_ioa_xfer +* Few dp->hdmi type 2 adaptors allow i2c_over_aux read/write +* to the control and status registers. These functions help +* to read/write from those. +*/ +static int drm_dp_dual_mode_ioa_xfer (struct i2c_adapter *adapter, +u8 *buffer,u8 offset,u8 no_of_bytes,u8 rw_flag) +{ +int err =0 ; + +struct i2c_msg msgs[] = { + { + .addr =DP_DUAL_MODE_SLAVE_ADDRESS , + .flags =0 , + .len =1 , + .buf = &offset, + }, { + .addr =DP_DUAL_MODE_SLAVE_ADDRESS , + .flags = rw_flag, + .len = no_of_bytes, + .buf = buffer, + } + }; + +/* I2C over AUX here */ + err = adapter->algo->master_xfer (adapter, msgs,2 ); +if (err <0 ) +DRM_ERROR ("LSPCON: Failed I2C over Aux read(addr=0x%x)\n" , + (unsigned int )offset); + +return err; +} + +int drm_dp_dual_mode_ioa_read (struct i2c_adapter *adapter,u8 *buffer, +u8 offset,u8 no_of_bytes) +{ +return drm_dp_dual_mode_ioa_xfer (adapter, buffer, offset, + no_of_bytes,I2C_M_RD ); +} +EXPORT_SYMBOL (drm_dp_dual_mode_ioa_read); + +int drm_dp_dual_mode_ioa_write(struct i2c_adapter *adapter, u8 *buffer,Quoted 8 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter, · line 226
Quoted 6 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +6
-0+ u8 offset, u8 no_of_bytes) +{ +return drm_dp_dual_mode_ioa_xfer (adapter, buffer, offset, + no_of_bytes,0 ); +} +EXPORT_SYMBOL (drm_dp_dual_mode_ioa_write);Aren't these just dupes of the dual mode helper read/write functions?
No, I2C over aux read uses
adapter->algo->master_xferfunction, which is different in case of aux channel read/write.dp_dual_modeusesi2c_xfer.
Quoted 8 lines
Quoted 4 lines
.master_xfer() is just an internal implementation detail of the i2c bus/algo driver. You're not meant call it directly.
i2c_transfer()is what you call, and it will end up calling .master_xfer() internally.Please correct me if its not the case, but the
master_xferfunction getting loaded indrm_dp_helperlayer isdrm_dp_i2c_xfer()which does a lot of stuff. You mean to sayi2c_xfer()function call will map todrm_dp_i2c_xfer?
Yes, assuming you pass in the correct i2c adapter.
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 9/12 drm/i915: Add and register lspcon connector functions
In reply to Shashank SharmaThis patch adds various lspcon connector functions. Some of the functions are newly written, to meet the specific needs of lspcon HW, whereas few of them are just an abstraction layer on existing HDMI connector functions.
--- drivers/gpu/drm/i915/intel_drv.h | 11 +- drivers/gpu/drm/i915/intel_hdmi.c | 8 +- drivers/gpu/drm/i915/intel_hotplug.c | 2 +- drivers/gpu/drm/i915/intel_lspcon.c | 195 ++++++++++++++++++++++++++++++++++- 4 files changed, 207 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/intel_drv.h +10 -1
@@ -1404,7 +1404,12 @@ int intel_hdmi_init_minimum(struct intel_digital_port *intel_dig_port,struct intel_hdmi *enc_to_intel_hdmi (struct drm_encoder *encoder);bool intel_hdmi_compute_config (struct intel_encoder *encoder,struct intel_crtc_state *pipe_config); - +int intel_hdmi_get_modes (struct drm_connector *connector); +int intel_hdmi_set_property (struct drm_connector *connector, +struct drm_property *property,uint64_t val); +void intel_hdmi_destroy (struct drm_connector *connector); +void intel_hdmi_add_properties (struct intel_hdmi *intel_hdmi, +struct drm_connector *connector);/* intel_lvds.c */ void intel_lvds_init (struct drm_device *dev);
@@ -1493,6 +1498,10 @@ bool intel_display_power_get_if_enabled(struct drm_i915_private *dev_priv,void intel_display_power_put (struct drm_i915_private *dev_priv,enum intel_display_power_domain domain); +/* intel_hotplug.c */ +bool intel_hpd_irq_event (struct drm_device *dev, +struct drm_connector *connector); +static inline void assert_rpm_device_not_suspended (struct drm_i915_private *dev_priv) {
drivers/gpu/drm/i915/intel_hdmi.c +4 -4
@@ -1540,7 +1540,7 @@ intel_hdmi_force(struct drm_connector *connector)hdmi_to_dig_port (intel_hdmi)->base.type =INTEL_OUTPUT_HDMI ; } -static int intel_hdmi_get_modes (struct drm_connector *connector) +int intel_hdmi_get_modes (struct drm_connector *connector) {struct edid *edid;
@@ -1564,7 +1564,7 @@ intel_hdmi_detect_audio(struct drm_connector *connector)return has_audio; } -static int +int intel_hdmi_set_property (struct drm_connector *connector,struct drm_property *property,uint64_t val)
@@ -2089,7 +2089,7 @@ static void chv_hdmi_pre_enable(struct intel_encoder *encoder) } } -static void intel_hdmi_destroy (struct drm_connector *connector) +void intel_hdmi_destroy (struct drm_connector *connector) {kfree (to_intel_connector (connector)->detect_edid);drm_connector_cleanup (connector);
@@ -2118,7 +2118,7 @@ static const struct drm_encoder_funcs intel_hdmi_enc_funcs = { .destroy = intel_encoder_destroy, }; -static void +void intel_hdmi_add_properties (struct intel_hdmi *intel_hdmi,struct drm_connector *connector) {intel_attach_force_audio_property (connector);
drivers/gpu/drm/i915/intel_hotplug.c +1 -1
@@ -226,7 +226,7 @@ static void intel_hpd_irq_storm_reenable_work(struct work_struct *work)intel_runtime_pm_put (dev_priv); } -static bool intel_hpd_irq_event (struct drm_device *dev, +bool intel_hpd_irq_event (struct drm_device *dev,struct drm_connector *connector) {enum drm_connector_status old_status;
drivers/gpu/drm/i915/intel_lspcon.c +192 -3
227 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 10/12 drm/i915: Add lspcon core functions
In reply to Shashank SharmaThis patch adds lspcon's internal functions, which work on the probe layer, and indicate the working status of lspcon, which are mostly:
probe: A lspcon device is probed only once, during boot time, as its always present with the device, next to port. So the i2c_over_aux channel is alwyas read/writeable if DC is powered on. If VBT says that this port contains lspcon, we check and probe the HW to verify and initialize it.
get_mode: This function indicates the current mode of operation of lspcon (ls or pcon mode)
change_mode: This function can change the lspcon's mode of operation to desired mode.
--- drivers/gpu/drm/i915/intel_lspcon.c | 145 ++++++++++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+)
drivers/gpu/drm/i915/intel_lspcon.c +145 -0
@@ -61,6 +61,144 @@ static struct intel_lspconreturn enc_to_lspcon (&intel_attached_encoder (connector)->base); } +enum lspcon_mode lspcon_get_current_mode (struct intel_lspcon *lspcon) +{ +u8 data; +int err =0 ; +struct intel_digital_port *dig_port =lspcon_to_dig_port (lspcon); +struct i2c_adapter *adapter = &dig_port->dp.aux.ddc; + +/* Read Status: i2c over aux */ + err =drm_dp_dual_mode_ioa_read (adapter, &data, +LSPCON_MODE_CHECK_OFFSET ,sizeof (data)); +if (err <0 ) { +DRM_ERROR ("LSPCON read mode ioa (0x80, 0x41) failed\n" ); +return lspcon_mode_invalid; + } + +DRM_DEBUG_DRIVER ("LSPCON mode (0x80, 0x41) = %x\n" , (unsigned int )data); +return data &LSPCON_MODE_MASK ? lspcon_mode_pcon : lspcon_mode_ls; +} + +int lspcon_change_mode (struct intel_lspcon *lspcon, +enum lspcon_mode mode,bool force) +{ +u8 data; +int err; +int time_out =200 ; +enum lspcon_mode current_mode; +struct intel_digital_port *dig_port =lspcon_to_dig_port (lspcon); + + current_mode =lspcon_get_current_mode (lspcon); +if (current_mode == lspcon_mode_invalid) { +DRM_ERROR ("Failed to get current LSPCON mode\n" ); +return -EFAULT ; + } + +if (current_mode == mode && !force) { +DRM_DEBUG_DRIVER ("Current mode = desired LSPCON mode\n" ); +return 0 ; + } + +if (mode == lspcon_mode_ls) + data = ~LSPCON_MODE_MASK ; +else + data =LSPCON_MODE_MASK ; + +/* Change mode */ + err =drm_dp_dual_mode_ioa_write (&dig_port->dp.aux.ddc, &data, +LSPCON_MODE_CHANGE_OFFSET ,sizeof (data)); +if (err <0 ) { +DRM_ERROR ("LSPCON mode change failed\n" ); +return err; + } + +/* +* 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. +*/ +while (time_out) { + current_mode =lspcon_get_current_mode (lspcon); +if (current_mode != mode) { +mdelay (10 ); + time_out -=10 ; + }else { + lspcon->mode_of_op = mode; +DRM_DEBUG_DRIVER ("LSPCON mode changed to %s\n" , + mode == lspcon_mode_ls ?"LS" :"PCON" ); +return 0 ; + } + } + +DRM_ERROR ("LSPCON mode change timed out\n" ); +return -EFAULT ; +} + +bool lspcon_detect_identifier (struct intel_lspcon *lspcon) +{ +enum drm_dp_dual_mode_type adaptor_type; +struct intel_digital_port *dig_port =lspcon_to_dig_port (lspcon); +struct i2c_adapter *adapter = &dig_port->dp.aux.ddc; + +/* Lets probe the adaptor and check its type */ + adaptor_type =drm_dp_dual_mode_detect (adapter); +if (adaptor_type !=DRM_DP_DUAL_MODE_TYPE2_LSPCON ) { +DRM_DEBUG_DRIVER ("No LSPCON detected, found %s\n" , +drm_dp_get_dual_mode_type_name (adaptor_type)); +return false; + } + +/* Yay ... got a LSPCON device */ +DRM_DEBUG_DRIVER ("LSPCON detected\n" ); +return true; +} + +enum lspcon_mode lspcon_probe (struct intel_lspcon *lspcon) +{ +enum lspcon_mode current_mode; + +/* Detect a valid lspcon */ +if (!lspcon_detect_identifier (lspcon)) { +DRM_DEBUG_DRIVER ("Failed to find LSPCON identifier\n" ); +return false; + } + +/* LSPCON's mode of operation */ + current_mode =lspcon_get_current_mode (lspcon); +if (current_mode == lspcon_mode_invalid) { +DRM_ERROR ("Failed to read LSPCON mode\n" ); +return false; + } + +/* All is well */ + lspcon->mode_of_op = current_mode; + lspcon->active = true; +return current_mode; +} + +bool lspcon_device_init (struct intel_lspcon *lspcon) +{ + +/* Lets check LSPCON now, probe the HW status */ + lspcon->active = false; + lspcon->mode_of_op = lspcon_mode_invalid; +if (!lspcon_probe (lspcon)) { +DRM_ERROR ("Failed to probe lspcon" ); +return false; + } + +/* We wish to keep LSPCON in LS mode */ +if (lspcon->active && lspcon->mode_of_op != lspcon_mode_ls) { +if (lspcon_change_mode (lspcon, lspcon_mode_ls, true) <0 ) { +DRM_ERROR ("LSPCON mode change to LS failed\n" ); +return false; + } + } +DRM_DEBUG_DRIVER ("LSPCON init success\n" ); +return true; +} +struct edid *lspcon_get_edid (struct intel_lspcon *lspcon,struct drm_connector *connector) {
@@ -233,6 +371,7 @@ int intel_lspcon_init_connector(struct intel_digital_port *intel_dig_port)struct intel_encoder *intel_encoder = &intel_dig_port->base;struct drm_device *dev = intel_encoder->base.dev;struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_lspcon *lspcon = &intel_dig_port->lspcon;struct intel_connector *intel_connector;struct drm_connector *connector;enum port port = intel_dig_port->port;
@@ -314,6 +453,12 @@ int intel_lspcon_init_connector(struct intel_digital_port *intel_dig_port)I915_WRITE (PEG_BAND_GAP_DATA , (temp & ~0xf ) |0xd ); } +/* Now initialize the LSPCON device */ +if (!lspcon_device_init (lspcon)) { +DRM_ERROR ("LSPCON device init failed\n" ); + goto fail; + } +DRM_DEBUG_DRIVER ("Success: LSPCON connector init\n" );return 0 ;
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 10/12] drm/i915: Add lspcon core functions
Quoted 93 lines · Shashank Sharma
This patch adds lspcon's internal functions, which work on the probe layer, and indicate the working status of lspcon, which are mostly:
probe: A lspcon device is probed only once, during boot time, as its always present with the device, next to port. So the
i2c_over_auxchannel is alwyas read/writeable if DC is powered on. If VBT says that this port contains lspcon, we check and probe the HW to verify and initialize it.
get_mode: This function indicates the current mode of operation of lspcon (ls or pcon mode)
change_mode: This function can change the lspcon's mode of operation to desired mode.Signed-off-by Shashank Sharma <[email protected]>Signed-off-by Akashdeep Sharma <[email protected]>--- drivers/gpu/drm/i915/intel_lspcon.c | 145 ++++++++++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+)drivers/gpu/drm/i915/intel_lspcon.c +63
-0@@ -61,6 +61,144 @@ static struct intel_lspconreturn enc_to_lspcon (&intel_attached_encoder (connector)->base); } +enum lspcon_mode lspcon_get_current_mode (struct intel_lspcon *lspcon) +{ +u8 data; +int err =0 ; +struct intel_digital_port *dig_port =lspcon_to_dig_port (lspcon); +struct i2c_adapter *adapter = &dig_port->dp.aux.ddc; + +/* Read Status: i2c over aux */ + err =drm_dp_dual_mode_ioa_read (adapter, &data, +LSPCON_MODE_CHECK_OFFSET ,sizeof (data)); +if (err <0 ) { +DRM_ERROR ("LSPCON read mode ioa (0x80, 0x41) failed\n" ); +return lspcon_mode_invalid; + } + +DRM_DEBUG_DRIVER ("LSPCON mode (0x80, 0x41) = %x\n" , (unsigned int )data); +return data &LSPCON_MODE_MASK ? lspcon_mode_pcon : lspcon_mode_ls; +} + +int lspcon_change_mode (struct intel_lspcon *lspcon, +enum lspcon_mode mode,bool force) +{ +u8 data; +int err; +int time_out =200 ; +enum lspcon_mode current_mode; +struct intel_digital_port *dig_port =lspcon_to_dig_port (lspcon); + + current_mode =lspcon_get_current_mode (lspcon); +if (current_mode == lspcon_mode_invalid) { +DRM_ERROR ("Failed to get current LSPCON mode\n" ); +return -EFAULT ; + } + +if (current_mode == mode && !force) { +DRM_DEBUG_DRIVER ("Current mode = desired LSPCON mode\n" ); +return 0 ; + } + +if (mode == lspcon_mode_ls) + data = ~LSPCON_MODE_MASK ; +else + data =LSPCON_MODE_MASK ; + +/* Change mode */ + err =drm_dp_dual_mode_ioa_write (&dig_port->dp.aux.ddc, &data, +LSPCON_MODE_CHANGE_OFFSET ,sizeof (data)); +if (err <0 ) { +DRM_ERROR ("LSPCON mode change failed\n" ); +return err; + } + +/* +* 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. +*/ +while (time_out) { + current_mode =lspcon_get_current_mode (lspcon); +if (current_mode != mode) { +mdelay (10 ); + time_out -=10 ; + }else {
drivers/gpu/drm/i915/intel_lspcon.c static struct intel_lspcon · line 136
Quoted 10 lines
drivers/gpu/drm/i915/intel_lspcon.c +10
-0+ lspcon->mode_of_op = mode; +DRM_DEBUG_DRIVER ("LSPCON mode changed to %s\n" , + mode == lspcon_mode_ls ?"LS" :"PCON" ); +return 0 ; + } + } + +DRM_ERROR ("LSPCON mode change timed out\n" ); +return -EFAULT ; +}
I think we probably want to put most of this stuff into the helper. We already have the LSPCON identification there, so having a few helpers to set/get the ls vs. pconn mode would seem appropriate.
Quoted 91 lines
drivers/gpu/drm/i915/intel_lspcon.c +72
-0+ +bool lspcon_detect_identifier (struct intel_lspcon *lspcon) +{ +enum drm_dp_dual_mode_type adaptor_type; +struct intel_digital_port *dig_port =lspcon_to_dig_port (lspcon); +struct i2c_adapter *adapter = &dig_port->dp.aux.ddc; + +/* Lets probe the adaptor and check its type */ + adaptor_type =drm_dp_dual_mode_detect (adapter); +if (adaptor_type !=DRM_DP_DUAL_MODE_TYPE2_LSPCON ) { +DRM_DEBUG_DRIVER ("No LSPCON detected, found %s\n" , +drm_dp_get_dual_mode_type_name (adaptor_type)); +return false; + } + +/* Yay ... got a LSPCON device */ +DRM_DEBUG_DRIVER ("LSPCON detected\n" ); +return true; +} + +enum lspcon_mode lspcon_probe (struct intel_lspcon *lspcon) +{ +enum lspcon_mode current_mode; + +/* Detect a valid lspcon */ +if (!lspcon_detect_identifier (lspcon)) { +DRM_DEBUG_DRIVER ("Failed to find LSPCON identifier\n" ); +return false; + } + +/* LSPCON's mode of operation */ + current_mode =lspcon_get_current_mode (lspcon); +if (current_mode == lspcon_mode_invalid) { +DRM_ERROR ("Failed to read LSPCON mode\n" ); +return false; + } + +/* All is well */ + lspcon->mode_of_op = current_mode; + lspcon->active = true; +return current_mode; +} + +bool lspcon_device_init (struct intel_lspcon *lspcon) +{ + +/* Lets check LSPCON now, probe the HW status */ + lspcon->active = false; + lspcon->mode_of_op = lspcon_mode_invalid; +if (!lspcon_probe (lspcon)) { +DRM_ERROR ("Failed to probe lspcon" ); +return false; + } + +/* We wish to keep LSPCON in LS mode */ +if (lspcon->active && lspcon->mode_of_op != lspcon_mode_ls) { +if (lspcon_change_mode (lspcon, lspcon_mode_ls, true) <0 ) { +DRM_ERROR ("LSPCON mode change to LS failed\n" ); +return false; + } + } +DRM_DEBUG_DRIVER ("LSPCON init success\n" ); +return true; +} +struct edid *lspcon_get_edid (struct intel_lspcon *lspcon,struct drm_connector *connector) {@@ -233,6 +371,7 @@ int intel_lspcon_init_connector(struct intel_digital_port *intel_dig_port)struct intel_encoder *intel_encoder = &intel_dig_port->base;struct drm_device *dev = intel_encoder->base.dev;struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_lspcon *lspcon = &intel_dig_port->lspcon;struct intel_connector *intel_connector;struct drm_connector *connector;enum port port = intel_dig_port->port;@@ -314,6 +453,12 @@ int intel_lspcon_init_connector(struct intel_digital_port *intel_dig_port)I915_WRITE (PEG_BAND_GAP_DATA , (temp & ~0xf ) |0xd ); } +/* Now initialize the LSPCON device */ +if (!lspcon_device_init (lspcon)) { +DRM_ERROR ("LSPCON device init failed\n" ); + goto fail; + } +DRM_DEBUG_DRIVER ("Success: LSPCON connector init\n" );return 0 ;Signature · 1 line
1.9.1
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 10/12] drm/i915: Add lspcon core functions
Regards
Shashank
Quoted 100 lines · Ville Syrjälä
Quoted 99 lines · Shashank Sharma
This patch adds lspcon's internal functions, which work on the probe layer, and indicate the working status of lspcon, which are mostly:
probe: A lspcon device is probed only once, during boot time, as its always present with the device, next to port. So the
i2c_over_auxchannel is alwyas read/writeable if DC is powered on. If VBT says that this port contains lspcon, we check and probe the HW to verify and initialize it.
get_mode: This function indicates the current mode of operation of lspcon (ls or pcon mode)
change_mode: This function can change the lspcon's mode of operation to desired mode.Signed-off-by Shashank Sharma <[email protected]>Signed-off-by Akashdeep Sharma <[email protected]>--- drivers/gpu/drm/i915/intel_lspcon.c | 145 ++++++++++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+)drivers/gpu/drm/i915/intel_lspcon.c +69
-0@@ -61,6 +61,144 @@ static struct intel_lspconreturn enc_to_lspcon (&intel_attached_encoder (connector)->base); } +enum lspcon_mode lspcon_get_current_mode (struct intel_lspcon *lspcon) +{ +u8 data; +int err =0 ; +struct intel_digital_port *dig_port =lspcon_to_dig_port (lspcon); +struct i2c_adapter *adapter = &dig_port->dp.aux.ddc; + +/* Read Status: i2c over aux */ + err =drm_dp_dual_mode_ioa_read (adapter, &data, +LSPCON_MODE_CHECK_OFFSET ,sizeof (data)); +if (err <0 ) { +DRM_ERROR ("LSPCON read mode ioa (0x80, 0x41) failed\n" ); +return lspcon_mode_invalid; + } + +DRM_DEBUG_DRIVER ("LSPCON mode (0x80, 0x41) = %x\n" , (unsigned int )data); +return data &LSPCON_MODE_MASK ? lspcon_mode_pcon : lspcon_mode_ls; +} + +int lspcon_change_mode (struct intel_lspcon *lspcon, +enum lspcon_mode mode,bool force) +{ +u8 data; +int err; +int time_out =200 ; +enum lspcon_mode current_mode; +struct intel_digital_port *dig_port =lspcon_to_dig_port (lspcon); + + current_mode =lspcon_get_current_mode (lspcon); +if (current_mode == lspcon_mode_invalid) { +DRM_ERROR ("Failed to get current LSPCON mode\n" ); +return -EFAULT ; + } + +if (current_mode == mode && !force) { +DRM_DEBUG_DRIVER ("Current mode = desired LSPCON mode\n" ); +return 0 ; + } + +if (mode == lspcon_mode_ls) + data = ~LSPCON_MODE_MASK ; +else + data =LSPCON_MODE_MASK ; + +/* Change mode */ + err =drm_dp_dual_mode_ioa_write (&dig_port->dp.aux.ddc, &data, +LSPCON_MODE_CHANGE_OFFSET ,sizeof (data)); +if (err <0 ) { +DRM_ERROR ("LSPCON mode change failed\n" ); +return err; + } + +/* +* 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. +*/ +while (time_out) { + current_mode =lspcon_get_current_mode (lspcon); +if (current_mode != mode) { +mdelay (10 ); + time_out -=10 ; + }else { + lspcon->mode_of_op = mode; +DRM_DEBUG_DRIVER ("LSPCON mode changed to %s\n" , + mode == lspcon_mode_ls ?"LS" :"PCON" ); +return 0 ; + } + }
Quoted 9 lines
drivers/gpu/drm/i915/intel_lspcon.c static struct intel_lspcon · line 136
Quoted 4 lines
drivers/gpu/drm/i915/intel_lspcon.c +4
-0+ +DRM_ERROR ("LSPCON mode change timed out\n" ); +return -EFAULT ; +}I think we probably want to put most of this stuff into the helper. We already have the LSPCON identification there, so having a few helpers to set/get the ls vs. pconn mode would seem appropriate.
Actually handling of LS/PCON modes are specific to MCA chips, and some of the mode change mechanism and few other control stuff may not be same on parade or some other vendor's chip, so I am not sure if we should create a helper for something which is specific to this chip. You suggest so ?
Quoted 89 lines
Quoted 89 lines
drivers/gpu/drm/i915/intel_lspcon.c +72
-0+ +bool lspcon_detect_identifier (struct intel_lspcon *lspcon) +{ +enum drm_dp_dual_mode_type adaptor_type; +struct intel_digital_port *dig_port =lspcon_to_dig_port (lspcon); +struct i2c_adapter *adapter = &dig_port->dp.aux.ddc; + +/* Lets probe the adaptor and check its type */ + adaptor_type =drm_dp_dual_mode_detect (adapter); +if (adaptor_type !=DRM_DP_DUAL_MODE_TYPE2_LSPCON ) { +DRM_DEBUG_DRIVER ("No LSPCON detected, found %s\n" , +drm_dp_get_dual_mode_type_name (adaptor_type)); +return false; + } + +/* Yay ... got a LSPCON device */ +DRM_DEBUG_DRIVER ("LSPCON detected\n" ); +return true; +} + +enum lspcon_mode lspcon_probe (struct intel_lspcon *lspcon) +{ +enum lspcon_mode current_mode; + +/* Detect a valid lspcon */ +if (!lspcon_detect_identifier (lspcon)) { +DRM_DEBUG_DRIVER ("Failed to find LSPCON identifier\n" ); +return false; + } + +/* LSPCON's mode of operation */ + current_mode =lspcon_get_current_mode (lspcon); +if (current_mode == lspcon_mode_invalid) { +DRM_ERROR ("Failed to read LSPCON mode\n" ); +return false; + } + +/* All is well */ + lspcon->mode_of_op = current_mode; + lspcon->active = true; +return current_mode; +} + +bool lspcon_device_init (struct intel_lspcon *lspcon) +{ + +/* Lets check LSPCON now, probe the HW status */ + lspcon->active = false; + lspcon->mode_of_op = lspcon_mode_invalid; +if (!lspcon_probe (lspcon)) { +DRM_ERROR ("Failed to probe lspcon" ); +return false; + } + +/* We wish to keep LSPCON in LS mode */ +if (lspcon->active && lspcon->mode_of_op != lspcon_mode_ls) { +if (lspcon_change_mode (lspcon, lspcon_mode_ls, true) <0 ) { +DRM_ERROR ("LSPCON mode change to LS failed\n" ); +return false; + } + } +DRM_DEBUG_DRIVER ("LSPCON init success\n" ); +return true; +} +struct edid *lspcon_get_edid (struct intel_lspcon *lspcon,struct drm_connector *connector) {@@ -233,6 +371,7 @@ int intel_lspcon_init_connector(struct intel_digital_port *intel_dig_port)struct intel_encoder *intel_encoder = &intel_dig_port->base;struct drm_device *dev = intel_encoder->base.dev;struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_lspcon *lspcon = &intel_dig_port->lspcon;struct intel_connector *intel_connector;struct drm_connector *connector;enum port port = intel_dig_port->port;@@ -314,6 +453,12 @@ int intel_lspcon_init_connector(struct intel_digital_port *intel_dig_port)I915_WRITE (PEG_BAND_GAP_DATA , (temp & ~0xf ) |0xd ); } +/* Now initialize the LSPCON device */ +if (!lspcon_device_init (lspcon)) { +DRM_ERROR ("LSPCON device init failed\n" ); + goto fail; + } +DRM_DEBUG_DRIVER ("Success: LSPCON connector init\n" );return 0 ;
Quoted 3 lines
Quoted 2 lines
--
1.9.1
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 10/12] drm/i915: Add lspcon core functions
Quoted 113 lines · Shashank
Regards
ShashankQuoted 100 lines · Ville Syrjälä
Quoted 99 lines · Shashank Sharma
This patch adds lspcon's internal functions, which work on the probe layer, and indicate the working status of lspcon, which are mostly:
probe: A lspcon device is probed only once, during boot time, as its always present with the device, next to port. So the
i2c_over_auxchannel is alwyas read/writeable if DC is powered on. If VBT says that this port contains lspcon, we check and probe the HW to verify and initialize it.
get_mode: This function indicates the current mode of operation of lspcon (ls or pcon mode)
change_mode: This function can change the lspcon's mode of operation to desired mode.Signed-off-by Shashank Sharma <[email protected]>Signed-off-by Akashdeep Sharma <[email protected]>--- drivers/gpu/drm/i915/intel_lspcon.c | 145 ++++++++++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+)drivers/gpu/drm/i915/intel_lspcon.c +69
-0@@ -61,6 +61,144 @@ static struct intel_lspconreturn enc_to_lspcon (&intel_attached_encoder (connector)->base); } +enum lspcon_mode lspcon_get_current_mode (struct intel_lspcon *lspcon) +{ +u8 data; +int err =0 ; +struct intel_digital_port *dig_port =lspcon_to_dig_port (lspcon); +struct i2c_adapter *adapter = &dig_port->dp.aux.ddc; + +/* Read Status: i2c over aux */ + err =drm_dp_dual_mode_ioa_read (adapter, &data, +LSPCON_MODE_CHECK_OFFSET ,sizeof (data)); +if (err <0 ) { +DRM_ERROR ("LSPCON read mode ioa (0x80, 0x41) failed\n" ); +return lspcon_mode_invalid; + } + +DRM_DEBUG_DRIVER ("LSPCON mode (0x80, 0x41) = %x\n" , (unsigned int )data); +return data &LSPCON_MODE_MASK ? lspcon_mode_pcon : lspcon_mode_ls; +} + +int lspcon_change_mode (struct intel_lspcon *lspcon, +enum lspcon_mode mode,bool force) +{ +u8 data; +int err; +int time_out =200 ; +enum lspcon_mode current_mode; +struct intel_digital_port *dig_port =lspcon_to_dig_port (lspcon); + + current_mode =lspcon_get_current_mode (lspcon); +if (current_mode == lspcon_mode_invalid) { +DRM_ERROR ("Failed to get current LSPCON mode\n" ); +return -EFAULT ; + } + +if (current_mode == mode && !force) { +DRM_DEBUG_DRIVER ("Current mode = desired LSPCON mode\n" ); +return 0 ; + } + +if (mode == lspcon_mode_ls) + data = ~LSPCON_MODE_MASK ; +else + data =LSPCON_MODE_MASK ; + +/* Change mode */ + err =drm_dp_dual_mode_ioa_write (&dig_port->dp.aux.ddc, &data, +LSPCON_MODE_CHANGE_OFFSET ,sizeof (data)); +if (err <0 ) { +DRM_ERROR ("LSPCON mode change failed\n" ); +return err; + } + +/* +* 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. +*/ +while (time_out) { + current_mode =lspcon_get_current_mode (lspcon); +if (current_mode != mode) { +mdelay (10 ); + time_out -=10 ; + }else { + lspcon->mode_of_op = mode; +DRM_DEBUG_DRIVER ("LSPCON mode changed to %s\n" , + mode == lspcon_mode_ls ?"LS" :"PCON" ); +return 0 ; + } + }Quoted 9 lines
drivers/gpu/drm/i915/intel_lspcon.c static struct intel_lspcon · line 136
Quoted 4 lines
drivers/gpu/drm/i915/intel_lspcon.c +4
-0+ +DRM_ERROR ("LSPCON mode change timed out\n" ); +return -EFAULT ; +}I think we probably want to put most of this stuff into the helper. We already have the LSPCON identification there, so having a few helpers to set/get the ls vs. pconn mode would seem appropriate.
Quoted 5 lines
Actually handling of LS/PCON modes are specific to MCA chips, and some of the mode change mechanism and few other control stuff may not be same on parade or some other vendor's chip, so I am not sure if we should create a helper for something which is specific to this chip. You suggest so ?
Well, if we already put the detection into the helper we already have some vendor specific stuff there, no? Or would the other vendor's chips be identifiable in the same way?
Anyways, I presume someone else than Intel might want to use these same chips in their products, so having the support in a central place would seem like a good idea. If we start to see incompatble LSPCON chips from multiple vendors we'll need to rethink how we support them all, but until we know how exactly they differ it's rather impossible to design the helper to deal with them. So as a first step I'd stuff it all into the helper.
Quoted 92 lines
Quoted 92 lines
Quoted 91 lines
drivers/gpu/drm/i915/intel_lspcon.c +72
-1+ +bool lspcon_detect_identifier (struct intel_lspcon *lspcon) +{ +enum drm_dp_dual_mode_type adaptor_type; +struct intel_digital_port *dig_port =lspcon_to_dig_port (lspcon); +struct i2c_adapter *adapter = &dig_port->dp.aux.ddc; + +/* Lets probe the adaptor and check its type */ + adaptor_type =drm_dp_dual_mode_detect (adapter); +if (adaptor_type !=DRM_DP_DUAL_MODE_TYPE2_LSPCON ) { +DRM_DEBUG_DRIVER ("No LSPCON detected, found %s\n" , +drm_dp_get_dual_mode_type_name (adaptor_type)); +return false; + } + +/* Yay ... got a LSPCON device */ +DRM_DEBUG_DRIVER ("LSPCON detected\n" ); +return true; +} + +enum lspcon_mode lspcon_probe (struct intel_lspcon *lspcon) +{ +enum lspcon_mode current_mode; + +/* Detect a valid lspcon */ +if (!lspcon_detect_identifier (lspcon)) { +DRM_DEBUG_DRIVER ("Failed to find LSPCON identifier\n" ); +return false; + } + +/* LSPCON's mode of operation */ + current_mode =lspcon_get_current_mode (lspcon); +if (current_mode == lspcon_mode_invalid) { +DRM_ERROR ("Failed to read LSPCON mode\n" ); +return false; + } + +/* All is well */ + lspcon->mode_of_op = current_mode; + lspcon->active = true; +return current_mode; +} + +bool lspcon_device_init (struct intel_lspcon *lspcon) +{ + +/* Lets check LSPCON now, probe the HW status */ + lspcon->active = false; + lspcon->mode_of_op = lspcon_mode_invalid; +if (!lspcon_probe (lspcon)) { +DRM_ERROR ("Failed to probe lspcon" ); +return false; + } + +/* We wish to keep LSPCON in LS mode */ +if (lspcon->active && lspcon->mode_of_op != lspcon_mode_ls) { +if (lspcon_change_mode (lspcon, lspcon_mode_ls, true) <0 ) { +DRM_ERROR ("LSPCON mode change to LS failed\n" ); +return false; + } + } +DRM_DEBUG_DRIVER ("LSPCON init success\n" ); +return true; +} +struct edid *lspcon_get_edid (struct intel_lspcon *lspcon,struct drm_connector *connector) {@@ -233,6 +371,7 @@ int intel_lspcon_init_connector(struct intel_digital_port *intel_dig_port)struct intel_encoder *intel_encoder = &intel_dig_port->base;struct drm_device *dev = intel_encoder->base.dev;struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_lspcon *lspcon = &intel_dig_port->lspcon;struct intel_connector *intel_connector;struct drm_connector *connector;enum port port = intel_dig_port->port;@@ -314,6 +453,12 @@ int intel_lspcon_init_connector(struct intel_digital_port *intel_dig_port)I915_WRITE (PEG_BAND_GAP_DATA , (temp & ~0xf ) |0xd ); } +/* Now initialize the LSPCON device */ +if (!lspcon_device_init (lspcon)) { +DRM_ERROR ("LSPCON device init failed\n" ); + goto fail; + } +DRM_DEBUG_DRIVER ("Success: LSPCON connector init\n" );return 0 ; --1.9.1
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 10/12] drm/i915: Add lspcon core functions
Quoted 124 lines · Ville Syrjälä
Quoted 113 lines · Shashank
Regards
ShashankQuoted 100 lines · Ville Syrjälä
Quoted 99 lines · Shashank Sharma
This patch adds lspcon's internal functions, which work on the probe layer, and indicate the working status of lspcon, which are mostly:
probe: A lspcon device is probed only once, during boot time, as its always present with the device, next to port. So the
i2c_over_auxchannel is alwyas read/writeable if DC is powered on. If VBT says that this port contains lspcon, we check and probe the HW to verify and initialize it.
get_mode: This function indicates the current mode of operation of lspcon (ls or pcon mode)
change_mode: This function can change the lspcon's mode of operation to desired mode.Signed-off-by Shashank Sharma <[email protected]>Signed-off-by Akashdeep Sharma <[email protected]>--- drivers/gpu/drm/i915/intel_lspcon.c | 145 ++++++++++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+)drivers/gpu/drm/i915/intel_lspcon.c +69
-0@@ -61,6 +61,144 @@ static struct intel_lspconreturn enc_to_lspcon (&intel_attached_encoder (connector)->base); } +enum lspcon_mode lspcon_get_current_mode (struct intel_lspcon *lspcon) +{ +u8 data; +int err =0 ; +struct intel_digital_port *dig_port =lspcon_to_dig_port (lspcon); +struct i2c_adapter *adapter = &dig_port->dp.aux.ddc; + +/* Read Status: i2c over aux */ + err =drm_dp_dual_mode_ioa_read (adapter, &data, +LSPCON_MODE_CHECK_OFFSET ,sizeof (data)); +if (err <0 ) { +DRM_ERROR ("LSPCON read mode ioa (0x80, 0x41) failed\n" ); +return lspcon_mode_invalid; + } + +DRM_DEBUG_DRIVER ("LSPCON mode (0x80, 0x41) = %x\n" , (unsigned int )data); +return data &LSPCON_MODE_MASK ? lspcon_mode_pcon : lspcon_mode_ls; +} + +int lspcon_change_mode (struct intel_lspcon *lspcon, +enum lspcon_mode mode,bool force) +{ +u8 data; +int err; +int time_out =200 ; +enum lspcon_mode current_mode; +struct intel_digital_port *dig_port =lspcon_to_dig_port (lspcon); + + current_mode =lspcon_get_current_mode (lspcon); +if (current_mode == lspcon_mode_invalid) { +DRM_ERROR ("Failed to get current LSPCON mode\n" ); +return -EFAULT ; + } + +if (current_mode == mode && !force) { +DRM_DEBUG_DRIVER ("Current mode = desired LSPCON mode\n" ); +return 0 ; + } + +if (mode == lspcon_mode_ls) + data = ~LSPCON_MODE_MASK ; +else + data =LSPCON_MODE_MASK ; + +/* Change mode */ + err =drm_dp_dual_mode_ioa_write (&dig_port->dp.aux.ddc, &data, +LSPCON_MODE_CHANGE_OFFSET ,sizeof (data)); +if (err <0 ) { +DRM_ERROR ("LSPCON mode change failed\n" ); +return err; + } + +/* +* 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. +*/ +while (time_out) { + current_mode =lspcon_get_current_mode (lspcon); +if (current_mode != mode) { +mdelay (10 ); + time_out -=10 ; + }else { + lspcon->mode_of_op = mode; +DRM_DEBUG_DRIVER ("LSPCON mode changed to %s\n" , + mode == lspcon_mode_ls ?"LS" :"PCON" ); +return 0 ; + } + }Quoted 9 lines
drivers/gpu/drm/i915/intel_lspcon.c static struct intel_lspcon · line 136
Quoted 4 lines
drivers/gpu/drm/i915/intel_lspcon.c +4
-0+ +DRM_ERROR ("LSPCON mode change timed out\n" ); +return -EFAULT ; +}I think we probably want to put most of this stuff into the helper. We already have the LSPCON identification there, so having a few helpers to set/get the ls vs. pconn mode would seem appropriate.
Quoted 5 lines
Actually handling of LS/PCON modes are specific to MCA chips, and some of the mode change mechanism and few other control stuff may not be same on parade or some other vendor's chip, so I am not sure if we should create a helper for something which is specific to this chip. You suggest so ?
Well, if we already put the detection into the helper we already have some vendor specific stuff there, no? Or would the other vendor's chips be identifiable in the same way?
Quoted 8 lines
Anyways, I presume someone else than Intel might want to use these same chips in their products, so having the support in a central place would seem like a good idea. If we start to see incompatble LSPCON chips from multiple vendors we'll need to rethink how we support them all, but until we know how exactly they differ it's rather impossible to design the helper to deal with them. So as a first step I'd stuff it all into the helper.
Yes, makes more sense this way. I will try to go through parade specs once, and see if I can find something which needs immediate discussion here. Else, I will move this into the central layer.
Quoted 89 lines
Quoted 89 lines
Quoted 89 lines
Quoted 89 lines
drivers/gpu/drm/i915/intel_lspcon.c +72
-0+ +bool lspcon_detect_identifier (struct intel_lspcon *lspcon) +{ +enum drm_dp_dual_mode_type adaptor_type; +struct intel_digital_port *dig_port =lspcon_to_dig_port (lspcon); +struct i2c_adapter *adapter = &dig_port->dp.aux.ddc; + +/* Lets probe the adaptor and check its type */ + adaptor_type =drm_dp_dual_mode_detect (adapter); +if (adaptor_type !=DRM_DP_DUAL_MODE_TYPE2_LSPCON ) { +DRM_DEBUG_DRIVER ("No LSPCON detected, found %s\n" , +drm_dp_get_dual_mode_type_name (adaptor_type)); +return false; + } + +/* Yay ... got a LSPCON device */ +DRM_DEBUG_DRIVER ("LSPCON detected\n" ); +return true; +} + +enum lspcon_mode lspcon_probe (struct intel_lspcon *lspcon) +{ +enum lspcon_mode current_mode; + +/* Detect a valid lspcon */ +if (!lspcon_detect_identifier (lspcon)) { +DRM_DEBUG_DRIVER ("Failed to find LSPCON identifier\n" ); +return false; + } + +/* LSPCON's mode of operation */ + current_mode =lspcon_get_current_mode (lspcon); +if (current_mode == lspcon_mode_invalid) { +DRM_ERROR ("Failed to read LSPCON mode\n" ); +return false; + } + +/* All is well */ + lspcon->mode_of_op = current_mode; + lspcon->active = true; +return current_mode; +} + +bool lspcon_device_init (struct intel_lspcon *lspcon) +{ + +/* Lets check LSPCON now, probe the HW status */ + lspcon->active = false; + lspcon->mode_of_op = lspcon_mode_invalid; +if (!lspcon_probe (lspcon)) { +DRM_ERROR ("Failed to probe lspcon" ); +return false; + } + +/* We wish to keep LSPCON in LS mode */ +if (lspcon->active && lspcon->mode_of_op != lspcon_mode_ls) { +if (lspcon_change_mode (lspcon, lspcon_mode_ls, true) <0 ) { +DRM_ERROR ("LSPCON mode change to LS failed\n" ); +return false; + } + } +DRM_DEBUG_DRIVER ("LSPCON init success\n" ); +return true; +} +struct edid *lspcon_get_edid (struct intel_lspcon *lspcon,struct drm_connector *connector) {@@ -233,6 +371,7 @@ int intel_lspcon_init_connector(struct intel_digital_port *intel_dig_port)struct intel_encoder *intel_encoder = &intel_dig_port->base;struct drm_device *dev = intel_encoder->base.dev;struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_lspcon *lspcon = &intel_dig_port->lspcon;struct intel_connector *intel_connector;struct drm_connector *connector;enum port port = intel_dig_port->port;@@ -314,6 +453,12 @@ int intel_lspcon_init_connector(struct intel_digital_port *intel_dig_port)I915_WRITE (PEG_BAND_GAP_DATA , (temp & ~0xf ) |0xd ); } +/* Now initialize the LSPCON device */ +if (!lspcon_device_init (lspcon)) { +DRM_ERROR ("LSPCON device init failed\n" ); + goto fail; + } +DRM_DEBUG_DRIVER ("Success: LSPCON connector init\n" );return 0 ;
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
--
1.9.1
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 10/12] drm/i915: Add lspcon core functions
Em Ter, 2016-05-03 às 21:44 +0530, Sharma, Shashank escreveu:
Quoted 166 lines · Ville Syrjälä
Quoted 151 lines · Shashank
Quoted 135 lines
Regards
ShashankQuoted 121 lines · Ville Syrjälä
Quoted 118 lines · Shashank Sharma
This patch adds lspcon's internal functions, which work on the probe layer, and indicate the working status of lspcon, which are mostly:
probe: A lspcon device is probed only once, during boot time, as its always present with the device, next to port. So the
i2c_over_auxchannel is alwyas read/writeable if DC is powered on. If VBT says that this port contains lspcon, we check and probe the HW to verify and initialize it.
get_mode: This function indicates the current mode of operation
of lspcon (ls or pcon mode)
change_mode: This function can change the lspcon's mode of operation to desired mode.Signed-off-by Shashank Sharma <[email protected]>Signed-off-by Akashdeep Sharma <[email protected]>---
drivers/gpu/drm/i915/intel_lspcon.c | 145
++++++++++++++++++++++++++++++++++++1 file changed, 145 insertions(+)drivers/gpu/drm/i915/intel_lspcon.c +0
-0@@ -61,6 +61,144 @@ static struct intel_lspconreturn enc_to_lspcon(&intel_attached_encoder(connector)->base); }
+enum
lspcon_modelspcon_get_current_mode(struct intel_lspcon *lspcon)drivers/gpu/drm/i915/intel_lspcon.c +4
-0+{ +u8 data; +int err =0 ; + struct intel_digital_port *dig_port =
lspcon_to_dig_port(lspcon);drivers/gpu/drm/i915/intel_lspcon.c +7
-0+struct i2c_adapter *adapter = &dig_port->dp.aux.ddc; + +/* Read Status: i2c over aux */ + err =drm_dp_dual_mode_ioa_read (adapter, &data, +LSPCON_MODE_CHECK_OFFSET ,sizeof (data)); +if (err <0 ) { + DRM_ERROR("LSPCON read mode ioa (0x80, 0x41)failed\n");
drivers/gpu/drm/i915/intel_lspcon.c +4
-0+return lspcon_mode_invalid; + } + + DRM_DEBUG_DRIVER("LSPCON mode (0x80, 0x41) = %x\n",(unsigned int)data);
drivers/gpu/drm/i915/intel_lspcon.c +1
-0+ return data & LSPCON_MODE_MASK ? lspcon_mode_pcon :
lspcon_mode_ls;drivers/gpu/drm/i915/intel_lspcon.c +10
-0+} + +int lspcon_change_mode (struct intel_lspcon *lspcon, +enum lspcon_mode mode,bool force) +{ +u8 data; +int err; +int time_out =200 ; +enum lspcon_mode current_mode; + struct intel_digital_port *dig_port =
lspcon_to_dig_port(lspcon);drivers/gpu/drm/i915/intel_lspcon.c +4
-0+ + current_mode =lspcon_get_current_mode (lspcon); +if (current_mode == lspcon_mode_invalid) { + DRM_ERROR("Failed to get current LSPCONmode\n");
drivers/gpu/drm/i915/intel_lspcon.c +5
-0+return -EFAULT ; + } + +if (current_mode == mode && !force) { + DRM_DEBUG_DRIVER("Current mode = desiredLSPCON mode\n");
drivers/gpu/drm/i915/intel_lspcon.c +10
-0+return 0 ; + } + +if (mode == lspcon_mode_ls) + data = ~LSPCON_MODE_MASK ; +else + data =LSPCON_MODE_MASK ; + +/* Change mode */ + err = drm_dp_dual_mode_ioa_write(&dig_port-Quoted 1 line
dp.aux.ddc, &data,
drivers/gpu/drm/i915/intel_lspcon.c +1
-0+ LSPCON_MODE_CHANGE_OFFSET,sizeof(data));
drivers/gpu/drm/i915/intel_lspcon.c +12
-0+if (err <0 ) { +DRM_ERROR ("LSPCON mode change failed\n" ); +return err; + } + +/* +* 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. +*/ +while (time_out) { + current_mode =
lspcon_get_current_mode(lspcon);drivers/gpu/drm/i915/intel_lspcon.c +6
-0+if (current_mode != mode) { +mdelay (10 ); + time_out -=10 ; + }else { + lspcon->mode_of_op = mode; + DRM_DEBUG_DRIVER("LSPCON modechanged to %s\n",
drivers/gpu/drm/i915/intel_lspcon.c +1
-0+ mode == lspcon_mode_ls ?"LS" : "PCON");
drivers/gpu/drm/i915/intel_lspcon.c +4
-0+return 0 ; + } + } +Quoted 9 lines
drivers/gpu/drm/i915/intel_lspcon.c static struct intel_lspcon · line 136
Quoted 3 lines
drivers/gpu/drm/i915/intel_lspcon.c +3
-0+DRM_ERROR ("LSPCON mode change timed out\n" ); +return -EFAULT ; +}I think we probably want to put most of this stuff into the helper. We
already have the LSPCON identification there, so having a few helpers
to set/get the ls vs. pconn mode would seem appropriate.Quoted 8 lines
Actually handling of LS/PCON modes are specific to MCA chips, and some
of the mode change mechanism and few other control stuff may not be same
on parade or some other vendor's chip, so I am not sure if we should
create a helper for something which is specific to this chip. You suggest so ?Well, if we already put the detection into the helper we already have
some vendor specific stuff there, no? Or would the other vendor's chips
be identifiable in the same way?Quoted 13 lines
Anyways, I presume someone else than Intel might want to use these same
chips in their products, so having the support in a central place would
seem like a good idea. If we start to see incompatble LSPCON chips from
multiple vendors we'll need to rethink how we support them all, but until we know how exactly they differ it's rather impossible to design
the helper to deal with them. So as a first step I'd stuff it all into
the helper.
Quoted 5 lines
Yes, makes more sense this way. I will try to go through parade specs
once, and see if I can find something which needs immediate discussion
here. Else, I will move this into the central layer.
The big problem with LSPCON is that it uses bits that are reserved by the VESA specs, such as bit 3 of I2C address 80h offset 10h. Nothing prevents VESA from defining an actual meaning to that bit that will be incompatible with LSPCON.
Quoted 109 lines
Quoted 109 lines
Quoted 109 lines
Quoted 109 lines
Quoted 109 lines
drivers/gpu/drm/i915/intel_lspcon.c +5
-0+ +bool lspcon_detect_identifier (struct intel_lspcon *lspcon) +{ +enum drm_dp_dual_mode_type adaptor_type; + struct intel_digital_port *dig_port =
lspcon_to_dig_port(lspcon);drivers/gpu/drm/i915/intel_lspcon.c +6
-0+struct i2c_adapter *adapter = &dig_port->dp.aux.ddc; + +/* Lets probe the adaptor and check its type */ + adaptor_type =drm_dp_dual_mode_detect (adapter); +if (adaptor_type !=DRM_DP_DUAL_MODE_TYPE2_LSPCON ) { + DRM_DEBUG_DRIVER("No LSPCON detected, found%s\n",
drivers/gpu/drm/i915/intel_lspcon.c +1
-0+ drm_dp_get_dual_mode_type_name(adapt
or_type));drivers/gpu/drm/i915/intel_lspcon.c +15
-0+return false; + } + +/* Yay ... got a LSPCON device */ +DRM_DEBUG_DRIVER ("LSPCON detected\n" ); +return true; +} + +enum lspcon_mode lspcon_probe (struct intel_lspcon *lspcon) +{ +enum lspcon_mode current_mode; + +/* Detect a valid lspcon */ +if (!lspcon_detect_identifier (lspcon)) { + DRM_DEBUG_DRIVER("Failed to find LSPCONidentifier\n");
drivers/gpu/drm/i915/intel_lspcon.c +29
-0+return false; + } + +/* LSPCON's mode of operation */ + current_mode =lspcon_get_current_mode (lspcon); +if (current_mode == lspcon_mode_invalid) { +DRM_ERROR ("Failed to read LSPCON mode\n" ); +return false; + } + +/* All is well */ + lspcon->mode_of_op = current_mode; + lspcon->active = true; +return current_mode; +} + +bool lspcon_device_init(struct intel_lspcon *lspcon) +{ + + /* Lets check LSPCON now, probe the HW status */ + lspcon->active = false; + lspcon->mode_of_op = lspcon_mode_invalid; + if (!lspcon_probe(lspcon)) { + DRM_ERROR("Failed to probe lspcon"); + return false; + } + + /* We wish to keep LSPCON in LS mode */ + if (lspcon->active && lspcon->mode_of_op !=
lspcon_mode_ls) {drivers/gpu/drm/i915/intel_lspcon.c +1
-0+ if (lspcon_change_mode(lspcon,
lspcon_mode_ls, true) < 0) {drivers/gpu/drm/i915/intel_lspcon.c +1
-0+ DRM_ERROR("LSPCON mode change to LSfailed\n");
drivers/gpu/drm/i915/intel_lspcon.c +7
-0+return false; + } + } +DRM_DEBUG_DRIVER ("LSPCON init success\n" ); +return true; +} +struct edid *lspcon_get_edid(struct
intel_lspcon*lspcon, structdrm_connector
*connector )
{drivers/gpu/drm/i915/intel_lspcon.c +0
-0@@ -233,6 +371,7 @@ int intel_lspcon_init_connector(struct intel_digital_port *intel_dig_port)struct
intel_encoder*intel_encoder=&intel_dig_port->base;
structdrm_device*dev =intel_encoder->base.dev; structdrm_i915_private*dev_priv= dev-Quoted 1 line
dev_private;drivers/gpu/drm/i915/intel_lspcon.c +1
-0+ struct intel_lspcon *lspcon = &intel_dig_port-Quoted 1 line
lspcon;
struct
intel_connector*intel_connector;
structdrm_connector*connector;
enum port port =intel_dig_port->port;drivers/gpu/drm/i915/intel_lspcon.c +0
-0@@ -314,6 +453,12 @@ int intel_lspcon_init_connector(struct intel_digital_port *intel_dig_port)
I915_WRITE(PEG_BAND_GAP_DATA, (temp & ~0xf) | 0xd);
}drivers/gpu/drm/i915/intel_lspcon.c +6
-0+/* Now initialize the LSPCON device */ +if (!lspcon_device_init (lspcon)) { +DRM_ERROR ("LSPCON device init failed\n" ); + goto fail; + } +
DRM_DEBUG_DRIVER("Success: LSPCON connector init\n");
return 0;
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
--
1.9.1
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 10/12] drm/i915: Add lspcon core functions
Quoted 173 lines · Paulo R
Em Ter, 2016-05-03 às 21:44 +0530, Sharma, Shashank escreveu:
Quoted 166 lines · Ville Syrjälä
Quoted 151 lines · Shashank
Quoted 135 lines
Regards
ShashankQuoted 121 lines · Ville Syrjälä
Quoted 118 lines · Shashank Sharma
This patch adds lspcon's internal functions, which work on the probe layer, and indicate the working status of lspcon, which are mostly:
probe: A lspcon device is probed only once, during boot time, as its always present with the device, next to port. So the
i2c_over_auxchannel is alwyas read/writeable if DC is powered on. If VBT says that this port contains lspcon, we check and probe the HW to verify and initialize it.
get_mode: This function indicates the current mode of operation
of lspcon (ls or pcon mode)
change_mode: This function can change the lspcon's mode of operation to desired mode.Signed-off-by Shashank Sharma <[email protected]>Signed-off-by Akashdeep Sharma <[email protected]>---
drivers/gpu/drm/i915/intel_lspcon.c | 145
++++++++++++++++++++++++++++++++++++1 file changed, 145 insertions(+)drivers/gpu/drm/i915/intel_lspcon.c +0
-0@@ -61,6 +61,144 @@ static struct intel_lspconreturn enc_to_lspcon(&intel_attached_encoder(connector)->base); }
+enum
lspcon_modelspcon_get_current_mode(struct intel_lspcon *lspcon)drivers/gpu/drm/i915/intel_lspcon.c +4
-0+{ +u8 data; +int err =0 ; + struct intel_digital_port *dig_port =
lspcon_to_dig_port(lspcon);drivers/gpu/drm/i915/intel_lspcon.c +7
-0+struct i2c_adapter *adapter = &dig_port->dp.aux.ddc; + +/* Read Status: i2c over aux */ + err =drm_dp_dual_mode_ioa_read (adapter, &data, +LSPCON_MODE_CHECK_OFFSET ,sizeof (data)); +if (err <0 ) { + DRM_ERROR("LSPCON read mode ioa (0x80, 0x41)failed\n");
drivers/gpu/drm/i915/intel_lspcon.c +4
-0+return lspcon_mode_invalid; + } + + DRM_DEBUG_DRIVER("LSPCON mode (0x80, 0x41) = %x\n",(unsigned int)data);
drivers/gpu/drm/i915/intel_lspcon.c +1
-0+ return data & LSPCON_MODE_MASK ? lspcon_mode_pcon :
lspcon_mode_ls;drivers/gpu/drm/i915/intel_lspcon.c +10
-0+} + +int lspcon_change_mode (struct intel_lspcon *lspcon, +enum lspcon_mode mode,bool force) +{ +u8 data; +int err; +int time_out =200 ; +enum lspcon_mode current_mode; + struct intel_digital_port *dig_port =
lspcon_to_dig_port(lspcon);drivers/gpu/drm/i915/intel_lspcon.c +4
-0+ + current_mode =lspcon_get_current_mode (lspcon); +if (current_mode == lspcon_mode_invalid) { + DRM_ERROR("Failed to get current LSPCONmode\n");
drivers/gpu/drm/i915/intel_lspcon.c +5
-0+return -EFAULT ; + } + +if (current_mode == mode && !force) { + DRM_DEBUG_DRIVER("Current mode = desiredLSPCON mode\n");
drivers/gpu/drm/i915/intel_lspcon.c +10
-0+return 0 ; + } + +if (mode == lspcon_mode_ls) + data = ~LSPCON_MODE_MASK ; +else + data =LSPCON_MODE_MASK ; + +/* Change mode */ + err = drm_dp_dual_mode_ioa_write(&dig_port-Quoted 1 line
dp.aux.ddc, &data,
drivers/gpu/drm/i915/intel_lspcon.c +1
-0+ LSPCON_MODE_CHANGE_OFFSET,sizeof(data));
drivers/gpu/drm/i915/intel_lspcon.c +12
-0+if (err <0 ) { +DRM_ERROR ("LSPCON mode change failed\n" ); +return err; + } + +/* +* 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. +*/ +while (time_out) { + current_mode =
lspcon_get_current_mode(lspcon);drivers/gpu/drm/i915/intel_lspcon.c +6
-0+if (current_mode != mode) { +mdelay (10 ); + time_out -=10 ; + }else { + lspcon->mode_of_op = mode; + DRM_DEBUG_DRIVER("LSPCON modechanged to %s\n",
drivers/gpu/drm/i915/intel_lspcon.c +1
-0+ mode == lspcon_mode_ls ?"LS" : "PCON");
drivers/gpu/drm/i915/intel_lspcon.c +4
-0+return 0 ; + } + } +Quoted 9 lines
drivers/gpu/drm/i915/intel_lspcon.c static struct intel_lspcon · line 136
Quoted 3 lines
drivers/gpu/drm/i915/intel_lspcon.c +3
-0+DRM_ERROR ("LSPCON mode change timed out\n" ); +return -EFAULT ; +}I think we probably want to put most of this stuff into the helper. We
already have the LSPCON identification there, so having a few helpers
to set/get the ls vs. pconn mode would seem appropriate.Quoted 8 lines
Actually handling of LS/PCON modes are specific to MCA chips, and some
of the mode change mechanism and few other control stuff may not be same
on parade or some other vendor's chip, so I am not sure if we should
create a helper for something which is specific to this chip. You suggest so ?Well, if we already put the detection into the helper we already have
some vendor specific stuff there, no? Or would the other vendor's chips
be identifiable in the same way?Quoted 13 lines
Anyways, I presume someone else than Intel might want to use these same
chips in their products, so having the support in a central place would
seem like a good idea. If we start to see incompatble LSPCON chips from
multiple vendors we'll need to rethink how we support them all, but until we know how exactly they differ it's rather impossible to design
the helper to deal with them. So as a first step I'd stuff it all into
the helper.Quoted 5 lines
Yes, makes more sense this way. I will try to go through parade specs
once, and see if I can find something which needs immediate discussion
here. Else, I will move this into the central layer.
Quoted 4 lines
The big problem with LSPCON is that it uses bits that are reserved by the VESA specs, such as bit 3 of I2C address 80h offset 10h. Nothing prevents VESA from defining an actual meaning to that bit that will be incompatible with LSPCON.
Well, when/if that happens we'll have to change the way the detection works, eg. just leave it up to the driver or something. As always, it's hard to make predictions, especially about the future.
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 11/12 drm/i915: Add lspcon hpd handler
In reply to Shashank SharmaThis patch adds a new hpd handler for lspcon.
As lspcon has its own way of reading EDID and detecting the device, it wont be efficient to use the existing hpd functions to handle the hot_plug scenarios. This new function reads the EDID and checks the status of the sink device.
--- drivers/gpu/drm/i915/intel_lspcon.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
drivers/gpu/drm/i915/intel_lspcon.c +35 -0
@@ -61,6 +61,38 @@ static struct intel_lspconreturn enc_to_lspcon (&intel_attached_encoder (connector)->base); } +enum irqreturn +lspcon_hpd_pulse (struct intel_digital_port *intel_dig_port,bool long_hpd) +{ +struct drm_device *dev = intel_dig_port->base.base.dev; +struct intel_encoder *intel_encoder = &intel_dig_port->base; +struct intel_connector *intel_connector; +bool changed = false; + +mutex_lock (&dev->mode_config.mutex); +if (intel_encoder->hot_plug) + intel_encoder->hot_plug (intel_encoder); + +for_each_intel_connector (dev, intel_connector) { +if (intel_connector->encoder == intel_encoder) { +struct drm_connector *connector = + &intel_connector->base; + +DRM_DEBUG_DRIVER ("Hptplug: Connector %s (pin %i).\n" , + connector->name, intel_encoder->hpd_pin); +if (intel_hpd_irq_event (dev, connector)) + changed = true; + } + } +mutex_unlock (&dev->mode_config.mutex); + +if (changed) { +DRM_DEBUG_DRIVER ("Sending event for change\n" ); +drm_kms_helper_hotplug_event (dev); + } +return IRQ_HANDLED ; +} +enum lspcon_mode lspcon_get_current_mode (struct intel_lspcon *lspcon) {u8 data;
@@ -396,6 +428,9 @@ int intel_lspcon_init_connector(struct intel_digital_port *intel_dig_port) intel_connector->get_hw_state = intel_ddi_connector_get_hw_state;i915_debugfs_connector_add (connector); +/* HPD handler */ + intel_dig_port->hpd_pulse = lspcon_hpd_pulse; +/* init DP */ ret =intel_dp_init_minimum (intel_dig_port, intel_connector);if (ret) {
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 12/12 DO_NOT_MERGE: drm/i915: Hack to enable lspcon initialization
In reply to Shashank SharmaThis patch adds a hack to enable lspcon on GEN9 devices. This should not be merged, and the hack must be replaced by proper VBT parsing logic.
Expecting this patch to enable lspcon bits in VBT:
https://lists.freedesktop.org/archives/intel-gfx/2016-March/089541.html
--- drivers/gpu/drm/i915/intel_ddi.c | 15 +++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 4 ++++ drivers/gpu/drm/i915/intel_lspcon.c | 10 ++++++++++ 3 files changed, 29 insertions(+)
drivers/gpu/drm/i915/intel_ddi.c +15 -0
@@ -2169,6 +2169,21 @@ void intel_ddi_init(struct drm_device *dev, enum port port) intel_encoder->crtc_mask = (1 <<0 ) | (1 <<1 ) | (1 <<2 ); intel_encoder->cloneable =0 ; + +/* Check if LSPCON is configured on this port */ +if (is_lspcon_present_on_port (dev_priv, intel_dig_port->port)) { +if (!intel_lspcon_init_connector (intel_dig_port)) { +DRM_DEBUG_KMS ("LSPCON configured for port %c\n" , +port_name (intel_dig_port->port)); +return ; + }else { +DRM_ERROR ("Can't set LSPCON(port %c), falling to DP/HDMI\n" , +port_name (intel_dig_port->port)); + init_dp = true; + init_hdmi = true; + } + } +if (init_dp) {if (!intel_ddi_init_dp_connector (intel_dig_port)) goto err;
drivers/gpu/drm/i915/intel_drv.h +4 -0
@@ -1345,6 +1345,10 @@ void intel_dsi_init(struct drm_device *dev);/* intel_dvo.c */ void intel_dvo_init (struct drm_device *dev); +/* intel_lspcon.c */ +int intel_lspcon_init_connector (struct intel_digital_port *intel_dig_port); +bool is_lspcon_present_on_port (struct drm_i915_private * dev_priv, +enum port port);/* legacy fbdev emulation in intel_fbdev.c */ #ifdef CONFIG_DRM_FBDEV_EMULATION
drivers/gpu/drm/i915/intel_lspcon.c +10 -0
@@ -397,6 +397,16 @@ static const struct drm_connector_helper_funcs lspcon_connector_helper_funcs = { .best_encoder = intel_best_encoder, }; +bool is_lspcon_present_on_port (struct drm_i915_private *dev_priv,enum port port) +{ +/* +* TODO: HACK +* Replace this with proper VBT child dev config check +* logic once that patch is available in tree +*/ +return IS_GEN9 (dev_priv->dev) && (port ==PORT_B ); +} +int intel_lspcon_init_connector (struct intel_digital_port *intel_dig_port) {int ret;
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Jani Nikula
maintainerRe: [PATCH 12/12] DO_NOT_MERGE: drm/i915: Hack to enable lspcon initialization
Quoted 6 lines · Shashank Sharma
This patch adds a hack to enable lspcon on GEN9 devices. This should not be merged, and the hack must be replaced by proper VBT parsing logic.
Expecting this patch to enable lspcon bits in VBT:
https://lists.freedesktop.org/archives/intel-gfx/2016-March/089541.html
FYI, an updated version of that patch has been pushed now.
BR,
Jani.
Quoted 70 lines
Signed-off-by Shashank Sharma <[email protected]>--- drivers/gpu/drm/i915/intel_ddi.c | 15 +++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 4 ++++ drivers/gpu/drm/i915/intel_lspcon.c | 10 ++++++++++ 3 files changed, 29 insertions(+)drivers/gpu/drm/i915/intel_ddi.c +15
-0@@ -2169,6 +2169,21 @@ void intel_ddi_init(struct drm_device *dev, enum port port) intel_encoder->crtc_mask = (1 <<0 ) | (1 <<1 ) | (1 <<2 ); intel_encoder->cloneable =0 ; + +/* Check if LSPCON is configured on this port */ +if (is_lspcon_present_on_port (dev_priv, intel_dig_port->port)) { +if (!intel_lspcon_init_connector (intel_dig_port)) { +DRM_DEBUG_KMS ("LSPCON configured for port %c\n" , +port_name (intel_dig_port->port)); +return ; + }else { +DRM_ERROR ("Can't set LSPCON(port %c), falling to DP/HDMI\n" , +port_name (intel_dig_port->port)); + init_dp = true; + init_hdmi = true; + } + } +if (init_dp) {if (!intel_ddi_init_dp_connector (intel_dig_port)) goto err;drivers/gpu/drm/i915/intel_drv.h +4
-0@@ -1345,6 +1345,10 @@ void intel_dsi_init(struct drm_device *dev);/* intel_dvo.c */ void intel_dvo_init (struct drm_device *dev); +/* intel_lspcon.c */ +int intel_lspcon_init_connector (struct intel_digital_port *intel_dig_port); +bool is_lspcon_present_on_port (struct drm_i915_private * dev_priv, +enum port port);/* legacy fbdev emulation in intel_fbdev.c */ #ifdef CONFIG_DRM_FBDEV_EMULATION drivers/gpu/drm/i915/intel_lspcon.c +10
-0@@ -397,6 +397,16 @@ static const struct drm_connector_helper_funcs lspcon_connector_helper_funcs = { .best_encoder = intel_best_encoder, }; +bool is_lspcon_present_on_port (struct drm_i915_private *dev_priv,enum port port) +{ +/* +* TODO: HACK +* Replace this with proper VBT child dev config check +* logic once that patch is available in tree +*/ +return IS_GEN9 (dev_priv->dev) && (port ==PORT_B ); +} +int intel_lspcon_init_connector (struct intel_digital_port *intel_dig_port) {int ret;
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: [PATCH 12/12] DO_NOT_MERGE: drm/i915: Hack to enable lspcon initialization
Regards
Shashank
Quoted 8 lines
Quoted 3 lines
Expecting this patch to enable lspcon bits in VBT:
https://lists.freedesktop.org/archives/intel-gfx/2016-March/089541.htmlFYI, an updated version of that patch has been pushed now.
BR,
Jani.
Thanks Jani, will have a look.
Quoted 58 lines
Quoted 58 lines
Signed-off-by Shashank Sharma <[email protected]>--- drivers/gpu/drm/i915/intel_ddi.c | 15 +++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 4 ++++ drivers/gpu/drm/i915/intel_lspcon.c | 10 ++++++++++ 3 files changed, 29 insertions(+)drivers/gpu/drm/i915/intel_ddi.c +15
-0@@ -2169,6 +2169,21 @@ void intel_ddi_init(struct drm_device *dev, enum port port) intel_encoder->crtc_mask = (1 <<0 ) | (1 <<1 ) | (1 <<2 ); intel_encoder->cloneable =0 ; + +/* Check if LSPCON is configured on this port */ +if (is_lspcon_present_on_port (dev_priv, intel_dig_port->port)) { +if (!intel_lspcon_init_connector (intel_dig_port)) { +DRM_DEBUG_KMS ("LSPCON configured for port %c\n" , +port_name (intel_dig_port->port)); +return ; + }else { +DRM_ERROR ("Can't set LSPCON(port %c), falling to DP/HDMI\n" , +port_name (intel_dig_port->port)); + init_dp = true; + init_hdmi = true; + } + } +if (init_dp) {if (!intel_ddi_init_dp_connector (intel_dig_port)) goto err;drivers/gpu/drm/i915/intel_drv.h +4
-0@@ -1345,6 +1345,10 @@ void intel_dsi_init(struct drm_device *dev);/* intel_dvo.c */ void intel_dvo_init (struct drm_device *dev); +/* intel_lspcon.c */ +int intel_lspcon_init_connector (struct intel_digital_port *intel_dig_port); +bool is_lspcon_present_on_port (struct drm_i915_private * dev_priv, +enum port port);/* legacy fbdev emulation in intel_fbdev.c */ #ifdef CONFIG_DRM_FBDEV_EMULATION drivers/gpu/drm/i915/intel_lspcon.c +0
-0@@ -397,6 +397,16 @@ static const struct drm_connector_helper_funcs lspcon_connector_helper_funcs = { .best_encoder = intel_best_encoder, };
Quoted 14 lines
drivers/gpu/drm/i915/intel_lspcon.c static const struct drm_connector_helper_funcs lspcon_connector_helper_funcs = { · line 412
Quoted 13 lines
drivers/gpu/drm/i915/intel_lspcon.c +10
-0+bool is_lspcon_present_on_port (struct drm_i915_private *dev_priv,enum port port) +{ +/* +* TODO: HACK +* Replace this with proper VBT child dev config check +* logic once that patch is available in tree +*/ +return IS_GEN9 (dev_priv->dev) && (port ==PORT_B ); +} +int intel_lspcon_init_connector (struct intel_digital_port *intel_dig_port) {int ret;
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: failure for series starting with [01/12] drm: Add helper for DP++ adaptors
In reply to Shashank Sharma== Series Details ==
== Series Details ==
Series: series starting with [01/12] drm: Add helper for DP++ adaptors
URL : https://patchwork.freedesktop.org/series/5273/
State : failure
== Summary ==
Series 5273v1 Series without cover letter
http://patchwork.freedesktop.org/api/1.0/series/5273/revisions/1/mbox/
Test pm_rpm:
Subgroup basic-rte:
pass -> DMESG-WARN (byt-nuc) UNSTABLEbdw-nuci7 total:196 pass:184 dwarn:0 dfail:0 fail:0 skip:12 bdw-ultra total:196 pass:175 dwarn:0 dfail:0 fail:0 skip:21 bsw-nuc-2 total:196 pass:159 dwarn:0 dfail:0 fail:0 skip:37 byt-nuc total:196 pass:160 dwarn:1 dfail:0 fail:0 skip:35 hsw-brixbox total:196 pass:174 dwarn:0 dfail:0 fail:0 skip:22 hsw-gt2 total:196 pass:179 dwarn:0 dfail:0 fail:0 skip:17 ilk-hp8440p total:196 pass:132 dwarn:0 dfail:0 fail:0 skip:64 ivb-t430s total:196 pass:171 dwarn:0 dfail:0 fail:0 skip:25 snb-x220t total:164 pass:139 dwarn:0 dfail:0 fail:0 skip:25
BOOT FAILED for skl-i7k-2
BOOT FAILED for skl-nuci5
BOOT FAILED for snb-dellxps
Results at /archive/results/CI_IGT_test/Patchwork_1788/
3e353ec38c8fe68e9a243a9388389a8815115451 drm-intel-nightly: 2016y-04m-04d-11h-13m-54s UTC integration manifest 42274b6522e88e7efec0eb1266424f75f5342706 DO_NOT_MERGE: drm/i915: Hack to enable lspcon initialization cb2a8679cb098c4f7006d6af69ef5158adcad4a4 drm/i915: Add lspcon hpd handler d3e68835b36c7376325fe0479578c4025afbfaf5 drm/i915: Add lspcon core functions 774a8bdf98e49645e026ea1a2a54ae191251157c drm/i915: Add and register lspcon connector functions 903d5afde26b1ccdf32ef274110b1bec97bfe3c2 drm: Add lspcon (custom type2 dp->hdmi) support 427b454fba08ac71964b0272fd7bb07481ff7f40 drm/i915: Add and initialize lspcon connector 0a15f3af6d3075ac6ae2acd06547a799c1969601 drm/i915: Add new lspcon file dcf5003f1e48e4ff3bee7caa80910c5b64a66cc3 drm/i915: Add lspcon data structures 0e3d1b93f904915352c8e2084db59bb6cd9b9f6f drm/i915: Determine DP++ type 1 DVI adaptor presence based on VBT 6eb0111dbcfca1f81bd1b7aa09b5caf6ed6d40c3 drm/i915: Enable/disable TMDS output buffers in DP++ adaptor as needed de089b451d3807e321dd9b544d0d904074db710e drm/i915: Respect DP++ adaptor TMDS clock limit 1e9985bd5082f57571f3da12e3f06a55886c9522 drm: Add helper for DP++ adaptors
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx