Commit 80109c32 authored by Beniamin Bia's avatar Beniamin Bia Committed by Jonathan Cameron

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: default avatarBeniamin Bia <beniamin.bia@analog.com>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 1e65b2f1
...@@ -389,16 +389,11 @@ static const struct iio_info ad9833_info = { ...@@ -389,16 +389,11 @@ static const struct iio_info ad9833_info = {
static int ad9834_probe(struct spi_device *spi) static int ad9834_probe(struct spi_device *spi)
{ {
struct ad9834_platform_data *pdata = dev_get_platdata(&spi->dev);
struct ad9834_state *st; struct ad9834_state *st;
struct iio_dev *indio_dev; struct iio_dev *indio_dev;
struct regulator *reg; struct regulator *reg;
int ret; int ret;
if (!pdata) {
dev_dbg(&spi->dev, "no platform data?\n");
return -ENODEV;
}
reg = devm_regulator_get(&spi->dev, "avdd"); reg = devm_regulator_get(&spi->dev, "avdd");
if (IS_ERR(reg)) if (IS_ERR(reg))
...@@ -418,7 +413,7 @@ static int ad9834_probe(struct spi_device *spi) ...@@ -418,7 +413,7 @@ static int ad9834_probe(struct spi_device *spi)
spi_set_drvdata(spi, indio_dev); spi_set_drvdata(spi, indio_dev);
st = iio_priv(indio_dev); st = iio_priv(indio_dev);
mutex_init(&st->lock); mutex_init(&st->lock);
st->mclk = pdata->mclk; st->mclk = 25000000;
st->spi = spi; st->spi = spi;
st->devid = spi_get_device_id(spi)->driver_data; st->devid = spi_get_device_id(spi)->driver_data;
st->reg = reg; st->reg = reg;
...@@ -454,11 +449,9 @@ static int ad9834_probe(struct spi_device *spi) ...@@ -454,11 +449,9 @@ static int ad9834_probe(struct spi_device *spi)
spi_message_add_tail(&st->freq_xfer[1], &st->freq_msg); spi_message_add_tail(&st->freq_xfer[1], &st->freq_msg);
st->control = AD9834_B28 | AD9834_RESET; st->control = AD9834_B28 | AD9834_RESET;
if (!pdata->en_div2)
st->control |= AD9834_DIV2; st->control |= AD9834_DIV2;
if (!pdata->en_signbit_msb_out && (st->devid == ID_AD9834)) if (st->devid == ID_AD9834)
st->control |= AD9834_SIGN_PIB; st->control |= AD9834_SIGN_PIB;
st->data = cpu_to_be16(AD9834_REG_CMD | st->control); st->data = cpu_to_be16(AD9834_REG_CMD | st->control);
...@@ -468,19 +461,19 @@ static int ad9834_probe(struct spi_device *spi) ...@@ -468,19 +461,19 @@ static int ad9834_probe(struct spi_device *spi)
goto error_disable_reg; goto error_disable_reg;
} }
ret = ad9834_write_frequency(st, AD9834_REG_FREQ0, pdata->freq0); ret = ad9834_write_frequency(st, AD9834_REG_FREQ0, 1000000);
if (ret) if (ret)
goto error_disable_reg; goto error_disable_reg;
ret = ad9834_write_frequency(st, AD9834_REG_FREQ1, pdata->freq1); ret = ad9834_write_frequency(st, AD9834_REG_FREQ1, 5000000);
if (ret) if (ret)
goto error_disable_reg; goto error_disable_reg;
ret = ad9834_write_phase(st, AD9834_REG_PHASE0, pdata->phase0); ret = ad9834_write_phase(st, AD9834_REG_PHASE0, 512);
if (ret) if (ret)
goto error_disable_reg; goto error_disable_reg;
ret = ad9834_write_phase(st, AD9834_REG_PHASE1, pdata->phase1); ret = ad9834_write_phase(st, AD9834_REG_PHASE1, 1024);
if (ret) if (ret)
goto error_disable_reg; goto error_disable_reg;
......
...@@ -8,32 +8,4 @@ ...@@ -8,32 +8,4 @@
#ifndef IIO_DDS_AD9834_H_ #ifndef IIO_DDS_AD9834_H_
#define IIO_DDS_AD9834_H_ #define IIO_DDS_AD9834_H_
/*
* TODO: struct ad7887_platform_data needs to go into include/linux/iio
*/
/**
* struct ad9834_platform_data - platform specific information
* @mclk: master clock in Hz
* @freq0: power up freq0 tuning word in Hz
* @freq1: power up freq1 tuning word in Hz
* @phase0: power up phase0 value [0..4095] correlates with 0..2PI
* @phase1: power up phase1 value [0..4095] correlates with 0..2PI
* @en_div2: digital output/2 is passed to the SIGN BIT OUT pin
* @en_signbit_msb_out: the MSB (or MSB/2) of the DAC data is connected to the
* SIGN BIT OUT pin. en_div2 controls whether it is the MSB
* or MSB/2 that is output. if en_signbit_msb_out=false,
* the on-board comparator is connected to SIGN BIT OUT
*/
struct ad9834_platform_data {
unsigned int mclk;
unsigned int freq0;
unsigned int freq1;
unsigned short phase0;
unsigned short phase1;
bool en_div2;
bool en_signbit_msb_out;
};
#endif /* IIO_DDS_AD9834_H_ */ #endif /* IIO_DDS_AD9834_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment