ASCA has a story (in Italian) stating that the postulator of the cause of Pope John Paul II, Msgr. Slawomir Oder, says that in 1989, confirmed in 1994, the Pope had already signed a resignation letter in case he became incapacitated.
Apparently, the late Pope reflected deeply on the matter and did a close study of canon law as well as the theological implications with Joseph Card. Ratzinger.
In 1994, when the Pope was about to undergo surgery for his broken leg, he said to the surgeon Gianfranco Fineschi: "Doctor, both you and I have only one option. You have to cure me. I have to heal. Because there is no place in the Church for a Pope Emeritus."