From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Message-ID: <4E53C14E.8010103@analog.com> Date: Tue, 23 Aug 2011 17:03:42 +0200 From: Michael Hennerich Reply-To: MIME-Version: 1.0 To: malas CC: Jonathan Cameron , "linux-iio@vger.kernel.org" Subject: Re: ad7793 iio-ring test read issue - Reg References: <20110823080829.M36921@tcoe.iitm.ac.in> <4E538D35.7090508@cam.ac.uk> <20110823112234.M44553@tcoe.iitm.ac.in> <544AC56F16B56944AEC3BD4E3D59177146E6D069A2@LIMKCMBX1.ad.analog.com> <20110823121352.M43006@tcoe.iitm.ac.in> <4E539F70.3060209@cam.ac.uk> <20110823123747.M17135@tcoe.iitm.ac.in> <4E53A3FA.7020700@cam.ac.uk> <20110823131000.M76209@tcoe.iitm.ac.in> <4E53AE25.4040609@cam.ac.uk> <20110823134517.M58041@tcoe.iitm.ac.in> <4E53B41A.4030309@cam.ac.uk> <20110823141337.M89235@tcoe.iitm.ac.in> <544AC56F16B56944AEC3BD4E3D59177146E6D06A8E@LIMKCMBX1.ad.analog.com> <20110823144708.M86833@tcoe.iitm.ac.in> In-Reply-To: <20110823144708.M86833@tcoe.iitm.ac.in> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed List-ID: On 08/23/2011 04:53 PM, malas wrote: > On Tue, 23 Aug 2011 15:30:39 +0100, Hennerich, Michael wrote >> malas wrote on 2011-08-23: >>> On Tue, 23 Aug 2011 15:07:22 +0100, Jonathan Cameron wrote >>>> On 08/23/11 14:48, malas wrote: >>>>> On Tue, 23 Aug 2011 14:41:57 +0100, Jonathan Cameron wrote >>>>>> On 08/23/11 14:24, malas wrote: >>>>>>> On Tue, 23 Aug 2011 13:58:34 +0100, Jonathan Cameron wrote >>>>>>>> On 08/23/11 13:43, malas wrote: >>>>>>>>> YES : Gregs updated kernel taken from link below: >>>>>>>>> >>>>>>>>> http://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging- >>> 2.6.git >>>>>>>> Right now that's pretty much mainline. >>>>>>>> >>>>>>>> See comments below and please reply inline as it makes this sort >>>>>>>> of discussion much easier to follow. >>>>>>>>> >>>>>>>>> On Tue, 23 Aug 2011 13:39:12 +0100, Jonathan Cameron wrote >>>>>>>>>> On 08/23/11 13:17, malas wrote: >>>>>>>>>>> >>>>>>>>>>> Sorry, I did not explicitly mention that. I did use the new >>> staging kernel >>>>> referred by >>>>>>>>>>> Michael Hennerich and integrated with 2010RC5 uclinux dist . >>>>>>>>>> Hmm. As in current contents of Greg KH's staging/staging-next? >>>>>>>>>> >>>>>>>>>> I'll assume so... See below. >>>>>>>>>> >>>>>>>>>>> On Tue, 23 Aug 2011 12:39:53 +0100, Hennerich, Michael wrote >>>>>>>>>>>> malas wrote on 2011-08-23: >>>>>>>>>>>>> >>>>>>>>>>>>> Dear Jonathan Cameron, >>>>>>>>>>>>> >>>>>>>>>>>>> The kernel version I am using is : >>>>>>>>>>>> Didn't you say that you use the staging kernel? >>>>>>>>>>>> >>>>>>>>>>>> >>> http://blackfin.uclinux.org/gf/project/uclinux- >>> dist/forum/?_forum_action=MessageReply&message_id=102839&action=ForumBr >>> owse >>>>>>>>>>>> Or copied drivers/staging/iio over to your Blackfin kernel tree? >>>>>>>>>>>> >>>>>>>>>>>>> ----------------------------------------------------------- >>>>>>>>>>>>> ---------- >>>>>>>>>>>>> >>>>>>>>>>>>> midas@ubuntu:~/Mala/Telemedicine/uclinux_source/uc2010_source/u >>>>>>>>>>>>> clinux/2 010R1$ svn info Path: . URL: >>>>>>>>>>>>> svn://blackfin.uclinux.org/uclinux-dist/branches/2010R1 >>>>>>>>>>>>> Repository Root: svn://blackfin.uclinux.org/uclinux-dist >>>>>>>>>>>>> Repository UUID: 3e2a5524-39e8-4cb9-84a9-c49da69cba3a >>>>>>>>>>>>> Revision: 10161 Node Kind: directory Schedule: normal Last >>>>>>>>>>>>> Changed Author: vapier Last Changed Rev: 10136 Last Changed >>>>>>>>>>>>> Date: 2011-04-02 22:36:15 +0530 (Sat, 02 Apr 2011) >>>>>>>>>>>>> ----------------------------------------------------------- >>>>>>>>>>>>> ---------- >>>>>>>>>>>>> >>>>>>>>>>>>> Regards >>>>>>>>>>>>> Mala >>>>>>>>>>>>> >>>>>>>>>>>>> On Tue, 23 Aug 2011 12:21:25 +0100, Jonathan Cameron wrote >>>>>>>>>>>>>> On 08/23/11 09:18, malas wrote: >>>>>>>>>>>>>>> Dear Michael Hennerich, >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> I shall post iio quesris in this mail list as per your >>>>>>>>>>>>>>> suggestions. >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> AD7793 driver is built into kernel. The chip gets configured >>>>>>>>>>>>>>> and am able to read data on continuous mode via spi >>>>>>>>>>>>>>> interface using ad7793 driver at kernel level. >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> While testing userspace test iio-ring to read data from ring >>>>>>>>>>>>>>> buffer, generic_buffer code was executed, it proceeds till >>>>>>>>>>>>>>> opening /sys/bus/iio/devices/device0:buffer0 and Read call >>>>>>>>>>>>>>> fails. >>>>>>>>>>>>>> Question 1: What's the kernel and where did you get it from? >>>>>>>>>>>>>> (Interfaces are moving fast so it's plausible you've fallen >>>>>>>>>>>>>> in a hole where userspace wasn't matching kernelspace). >>>>>>>>>>>>>>> In fs I can list the iio device ad7793 with following >>>>>>>>>>>>>>> properties get/set. >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> root:/> ls /sys/bus/iio/devices/device0\:buffer0/ >>>>>>>>>>>>>>> bytes_per_datum enable power subsystem dev >>>>>>>>>>>>>>> length scan_elements uevent root:/> >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> I find access0 and event0 missing in this list. Is that >>> the reason >>>>>>>>>>>>> for read() fails. >>>>>>>>>>>>>> Yes. Question is why and without kernel version I don't know >>>>>>>>>>>>>> where to look I'm afraid. >>>>>>>>>> Ah, this does look like a missmatch in interfaces between >>>>>>>>>> userspace and kernel. >>>>>>>>>> >>>>>>>>>> At this point in time we have scrapped the event0 chrdev (done >>>>>>>>>> via polling on the access one) and the access one has be >>>>>>>>>> flattened into device0\:buffer0/ (read dev). >>>>>>>>>> >>>>>>>>>> Looks like the generic_buffer.c example does line up though. >>>>>>>>>> Where did the 'test iio-ring' come from? Is that one yours >>>>>>>>>> Michael? >>>>>>> >>>>>>> iio-ring.c under uclinux2010/user/blkfin-test/iio-ring-test. The >>>>>>> file is in the attached. I did not use that since i didn't find >>>>>>> access0 or event0 files under /sys/bus/iio/devices/device0:buffer0. >>>>>>> >>>>>>> I have tested with the generic_buffer.c example (under >>>>>>> iio/documentaion folder) to get Ad7793 received samples to user >>>>>>> space from ring buffer. The app opens: /dev/device0:buffer0 for poll >>>>>>> and reading samples. Is the device name for the open() correct. >>>>>> Yes - that should be right. >>>>> ************************* >>>>> Open fails for "/dev/device0:buffer0" device name >>>>> I tried changing to "/sys/bus/iio/devices/device0:buffer0"- open() >>> succeeded then but >>>>> then read fails. >>>> Read must be the one under dev. The other is a directory with >>>> description of the buffer. >>>> >>>> What is the error on the open of /dev/device0:buffer0? >>> ERROR => >>> Going to open access file /dev/device0:buffer0 >>> Failed to open /dev/device0:buffer0 >>> open returned fp as -1 >>> >> I think I asked you before to check if /dev/device0:buffer0 exists. >> And I guess is does not - so you have to create it. >> >> Greetings, >> Michael > I created a directory "device0:buffer0" under /dev. Files under /dev are device nodes, so called pseudo files. You have to create them using mknod, or have mdev create them for you. Typically they are created automatically. But on Blackfin they fail to be created when the IIO driver is statically build into the kernel. However mdev creates them when the driver is loaded as module. The simplest for you would be to build ad7793 as module and use modprobe on start. > Open() now succeeds, but read() is still failing, returns readSize as -1. > I have not initialised any trigger.Should I? > > I am running generic_buffer specifying only driver name as: > > root> generic_buffer -n ad7793 > > -mala >> -- >> Analog Devices GmbH Wilhelm-Wagenfeld-Str. 6 80807 Muenchen >> Sitz der Gesellschaft: Muenchen; Registergericht: Muenchen HRB 40368; >> Geschaeftsfuehrer:Dr.Carsten Suckrow, Thomas Wessel, William A. Martin, >> Margaret Seif > > -- > Open WebMail Project (http://openwebmail.org) > > > > -- > To unsubscribe from this list: send the line "unsubscribe linux-iio" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- Greetings, Michael -- Analog Devices GmbH Wilhelm-Wagenfeld-Str. 6 80807 Muenchen Sitz der Gesellschaft: Muenchen; Registergericht: Muenchen HRB 40368; Geschaeftsfuehrer:Dr.Carsten Suckrow, Thomas Wessel, William A. Martin, Margaret Seif