Skip to content

Commit

Permalink
drm: rcar-du: Remove platform data support
Browse files Browse the repository at this point in the history
All platforms now instantiate the DU through DT, platform data support
isn't needed anymore.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
  • Loading branch information
Laurent Pinchart committed Nov 26, 2014
1 parent 6512f5f commit 2378ad1
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 151 deletions.
10 changes: 9 additions & 1 deletion drivers/gpu/drm/rcar-du/rcar_du_crtc.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#define __RCAR_DU_CRTC_H__

#include <linux/mutex.h>
#include <linux/platform_data/rcar-du.h>

#include <drm/drmP.h>
#include <drm/drm_crtc.h>
Expand All @@ -41,6 +40,15 @@ struct rcar_du_crtc {

#define to_rcar_crtc(c) container_of(c, struct rcar_du_crtc, crtc)

enum rcar_du_output {
RCAR_DU_OUTPUT_DPAD0,
RCAR_DU_OUTPUT_DPAD1,
RCAR_DU_OUTPUT_LVDS0,
RCAR_DU_OUTPUT_LVDS1,
RCAR_DU_OUTPUT_TCON,
RCAR_DU_OUTPUT_MAX,
};

int rcar_du_crtc_create(struct rcar_du_group *rgrp, unsigned int index);
void rcar_du_crtc_enable_vblank(struct rcar_du_crtc *rcrtc, bool enable);
void rcar_du_crtc_cancel_page_flip(struct rcar_du_crtc *rcrtc,
Expand Down
4 changes: 1 addition & 3 deletions drivers/gpu/drm/rcar-du/rcar_du_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,11 @@ static int rcar_du_load(struct drm_device *dev, unsigned long flags)
{
struct platform_device *pdev = dev->platformdev;
struct device_node *np = pdev->dev.of_node;
struct rcar_du_platform_data *pdata = pdev->dev.platform_data;
struct rcar_du_device *rcdu;
struct resource *mem;
int ret;

if (pdata == NULL && np == NULL) {
if (np == NULL) {
dev_err(dev->dev, "no platform data\n");
return -ENODEV;
}
Expand All @@ -163,7 +162,6 @@ static int rcar_du_load(struct drm_device *dev, unsigned long flags)
}

rcdu->dev = &pdev->dev;
rcdu->pdata = pdata;
rcdu->info = np ? of_match_device(rcar_du_of_table, rcdu->dev)->data
: (void *)platform_get_device_id(pdev)->driver_data;
rcdu->ddev = dev;
Expand Down
2 changes: 0 additions & 2 deletions drivers/gpu/drm/rcar-du/rcar_du_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#define __RCAR_DU_DRV_H__

#include <linux/kernel.h>
#include <linux/platform_data/rcar-du.h>

#include "rcar_du_crtc.h"
#include "rcar_du_group.h"
Expand Down Expand Up @@ -67,7 +66,6 @@ struct rcar_du_device_info {

struct rcar_du_device {
struct device *dev;
const struct rcar_du_platform_data *pdata;
const struct rcar_du_device_info *info;

void __iomem *mmio;
Expand Down
8 changes: 2 additions & 6 deletions drivers/gpu/drm/rcar-du/rcar_du_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ static const struct drm_encoder_funcs encoder_funcs = {
int rcar_du_encoder_init(struct rcar_du_device *rcdu,
enum rcar_du_encoder_type type,
enum rcar_du_output output,
const struct rcar_du_encoder_data *data,
struct device_node *np)
{
struct rcar_du_encoder *renc;
Expand Down Expand Up @@ -190,11 +189,8 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
drm_encoder_helper_add(&renc->encoder, &encoder_helper_funcs);

switch (encoder_type) {
case DRM_MODE_ENCODER_LVDS: {
const struct rcar_du_panel_data *pdata =
data ? &data->connector.lvds.panel : NULL;
return rcar_du_lvds_connector_init(rcdu, renc, pdata, np);
}
case DRM_MODE_ENCODER_LVDS:
return rcar_du_lvds_connector_init(rcdu, renc, np);

case DRM_MODE_ENCODER_DAC:
return rcar_du_vga_connector_init(rcdu, renc);
Expand Down
10 changes: 7 additions & 3 deletions drivers/gpu/drm/rcar-du/rcar_du_encoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,18 @@
#ifndef __RCAR_DU_ENCODER_H__
#define __RCAR_DU_ENCODER_H__

#include <linux/platform_data/rcar-du.h>

#include <drm/drm_crtc.h>

struct rcar_du_device;
struct rcar_du_lvdsenc;

enum rcar_du_encoder_type {
RCAR_DU_ENCODER_UNUSED = 0,
RCAR_DU_ENCODER_NONE,
RCAR_DU_ENCODER_VGA,
RCAR_DU_ENCODER_LVDS,
};

struct rcar_du_encoder {
struct drm_encoder encoder;
enum rcar_du_output output;
Expand All @@ -44,7 +49,6 @@ rcar_du_connector_best_encoder(struct drm_connector *connector);
int rcar_du_encoder_init(struct rcar_du_device *rcdu,
enum rcar_du_encoder_type type,
enum rcar_du_output output,
const struct rcar_du_encoder_data *data,
struct device_node *np);

#endif /* __RCAR_DU_ENCODER_H__ */
52 changes: 7 additions & 45 deletions drivers/gpu/drm/rcar-du/rcar_du_kms.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,43 +190,9 @@ static const struct drm_mode_config_funcs rcar_du_mode_config_funcs = {
.output_poll_changed = rcar_du_output_poll_changed,
};

static int rcar_du_encoders_init_pdata(struct rcar_du_device *rcdu)
{
unsigned int num_encoders = 0;
unsigned int i;
int ret;

for (i = 0; i < rcdu->pdata->num_encoders; ++i) {
const struct rcar_du_encoder_data *pdata =
&rcdu->pdata->encoders[i];
const struct rcar_du_output_routing *route =
&rcdu->info->routes[pdata->output];

if (pdata->type == RCAR_DU_ENCODER_UNUSED)
continue;

if (pdata->output >= RCAR_DU_OUTPUT_MAX ||
route->possible_crtcs == 0) {
dev_warn(rcdu->dev,
"encoder %u references unexisting output %u, skipping\n",
i, pdata->output);
continue;
}

ret = rcar_du_encoder_init(rcdu, pdata->type, pdata->output,
pdata, NULL);
if (ret < 0)
return ret;

num_encoders++;
}

return num_encoders;
}

static int rcar_du_encoders_init_dt_one(struct rcar_du_device *rcdu,
enum rcar_du_output output,
struct of_endpoint *ep)
static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu,
enum rcar_du_output output,
struct of_endpoint *ep)
{
static const struct {
const char *compatible;
Expand Down Expand Up @@ -323,14 +289,14 @@ static int rcar_du_encoders_init_dt_one(struct rcar_du_device *rcdu,
connector = entity;
}

ret = rcar_du_encoder_init(rcdu, enc_type, output, NULL, connector);
ret = rcar_du_encoder_init(rcdu, enc_type, output, connector);
of_node_put(encoder);
of_node_put(connector);

return ret < 0 ? ret : 1;
}

static int rcar_du_encoders_init_dt(struct rcar_du_device *rcdu)
static int rcar_du_encoders_init(struct rcar_du_device *rcdu)
{
struct device_node *np = rcdu->dev->of_node;
struct device_node *prev = NULL;
Expand Down Expand Up @@ -377,7 +343,7 @@ static int rcar_du_encoders_init_dt(struct rcar_du_device *rcdu)
}

/* Process the output pipeline. */
ret = rcar_du_encoders_init_dt_one(rcdu, output, &ep);
ret = rcar_du_encoders_init_one(rcdu, output, &ep);
if (ret < 0) {
of_node_put(ep_node);
return ret;
Expand Down Expand Up @@ -442,11 +408,7 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)
if (ret < 0)
return ret;

if (rcdu->pdata)
ret = rcar_du_encoders_init_pdata(rcdu);
else
ret = rcar_du_encoders_init_dt(rcdu);

ret = rcar_du_encoders_init(rcdu);
if (ret < 0)
return ret;

Expand Down
26 changes: 12 additions & 14 deletions drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@
struct rcar_du_lvds_connector {
struct rcar_du_connector connector;

struct rcar_du_panel_data panel;
struct {
unsigned int width_mm; /* Panel width in mm */
unsigned int height_mm; /* Panel height in mm */
struct videomode mode;
} panel;
};

#define to_rcar_lvds_connector(c) \
Expand Down Expand Up @@ -78,31 +82,25 @@ static const struct drm_connector_funcs connector_funcs = {

int rcar_du_lvds_connector_init(struct rcar_du_device *rcdu,
struct rcar_du_encoder *renc,
const struct rcar_du_panel_data *panel,
/* TODO const */ struct device_node *np)
{
struct rcar_du_lvds_connector *lvdscon;
struct drm_connector *connector;
struct display_timing timing;
int ret;

lvdscon = devm_kzalloc(rcdu->dev, sizeof(*lvdscon), GFP_KERNEL);
if (lvdscon == NULL)
return -ENOMEM;

if (panel) {
lvdscon->panel = *panel;
} else {
struct display_timing timing;

ret = of_get_display_timing(np, "panel-timing", &timing);
if (ret < 0)
return ret;
ret = of_get_display_timing(np, "panel-timing", &timing);
if (ret < 0)
return ret;

videomode_from_timing(&timing, &lvdscon->panel.mode);
videomode_from_timing(&timing, &lvdscon->panel.mode);

of_property_read_u32(np, "width-mm", &lvdscon->panel.width_mm);
of_property_read_u32(np, "height-mm", &lvdscon->panel.height_mm);
}
of_property_read_u32(np, "width-mm", &lvdscon->panel.width_mm);
of_property_read_u32(np, "height-mm", &lvdscon->panel.height_mm);

connector = &lvdscon->connector.connector;
connector->display_info.width_mm = lvdscon->panel.width_mm;
Expand Down
2 changes: 0 additions & 2 deletions drivers/gpu/drm/rcar-du/rcar_du_lvdscon.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@

struct rcar_du_device;
struct rcar_du_encoder;
struct rcar_du_panel_data;

int rcar_du_lvds_connector_init(struct rcar_du_device *rcdu,
struct rcar_du_encoder *renc,
const struct rcar_du_panel_data *panel,
struct device_node *np);

#endif /* __RCAR_DU_LVDSCON_H__ */
1 change: 0 additions & 1 deletion drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

#include <linux/io.h>
#include <linux/module.h>
#include <linux/platform_data/rcar-du.h>

struct rcar_drm_crtc;
struct rcar_du_lvdsenc;
Expand Down
74 changes: 0 additions & 74 deletions include/linux/platform_data/rcar-du.h

This file was deleted.

0 comments on commit 2378ad1

Please sign in to comment.