We present an abundance analysis based on high-resolution spectra of red-giant-branch (RGB) stars in the Galactic globular clusters NGC 6121 (M4) and NGC 6656 (M22). Our aim was to study their stellar population in the context of the multipopulation phenomenon recently discovered to affect some globular clusters. Analysis was performed for the following elements: O, Na, Mg, Al, Ca, Fe, Y, and Ba. Spectroscopic data were completed by high-precision wide-field U BV IC ground-based photometry and HST/ACS observations. For M4, we find a well-defined Na–O anticorrelation composed of two distinct groups of stars with significantly different Na and O content. The two groups of Na-rich and Na-poor stars populate two different regions along the RGB. As regards M22, Na and O follow the well-known anticorrelation found in many other GCs. However, at odds with M4, it appears to be continuous without any hint of clumpiness. On the other hand, we identified two clearly separated groups of stars with significantly different abundances of the s-process elements Y, Zr and Ba. The relative numbers of the members of both groups are very similar to the ratio of the stars in the two subgiant branches of M22 recently found by Piotto (2009). The s-element-rich stars are also richer in iron and have higher Ca abundances. This makes M22 the second cluster after ω Centauri where an intrinsic spread in Fe was found. Both spectroscopic and photometric results imply the presence of two stellar populations in M4 and M22, even if both clusters have completely different characteristics.