There's a lot to your question. Are you asking how to calculate the flow into the cylinder as a function of valve lift?
I don't believe your second expression is that useful. The power produced by the motor (it's not an "engine" because it doesn't run on heat) will be equal to the force on the piston times the piston speed (p*A*dx/dt), but not equal to the rate of energy coming in with the fluid. This is because some of the enthalpy of the incoming flow, through turbulence, will be converted to heat.
You'll need to calculate the mass-flow into the cylinder to get pressure as a function of crank angle theta, and calculate torque from T = p*A*dx/dtheta.