All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Wang <jason77.wang@gmail.com>
To: Grazvydas Ignotas <notasas@gmail.com>
Cc: Jason Wang <jason77.wang@gmail.com>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	vapier@gentoo.org, linux-input@vger.kernel.org,
	linux-omap@vger.kernel.org, grant.likely@secretlab.ca,
	roman.tereshonkov@nokia.com
Subject: Re: [PATCH 4/4] Input: ads7846 - modificatons of _stop()/_disable() conditions
Date: Thu, 14 Oct 2010 10:14:15 +0800	[thread overview]
Message-ID: <4CB66777.5060309@gmail.com> (raw)
In-Reply-To: <AANLkTi=0b-q3LK3-4mgdpSP7pScVSF1ZWzD45bLoAmJO@mail.gmail.com>

Grazvydas Ignotas wrote:
> On Wed, Oct 13, 2010 at 6:12 AM, Jason Wang <jason77.wang@gmail.com> wrote:
>   
>> Hi Dmitry,
>>
>> I have validated the new patch based off the 2.6.36-rc7 on
>> the ti_omap3530evm, it works fine.
>>     
>
> Working here on pandora too, applied on top of linux-next (did not
> test suspend though).
>
> Not caused by this patch, but the old problem where lower measurement
> bits get lost is back - when I draw diagonal line it looks like
> stairs. I think it's caused by OMAP SPI driver, CCing linux-omap.
>
>   
Yes, it is OMAP spi driver issues, I have met the same problem before, 
please refer to:
http://www.spinics.net/lists/arm-kernel/msg91538.html

you can apply this patch and test again.



 From 393f445ab899abaf5d60a55a54f242c430507047 Mon Sep 17 00:00:00 2001
From: Jason Wang <jason77.wang@gmail.com>
Date: Thu, 14 Oct 2010 10:08:07 +0800
Subject: [PATCH] spi/omap2_mcspi: disable channel after TX_ONLY transfer 
in PIO mode

In TX_ONLY transfer, the SPI controller can also receive data
simultaneously and saves them in rx register. After the TX_ONLY
transfer, the rx register will hold random data received during
last tx transaction.

If the next transfer is RX_ONLY, this random data has
the possibility to affect this transfer like this:

  If the spi controller is changed from TX_ONLY to RX_ONLY mode,
  The random data makes the rx register full imediately and
  triggers a dummy write (in SPI RX_ONLY transfer, we need a dummy
  write to trigger the first transaction).

  So the first data received in RX_ONLY transfer will be that
  random data instead of something meaningfug.

We can avoid this by a Disable/reenable toggle of the spi channel
after the TX_ONLY transfer, since it purges the rx register.

Signed-off-by: Jason Wang <jason77.wang@gmail.com>
---
 drivers/spi/omap2_mcspi.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/spi/omap2_mcspi.c b/drivers/spi/omap2_mcspi.c
index b3a94ca..43fab41 100644
--- a/drivers/spi/omap2_mcspi.c
+++ b/drivers/spi/omap2_mcspi.c
@@ -644,6 +644,12 @@ omap2_mcspi_txrx_pio(struct spi_device *spi, struct 
spi_transfer *xfer)
                } else if (mcspi_wait_for_reg_bit(chstat_reg,
                                OMAP2_MCSPI_CHSTAT_EOT) < 0)
                        dev_err(&spi->dev, "EOT timed out\n");
+
+               /* disable chan to purge rx datas received in TX_ONLY 
transfer,
+                * otherwise these rx datas will affect the direct following
+                * RX_ONLY transfer.
+                */
+               omap2_mcspi_set_enable(spi, 0);
        }
 out:
        omap2_mcspi_set_enable(spi, 1);
-- 
1.5.6.5


  reply	other threads:[~2010-10-14  2:10 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-16 10:51 [PATCH 0/4] Switch ads7846 driver to use soft irq Jason Wang
2010-09-16 10:51 ` [PATCH 1/4] Input: ads7846 - switch to using threaded IRQ Jason Wang
2010-09-16 10:51   ` [PATCH 2/4] Input: ads7846 - add a include header to prevent building fails Jason Wang
2010-09-16 10:51     ` [PATCH 3/4] Input: ads7846 - restore ADC to powerdown mode if no messgaes needed Jason Wang
2010-09-16 10:51       ` [PATCH 4/4] Input: ads7846 - modificatons of _stop()/_disable() conditions Jason Wang
2010-09-17  6:39         ` Dmitry Torokhov
2010-09-17  9:20           ` Jason Wang
2010-09-17 16:07             ` Dmitry Torokhov
2010-09-20  8:18               ` Jason Wang
2010-10-12  9:58                 ` Jason Wang
2010-10-12 16:00                   ` Dmitry Torokhov
2010-10-13  3:12                     ` Jason Wang
2010-10-13 22:17                       ` Grazvydas Ignotas
2010-10-14  2:14                         ` Jason Wang [this message]
2010-10-14 21:40                           ` Grazvydas Ignotas
2010-10-15  2:29                             ` Jason Wang
2010-10-18 23:19                               ` Tony Lindgren
2010-10-19  1:25                                 ` Jason Wang
2010-09-17  1:48 ` [PATCH 0/4] Switch ads7846 driver to use soft irq Jason Wang

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=4CB66777.5060309@gmail.com \
    --to=jason77.wang@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=grant.likely@secretlab.ca \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=notasas@gmail.com \
    --cc=roman.tereshonkov@nokia.com \
    --cc=vapier@gentoo.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.