Commit 7c585f9a authored by Jani Nikula's avatar Jani Nikula Committed by Robert Foss

drm/bridge: anx7625: use struct drm_edid more

Prefer struct drm_edid based functions over struct edid.
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Signed-off-by: default avatarRobert Foss <rfoss@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/1d1290829fa463237b560c43e77170a986186031.1715347488.git.jani.nikula@intel.com
parent 8aa8781b
...@@ -464,9 +464,11 @@ static int anx7625_odfc_config(struct anx7625_data *ctx, ...@@ -464,9 +464,11 @@ static int anx7625_odfc_config(struct anx7625_data *ctx,
*/ */
static int anx7625_set_k_value(struct anx7625_data *ctx) static int anx7625_set_k_value(struct anx7625_data *ctx)
{ {
struct edid *edid = (struct edid *)ctx->slimport_edid_p.edid_raw_data; struct drm_edid_product_id id;
if (edid->mfg_id[0] == IVO_MID0 && edid->mfg_id[1] == IVO_MID1) drm_edid_get_product_id(ctx->cached_drm_edid, &id);
if (be16_to_cpu(id.manufacturer_name) == IVO_MID)
return anx7625_reg_write(ctx, ctx->i2c.rx_p1_client, return anx7625_reg_write(ctx, ctx->i2c.rx_p1_client,
MIPI_DIGITAL_ADJ_1, 0x3B); MIPI_DIGITAL_ADJ_1, 0x3B);
...@@ -1526,7 +1528,8 @@ static int anx7625_wait_hpd_asserted(struct drm_dp_aux *aux, ...@@ -1526,7 +1528,8 @@ static int anx7625_wait_hpd_asserted(struct drm_dp_aux *aux,
static void anx7625_remove_edid(struct anx7625_data *ctx) static void anx7625_remove_edid(struct anx7625_data *ctx)
{ {
ctx->slimport_edid_p.edid_block_num = -1; drm_edid_free(ctx->cached_drm_edid);
ctx->cached_drm_edid = NULL;
} }
static void anx7625_dp_adjust_swing(struct anx7625_data *ctx) static void anx7625_dp_adjust_swing(struct anx7625_data *ctx)
...@@ -1787,27 +1790,32 @@ static ssize_t anx7625_aux_transfer(struct drm_dp_aux *aux, ...@@ -1787,27 +1790,32 @@ static ssize_t anx7625_aux_transfer(struct drm_dp_aux *aux,
static const struct drm_edid *anx7625_edid_read(struct anx7625_data *ctx) static const struct drm_edid *anx7625_edid_read(struct anx7625_data *ctx)
{ {
struct device *dev = ctx->dev; struct device *dev = ctx->dev;
struct s_edid_data *p_edid = &ctx->slimport_edid_p; u8 *edid_buf;
int edid_num; int edid_num;
if (ctx->slimport_edid_p.edid_block_num > 0) if (ctx->cached_drm_edid)
goto out; goto out;
edid_buf = kmalloc(FOUR_BLOCK_SIZE, GFP_KERNEL);
if (!edid_buf)
return NULL;
pm_runtime_get_sync(dev); pm_runtime_get_sync(dev);
_anx7625_hpd_polling(ctx, 5000 * 100); _anx7625_hpd_polling(ctx, 5000 * 100);
edid_num = sp_tx_edid_read(ctx, p_edid->edid_raw_data); edid_num = sp_tx_edid_read(ctx, edid_buf);
pm_runtime_put_sync(dev); pm_runtime_put_sync(dev);
if (edid_num < 1) { if (edid_num < 1) {
DRM_DEV_ERROR(dev, "Fail to read EDID: %d\n", edid_num); DRM_DEV_ERROR(dev, "Fail to read EDID: %d\n", edid_num);
kfree(edid_buf);
return NULL; return NULL;
} }
p_edid->edid_block_num = edid_num; ctx->cached_drm_edid = drm_edid_alloc(edid_buf, FOUR_BLOCK_SIZE);
kfree(edid_buf);
out: out:
return drm_edid_alloc(ctx->slimport_edid_p.edid_raw_data, return drm_edid_dup(ctx->cached_drm_edid);
FOUR_BLOCK_SIZE);
} }
static enum drm_connector_status anx7625_sink_detect(struct anx7625_data *ctx) static enum drm_connector_status anx7625_sink_detect(struct anx7625_data *ctx)
......
...@@ -286,8 +286,7 @@ ...@@ -286,8 +286,7 @@
#define MIPI_LANE_CTRL_10 0x0F #define MIPI_LANE_CTRL_10 0x0F
#define MIPI_DIGITAL_ADJ_1 0x1B #define MIPI_DIGITAL_ADJ_1 0x1B
#define IVO_MID0 0x26 #define IVO_MID 0x26CF
#define IVO_MID1 0xCF
#define MIPI_PLL_M_NUM_23_16 0x1E #define MIPI_PLL_M_NUM_23_16 0x1E
#define MIPI_PLL_M_NUM_15_8 0x1F #define MIPI_PLL_M_NUM_15_8 0x1F
...@@ -417,11 +416,6 @@ enum audio_wd_len { ...@@ -417,11 +416,6 @@ enum audio_wd_len {
#define EDID_TRY_CNT 3 #define EDID_TRY_CNT 3
#define SUPPORT_PIXEL_CLOCK 300000 #define SUPPORT_PIXEL_CLOCK 300000
struct s_edid_data {
int edid_block_num;
u8 edid_raw_data[FOUR_BLOCK_SIZE];
};
/***************** Display End *****************/ /***************** Display End *****************/
#define MAX_LANES_SUPPORT 4 #define MAX_LANES_SUPPORT 4
...@@ -466,7 +460,7 @@ struct anx7625_data { ...@@ -466,7 +460,7 @@ struct anx7625_data {
struct anx7625_i2c_client i2c; struct anx7625_i2c_client i2c;
struct i2c_client *last_client; struct i2c_client *last_client;
struct timer_list hdcp_timer; struct timer_list hdcp_timer;
struct s_edid_data slimport_edid_p; const struct drm_edid *cached_drm_edid;
struct device *codec_dev; struct device *codec_dev;
hdmi_codec_plugged_cb plugged_cb; hdmi_codec_plugged_cb plugged_cb;
struct work_struct work; struct work_struct work;
......
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