Chosen Solution

I have a Sony RX100M5. When I flip the display up in selfie mode, the image will not change to selfie mode. It stays inverted. When If I place a small magnet at a particular place on the housing, the image inverts as long as the magnet is there. Then it always stays inverted even when display is is brought to normal position.

I think what you can do is just revert the magnet under the screen. This happened to me when I dropped my RX100m3 but then I opened it again and flipped the magnet and it worked well.