Skip to content

Commit 6a6ab0c

Browse files
Laurent Pinchartgeertu
authored andcommitted
drm: renesas: shmobile: Use struct videomode in platform data
Replace the drm_mode_modeinfo field with videomode that includes more signal polarity flags. This simplifies driver handling of panel modes and prepares for DT support. Signed-off-by: Laurent Pinchart <[email protected]> [geert: Simplify] Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Geert Uytterhoeven <[email protected]> Link: https://lore.kernel.org/r/4312e56de424d94399c6105e7159317eae86c9d5.1694767209.git.geert+renesas@glider.be
1 parent c2e938e commit 6a6ab0c

File tree

4 files changed

+20
-30
lines changed

4 files changed

+20
-30
lines changed

drivers/gpu/drm/renesas/shmobile/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ config DRM_SHMOBILE
66
select BACKLIGHT_CLASS_DEVICE
77
select DRM_KMS_HELPER
88
select DRM_GEM_DMA_HELPER
9+
select VIDEOMODE_HELPERS
910
help
1011
Choose this option if you have an SH Mobile chipset.
1112
If M is selected the module will be called shmob-drm.

drivers/gpu/drm/renesas/shmobile/shmob_drm_crtc.c

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
#include <drm/drm_simple_kms_helper.h>
2424
#include <drm/drm_vblank.h>
2525

