Yep, just define 3 different pwm_ops (one for each IP), each of them
implementing ->apply() and ->get_state() and that's all.
Something like:
static const struct pwm_ops rockchip_pwm_ops_v1 = {
.get_state = rockchip_pwm_v1_get_state,
.apply = rockchip_pwm_v1_apply,
.owner = THIS_MODULE,
};
static const struct pwm_ops rockchip_pwm_ops_v2 = {
.get_state = rockchip_pwm_v2_get_state,
.apply = rockchip_pwm_v2_apply,
.owner = THIS_MODULE,
};
static const struct pwm_ops rockchip_pwm_ops_vop = {
.get_state = rockchip_pwm_vop_get_state,
.apply = rockchip_pwm_vop_apply,
.owner = THIS_MODULE,
};
static const struct of_device_id rockchip_pwm_dt_ids[] = {
{ .compatible = "rockchip,rk2928-pwm", .data = &rockchip_pwm_ops_v1 },
{ .compatible = "rockchip,rk3288-pwm", .data = &rockchip_pwm_ops_v2 },
{ .compatible = "rockchip,vop-pwm", .data = &rockchip_pwm_ops_vop },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, rockchip_pwm_dt_ids);