Proximity sensor always 0 or 9cm. Could this be a hardware or software problem?
This depends on the device. There are devices that have more accurate sensors, which can display the distance in cm correctly, but some sensors only report the distance as "near" or "far". If your device only gives the two states, Android uses the sensor's maximum detectable distance as the "far" state (in this case, 9cm) and 0 as the "near" state (which translates to 0cm).

Source: Position Sensors | Android Developers