26+
#include <video/videomode.h>
27+
2628
#include "shmob_drm_crtc.h"
2729
#include "shmob_drm_drv.h"
2830
#include "shmob_drm_kms.h"
@@ -41,18 +43,16 @@ static void shmob_drm_crtc_setup_geometry(struct shmob_drm_crtc *scrtc)
4143
{
4244
struct drm_crtc *crtc = &scrtc->crtc;
4345
struct shmob_drm_device *sdev = to_shmob_device(crtc->dev);
44-
const struct shmob_drm_interface_data *idata = &sdev->pdata->iface;
46+
enum display_flags dpy_flags = sdev->connector.mode->flags;
4547
const struct drm_display_mode *mode = &crtc->mode;
4648
u32 value;
4749

4850
value = sdev->ldmt1r
4951
| ((mode->flags & DRM_MODE_FLAG_PVSYNC) ? 0 : LDMT1R_VPOL)
5052
| ((mode->flags & DRM_MODE_FLAG_PHSYNC) ? 0 : LDMT1R_HPOL)
51-
| ((idata->flags & SHMOB_DRM_IFACE_FL_DWPOL) ? LDMT1R_DWPOL : 0)
52-
| ((idata->flags & SHMOB_DRM_IFACE_FL_DIPOL) ? LDMT1R_DIPOL : 0)
53-
| ((idata->flags & SHMOB_DRM_IFACE_FL_DAPOL) ? LDMT1R_DAPOL : 0)
54-
| ((idata->flags & SHMOB_DRM_IFACE_FL_HSCNT) ? LDMT1R_HSCNT : 0)
55-
| ((idata->flags & SHMOB_DRM_IFACE_FL_DWCNT) ? LDMT1R_DWCNT : 0);
53+
| ((dpy_flags & DISPLAY_FLAGS_PIXDATA_POSEDGE) ? LDMT1R_DWPOL : 0)
54+
| ((dpy_flags & DISPLAY_FLAGS_DE_LOW) ? LDMT1R_DIPOL : 0);
55+
5656
lcdc_write(sdev, LDMT1R, value);
5757

5858
value = ((mode->hdisplay / 8) << 16) /* HDCN */
@@ -548,26 +548,17 @@ static inline struct shmob_drm_connector *to_shmob_connector(struct drm_connecto
548548

549549
static int shmob_drm_connector_get_modes(struct drm_connector *connector)
550550
{
551-
struct shmob_drm_device *sdev = to_shmob_device(connector->dev);
551+
struct shmob_drm_connector *scon = to_shmob_connector(connector);
552552
struct drm_display_mode *mode;
553553

554554
mode = drm_mode_create(connector->dev);
555555
if (mode == NULL)
556556
return 0;
557557

558558
mode->type = DRM_MODE_TYPE_PREFERRED | DRM_MODE_TYPE_DRIVER;
559-
mode->clock = sdev->pdata->panel.mode.clock;
560-
mode->hdisplay = sdev->pdata->panel.mode.hdisplay;
561-
mode->hsync_start = sdev->pdata->panel.mode.hsync_start;
562-
mode->hsync_end = sdev->pdata->panel.mode.hsync_end;
563-
mode->htotal = sdev->pdata->panel.mode.htotal;
564-
mode->vdisplay = sdev->pdata->panel.mode.vdisplay;
565-
mode->vsync_start = sdev->pdata->panel.mode.vsync_start;
566-
mode->vsync_end = sdev->pdata->panel.mode.vsync_end;
567-
mode->vtotal = sdev->pdata->panel.mode.vtotal;
568-
mode->flags = sdev->pdata->panel.mode.flags;
569-
570-
drm_mode_set_name(mode);
559+
560+
drm_display_mode_from_videomode(scon->mode, mode);
561+
571562
drm_mode_probed_add(connector, mode);
572563

573564
return 1;
@@ -601,10 +592,12 @@ static const struct drm_connector_funcs connector_funcs = {
601592
int shmob_drm_connector_create(struct shmob_drm_device *sdev,
602593
struct drm_encoder *encoder)
603594
{
604-
struct drm_connector *connector = &sdev->connector.connector;
595+
struct shmob_drm_connector *scon = &sdev->connector;
596+
struct drm_connector *connector = &scon->connector;
605597
int ret;
606598

607-
sdev->connector.encoder = encoder;
599+
scon->encoder = encoder;
600+
scon->mode = &sdev->pdata->panel.mode;
608601

609602
connector->display_info.width_mm = sdev->pdata->panel.width_mm;
610603
connector->display_info.height_mm = sdev->pdata->panel.height_mm;

drivers/gpu/drm/renesas/shmobile/shmob_drm_crtc.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
#include <drm/drm_connector.h>
1515
#include <drm/drm_encoder.h>
1616

17+
#include <video/videomode.h>
18+
1719
struct drm_pending_vblank_event;
1820
struct shmob_drm_device;
1921
struct shmob_drm_format_info;
@@ -33,6 +35,7 @@ struct shmob_drm_crtc {
3335
struct shmob_drm_connector {
3436
struct drm_connector connector;
3537
struct drm_encoder *encoder;
38+
const struct videomode *mode;
3639
};
3740

3841
int shmob_drm_crtc_create(struct shmob_drm_device *sdev);

include/linux/platform_data/shmob_drm.h

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#ifndef __SHMOB_DRM_H__
1111
#define __SHMOB_DRM_H__
1212

13-
#include <drm/drm_mode.h>
13+
#include <video/videomode.h>
1414

1515
enum shmob_drm_clk_source {
1616
SHMOB_DRM_CLK_BUS,
@@ -32,19 +32,12 @@ enum shmob_drm_interface {
3232
struct shmob_drm_panel_data {
3333
unsigned int width_mm; /* Panel width in mm */
3434
unsigned int height_mm; /* Panel height in mm */
35-
struct drm_mode_modeinfo mode;
35+
struct videomode mode;
3636
};
3737

38-
#define SHMOB_DRM_IFACE_FL_DWPOL (1 << 0) /* Rising edge dot clock data latch */
39-
#define SHMOB_DRM_IFACE_FL_DIPOL (1 << 1) /* Active low display enable */
40-
#define SHMOB_DRM_IFACE_FL_DAPOL (1 << 2) /* Active low display data */
41-
#define SHMOB_DRM_IFACE_FL_HSCNT (1 << 3) /* Disable HSYNC during VBLANK */
42-
#define SHMOB_DRM_IFACE_FL_DWCNT (1 << 4) /* Disable dotclock during blanking */
43-
4438
struct shmob_drm_interface_data {
4539
enum shmob_drm_interface interface;
4640
unsigned int clk_div;
47-
unsigned int flags;
4841
};
4942

5043
struct shmob_drm_platform_data {

0 commit comments

Comments
 (0)