Commit 2378ad12 authored by Laurent Pinchart's avatar Laurent Pinchart

drm: rcar-du: Remove platform data support

All platforms now instantiate the DU through DT, platform data support
isn't needed anymore.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
parent 6512f5fb
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#define __RCAR_DU_CRTC_H__ #define __RCAR_DU_CRTC_H__
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/platform_data/rcar-du.h>
#include <drm/drmP.h> #include <drm/drmP.h>
#include <drm/drm_crtc.h> #include <drm/drm_crtc.h>
...@@ -41,6 +40,15 @@ struct rcar_du_crtc { ...@@ -41,6 +40,15 @@ struct rcar_du_crtc {
#define to_rcar_crtc(c) container_of(c, struct rcar_du_crtc, 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); 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_enable_vblank(struct rcar_du_crtc *rcrtc, bool enable);
void rcar_du_crtc_cancel_page_flip(struct rcar_du_crtc *rcrtc, void rcar_du_crtc_cancel_page_flip(struct rcar_du_crtc *rcrtc,
......
...@@ -146,12 +146,11 @@ static int rcar_du_load(struct drm_device *dev, unsigned long flags) ...@@ -146,12 +146,11 @@ static int rcar_du_load(struct drm_device *dev, unsigned long flags)
{ {
struct platform_device *pdev = dev->platformdev; struct platform_device *pdev = dev->platformdev;
struct device_node *np = pdev->dev.of_node; struct device_node *np = pdev->dev.of_node;
struct rcar_du_platform_data *pdata = pdev->dev.platform_data;
struct rcar_du_device *rcdu; struct rcar_du_device *rcdu;
struct resource *mem; struct resource *mem;
int ret; int ret;
if (pdata == NULL && np == NULL) { if (np == NULL) {
dev_err(dev->dev, "no platform data\n"); dev_err(dev->dev, "no platform data\n");
return -ENODEV; return -ENODEV;
} }
...@@ -163,7 +162,6 @@ static int rcar_du_load(struct drm_device *dev, unsigned long flags) ...@@ -163,7 +162,6 @@ static int rcar_du_load(struct drm_device *dev, unsigned long flags)
} }
rcdu->dev = &pdev->dev; rcdu->dev = &pdev->dev;
rcdu->pdata = pdata;
rcdu->info = np ? of_match_device(rcar_du_of_table, rcdu->dev)->data rcdu->info = np ? of_match_device(rcar_du_of_table, rcdu->dev)->data
: (void *)platform_get_device_id(pdev)->driver_data; : (void *)platform_get_device_id(pdev)->driver_data;
rcdu->ddev = dev; rcdu->ddev = dev;
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#define __RCAR_DU_DRV_H__ #define __RCAR_DU_DRV_H__
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/platform_data/rcar-du.h>
#include "rcar_du_crtc.h" #include "rcar_du_crtc.h"
#include "rcar_du_group.h" #include "rcar_du_group.h"
...@@ -67,7 +66,6 @@ struct rcar_du_device_info { ...@@ -67,7 +66,6 @@ struct rcar_du_device_info {
struct rcar_du_device { struct rcar_du_device {
struct device *dev; struct device *dev;
const struct rcar_du_platform_data *pdata;
const struct rcar_du_device_info *info; const struct rcar_du_device_info *info;
void __iomem *mmio; void __iomem *mmio;
......
...@@ -142,7 +142,6 @@ static const struct drm_encoder_funcs encoder_funcs = { ...@@ -142,7 +142,6 @@ static const struct drm_encoder_funcs encoder_funcs = {
int rcar_du_encoder_init(struct rcar_du_device *rcdu, int rcar_du_encoder_init(struct rcar_du_device *rcdu,
enum rcar_du_encoder_type type, enum rcar_du_encoder_type type,
enum rcar_du_output output, enum rcar_du_output output,
const struct rcar_du_encoder_data *data,
struct device_node *np) struct device_node *np)
{ {
struct rcar_du_encoder *renc; struct rcar_du_encoder *renc;
...@@ -190,11 +189,8 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu, ...@@ -190,11 +189,8 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
drm_encoder_helper_add(&renc->encoder, &encoder_helper_funcs); drm_encoder_helper_add(&renc->encoder, &encoder_helper_funcs);
switch (encoder_type) { switch (encoder_type) {
case DRM_MODE_ENCODER_LVDS: { case DRM_MODE_ENCODER_LVDS:
const struct rcar_du_panel_data *pdata = return rcar_du_lvds_connector_init(rcdu, renc, np);
data ? &data->connector.lvds.panel : NULL;
return rcar_du_lvds_connector_init(rcdu, renc, pdata, np);
}
case DRM_MODE_ENCODER_DAC: case DRM_MODE_ENCODER_DAC:
return rcar_du_vga_connector_init(rcdu, renc); return rcar_du_vga_connector_init(rcdu, renc);
......
...@@ -14,13 +14,18 @@ ...@@ -14,13 +14,18 @@
#ifndef __RCAR_DU_ENCODER_H__ #ifndef __RCAR_DU_ENCODER_H__
#define __RCAR_DU_ENCODER_H__ #define __RCAR_DU_ENCODER_H__
#include <linux/platform_data/rcar-du.h>
#include <drm/drm_crtc.h> #include <drm/drm_crtc.h>
struct rcar_du_device; struct rcar_du_device;
struct rcar_du_lvdsenc; 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 rcar_du_encoder {
struct drm_encoder encoder; struct drm_encoder encoder;
enum rcar_du_output output; enum rcar_du_output output;
...@@ -44,7 +49,6 @@ rcar_du_connector_best_encoder(struct drm_connector *connector); ...@@ -44,7 +49,6 @@ rcar_du_connector_best_encoder(struct drm_connector *connector);
int rcar_du_encoder_init(struct rcar_du_device *rcdu, int rcar_du_encoder_init(struct rcar_du_device *rcdu,
enum rcar_du_encoder_type type, enum rcar_du_encoder_type type,
enum rcar_du_output output, enum rcar_du_output output,
const struct rcar_du_encoder_data *data,
struct device_node *np); struct device_node *np);
#endif /* __RCAR_DU_ENCODER_H__ */ #endif /* __RCAR_DU_ENCODER_H__ */
...@@ -190,43 +190,9 @@ static const struct drm_mode_config_funcs rcar_du_mode_config_funcs = { ...@@ -190,43 +190,9 @@ static const struct drm_mode_config_funcs rcar_du_mode_config_funcs = {
.output_poll_changed = rcar_du_output_poll_changed, .output_poll_changed = rcar_du_output_poll_changed,
}; };
static int rcar_du_encoders_init_pdata(struct rcar_du_device *rcdu) static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu,
{ enum rcar_du_output output,
unsigned int num_encoders = 0; struct of_endpoint *ep)
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 const struct { static const struct {
const char *compatible; const char *compatible;
...@@ -323,14 +289,14 @@ static int rcar_du_encoders_init_dt_one(struct rcar_du_device *rcdu, ...@@ -323,14 +289,14 @@ static int rcar_du_encoders_init_dt_one(struct rcar_du_device *rcdu,
connector = entity; 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(encoder);
of_node_put(connector); of_node_put(connector);
return ret < 0 ? ret : 1; 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 *np = rcdu->dev->of_node;
struct device_node *prev = NULL; struct device_node *prev = NULL;
...@@ -377,7 +343,7 @@ static int rcar_du_encoders_init_dt(struct rcar_du_device *rcdu) ...@@ -377,7 +343,7 @@ static int rcar_du_encoders_init_dt(struct rcar_du_device *rcdu)
} }
/* Process the output pipeline. */ /* 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) { if (ret < 0) {
of_node_put(ep_node); of_node_put(ep_node);
return ret; return ret;
...@@ -442,11 +408,7 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu) ...@@ -442,11 +408,7 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)
if (ret < 0) if (ret < 0)
return ret; return ret;
if (rcdu->pdata) ret = rcar_du_encoders_init(rcdu);
ret = rcar_du_encoders_init_pdata(rcdu);
else
ret = rcar_du_encoders_init_dt(rcdu);
if (ret < 0) if (ret < 0)
return ret; return ret;
......
...@@ -27,7 +27,11 @@ ...@@ -27,7 +27,11 @@
struct rcar_du_lvds_connector { struct rcar_du_lvds_connector {
struct rcar_du_connector 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) \ #define to_rcar_lvds_connector(c) \
...@@ -78,31 +82,25 @@ static const struct drm_connector_funcs connector_funcs = { ...@@ -78,31 +82,25 @@ static const struct drm_connector_funcs connector_funcs = {
int rcar_du_lvds_connector_init(struct rcar_du_device *rcdu, int rcar_du_lvds_connector_init(struct rcar_du_device *rcdu,
struct rcar_du_encoder *renc, struct rcar_du_encoder *renc,
const struct rcar_du_panel_data *panel,
/* TODO const */ struct device_node *np) /* TODO const */ struct device_node *np)
{ {
struct rcar_du_lvds_connector *lvdscon; struct rcar_du_lvds_connector *lvdscon;
struct drm_connector *connector; struct drm_connector *connector;
struct display_timing timing;
int ret; int ret;
lvdscon = devm_kzalloc(rcdu->dev, sizeof(*lvdscon), GFP_KERNEL); lvdscon = devm_kzalloc(rcdu->dev, sizeof(*lvdscon), GFP_KERNEL);
if (lvdscon == NULL) if (lvdscon == NULL)
return -ENOMEM; return -ENOMEM;
if (panel) { ret = of_get_display_timing(np, "panel-timing", &timing);
lvdscon->panel = *panel; if (ret < 0)
} else { return ret;
struct display_timing timing;
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, "width-mm", &lvdscon->panel.width_mm);
of_property_read_u32(np, "height-mm", &lvdscon->panel.height_mm); of_property_read_u32(np, "height-mm", &lvdscon->panel.height_mm);
}
connector = &lvdscon->connector.connector; connector = &lvdscon->connector.connector;
connector->display_info.width_mm = lvdscon->panel.width_mm; connector->display_info.width_mm = lvdscon->panel.width_mm;
......
...@@ -16,11 +16,9 @@ ...@@ -16,11 +16,9 @@
struct rcar_du_device; struct rcar_du_device;
struct rcar_du_encoder; struct rcar_du_encoder;
struct rcar_du_panel_data;
int rcar_du_lvds_connector_init(struct rcar_du_device *rcdu, int rcar_du_lvds_connector_init(struct rcar_du_device *rcdu,
struct rcar_du_encoder *renc, struct rcar_du_encoder *renc,
const struct rcar_du_panel_data *panel,
struct device_node *np); struct device_node *np);
#endif /* __RCAR_DU_LVDSCON_H__ */ #endif /* __RCAR_DU_LVDSCON_H__ */
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include <linux/io.h> #include <linux/io.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_data/rcar-du.h>
struct rcar_drm_crtc; struct rcar_drm_crtc;
struct rcar_du_lvdsenc; struct rcar_du_lvdsenc;
......
/*
* rcar_du.h -- R-Car Display Unit DRM driver
*
* Copyright (C) 2013 Renesas Corporation
*
* Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#ifndef __RCAR_DU_H__
#define __RCAR_DU_H__
#include <video/videomode.h>
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,
};
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_panel_data {
unsigned int width_mm; /* Panel width in mm */
unsigned int height_mm; /* Panel height in mm */
struct videomode mode;
};
struct rcar_du_connector_lvds_data {
struct rcar_du_panel_data panel;
};
struct rcar_du_connector_vga_data {
/* TODO: Add DDC information for EDID retrieval */
};
/*
* struct rcar_du_encoder_data - Encoder platform data
* @type: the encoder type (RCAR_DU_ENCODER_*)
* @output: the DU output the connector is connected to (RCAR_DU_OUTPUT_*)
* @connector.lvds: platform data for LVDS connectors
* @connector.vga: platform data for VGA connectors
*
* Encoder platform data describes an on-board encoder, its associated DU SoC
* output, and the connector.
*/
struct rcar_du_encoder_data {
enum rcar_du_encoder_type type;
enum rcar_du_output output;
union {
struct rcar_du_connector_lvds_data lvds;
struct rcar_du_connector_vga_data vga;
} connector;
};
struct rcar_du_platform_data {
struct rcar_du_encoder_data *encoders;
unsigned int num_encoders;
};
#endif /* __RCAR_DU_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment