He who has done business in things that are prohibited in Islam, such as musical instruments, prohibited cassettes, cigarettes, etc. while knowing the ruling on them then wishes to repent, needs to give away in charity all the profits he made from them. This will be a means of purification and will not be counted as spending in the way of Allah, for Allah is pure and does not accept but the pure.
Further, if this money gets mixed up with other earnings, as in the case of a shop owner who sells many other items, then if he can compute the amount of profits made from them, he should do so in the hope of purifying the rest of his earnings.
In other words, he who has some money earned through unlawful means and intends to repent, should:
If he was an unbeliever at the time of earning the money, he is not obliged to atone for them or seek their purification. For the Prophet (peace and blessings of Allah be upon him) did not demand from his followers that they purify their wealth after coming into the fold of Islam. If he was a Muslim at the time of earning the money, well aware of its Islamic ban and prohibition, then he should separate it out at the time of repentance.
And Allah knows best.