From: David Brownell <david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
joakim.tjernlund-SNLAxHN9vbcOP4wsBPIw7w@public.gmane.org
Subject: Re: spidev question
Date: Mon, 10 Mar 2008 12:00:44 -0800 [thread overview]
Message-ID: <200803101300.44267.david-b@pacbell.net> (raw)
In-Reply-To: <1205178415.29669.119.camel-/EMGr9iCeazgSi9v3i4K4Pmbkio/vSLMs0AfqQuZ5sE@public.gmane.org>
On Monday 10 March 2008, Joakim Tjernlund wrote:
> Trying to make sense of spidev. We have 5 spi devices on the
> same spi bus and I am trying to use different word sizes for some of the
> devices.
>
> I open 5 diffrent /dev/spidev0.x where x=0..4 and for
> each fd returned I do:
> ioctl(fd, SPI_IOC_WR_BITS_PER_WORD, &bits);
That is, something like:
fd[x] = open("/dev/spidev0.x", O_RDWR);
ioctl(fd[x], SPI_IOC_WR_BITS_PER_WORD, &bits[x]);
Each device should have its own file descriptor.
> bits is either 8 or 16.
> However, it seems that the last ioctl "wins", all spi transactions
> appears to used the last setting, thats is, the ioctl appears to be
> for the controller, not the spi slave I am talking to.
Sounds like a bug in the controller driver, if you're properly
getting a file descriptor per device...
> This does not make sense to me, I figured I could set bits_per_word(and
> max speed too) for each slave. Can anyone tell me how spidev is supposed
> to work? It is quite possible that I got a problem in spi HW driver that
> fools me somehow.
Absolutely. Each device has a variety of individual characteristics,
like speed, bits per word, mode, and so on. That's why they're stored
in the spi_device rather than the controller
- Dave
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
next prev parent reply other threads:[~2008-03-10 20:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-10 19:46 spidev question Joakim Tjernlund
[not found] ` <1205178415.29669.119.camel-/EMGr9iCeazgSi9v3i4K4Pmbkio/vSLMs0AfqQuZ5sE@public.gmane.org>
2008-03-10 20:00 ` David Brownell [this message]
[not found] ` <200803101300.44267.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-03-10 20:05 ` Joakim Tjernlund
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=200803101300.44267.david-b@pacbell.net \
--to=david-b-ybekhbn/0ldr7s880joybq@public.gmane.org \
--cc=joakim.tjernlund-SNLAxHN9vbcOP4wsBPIw7w@public.gmane.org \
--cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.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.