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 09/15] OMAP: DSS2: SDI driver
Date: Wed, 5 Aug 2009 17:59:39 +0300	[thread overview]
Message-ID: <20090805145939.GR7374@atomide.com> (raw)
In-Reply-To: <1249481741-14008-10-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/sdi.c |  370 +++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 370 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/video/omap2/dss/sdi.c
> 
> diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c
> new file mode 100644
> index 0000000..2f4d226
> --- /dev/null
> +++ b/drivers/video/omap2/dss/sdi.c
> @@ -0,0 +1,370 @@
> +/*
> + * linux/drivers/video/omap2/dss/sdi.c
> + *
> + * Copyright (C) 2009 Nokia Corporation
> + * Author: Tomi Valkeinen <tomi.valkeinen@nokia.com>
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License version 2 as published by
> + * the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful, but WITHOUT
> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
> + * more details.
> + *
> + * You should have received a copy of the GNU General Public License along with
> + * this program.  If not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +#define DSS_SUBSYS_NAME "SDI"
> +
> +#include <linux/kernel.h>
> +#include <linux/clk.h>
> +#include <linux/delay.h>
> +#include <linux/err.h>
> +#include <linux/io.h>
> +
> +#include <mach/board.h>
> +#include <mach/display.h>
> +#include "dss.h"
> +
> +#define CONTROL_PADCONF_BASE	0x48002000
> +
> +#define OMAP_SDI_PAD_DIS(pe, pu) ((7 << 0)		| /* MODE 7 = safe */ \
> +				 (((pe) ? 1 : 0) << 3)	| /* PULL_ENA */      \
> +				 (((pu) ? 1 : 0) << 4)	| /* PULL_UP  */      \
> +				 (1 << 8))		  /* INPUT_EN */
> +
> +#define OMAP_SDI_PAD_EN		 (1 << 0)		  /* MODE 1 = SDI_xx */
> +
> +#define OMAP_SDI_PAD_MASK	OMAP_SDI_PAD_DIS(1, 1)
> +
> +static struct {
> +	bool skip_init;
> +	bool update_enabled;
> +} sdi;
> +
> +/* CONTROL_PADCONF_DSS_DATAXX */
> +static const u16 sdi_pads[] =
> +{
> +	0x0f0,		/* 10[ 7..0]:SDI_DAT1N */
> +	0x0f2,		/* 10[15..0]:SDI_DAT1P */
> +	0x0f4,		/* 12[ 7..0]:SDI_DAT2N */
> +	0x0f6,		/* 12[15..0]:SDI_DAT2P */
> +	0x0f8,		/* 14[ 7..0]:SDI_DAT3N */
> +	0x0fa,		/* 14[15..0]:SDI_DAT3P */
> +	0x108,		/* 22[ 7..0]:SDI_CLKN */
> +	0x10a,		/* 22[15..0]:SDI_CLKP */
> +};

Aaargh, NAK for custom pin muxing. Please do it in mux.[ch], see
arch/arm/mach-omap2/mux.c.

> +
> +/*
> + * Check if bootloader / platform code has configured the SDI pads properly.
> + * This means it either configured all required pads for SDI mode, or that it
> + * left all the required pads unconfigured.
> + */
> +static int sdi_pad_init(struct omap_dss_device *dssdev)
> +{
> +	unsigned req_map;
> +	bool configured = false;
> +	bool unconfigured = false;
> +	int data_pairs;
> +	int i;
> +
> +	data_pairs = dssdev->phy.sdi.datapairs;
> +	req_map = (1 << (data_pairs * 2)) - 1;		/* data lanes */
> +	req_map |= 3 << 6;				/* clk lane */
> +	for (i = 0; i < ARRAY_SIZE(sdi_pads); i++) {
> +		u32 reg;
> +		u32 val;
> +
> +		if (!((1 << i) & req_map))
> +			/* Ignore unneded pads. */
> +			continue;
> +		reg = CONTROL_PADCONF_BASE + sdi_pads[i];
> +		val = omap_readw(reg);
> +		switch (val & 0x07) {	/* pad mode */
> +		case 1:
> +			if (unconfigured)
> +				break;
> +			/* Is the pull configuration ok for SDI mode? */
> +			if ((val & OMAP_SDI_PAD_MASK) != OMAP_SDI_PAD_EN)
> +				break;
> +			configured = true;
> +			break;
> +		case 0:
> +		case 7:
> +			if (configured)
> +				break;
> +			unconfigured = true;
> +			break;
> +		default:
> +			break;
> +		}
> +	}
> +	if (i != ARRAY_SIZE(sdi_pads)) {
> +		DSSERR("SDI: invalid pad configuration\n");
> +		return -1;
> +	}
> +
> +	return 0;
> +}
> +
> +static void sdi_pad_config(struct omap_dss_device *dssdev, bool enable)
> +{
> +	int data_pairs;
> +	bool pad_off_pe, pad_off_pu;
> +	unsigned req_map;
> +	int i;
> +
> +	data_pairs = dssdev->phy.sdi.datapairs;
> +	pad_off_pe = dssdev->phy.sdi.pad_off_pe;
> +	pad_off_pu = dssdev->phy.sdi.pad_off_pu;
> +	req_map = (1 << (data_pairs * 2)) - 1;		/* data lanes */
> +	req_map |= 3 << 6;				/* clk lane */
> +	for (i = 0; i < ARRAY_SIZE(sdi_pads); i++) {
> +		u32 reg;
> +		u16 val;
> +
> +		if (!((1 << i) & req_map))
> +			continue;
> +		if (enable)
> +			val = OMAP_SDI_PAD_EN;
> +		else
> +			val = OMAP_SDI_PAD_DIS(pad_off_pe, pad_off_pu);
> +		reg = CONTROL_PADCONF_BASE + sdi_pads[i];
> +		omap_writew(val, reg);
> +	}
> +}
> +

Looks like you can do all this with mux.[ch]. If not, we need to improve
the generic mux code.

Regards,

Tony

  parent reply	other threads:[~2009-08-05 14:59 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                     ` [PATCH 10/15] OMAP: DSS2: DSI driver Tony Lindgren
2009-08-05 14:59                   ` Tony Lindgren [this message]
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=20090805145939.GR7374@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).