linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Tomi Valkeinen <tomi.valkeinen@nokia.com>
Cc: linux-fbdev-devel@lists.sourceforge.net, linux-omap@vger.kernel.org
Subject: Re: [PATCH 10/15] OMAP: DSS2: DSI driver
Date: Wed, 5 Aug 2009 18:04:47 +0300	[thread overview]
Message-ID: <20090805150446.GS7374@atomide.com> (raw)
In-Reply-To: <1249481741-14008-11-git-send-email-tomi.valkeinen@nokia.com>

* Tomi Valkeinen <tomi.valkeinen@nokia.com> [090805 17:19]:
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@nokia.com>
> ---
>  drivers/video/omap2/dss/dsi.c | 3509 +++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 3509 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/video/omap2/dss/dsi.c
> 
> diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c

<snip snip>

> +int dsi_vc_dcs_read(int channel, u8 dcs_cmd, u8 *buf, int buflen)
> +{
> +	u32 val;
> +	u8 dt;
> +	int r;
> +
> +	if (dsi.debug_read)
> +		DSSDBG("dsi_vc_dcs_read(ch%d, dcs_cmd %u)\n", channel, dcs_cmd);
> +
> +	r = dsi_vc_send_short(channel, DSI_DT_DCS_READ, dcs_cmd, 0);
> +	if (r)
> +		return r;
> +
> +	r = dsi_vc_send_bta_sync(channel);
> +	if (r)
> +		return r;
> +
> +	/* RX_FIFO_NOT_EMPTY */
> +	if (REG_GET(DSI_VC_CTRL(channel), 20, 20) == 0) {
> +		DSSERR("RX fifo empty when trying to read.\n");
> +		return -EIO;
> +	}
> +
> +	val = dsi_read_reg(DSI_VC_SHORT_PACKET_HEADER(channel));
> +	if (dsi.debug_read)
> +		DSSDBG("\theader: %08x\n", val);
> +	dt = FLD_GET(val, 5, 0);
> +	if (dt == DSI_DT_RX_ACK_WITH_ERR) {
> +		u16 err = FLD_GET(val, 23, 8);
> +		dsi_show_rx_ack_with_err(err);
> +		return -1;

Return something from err.h instead of -1 in various places in this function?

> +
> +	} else if (dt == DSI_DT_RX_SHORT_READ_1) {
> +		u8 data = FLD_GET(val, 15, 8);
> +		if (dsi.debug_read)
> +			DSSDBG("\tDCS short response, 1 byte: %02x\n", data);
> +
> +		if (buflen < 1)
> +			return -1;
> +
> +		buf[0] = data;
> +
> +		return 1;
> +	} else if (dt == DSI_DT_RX_SHORT_READ_2) {
> +		u16 data = FLD_GET(val, 23, 8);
> +		if (dsi.debug_read)
> +			DSSDBG("\tDCS short response, 2 byte: %04x\n", data);
> +
> +		if (buflen < 2)
> +			return -1;
> +
> +		buf[0] = data & 0xff;
> +		buf[1] = (data >> 8) & 0xff;
> +
> +		return 2;
> +	} else if (dt == DSI_DT_RX_DCS_LONG_READ) {
> +		int w;
> +		int len = FLD_GET(val, 23, 8);
> +		if (dsi.debug_read)
> +			DSSDBG("\tDCS long response, len %d\n", len);
> +
> +		if (len > buflen)
> +			return -1;
> +
> +		/* two byte checksum ends the packet, not included in len */
> +		for (w = 0; w < len + 2;) {
> +			int b;
> +			val = dsi_read_reg(DSI_VC_SHORT_PACKET_HEADER(channel));
> +			if (dsi.debug_read)
> +				DSSDBG("\t\t%02x %02x %02x %02x\n",
> +						(val >> 0) & 0xff,
> +						(val >> 8) & 0xff,
> +						(val >> 16) & 0xff,
> +						(val >> 24) & 0xff);
> +
> +			for (b = 0; b < 4; ++b) {
> +				if (w < len)
> +					buf[w] = (val >> (b * 8)) & 0xff;
> +				/* we discard the 2 byte checksum */
> +				++w;
> +			}
> +		}
> +
> +		return len;
> +
> +	} else {
> +		DSSERR("\tunknown datatype 0x%02x\n", dt);
> +		return -1;
> +	}
> +}

  parent reply	other threads:[~2009-08-05 15:04 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-05 14:15 [PATCH 00/15] OMAP: DSS intro Tomi Valkeinen
2009-08-05 14:15 ` [PATCH 01/15] OMAP: OMAPFB: split omapfb.h Tomi Valkeinen
2009-08-05 14:15   ` [PATCH 02/15] OMAP: OMAPFB: add omapdss device Tomi Valkeinen
2009-08-05 14:15     ` [PATCH 03/15] OMAP: Add VRAM manager Tomi Valkeinen
2009-08-05 14:15       ` [PATCH 04/15] OMAP: Add support for VRFB rotation engine Tomi Valkeinen
2009-08-05 14:15         ` [PATCH 05/15] OMAP: DSS2: Documentation for DSS2 Tomi Valkeinen
2009-08-05 14:15           ` [PATCH 06/15] OMAP: DSS2: Display Subsystem Driver core Tomi Valkeinen
2009-08-05 14:15             ` [PATCH 07/15] OMAP: DSS2: VENC driver Tomi Valkeinen
2009-08-05 14:15               ` [PATCH 08/15] OMAP: DSS2: RFBI driver Tomi Valkeinen
2009-08-05 14:15                 ` [PATCH 09/15] OMAP: DSS2: SDI driver Tomi Valkeinen
2009-08-05 14:15                   ` [PATCH 10/15] OMAP: DSS2: DSI driver Tomi Valkeinen
2009-08-05 14:15                     ` [PATCH 11/15] OMAP: DSS2: omapfb driver Tomi Valkeinen
2009-08-05 14:15                       ` [PATCH 12/15] OMAP: DSS2: Add panel drivers Tomi Valkeinen
2009-08-05 14:15                         ` [PATCH 13/15] OMAP: SDP: Enable DSS2 for OMAP3 SDP board Tomi Valkeinen
2009-08-05 14:15                           ` [PATCH 14/15] OMAP: Beagle: Enable DSS2 for Beagle board Tomi Valkeinen
2009-08-05 14:15                             ` [PATCH 15/15] OMAP: Overo: Enable DSS2 for Overo Tomi Valkeinen
2009-08-05 14:44                               ` Tony Lindgren
2009-08-05 14:43                             ` [PATCH 14/15] OMAP: Beagle: Enable DSS2 for Beagle board Tony Lindgren
2009-08-05 14:40                           ` [PATCH 13/15] OMAP: SDP: Enable DSS2 for OMAP3 SDP board Tony Lindgren
2009-08-05 14:48                             ` Tomi Valkeinen
2009-08-07 11:50                         ` [PATCH 12/15] OMAP: DSS2: Add panel drivers Roger Quadros
2009-08-07 11:47                       ` [PATCH 11/15] OMAP: DSS2: omapfb driver Roger Quadros
2009-08-07 11:52                         ` Tomi Valkeinen
2009-08-07 11:54                           ` Roger Quadros
2009-08-05 15:04                     ` Tony Lindgren [this message]
2009-08-05 14:59                   ` [PATCH 09/15] OMAP: DSS2: SDI driver Tony Lindgren
2009-08-05 14:49                 ` [PATCH 08/15] OMAP: DSS2: RFBI driver Tony Lindgren
2009-08-05 14:47               ` [PATCH 07/15] OMAP: DSS2: VENC driver Tony Lindgren
2009-08-05 14:31         ` [PATCH 04/15] OMAP: Add support for VRFB rotation engine Tony Lindgren
2009-08-07  8:33           ` Tomi Valkeinen
2009-08-05 14:33       ` [PATCH 03/15] OMAP: Add VRAM manager Tony Lindgren
2009-08-05 14:32     ` [PATCH 02/15] OMAP: OMAPFB: add omapdss device Tony Lindgren
2009-08-05 14:32   ` [PATCH 01/15] OMAP: OMAPFB: split omapfb.h Tony Lindgren
2009-08-07 11:17 ` [PATCH 00/15] OMAP: DSS intro Roger Quadros
2009-08-07 11:24   ` Tomi Valkeinen
2009-08-07 11:27     ` Roger Quadros

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090805150446.GS7374@atomide.com \
    --to=tony@atomide.com \
    --cc=linux-fbdev-devel@lists.sourceforge.net \
    --cc=linux-omap@vger.kernel.org \
    --cc=tomi.valkeinen@nokia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).