All of lore.kernel.org
 help / color / mirror / Atom feed
* DTS Support for AD7192
@ 2013-08-14  7:25 Oliver King-Smith
  2013-08-17  9:53 ` Lars-Peter Clausen
  0 siblings, 1 reply; 4+ messages in thread
From: Oliver King-Smith @ 2013-08-14  7:25 UTC (permalink / raw)
  To: linux-iio

Hello,

I am trying to bring up an AD7192 under the new IIO standard in linux.  I am using the 3.8 version of the kernel on a BeagleBone black.  I am having trouble understand the devices tree structure for industrial IO.

In particular I define a new spi device that looks like

/*
 * Copyright (C) 2013 Elemental Semiconductor
 *
 * 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 has been developed to support the DAQ system being developed
 * by Elemental Semiconductor/
 */
/dts-v1/;
/plugin/;

/ {
	compatible = "ti,beaglebone-black", "ti,am335x-bone";

	/* identification */
	part-number = "es_daq";
	version = "0010";

	/* We need to use the SPI bus for the AD7192 */
	exclusive-use =
		/* the pin header uses */
		"P9.28",	/* spi1_cs0 */
		"P9.29",	/* spi1_d0 */
		"P9.30",	/* spi1_d1 */
		"P9.31",	/* spi1_sclk */
		"p9.27",	/* interrupt data ready */
		/* the hardware ip uses */
		"gpio3_19",
		"spi1";	

	fragment@0 {
		target = <&am33xx_pinmux>;
		__overlay__ {
			/* default state has all gpios released and mode set to uart1 */
			bb_spi1_pins: pinmux_bb_spi1_pins {
				pinctrl-single,pins = <
					0x190 0x33	/* mcasp0_aclkx.spi1_sclk, INPUT_PULLUP | MODE3 */
					0x194 0x33	/* mcasp0_fsx.spi1_d0, INPUT_PULLUP | MODE3 */
					0x198 0x13	/* mcasp0_axr0.spi1_d1, OUTPUT_PULLUP | MODE3 */
					0x19c 0x13	/* mcasp0_ahclkr.spi1_cs0, OUTPUT_PULLUP | MODE3 */
				>;
			};
			bb_adc0_pins: pinmux_bb_gpio3_pins {
				pinctrl-single,pins = <
					0x18c 0x2f	/* DRDY interrupt INPUT | PULLDIS | MODE7 */
				>;
			};
		};
	};


	fragment@1 {
		target = <&spi1>;	/* spi1 is numbered correctly */
		__overlay__ {
			status = "okay";
			pinctrl-names = "default";
			pinctrl-0 = <&bb_spi1_pins>;

			#address-cells = <1>;
			#size-cells = <0>;
			
			// We try to add in the adc
			adc@0{
				#address-cells = <1>;
				#size-cells = <0>;
				
				compatible = "ad,ad7192";
				reg = <0>;
				
				// The ad7192 can handle 5MHz, but our isolators are only good
				// to 1MHz.  So we back of to 500KHz
				spi-max-frequency = <500000>;
				// we want to invert the normal operation for the AD7192
				spi-cpol;
				spi-cpha;
	
				// Make sure the interrupt pin is mentioned here
				pinctrl-names = "default";
				pinctrl-0 = <&bb_adc0_pins>;

				interrupt-parent = <&gpio3>;
				interrupts = <19 0x0>;
				irq-gpio = <&gpio3 19 0>;
				
				// I think we need to identify this device as an iio device
				#io-channel-cells = <1>;
			};
		};
	};
};

This file works at some level, because I see the ad7192 kernel module being loaded, and the api bus show an ad7182 registered.  The problem is I don't see the iiodevices showing up in the /dev directory.  I thought adding the #io-channel-cells = <1>; was sufficient, but apparently it is not.

Does anyone have any advice on how I should define the DTS file to make the system understand that I want to use the AD7192 as an IIO device?

Oliver


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: DTS Support for AD7192
  2013-08-14  7:25 DTS Support for AD7192 Oliver King-Smith
@ 2013-08-17  9:53 ` Lars-Peter Clausen
  2013-08-20 13:10   ` Bogdan, Dragos
  0 siblings, 1 reply; 4+ messages in thread
From: Lars-Peter Clausen @ 2013-08-17  9:53 UTC (permalink / raw)
  To: Oliver King-Smith; +Cc: linux-iio, Dragos Bogdan

On 08/14/2013 09:25 AM, Oliver King-Smith wrote:
> Hello,
>
> I am trying to bring up an AD7192 under the new IIO standard in linux.  I am using the 3.8 version of the kernel on a BeagleBone black.  I am having trouble understand the devices tree structure for industrial IO.
[...]

There is nothing special that needs to be done for IIO devices for devicetree, 
but the driver currently does not support devicetree. But I think Dragos has a 
patch adding dt support to the driver.

- Lars


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: DTS Support for AD7192
  2013-08-17  9:53 ` Lars-Peter Clausen
