@@ -47,6 +47,7 @@ enum adrv9025_iio_dev_attr {
4747 ADRV9025_CAL_MASK ,
4848 ADRV9025_DPD_TX_MASK ,
4949 ADRV9025_DPD_RESET ,
50+ ADRV9025_DPD_CONFIG_SET ,
5051 adrv9025_JESD204_FSM_ERROR ,
5152 adrv9025_JESD204_FSM_PAUSED ,
5253 adrv9025_JESD204_FSM_STATE ,
@@ -396,6 +397,20 @@ static ssize_t adrv9025_phy_store(struct device *dev,
396397 ret = adrv9025_dev_err (phy );
397398 }
398399 break ;
400+ case ADRV9025_DPD_CONFIG_SET :
401+ ret = kstrtobool (buf , & enable );
402+ if (ret )
403+ break ;
404+
405+ phy -> dpdTrackingConfig -> txChannelMask = phy -> dpdTxChannel ;
406+
407+ if (enable ) {
408+ ret = adi_adrv9025_DpdTrackingConfigSet (phy -> madDevice ,
409+ phy -> dpdTrackingConfig );
410+ if (ret )
411+ ret = adrv9025_dev_err (phy );
412+ }
413+ break ;
399414 case adrv9025_JESD204_FSM_RESUME :
400415 if (!phy -> jdev ) {
401416 ret = - ENOTSUPP ;
@@ -587,6 +602,9 @@ static IIO_DEVICE_ATTR(dpd_tx_mask, 0644, adrv9025_phy_show,
587602static IIO_DEVICE_ATTR (dpd_reset , 0200 , NULL,
588603 adrv9025_phy_store , ADRV9025_DPD_RESET ) ;
589604
605+ static IIO_DEVICE_ATTR (dpd_tracking_config_set , 0200 , NULL,
606+ adrv9025_phy_store , ADRV9025_DPD_CONFIG_SET ) ;
607+
590608static IIO_DEVICE_ATTR (jesd204_fsm_error , 0444 ,
591609 adrv9025_phy_show ,
592610 NULL,
@@ -622,6 +640,7 @@ static struct attribute *adrv9025_phy_attributes[] = {
622640 & iio_dev_attr_calibrate_mask .dev_attr .attr ,
623641 & iio_dev_attr_dpd_tx_mask .dev_attr .attr ,
624642 & iio_dev_attr_dpd_reset .dev_attr .attr ,
643+ & iio_dev_attr_dpd_tracking_config_set .dev_attr .attr ,
625644 & iio_dev_attr_jesd204_fsm_error .dev_attr .attr ,
626645 & iio_dev_attr_jesd204_fsm_state .dev_attr .attr ,
627646 & iio_dev_attr_jesd204_fsm_paused .dev_attr .attr ,
@@ -3011,6 +3030,72 @@ static int adrv9025_phy_parse_agc_dt(struct iio_dev *iodev, struct device *dev)
30113030 & phy -> agcConfig -> agcSlowloopFastGainChangeBlockEnable , 0 , 0 , 1 );
30123031}
30133032
3033+ static int adrv9025_phy_parse_dpd_config_dt (struct iio_dev * iodev , struct device * dev )
3034+ {
3035+ struct adrv9025_rf_phy * phy = iio_priv (iodev );
3036+ struct device_node * np = dev -> of_node ;
3037+ int ret ;
3038+
3039+ ret = ADRV9025_OF_PROP ("adi,dpd-indirect-regularization-value" ,
3040+ & phy -> dpdTrackingConfig -> dpdIndirectRegularizationValue , 20 , 0 , 63 );
3041+ if (ret )
3042+ return ret ;
3043+
3044+ ret = ADRV9025_OF_PROP ("adi,dpd-direct-regularization-value" ,
3045+ & phy -> dpdTrackingConfig -> dpdDirectRegularizationValue , 35 , 0 , 63 );
3046+ if (ret )
3047+ return ret ;
3048+
3049+ ret = ADRV9025_OF_PROP ("adi,dpd-samples" ,
3050+ & phy -> dpdTrackingConfig -> dpdSamples , 16384 , 4096 , 61440 );
3051+ if (ret )
3052+ return ret ;
3053+
3054+ ret = ADRV9025_OF_PROP ("adi,dpd-m-threshold" ,
3055+ & phy -> dpdTrackingConfig -> dpdMThreshold , 2920 , 0 , 32767 );
3056+ if (ret )
3057+ return ret ;
3058+
3059+ ret = ADRV9025_OF_PROP ("adi,dpd-peak-search-window-size" ,
3060+ & phy -> dpdTrackingConfig -> dpdPeakSearchWindowSize , 65535 , 0 , 16777215 );
3061+ if (ret )
3062+ return ret ;
3063+
3064+ ret = ADRV9025_OF_PROP ("adi,dpd-update-mode" ,
3065+ & phy -> dpdTrackingConfig -> dpdUpdateMode , 0 , 0 , 2 );
3066+ if (ret )
3067+ return ret ;
3068+
3069+ ret = ADRV9025_OF_PROP ("adi,dpd-min-avg-signal-level" ,
3070+ & phy -> dpdTrackingConfig -> minAvgSignalLevel , 519 , 0 , 65535 );
3071+ if (ret )
3072+ return ret ;
3073+
3074+ ret = ADRV9025_OF_PROP ("adi,dpd-mu" ,
3075+ & phy -> dpdTrackingConfig -> dpdMu , 50 , 0 , 100 );
3076+ if (ret )
3077+ return ret ;
3078+
3079+ ret = ADRV9025_OF_PROP ("adi,dpd-min-avg-signal-level-orx" ,
3080+ & phy -> dpdTrackingConfig -> minAvgSignalLevelOrx , 519 , 0 , 65535 );
3081+ if (ret )
3082+ return ret ;
3083+
3084+ ret = ADRV9025_OF_PROP ("adi,dpd-filter-sel" ,
3085+ & phy -> dpdTrackingConfig -> dpdFilterSel , 0 , 0 , 1 );
3086+ if (ret )
3087+ return ret ;
3088+
3089+ ret = ADRV9025_OF_PROP ("adi,dpd-enable-direct-learning" ,
3090+ & phy -> dpdTrackingConfig -> enableDirectLearning , 0 , 0 , 1 );
3091+ if (ret )
3092+ return ret ;
3093+
3094+ return ADRV9025_OF_PROP ("adi,dpd-indirect-regularization-low-power-value" ,
3095+ & phy -> dpdTrackingConfig -> dpdIndirectRegularizationLowPowerValue ,
3096+ 20 , 0 , 63 );
3097+ }
3098+
30143099static int adrv9025_parse_dpd_coef (struct adrv9025_rf_phy * phy , char * data , u32 size )
30153100{
30163101 u8 dpdNumFeatures = 0 , i , j , k , lut ;
@@ -3181,12 +3266,19 @@ static int adrv9025_probe(struct spi_device *spi)
31813266 phy -> dpdModelConfig = kzalloc (sizeof (adi_adrv9025_DpdModelConfig_v2_t ), GFP_KERNEL );
31823267 if (!(phy -> dpdModelConfig ))
31833268 return - ENOMEM ;
3269+ phy -> dpdTrackingConfig = kzalloc (sizeof (adi_adrv9025_DpdTrackingConfig_t ), GFP_KERNEL );
3270+ if (!(phy -> dpdTrackingConfig ))
3271+ return - ENOMEM ;
31843272 mutex_init (& phy -> lock );
31853273
31863274 ret = adrv9025_phy_parse_agc_dt (indio_dev , & spi -> dev );
31873275 if (ret )
31883276 return ret ;
31893277
3278+ ret = adrv9025_phy_parse_dpd_config_dt (indio_dev , & spi -> dev );
3279+ if (ret )
3280+ return ret ;
3281+
31903282 priv = jesd204_dev_priv (jdev );
31913283 priv -> phy = phy ;
31923284
0 commit comments