RIS configuration, beamformer design, and power control in single-cell and multi-cell wireless networks