There are two main feedback gains.
The first and easily the most sensitive is the Integral gain. Increasing this value increases the amount of the input signal (from the photodiode) which is fed back into the output signal (the z piezo). The higher the values, the faster the AFM will react to changes in the topography in the sample. Thus, the higher you can have the integral gain, the better image quality can be achieved. The problem is that if the integral gain is set too high, feedback oscillations will result (see Figure 20a and b). The aim is to set them as high as possible while avoiding oscillations in the image.
The Proportional gain is not nearly as sensitive as the integral gain and a general rule is that once the integral gain is optimised then adjust the proportional gain to the same value.
It is difficult to give exact gain values since each AFM system will have different scaling factors for these parameters, but another general rule is that for relatively rough samples the gains should be higher than for smooth samples.