Skip to content

Commit a94bd28

Browse files
committed
iio: trx-rf: ad9088: Add mcs_track_decimation debugfs entry and widen to u32
Add debugfs read/write support for mcs_track_decimation allowing runtime adjustment of the MCS tracking calibration TDC decimation rate. Change mcs_track_decimation from u16 to u32 to match the API. Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
1 parent ccab425 commit a94bd28

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

drivers/iio/trx-rf/ad9088/ad9088.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ struct ad9088_phy {
259259
bool cddc_sample_delay_en;
260260
bool fddc_sample_delay_en;
261261
u32 multidevice_instance_count;
262-
u16 mcs_track_decimation;
262+
u32 mcs_track_decimation;
263263

264264
struct ad9088_debugfs_entry debugfs_entry[32];
265265
u32 ad9088_debugfs_entry_index;
@@ -372,7 +372,7 @@ int ad9088_delta_t_measurement_set(struct ad9088_phy *phy, u32 mode);
372372
int ad9088_delta_t_measurement_get(struct ad9088_phy *phy, u32 mode, s64 *apollo_delta_t);
373373
int ad9088_mcs_init_cal_validate(struct ad9088_phy *phy,
374374
adi_apollo_mcs_cal_init_status_t *init_cal_status);
375-
int ad9088_mcs_tracking_cal_setup(struct ad9088_phy *phy, u16 mcs_track_decimation,
375+
int ad9088_mcs_tracking_cal_setup(struct ad9088_phy *phy, u32 mcs_track_decimation,
376376
u16 initialize_track_cal);
377377
int ad9088_mcs_init_cal_status_print(struct ad9088_phy *phy, char *buf,
378378
adi_apollo_mcs_cal_init_status_t *status);

drivers/iio/trx-rf/ad9088/ad9088_debugfs.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ enum ad9088_debugfs_cmd {
3737
DBGFS_MCS_TRACK_STATUS,
3838
DBGFS_MCS_INIT_CAL_STATUS,
3939
DBGFS_MCS_TRACK_CAL_VALIDATE,
40+
DBGFS_MCS_TRACK_DECIMATION,
4041
};
4142

4243
static const u8 lanes_all[] = {
@@ -352,6 +353,9 @@ static ssize_t ad9088_debugfs_read(struct file *file, char __user *userbuf,
352353
len = snprintf(phy->dbuf, sizeof(phy->dbuf), "%lld\n",
353354
entry->delta_t);
354355
break;
356+
case DBGFS_MCS_TRACK_DECIMATION:
357+
val = phy->mcs_track_decimation;
358+
break;
355359
case DBGFS_MCS_BG_TRACK_CAL_RUN:
356360
val = phy->mcs_cal_bg_tracking_run;
357361
break;
@@ -689,6 +693,11 @@ static ssize_t ad9088_debugfs_write(struct file *file,
689693
if (val)
690694
ret = ad9088_mcs_tracking_cal_setup(phy, phy->mcs_track_decimation, 1);
691695
break;
696+
case DBGFS_MCS_TRACK_DECIMATION:
697+
phy->mcs_track_decimation = val;
698+
ret = adi_apollo_mcs_cal_tracking_decimation_set(&phy->ad9088, phy->mcs_track_decimation);
699+
ret = ad9088_check_apollo_error(&phy->spi->dev, ret, "adi_apollo_mcs_cal_tracking_decimation_set");
700+
break;
692701
case DBGFS_MCS_FG_TRACK_CAL_RUN:
693702
if (val) {
694703
ret = adi_apollo_mcs_cal_fg_tracking_run(&phy->ad9088);
@@ -833,6 +842,8 @@ void ad9088_debugfs_register(struct iio_dev *indio_dev)
833842
"mcs_init_cal_status", DBGFS_MCS_INIT_CAL_STATUS);
834843
ad9088_add_debugfs_entry(phy, indio_dev,
835844
"mcs_track_cal_validate", DBGFS_MCS_TRACK_CAL_VALIDATE);
845+
ad9088_add_debugfs_entry(phy, indio_dev,
846+
"mcs_track_decimation", DBGFS_MCS_TRACK_DECIMATION);
836847

837848
for (i = 0; i < phy->ad9088_debugfs_entry_index; i++)
838849
debugfs_create_file(phy->debugfs_entry[i].propname, 0644,

drivers/iio/trx-rf/ad9088/ad9088_dt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ int ad9088_parse_dt(struct ad9088_phy *phy)
180180
* periodic SYSREF, keep below 32768. Default: 1023.
181181
*/
182182
phy->mcs_track_decimation = 1023;
183-
of_property_read_u16(node, "adi,mcs-track-decimation", &phy->mcs_track_decimation);
183+
of_property_read_u32(node, "adi,mcs-track-decimation", &phy->mcs_track_decimation);
184184

185185
phy->trig_sync_en = of_property_read_bool(node, "adi,trigger-sync-en");
186186

drivers/iio/trx-rf/ad9088/ad9088_mcs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ int ad9088_mcs_init_cal_validate(struct ad9088_phy *phy,
264264
return ret;
265265
}
266266

267-
int ad9088_mcs_tracking_cal_setup(struct ad9088_phy *phy, u16 mcs_track_decimation,
267+
int ad9088_mcs_tracking_cal_setup(struct ad9088_phy *phy, u32 mcs_track_decimation,
268268
u16 initialize_track_cal)
269269
{
270270
adi_apollo_device_t *device = &phy->ad9088;

0 commit comments

Comments
 (0)