summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrzej Hajda <a.hajda@samsung.com>2016-10-17 14:43:47 +0200
committerSeung-Woo Kim <sw0312.kim@samsung.com>2016-12-14 13:53:53 +0900
commitb66ef4d7cea87a6c51efbae05c1ff8715ab3da35 (patch)
treeaa0242c26b7687a2c21def0d9eb63f7adff9f851
parent0a191fef8bab268c971b247a06663d59a57464dc (diff)
drm/bridge/sii8620: abstract out common MSC command
Four different functions share the same code, this patch abstracts out the common part. Change-Id: Ia2c7ccb59863be03bf47d61ec979c72bb3258df6 Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
-rw-r--r--drivers/gpu/drm/bridge/sii8620.c33
1 files changed, 11 insertions, 22 deletions
diff --git a/drivers/gpu/drm/bridge/sii8620.c b/drivers/gpu/drm/bridge/sii8620.c
index 384e592ba6e5..c0c87e81de86 100644
--- a/drivers/gpu/drm/bridge/sii8620.c
+++ b/drivers/gpu/drm/bridge/sii8620.c
@@ -301,43 +301,32 @@ static struct sii8620_mt_msg *sii8620_mt_msg_new(struct sii8620 *ctx)
return msg;
}
-static void sii8620_mt_write_stat(struct sii8620 *ctx, u8 reg, u8 val)
+static void sii8620_mt_msc_cmd(struct sii8620 *ctx, u8 cmd, u8 arg1, u8 arg2)
{
struct sii8620_mt_msg *msg = sii8620_mt_msg_new(ctx);
if (!msg)
return;
- msg->reg[0] = MHL_WRITE_STAT;
- msg->reg[1] = reg;
- msg->reg[2] = val;
+ msg->reg[0] = cmd;
+ msg->reg[1] = arg1;
+ msg->reg[2] = arg2;
msg->send = sii8620_mt_msc_cmd_send;
}
-static inline void sii8620_mt_set_int(struct sii8620 *ctx, u8 irq, u8 mask)
+static void sii8620_mt_write_stat(struct sii8620 *ctx, u8 reg, u8 val)
{
- struct sii8620_mt_msg *msg = sii8620_mt_msg_new(ctx);
-
- if (!msg)
- return;
+ sii8620_mt_msc_cmd(ctx, MHL_WRITE_STAT, reg, val);
+}
- msg->reg[0] = MHL_SET_INT;
- msg->reg[1] = irq;
- msg->reg[2] = mask;
- msg->send = sii8620_mt_msc_cmd_send;
+static inline void sii8620_mt_set_int(struct sii8620 *ctx, u8 irq, u8 mask)
+{
+ sii8620_mt_msc_cmd(ctx, MHL_SET_INT, irq, mask);
}
static void sii8620_mt_msc_msg(struct sii8620 *ctx, u8 cmd, u8 data)
{
- struct sii8620_mt_msg *msg = sii8620_mt_msg_new(ctx);
-
- if (!msg)
- return;
-
- msg->reg[0] = MHL_MSC_MSG;
- msg->reg[1] = cmd;
- msg->reg[2] = data;
- msg->send = sii8620_mt_msc_cmd_send;
+ sii8620_mt_msc_cmd(ctx, MHL_MSC_MSG, cmd, data);
}
static void sii8620_mt_rap(struct sii8620 *ctx, u8 code)