Commit 318fbd7d authored by Lyude Paul's avatar Lyude Paul

drm/dp_dual_mode: Pass drm_device to drm_lspcon_(get|set)_mode()

So that we can start using drm_dbg_*() throughout the DRM DP helpers.
Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210423184309.207645-13-lyude@redhat.comReviewed-by: default avatarDave Airlie <airlied@redhat.com>
parent 739624d8
...@@ -430,6 +430,7 @@ EXPORT_SYMBOL(drm_dp_get_dual_mode_type_name); ...@@ -430,6 +430,7 @@ EXPORT_SYMBOL(drm_dp_get_dual_mode_type_name);
/** /**
* drm_lspcon_get_mode: Get LSPCON's current mode of operation by * drm_lspcon_get_mode: Get LSPCON's current mode of operation by
* reading offset (0x80, 0x41) * reading offset (0x80, 0x41)
* @dev: &drm_device to use
* @adapter: I2C-over-aux adapter * @adapter: I2C-over-aux adapter
* @mode: current lspcon mode of operation output variable * @mode: current lspcon mode of operation output variable
* *
...@@ -437,7 +438,7 @@ EXPORT_SYMBOL(drm_dp_get_dual_mode_type_name); ...@@ -437,7 +438,7 @@ EXPORT_SYMBOL(drm_dp_get_dual_mode_type_name);
* 0 on success, sets the current_mode value to appropriate mode * 0 on success, sets the current_mode value to appropriate mode
* -error on failure * -error on failure
*/ */
int drm_lspcon_get_mode(struct i2c_adapter *adapter, int drm_lspcon_get_mode(const struct drm_device *dev, struct i2c_adapter *adapter,
enum drm_lspcon_mode *mode) enum drm_lspcon_mode *mode)
{ {
u8 data; u8 data;
...@@ -477,13 +478,14 @@ EXPORT_SYMBOL(drm_lspcon_get_mode); ...@@ -477,13 +478,14 @@ EXPORT_SYMBOL(drm_lspcon_get_mode);
/** /**
* drm_lspcon_set_mode: Change LSPCON's mode of operation by * drm_lspcon_set_mode: Change LSPCON's mode of operation by
* writing offset (0x80, 0x40) * writing offset (0x80, 0x40)
* @dev: &drm_device to use
* @adapter: I2C-over-aux adapter * @adapter: I2C-over-aux adapter
* @mode: required mode of operation * @mode: required mode of operation
* *
* Returns: * Returns:
* 0 on success, -error on failure/timeout * 0 on success, -error on failure/timeout
*/ */
int drm_lspcon_set_mode(struct i2c_adapter *adapter, int drm_lspcon_set_mode(const struct drm_device *dev, struct i2c_adapter *adapter,
enum drm_lspcon_mode mode) enum drm_lspcon_mode mode)
{ {
u8 data = 0; u8 data = 0;
...@@ -508,7 +510,7 @@ int drm_lspcon_set_mode(struct i2c_adapter *adapter, ...@@ -508,7 +510,7 @@ int drm_lspcon_set_mode(struct i2c_adapter *adapter,
* so wait and retry until time out or done. * so wait and retry until time out or done.
*/ */
do { do {
ret = drm_lspcon_get_mode(adapter, &current_mode); ret = drm_lspcon_get_mode(dev, adapter, &current_mode);
if (ret) { if (ret) {
DRM_ERROR("can't confirm LSPCON mode change\n"); DRM_ERROR("can't confirm LSPCON mode change\n");
return ret; return ret;
......
...@@ -139,10 +139,11 @@ void lspcon_detect_hdr_capability(struct intel_lspcon *lspcon) ...@@ -139,10 +139,11 @@ void lspcon_detect_hdr_capability(struct intel_lspcon *lspcon)
static enum drm_lspcon_mode lspcon_get_current_mode(struct intel_lspcon *lspcon) static enum drm_lspcon_mode lspcon_get_current_mode(struct intel_lspcon *lspcon)
{ {
struct intel_dp *intel_dp = lspcon_to_intel_dp(lspcon);
enum drm_lspcon_mode current_mode; enum drm_lspcon_mode current_mode;
struct i2c_adapter *adapter = &lspcon_to_intel_dp(lspcon)->aux.ddc; struct i2c_adapter *adapter = &intel_dp->aux.ddc;
if (drm_lspcon_get_mode(adapter, &current_mode)) { if (drm_lspcon_get_mode(intel_dp->aux.drm_dev, adapter, &current_mode)) {
DRM_DEBUG_KMS("Error reading LSPCON mode\n"); DRM_DEBUG_KMS("Error reading LSPCON mode\n");
return DRM_LSPCON_MODE_INVALID; return DRM_LSPCON_MODE_INVALID;
} }
...@@ -175,11 +176,12 @@ static enum drm_lspcon_mode lspcon_wait_mode(struct intel_lspcon *lspcon, ...@@ -175,11 +176,12 @@ static enum drm_lspcon_mode lspcon_wait_mode(struct intel_lspcon *lspcon,
static int lspcon_change_mode(struct intel_lspcon *lspcon, static int lspcon_change_mode(struct intel_lspcon *lspcon,
enum drm_lspcon_mode mode) enum drm_lspcon_mode mode)
{ {
struct intel_dp *intel_dp = lspcon_to_intel_dp(lspcon);
int err; int err;
enum drm_lspcon_mode current_mode; enum drm_lspcon_mode current_mode;
struct i2c_adapter *adapter = &lspcon_to_intel_dp(lspcon)->aux.ddc; struct i2c_adapter *adapter = &intel_dp->aux.ddc;
err = drm_lspcon_get_mode(adapter, &current_mode); err = drm_lspcon_get_mode(intel_dp->aux.drm_dev, adapter, &current_mode);
if (err) { if (err) {
DRM_ERROR("Error reading LSPCON mode\n"); DRM_ERROR("Error reading LSPCON mode\n");
return err; return err;
...@@ -190,7 +192,7 @@ static int lspcon_change_mode(struct intel_lspcon *lspcon, ...@@ -190,7 +192,7 @@ static int lspcon_change_mode(struct intel_lspcon *lspcon,
return 0; return 0;
} }
err = drm_lspcon_set_mode(adapter, mode); err = drm_lspcon_set_mode(intel_dp->aux.drm_dev, adapter, mode);
if (err < 0) { if (err < 0) {
DRM_ERROR("LSPCON mode change failed\n"); DRM_ERROR("LSPCON mode change failed\n");
return err; return err;
......
...@@ -114,8 +114,8 @@ int drm_dp_dual_mode_set_tmds_output(const struct drm_device *dev, enum drm_dp_d ...@@ -114,8 +114,8 @@ int drm_dp_dual_mode_set_tmds_output(const struct drm_device *dev, enum drm_dp_d
struct i2c_adapter *adapter, bool enable); struct i2c_adapter *adapter, bool enable);
const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type); const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type);
int drm_lspcon_get_mode(struct i2c_adapter *adapter, int drm_lspcon_get_mode(const struct drm_device *dev, struct i2c_adapter *adapter,
enum drm_lspcon_mode *current_mode); enum drm_lspcon_mode *current_mode);
int drm_lspcon_set_mode(struct i2c_adapter *adapter, int drm_lspcon_set_mode(const struct drm_device *dev, struct i2c_adapter *adapter,
enum drm_lspcon_mode reqd_mode); enum drm_lspcon_mode reqd_mode);
#endif #endif
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