Is that all of your code?
For example, you define the 'pwm_duty' function to set the "on" clock count but it is not called anywhere.
Also, why do you pass a parameter to the 'pwm_freq' and 'pwm_duty' functions but then ignore it and use a constant.
The way you have the device set up, it would appear that you are setting the oscillator to be 4MHZ and the timer to have pre- and post-scalar settings of 1:1. With a PR2 value of 100, that means the clock will reset every 25uSec and so the PWM will have a base frequency of 40KHz. However, you have set the combined CCPR2L:CCP2CON<5,4> value to 400 (remember that the bottom 2 bits of the PWM width value are in the CCPxCON regisater but they must be taken into account when you calculate the value you need).
As the PWM will start high but drop low after the (in your case) 400 ticks from Timer2, you have a problem as the timer will actually restart the PWM cycle in 100 ticks (check Figure 11-4 for details of this).
If you are getting 4.2KHz then you need to go back to doign some more fundamental checks that the oscillator is begin correctly configured to give the frequency you expect, then that the timer is counting in thew way you expect and finally you can correctly configure the PWM peripheral.
Susan