Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

staging: iio: ad9832: remove platform_data support

Remove legacy platform_data support as there are no in tree users and
this approach belongs to a long gone era. The policy decision on what
to output is a userspace problem, not something that should be provided
from firmware.

The driver now initializes the device to a safe state (SLEEP|RESET|CLR)
outputting nothing. Userspace can configure the desired frequencies and
phases via the existing sysfs attributes once the device is ready to be
used.

Original discussion started here [1].

Link: https://lore.kernel.org/linux-iio/20250628161040.3d21e2c4@jic23-huawei/ #[1]
Suggested-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Tomas Borquez <tomasborquez13@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Tomas Borquez and committed by
Jonathan Cameron
c7f9c36b 8f0b4cce

-65
-32
drivers/staging/iio/frequency/ad9832.c
··· 23 23 #include <linux/iio/iio.h> 24 24 #include <linux/iio/sysfs.h> 25 25 26 - #include "ad9832.h" 27 - 28 26 #include "dds.h" 29 27 30 28 /* Registers */ ··· 297 299 298 300 static int ad9832_probe(struct spi_device *spi) 299 301 { 300 - struct ad9832_platform_data *pdata = dev_get_platdata(&spi->dev); 301 302 struct iio_dev *indio_dev; 302 303 struct ad9832_state *st; 303 304 int ret; 304 - 305 - if (!pdata) { 306 - dev_dbg(&spi->dev, "no platform data?\n"); 307 - return -ENODEV; 308 - } 309 305 310 306 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); 311 307 if (!indio_dev) ··· 370 378 dev_err(&spi->dev, "device init failed\n"); 371 379 return ret; 372 380 } 373 - 374 - ret = ad9832_write_frequency(st, AD9832_FREQ0HM, pdata->freq0); 375 - if (ret) 376 - return ret; 377 - 378 - ret = ad9832_write_frequency(st, AD9832_FREQ1HM, pdata->freq1); 379 - if (ret) 380 - return ret; 381 - 382 - ret = ad9832_write_phase(st, AD9832_PHASE0H, pdata->phase0); 383 - if (ret) 384 - return ret; 385 - 386 - ret = ad9832_write_phase(st, AD9832_PHASE1H, pdata->phase1); 387 - if (ret) 388 - return ret; 389 - 390 - ret = ad9832_write_phase(st, AD9832_PHASE2H, pdata->phase2); 391 - if (ret) 392 - return ret; 393 - 394 - ret = ad9832_write_phase(st, AD9832_PHASE3H, pdata->phase3); 395 - if (ret) 396 - return ret; 397 381 398 382 return devm_iio_device_register(&spi->dev, indio_dev); 399 383 }
-33
drivers/staging/iio/frequency/ad9832.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0+ */ 2 - /* 3 - * AD9832 SPI DDS driver 4 - * 5 - * Copyright 2011 Analog Devices Inc. 6 - */ 7 - #ifndef IIO_DDS_AD9832_H_ 8 - #define IIO_DDS_AD9832_H_ 9 - 10 - /* 11 - * TODO: struct ad9832_platform_data needs to go into include/linux/iio 12 - */ 13 - 14 - /** 15 - * struct ad9832_platform_data - platform specific information 16 - * @freq0: power up freq0 tuning word in Hz 17 - * @freq1: power up freq1 tuning word in Hz 18 - * @phase0: power up phase0 value [0..4095] correlates with 0..2PI 19 - * @phase1: power up phase1 value [0..4095] correlates with 0..2PI 20 - * @phase2: power up phase2 value [0..4095] correlates with 0..2PI 21 - * @phase3: power up phase3 value [0..4095] correlates with 0..2PI 22 - */ 23 - 24 - struct ad9832_platform_data { 25 - unsigned long freq0; 26 - unsigned long freq1; 27 - unsigned short phase0; 28 - unsigned short phase1; 29 - unsigned short phase2; 30 - unsigned short phase3; 31 - }; 32 - 33 - #endif /* IIO_DDS_AD9832_H_ */