diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/video/tegra/dc/dc.c | 25 | ||||
-rw-r--r-- | drivers/video/tegra/dc/dc_reg.h | 4 |
2 files changed, 29 insertions, 0 deletions
diff --git a/drivers/video/tegra/dc/dc.c b/drivers/video/tegra/dc/dc.c index f8159331877a..fe6150f6aabf 100644 --- a/drivers/video/tegra/dc/dc.c +++ b/drivers/video/tegra/dc/dc.c @@ -813,6 +813,31 @@ int tegra_dc_set_mode(struct tegra_dc *dc, const struct tegra_dc_mode *mode) } EXPORT_SYMBOL(tegra_dc_set_mode); +void +tegra_dc_config_pwm(struct tegra_dc *dc, struct tegra_dc_pwm_params *cfg) +{ + unsigned int ctrl; + + ctrl = ((cfg->period << PM_PERIOD_SHIFT) | + (cfg->clk_div << PM_CLK_DIVIDER_SHIFT) | + cfg->clk_select); + + switch (cfg->which_pwm) { + case TEGRA_PWM_PM0: + tegra_dc_writel(dc, ctrl, DC_COM_PM0_CONTROL); + tegra_dc_writel(dc, cfg->duty_cycle, DC_COM_PM0_DUTY_CYCLE); + break; + case TEGRA_PWM_PM1: + tegra_dc_writel(dc, ctrl, DC_COM_PM1_CONTROL); + tegra_dc_writel(dc, cfg->duty_cycle, DC_COM_PM1_DUTY_CYCLE); + break; + default: + dev_err(&dc->ndev->dev, "Error\n"); + return; + } +} +EXPORT_SYMBOL(tegra_dc_config_pwm); + static void tegra_dc_set_out_pin_polars(struct tegra_dc *dc, const struct tegra_dc_out_pin *pins, const unsigned int n_pins) diff --git a/drivers/video/tegra/dc/dc_reg.h b/drivers/video/tegra/dc/dc_reg.h index 240d8a48d03e..1bb2b00f6c71 100644 --- a/drivers/video/tegra/dc/dc_reg.h +++ b/drivers/video/tegra/dc/dc_reg.h @@ -145,6 +145,10 @@ #define DC_COM_PM0_DUTY_CYCLE 0x31d #define DC_COM_PM1_CONTROL 0x31e #define DC_COM_PM1_DUTY_CYCLE 0x31f + +#define PM_PERIOD_SHIFT 18 +#define PM_CLK_DIVIDER_SHIFT 4 + #define DC_COM_SPI_CONTROL 0x320 #define DC_COM_SPI_START_BYTE 0x321 #define DC_COM_HSPI_WRITE_DATA_AB 0x322 |