Commit 603fc0fc authored by Dmitry Baryshkov's avatar Dmitry Baryshkov Committed by Dmitry Baryshkov
Browse files

drm/msm/dp: drop the msm_dp_catalog module



Now as the msm_dp_catalog module became nearly empty, drop it, accessing
registers directly from the corresponding submodules.

Reviewed-by: default avatarStephen Boyd <swboyd@chromium.org>
Tested-by: Stephen Boyd <swboyd@chromium.org> # sc7180-trogdor
Signed-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Patchwork: https://patchwork.freedesktop.org/patch/654332/
Link: https://lore.kernel.org/r/20250518-fd-dp-audio-fixup-v6-11-2f0ec3ec000d@oss.qualcomm.com
parent d11f5a7a
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -135,7 +135,6 @@ msm-display-$(CONFIG_DEBUG_FS) += \
	dp/dp_debug.o

msm-display-$(CONFIG_DRM_MSM_DP)+= dp/dp_aux.o \
	dp/dp_catalog.o \
	dp/dp_ctrl.o \
	dp/dp_display.o \
	dp/dp_drm.o \
+39 −31
Original line number Diff line number Diff line
@@ -11,7 +11,6 @@
#include <drm/display/drm_dp_helper.h>
#include <drm/drm_edid.h>

#include "dp_catalog.h"
#include "dp_audio.h"
#include "dp_drm.h"
#include "dp_panel.h"
@@ -22,16 +21,30 @@
struct msm_dp_audio_private {
	struct platform_device *pdev;
	struct drm_device *drm_dev;
	struct msm_dp_catalog *catalog;
	void __iomem *link_base;

	u32 channels;

	struct msm_dp_audio msm_dp_audio;
};

static inline u32 msm_dp_read_link(struct msm_dp_audio_private *audio, u32 offset)
{
	return readl_relaxed(audio->link_base + offset);
}

static inline void msm_dp_write_link(struct msm_dp_audio_private *audio,
			       u32 offset, u32 data)
{
	/*
	 * To make sure link reg writes happens before any other operation,
	 * this function uses writel() instread of writel_relaxed()
	 */
	writel(data, audio->link_base + offset);
}

