From: Tomi Valkeinen <tomi.valkeinen@ti.com>
To: "Dr. H. Nikolaus Schaller" <hns@goldelico.com>
Cc: Marek Belisko <marek@goldelico.com>,
plagnioj@jcrosoft.com, linux-kernel@vger.kernel.org,
linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org
Subject: Re: [PATCH] omapdss: Add new panel driver for Topolly td028ttec1 LCD.
Date: Thu, 10 Oct 2013 11:10:56 +0000 [thread overview]
Message-ID: <52568B40.4040802@ti.com> (raw)
In-Reply-To: <7FAC77D4-5E1E-4B11-B067-3A8233C69240@goldelico.com>
[-- Attachment #1: Type: text/plain, Size: 5821 bytes --]
On 10/10/13 12:34, Dr. H. Nikolaus Schaller wrote:
> Hi Tomi,
>
> Am 10.10.2013 um 10:19 schrieb Tomi Valkeinen:
>
>> Hi,
>>
>> On 10/10/13 00:08, Marek Belisko wrote:
>>> For communicating with driver is used gpio bitbanging because TD028 does
>>> not have a standard compliant SPI interface. It is a 3-wire thing with
>>> direction reversal.
>>
>> Isn't that SPI_3WIRE?
>
> Maybe - but we have no complete datasheet and I don't know an official spec of
> a 3-wire SPI protocol to compare how 3-wire should work.
Yep, and I know only what I read on wikipedia a few hours ago =).
> And I think (but I may be wrong) that SPI_3WIRE is an optional feature of the SoC
> specific SPI drivers and in my understanding the OMAP has no such driver:
>
> http://lxr.free-electrons.com/source/drivers/spi/spi-omap2-mcspi.c#L874
>
> And spi-bitbang.c hasn't either.
>
> So I would prefer to leave this as an area for optimizations for future work.
> Maybe we can add some more comments on this.
Ok. Well, I guess it's not too bad. But it's really not something that
should be in the panel driver (assuming it's "standard" 3-wire SPI).
Some SoC could support 3-wire SPI, and then it'd be good to use the SoCs
hardware for SPI communication. Having bitbanging hardcoded into the
driver will prevent that.
>>> + int cs_gpio;
>>> + int scl_gpio;
>>> + int din_gpio;
>>> + int dout_gpio;
>>
>> Three wires, but four gpios? What am I missing here...
>
> We have wired up the 3-wire SPI interface of the display
> to 4 wires of the McSPI interface because we initially thought
> that it could work in 4 wire mode as well.
>
> The next step we did was to port the driver code from the
> Openmoko Neo1973 U-Boot which used the gpio-bitbang
> mechanism.
>
> Since it worked and is used only for enabling/disabling the
> display and for no other purpose we never felt it important
> to check or modify the code to use SPI.
>
> But you are right - we don't use the din_gpio really since
> we never read registers from the chip. So 3 gpios could be
> sufficient.
>
> Or we must handle the case that din_gpio == dout_gpio
> in panel_probe to avoid duplicate use of the same gpio.
The panel hardware has three wires, so the panel driver (if it does
handle the bus by bitbanging) can only refer to three gpios. So either
the bus details should be hidden by using the normal spi framework, or
if the driver does the bitbanging, use the gpios as specified in the
panel spec. The panel driver cannot contain any board specific stuff.
>>> +static int jbt_spi_xfer(struct panel_drv_data *data, int wordnum, int bitlen)
>>
>> Hmm, if it's not SPI, maybe it shouldn't be called SPI?
>
> Yes, we can remove the _spi_ in this name.
Or maybe use "spi3w" or such, just to make it clear it's not plain
standard spi. Again, presuming it's really 3-wire spi =).
>>> +static int td028ttec1_panel_probe(struct platform_device *pdev)
>>> +{
>>> + struct panel_drv_data *ddata;
>>> + struct omap_dss_device *dssdev;
>>> + int r;
>>> +
>>> + ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL);
>>> + if (ddata == NULL)
>>> + return -ENOMEM;
>>> +
>>> + platform_set_drvdata(pdev, ddata);
>>> +
>>> + if (dev_get_platdata(&pdev->dev)) {
>>> + r = td028ttec1_panel_probe_pdata(pdev);
>>> + if (r)
>>> + return r;
>>> + } else {
>>> + return -ENODEV;
>>> + }
>>> +
>>> + if (gpio_is_valid(ddata->cs_gpio)) {
>>> + r = devm_gpio_request_one(&pdev->dev, ddata->cs_gpio,
>>> + GPIOF_OUT_INIT_HIGH, "lcd cs");
>>> + if (r)
>>> + goto err_gpio;
>>> + }
>>> +
>>> + if (gpio_is_valid(ddata->scl_gpio)) {
>>> + r = devm_gpio_request_one(&pdev->dev, ddata->scl_gpio,
>>> + GPIOF_OUT_INIT_HIGH, "lcd scl");
>>> + if (r)
>>> + goto err_gpio;
>>> + }
>>> +
>>> + if (gpio_is_valid(ddata->dout_gpio)) {
>>> + r = devm_gpio_request_one(&pdev->dev, ddata->dout_gpio,
>>> + GPIOF_OUT_INIT_LOW, "lcd dout");
>>> + if (r)
>>> + goto err_gpio;
>>> + }
>>> +
>>> + if (gpio_is_valid(ddata->din_gpio)) {
>>> + r = devm_gpio_request_one(&pdev->dev, ddata->din_gpio,
>>> + GPIOF_IN, "lcd din");
>>> + if (r)
>>> + goto err_gpio;
>>> + }
>>> +
>>> + /* according to data sheet: wait 50ms (Tpos of LCM). However, 50ms
>>> + * seems unreliable with later LCM batches, increasing to 90ms */
>>> + mdelay(90);
>>
>> What is this delay for? Usually sleeps/delays should be between two "HW
>> actions". Here there's nothing below this line that would count as such
>> an action.
>
> I guess that this delay is intended to power on the display first, then wait some
I'm not very comfortable with merging a driver, when the driver author
guesses what parts of the driver do =).
> time and after that delay enable the DSS clocks and signals and make the
> controller chip in the panel initialize.
I don't see the code before the delay doing any power up, it just sets
the data bus gpios to certain state. Do those gpio initializations power
up the panel?
> But this of course depends on the order the DSS components are probed
> and enabled and how power is controlled (we don't interrupt power at all).
>
> I think we can move this delay (sleep) to the beginning of
>
> td028ttec1_panel_enable() before /* three times command zero */
>
> to make sure that a freshly powered display has enough time to do its
> internal reset and initializations before registers are programmed.
The probe function should not enable the panel (well, it can enable the
panel, but only to read an ID or such and then disable it before exiting
probe).
So after probe, the panel should be as dead as possible, power disabled
etc. All the powering up should happen in enable().
Tomi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 901 bytes --]
next prev parent reply other threads:[~2013-10-10 11:10 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-09 21:08 [PATCH] omapdss: Add new panel driver for Topolly td028ttec1 LCD Marek Belisko
2013-10-10 8:19 ` Tomi Valkeinen
2013-10-10 9:34 ` Dr. H. Nikolaus Schaller
2013-10-10 11:10 ` Tomi Valkeinen [this message]
2013-10-10 11:52 ` Dr. H. Nikolaus Schaller
2013-10-10 12:13 ` Tomi Valkeinen
2013-10-10 12:26 ` Lars-Peter Clausen
2013-10-10 13:42 ` Dr. H. Nikolaus Schaller
2013-10-10 18:58 ` Lars-Peter Clausen
2013-10-11 4:41 ` Tomi Valkeinen
2013-10-11 7:08 ` Lars-Peter Clausen
2013-10-11 7:42 ` Dr. H. Nikolaus Schaller
2013-10-11 8:17 ` Tomi Valkeinen
2013-10-11 8:59 ` Belisko Marek
2013-10-11 9:04 ` Tomi Valkeinen
2013-10-11 9:06 ` Lars-Peter Clausen
2013-10-11 9:50 ` Dr. H. Nikolaus Schaller
2013-10-11 10:09 ` Tomi Valkeinen
2013-10-11 11:03 ` Dr. H. Nikolaus Schaller
2013-10-11 7:29 ` Dr. H. Nikolaus Schaller
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=52568B40.4040802@ti.com \
--to=tomi.valkeinen@ti.com \
--cc=hns@goldelico.com \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=marek@goldelico.com \
--cc=plagnioj@jcrosoft.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).