Commit 92ea2220 authored by Lyude Paul's avatar Lyude Paul

drm/dp_dual_mode: Pass drm_device to drm_dp_dual_mode_detect()

Since we're about to be using drm_dbg_*() throughout the DP helpers, we'll
need to be able to access the DRM device in the dual mode DP helpers as
well. Note however that since drm_dp_dual_mode_detect() can be called with
DDC adapters that aren't part of a drm_dp_aux struct, we need to pass down
the drm_device to these functions instead of using drm_dp_aux.
Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210423184309.207645-9-lyude@redhat.comReviewed-by: default avatarDave Airlie <airlied@redhat.com>
parent 427e59d3
...@@ -165,6 +165,7 @@ static bool is_lspcon_adaptor(const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN], ...@@ -165,6 +165,7 @@ static bool is_lspcon_adaptor(const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN],
/** /**
* drm_dp_dual_mode_detect - Identify the DP dual mode adaptor * drm_dp_dual_mode_detect - Identify the DP dual mode adaptor
* @dev: &drm_device to use
* @adapter: I2C adapter for the DDC bus * @adapter: I2C adapter for the DDC bus
* *
* Attempt to identify the type of the DP dual mode adaptor used. * Attempt to identify the type of the DP dual mode adaptor used.
...@@ -178,7 +179,8 @@ static bool is_lspcon_adaptor(const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN], ...@@ -178,7 +179,8 @@ static bool is_lspcon_adaptor(const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN],
* Returns: * Returns:
* The type of the DP dual mode adaptor used * The type of the DP dual mode adaptor used
*/ */
enum drm_dp_dual_mode_type drm_dp_dual_mode_detect(struct i2c_adapter *adapter) enum drm_dp_dual_mode_type drm_dp_dual_mode_detect(const struct drm_device *dev,
struct i2c_adapter *adapter)
{ {
char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN] = {}; char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN] = {};
uint8_t adaptor_id = 0x00; uint8_t adaptor_id = 0x00;
......
...@@ -2223,7 +2223,7 @@ intel_hdmi_dp_dual_mode_detect(struct drm_connector *connector, bool has_edid) ...@@ -2223,7 +2223,7 @@ intel_hdmi_dp_dual_mode_detect(struct drm_connector *connector, bool has_edid)
enum port port = hdmi_to_dig_port(hdmi)->base.port; enum port port = hdmi_to_dig_port(hdmi)->base.port;
struct i2c_adapter *adapter = struct i2c_adapter *adapter =
intel_gmbus_get_adapter(dev_priv, hdmi->ddc_bus); intel_gmbus_get_adapter(dev_priv, hdmi->ddc_bus);
enum drm_dp_dual_mode_type type = drm_dp_dual_mode_detect(adapter); enum drm_dp_dual_mode_type type = drm_dp_dual_mode_detect(&dev_priv->drm, adapter);
/* /*
* Type 1 DVI adaptors are not required to implement any * Type 1 DVI adaptors are not required to implement any
......
...@@ -221,7 +221,8 @@ static bool lspcon_probe(struct intel_lspcon *lspcon) ...@@ -221,7 +221,8 @@ static bool lspcon_probe(struct intel_lspcon *lspcon)
{ {
int retry; int retry;
enum drm_dp_dual_mode_type adaptor_type; enum drm_dp_dual_mode_type adaptor_type;
struct i2c_adapter *adapter = &lspcon_to_intel_dp(lspcon)->aux.ddc; struct intel_dp *intel_dp = lspcon_to_intel_dp(lspcon);
struct i2c_adapter *adapter = &intel_dp->aux.ddc;
enum drm_lspcon_mode expected_mode; enum drm_lspcon_mode expected_mode;
expected_mode = lspcon_wake_native_aux_ch(lspcon) ? expected_mode = lspcon_wake_native_aux_ch(lspcon) ?
...@@ -232,7 +233,7 @@ static bool lspcon_probe(struct intel_lspcon *lspcon) ...@@ -232,7 +233,7 @@ static bool lspcon_probe(struct intel_lspcon *lspcon)
if (retry) if (retry)
usleep_range(500, 1000); usleep_range(500, 1000);
adaptor_type = drm_dp_dual_mode_detect(adapter); adaptor_type = drm_dp_dual_mode_detect(intel_dp->aux.drm_dev, adapter);
if (adaptor_type == DRM_DP_DUAL_MODE_LSPCON) if (adaptor_type == DRM_DP_DUAL_MODE_LSPCON)
break; break;
} }
......
...@@ -62,6 +62,7 @@ ...@@ -62,6 +62,7 @@
#define DP_DUAL_MODE_LSPCON_CURRENT_MODE 0x41 #define DP_DUAL_MODE_LSPCON_CURRENT_MODE 0x41
#define DP_DUAL_MODE_LSPCON_MODE_PCON 0x1 #define DP_DUAL_MODE_LSPCON_MODE_PCON 0x1
struct drm_device;
struct i2c_adapter; struct i2c_adapter;
ssize_t drm_dp_dual_mode_read(struct i2c_adapter *adapter, ssize_t drm_dp_dual_mode_read(struct i2c_adapter *adapter,
...@@ -103,7 +104,8 @@ enum drm_dp_dual_mode_type { ...@@ -103,7 +104,8 @@ enum drm_dp_dual_mode_type {
DRM_DP_DUAL_MODE_LSPCON, DRM_DP_DUAL_MODE_LSPCON,
}; };
enum drm_dp_dual_mode_type drm_dp_dual_mode_detect(struct i2c_adapter *adapter); enum drm_dp_dual_mode_type
drm_dp_dual_mode_detect(const struct drm_device *dev, struct i2c_adapter *adapter);
int drm_dp_dual_mode_max_tmds_clock(enum drm_dp_dual_mode_type type, int drm_dp_dual_mode_max_tmds_clock(enum drm_dp_dual_mode_type type,
struct i2c_adapter *adapter); struct i2c_adapter *adapter);
int drm_dp_dual_mode_get_tmds_output(enum drm_dp_dual_mode_type type, int drm_dp_dual_mode_get_tmds_output(enum drm_dp_dual_mode_type type,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment