Re: [PATCH 1/2] iio: ad5755: add support for dt bindings
From: Lars-Peter Clausen <hidden>
Date: 2016-02-02 16:37:50
Also in:
linux-iio
On 02/02/2016 04:57 PM, Sean Nyekjær wrote:
On 2016-02-02 16:33, Lars-Peter Clausen wrote:quoted
On 02/02/2016 01:36 PM, Sean Nyekjaer wrote:quoted
Still missing a way to provide default modes and settings for the driver from dt, but I see this as a start. Signed-off-by: Sean Nyekjaer <sean.nyekjaer-rjjw5hvvQKZaa/9Udqfwiw@public.gmane.org>Hi, Thanks for the patch.:-)quoted
quoted
--- drivers/iio/dac/ad5755.c | 10 ++++++++++ 1 file changed, 10 insertions(+)diff --git a/drivers/iio/dac/ad5755.c b/drivers/iio/dac/ad5755.c index bfb350a..e1b6e78 100644 --- a/drivers/iio/dac/ad5755.c +++ b/drivers/iio/dac/ad5755.c@@ -607,6 +607,16 @@ static const struct spi_device_id ad5755_id[] = { }; MODULE_DEVICE_TABLE(spi, ad5755_id); +static const struct of_device_id ad5755_of_match[] = { + { .compatible = "adi,ad5755" }, + { .compatible = "adi,ad5755-1" }, + { .compatible = "adi,ad5757" }, + { .compatible = "adi,ad5735" }, + { .compatible = "adi,ad5737" },This needs to set the ID for the device type, so that the driver gets instantiated for the correct devicetype. And in the probe function check if the driver was probed via DT (by checking spi->dev.of_node) and if it does get the ID from the of_device_id rather the spi_device_id.I was planning on doing that. And I was experimenting with providing modes and settings for every channel from the dt. Is the DAC the only output devices in IIO?
There is also support for programmable potentiometers (sometimes called RDAC), but that's it.
I will send an proposal tomorrow :-) And thereby (maybe) pave the way for the runtime mode switching Should we drop the platform data support and only rely on dt?
No, there might still be some people depending on it. I don't think the burden of continuing to maintain the platform data support is that high. - Lars