static void msm_dp_audio_stream_sdp(struct msm_dp_audio_private *audio)
{
	struct msm_dp_catalog *catalog = audio->catalog;
	struct dp_sdp_header sdp_hdr = {
		.HB0 = 0x00,
		.HB1 = 0x02,
@@ -42,13 +55,12 @@ static void msm_dp_audio_stream_sdp(struct msm_dp_audio_private *audio)

	msm_dp_utils_pack_sdp_header(&sdp_hdr, header);

	msm_dp_write_link(catalog, MMSS_DP_AUDIO_STREAM_0, header[0]);
	msm_dp_write_link(catalog, MMSS_DP_AUDIO_STREAM_1, header[1]);
	msm_dp_write_link(audio, MMSS_DP_AUDIO_STREAM_0, header[0]);
	msm_dp_write_link(audio, MMSS_DP_AUDIO_STREAM_1, header[1]);
}

static void msm_dp_audio_timestamp_sdp(struct msm_dp_audio_private *audio)
{
	struct msm_dp_catalog *catalog = audio->catalog;
	struct dp_sdp_header sdp_hdr = {
		.HB0 = 0x00,
		.HB1 = 0x01,
@@ -59,13 +71,12 @@ static void msm_dp_audio_timestamp_sdp(struct msm_dp_audio_private *audio)

	msm_dp_utils_pack_sdp_header(&sdp_hdr, header);

	msm_dp_write_link(catalog, MMSS_DP_AUDIO_TIMESTAMP_0, header[0]);
	msm_dp_write_link(catalog, MMSS_DP_AUDIO_TIMESTAMP_1, header[1]);
	msm_dp_write_link(audio, MMSS_DP_AUDIO_TIMESTAMP_0, header[0]);
	msm_dp_write_link(audio, MMSS_DP_AUDIO_TIMESTAMP_1, header[1]);
}

static void msm_dp_audio_infoframe_sdp(struct msm_dp_audio_private *audio)
{
	struct msm_dp_catalog *catalog = audio->catalog;
	struct dp_sdp_header sdp_hdr = {
		.HB0 = 0x00,
		.HB1 = 0x84,
@@ -76,13 +87,12 @@ static void msm_dp_audio_infoframe_sdp(struct msm_dp_audio_private *audio)

	msm_dp_utils_pack_sdp_header(&sdp_hdr, header);

	msm_dp_write_link(catalog, MMSS_DP_AUDIO_INFOFRAME_0, header[0]);
	msm_dp_write_link(catalog, MMSS_DP_AUDIO_INFOFRAME_1, header[1]);
	msm_dp_write_link(audio, MMSS_DP_AUDIO_INFOFRAME_0, header[0]);
	msm_dp_write_link(audio, MMSS_DP_AUDIO_INFOFRAME_1, header[1]);
}

static void msm_dp_audio_copy_management_sdp(struct msm_dp_audio_private *audio)
{
	struct msm_dp_catalog *catalog = audio->catalog;
	struct dp_sdp_header sdp_hdr = {
		.HB0 = 0x00,
		.HB1 = 0x05,
@@ -93,13 +103,12 @@ static void msm_dp_audio_copy_management_sdp(struct msm_dp_audio_private *audio)

	msm_dp_utils_pack_sdp_header(&sdp_hdr, header);

	msm_dp_write_link(catalog, MMSS_DP_AUDIO_COPYMANAGEMENT_0, header[0]);
	msm_dp_write_link(catalog, MMSS_DP_AUDIO_COPYMANAGEMENT_1, header[1]);
	msm_dp_write_link(audio, MMSS_DP_AUDIO_COPYMANAGEMENT_0, header[0]);
	msm_dp_write_link(audio, MMSS_DP_AUDIO_COPYMANAGEMENT_1, header[1]);
}

static void msm_dp_audio_isrc_sdp(struct msm_dp_audio_private *audio)
{
	struct msm_dp_catalog *catalog = audio->catalog;
	struct dp_sdp_header sdp_hdr = {
		.HB0 = 0x00,
		.HB1 = 0x06,
@@ -110,21 +119,20 @@ static void msm_dp_audio_isrc_sdp(struct msm_dp_audio_private *audio)
	u32 reg;

	/* XXX: is it necessary to preserve this field? */
	reg = msm_dp_read_link(catalog, MMSS_DP_AUDIO_ISRC_1);
	reg = msm_dp_read_link(audio, MMSS_DP_AUDIO_ISRC_1);
	sdp_hdr.HB3 = FIELD_GET(HEADER_3_MASK, reg);

	msm_dp_utils_pack_sdp_header(&sdp_hdr, header);

	msm_dp_write_link(catalog, MMSS_DP_AUDIO_ISRC_0, header[0]);
	msm_dp_write_link(catalog, MMSS_DP_AUDIO_ISRC_1, header[1]);
	msm_dp_write_link(audio, MMSS_DP_AUDIO_ISRC_0, header[0]);
	msm_dp_write_link(audio, MMSS_DP_AUDIO_ISRC_1, header[1]);
}

static void msm_dp_audio_config_sdp(struct msm_dp_audio_private *audio)
{
	struct msm_dp_catalog *msm_dp_catalog = audio->catalog;
	u32 sdp_cfg, sdp_cfg2;

	sdp_cfg = msm_dp_read_link(msm_dp_catalog, MMSS_DP_SDP_CFG);
	sdp_cfg = msm_dp_read_link(audio, MMSS_DP_SDP_CFG);
	/* AUDIO_TIMESTAMP_SDP_EN */
	sdp_cfg |= BIT(1);
	/* AUDIO_STREAM_SDP_EN */
@@ -138,9 +146,9 @@ static void msm_dp_audio_config_sdp(struct msm_dp_audio_private *audio)

	drm_dbg_dp(audio->drm_dev, "sdp_cfg = 0x%x\n", sdp_cfg);

	msm_dp_write_link(msm_dp_catalog, MMSS_DP_SDP_CFG, sdp_cfg);
	msm_dp_write_link(audio, MMSS_DP_SDP_CFG, sdp_cfg);

	sdp_cfg2 = msm_dp_read_link(msm_dp_catalog, MMSS_DP_SDP_CFG2);
	sdp_cfg2 = msm_dp_read_link(audio, MMSS_DP_SDP_CFG2);
	/* IFRM_REGSRC -> Do not use reg values */
	sdp_cfg2 &= ~BIT(0);
	/* AUDIO_STREAM_HB3_REGSRC-> Do not use reg values */
@@ -148,7 +156,7 @@ static void msm_dp_audio_config_sdp(struct msm_dp_audio_private *audio)

	drm_dbg_dp(audio->drm_dev, "sdp_cfg2 = 0x%x\n", sdp_cfg2);

	msm_dp_write_link(msm_dp_catalog, MMSS_DP_SDP_CFG2, sdp_cfg2);
	msm_dp_write_link(audio, MMSS_DP_SDP_CFG2, sdp_cfg2);
}

static void msm_dp_audio_setup_sdp(struct msm_dp_audio_private *audio)
@@ -190,7 +198,7 @@ static void msm_dp_audio_setup_acr(struct msm_dp_audio_private *audio)
	drm_dbg_dp(audio->drm_dev, "select: %#x, acr_ctrl: %#x\n",
		   select, acr_ctrl);

	msm_dp_write_link(audio->catalog, MMSS_DP_AUDIO_ACR_CTRL, acr_ctrl);
	msm_dp_write_link(audio, MMSS_DP_AUDIO_ACR_CTRL, acr_ctrl);
}

static void msm_dp_audio_safe_to_exit_level(struct msm_dp_audio_private *audio)
@@ -215,7 +223,7 @@ static void msm_dp_audio_safe_to_exit_level(struct msm_dp_audio_private *audio)
		break;
	}

	mainlink_levels = msm_dp_read_link(audio->catalog, REG_DP_MAINLINK_LEVELS);
	mainlink_levels = msm_dp_read_link(audio, REG_DP_MAINLINK_LEVELS);
	mainlink_levels &= 0xFE0;
	mainlink_levels |= safe_to_exit_level;

@@ -223,14 +231,14 @@ static void msm_dp_audio_safe_to_exit_level(struct msm_dp_audio_private *audio)
		   "mainlink_level = 0x%x, safe_to_exit_level = 0x%x\n",
		   mainlink_levels, safe_to_exit_level);

	msm_dp_write_link(audio->catalog, REG_DP_MAINLINK_LEVELS, mainlink_levels);
	msm_dp_write_link(audio, REG_DP_MAINLINK_LEVELS, mainlink_levels);
}

static void msm_dp_audio_enable(struct msm_dp_audio_private *audio, bool enable)
{
	u32 audio_ctrl;

	audio_ctrl = msm_dp_read_link(audio->catalog, MMSS_DP_AUDIO_CFG);
	audio_ctrl = msm_dp_read_link(audio, MMSS_DP_AUDIO_CFG);

	if (enable)
		audio_ctrl |= BIT(0);
@@ -239,7 +247,7 @@ static void msm_dp_audio_enable(struct msm_dp_audio_private *audio, bool enable)

	drm_dbg_dp(audio->drm_dev, "dp_audio_cfg = 0x%x\n", audio_ctrl);

	msm_dp_write_link(audio->catalog, MMSS_DP_AUDIO_CFG, audio_ctrl);
	msm_dp_write_link(audio, MMSS_DP_AUDIO_CFG, audio_ctrl);
	/* make sure audio engine is disabled */
	wmb();
}
@@ -330,13 +338,13 @@ void msm_dp_audio_shutdown(struct drm_connector *connector,
}

struct msm_dp_audio *msm_dp_audio_get(struct platform_device *pdev,
			struct msm_dp_catalog *catalog)
			      void __iomem *link_base)
{
	int rc = 0;
	struct msm_dp_audio_private *audio;
	struct msm_dp_audio *msm_dp_audio;

	if (!pdev || !catalog) {
	if (!pdev) {
		DRM_ERROR("invalid input\n");
		rc = -EINVAL;
		goto error;
@@ -349,7 +357,7 @@ struct msm_dp_audio *msm_dp_audio_get(struct platform_device *pdev,
	}

	audio->pdev = pdev;
	audio->catalog = catalog;
	audio->link_base = link_base;

	msm_dp_audio = &audio->msm_dp_audio;

+4 −3
Original line number Diff line number Diff line
@@ -8,9 +8,10 @@

#include <linux/platform_device.h>

#include "dp_catalog.h"
#include <sound/hdmi-codec.h>

struct drm_bridge;

/**
 * struct msm_dp_audio
 * @lane_count: number of lanes configured in current session
@@ -27,13 +28,13 @@ struct msm_dp_audio {
 * Creates and instance of dp audio.
 *
 * @pdev: caller's platform device instance.
 * @catalog: an instance of msm_dp_catalog module.
 * @link_base: pointer to the msm_dp_link resource.
 *
 * Returns the error code in case of failure, otherwize
 * an instance of newly created msm_dp_module.
 */
struct msm_dp_audio *msm_dp_audio_get(struct platform_device *pdev,
			struct msm_dp_catalog *catalog);
			      void __iomem *link_base);

/**
 * msm_dp_audio_put()
+56 −57
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ enum msm_dp_aux_err {

struct msm_dp_aux_private {
	struct device *dev;
	struct msm_dp_catalog *catalog;
	void __iomem *aux_base;

	struct phy *phy;

@@ -46,14 +46,27 @@ struct msm_dp_aux_private {
	struct drm_dp_aux msm_dp_aux;
};

static void msm_dp_aux_clear_hw_interrupts(struct msm_dp_aux_private *aux)
static inline u32 msm_dp_read_aux(struct msm_dp_aux_private *aux, u32 offset)
{
	return readl_relaxed(aux->aux_base + offset);
}

static inline void msm_dp_write_aux(struct msm_dp_aux_private *aux,
				u32 offset, u32 data)
{
	struct msm_dp_catalog *msm_dp_catalog = aux->catalog;
	/*
	 * To make sure aux reg writes happens before any other operation,
	 * this function uses writel() instread of writel_relaxed()
	 */
	writel(data, aux->aux_base + offset);
}

	msm_dp_read_aux(msm_dp_catalog, REG_DP_PHY_AUX_INTERRUPT_STATUS);
	msm_dp_write_aux(msm_dp_catalog, REG_DP_PHY_AUX_INTERRUPT_CLEAR, 0x1f);
	msm_dp_write_aux(msm_dp_catalog, REG_DP_PHY_AUX_INTERRUPT_CLEAR, 0x9f);
	msm_dp_write_aux(msm_dp_catalog, REG_DP_PHY_AUX_INTERRUPT_CLEAR, 0);
static void msm_dp_aux_clear_hw_interrupts(struct msm_dp_aux_private *aux)
{
	msm_dp_read_aux(aux, REG_DP_PHY_AUX_INTERRUPT_STATUS);
	msm_dp_write_aux(aux, REG_DP_PHY_AUX_INTERRUPT_CLEAR, 0x1f);
	msm_dp_write_aux(aux, REG_DP_PHY_AUX_INTERRUPT_CLEAR, 0x9f);
	msm_dp_write_aux(aux, REG_DP_PHY_AUX_INTERRUPT_CLEAR, 0);
}

/*
@@ -61,51 +74,47 @@ static void msm_dp_aux_clear_hw_interrupts(struct msm_dp_aux_private *aux)
 */
static void msm_dp_aux_reset(struct msm_dp_aux_private *aux)
{
	struct msm_dp_catalog *msm_dp_catalog = aux->catalog;
	u32 aux_ctrl;

	aux_ctrl = msm_dp_read_aux(msm_dp_catalog, REG_DP_AUX_CTRL);
	aux_ctrl = msm_dp_read_aux(aux, REG_DP_AUX_CTRL);

	aux_ctrl |= DP_AUX_CTRL_RESET;
	msm_dp_write_aux(msm_dp_catalog, REG_DP_AUX_CTRL, aux_ctrl);
	msm_dp_write_aux(aux, REG_DP_AUX_CTRL, aux_ctrl);
	usleep_range(1000, 1100); /* h/w recommended delay */

	aux_ctrl &= ~DP_AUX_CTRL_RESET;
	msm_dp_write_aux(msm_dp_catalog, REG_DP_AUX_CTRL, aux_ctrl);
	msm_dp_write_aux(aux, REG_DP_AUX_CTRL, aux_ctrl);
}

static void msm_dp_aux_enable(struct msm_dp_aux_private *aux)
{
	struct msm_dp_catalog *msm_dp_catalog = aux->catalog;
	u32 aux_ctrl;

	aux_ctrl = msm_dp_read_aux(msm_dp_catalog, REG_DP_AUX_CTRL);
	aux_ctrl = msm_dp_read_aux(aux, REG_DP_AUX_CTRL);

	msm_dp_write_aux(msm_dp_catalog, REG_DP_TIMEOUT_COUNT, 0xffff);
	msm_dp_write_aux(msm_dp_catalog, REG_DP_AUX_LIMITS, 0xffff);
	msm_dp_write_aux(aux, REG_DP_TIMEOUT_COUNT, 0xffff);
	msm_dp_write_aux(aux, REG_DP_AUX_LIMITS, 0xffff);

	aux_ctrl |= DP_AUX_CTRL_ENABLE;
	msm_dp_write_aux(msm_dp_catalog, REG_DP_AUX_CTRL, aux_ctrl);
	msm_dp_write_aux(aux, REG_DP_AUX_CTRL, aux_ctrl);
}

static void msm_dp_aux_disable(struct msm_dp_aux_private *aux)
{
	struct msm_dp_catalog *msm_dp_catalog = aux->catalog;
	u32 aux_ctrl;

	aux_ctrl = msm_dp_read_aux(msm_dp_catalog, REG_DP_AUX_CTRL);
	aux_ctrl = msm_dp_read_aux(aux, REG_DP_AUX_CTRL);
	aux_ctrl &= ~DP_AUX_CTRL_ENABLE;
	msm_dp_write_aux(msm_dp_catalog, REG_DP_AUX_CTRL, aux_ctrl);
	msm_dp_write_aux(aux, REG_DP_AUX_CTRL, aux_ctrl);
}

static int msm_dp_aux_wait_for_hpd_connect_state(struct msm_dp_aux_private *aux,
					     unsigned long wait_us)
{
	struct msm_dp_catalog *msm_dp_catalog = aux->catalog;
	u32 state;

	/* poll for hpd connected status every 2ms and timeout after wait_us */
	return readl_poll_timeout(msm_dp_catalog->aux_base +
	return readl_poll_timeout(aux->aux_base +
				  REG_DP_DP_HPD_INT_STATUS,
				  state, state & DP_DP_HPD_STATE_STATUS_CONNECTED,
				  min(wait_us, 2000), wait_us);
@@ -154,10 +163,10 @@ static ssize_t msm_dp_aux_write(struct msm_dp_aux_private *aux,
		/* index = 0, write */
		if (i == 0)
			reg |= DP_AUX_DATA_INDEX_WRITE;
		msm_dp_write_aux(aux->catalog, REG_DP_AUX_DATA, reg);
		msm_dp_write_aux(aux, REG_DP_AUX_DATA, reg);
	}

	msm_dp_write_aux(aux->catalog, REG_DP_AUX_TRANS_CTRL, 0);
	msm_dp_write_aux(aux, REG_DP_AUX_TRANS_CTRL, 0);
	msm_dp_aux_clear_hw_interrupts(aux);

	reg = 0; /* Transaction number == 1 */
@@ -172,7 +181,7 @@ static ssize_t msm_dp_aux_write(struct msm_dp_aux_private *aux,
	}

	reg |= DP_AUX_TRANS_CTRL_GO;
	msm_dp_write_aux(aux->catalog, REG_DP_AUX_TRANS_CTRL, reg);
	msm_dp_write_aux(aux, REG_DP_AUX_TRANS_CTRL, reg);

	return len;
}
@@ -205,22 +214,22 @@ static ssize_t msm_dp_aux_cmd_fifo_rx(struct msm_dp_aux_private *aux,
	u32 i, actual_i;
	u32 len = msg->size;

	data = msm_dp_read_aux(aux->catalog, REG_DP_AUX_TRANS_CTRL);
	data = msm_dp_read_aux(aux, REG_DP_AUX_TRANS_CTRL);
	data &= ~DP_AUX_TRANS_CTRL_GO;
	msm_dp_write_aux(aux->catalog, REG_DP_AUX_TRANS_CTRL, data);
	msm_dp_write_aux(aux, REG_DP_AUX_TRANS_CTRL, data);

	data = DP_AUX_DATA_INDEX_WRITE; /* INDEX_WRITE */
	data |= DP_AUX_DATA_READ;  /* read */

	msm_dp_write_aux(aux->catalog, REG_DP_AUX_DATA, data);
	msm_dp_write_aux(aux, REG_DP_AUX_DATA, data);

	dp = msg->buffer;

	/* discard first byte */
	data = msm_dp_read_aux(aux->catalog, REG_DP_AUX_DATA);
	data = msm_dp_read_aux(aux, REG_DP_AUX_DATA);

	for (i = 0; i < len; i++) {
		data = msm_dp_read_aux(aux->catalog, REG_DP_AUX_DATA);
		data = msm_dp_read_aux(aux, REG_DP_AUX_DATA);
		*dp++ = (u8)((data >> DP_AUX_DATA_OFFSET) & 0xff);

		actual_i = (data >> DP_AUX_DATA_INDEX_OFFSET) & 0xFF;
@@ -588,42 +597,39 @@ void msm_dp_aux_hpd_enable(struct drm_dp_aux *msm_dp_aux)
{
	struct msm_dp_aux_private *aux =
		container_of(msm_dp_aux, struct msm_dp_aux_private, msm_dp_aux);
	struct msm_dp_catalog *msm_dp_catalog = aux->catalog;
	u32 reg;

	/* Configure REFTIMER and enable it */
	reg = msm_dp_read_aux(msm_dp_catalog, REG_DP_DP_HPD_REFTIMER);
	reg = msm_dp_read_aux(aux, REG_DP_DP_HPD_REFTIMER);
	reg |= DP_DP_HPD_REFTIMER_ENABLE;
	msm_dp_write_aux(msm_dp_catalog, REG_DP_DP_HPD_REFTIMER, reg);
	msm_dp_write_aux(aux, REG_DP_DP_HPD_REFTIMER, reg);

	/* Enable HPD */
	msm_dp_write_aux(msm_dp_catalog, REG_DP_DP_HPD_CTRL, DP_DP_HPD_CTRL_HPD_EN);
	msm_dp_write_aux(aux, REG_DP_DP_HPD_CTRL, DP_DP_HPD_CTRL_HPD_EN);
}

void msm_dp_aux_hpd_disable(struct drm_dp_aux *msm_dp_aux)
{
	struct msm_dp_aux_private *aux =
		container_of(msm_dp_aux, struct msm_dp_aux_private, msm_dp_aux);
	struct msm_dp_catalog *msm_dp_catalog = aux->catalog;
	u32 reg;

	reg = msm_dp_read_aux(msm_dp_catalog, REG_DP_DP_HPD_REFTIMER);
	reg = msm_dp_read_aux(aux, REG_DP_DP_HPD_REFTIMER);
	reg &= ~DP_DP_HPD_REFTIMER_ENABLE;
	msm_dp_write_aux(msm_dp_catalog, REG_DP_DP_HPD_REFTIMER, reg);
	msm_dp_write_aux(aux, REG_DP_DP_HPD_REFTIMER, reg);

	msm_dp_write_aux(msm_dp_catalog, REG_DP_DP_HPD_CTRL, 0);
	msm_dp_write_aux(aux, REG_DP_DP_HPD_CTRL, 0);
}

void msm_dp_aux_hpd_intr_enable(struct drm_dp_aux *msm_dp_aux)
{
	struct msm_dp_aux_private *aux =
		container_of(msm_dp_aux, struct msm_dp_aux_private, msm_dp_aux);
	struct msm_dp_catalog *msm_dp_catalog = aux->catalog;
	u32 reg;

	reg = msm_dp_read_aux(msm_dp_catalog, REG_DP_DP_HPD_INT_MASK);
	reg = msm_dp_read_aux(aux, REG_DP_DP_HPD_INT_MASK);
	reg |= DP_DP_HPD_INT_MASK;
	msm_dp_write_aux(msm_dp_catalog, REG_DP_DP_HPD_INT_MASK,
	msm_dp_write_aux(aux, REG_DP_DP_HPD_INT_MASK,
		     reg & DP_DP_HPD_INT_MASK);
}

@@ -631,12 +637,11 @@ void msm_dp_aux_hpd_intr_disable(struct drm_dp_aux *msm_dp_aux)
{
	struct msm_dp_aux_private *aux =
		container_of(msm_dp_aux, struct msm_dp_aux_private, msm_dp_aux);
	struct msm_dp_catalog *msm_dp_catalog = aux->catalog;
	u32 reg;

	reg = msm_dp_read_aux(msm_dp_catalog, REG_DP_DP_HPD_INT_MASK);
	reg = msm_dp_read_aux(aux, REG_DP_DP_HPD_INT_MASK);
	reg &= ~DP_DP_HPD_INT_MASK;
	msm_dp_write_aux(msm_dp_catalog, REG_DP_DP_HPD_INT_MASK,
	msm_dp_write_aux(aux, REG_DP_DP_HPD_INT_MASK,
		     reg & DP_DP_HPD_INT_MASK);
}

@@ -644,13 +649,12 @@ u32 msm_dp_aux_get_hpd_intr_status(struct drm_dp_aux *msm_dp_aux)
{
	struct msm_dp_aux_private *aux =
		container_of(msm_dp_aux, struct msm_dp_aux_private, msm_dp_aux);
	struct msm_dp_catalog *msm_dp_catalog = aux->catalog;
	int isr, mask;

	isr = msm_dp_read_aux(msm_dp_catalog, REG_DP_DP_HPD_INT_STATUS);
	msm_dp_write_aux(msm_dp_catalog, REG_DP_DP_HPD_INT_ACK,
	isr = msm_dp_read_aux(aux, REG_DP_DP_HPD_INT_STATUS);
	msm_dp_write_aux(aux, REG_DP_DP_HPD_INT_ACK,
				 (isr & DP_DP_HPD_INT_MASK));
	mask = msm_dp_read_aux(msm_dp_catalog, REG_DP_DP_HPD_INT_MASK);
	mask = msm_dp_read_aux(aux, REG_DP_DP_HPD_INT_MASK);

	/*
	 * We only want to return interrupts that are unmasked to the caller.
@@ -666,27 +670,22 @@ u32 msm_dp_aux_is_link_connected(struct drm_dp_aux *msm_dp_aux)
{
	struct msm_dp_aux_private *aux =
		container_of(msm_dp_aux, struct msm_dp_aux_private, msm_dp_aux);
	struct msm_dp_catalog *msm_dp_catalog = aux->catalog;
	u32 status;

	status = msm_dp_read_aux(msm_dp_catalog, REG_DP_DP_HPD_INT_STATUS);
	status = msm_dp_read_aux(aux, REG_DP_DP_HPD_INT_STATUS);
	status >>= DP_DP_HPD_STATE_STATUS_BITS_SHIFT;
	status &= DP_DP_HPD_STATE_STATUS_BITS_MASK;

	return status;
}

struct drm_dp_aux *msm_dp_aux_get(struct device *dev, struct msm_dp_catalog *catalog,
struct drm_dp_aux *msm_dp_aux_get(struct device *dev,
			      struct phy *phy,
			      bool is_edp)
			      bool is_edp,
			      void __iomem *aux_base)
{
	struct msm_dp_aux_private *aux;

	if (!catalog) {
		DRM_ERROR("invalid input\n");
		return ERR_PTR(-ENODEV);
	}

	aux = devm_kzalloc(dev, sizeof(*aux), GFP_KERNEL);
	if (!aux)
		return ERR_PTR(-ENOMEM);
@@ -697,9 +696,9 @@ struct drm_dp_aux *msm_dp_aux_get(struct device *dev, struct msm_dp_catalog *cat
	mutex_init(&aux->mutex);

	aux->dev = dev;
	aux->catalog = catalog;
	aux->phy = phy;
	aux->retry_cnt = 0;
	aux->aux_base = aux_base;

	/*
	 * Use the drm_dp_aux_init() to use the aux adapter
+3 −3
Original line number Diff line number Diff line
@@ -6,7 +6,6 @@
#ifndef _DP_AUX_H_
#define _DP_AUX_H_

#include "dp_catalog.h"
#include <drm/display/drm_dp_helper.h>

int msm_dp_aux_register(struct drm_dp_aux *msm_dp_aux);
@@ -25,9 +24,10 @@ u32 msm_dp_aux_get_hpd_intr_status(struct drm_dp_aux *msm_dp_aux);
u32 msm_dp_aux_is_link_connected(struct drm_dp_aux *msm_dp_aux);

struct phy;
struct drm_dp_aux *msm_dp_aux_get(struct device *dev, struct msm_dp_catalog *catalog,
struct drm_dp_aux *msm_dp_aux_get(struct device *dev,
			      struct phy *phy,
			      bool is_edp);
			      bool is_edp,
			      void __iomem *aux_base);
void msm_dp_aux_put(struct drm_dp_aux *aux);

#endif /*__DP_AUX_H_*/
Loading