Samsung Electronics posts 5.2% rise in Q2 profit