From fe0e12f81caff36e0a38b9d4e8b4c36ec837987c Mon Sep 17 00:00:00 2001 From: Kuogee Hsieh Date: Fri, 3 Apr 2015 17:56:46 -0700 Subject: [PATCH] msm: mdss: add compression_mode and pps dcs_type support Two new DCS types, compression_mode (0x03) and pps (0x0a) are introduced to support DCS (Display Stream Compression). Add process those two new dcs types to support DSC. Change-Id: Ibbd90c7c84598ba24a5919174bb547e851cc4754 Signed-off-by: Kuogee Hsieh --- drivers/video/fbdev/msm/mdss_dsi_cmd.c | 77 ++++++++++++++++++++++++++ drivers/video/fbdev/msm/mdss_dsi_cmd.h | 5 +- 2 files changed, 80 insertions(+), 2 deletions(-) diff --git a/drivers/video/fbdev/msm/mdss_dsi_cmd.c b/drivers/video/fbdev/msm/mdss_dsi_cmd.c index 8c56264c4679..0a97b9b7873c 100644 --- a/drivers/video/fbdev/msm/mdss_dsi_cmd.c +++ b/drivers/video/fbdev/msm/mdss_dsi_cmd.c @@ -379,6 +379,50 @@ static int mdss_dsi_cm_on(struct dsi_buf *dp, struct dsi_cmd_desc *cm) return DSI_HOST_HDR_SIZE; /* 4 bytes */ } +static int mdss_dsi_dsc_pps(struct dsi_buf *dp, struct dsi_cmd_desc *cm) +{ + struct dsi_ctrl_hdr *dchdr; + char *bp; + u32 *hp; + int i, len = 0; + + dchdr = &cm->dchdr; + bp = mdss_dsi_buf_reserve_hdr(dp, DSI_HOST_HDR_SIZE); + + /* + * fill up payload + * dcs command byte (first byte) followed by payload + */ + if (cm->payload) { + len = dchdr->dlen; + len += 3; + len &= ~0x03; /* multipled by 4 */ + for (i = 0; i < dchdr->dlen; i++) + *bp++ = cm->payload[i]; + + /* append 0xff to the end */ + for (; i < len; i++) + *bp++ = 0xff; + + dp->len += len; + } + + /* fill up header */ + hp = dp->hdr; + *hp = 0; + *hp = DSI_HDR_WC(dchdr->dlen); + *hp |= DSI_HDR_VC(dchdr->vc); + *hp |= DSI_HDR_LONG_PKT; + *hp |= DSI_HDR_DTYPE(DTYPE_PPS); + if (dchdr->last) + *hp |= DSI_HDR_LAST; + + mdss_dsi_buf_push(dp, DSI_HOST_HDR_SIZE); + + len += DSI_HOST_HDR_SIZE; + return len; +} + static int mdss_dsi_cm_off(struct dsi_buf *dp, struct dsi_cmd_desc *cm) { struct dsi_ctrl_hdr *dchdr; @@ -459,6 +503,33 @@ static int mdss_dsi_set_max_pktsize(struct dsi_buf *dp, struct dsi_cmd_desc *cm) return DSI_HOST_HDR_SIZE; /* 4 bytes */ } +static int mdss_dsi_compression_mode(struct dsi_buf *dp, + struct dsi_cmd_desc *cm) +{ + struct dsi_ctrl_hdr *dchdr; + u32 *hp; + + dchdr = &cm->dchdr; + if (cm->payload == 0) { + pr_err("%s: NO payload error\n", __func__); + return 0; + } + + mdss_dsi_buf_reserve_hdr(dp, DSI_HOST_HDR_SIZE); + hp = dp->hdr; + *hp = 0; + *hp |= DSI_HDR_VC(dchdr->vc); + *hp |= DSI_HDR_DTYPE(DTYPE_COMPRESSION_MODE); + if (dchdr->last) + *hp |= DSI_HDR_LAST; + + *hp |= DSI_HDR_DATA1(cm->payload[0]); + *hp |= DSI_HDR_DATA2(cm->payload[1]); + + mdss_dsi_buf_push(dp, DSI_HOST_HDR_SIZE); + return DSI_HOST_HDR_SIZE; /* 4 bytes */ +} + static int mdss_dsi_null_pkt(struct dsi_buf *dp, struct dsi_cmd_desc *cm) { struct dsi_ctrl_hdr *dchdr; @@ -538,6 +609,12 @@ int mdss_dsi_cmd_dma_add(struct dsi_buf *dp, struct dsi_cmd_desc *cm) case DTYPE_MAX_PKTSIZE: len = mdss_dsi_set_max_pktsize(dp, cm); break; + case DTYPE_PPS: + len = mdss_dsi_dsc_pps(dp, cm); + break; + case DTYPE_COMPRESSION_MODE: + len = mdss_dsi_compression_mode(dp, cm); + break; case DTYPE_NULL_PKT: len = mdss_dsi_null_pkt(dp, cm); break; diff --git a/drivers/video/fbdev/msm/mdss_dsi_cmd.h b/drivers/video/fbdev/msm/mdss_dsi_cmd.h index 119ce349100e..cb8960776ced 100644 --- a/drivers/video/fbdev/msm/mdss_dsi_cmd.h +++ b/drivers/video/fbdev/msm/mdss_dsi_cmd.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -58,7 +58,8 @@ struct dsi_buf { #define DTYPE_GEN_READ1 0x14 /* long read, 1 parameter */ #define DTYPE_GEN_READ2 0x24 /* long read, 2 parameter */ -#define DTYPE_TEAR_ON 0x35 /* set tear on */ +#define DTYPE_COMPRESSION_MODE 0x07 /* compression mode */ +#define DTYPE_PPS 0x0a /* pps */ #define DTYPE_MAX_PKTSIZE 0x37 /* set max packet size */ #define DTYPE_NULL_PKT 0x09 /* null packet, no data */ #define DTYPE_BLANK_PKT 0x19 /* blankiing packet, no data */