[PATCH] drm/exynos/dsi: use core helper to create DSI packet
Inki Dae
daeinki at gmail.com
Tue Mar 1 15:20:37 UTC 2016
Fixed trivial one related to following warning,
drivers/gpu/drm/exynos/exynos_drm_dsi.c:1188:2: warning: format '%ld'
expects argument of type 'long int', but argument 5 has type 'size_t'
[-Wformat]
2016-02-17 22:33 GMT+09:00 Andrzej Hajda <a.hajda at samsung.com>:
> Core provides generic helper to create DSI packet, use it instead of
> custom code.
>
> Signed-off-by: Andrzej Hajda <a.hajda at samsung.com>
> ---
> drivers/gpu/drm/exynos/exynos_drm_dsi.c | 69 +++++++++++----------------------
> 1 file changed, 23 insertions(+), 46 deletions(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> index 77e17ae..f17be93 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> @@ -10,6 +10,8 @@
> * published by the Free Software Foundation.
> */
>
> +#include <asm/unaligned.h>
> +
> #include <drm/drmP.h>
> #include <drm/drm_crtc_helper.h>
> #include <drm/drm_mipi_dsi.h>
> @@ -222,12 +224,8 @@ struct exynos_dsi_transfer {
> struct list_head list;
> struct completion completed;
> int result;
> - u8 data_id;
> - u8 data[2];
> + struct mipi_dsi_packet packet;
> u16 flags;
> -
> - const u8 *tx_payload;
> - u16 tx_len;
> u16 tx_done;
>
> u8 *rx_payload;
> @@ -322,6 +320,7 @@ enum reg_idx {
> static inline void exynos_dsi_write(struct exynos_dsi *dsi, enum reg_idx idx,
> u32 val)
> {
> +
> writel(val, dsi->reg_base + dsi->driver_data->reg_ofs[idx]);
> }
>
> @@ -983,13 +982,14 @@ static void exynos_dsi_send_to_fifo(struct exynos_dsi *dsi,
> struct exynos_dsi_transfer *xfer)
> {
> struct device *dev = dsi->dev;
> - const u8 *payload = xfer->tx_payload + xfer->tx_done;
> - u16 length = xfer->tx_len - xfer->tx_done;
> + struct mipi_dsi_packet *pkt = &xfer->packet;
> + const u8 *payload = pkt->payload + xfer->tx_done;
> + u16 length = pkt->payload_length - xfer->tx_done;
> bool first = !xfer->tx_done;
> u32 reg;
>
> dev_dbg(dev, "< xfer %p: tx len %u, done %u, rx len %u, done %u\n",
> - xfer, xfer->tx_len, xfer->tx_done, xfer->rx_len, xfer->rx_done);
> + xfer, length, xfer->tx_done, xfer->rx_len, xfer->rx_done);
>
> if (length > DSI_TX_FIFO_SIZE)
> length = DSI_TX_FIFO_SIZE;
> @@ -998,8 +998,7 @@ static void exynos_dsi_send_to_fifo(struct exynos_dsi *dsi,
>
> /* Send payload */
> while (length >= 4) {
> - reg = (payload[3] << 24) | (payload[2] << 16)
> - | (payload[1] << 8) | payload[0];
> + reg = get_unaligned_le32(payload);
> exynos_dsi_write(dsi, DSIM_PAYLOAD_REG, reg);
> payload += 4;
> length -= 4;
> @@ -1017,16 +1016,13 @@ static void exynos_dsi_send_to_fifo(struct exynos_dsi *dsi,
> reg |= payload[0];
> exynos_dsi_write(dsi, DSIM_PAYLOAD_REG, reg);
> break;
> - case 0:
> - /* Do nothing */
> - break;
> }
>
> /* Send packet header */
> if (!first)
> return;
>
> - reg = (xfer->data[1] << 16) | (xfer->data[0] << 8) | xfer->data_id;
> + reg = get_unaligned_le32(pkt->header);
> if (exynos_dsi_wait_for_hdr_fifo(dsi)) {
> dev_err(dev, "waiting for header FIFO timed out\n");
> return;
> @@ -1147,13 +1143,14 @@ again:
>
> spin_unlock_irqrestore(&dsi->transfer_lock, flags);
>
> - if (xfer->tx_len && xfer->tx_done == xfer->tx_len)
> + if (xfer->packet.payload_length &&
> + xfer->tx_done == xfer->packet.payload_length)
> /* waiting for RX */
> return;
>
> exynos_dsi_send_to_fifo(dsi, xfer);
>
> - if (xfer->tx_len || xfer->rx_len)
> + if (xfer->packet.payload_length || xfer->rx_len)
> return;
>
> xfer->result = 0;
> @@ -1189,10 +1186,11 @@ static bool exynos_dsi_transfer_finish(struct exynos_dsi *dsi)
> spin_unlock_irqrestore(&dsi->transfer_lock, flags);
>
> dev_dbg(dsi->dev,
> - "> xfer %p, tx_len %u, tx_done %u, rx_len %u, rx_done %u\n",
> - xfer, xfer->tx_len, xfer->tx_done, xfer->rx_len, xfer->rx_done);
> + "> xfer %p, tx_len %lu, tx_done %u, rx_len %u, rx_done %u\n",
> + xfer, xfer->packet.payload_length, xfer->tx_done, xfer->rx_len,
%zu would be required for xfer->packet.payload_length which has size_t type.
Thanks,
Inki Dae
More information about the dri-devel
mailing list