mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 11:26:02 +09:00
pwm: rockchip: Make pwm configure correctly for enable_conf
If some PWM enable_conf was configured with different values at uboot/loader, the enable_conf should be cleaned firstly and configured them at kernel. It is better to use the same parameters on both sides to ensure excessive smoothing. Change-Id: Ib1b7b55e9816639d9915543dadf059ce0e8be103 Signed-off-by: David Wu <david.wu@rock-chips.com>
This commit is contained in:
@@ -55,6 +55,7 @@ struct rockchip_pwm_data {
|
||||
bool supports_lock;
|
||||
bool vop_pwm;
|
||||
u32 enable_conf;
|
||||
u32 enable_conf_mask;
|
||||
};
|
||||
|
||||
static inline struct rockchip_pwm_chip *to_rockchip_pwm_chip(struct pwm_chip *c)
|
||||
@@ -183,6 +184,7 @@ static int rockchip_pwm_enable(struct pwm_chip *chip,
|
||||
}
|
||||
|
||||
val = readl_relaxed(pc->base + pc->data->regs.ctrl);
|
||||
val &= ~pc->data->enable_conf_mask;
|
||||
|
||||
if (enable)
|
||||
val |= enable_conf;
|
||||
@@ -259,6 +261,7 @@ static const struct rockchip_pwm_data pwm_data_v1 = {
|
||||
.supports_lock = false,
|
||||
.vop_pwm = false,
|
||||
.enable_conf = PWM_CTRL_OUTPUT_EN | PWM_CTRL_TIMER_EN,
|
||||
.enable_conf_mask = BIT(1) | BIT(3),
|
||||
};
|
||||
|
||||
static const struct rockchip_pwm_data pwm_data_v2 = {
|
||||
@@ -274,6 +277,7 @@ static const struct rockchip_pwm_data pwm_data_v2 = {
|
||||
.vop_pwm = false,
|
||||
.enable_conf = PWM_OUTPUT_LEFT | PWM_LP_DISABLE | PWM_ENABLE |
|
||||
PWM_CONTINUOUS,
|
||||
.enable_conf_mask = GENMASK(2, 0) | BIT(5) | BIT(8),
|
||||
};
|
||||
|
||||
static const struct rockchip_pwm_data pwm_data_vop = {
|
||||
@@ -289,6 +293,7 @@ static const struct rockchip_pwm_data pwm_data_vop = {
|
||||
.vop_pwm = true,
|
||||
.enable_conf = PWM_OUTPUT_LEFT | PWM_LP_DISABLE | PWM_ENABLE |
|
||||
PWM_CONTINUOUS,
|
||||
.enable_conf_mask = GENMASK(2, 0) | BIT(5) | BIT(8),
|
||||
};
|
||||
|
||||
static const struct rockchip_pwm_data pwm_data_v3 = {
|
||||
@@ -304,6 +309,7 @@ static const struct rockchip_pwm_data pwm_data_v3 = {
|
||||
.vop_pwm = false,
|
||||
.enable_conf = PWM_OUTPUT_LEFT | PWM_LP_DISABLE | PWM_ENABLE |
|
||||
PWM_CONTINUOUS,
|
||||
.enable_conf_mask = GENMASK(2, 0) | BIT(5) | BIT(8),
|
||||
};
|
||||
|
||||
static const struct of_device_id rockchip_pwm_dt_ids[] = {
|
||||
|
||||
Reference in New Issue
Block a user