mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
pwm: rockchip: Add pwm output center aligned mdoe
Support pwm output aligned mode to switch from left-aligned to center-aligned. In dts, add "center-aligned". Signed-off-by: Steven Liu <steven.liu@rock-chips.com> Change-Id: I3e699c873a9ef533e59e11dbf9777001f205b4d9
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
#define PWM_INACTIVE_POSITIVE (1 << 4)
|
||||
#define PWM_POLARITY_MASK (PWM_DUTY_POSITIVE | PWM_INACTIVE_POSITIVE)
|
||||
#define PWM_OUTPUT_LEFT (0 << 5)
|
||||
#define PWM_OUTPUT_CENTER (1 << 5)
|
||||
#define PWM_LOCK_EN (1 << 6)
|
||||
#define PWM_LP_DISABLE (0 << 8)
|
||||
|
||||
@@ -42,6 +43,7 @@ struct rockchip_pwm_chip {
|
||||
const struct rockchip_pwm_data *data;
|
||||
void __iomem *base;
|
||||
bool vop_pwm_en; /* indicate voppwm mirror register state */
|
||||
bool center_aligned;
|
||||
};
|
||||
|
||||
struct rockchip_pwm_regs {
|
||||
@@ -189,6 +191,11 @@ 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 (PWM_OUTPUT_CENTER & pc->data->enable_conf_mask) {
|
||||
if (pc->center_aligned)
|
||||
val |= PWM_OUTPUT_CENTER;
|
||||
}
|
||||
|
||||
if (enable)
|
||||
val |= enable_conf;
|
||||
else
|
||||
@@ -410,6 +417,9 @@ static int rockchip_pwm_probe(struct platform_device *pdev)
|
||||
pc->chip.of_pwm_n_cells = 3;
|
||||
}
|
||||
|
||||
pc->center_aligned =
|
||||
device_property_read_bool(&pdev->dev, "center-aligned");
|
||||
|
||||
ret = pwmchip_add(&pc->chip);
|
||||
if (ret < 0) {
|
||||
clk_unprepare(pc->clk);
|
||||
|
||||
Reference in New Issue
Block a user