Skip to content

Commit 6cd50d5

Browse files
mhennerichcommodo
authored andcommitted
iio: adc: ad9361: Add option to set Reg Gain Step Config2 0x106 [D6:D4]
This adds the option to set: [D6:D4]—Fast Attack Only. Decrement Step Size for: Small LPF Gain Change/Full Table Case If not set the value defaults to 2. Similar to PR #20 Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
1 parent c078b31 commit 6cd50d5

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

drivers/iio/adc/ad9361.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3254,8 +3254,9 @@ static int ad9361_gc_setup(struct ad9361_rf_phy *phy, struct gain_control *ctrl)
32543254
SMALL_ADC_OVERLOAD_EXED_COUNTER(ctrl->adc_small_overload_exceed_counter);
32553255
ad9361_spi_write(spi, REG_ADC_OVERLOAD_COUNTERS, reg);
32563256

3257-
ad9361_spi_writef(spi, REG_GAIN_STP_CONFIG_2, LARGE_LPF_GAIN_STEP(~0),
3258-
LARGE_LPF_GAIN_STEP(ctrl->adc_large_overload_inc_steps));
3257+
reg = DECREMENT_STP_SIZE_FOR_SMALL_LPF_GAIN_CHANGE(ctrl->f_agc_large_overload_inc_steps) |
3258+
LARGE_LPF_GAIN_STEP(ctrl->adc_large_overload_inc_steps);
3259+
ad9361_spi_write(spi, REG_GAIN_STP_CONFIG_2, reg);
32593260

32603261
reg = LARGE_LMT_OVERLOAD_EXED_COUNTER(ctrl->lmt_overload_large_exceed_counter) |
32613262
SMALL_LMT_OVERLOAD_EXED_COUNTER(ctrl->lmt_overload_small_exceed_counter);
@@ -8505,7 +8506,7 @@ static struct ad9361_phy_platform_data
85058506
ad9361_of_get_u32(iodev, np, "adi,agc-adc-large-overload-exceed-counter", 10,
85068507
&pdata->gain_ctrl.adc_large_overload_exceed_counter);
85078508
ad9361_of_get_u32(iodev, np, "adi,agc-adc-large-overload-inc-steps", 2,
8508-
&pdata->gain_ctrl.adc_large_overload_inc_steps);
8509+
&pdata->gain_ctrl.adc_large_overload_inc_steps); /* Name is misleading should be dec-steps */
85098510
ad9361_of_get_bool(iodev, np, "adi,agc-adc-lmt-small-overload-prevent-gain-inc-enable",
85108511
&pdata->gain_ctrl.adc_lmt_small_overload_prevent_gain_inc);
85118512
ad9361_of_get_u32(iodev, np, "adi,agc-lmt-overload-large-exceed-counter", 10,
@@ -8593,6 +8594,9 @@ static struct ad9361_phy_platform_data
85938594
ad9361_of_get_u32(iodev, np, "adi,fagc-power-measurement-duration-in-state5", 64,
85948595
&pdata->gain_ctrl.f_agc_power_measurement_duration_in_state5); /* 0x109, 0x10a RX samples 0..524288 */
85958596

8597+
ad9361_of_get_u32(iodev, np, "adi,fagc-adc-large-overload-inc-steps", 2, /* 0x106 [D6:D4] 0..7 */
8598+
&pdata->gain_ctrl.f_agc_large_overload_inc_steps); /* Name is misleading should be dec-steps */
8599+
85968600
/* RSSI Control */
85978601

85988602
ad9361_of_get_u32(iodev, np, "adi,rssi-restart-mode", 3,

drivers/iio/adc/ad9361.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2947,6 +2947,7 @@ struct gain_control {
29472947

29482948
enum f_agc_target_gain_index_type f_agc_rst_gla_if_en_agc_pulled_high_mode; /* 0x0FB, 0x111 */
29492949
u8 f_agc_power_measurement_duration_in_state5; /* 0x109, 0x10a RX samples 0..524288*/
2950+
u8 f_agc_large_overload_inc_steps; /* 0x106 [D6:D4] 0..7 */
29502951

29512952
};
29522953

0 commit comments

Comments
 (0)