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

staging: iio: frequency: ad9833: Get frequency value statically

The values from platform data were replaced by statically values.
This was just a intermediate step of taking this driver out of staging and
load data from device tree.

Signed-off-by: Beniamin Bia <beniamin.bia@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Beniamin Bia and committed by
Jonathan Cameron
80109c32 1e65b2f1

+7 -42
+7 -14
drivers/staging/iio/frequency/ad9834.c
··· 389 389 390 390 static int ad9834_probe(struct spi_device *spi) 391 391 { 392 - struct ad9834_platform_data *pdata = dev_get_platdata(&spi->dev); 393 392 struct ad9834_state *st; 394 393 struct iio_dev *indio_dev; 395 394 struct regulator *reg; 396 395 int ret; 397 396 398 - if (!pdata) { 399 - dev_dbg(&spi->dev, "no platform data?\n"); 400 - return -ENODEV; 401 - } 402 397 403 398 reg = devm_regulator_get(&spi->dev, "avdd"); 404 399 if (IS_ERR(reg)) ··· 413 418 spi_set_drvdata(spi, indio_dev); 414 419 st = iio_priv(indio_dev); 415 420 mutex_init(&st->lock); 416 - st->mclk = pdata->mclk; 421 + st->mclk = 25000000; 417 422 st->spi = spi; 418 423 st->devid = spi_get_device_id(spi)->driver_data; 419 424 st->reg = reg; ··· 449 454 spi_message_add_tail(&st->freq_xfer[1], &st->freq_msg); 450 455 451 456 st->control = AD9834_B28 | AD9834_RESET; 457 + st->control |= AD9834_DIV2; 452 458 453 - if (!pdata->en_div2) 454 - st->control |= AD9834_DIV2; 455 - 456 - if (!pdata->en_signbit_msb_out && (st->devid == ID_AD9834)) 459 + if (st->devid == ID_AD9834) 457 460 st->control |= AD9834_SIGN_PIB; 458 461 459 462 st->data = cpu_to_be16(AD9834_REG_CMD | st->control); ··· 461 468 goto error_disable_reg; 462 469 } 463 470 464 - ret = ad9834_write_frequency(st, AD9834_REG_FREQ0, pdata->freq0); 471 + ret = ad9834_write_frequency(st, AD9834_REG_FREQ0, 1000000); 465 472 if (ret) 466 473 goto error_disable_reg; 467 474 468 - ret = ad9834_write_frequency(st, AD9834_REG_FREQ1, pdata->freq1); 475 + ret = ad9834_write_frequency(st, AD9834_REG_FREQ1, 5000000); 469 476 if (ret) 470 477 goto error_disable_reg; 471 478 472 - ret = ad9834_write_phase(st, AD9834_REG_PHASE0, pdata->phase0); 479 + ret = ad9834_write_phase(st, AD9834_REG_PHASE0, 512); 473 480 if (ret) 474 481 goto error_disable_reg; 475 482 476 - ret = ad9834_write_phase(st, AD9834_REG_PHASE1, pdata->phase1); 483 + ret = ad9834_write_phase(st, AD9834_REG_PHASE1, 1024); 477 484 if (ret) 478 485 goto error_disable_reg; 479 486
-28
drivers/staging/iio/frequency/ad9834.h
··· 8 8 #ifndef IIO_DDS_AD9834_H_ 9 9 #define IIO_DDS_AD9834_H_ 10 10 11 - /* 12 - * TODO: struct ad7887_platform_data needs to go into include/linux/iio 13 - */ 14 - 15 - /** 16 - * struct ad9834_platform_data - platform specific information 17 - * @mclk: master clock in Hz 18 - * @freq0: power up freq0 tuning word in Hz 19 - * @freq1: power up freq1 tuning word in Hz 20 - * @phase0: power up phase0 value [0..4095] correlates with 0..2PI 21 - * @phase1: power up phase1 value [0..4095] correlates with 0..2PI 22 - * @en_div2: digital output/2 is passed to the SIGN BIT OUT pin 23 - * @en_signbit_msb_out: the MSB (or MSB/2) of the DAC data is connected to the 24 - * SIGN BIT OUT pin. en_div2 controls whether it is the MSB 25 - * or MSB/2 that is output. if en_signbit_msb_out=false, 26 - * the on-board comparator is connected to SIGN BIT OUT 27 - */ 28 - 29 - struct ad9834_platform_data { 30 - unsigned int mclk; 31 - unsigned int freq0; 32 - unsigned int freq1; 33 - unsigned short phase0; 34 - unsigned short phase1; 35 - bool en_div2; 36 - bool en_signbit_msb_out; 37 - }; 38 - 39 11 #endif /* IIO_DDS_AD9834_H_ */