@ 2013-08-20 13:10   ` Bogdan, Dragos
  2013-08-21  0:00     ` Oliver King-Smith
  0 siblings, 1 reply; 4+ messages in thread
From: Bogdan, Dragos @ 2013-08-20 13:10 UTC (permalink / raw)
  To: Lars-Peter Clausen, Oliver King-Smith; +Cc: linux-iio@vger.kernel.org

Hi Oliver,

Unfortunately, these days I'm out of office, so I will publish the devicetree support patch just next week. I will let you know.

Regards,
Dragos
________________________________________
From: Lars-Peter Clausen [lars@metafoo.de]
Sent: Saturday, August 17, 2013 12:53 PM
To: Oliver King-Smith
Cc: linux-iio@vger.kernel.org; Bogdan, Dragos
Subject: Re: DTS Support for AD7192

On 08/14/2013 09:25 AM, Oliver King-Smith wrote:
> Hello,
>
> I am trying to bring up an AD7192 under the new IIO standard in linux.  I am using the 3.8 version of the kernel on a BeagleBone black.  I am having trouble understand the devices tree structure for industrial IO.
[...]

There is nothing special that needs to be done for IIO devices for devicetree,
but the driver currently does not support devicetree. But I think Dragos has a
patch adding dt support to the driver.

- Lars




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: DTS Support for AD7192
  2013-08-20 13:10   ` Bogdan, Dragos
@ 2013-08-21  0:00     ` Oliver King-Smith
  0 siblings, 0 replies; 4+ messages in thread
From: Oliver King-Smith @ 2013-08-21  0:00 UTC (permalink / raw)
  To: Bogdan, Dragos; +Cc: Lars-Peter Clausen, linux-iio@vger.kernel.org

Dragos,

I am resending this, as I accidentally sent the previous version in non plain text.

Thank you for the follow up, I have made some progress on this.  I am using the Beaglebone Black to interface to the ad7192.  The main problem now can be shown in the log below:

[  311.593777] ad7192: module is from the staging directory, the quality is unknown, you have been warned.
[  311.595641] edma-dma-engine edma-dma-engine.0: allocated channel for 0:43
[  311.597279] edma-dma-engine edma-dma-engine.0: allocated channel for 0:42
[  311.597617] ad7192 spi1.0: no platform data?
[  311.609899] bone-capemgr bone_capemgr.8: slot #7: Applied #2 overlays.

The platform data in this case is the struct ad7192_platform_data

There is no support that I can see to populate this data from device tree.  I assume this is part of your fix.

Another issue I saw when hooking the ad7192 to an old beagle bone (running a much older version of the kernel and iio infrastructure) was the iio driver for the ad7192 was hanging working with the AM335X processors.  In this case I tracked the problem to level sensitive interrupts rather than edge sensitive.  There were some race conditions that cause the driver to miss an interrupt and hang as a result.  I never got it entirely working as I got distracted and the Beaglebone Black came out by the time I picked it up again.  Do you want me to post those changes back?  A lot has changed since then, but it could still be a problem in the current drivers.

 Oliver King-Smith PhD
CEO
831-227-8675
oliverks@elementalsemi.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-08-21  0:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-14  7:25 DTS Support for AD7192 Oliver King-Smith
2013-08-17  9:53 ` Lars-Peter Clausen
2013-08-20 13:10   ` Bogdan, Dragos
2013-08-21  0:00     ` Oliver King-Smith

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.