Skip to content

Commit 6cfc28c

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 <[email protected]>
1 parent d67f618 commit 6cfc28c

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
@@ -3256,8 +3256,9 @@ static int ad9361_gc_setup(struct ad9361_rf_phy *phy, struct gain_control *ctrl)
32563256
SMALL_ADC_OVERLOAD_EXED_COUNTER(ctrl->adc_small_overload_exceed_counter);
32573257
ad9361_spi_write(spi, REG_ADC_OVERLOAD_COUNTERS, reg);
32583258

3259-
ad9361_spi_writef(spi, REG_GAIN_STP_CONFIG_2, LARGE_LPF_GAIN_STEP(~0),
3260-
LARGE_LPF_GAIN_STEP(ctrl->adc_large_overload_inc_steps));
3259+
reg = DECREMENT_STP_SIZE_FOR_SMALL_LPF_GAIN_CHANGE(ctrl->f_agc_large_overload_inc_steps) |
3260+
LARGE_LPF_GAIN_STEP(ctrl->adc_large_overload_inc_steps);
3261+
ad9361_spi_write(spi, REG_GAIN_STP_CONFIG_2, reg);
32613262

32623263
reg = LARGE_LMT_OVERLOAD_EXED_COUNTER(ctrl->lmt_overload_large_exceed_counter) |
32633264
SMALL_LMT_OVERLOAD_EXED_COUNTER(ctrl->lmt_overload_small_exceed_counter);
@@ -8437,7 +8438,7 @@ static struct ad9361_phy_platform_data
84378438
ad9361_of_get_u32(iodev, np, "adi,agc-adc-large-overload-exceed-counter", 10,
84388439
&pdata->gain_ctrl.adc_large_overload_exceed_counter);
84398440
ad9361_of_get_u32(iodev, np, "adi,agc-adc-large-overload-inc-steps", 2,
8440-
&pdata->gain_ctrl.adc_large_overload_inc_steps);
8441+
&pdata->gain_ctrl.adc_large_overload_inc_steps); /* Name is misleading should be dec-steps */
84418442
ad9361_of_get_bool(iodev, np, "adi,agc-adc-lmt-small-overload-prevent-gain-inc-enable",
84428443
&pdata->gain_ctrl.adc_lmt_small_overload_prevent_gain_inc);
84438444
ad9361_of_get_u32(iodev, np, "adi,agc-lmt-overload-large-exceed-counter", 10,
@@ -8525,6 +8526,9 @@ static struct ad9361_phy_platform_data
85258526
ad9361_of_get_u32(iodev, np, "adi,fagc-power-measurement-duration-in-state5", 64,
85268527
&pdata->gain_ctrl.f_agc_power_measurement_duration_in_state5); /* 0x109, 0x10a RX samples 0..524288 */
85278528

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

85308534
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
@@ -2954,6 +2954,7 @@ struct gain_control {
29542954

29552955
enum f_agc_target_gain_index_type f_agc_rst_gla_if_en_agc_pulled_high_mode; /* 0x0FB, 0x111 */
29562956
u8 f_agc_power_measurement_duration_in_state5; /* 0x109, 0x10a RX samples 0..524288*/
2957+
u8 f_agc_large_overload_inc_steps; /* 0x106 [D6:D4] 0..7 */
29572958

29582959
};
29592960

0 commit comments

Comments
 (0)