@@ -1193,7 +1193,7 @@ static const u32 rx_track_calls[] = {
11931193};
11941194
11951195static int adrv9002_phy_rx_do_write (const struct adrv9002_rf_phy * phy , struct adrv9002_rx_chan * rx ,
1196- uintptr_t private , const char * buf )
1196+ adi_common_Port_e port , uintptr_t private , const char * buf )
11971197{
11981198 struct adi_adrv9001_RxSettings * rx_settings = & phy -> curr_profile -> rx ;
11991199 struct adi_adrv9001_RxChannelCfg * rx_cfg = & rx_settings -> rxChannelCfg [rx -> channel .idx ];
@@ -1253,7 +1253,7 @@ static int adrv9002_phy_rx_do_write(const struct adrv9002_rf_phy *phy, struct ad
12531253 return adrv9002_channel_to_state (phy , & rx -> channel , rx -> channel .cached_state ,
12541254 false);
12551255 case RX_BBDC :
1256- if (!rx -> orx_en && rx -> channel . port == ADI_ORX )
1256+ if (!rx -> orx_en && port == ADI_ORX )
12571257 return - ENODEV ;
12581258
12591259 ret = kstrtobool (buf , & enable );
@@ -1264,7 +1264,7 @@ static int adrv9002_phy_rx_do_write(const struct adrv9002_rf_phy *phy, struct ad
12641264 * value to 0. The difference with the tracking cal is that disabling it, just
12651265 * disables the algorithm but the last used correction value is still applied...
12661266 */
1267- return api_call (phy , adi_adrv9001_bbdc_RejectionEnable_Set , rx -> channel . port ,
1267+ return api_call (phy , adi_adrv9001_bbdc_RejectionEnable_Set , port ,
12681268 rx -> channel .number , enable );
12691269 case RX_BBDC_LOOP_GAIN :
12701270 ret = kstrtou32 (buf , 10 , & val );
@@ -1284,15 +1284,15 @@ static ssize_t adrv9002_phy_rx_write(struct iio_dev *indio_dev,
12841284{
12851285 struct adrv9002_rf_phy * phy = iio_priv (indio_dev );
12861286 const int channel = ADRV_ADDRESS_CHAN (chan -> address );
1287- const int port = ADRV_ADDRESS_PORT (chan -> address );
1287+ const adi_common_Port_e port = ADRV_ADDRESS_PORT (chan -> address );
12881288 struct adrv9002_rx_chan * rx = & phy -> rx_channels [channel ];
12891289 int ret = - ENODEV ;
12901290
12911291 mutex_lock (& phy -> lock );
12921292 if (!rx -> channel .enabled && port == ADI_RX )
12931293 goto out_unlock ;
12941294
1295- ret = adrv9002_phy_rx_do_write (phy , rx , private , buf );
1295+ ret = adrv9002_phy_rx_do_write (phy , rx , port , private , buf );
12961296
12971297out_unlock :
12981298 mutex_unlock (& phy -> lock );
@@ -1341,7 +1341,8 @@ static int adrv9002_intf_gain_avail(const struct adrv9002_rf_phy *phy,
13411341}
13421342
13431343static int adrv9002_phy_rx_do_read (const struct adrv9002_rf_phy * phy ,
1344- const struct adrv9002_rx_chan * rx , uintptr_t private , char * buf )
1344+ const struct adrv9002_rx_chan * rx , adi_common_Port_e port ,
1345+ uintptr_t private , char * buf )
13451346{
13461347 struct adi_adrv9001_RxSettings * rx_settings = & phy -> curr_profile -> rx ;
13471348 struct adi_adrv9001_RxChannelCfg * rx_cfg = & rx_settings -> rxChannelCfg [rx -> channel .idx ];
@@ -1400,11 +1401,11 @@ static int adrv9002_phy_rx_do_read(const struct adrv9002_rf_phy *phy,
14001401
14011402 return sysfs_emit (buf , "%d\n" , enable );
14021403 case RX_BBDC :
1403- if (!rx -> orx_en && rx -> channel . port == ADI_ORX )
1404+ if (!rx -> orx_en && port == ADI_ORX )
14041405 return - ENODEV ;
14051406
1406- ret = api_call (phy , adi_adrv9001_bbdc_RejectionEnable_Get ,
1407- rx -> channel .port , rx -> channel . number , & bbdc );
1407+ ret = api_call (phy , adi_adrv9001_bbdc_RejectionEnable_Get , port ,
1408+ rx -> channel .number , & bbdc );
14081409 if (ret )
14091410 return ret ;
14101411
@@ -1429,7 +1430,7 @@ static ssize_t adrv9002_phy_rx_read(struct iio_dev *indio_dev,
14291430{
14301431 struct adrv9002_rf_phy * phy = iio_priv (indio_dev );
14311432 const int channel = ADRV_ADDRESS_CHAN (chan -> address );
1432- const int port = ADRV_ADDRESS_PORT (chan -> address );
1433+ const adi_common_Port_e port = ADRV_ADDRESS_PORT (chan -> address );
14331434 struct adrv9002_rx_chan * rx = & phy -> rx_channels [channel ];
14341435 int ret = - ENODEV ;
14351436
@@ -1441,7 +1442,7 @@ static ssize_t adrv9002_phy_rx_read(struct iio_dev *indio_dev,
14411442 if (!rx -> channel .enabled && port == ADI_RX && private != RX_INTERFACE_GAIN_AVAIL )
14421443 goto out_unlock ;
14431444
1444- ret = adrv9002_phy_rx_do_read (phy , rx , private , buf );
1445+ ret = adrv9002_phy_rx_do_read (phy , rx , port , private , buf );
14451446
14461447out_unlock :
14471448 mutex_unlock (& phy -> lock );
@@ -1898,12 +1899,13 @@ static int adrv9002_phy_read_raw_no_rf_chan(const struct adrv9002_rf_phy *phy,
18981899}
18991900
19001901static int adrv9002_hardware_gain_get (const struct adrv9002_rf_phy * phy ,
1901- const struct adrv9002_chan * c , int * val , int * val2 )
1902+ const struct adrv9002_chan * c , adi_common_Port_e port ,
1903+ int * val , int * val2 )
19021904{
19031905 int temp , ret ;
19041906 u8 index ;
19051907
1906- if (c -> port == ADI_TX ) {
1908+ if (port == ADI_TX ) {
19071909 u16 atten_mdb ;
19081910
19091911 ret = api_call (phy , adi_adrv9001_Tx_Attenuation_Get , c -> number , & atten_mdb );
@@ -1918,32 +1920,32 @@ static int adrv9002_hardware_gain_get(const struct adrv9002_rf_phy *phy,
19181920 return IIO_VAL_INT_PLUS_MICRO_DB ;
19191921 }
19201922
1921- if (c -> port == ADI_ORX )
1923+ if (port == ADI_ORX )
19221924 ret = api_call (phy , adi_adrv9001_ORx_Gain_Get , c -> number , & index );
19231925 else
19241926 ret = api_call (phy , adi_adrv9001_Rx_Gain_Get , c -> number , & index );
19251927 if (ret )
19261928 return ret ;
19271929
1928- temp = adrv9002_gainidx_to_gain (index , c -> port );
1930+ temp = adrv9002_gainidx_to_gain (index , port );
19291931 * val = temp / 1000 ;
19301932 * val2 = temp % 1000 * 1000 ;
19311933
19321934 return IIO_VAL_INT_PLUS_MICRO_DB ;
19331935}
19341936
19351937static int adrv9002_phy_read_raw_rf_chan (const struct adrv9002_rf_phy * phy ,
1936- const struct adrv9002_chan * chann , int * val ,
1937- int * val2 , long m )
1938+ const struct adrv9002_chan * chann , adi_common_Port_e port ,
1939+ int * val , int * val2 , long m )
19381940{
19391941 switch (m ) {
19401942 case IIO_CHAN_INFO_HARDWAREGAIN :
1941- return adrv9002_hardware_gain_get (phy , chann , val , val2 );
1943+ return adrv9002_hardware_gain_get (phy , chann , port , val , val2 );
19421944 case IIO_CHAN_INFO_SAMP_FREQ :
19431945 * val = clk_get_rate (chann -> clk );
19441946 return IIO_VAL_INT ;
19451947 case IIO_CHAN_INFO_ENABLE :
1946- if (chann -> port == ADI_ORX ) {
1948+ if (port == ADI_ORX ) {
19471949 struct adrv9002_rx_chan * rx = chan_to_rx (chann );
19481950
19491951 if (!rx -> orx_gpio )
@@ -1986,7 +1988,7 @@ static int adrv9002_phy_read_raw(struct iio_dev *indio_dev,
19861988 goto out_unlock ;
19871989 }
19881990
1989- ret = adrv9002_phy_read_raw_rf_chan (phy , chann , val , val2 , m );
1991+ ret = adrv9002_phy_read_raw_rf_chan (phy , chann , port , val , val2 , m );
19901992
19911993out_unlock :
19921994 mutex_unlock (& phy -> lock );
@@ -2052,13 +2054,14 @@ static bool adrv9002_orx_can_enable(const struct adrv9002_rf_phy *phy,
20522054}
20532055
20542056static int adrv9002_hardware_gain_set (const struct adrv9002_rf_phy * phy ,
2055- const struct adrv9002_chan * c , int val , int val2 )
2057+ const struct adrv9002_chan * c , adi_common_Port_e port ,
2058+ int val , int val2 )
20562059{
20572060 int gain ;
20582061 u32 code ;
20592062 u8 idx ;
20602063
2061- if (c -> port == ADI_TX ) {
2064+ if (port == ADI_TX ) {
20622065 if (val > 0 || (val == 0 && val2 > 0 ))
20632066 return - EINVAL ;
20642067
@@ -2067,22 +2070,23 @@ static int adrv9002_hardware_gain_set(const struct adrv9002_rf_phy *phy,
20672070 }
20682071
20692072 gain = val * 1000 + val2 / 1000 ;
2070- idx = adrv9002_gain_to_gainidx (gain , c -> port );
2073+ idx = adrv9002_gain_to_gainidx (gain , port );
20712074
2072- if (c -> port == ADI_RX )
2075+ if (port == ADI_RX )
20732076 return api_call (phy , adi_adrv9001_Rx_Gain_Set , c -> number , idx );
20742077
20752078 return api_call (phy , adi_adrv9001_ORx_Gain_Set , c -> number , idx );
20762079}
20772080
20782081static int adrv9002_phy_write_raw_rf_chan (const struct adrv9002_rf_phy * phy ,
2079- struct adrv9002_chan * chann , int val , int val2 , long mask )
2082+ struct adrv9002_chan * chann , adi_common_Port_e port ,
2083+ int val , int val2 , long mask )
20802084{
20812085 switch (mask ) {
20822086 case IIO_CHAN_INFO_HARDWAREGAIN :
2083- return adrv9002_hardware_gain_set (phy , chann , val , val2 );
2087+ return adrv9002_hardware_gain_set (phy , chann , port , val , val2 );
20842088 case IIO_CHAN_INFO_ENABLE :
2085- if (chann -> port == ADI_ORX ) {
2089+ if (port == ADI_ORX ) {
20862090 struct adrv9002_rx_chan * rx = chan_to_rx (chann );
20872091
20882092 if (!rx -> orx_gpio )
@@ -2127,7 +2131,7 @@ static int adrv9002_phy_write_raw(struct iio_dev *indio_dev,
21272131 goto out_unlock ;
21282132 }
21292133
2130- ret = adrv9002_phy_write_raw_rf_chan (phy , chann , val , val2 , mask );
2134+ ret = adrv9002_phy_write_raw_rf_chan (phy , chann , port , val , val2 , mask );
21312135
21322136out_unlock :
21332137 mutex_unlock (& phy -> lock );
0 commit comments