mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
drm: atmel-hlcdc: Support inverting the pixel clock polarity
On the SoC host controller, the pixel clock can be: * standard: data is launched on the rising edge * inverted: data is launched on the falling edge Some panels may need the inverted option to be used so let's support this DRM flag. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230609144843.851327-1-miquel.raynal@bootlin.com
This commit is contained in:
parent
2da20c92ce
commit
d01cb0457d
1 changed files with 25 additions and 0 deletions
|
@ -68,7 +68,11 @@ static void atmel_hlcdc_crtc_mode_set_nofb(struct drm_crtc *c)
|
||||||
struct atmel_hlcdc_crtc *crtc = drm_crtc_to_atmel_hlcdc_crtc(c);
|
struct atmel_hlcdc_crtc *crtc = drm_crtc_to_atmel_hlcdc_crtc(c);
|
||||||
struct regmap *regmap = crtc->dc->hlcdc->regmap;
|
struct regmap *regmap = crtc->dc->hlcdc->regmap;
|
||||||
struct drm_display_mode *adj = &c->state->adjusted_mode;
|
struct drm_display_mode *adj = &c->state->adjusted_mode;
|
||||||
|
struct drm_encoder *encoder = NULL, *en_iter;
|
||||||
|
struct drm_connector *connector = NULL;
|
||||||
struct atmel_hlcdc_crtc_state *state;
|
struct atmel_hlcdc_crtc_state *state;
|
||||||
|
struct drm_device *ddev = c->dev;
|
||||||
|
struct drm_connector_list_iter iter;
|
||||||
unsigned long mode_rate;
|
unsigned long mode_rate;
|
||||||
struct videomode vm;
|
struct videomode vm;
|
||||||
unsigned long prate;
|
unsigned long prate;
|
||||||
|
@ -76,6 +80,23 @@ static void atmel_hlcdc_crtc_mode_set_nofb(struct drm_crtc *c)
|
||||||
unsigned int cfg = 0;
|
unsigned int cfg = 0;
|
||||||
int div, ret;
|
int div, ret;
|
||||||
|
|
||||||
|
/* get encoder from crtc */
|
||||||
|
drm_for_each_encoder(en_iter, ddev) {
|
||||||
|
if (en_iter->crtc == c) {
|
||||||
|
encoder = en_iter;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (encoder) {
|
||||||
|
/* Get the connector from encoder */
|
||||||
|
drm_connector_list_iter_begin(ddev, &iter);
|
||||||
|
drm_for_each_connector_iter(connector, &iter)
|
||||||
|
if (connector->encoder == encoder)
|
||||||
|
break;
|
||||||
|
drm_connector_list_iter_end(&iter);
|
||||||
|
}
|
||||||
|
|
||||||
ret = clk_prepare_enable(crtc->dc->hlcdc->sys_clk);
|
ret = clk_prepare_enable(crtc->dc->hlcdc->sys_clk);
|
||||||
if (ret)
|
if (ret)
|
||||||
return;
|
return;
|
||||||
|
@ -134,6 +155,10 @@ static void atmel_hlcdc_crtc_mode_set_nofb(struct drm_crtc *c)
|
||||||
|
|
||||||
cfg |= ATMEL_HLCDC_CLKDIV(div);
|
cfg |= ATMEL_HLCDC_CLKDIV(div);
|
||||||
|
|
||||||
|
if (connector &&
|
||||||
|
connector->display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE)
|
||||||
|
cfg |= ATMEL_HLCDC_CLKPOL;
|
||||||
|
|
||||||
regmap_update_bits(regmap, ATMEL_HLCDC_CFG(0), mask, cfg);
|
regmap_update_bits(regmap, ATMEL_HLCDC_CFG(0), mask, cfg);
|
||||||
|
|
||||||
state = drm_crtc_state_to_atmel_hlcdc_crtc_state(c->state);
|
state = drm_crtc_state_to_atmel_hlcdc_crtc_state(c->state);
|
||||||
|
|
Loading…
Add table
Reference in a new issue