This is more or less the same as Ian Lepore did in commit ef558a107824372e4bb70ef57cff4406a8f7fedd for am335x_ehrpwm.c ofcourse the ecap/apwm is alot more simple than in the case of ehrpwm.
Added pwmbus_channel_set/get_flags to implement inverted polarity.