Commit f70e4376 authored by Jani Nikula's avatar Jani Nikula

drm/i915/dp: convert intel_dp_aux.[ch] to struct intel_display

Going forward, struct intel_display shall replace struct
drm_i915_private as the main display device data pointer type. Convert
intel_dp_aux.[ch] to struct intel_display.
Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/f295369d573d217323a624fd4b8dc477a6cf183b.1725012870.git.jani.nikula@intel.com
parent a954e0a2
...@@ -576,6 +576,7 @@ void valleyview_pipestat_irq_handler(struct drm_i915_private *dev_priv, ...@@ -576,6 +576,7 @@ void valleyview_pipestat_irq_handler(struct drm_i915_private *dev_priv,
static void ibx_irq_handler(struct drm_i915_private *dev_priv, u32 pch_iir) static void ibx_irq_handler(struct drm_i915_private *dev_priv, u32 pch_iir)
{ {
struct intel_display *display = &dev_priv->display;
enum pipe pipe; enum pipe pipe;
u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK; u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK;
...@@ -589,7 +590,7 @@ static void ibx_irq_handler(struct drm_i915_private *dev_priv, u32 pch_iir) ...@@ -589,7 +590,7 @@ static void ibx_irq_handler(struct drm_i915_private *dev_priv, u32 pch_iir)
} }
if (pch_iir & SDE_AUX_MASK) if (pch_iir & SDE_AUX_MASK)
intel_dp_aux_irq_handler(dev_priv); intel_dp_aux_irq_handler(display);
if (pch_iir & SDE_GMBUS) if (pch_iir & SDE_GMBUS)
intel_gmbus_irq_handler(dev_priv); intel_gmbus_irq_handler(dev_priv);
...@@ -664,6 +665,7 @@ static void cpt_serr_int_handler(struct drm_i915_private *dev_priv) ...@@ -664,6 +665,7 @@ static void cpt_serr_int_handler(struct drm_i915_private *dev_priv)
static void cpt_irq_handler(struct drm_i915_private *dev_priv, u32 pch_iir) static void cpt_irq_handler(struct drm_i915_private *dev_priv, u32 pch_iir)
{ {
struct intel_display *display = &dev_priv->display;
enum pipe pipe; enum pipe pipe;
u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_CPT; u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_CPT;
...@@ -677,7 +679,7 @@ static void cpt_irq_handler(struct drm_i915_private *dev_priv, u32 pch_iir) ...@@ -677,7 +679,7 @@ static void cpt_irq_handler(struct drm_i915_private *dev_priv, u32 pch_iir)
} }
if (pch_iir & SDE_AUX_MASK_CPT) if (pch_iir & SDE_AUX_MASK_CPT)
intel_dp_aux_irq_handler(dev_priv); intel_dp_aux_irq_handler(display);
if (pch_iir & SDE_GMBUS_CPT) if (pch_iir & SDE_GMBUS_CPT)
intel_gmbus_irq_handler(dev_priv); intel_gmbus_irq_handler(dev_priv);
...@@ -709,7 +711,7 @@ void ilk_display_irq_handler(struct drm_i915_private *dev_priv, u32 de_iir) ...@@ -709,7 +711,7 @@ void ilk_display_irq_handler(struct drm_i915_private *dev_priv, u32 de_iir)
ilk_hpd_irq_handler(dev_priv, hotplug_trigger); ilk_hpd_irq_handler(dev_priv, hotplug_trigger);
if (de_iir & DE_AUX_CHANNEL_A) if (de_iir & DE_AUX_CHANNEL_A)
intel_dp_aux_irq_handler(dev_priv); intel_dp_aux_irq_handler(display);
if (de_iir & DE_GSE) if (de_iir & DE_GSE)
intel_opregion_asle_intr(display); intel_opregion_asle_intr(display);
...@@ -775,7 +777,7 @@ void ivb_display_irq_handler(struct drm_i915_private *dev_priv, u32 de_iir) ...@@ -775,7 +777,7 @@ void ivb_display_irq_handler(struct drm_i915_private *dev_priv, u32 de_iir)
} }
if (de_iir & DE_AUX_CHANNEL_A_IVB) if (de_iir & DE_AUX_CHANNEL_A_IVB)
intel_dp_aux_irq_handler(dev_priv); intel_dp_aux_irq_handler(display);
if (de_iir & DE_GSE_IVB) if (de_iir & DE_GSE_IVB)
intel_opregion_asle_intr(display); intel_opregion_asle_intr(display);
...@@ -1065,6 +1067,7 @@ static void gen8_read_and_ack_pch_irqs(struct drm_i915_private *i915, u32 *pch_i ...@@ -1065,6 +1067,7 @@ static void gen8_read_and_ack_pch_irqs(struct drm_i915_private *i915, u32 *pch_i
void gen8_de_irq_handler(struct drm_i915_private *dev_priv, u32 master_ctl) void gen8_de_irq_handler(struct drm_i915_private *dev_priv, u32 master_ctl)
{ {
struct intel_display *display = &dev_priv->display;
u32 iir; u32 iir;
enum pipe pipe; enum pipe pipe;
...@@ -1100,7 +1103,7 @@ void gen8_de_irq_handler(struct drm_i915_private *dev_priv, u32 master_ctl) ...@@ -1100,7 +1103,7 @@ void gen8_de_irq_handler(struct drm_i915_private *dev_priv, u32 master_ctl)
intel_uncore_write(&dev_priv->uncore, GEN8_DE_PORT_IIR, iir); intel_uncore_write(&dev_priv->uncore, GEN8_DE_PORT_IIR, iir);
if (iir & gen8_de_port_aux_mask(dev_priv)) { if (iir & gen8_de_port_aux_mask(dev_priv)) {
intel_dp_aux_irq_handler(dev_priv); intel_dp_aux_irq_handler(display);
found = true; found = true;
} }
......
...@@ -18,12 +18,12 @@ ...@@ -18,12 +18,12 @@
#define AUX_CH_NAME_BUFSIZE 6 #define AUX_CH_NAME_BUFSIZE 6
static const char *aux_ch_name(struct drm_i915_private *i915, static const char *aux_ch_name(struct intel_display *display,
char *buf, int size, enum aux_ch aux_ch) char *buf, int size, enum aux_ch aux_ch)
{ {
if (DISPLAY_VER(i915) >= 13 && aux_ch >= AUX_CH_D_XELPD) if (DISPLAY_VER(display) >= 13 && aux_ch >= AUX_CH_D_XELPD)
snprintf(buf, size, "%c", 'A' + aux_ch - AUX_CH_D_XELPD + AUX_CH_D); snprintf(buf, size, "%c", 'A' + aux_ch - AUX_CH_D_XELPD + AUX_CH_D);
else if (DISPLAY_VER(i915) >= 12 && aux_ch >= AUX_CH_USBC1) else if (DISPLAY_VER(display) >= 12 && aux_ch >= AUX_CH_USBC1)
snprintf(buf, size, "USBC%c", '1' + aux_ch - AUX_CH_USBC1); snprintf(buf, size, "USBC%c", '1' + aux_ch - AUX_CH_USBC1);
else else
snprintf(buf, size, "%c", 'A' + aux_ch); snprintf(buf, size, "%c", 'A' + aux_ch);
...@@ -56,17 +56,18 @@ static void intel_dp_aux_unpack(u32 src, u8 *dst, int dst_bytes) ...@@ -56,17 +56,18 @@ static void intel_dp_aux_unpack(u32 src, u8 *dst, int dst_bytes)
static u32 static u32
intel_dp_aux_wait_done(struct intel_dp *intel_dp) intel_dp_aux_wait_done(struct intel_dp *intel_dp)
{ {
struct drm_i915_private *i915 = dp_to_i915(intel_dp); struct intel_display *display = to_intel_display(intel_dp);
i915_reg_t ch_ctl = intel_dp->aux_ch_ctl_reg(intel_dp); i915_reg_t ch_ctl = intel_dp->aux_ch_ctl_reg(intel_dp);
const unsigned int timeout_ms = 10; const unsigned int timeout_ms = 10;
u32 status; u32 status;
int ret; int ret;
ret = intel_de_wait_custom(i915, ch_ctl, DP_AUX_CH_CTL_SEND_BUSY, 0, ret = intel_de_wait_custom(display, ch_ctl, DP_AUX_CH_CTL_SEND_BUSY,
0,
2, timeout_ms, &status); 2, timeout_ms, &status);
if (ret == -ETIMEDOUT) if (ret == -ETIMEDOUT)
drm_err(&i915->drm, drm_err(display->drm,
"%s: did not complete or timeout within %ums (status 0x%08x)\n", "%s: did not complete or timeout within %ums (status 0x%08x)\n",
intel_dp->aux.name, timeout_ms, status); intel_dp->aux.name, timeout_ms, status);
...@@ -75,7 +76,7 @@ intel_dp_aux_wait_done(struct intel_dp *intel_dp) ...@@ -75,7 +76,7 @@ intel_dp_aux_wait_done(struct intel_dp *intel_dp)
static u32 g4x_get_aux_clock_divider(struct intel_dp *intel_dp, int index) static u32 g4x_get_aux_clock_divider(struct intel_dp *intel_dp, int index)
{ {
struct drm_i915_private *i915 = dp_to_i915(intel_dp); struct intel_display *display = to_intel_display(intel_dp);
if (index) if (index)
return 0; return 0;
...@@ -84,12 +85,12 @@ static u32 g4x_get_aux_clock_divider(struct intel_dp *intel_dp, int index) ...@@ -84,12 +85,12 @@ static u32 g4x_get_aux_clock_divider(struct intel_dp *intel_dp, int index)
* The clock divider is based off the hrawclk, and would like to run at * The clock divider is based off the hrawclk, and would like to run at
* 2MHz. So, take the hrawclk value and divide by 2000 and use that * 2MHz. So, take the hrawclk value and divide by 2000 and use that
*/ */
return DIV_ROUND_CLOSEST(DISPLAY_RUNTIME_INFO(i915)->rawclk_freq, 2000); return DIV_ROUND_CLOSEST(DISPLAY_RUNTIME_INFO(display)->rawclk_freq, 2000);
} }
static u32 ilk_get_aux_clock_divider(struct intel_dp *intel_dp, int index) static u32 ilk_get_aux_clock_divider(struct intel_dp *intel_dp, int index)
{ {
struct drm_i915_private *i915 = dp_to_i915(intel_dp); struct intel_display *display = to_intel_display(intel_dp);
struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp); struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
u32 freq; u32 freq;
...@@ -102,15 +103,16 @@ static u32 ilk_get_aux_clock_divider(struct intel_dp *intel_dp, int index) ...@@ -102,15 +103,16 @@ static u32 ilk_get_aux_clock_divider(struct intel_dp *intel_dp, int index)
* divide by 2000 and use that * divide by 2000 and use that
*/ */
if (dig_port->aux_ch == AUX_CH_A) if (dig_port->aux_ch == AUX_CH_A)
freq = i915->display.cdclk.hw.cdclk; freq = display->cdclk.hw.cdclk;
else else
freq = DISPLAY_RUNTIME_INFO(i915)->rawclk_freq; freq = DISPLAY_RUNTIME_INFO(display)->rawclk_freq;
return DIV_ROUND_CLOSEST(freq, 2000); return DIV_ROUND_CLOSEST(freq, 2000);
} }
static u32 hsw_get_aux_clock_divider(struct intel_dp *intel_dp, int index) static u32 hsw_get_aux_clock_divider(struct intel_dp *intel_dp, int index)
{ {
struct drm_i915_private *i915 = dp_to_i915(intel_dp); struct intel_display *display = to_intel_display(intel_dp);
struct drm_i915_private *i915 = to_i915(display->drm);
struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp); struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
if (dig_port->aux_ch != AUX_CH_A && HAS_PCH_LPT_H(i915)) { if (dig_port->aux_ch != AUX_CH_A && HAS_PCH_LPT_H(i915)) {
...@@ -201,8 +203,8 @@ static u32 skl_get_aux_send_ctl(struct intel_dp *intel_dp, ...@@ -201,8 +203,8 @@ static u32 skl_get_aux_send_ctl(struct intel_dp *intel_dp,
int send_bytes, int send_bytes,
u32 unused) u32 unused)
{ {
struct intel_display *display = to_intel_display(intel_dp);
struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp); struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
u32 ret; u32 ret;
/* /*
...@@ -227,7 +229,7 @@ static u32 skl_get_aux_send_ctl(struct intel_dp *intel_dp, ...@@ -227,7 +229,7 @@ static u32 skl_get_aux_send_ctl(struct intel_dp *intel_dp,
* Power request bit is already set during aux power well enable. * Power request bit is already set during aux power well enable.
* Preserve the bit across aux transactions. * Preserve the bit across aux transactions.
*/ */
if (DISPLAY_VER(i915) >= 14) if (DISPLAY_VER(display) >= 14)
ret |= XELPDP_DP_AUX_CH_CTL_POWER_REQUEST; ret |= XELPDP_DP_AUX_CH_CTL_POWER_REQUEST;
return ret; return ret;
...@@ -239,6 +241,7 @@ intel_dp_aux_xfer(struct intel_dp *intel_dp, ...@@ -239,6 +241,7 @@ intel_dp_aux_xfer(struct intel_dp *intel_dp,
u8 *recv, int recv_size, u8 *recv, int recv_size,
u32 aux_send_ctl_flags) u32 aux_send_ctl_flags)
{ {
struct intel_display *display = to_intel_display(intel_dp);
struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp); struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
struct intel_encoder *encoder = &dig_port->base; struct intel_encoder *encoder = &dig_port->base;
struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev); struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
...@@ -297,7 +300,7 @@ intel_dp_aux_xfer(struct intel_dp *intel_dp, ...@@ -297,7 +300,7 @@ intel_dp_aux_xfer(struct intel_dp *intel_dp,
/* Try to wait for any previous AUX channel activity */ /* Try to wait for any previous AUX channel activity */
for (try = 0; try < 3; try++) { for (try = 0; try < 3; try++) {
status = intel_de_read_notrace(i915, ch_ctl); status = intel_de_read_notrace(display, ch_ctl);
if ((status & DP_AUX_CH_CTL_SEND_BUSY) == 0) if ((status & DP_AUX_CH_CTL_SEND_BUSY) == 0)
break; break;
msleep(1); msleep(1);
...@@ -306,10 +309,10 @@ intel_dp_aux_xfer(struct intel_dp *intel_dp, ...@@ -306,10 +309,10 @@ intel_dp_aux_xfer(struct intel_dp *intel_dp,
trace_i915_reg_rw(false, ch_ctl, status, sizeof(status), true); trace_i915_reg_rw(false, ch_ctl, status, sizeof(status), true);
if (try == 3) { if (try == 3) {
const u32 status = intel_de_read(i915, ch_ctl); const u32 status = intel_de_read(display, ch_ctl);
if (status != intel_dp->aux_busy_last_status) { if (status != intel_dp->aux_busy_last_status) {
drm_WARN(&i915->drm, 1, drm_WARN(display->drm, 1,
"%s: not started (status 0x%08x)\n", "%s: not started (status 0x%08x)\n",
intel_dp->aux.name, status); intel_dp->aux.name, status);
intel_dp->aux_busy_last_status = status; intel_dp->aux_busy_last_status = status;
...@@ -320,7 +323,7 @@ intel_dp_aux_xfer(struct intel_dp *intel_dp, ...@@ -320,7 +323,7 @@ intel_dp_aux_xfer(struct intel_dp *intel_dp,
} }
/* Only 5 data registers! */ /* Only 5 data registers! */
if (drm_WARN_ON(&i915->drm, send_bytes > 20 || recv_size > 20)) { if (drm_WARN_ON(display->drm, send_bytes > 20 || recv_size > 20)) {
ret = -E2BIG; ret = -E2BIG;
goto out; goto out;
} }
...@@ -336,17 +339,17 @@ intel_dp_aux_xfer(struct intel_dp *intel_dp, ...@@ -336,17 +339,17 @@ intel_dp_aux_xfer(struct intel_dp *intel_dp,
for (try = 0; try < 5; try++) { for (try = 0; try < 5; try++) {
/* Load the send data into the aux channel data registers */ /* Load the send data into the aux channel data registers */
for (i = 0; i < send_bytes; i += 4) for (i = 0; i < send_bytes; i += 4)
intel_de_write(i915, ch_data[i >> 2], intel_de_write(display, ch_data[i >> 2],
intel_dp_aux_pack(send + i, intel_dp_aux_pack(send + i,
send_bytes - i)); send_bytes - i));
/* Send the command and wait for it to complete */ /* Send the command and wait for it to complete */
intel_de_write(i915, ch_ctl, send_ctl); intel_de_write(display, ch_ctl, send_ctl);
status = intel_dp_aux_wait_done(intel_dp); status = intel_dp_aux_wait_done(intel_dp);
/* Clear done status and any errors */ /* Clear done status and any errors */
intel_de_write(i915, ch_ctl, intel_de_write(display, ch_ctl,
status | DP_AUX_CH_CTL_DONE | status | DP_AUX_CH_CTL_DONE |
DP_AUX_CH_CTL_TIME_OUT_ERROR | DP_AUX_CH_CTL_TIME_OUT_ERROR |
DP_AUX_CH_CTL_RECEIVE_ERROR); DP_AUX_CH_CTL_RECEIVE_ERROR);
...@@ -370,7 +373,7 @@ intel_dp_aux_xfer(struct intel_dp *intel_dp, ...@@ -370,7 +373,7 @@ intel_dp_aux_xfer(struct intel_dp *intel_dp,
} }
if ((status & DP_AUX_CH_CTL_DONE) == 0) { if ((status & DP_AUX_CH_CTL_DONE) == 0) {
drm_err(&i915->drm, "%s: not done (status 0x%08x)\n", drm_err(display->drm, "%s: not done (status 0x%08x)\n",
intel_dp->aux.name, status); intel_dp->aux.name, status);
ret = -EBUSY; ret = -EBUSY;
goto out; goto out;
...@@ -382,7 +385,7 @@ intel_dp_aux_xfer(struct intel_dp *intel_dp, ...@@ -382,7 +385,7 @@ intel_dp_aux_xfer(struct intel_dp *intel_dp,
* not connected. * not connected.
*/ */
if (status & DP_AUX_CH_CTL_RECEIVE_ERROR) { if (status & DP_AUX_CH_CTL_RECEIVE_ERROR) {
drm_err(&i915->drm, "%s: receive error (status 0x%08x)\n", drm_err(display->drm, "%s: receive error (status 0x%08x)\n",
intel_dp->aux.name, status); intel_dp->aux.name, status);
ret = -EIO; ret = -EIO;
goto out; goto out;
...@@ -393,7 +396,7 @@ intel_dp_aux_xfer(struct intel_dp *intel_dp, ...@@ -393,7 +396,7 @@ intel_dp_aux_xfer(struct intel_dp *intel_dp,
* -- don't fill the kernel log with these * -- don't fill the kernel log with these
*/ */
if (status & DP_AUX_CH_CTL_TIME_OUT_ERROR) { if (status & DP_AUX_CH_CTL_TIME_OUT_ERROR) {
drm_dbg_kms(&i915->drm, "%s: timeout (status 0x%08x)\n", drm_dbg_kms(display->drm, "%s: timeout (status 0x%08x)\n",
intel_dp->aux.name, status); intel_dp->aux.name, status);
ret = -ETIMEDOUT; ret = -ETIMEDOUT;
goto out; goto out;
...@@ -408,7 +411,7 @@ intel_dp_aux_xfer(struct intel_dp *intel_dp, ...@@ -408,7 +411,7 @@ intel_dp_aux_xfer(struct intel_dp *intel_dp,
* drm layer takes care for the necessary retries. * drm layer takes care for the necessary retries.
*/ */
if (recv_bytes == 0 || recv_bytes > 20) { if (recv_bytes == 0 || recv_bytes > 20) {
drm_dbg_kms(&i915->drm, drm_dbg_kms(display->drm,
"%s: Forbidden recv_bytes = %d on aux transaction\n", "%s: Forbidden recv_bytes = %d on aux transaction\n",
intel_dp->aux.name, recv_bytes); intel_dp->aux.name, recv_bytes);
ret = -EBUSY; ret = -EBUSY;
...@@ -419,7 +422,7 @@ intel_dp_aux_xfer(struct intel_dp *intel_dp, ...@@ -419,7 +422,7 @@ intel_dp_aux_xfer(struct intel_dp *intel_dp,
recv_bytes = recv_size; recv_bytes = recv_size;
for (i = 0; i < recv_bytes; i += 4) for (i = 0; i < recv_bytes; i += 4)
intel_dp_aux_unpack(intel_de_read(i915, ch_data[i >> 2]), intel_dp_aux_unpack(intel_de_read(display, ch_data[i >> 2]),
recv + i, recv_bytes - i); recv + i, recv_bytes - i);
ret = recv_bytes; ret = recv_bytes;
...@@ -468,7 +471,7 @@ static ssize_t ...@@ -468,7 +471,7 @@ static ssize_t
intel_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) intel_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)
{ {
struct intel_dp *intel_dp = container_of(aux, struct intel_dp, aux); struct intel_dp *intel_dp = container_of(aux, struct intel_dp, aux);
struct drm_i915_private *i915 = dp_to_i915(intel_dp); struct intel_display *display = to_intel_display(intel_dp);
u8 txbuf[20], rxbuf[20]; u8 txbuf[20], rxbuf[20];
size_t txsize, rxsize; size_t txsize, rxsize;
u32 flags = intel_dp_aux_xfer_flags(msg); u32 flags = intel_dp_aux_xfer_flags(msg);
...@@ -483,10 +486,10 @@ intel_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) ...@@ -483,10 +486,10 @@ intel_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)
txsize = msg->size ? HEADER_SIZE + msg->size : BARE_ADDRESS_SIZE; txsize = msg->size ? HEADER_SIZE + msg->size : BARE_ADDRESS_SIZE;
rxsize = 2; /* 0 or 1 data bytes */ rxsize = 2; /* 0 or 1 data bytes */
if (drm_WARN_ON(&i915->drm, txsize > 20)) if (drm_WARN_ON(display->drm, txsize > 20))
return -E2BIG; return -E2BIG;
drm_WARN_ON(&i915->drm, !msg->buffer != !msg->size); drm_WARN_ON(display->drm, !msg->buffer != !msg->size);
if (msg->buffer) if (msg->buffer)
memcpy(txbuf + HEADER_SIZE, msg->buffer, msg->size); memcpy(txbuf + HEADER_SIZE, msg->buffer, msg->size);
...@@ -511,7 +514,7 @@ intel_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) ...@@ -511,7 +514,7 @@ intel_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)
txsize = msg->size ? HEADER_SIZE : BARE_ADDRESS_SIZE; txsize = msg->size ? HEADER_SIZE : BARE_ADDRESS_SIZE;
rxsize = msg->size + 1; rxsize = msg->size + 1;
if (drm_WARN_ON(&i915->drm, rxsize > 20)) if (drm_WARN_ON(display->drm, rxsize > 20))
return -E2BIG; return -E2BIG;
ret = intel_dp_aux_xfer(intel_dp, txbuf, txsize, ret = intel_dp_aux_xfer(intel_dp, txbuf, txsize,
...@@ -721,7 +724,7 @@ static i915_reg_t tgl_aux_data_reg(struct intel_dp *intel_dp, int index) ...@@ -721,7 +724,7 @@ static i915_reg_t tgl_aux_data_reg(struct intel_dp *intel_dp, int index)
static i915_reg_t xelpdp_aux_ctl_reg(struct intel_dp *intel_dp) static i915_reg_t xelpdp_aux_ctl_reg(struct intel_dp *intel_dp)
{ {
struct drm_i915_private *i915 = dp_to_i915(intel_dp); struct intel_display *display = to_intel_display(intel_dp);
struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp); struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
enum aux_ch aux_ch = dig_port->aux_ch; enum aux_ch aux_ch = dig_port->aux_ch;
...@@ -732,16 +735,16 @@ static i915_reg_t xelpdp_aux_ctl_reg(struct intel_dp *intel_dp) ...@@ -732,16 +735,16 @@ static i915_reg_t xelpdp_aux_ctl_reg(struct intel_dp *intel_dp)
case AUX_CH_USBC2: case AUX_CH_USBC2:
case AUX_CH_USBC3: case AUX_CH_USBC3:
case AUX_CH_USBC4: case AUX_CH_USBC4:
return XELPDP_DP_AUX_CH_CTL(i915, aux_ch); return XELPDP_DP_AUX_CH_CTL(display, aux_ch);
default: default:
MISSING_CASE(aux_ch); MISSING_CASE(aux_ch);
return XELPDP_DP_AUX_CH_CTL(i915, AUX_CH_A); return XELPDP_DP_AUX_CH_CTL(display, AUX_CH_A);
} }
} }
static i915_reg_t xelpdp_aux_data_reg(struct intel_dp *intel_dp, int index) static i915_reg_t xelpdp_aux_data_reg(struct intel_dp *intel_dp, int index)
{ {
struct drm_i915_private *i915 = dp_to_i915(intel_dp); struct intel_display *display = to_intel_display(intel_dp);
struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp); struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
enum aux_ch aux_ch = dig_port->aux_ch; enum aux_ch aux_ch = dig_port->aux_ch;
...@@ -752,10 +755,10 @@ static i915_reg_t xelpdp_aux_data_reg(struct intel_dp *intel_dp, int index) ...@@ -752,10 +755,10 @@ static i915_reg_t xelpdp_aux_data_reg(struct intel_dp *intel_dp, int index)
case AUX_CH_USBC2: case AUX_CH_USBC2:
case AUX_CH_USBC3: case AUX_CH_USBC3:
case AUX_CH_USBC4: case AUX_CH_USBC4:
return XELPDP_DP_AUX_CH_DATA(i915, aux_ch, index); return XELPDP_DP_AUX_CH_DATA(display, aux_ch, index);
default: default:
MISSING_CASE(aux_ch); MISSING_CASE(aux_ch);
return XELPDP_DP_AUX_CH_DATA(i915, AUX_CH_A, index); return XELPDP_DP_AUX_CH_DATA(display, AUX_CH_A, index);
} }
} }
...@@ -769,19 +772,20 @@ void intel_dp_aux_fini(struct intel_dp *intel_dp) ...@@ -769,19 +772,20 @@ void intel_dp_aux_fini(struct intel_dp *intel_dp)
void intel_dp_aux_init(struct intel_dp *intel_dp) void intel_dp_aux_init(struct intel_dp *intel_dp)
{ {
struct drm_i915_private *i915 = dp_to_i915(intel_dp); struct intel_display *display = to_intel_display(intel_dp);
struct drm_i915_private *i915 = to_i915(display->drm);
struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp); struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
struct intel_encoder *encoder = &dig_port->base; struct intel_encoder *encoder = &dig_port->base;
enum aux_ch aux_ch = dig_port->aux_ch; enum aux_ch aux_ch = dig_port->aux_ch;
char buf[AUX_CH_NAME_BUFSIZE]; char buf[AUX_CH_NAME_BUFSIZE];
if (DISPLAY_VER(i915) >= 14) { if (DISPLAY_VER(display) >= 14) {
intel_dp->aux_ch_ctl_reg = xelpdp_aux_ctl_reg; intel_dp->aux_ch_ctl_reg = xelpdp_aux_ctl_reg;
intel_dp->aux_ch_data_reg = xelpdp_aux_data_reg; intel_dp->aux_ch_data_reg = xelpdp_aux_data_reg;
} else if (DISPLAY_VER(i915) >= 12) { } else if (DISPLAY_VER(display) >= 12) {
intel_dp->aux_ch_ctl_reg = tgl_aux_ctl_reg; intel_dp->aux_ch_ctl_reg = tgl_aux_ctl_reg;
intel_dp->aux_ch_data_reg = tgl_aux_data_reg; intel_dp->aux_ch_data_reg = tgl_aux_data_reg;
} else if (DISPLAY_VER(i915) >= 9) { } else if (DISPLAY_VER(display) >= 9) {
intel_dp->aux_ch_ctl_reg = skl_aux_ctl_reg; intel_dp->aux_ch_ctl_reg = skl_aux_ctl_reg;
intel_dp->aux_ch_data_reg = skl_aux_data_reg; intel_dp->aux_ch_data_reg = skl_aux_data_reg;
} else if (HAS_PCH_SPLIT(i915)) { } else if (HAS_PCH_SPLIT(i915)) {
...@@ -795,7 +799,7 @@ void intel_dp_aux_init(struct intel_dp *intel_dp) ...@@ -795,7 +799,7 @@ void intel_dp_aux_init(struct intel_dp *intel_dp)
intel_dp->aux_ch_data_reg = g4x_aux_data_reg; intel_dp->aux_ch_data_reg = g4x_aux_data_reg;
} }
if (DISPLAY_VER(i915) >= 9) if (DISPLAY_VER(display) >= 9)
intel_dp->get_aux_clock_divider = skl_get_aux_clock_divider; intel_dp->get_aux_clock_divider = skl_get_aux_clock_divider;
else if (IS_BROADWELL(i915) || IS_HASWELL(i915)) else if (IS_BROADWELL(i915) || IS_HASWELL(i915))
intel_dp->get_aux_clock_divider = hsw_get_aux_clock_divider; intel_dp->get_aux_clock_divider = hsw_get_aux_clock_divider;
...@@ -804,17 +808,17 @@ void intel_dp_aux_init(struct intel_dp *intel_dp) ...@@ -804,17 +808,17 @@ void intel_dp_aux_init(struct intel_dp *intel_dp)
else else
intel_dp->get_aux_clock_divider = g4x_get_aux_clock_divider; intel_dp->get_aux_clock_divider = g4x_get_aux_clock_divider;
if (DISPLAY_VER(i915) >= 9) if (DISPLAY_VER(display) >= 9)
intel_dp->get_aux_send_ctl = skl_get_aux_send_ctl; intel_dp->get_aux_send_ctl = skl_get_aux_send_ctl;
else else
intel_dp->get_aux_send_ctl = g4x_get_aux_send_ctl; intel_dp->get_aux_send_ctl = g4x_get_aux_send_ctl;
intel_dp->aux.drm_dev = &i915->drm; intel_dp->aux.drm_dev = display->drm;
drm_dp_aux_init(&intel_dp->aux); drm_dp_aux_init(&intel_dp->aux);
/* Failure to allocate our preferred name is not critical */ /* Failure to allocate our preferred name is not critical */
intel_dp->aux.name = kasprintf(GFP_KERNEL, "AUX %s/%s", intel_dp->aux.name = kasprintf(GFP_KERNEL, "AUX %s/%s",
aux_ch_name(i915, buf, sizeof(buf), aux_ch), aux_ch_name(display, buf, sizeof(buf), aux_ch),
encoder->base.name); encoder->base.name);
intel_dp->aux.transfer = intel_dp_aux_transfer; intel_dp->aux.transfer = intel_dp_aux_transfer;
...@@ -823,10 +827,10 @@ void intel_dp_aux_init(struct intel_dp *intel_dp) ...@@ -823,10 +827,10 @@ void intel_dp_aux_init(struct intel_dp *intel_dp)
static enum aux_ch default_aux_ch(struct intel_encoder *encoder) static enum aux_ch default_aux_ch(struct intel_encoder *encoder)
{ {
struct drm_i915_private *i915 = to_i915(encoder->base.dev); struct intel_display *display = to_intel_display(encoder);
/* SKL has DDI E but no AUX E */ /* SKL has DDI E but no AUX E */
if (DISPLAY_VER(i915) == 9 && encoder->port == PORT_E) if (DISPLAY_VER(display) == 9 && encoder->port == PORT_E)
return AUX_CH_A; return AUX_CH_A;
return (enum aux_ch)encoder->port; return (enum aux_ch)encoder->port;
...@@ -836,10 +840,10 @@ static struct intel_encoder * ...@@ -836,10 +840,10 @@ static struct intel_encoder *
get_encoder_by_aux_ch(struct intel_encoder *encoder, get_encoder_by_aux_ch(struct intel_encoder *encoder,
enum aux_ch aux_ch) enum aux_ch aux_ch)
{ {
struct drm_i915_private *i915 = to_i915(encoder->base.dev); struct intel_display *display = to_intel_display(encoder);
struct intel_encoder *other; struct intel_encoder *other;
for_each_intel_encoder(&i915->drm, other) { for_each_intel_encoder(display->drm, other) {
if (other == encoder) if (other == encoder)
continue; continue;
...@@ -855,7 +859,7 @@ get_encoder_by_aux_ch(struct intel_encoder *encoder, ...@@ -855,7 +859,7 @@ get_encoder_by_aux_ch(struct intel_encoder *encoder,
enum aux_ch intel_dp_aux_ch(struct intel_encoder *encoder) enum aux_ch intel_dp_aux_ch(struct intel_encoder *encoder)
{ {
struct drm_i915_private *i915 = to_i915(encoder->base.dev); struct intel_display *display = to_intel_display(encoder);
struct intel_encoder *other; struct intel_encoder *other;
const char *source; const char *source;
enum aux_ch aux_ch; enum aux_ch aux_ch;
...@@ -876,23 +880,23 @@ enum aux_ch intel_dp_aux_ch(struct intel_encoder *encoder) ...@@ -876,23 +880,23 @@ enum aux_ch intel_dp_aux_ch(struct intel_encoder *encoder)
other = get_encoder_by_aux_ch(encoder, aux_ch); other = get_encoder_by_aux_ch(encoder, aux_ch);
if (other) { if (other) {
drm_dbg_kms(&i915->drm, drm_dbg_kms(display->drm,
"[ENCODER:%d:%s] AUX CH %s already claimed by [ENCODER:%d:%s]\n", "[ENCODER:%d:%s] AUX CH %s already claimed by [ENCODER:%d:%s]\n",
encoder->base.base.id, encoder->base.name, encoder->base.base.id, encoder->base.name,
aux_ch_name(i915, buf, sizeof(buf), aux_ch), aux_ch_name(display, buf, sizeof(buf), aux_ch),
other->base.base.id, other->base.name); other->base.base.id, other->base.name);
return AUX_CH_NONE; return AUX_CH_NONE;
} }
drm_dbg_kms(&i915->drm, drm_dbg_kms(display->drm,
"[ENCODER:%d:%s] Using AUX CH %s (%s)\n", "[ENCODER:%d:%s] Using AUX CH %s (%s)\n",
encoder->base.base.id, encoder->base.name, encoder->base.base.id, encoder->base.name,
aux_ch_name(i915, buf, sizeof(buf), aux_ch), source); aux_ch_name(display, buf, sizeof(buf), aux_ch), source);
return aux_ch; return aux_ch;
} }
void intel_dp_aux_irq_handler(struct drm_i915_private *i915) void intel_dp_aux_irq_handler(struct intel_display *display)
{ {
wake_up_all(&i915->display.gmbus.wait_queue); wake_up_all(&display->gmbus.wait_queue);
} }
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include <linux/types.h> #include <linux/types.h>
enum aux_ch; enum aux_ch;
struct drm_i915_private; struct intel_display;
struct intel_dp; struct intel_dp;
struct intel_encoder; struct intel_encoder;
...@@ -18,7 +18,7 @@ void intel_dp_aux_init(struct intel_dp *intel_dp); ...@@ -18,7 +18,7 @@ void intel_dp_aux_init(struct intel_dp *intel_dp);
enum aux_ch intel_dp_aux_ch(struct intel_encoder *encoder); enum aux_ch intel_dp_aux_ch(struct intel_encoder *encoder);
void intel_dp_aux_irq_handler(struct drm_i915_private *i915); void intel_dp_aux_irq_handler(struct intel_display *display);
u32 intel_dp_aux_pack(const u8 *src, int src_bytes); u32 intel_dp_aux_pack(const u8 *src, int src_bytes);
int intel_dp_aux_fw_sync_len(struct intel_dp *intel_dp); int intel_dp_aux_fw_sync_len(struct intel_dp *intel_dp);
......
...@@ -456,6 +456,7 @@ u32 i9xx_hpd_irq_ack(struct drm_i915_private *dev_priv) ...@@ -456,6 +456,7 @@ u32 i9xx_hpd_irq_ack(struct drm_i915_private *dev_priv)
void i9xx_hpd_irq_handler(struct drm_i915_private *dev_priv, u32 hotplug_status) void i9xx_hpd_irq_handler(struct drm_i915_private *dev_priv, u32 hotplug_status)
{ {
struct intel_display *display = &dev_priv->display;
u32 pin_mask = 0, long_mask = 0; u32 pin_mask = 0, long_mask = 0;
u32 hotplug_trigger; u32 hotplug_trigger;
...@@ -477,7 +478,7 @@ void i9xx_hpd_irq_handler(struct drm_i915_private *dev_priv, u32 hotplug_status) ...@@ -477,7 +478,7 @@ void i9xx_hpd_irq_handler(struct drm_i915_private *dev_priv, u32 hotplug_status)
if ((IS_G4X(dev_priv) || if ((IS_G4X(dev_priv) ||
IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) && IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) &&
hotplug_status & DP_AUX_CHANNEL_MASK_INT_STATUS_G4X) hotplug_status & DP_AUX_CHANNEL_MASK_INT_STATUS_G4X)
intel_dp_aux_irq_handler(dev_priv); intel_dp_aux_irq_handler(display);
} }
void ibx_hpd_irq_handler(struct drm_i915_private *dev_priv, u32 hotplug_trigger) void ibx_hpd_irq_handler(struct drm_i915_private *dev_priv, u32 hotplug_trigger)
...@@ -513,6 +514,7 @@ void ibx_hpd_irq_handler(struct drm_i915_private *dev_priv, u32 hotplug_trigger) ...@@ -513,6 +514,7 @@ void ibx_hpd_irq_handler(struct drm_i915_private *dev_priv, u32 hotplug_trigger)
void xelpdp_pica_irq_handler(struct drm_i915_private *i915, u32 iir) void xelpdp_pica_irq_handler(struct drm_i915_private *i915, u32 iir)
{ {
struct intel_display *display = &i915->display;
enum hpd_pin pin; enum hpd_pin pin;
u32 hotplug_trigger = iir & (XELPDP_DP_ALT_HOTPLUG_MASK | XELPDP_TBT_HOTPLUG_MASK); u32 hotplug_trigger = iir & (XELPDP_DP_ALT_HOTPLUG_MASK | XELPDP_TBT_HOTPLUG_MASK);
u32 trigger_aux = iir & XELPDP_AUX_TC_MASK; u32 trigger_aux = iir & XELPDP_AUX_TC_MASK;
...@@ -545,7 +547,7 @@ void xelpdp_pica_irq_handler(struct drm_i915_private *i915, u32 iir) ...@@ -545,7 +547,7 @@ void xelpdp_pica_irq_handler(struct drm_i915_private *i915, u32 iir)
} }
if (trigger_aux) if (trigger_aux)
intel_dp_aux_irq_handler(i915); intel_dp_aux_irq_handler(display);
if (!pin_mask && !trigger_aux) if (!pin_mask && !trigger_aux)
drm_err(&i915->drm, drm_err(&i915->drm,
......
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