According to the relevant regulations of China, every citizen can bring up to $5,000 worth of foreign currency cash every year. If you plan to bring Hong Kong dollars back to the mainland from Hong Kong, you can bring up to 20,000 RMB or 5,000 US dollars (about 39,000 Hong Kong dollars).
If the amount of Hong Kong dollars you carry exceeds this limit, you need to declare it to the SAFE in advance.