2009-08-07 18:15:50 +08:00
|
|
|
/*
|
|
|
|
* linux/drivers/video/omap2/dss/dpi.c
|
|
|
|
*
|
|
|
|
* Copyright (C) 2009 Nokia Corporation
|
|
|
|
* Author: Tomi Valkeinen <tomi.valkeinen@nokia.com>
|
|
|
|
*
|
|
|
|
* Some code and ideas taken from drivers/video/omap/ driver
|
|
|
|
* by Imre Deak.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License version 2 as published by
|
|
|
|
* the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
* more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with
|
|
|
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define DSS_SUBSYS_NAME "DPI"
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/delay.h>
|
2011-07-11 01:20:26 +08:00
|
|
|
#include <linux/export.h>
|
2010-02-04 23:03:41 +08:00
|
|
|
#include <linux/err.h>
|
2009-08-07 18:15:50 +08:00
|
|
|
#include <linux/errno.h>
|
2010-02-04 23:03:41 +08:00
|
|
|
#include <linux/platform_device.h>
|
|
|
|
#include <linux/regulator/consumer.h>
|
2012-09-28 15:03:03 +08:00
|
|
|
#include <linux/string.h>
|
2013-12-16 21:13:24 +08:00
|
|
|
#include <linux/of.h>
|
2014-10-22 19:49:14 +08:00
|
|
|
#include <linux/clk.h>
|
OMAPDSS: componentize omapdss
omapdss kernel module contains drivers for multiple devices, one for
each DSS submodule. The probing we have at the moment is a mess, and
doesn't give us proper deferred probing nor ensure that all the devices
are probed before omapfb/omapdrm start using omapdss.
This patch solves the mess by using the component system for DSS
submodules.
The changes to all DSS submodules (dispc, dpi, dsi, hdmi4/5, rfbi, sdi,
venc) are the same: probe & remove functions are changed to bind &
unbind, and new probe & remove functions are added which call
component_add/del.
The dss_core driver (dss.c) acts as a component master. Adding and
matching the components is simple: all dss device's child devices are
added as components.
However, we do have some dependencies between the drivers. The order in
which they should be probed is reflected by the list in core.c
(dss_output_drv_reg_funcs). The drivers are registered in that order,
which causes the components to be added in that order, which makes the
components to be bound in that order. This feels a bit fragile, and we
probably should improve the code to manage binds in random order.
However, for now, this works fine.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-06-04 20:22:23 +08:00
|
|
|
#include <linux/component.h>
|
2009-08-07 18:15:50 +08:00
|
|
|
|
2016-05-27 19:40:49 +08:00
|
|
|
#include "omapdss.h"
|
2009-08-07 18:15:50 +08:00
|
|
|
#include "dss.h"
|
2012-08-22 14:14:06 +08:00
|
|
|
#include "dss_features.h"
|
2009-08-07 18:15:50 +08:00
|
|
|
|
2014-05-30 18:56:22 +08:00
|
|
|
struct dpi_data {
|
2013-03-19 17:33:52 +08:00
|
|
|
struct platform_device *pdev;
|
|
|
|
|
2010-02-04 23:03:41 +08:00
|
|
|
struct regulator *vdds_dsi_reg;
|
2016-05-17 21:08:54 +08:00
|
|
|
enum dss_clk_source clk_src;
|
2014-10-22 19:49:14 +08:00
|
|
|
struct dss_pll *pll;
|
2012-06-29 16:49:13 +08:00
|
|
|
|
2012-07-05 15:22:46 +08:00
|
|
|
struct mutex lock;
|
|
|
|
|
2012-08-08 16:58:54 +08:00
|
|
|
struct omap_video_timings timings;
|
2012-06-29 16:49:13 +08:00
|
|
|
struct dss_lcd_mgr_config mgr_config;
|
2012-07-06 18:00:52 +08:00
|
|
|
int data_lines;
|
2012-09-26 19:00:49 +08:00
|
|
|
|
OMAPDSS: combine omap_dss_output into omap_dss_device
We currently have omap_dss_device, which represents an external display
device, sometimes an external encoder, sometimes a panel. Then we have
omap_dss_output, which represents DSS's output encoder.
In the future with new display device model, we construct a video
pipeline from the display blocks. To accomplish this, all the blocks
need to be presented by the same entity.
Thus, this patch combines omap_dss_output into omap_dss_device. Some of
the fields in omap_dss_output are already found in omap_dss_device, but
some are not. This means we'll have DSS output specific fields in
omap_dss_device, which is not very nice. However, it is easier to just
keep those output specific fields there for now, and after transition to
new display device model is made, they can be cleaned up easier than
could be done now.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2013-04-19 20:09:34 +08:00
|
|
|
struct omap_dss_device output;
|
2013-12-16 21:13:24 +08:00
|
|
|
|
|
|
|
bool port_initialized;
|
2014-05-30 18:56:22 +08:00
|
|
|
};
|
|
|
|
|
2014-06-01 15:17:44 +08:00
|
|
|
static struct dpi_data *dpi_get_data_from_dssdev(struct omap_dss_device *dssdev)
|
|
|
|
{
|
|
|
|
return container_of(dssdev, struct dpi_data, output);
|
|
|
|
}
|
|
|
|
|
2014-06-02 16:41:51 +08:00
|
|
|
/* only used in non-DT mode */
|
2014-06-01 15:17:44 +08:00
|
|
|
static struct dpi_data *dpi_get_data_from_pdev(struct platform_device *pdev)
|
|
|
|
{
|
|
|
|
return dev_get_drvdata(&pdev->dev);
|
|
|
|
}
|
2009-08-07 18:15:50 +08:00
|
|
|
|
2016-05-17 21:08:54 +08:00
|
|
|
static enum dss_clk_source dpi_get_clk_src(enum omap_channel channel)
|
2011-05-12 19:56:26 +08:00
|
|
|
{
|
OMAPDSS: fix TV-out issue with DSI PLL
Commit 0e8276ef75f5c7811b038d1d23b2b42c16efc5ac (OMAPDSS: DPI: always
use DSI PLL if available) made dpi.c use DSI PLL for its clock. This
works fine, for DPI, but has a nasty side effect on OMAP3:
On OMAP3 the same clock is used for DISPC fclk and LCD output. Thus,
after the above patch, DSI PLL is used for DISPC and LCD output. If
TV-out is used, the TV-out needs DISPC. And if DPI is turned off, the
DSI PLL is also turned off, disabling DISPC.
For this to work, we'd need proper DSS internal clock handling, with
refcounts, which is a non-trivial project.
This patch fixes the issue for now by disabling the use of DSI PLL for
DPI on OMAP3.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2012-12-13 20:21:30 +08:00
|
|
|
/*
|
|
|
|
* XXX we can't currently use DSI PLL for DPI with OMAP3, as the DSI PLL
|
|
|
|
* would also be used for DISPC fclk. Meaning, when the DPI output is
|
|
|
|
* disabled, DISPC clock will be disabled, and TV out will stop.
|
|
|
|
*/
|
|
|
|
switch (omapdss_get_version()) {
|
|
|
|
case OMAPDSS_VER_OMAP24xx:
|
|
|
|
case OMAPDSS_VER_OMAP34xx_ES1:
|
|
|
|
case OMAPDSS_VER_OMAP34xx_ES3:
|
|
|
|
case OMAPDSS_VER_OMAP3630:
|
|
|
|
case OMAPDSS_VER_AM35xx:
|
2014-03-24 19:01:51 +08:00
|
|
|
case OMAPDSS_VER_AM43xx:
|
2016-05-17 21:08:54 +08:00
|
|
|
return DSS_CLK_SRC_FCK;
|
OMAPDSS: fix TV-out issue with DSI PLL
Commit 0e8276ef75f5c7811b038d1d23b2b42c16efc5ac (OMAPDSS: DPI: always
use DSI PLL if available) made dpi.c use DSI PLL for its clock. This
works fine, for DPI, but has a nasty side effect on OMAP3:
On OMAP3 the same clock is used for DISPC fclk and LCD output. Thus,
after the above patch, DSI PLL is used for DISPC and LCD output. If
TV-out is used, the TV-out needs DISPC. And if DPI is turned off, the
DSI PLL is also turned off, disabling DISPC.
For this to work, we'd need proper DSS internal clock handling, with
refcounts, which is a non-trivial project.
This patch fixes the issue for now by disabling the use of DSI PLL for
DPI on OMAP3.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2012-12-13 20:21:30 +08:00
|
|
|
|
2013-03-11 19:57:38 +08:00
|
|
|
case OMAPDSS_VER_OMAP4430_ES1:
|
|
|
|
case OMAPDSS_VER_OMAP4430_ES2:
|
|
|
|
case OMAPDSS_VER_OMAP4:
|
|
|
|
switch (channel) {
|
|
|
|
case OMAP_DSS_CHANNEL_LCD:
|
2016-05-17 21:08:54 +08:00
|
|
|
return DSS_CLK_SRC_PLL1_1;
|
2013-03-11 19:57:38 +08:00
|
|
|
case OMAP_DSS_CHANNEL_LCD2:
|
2016-05-17 21:08:54 +08:00
|
|
|
return DSS_CLK_SRC_PLL2_1;
|
2013-03-11 19:57:38 +08:00
|
|
|
default:
|
2016-05-17 21:08:54 +08:00
|
|
|
return DSS_CLK_SRC_FCK;
|
2013-03-11 19:57:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
case OMAPDSS_VER_OMAP5:
|
|
|
|
switch (channel) {
|
|
|
|
case OMAP_DSS_CHANNEL_LCD:
|
2016-05-17 21:08:54 +08:00
|
|
|
return DSS_CLK_SRC_PLL1_1;
|
2013-03-11 19:57:38 +08:00
|
|
|
case OMAP_DSS_CHANNEL_LCD3:
|
2016-05-17 21:08:54 +08:00
|
|
|
return DSS_CLK_SRC_PLL2_1;
|
|
|
|
case OMAP_DSS_CHANNEL_LCD2:
|
2013-03-11 19:57:38 +08:00
|
|
|
default:
|
2016-05-17 21:08:54 +08:00
|
|
|
return DSS_CLK_SRC_FCK;
|
2013-03-11 19:57:38 +08:00
|
|
|
}
|
|
|
|
|
2014-12-31 17:26:06 +08:00
|
|
|
case OMAPDSS_VER_DRA7xx:
|
|
|
|
switch (channel) {
|
|
|
|
case OMAP_DSS_CHANNEL_LCD:
|
2016-05-17 21:08:54 +08:00
|
|
|
return DSS_CLK_SRC_PLL1_1;
|
2014-12-31 17:26:06 +08:00
|
|
|
case OMAP_DSS_CHANNEL_LCD2:
|
2016-05-17 21:08:54 +08:00
|
|
|
return DSS_CLK_SRC_PLL1_3;
|
2014-12-31 17:26:06 +08:00
|
|
|
case OMAP_DSS_CHANNEL_LCD3:
|
2016-05-17 21:08:54 +08:00
|
|
|
return DSS_CLK_SRC_PLL2_1;
|
2014-12-31 17:26:06 +08:00
|
|
|
default:
|
2016-05-17 21:08:54 +08:00
|
|
|
return DSS_CLK_SRC_FCK;
|
2014-12-31 17:26:06 +08:00
|
|
|
}
|
|
|
|
|
2012-10-22 21:12:58 +08:00
|
|
|
default:
|
2016-05-17 19:01:10 +08:00
|
|
|
return DSS_CLK_SRC_FCK;
|
2012-10-22 21:12:58 +08:00
|
|
|
}
|
2011-04-12 16:22:26 +08:00
|
|
|
}
|
|
|
|
|
2013-03-05 23:07:16 +08:00
|
|
|
struct dpi_clk_calc_ctx {
|
2014-10-22 19:49:14 +08:00
|
|
|
struct dss_pll *pll;
|
2016-05-17 21:20:07 +08:00
|
|
|
unsigned clkout_idx;
|
2013-03-05 23:07:16 +08:00
|
|
|
|
|
|
|
/* inputs */
|
|
|
|
|
|
|
|
unsigned long pck_min, pck_max;
|
|
|
|
|
|
|
|
/* outputs */
|
|
|
|
|
2016-05-18 17:22:32 +08:00
|
|
|
struct dss_pll_clock_info pll_cinfo;
|
2014-01-28 14:50:47 +08:00
|
|
|
unsigned long fck;
|
2013-03-05 23:07:16 +08:00
|
|
|
struct dispc_clock_info dispc_cinfo;
|
|
|
|
};
|
|
|
|
|
|
|
|
static bool dpi_calc_dispc_cb(int lckd, int pckd, unsigned long lck,
|
|
|
|
unsigned long pck, void *data)
|
|
|
|
{
|
|
|
|
struct dpi_clk_calc_ctx *ctx = data;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Odd dividers give us uneven duty cycle, causing problem when level
|
|
|
|
* shifted. So skip all odd dividers when the pixel clock is on the
|
|
|
|
* higher side.
|
|
|
|
*/
|
2013-06-12 14:44:52 +08:00
|
|
|
if (ctx->pck_min >= 100000000) {
|
2013-03-05 23:07:16 +08:00
|
|
|
if (lckd > 1 && lckd % 2 != 0)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (pckd > 1 && pckd % 2 != 0)
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
ctx->dispc_cinfo.lck_div = lckd;
|
|
|
|
ctx->dispc_cinfo.pck_div = pckd;
|
|
|
|
ctx->dispc_cinfo.lck = lck;
|
|
|
|
ctx->dispc_cinfo.pck = pck;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-10-22 19:49:14 +08:00
|
|
|
static bool dpi_calc_hsdiv_cb(int m_dispc, unsigned long dispc,
|
2013-03-05 23:07:16 +08:00
|
|
|
void *data)
|
|
|
|
{
|
|
|
|
struct dpi_clk_calc_ctx *ctx = data;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Odd dividers give us uneven duty cycle, causing problem when level
|
|
|
|
* shifted. So skip all odd dividers when the pixel clock is on the
|
|
|
|
* higher side.
|
|
|
|
*/
|
2014-10-22 19:49:14 +08:00
|
|
|
if (m_dispc > 1 && m_dispc % 2 != 0 && ctx->pck_min >= 100000000)
|
2013-03-05 23:07:16 +08:00
|
|
|
return false;
|
|
|
|
|
2016-05-18 17:22:32 +08:00
|
|
|
ctx->pll_cinfo.mX[ctx->clkout_idx] = m_dispc;
|
|
|
|
ctx->pll_cinfo.clkout[ctx->clkout_idx] = dispc;
|
2013-03-05 23:07:16 +08:00
|
|
|
|
|
|
|
return dispc_div_calc(dispc, ctx->pck_min, ctx->pck_max,
|
|
|
|
dpi_calc_dispc_cb, ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-10-22 19:49:14 +08:00
|
|
|
static bool dpi_calc_pll_cb(int n, int m, unsigned long fint,
|
|
|
|
unsigned long clkdco,
|
2013-03-05 23:07:16 +08:00
|
|
|
void *data)
|
|
|
|
{
|
|
|
|
struct dpi_clk_calc_ctx *ctx = data;
|
|
|
|
|
2016-05-18 17:22:32 +08:00
|
|
|
ctx->pll_cinfo.n = n;
|
|
|
|
ctx->pll_cinfo.m = m;
|
|
|
|
ctx->pll_cinfo.fint = fint;
|
|
|
|
ctx->pll_cinfo.clkdco = clkdco;
|
2013-03-05 23:07:16 +08:00
|
|
|
|
2016-05-18 02:23:37 +08:00
|
|
|
return dss_pll_hsdiv_calc_a(ctx->pll, clkdco,
|
2014-10-22 19:49:14 +08:00
|
|
|
ctx->pck_min, dss_feat_get_param_max(FEAT_PARAM_DSS_FCK),
|
|
|
|
dpi_calc_hsdiv_cb, ctx);
|
2013-03-05 23:07:16 +08:00
|
|
|
}
|
|
|
|
|
2013-10-31 20:44:23 +08:00
|
|
|
static bool dpi_calc_dss_cb(unsigned long fck, void *data)
|
2013-03-05 23:07:16 +08:00
|
|
|
{
|
|
|
|
struct dpi_clk_calc_ctx *ctx = data;
|
|
|
|
|
2013-10-31 20:44:23 +08:00
|
|
|
ctx->fck = fck;
|
2013-03-05 23:07:16 +08:00
|
|
|
|
|
|
|
return dispc_div_calc(fck, ctx->pck_min, ctx->pck_max,
|
|
|
|
dpi_calc_dispc_cb, ctx);
|
|
|
|
}
|
|
|
|
|
2016-05-18 17:22:32 +08:00
|
|
|
static bool dpi_pll_clk_calc(struct dpi_data *dpi, unsigned long pck,
|
2014-05-30 18:56:22 +08:00
|
|
|
struct dpi_clk_calc_ctx *ctx)
|
2013-03-05 23:07:16 +08:00
|
|
|
{
|
|
|
|
unsigned long clkin;
|
|
|
|
|
|
|
|
memset(ctx, 0, sizeof(*ctx));
|
2014-10-22 19:49:14 +08:00
|
|
|
ctx->pll = dpi->pll;
|
2016-05-17 21:20:07 +08:00
|
|
|
ctx->clkout_idx = dss_pll_get_clkout_idx_for_src(dpi->clk_src);
|
2013-03-05 23:07:16 +08:00
|
|
|
|
2016-05-18 17:06:49 +08:00
|
|
|
clkin = clk_get_rate(dpi->pll->clkin);
|
2013-03-05 23:07:16 +08:00
|
|
|
|
2016-05-18 17:06:49 +08:00
|
|
|
if (dpi->pll->hw->type == DSS_PLL_TYPE_A) {
|
|
|
|
unsigned long pll_min, pll_max;
|
2014-10-22 19:49:14 +08:00
|
|
|
|
2016-05-18 17:06:49 +08:00
|
|
|
ctx->pck_min = pck - 1000;
|
|
|
|
ctx->pck_max = pck + 1000;
|
|
|
|
|
|
|
|
pll_min = 0;
|
|
|
|
pll_max = 0;
|
|
|
|
|
|
|
|
return dss_pll_calc_a(ctx->pll, clkin,
|
|
|
|
pll_min, pll_max,
|
|
|
|
dpi_calc_pll_cb, ctx);
|
|
|
|
} else { /* DSS_PLL_TYPE_B */
|
2016-05-18 17:22:32 +08:00
|
|
|
dss_pll_calc_b(dpi->pll, clkin, pck, &ctx->pll_cinfo);
|
2016-05-18 17:06:49 +08:00
|
|
|
|
|
|
|
ctx->dispc_cinfo.lck_div = 1;
|
|
|
|
ctx->dispc_cinfo.pck_div = 1;
|
2016-05-18 17:22:32 +08:00
|
|
|
ctx->dispc_cinfo.lck = ctx->pll_cinfo.clkout[0];
|
2016-05-18 17:06:49 +08:00
|
|
|
ctx->dispc_cinfo.pck = ctx->dispc_cinfo.lck;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2013-03-05 23:07:16 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static bool dpi_dss_clk_calc(unsigned long pck, struct dpi_clk_calc_ctx *ctx)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* DSS fck gives us very few possibilities, so finding a good pixel
|
|
|
|
* clock may not be possible. We try multiple times to find the clock,
|
|
|
|
* each time widening the pixel clock range we look for, up to
|
2013-04-10 19:54:54 +08:00
|
|
|
* +/- ~15MHz.
|
2013-03-05 23:07:16 +08:00
|
|
|
*/
|
|
|
|
|
2013-04-10 19:54:54 +08:00
|
|
|
for (i = 0; i < 25; ++i) {
|
2013-03-05 23:07:16 +08:00
|
|
|
bool ok;
|
|
|
|
|
|
|
|
memset(ctx, 0, sizeof(*ctx));
|
|
|
|
if (pck > 1000 * i * i * i)
|
|
|
|
ctx->pck_min = max(pck - 1000 * i * i * i, 0lu);
|
|
|
|
else
|
|
|
|
ctx->pck_min = 0;
|
|
|
|
ctx->pck_max = pck + 1000 * i * i * i;
|
|
|
|
|
2013-10-31 22:41:57 +08:00
|
|
|
ok = dss_div_calc(pck, ctx->pck_min, dpi_calc_dss_cb, ctx);
|
2013-03-05 23:07:16 +08:00
|
|
|
if (ok)
|
|
|
|
return ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-05-18 17:22:32 +08:00
|
|
|
static int dpi_set_pll_clk(struct dpi_data *dpi, enum omap_channel channel,
|
2010-12-02 19:27:11 +08:00
|
|
|
unsigned long pck_req, unsigned long *fck, int *lck_div,
|
|
|
|
int *pck_div)
|
2009-08-07 18:15:50 +08:00
|
|
|
{
|
2013-03-05 23:07:16 +08:00
|
|
|
struct dpi_clk_calc_ctx ctx;
|
2009-08-07 18:15:50 +08:00
|
|
|
int r;
|
2013-03-05 23:07:16 +08:00
|
|
|
bool ok;
|
2009-08-07 18:15:50 +08:00
|
|
|
|
2016-05-18 17:22:32 +08:00
|
|
|
ok = dpi_pll_clk_calc(dpi, pck_req, &ctx);
|
2013-03-05 23:07:16 +08:00
|
|
|
if (!ok)
|
|
|
|
return -EINVAL;
|
2009-08-07 18:15:50 +08:00
|
|
|
|
2016-05-18 17:22:32 +08:00
|
|
|
r = dss_pll_set_config(dpi->pll, &ctx.pll_cinfo);
|
2009-08-07 18:15:50 +08:00
|
|
|
if (r)
|
|
|
|
return r;
|
|
|
|
|
2016-05-17 21:08:54 +08:00
|
|
|
dss_select_lcd_clk_source(channel, dpi->clk_src);
|
2009-08-07 18:15:50 +08:00
|
|
|
|
2014-05-30 18:56:22 +08:00
|
|
|
dpi->mgr_config.clock_info = ctx.dispc_cinfo;
|
2009-08-07 18:15:50 +08:00
|
|
|
|
2016-05-18 17:22:32 +08:00
|
|
|
*fck = ctx.pll_cinfo.clkout[ctx.clkout_idx];
|
2013-03-05 23:07:16 +08:00
|
|
|
*lck_div = ctx.dispc_cinfo.lck_div;
|
|
|
|
*pck_div = ctx.dispc_cinfo.pck_div;
|
2009-08-07 18:15:50 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2011-04-12 16:22:26 +08:00
|
|
|
|
2014-05-30 18:56:22 +08:00
|
|
|
static int dpi_set_dispc_clk(struct dpi_data *dpi, unsigned long pck_req,
|
|
|
|
unsigned long *fck, int *lck_div, int *pck_div)
|
2009-08-07 18:15:50 +08:00
|
|
|
{
|
2013-03-05 23:07:16 +08:00
|
|
|
struct dpi_clk_calc_ctx ctx;
|
2009-08-07 18:15:50 +08:00
|
|
|
int r;
|
2013-03-05 23:07:16 +08:00
|
|
|
bool ok;
|
2009-08-07 18:15:50 +08:00
|
|
|
|
2013-03-05 23:07:16 +08:00
|
|
|
ok = dpi_dss_clk_calc(pck_req, &ctx);
|
|
|
|
if (!ok)
|
|
|
|
return -EINVAL;
|
2009-08-07 18:15:50 +08:00
|
|
|
|
2013-10-31 20:44:23 +08:00
|
|
|
r = dss_set_fck_rate(ctx.fck);
|
2009-08-07 18:15:50 +08:00
|
|
|
if (r)
|
|
|
|
return r;
|
|
|
|
|
2014-05-30 18:56:22 +08:00
|
|
|
dpi->mgr_config.clock_info = ctx.dispc_cinfo;
|
2009-08-07 18:15:50 +08:00
|
|
|
|
2013-10-31 20:44:23 +08:00
|
|
|
*fck = ctx.fck;
|
2013-03-05 23:07:16 +08:00
|
|
|
*lck_div = ctx.dispc_cinfo.lck_div;
|
|
|
|
*pck_div = ctx.dispc_cinfo.pck_div;
|
2009-08-07 18:15:50 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-05-30 18:56:22 +08:00
|
|
|
static int dpi_set_mode(struct dpi_data *dpi)
|
2009-08-07 18:15:50 +08:00
|
|
|
{
|
2014-05-30 18:56:22 +08:00
|
|
|
struct omap_dss_device *out = &dpi->output;
|
2015-11-05 15:52:00 +08:00
|
|
|
enum omap_channel channel = out->dispc_channel;
|
2014-05-30 18:56:22 +08:00
|
|
|
struct omap_video_timings *t = &dpi->timings;
|
2011-04-12 16:22:26 +08:00
|
|
|
int lck_div = 0, pck_div = 0;
|
|
|
|
unsigned long fck = 0;
|
2009-08-07 18:15:50 +08:00
|
|
|
unsigned long pck;
|
|
|
|
int r = 0;
|
|
|
|
|
2014-10-22 19:49:14 +08:00
|
|
|
if (dpi->pll)
|
2016-05-18 17:22:32 +08:00
|
|
|
r = dpi_set_pll_clk(dpi, channel, t->pixelclock, &fck,
|
2012-06-21 12:03:55 +08:00
|
|
|
&lck_div, &pck_div);
|
2011-04-12 16:22:26 +08:00
|
|
|
else
|
2014-05-30 18:56:22 +08:00
|
|
|
r = dpi_set_dispc_clk(dpi, t->pixelclock, &fck,
|
2012-06-21 12:03:55 +08:00
|
|
|
&lck_div, &pck_div);
|
2009-08-07 18:15:50 +08:00
|
|
|
if (r)
|
2011-05-27 15:52:19 +08:00
|
|
|
return r;
|
2009-08-07 18:15:50 +08:00
|
|
|
|
2013-04-10 19:12:14 +08:00
|
|
|
pck = fck / lck_div / pck_div;
|
2009-08-07 18:15:50 +08:00
|
|
|
|
2013-04-10 19:12:14 +08:00
|
|
|
if (pck != t->pixelclock) {
|
|
|
|
DSSWARN("Could not find exact pixel clock. Requested %d Hz, got %lu Hz\n",
|
|
|
|
t->pixelclock, pck);
|
2009-08-07 18:15:50 +08:00
|
|
|
|
2013-04-10 19:12:14 +08:00
|
|
|
t->pixelclock = pck;
|
2009-08-07 18:15:50 +08:00
|
|
|
}
|
|
|
|
|
2015-11-05 15:52:00 +08:00
|
|
|
dss_mgr_set_timings(channel, t);
|
2009-08-07 18:15:50 +08:00
|
|
|
|
2011-05-27 15:52:19 +08:00
|
|
|
return 0;
|
2009-08-07 18:15:50 +08:00
|
|
|
}
|
|
|
|
|
2014-05-30 18:56:22 +08:00
|
|
|
static void dpi_config_lcd_manager(struct dpi_data *dpi)
|
2009-08-07 18:15:50 +08:00
|
|
|
{
|
2014-05-30 18:56:22 +08:00
|
|
|
struct omap_dss_device *out = &dpi->output;
|
2015-11-05 15:52:00 +08:00
|
|
|
enum omap_channel channel = out->dispc_channel;
|
2014-05-30 18:56:22 +08:00
|
|
|
|
|
|
|
dpi->mgr_config.io_pad_mode = DSS_IO_PAD_MODE_BYPASS;
|
2011-08-22 20:11:57 +08:00
|
|
|
|
2014-05-30 18:56:22 +08:00
|
|
|
dpi->mgr_config.stallmode = false;
|
|
|
|
dpi->mgr_config.fifohandcheck = false;
|
2012-06-29 16:49:13 +08:00
|
|
|
|
2014-05-30 18:56:22 +08:00
|
|
|
dpi->mgr_config.video_port_width = dpi->data_lines;
|
2012-06-29 16:49:13 +08:00
|
|
|
|
2014-05-30 18:56:22 +08:00
|
|
|
dpi->mgr_config.lcden_sig_polarity = 0;
|
2012-06-29 16:49:13 +08:00
|
|
|
|
2015-11-05 15:52:00 +08:00
|
|
|
dss_mgr_set_lcd_config(channel, &dpi->mgr_config);
|
2009-08-07 18:15:50 +08:00
|
|
|
}
|
|
|
|
|
2013-05-15 15:40:15 +08:00
|
|
|
static int dpi_display_enable(struct omap_dss_device *dssdev)
|
2009-08-07 18:15:50 +08:00
|
|
|
{
|
2014-06-01 15:17:44 +08:00
|
|
|
struct dpi_data *dpi = dpi_get_data_from_dssdev(dssdev);
|
2014-05-30 18:56:22 +08:00
|
|
|
struct omap_dss_device *out = &dpi->output;
|
2015-11-05 15:52:00 +08:00
|
|
|
enum omap_channel channel = out->dispc_channel;
|
2009-08-07 18:15:50 +08:00
|
|
|
int r;
|
|
|
|
|
2014-05-30 18:56:22 +08:00
|
|
|
mutex_lock(&dpi->lock);
|
2012-07-05 15:22:46 +08:00
|
|
|
|
2014-05-30 18:56:22 +08:00
|
|
|
if (dss_has_feature(FEAT_DPI_USES_VDDS_DSI) && !dpi->vdds_dsi_reg) {
|
2012-02-07 17:44:55 +08:00
|
|
|
DSSERR("no VDSS_DSI regulator\n");
|
2012-07-05 15:22:46 +08:00
|
|
|
r = -ENODEV;
|
|
|
|
goto err_no_reg;
|
2012-02-07 17:44:55 +08:00
|
|
|
}
|
|
|
|
|
2015-11-05 15:34:51 +08:00
|
|
|
if (!out->dispc_channel_connected) {
|
2012-09-07 20:23:38 +08:00
|
|
|
DSSERR("failed to enable display: no output/manager\n");
|
2012-07-05 15:22:46 +08:00
|
|
|
r = -ENODEV;
|
2012-09-07 20:23:38 +08:00
|
|
|
goto err_no_out_mgr;
|
2011-06-23 21:38:21 +08:00
|
|
|
}
|
|
|
|
|
2012-08-22 14:14:06 +08:00
|
|
|
if (dss_has_feature(FEAT_DPI_USES_VDDS_DSI)) {
|
2014-05-30 18:56:22 +08:00
|
|
|
r = regulator_enable(dpi->vdds_dsi_reg);
|
2010-02-04 23:03:41 +08:00
|
|
|
if (r)
|
2011-05-27 15:52:19 +08:00
|
|
|
goto err_reg_enable;
|
2010-02-04 23:03:41 +08:00
|
|
|
}
|
|
|
|
|
2011-05-27 15:52:19 +08:00
|
|
|
r = dispc_runtime_get();
|
2009-08-07 18:15:50 +08:00
|
|
|
if (r)
|
2011-05-27 15:52:19 +08:00
|
|
|
goto err_get_dispc;
|
|
|
|
|
2015-11-05 15:52:00 +08:00
|
|
|
r = dss_dpi_select_source(out->port_num, channel);
|
2012-09-21 17:09:54 +08:00
|
|
|
if (r)
|
|
|
|
goto err_src_sel;
|
|
|
|
|
2014-10-22 19:49:14 +08:00
|
|
|
if (dpi->pll) {
|
|
|
|
r = dss_pll_enable(dpi->pll);
|
2011-04-12 16:22:26 +08:00
|
|
|
if (r)
|
2016-05-18 17:22:32 +08:00
|
|
|
goto err_pll_init;
|
2011-04-12 16:22:26 +08:00
|
|
|
}
|
|
|
|
|
2014-05-30 18:56:22 +08:00
|
|
|
r = dpi_set_mode(dpi);
|
2009-08-07 18:15:50 +08:00
|
|
|
if (r)
|
2011-05-27 15:52:19 +08:00
|
|
|
goto err_set_mode;
|
2009-08-07 18:15:50 +08:00
|
|
|
|
2014-05-30 18:56:22 +08:00
|
|
|
dpi_config_lcd_manager(dpi);
|
2012-06-29 16:49:13 +08:00
|
|
|
|
2009-08-07 18:15:50 +08:00
|
|
|
mdelay(2);
|
|
|
|
|
2015-11-05 15:52:00 +08:00
|
|
|
r = dss_mgr_enable(channel);
|
2011-11-21 19:42:58 +08:00
|
|
|
if (r)
|
|
|
|
goto err_mgr_enable;
|
2009-08-07 18:15:50 +08:00
|
|
|
|
2014-05-30 18:56:22 +08:00
|
|
|
mutex_unlock(&dpi->lock);
|
2012-07-05 15:22:46 +08:00
|
|
|
|
2009-08-07 18:15:50 +08:00
|
|
|
return 0;
|
|
|
|
|
2011-11-21 19:42:58 +08:00
|
|
|
err_mgr_enable:
|
2011-05-27 15:52:19 +08:00
|
|
|
err_set_mode:
|
2014-10-22 19:49:14 +08:00
|
|
|
if (dpi->pll)
|
|
|
|
dss_pll_disable(dpi->pll);
|
2016-05-18 17:22:32 +08:00
|
|
|
err_pll_init:
|
2012-09-21 17:09:54 +08:00
|
|
|
err_src_sel:
|
2011-05-27 15:52:19 +08:00
|
|
|
dispc_runtime_put();
|
|
|
|
err_get_dispc:
|
2012-08-22 14:14:06 +08:00
|
|
|
if (dss_has_feature(FEAT_DPI_USES_VDDS_DSI))
|
2014-05-30 18:56:22 +08:00
|
|
|
regulator_disable(dpi->vdds_dsi_reg);
|
2011-05-27 15:52:19 +08:00
|
|
|
err_reg_enable:
|
2012-09-07 20:23:38 +08:00
|
|
|
err_no_out_mgr:
|
2012-07-05 15:22:46 +08:00
|
|
|
err_no_reg:
|
2014-05-30 18:56:22 +08:00
|
|
|
mutex_unlock(&dpi->lock);
|
2009-08-07 18:15:50 +08:00
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
2013-05-15 15:40:15 +08:00
|
|
|
static void dpi_display_disable(struct omap_dss_device *dssdev)
|
2009-08-07 18:15:50 +08:00
|
|
|
{
|
2014-06-01 15:17:44 +08:00
|
|
|
struct dpi_data *dpi = dpi_get_data_from_dssdev(dssdev);
|
2015-11-05 15:52:00 +08:00
|
|
|
enum omap_channel channel = dpi->output.dispc_channel;
|
2012-09-07 20:23:38 +08:00
|
|
|
|
2014-05-30 18:56:22 +08:00
|
|
|
mutex_lock(&dpi->lock);
|
2012-07-05 15:22:46 +08:00
|
|
|
|
2015-11-05 15:52:00 +08:00
|
|
|
dss_mgr_disable(channel);
|
2009-08-07 18:15:50 +08:00
|
|
|
|
2014-10-22 19:49:14 +08:00
|
|
|
if (dpi->pll) {
|
2016-05-17 19:01:10 +08:00
|
|
|
dss_select_lcd_clk_source(channel, DSS_CLK_SRC_FCK);
|
2014-10-22 19:49:14 +08:00
|
|
|
dss_pll_disable(dpi->pll);
|
2011-04-12 16:22:26 +08:00
|
|
|
}
|
2009-08-07 18:15:50 +08:00
|
|
|
|
2011-05-27 15:52:19 +08:00
|
|
|
dispc_runtime_put();
|
2009-08-07 18:15:50 +08:00
|
|
|
|
2012-08-22 14:14:06 +08:00
|
|
|
if (dss_has_feature(FEAT_DPI_USES_VDDS_DSI))
|
2014-05-30 18:56:22 +08:00
|
|
|
regulator_disable(dpi->vdds_dsi_reg);
|
2010-02-04 23:03:41 +08:00
|
|
|
|
2014-05-30 18:56:22 +08:00
|
|
|
mutex_unlock(&dpi->lock);
|
2009-08-07 18:15:50 +08:00
|
|
|
}
|
|
|
|
|
2013-05-15 15:40:15 +08:00
|
|
|
static void dpi_set_timings(struct omap_dss_device *dssdev,
|
2012-08-08 16:58:54 +08:00
|
|
|
struct omap_video_timings *timings)
|
2009-08-07 18:15:50 +08:00
|
|
|
{
|
2014-06-01 15:17:44 +08:00
|
|
|
struct dpi_data *dpi = dpi_get_data_from_dssdev(dssdev);
|
2014-05-30 18:56:22 +08:00
|
|
|
|
2009-08-07 18:15:50 +08:00
|
|
|
DSSDBG("dpi_set_timings\n");
|
2012-07-05 15:22:46 +08:00
|
|
|
|
2014-05-30 18:56:22 +08:00
|
|
|
mutex_lock(&dpi->lock);
|
2012-07-05 15:22:46 +08:00
|
|
|
|
2014-05-30 18:56:22 +08:00
|
|
|
dpi->timings = *timings;
|
2012-08-08 16:58:54 +08:00
|
|
|
|
2014-05-30 18:56:22 +08:00
|
|
|
mutex_unlock(&dpi->lock);
|
2009-08-07 18:15:50 +08:00
|
|
|
}
|
|
|
|
|
2013-05-24 18:18:52 +08:00
|
|
|
static void dpi_get_timings(struct omap_dss_device *dssdev,
|
|
|
|
struct omap_video_timings *timings)
|
|
|
|
{
|
2014-06-01 15:17:44 +08:00
|
|
|
struct dpi_data *dpi = dpi_get_data_from_dssdev(dssdev);
|
2014-05-30 18:56:22 +08:00
|
|
|
|
|
|
|
mutex_lock(&dpi->lock);
|
2013-05-24 18:18:52 +08:00
|
|
|
|
2014-05-30 18:56:22 +08:00
|
|
|
*timings = dpi->timings;
|
2013-05-24 18:18:52 +08:00
|
|
|
|
2014-05-30 18:56:22 +08:00
|
|
|
mutex_unlock(&dpi->lock);
|
2013-05-24 18:18:52 +08:00
|
|
|
}
|
|
|
|
|
2013-05-15 15:40:15 +08:00
|
|
|
static int dpi_check_timings(struct omap_dss_device *dssdev,
|
2009-08-07 18:15:50 +08:00
|
|
|
struct omap_video_timings *timings)
|
|
|
|
{
|
2014-06-01 15:17:44 +08:00
|
|
|
struct dpi_data *dpi = dpi_get_data_from_dssdev(dssdev);
|
2015-11-05 15:52:00 +08:00
|
|
|
enum omap_channel channel = dpi->output.dispc_channel;
|
2009-08-07 18:15:50 +08:00
|
|
|
int lck_div, pck_div;
|
|
|
|
unsigned long fck;
|
|
|
|
unsigned long pck;
|
2013-03-05 23:07:16 +08:00
|
|
|
struct dpi_clk_calc_ctx ctx;
|
|
|
|
bool ok;
|
2009-08-07 18:15:50 +08:00
|
|
|
|
2016-01-05 17:43:18 +08:00
|
|
|
if (timings->x_res % 8 != 0)
|
|
|
|
return -EINVAL;
|
|
|
|
|
2015-11-05 15:52:00 +08:00
|
|
|
if (!dispc_mgr_timings_ok(channel, timings))
|
2009-08-07 18:15:50 +08:00
|
|
|
return -EINVAL;
|
|
|
|
|
2013-04-10 19:12:14 +08:00
|
|
|
if (timings->pixelclock == 0)
|
2009-08-07 18:15:50 +08:00
|
|
|
return -EINVAL;
|
|
|
|
|
2014-10-22 19:49:14 +08:00
|
|
|
if (dpi->pll) {
|
2016-05-18 17:22:32 +08:00
|
|
|
ok = dpi_pll_clk_calc(dpi, timings->pixelclock, &ctx);
|
2013-03-05 23:07:16 +08:00
|
|
|
if (!ok)
|
|
|
|
return -EINVAL;
|
2009-08-07 18:15:50 +08:00
|
|
|
|
2016-05-18 17:22:32 +08:00
|
|
|
fck = ctx.pll_cinfo.clkout[ctx.clkout_idx];
|
2011-04-12 16:22:26 +08:00
|
|
|
} else {
|
2013-04-10 19:12:14 +08:00
|
|
|
ok = dpi_dss_clk_calc(timings->pixelclock, &ctx);
|
2013-03-05 23:07:16 +08:00
|
|
|
if (!ok)
|
|
|
|
return -EINVAL;
|
2009-08-07 18:15:50 +08:00
|
|
|
|
2013-10-31 20:44:23 +08:00
|
|
|
fck = ctx.fck;
|
2009-08-07 18:15:50 +08:00
|
|
|
}
|
2011-04-12 16:22:26 +08:00
|
|
|
|
2013-03-05 23:07:16 +08:00
|
|
|
lck_div = ctx.dispc_cinfo.lck_div;
|
|
|
|
pck_div = ctx.dispc_cinfo.pck_div;
|
2009-08-07 18:15:50 +08:00
|
|
|
|
2013-04-10 19:12:14 +08:00
|
|
|
pck = fck / lck_div / pck_div;
|
2009-08-07 18:15:50 +08:00
|
|
|
|
2013-04-10 19:12:14 +08:00
|
|
|
timings->pixelclock = pck;
|
2009-08-07 18:15:50 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-05-15 15:40:15 +08:00
|
|
|
static void dpi_set_data_lines(struct omap_dss_device *dssdev, int data_lines)
|
2012-07-06 18:00:52 +08:00
|
|
|
{
|
2014-06-01 15:17:44 +08:00
|
|
|
struct dpi_data *dpi = dpi_get_data_from_dssdev(dssdev);
|
2012-07-06 18:00:52 +08:00
|
|
|
|
2014-05-30 18:56:22 +08:00
|
|
|
mutex_lock(&dpi->lock);
|
2012-07-06 18:00:52 +08:00
|
|
|
|
2014-05-30 18:56:22 +08:00
|
|
|
dpi->data_lines = data_lines;
|
|
|
|
|
|
|
|
mutex_unlock(&dpi->lock);
|
2012-07-06 18:00:52 +08:00
|
|
|
}
|
|
|
|
|
2016-05-18 17:22:32 +08:00
|
|
|
static int dpi_verify_pll(struct dss_pll *pll)
|
2012-10-30 18:57:43 +08:00
|
|
|
{
|
|
|
|
int r;
|
|
|
|
|
|
|
|
/* do initial setup with the PLL to see if it is operational */
|
|
|
|
|
2014-10-22 19:49:14 +08:00
|
|
|
r = dss_pll_enable(pll);
|
2014-08-08 15:04:31 +08:00
|
|
|
if (r)
|
2012-10-30 18:57:43 +08:00
|
|
|
return r;
|
|
|
|
|
2014-10-22 19:49:14 +08:00
|
|
|
dss_pll_disable(pll);
|
2012-10-30 18:57:43 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-05-30 18:56:22 +08:00
|
|
|
static int dpi_init_regulator(struct dpi_data *dpi)
|
2013-04-19 21:52:27 +08:00
|
|
|
{
|
|
|
|
struct regulator *vdds_dsi;
|
|
|
|
|
|
|
|
if (!dss_has_feature(FEAT_DPI_USES_VDDS_DSI))
|
|
|
|
return 0;
|
|
|
|
|
2014-05-30 18:56:22 +08:00
|
|
|
if (dpi->vdds_dsi_reg)
|
2013-04-19 21:52:27 +08:00
|
|
|
return 0;
|
|
|
|
|
2014-05-30 18:56:22 +08:00
|
|
|
vdds_dsi = devm_regulator_get(&dpi->pdev->dev, "vdds_dsi");
|
2013-04-19 21:52:27 +08:00
|
|
|
if (IS_ERR(vdds_dsi)) {
|
2013-12-19 22:15:34 +08:00
|
|
|
if (PTR_ERR(vdds_dsi) != -EPROBE_DEFER)
|
|
|
|
DSSERR("can't get VDDS_DSI regulator\n");
|
2013-08-29 15:06:55 +08:00
|
|
|
return PTR_ERR(vdds_dsi);
|
2013-04-19 21:52:27 +08:00
|
|
|
}
|
|
|
|
|
2014-05-30 18:56:22 +08:00
|
|
|
dpi->vdds_dsi_reg = vdds_dsi;
|
2013-04-19 21:52:27 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-05-30 18:56:22 +08:00
|
|
|
static void dpi_init_pll(struct dpi_data *dpi)
|
2013-04-19 21:52:27 +08:00
|
|
|
{
|
2014-10-22 19:49:14 +08:00
|
|
|
struct dss_pll *pll;
|
2013-04-19 21:52:27 +08:00
|
|
|
|
2014-10-22 19:49:14 +08:00
|
|
|
if (dpi->pll)
|
2013-04-19 21:52:27 +08:00
|
|
|
return;
|
|
|
|
|
2016-05-17 21:08:54 +08:00
|
|
|
dpi->clk_src = dpi_get_clk_src(dpi->output.dispc_channel);
|
|
|
|
|
|
|
|
pll = dss_pll_find_by_src(dpi->clk_src);
|
2014-10-22 19:49:14 +08:00
|
|
|
if (!pll)
|
2013-04-19 21:52:27 +08:00
|
|
|
return;
|
|
|
|
|
2016-05-18 17:22:32 +08:00
|
|
|
if (dpi_verify_pll(pll)) {
|
|
|
|
DSSWARN("PLL not operational\n");
|
2013-04-19 21:52:27 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-10-22 19:49:14 +08:00
|
|
|
dpi->pll = pll;
|
2013-04-19 21:52:27 +08:00
|
|
|
}
|
|
|
|
|
2013-02-13 17:23:54 +08:00
|
|
|
/*
|
|
|
|
* Return a hardcoded channel for the DPI output. This should work for
|
|
|
|
* current use cases, but this can be later expanded to either resolve
|
|
|
|
* the channel in some more dynamic manner, or get the channel as a user
|
|
|
|
* parameter.
|
|
|
|
*/
|
2014-05-06 19:37:39 +08:00
|
|
|
static enum omap_channel dpi_get_channel(int port_num)
|
2013-02-13 17:23:54 +08:00
|
|
|
{
|
|
|
|
switch (omapdss_get_version()) {
|
|
|
|
case OMAPDSS_VER_OMAP24xx:
|
|
|
|
case OMAPDSS_VER_OMAP34xx_ES1:
|
|
|
|
case OMAPDSS_VER_OMAP34xx_ES3:
|
|
|
|
case OMAPDSS_VER_OMAP3630:
|
|
|
|
case OMAPDSS_VER_AM35xx:
|
2014-03-24 19:01:51 +08:00
|
|
|
case OMAPDSS_VER_AM43xx:
|
2013-02-13 17:23:54 +08:00
|
|
|
return OMAP_DSS_CHANNEL_LCD;
|
|
|
|
|
2014-12-31 17:26:06 +08:00
|
|
|
case OMAPDSS_VER_DRA7xx:
|
|
|
|
switch (port_num) {
|
|
|
|
case 2:
|
|
|
|
return OMAP_DSS_CHANNEL_LCD3;
|
|
|
|
case 1:
|
|
|
|
return OMAP_DSS_CHANNEL_LCD2;
|
|
|
|
case 0:
|
|
|
|
default:
|
|
|
|
return OMAP_DSS_CHANNEL_LCD;
|
|
|
|
}
|
|
|
|
|
2013-02-13 17:23:54 +08:00
|
|
|
case OMAPDSS_VER_OMAP4430_ES1:
|
|
|
|
case OMAPDSS_VER_OMAP4430_ES2:
|
|
|
|
case OMAPDSS_VER_OMAP4:
|
|
|
|
return OMAP_DSS_CHANNEL_LCD2;
|
|
|
|
|
|
|
|
case OMAPDSS_VER_OMAP5:
|
|
|
|
return OMAP_DSS_CHANNEL_LCD3;
|
|
|
|
|
|
|
|
default:
|
|
|
|
DSSWARN("unsupported DSS version\n");
|
|
|
|
return OMAP_DSS_CHANNEL_LCD;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-24 18:18:52 +08:00
|
|
|
static int dpi_connect(struct omap_dss_device *dssdev,
|
|
|
|
struct omap_dss_device *dst)
|
|
|
|
{
|
2014-06-01 15:17:44 +08:00
|
|
|
struct dpi_data *dpi = dpi_get_data_from_dssdev(dssdev);
|
2015-11-05 15:52:00 +08:00
|
|
|
enum omap_channel channel = dpi->output.dispc_channel;
|
2013-05-24 18:18:52 +08:00
|
|
|
int r;
|
|
|
|
|
2014-05-30 18:56:22 +08:00
|
|
|
r = dpi_init_regulator(dpi);
|
2013-05-24 18:18:52 +08:00
|
|
|
if (r)
|
|
|
|
return r;
|
|
|
|
|
2014-05-30 18:56:22 +08:00
|
|
|
dpi_init_pll(dpi);
|
2013-05-24 18:18:52 +08:00
|
|
|
|
2015-11-05 15:52:00 +08:00
|
|
|
r = dss_mgr_connect(channel, dssdev);
|
2013-05-24 18:18:52 +08:00
|
|
|
if (r)
|
|
|
|
return r;
|
|
|
|
|
|
|
|
r = omapdss_output_set_device(dssdev, dst);
|
|
|
|
if (r) {
|
|
|
|
DSSERR("failed to connect output to new device: %s\n",
|
|
|
|
dst->name);
|
2015-11-05 15:52:00 +08:00
|
|
|
dss_mgr_disconnect(channel, dssdev);
|
2013-05-24 18:18:52 +08:00
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void dpi_disconnect(struct omap_dss_device *dssdev,
|
|
|
|
struct omap_dss_device *dst)
|
|
|
|
{
|
2015-11-05 15:52:00 +08:00
|
|
|
struct dpi_data *dpi = dpi_get_data_from_dssdev(dssdev);
|
|
|
|
enum omap_channel channel = dpi->output.dispc_channel;
|
|
|
|
|
2013-07-24 18:06:54 +08:00
|
|
|
WARN_ON(dst != dssdev->dst);
|
2013-05-24 18:18:52 +08:00
|
|
|
|
2013-07-24 18:06:54 +08:00
|
|
|
if (dst != dssdev->dst)
|
2013-05-24 18:18:52 +08:00
|
|
|
return;
|
|
|
|
|
|
|
|
omapdss_output_unset_device(dssdev);
|
|
|
|
|
2015-11-05 15:52:00 +08:00
|
|
|
dss_mgr_disconnect(channel, dssdev);
|
2013-05-24 18:18:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static const struct omapdss_dpi_ops dpi_ops = {
|
|
|
|
.connect = dpi_connect,
|
|
|
|
.disconnect = dpi_disconnect,
|
|
|
|
|
2013-05-15 15:40:15 +08:00
|
|
|
.enable = dpi_display_enable,
|
|
|
|
.disable = dpi_display_disable,
|
2013-05-24 18:18:52 +08:00
|
|
|
|
|
|
|
.check_timings = dpi_check_timings,
|
2013-05-15 15:40:15 +08:00
|
|
|
.set_timings = dpi_set_timings,
|
2013-05-24 18:18:52 +08:00
|
|
|
.get_timings = dpi_get_timings,
|
|
|
|
|
2013-05-15 15:40:15 +08:00
|
|
|
.set_data_lines = dpi_set_data_lines,
|
2013-05-24 18:18:52 +08:00
|
|
|
};
|
|
|
|
|
2013-04-26 19:27:44 +08:00
|
|
|
static void dpi_init_output(struct platform_device *pdev)
|
2012-09-26 19:00:49 +08:00
|
|
|
{
|
2014-06-01 15:17:44 +08:00
|
|
|
struct dpi_data *dpi = dpi_get_data_from_pdev(pdev);
|
2014-05-30 18:56:22 +08:00
|
|
|
struct omap_dss_device *out = &dpi->output;
|
2012-09-26 19:00:49 +08:00
|
|
|
|
OMAPDSS: combine omap_dss_output into omap_dss_device
We currently have omap_dss_device, which represents an external display
device, sometimes an external encoder, sometimes a panel. Then we have
omap_dss_output, which represents DSS's output encoder.
In the future with new display device model, we construct a video
pipeline from the display blocks. To accomplish this, all the blocks
need to be presented by the same entity.
Thus, this patch combines omap_dss_output into omap_dss_device. Some of
the fields in omap_dss_output are already found in omap_dss_device, but
some are not. This means we'll have DSS output specific fields in
omap_dss_device, which is not very nice. However, it is easier to just
keep those output specific fields there for now, and after transition to
new display device model is made, they can be cleaned up easier than
could be done now.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2013-04-19 20:09:34 +08:00
|
|
|
out->dev = &pdev->dev;
|
2012-09-26 19:00:49 +08:00
|
|
|
out->id = OMAP_DSS_OUTPUT_DPI;
|
OMAPDSS: combine omap_dss_output into omap_dss_device
We currently have omap_dss_device, which represents an external display
device, sometimes an external encoder, sometimes a panel. Then we have
omap_dss_output, which represents DSS's output encoder.
In the future with new display device model, we construct a video
pipeline from the display blocks. To accomplish this, all the blocks
need to be presented by the same entity.
Thus, this patch combines omap_dss_output into omap_dss_device. Some of
the fields in omap_dss_output are already found in omap_dss_device, but
some are not. This means we'll have DSS output specific fields in
omap_dss_device, which is not very nice. However, it is easier to just
keep those output specific fields there for now, and after transition to
new display device model is made, they can be cleaned up easier than
could be done now.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2013-04-19 20:09:34 +08:00
|
|
|
out->output_type = OMAP_DISPLAY_TYPE_DPI;
|
2013-02-18 19:06:01 +08:00
|
|
|
out->name = "dpi.0";
|
2014-05-06 19:37:39 +08:00
|
|
|
out->dispc_channel = dpi_get_channel(0);
|
2013-05-24 18:18:52 +08:00
|
|
|
out->ops.dpi = &dpi_ops;
|
2013-05-03 16:42:18 +08:00
|
|
|
out->owner = THIS_MODULE;
|
2012-09-26 19:00:49 +08:00
|
|
|
|
2013-04-24 18:32:51 +08:00
|
|
|
omapdss_register_output(out);
|
2012-09-26 19:00:49 +08:00
|
|
|
}
|
|
|
|
|
2015-06-04 19:12:16 +08:00
|
|
|
static void dpi_uninit_output(struct platform_device *pdev)
|
2012-09-26 19:00:49 +08:00
|
|
|
{
|
2014-06-01 15:17:44 +08:00
|
|
|
struct dpi_data *dpi = dpi_get_data_from_pdev(pdev);
|
2014-05-30 18:56:22 +08:00
|
|
|
struct omap_dss_device *out = &dpi->output;
|
2012-09-26 19:00:49 +08:00
|
|
|
|
2013-04-24 18:32:51 +08:00
|
|
|
omapdss_unregister_output(out);
|
2012-09-26 19:00:49 +08:00
|
|
|
}
|
|
|
|
|
2014-06-02 16:41:51 +08:00
|
|
|
static void dpi_init_output_port(struct platform_device *pdev,
|
|
|
|
struct device_node *port)
|
|
|
|
{
|
|
|
|
struct dpi_data *dpi = port->data;
|
|
|
|
struct omap_dss_device *out = &dpi->output;
|
2014-05-06 19:37:39 +08:00
|
|
|
int r;
|
|
|
|
u32 port_num;
|
|
|
|
|
|
|
|
r = of_property_read_u32(port, "reg", &port_num);
|
|
|
|
if (r)
|
|
|
|
port_num = 0;
|
|
|
|
|
|
|
|
switch (port_num) {
|
|
|
|
case 2:
|
|
|
|
out->name = "dpi.2";
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
out->name = "dpi.1";
|
|
|
|
break;
|
|
|
|
case 0:
|
|
|
|
default:
|
|
|
|
out->name = "dpi.0";
|
|
|
|
break;
|
|
|
|
}
|
2014-06-02 16:41:51 +08:00
|
|
|
|
|
|
|
out->dev = &pdev->dev;
|
|
|
|
out->id = OMAP_DSS_OUTPUT_DPI;
|
|
|
|
out->output_type = OMAP_DISPLAY_TYPE_DPI;
|
2014-05-06 19:37:39 +08:00
|
|
|
out->dispc_channel = dpi_get_channel(port_num);
|
|
|
|
out->port_num = port_num;
|
2014-06-02 16:41:51 +08:00
|
|
|
out->ops.dpi = &dpi_ops;
|
|
|
|
out->owner = THIS_MODULE;
|
|
|
|
|
|
|
|
omapdss_register_output(out);
|
|
|
|
}
|
|
|
|
|
2015-06-04 19:12:16 +08:00
|
|
|
static void dpi_uninit_output_port(struct device_node *port)
|
2014-06-02 16:41:51 +08:00
|
|
|
{
|
|
|
|
struct dpi_data *dpi = port->data;
|
|
|
|
struct omap_dss_device *out = &dpi->output;
|
|
|
|
|
|
|
|
omapdss_unregister_output(out);
|
|
|
|
}
|
|
|
|
|
OMAPDSS: componentize omapdss
omapdss kernel module contains drivers for multiple devices, one for
each DSS submodule. The probing we have at the moment is a mess, and
doesn't give us proper deferred probing nor ensure that all the devices
are probed before omapfb/omapdrm start using omapdss.
This patch solves the mess by using the component system for DSS
submodules.
The changes to all DSS submodules (dispc, dpi, dsi, hdmi4/5, rfbi, sdi,
venc) are the same: probe & remove functions are changed to bind &
unbind, and new probe & remove functions are added which call
component_add/del.
The dss_core driver (dss.c) acts as a component master. Adding and
matching the components is simple: all dss device's child devices are
added as components.
However, we do have some dependencies between the drivers. The order in
which they should be probed is reflected by the list in core.c
(dss_output_drv_reg_funcs). The drivers are registered in that order,
which causes the components to be added in that order, which makes the
components to be bound in that order. This feels a bit fragile, and we
probably should improve the code to manage binds in random order.
However, for now, this works fine.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-06-04 20:22:23 +08:00
|
|
|
static int dpi_bind(struct device *dev, struct device *master, void *data)
|
2012-05-02 19:55:12 +08:00
|
|
|
{
|
OMAPDSS: componentize omapdss
omapdss kernel module contains drivers for multiple devices, one for
each DSS submodule. The probing we have at the moment is a mess, and
doesn't give us proper deferred probing nor ensure that all the devices
are probed before omapfb/omapdrm start using omapdss.
This patch solves the mess by using the component system for DSS
submodules.
The changes to all DSS submodules (dispc, dpi, dsi, hdmi4/5, rfbi, sdi,
venc) are the same: probe & remove functions are changed to bind &
unbind, and new probe & remove functions are added which call
component_add/del.
The dss_core driver (dss.c) acts as a component master. Adding and
matching the components is simple: all dss device's child devices are
added as components.
However, we do have some dependencies between the drivers. The order in
which they should be probed is reflected by the list in core.c
(dss_output_drv_reg_funcs). The drivers are registered in that order,
which causes the components to be added in that order, which makes the
components to be bound in that order. This feels a bit fragile, and we
probably should improve the code to manage binds in random order.
However, for now, this works fine.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-06-04 20:22:23 +08:00
|
|
|
struct platform_device *pdev = to_platform_device(dev);
|
2014-06-01 15:17:44 +08:00
|
|
|
struct dpi_data *dpi;
|
|
|
|
|
|
|
|
dpi = devm_kzalloc(&pdev->dev, sizeof(*dpi), GFP_KERNEL);
|
|
|
|
if (!dpi)
|
|
|
|
return -ENOMEM;
|
2014-05-30 18:56:22 +08:00
|
|
|
|
|
|
|
dpi->pdev = pdev;
|
2013-03-19 17:33:52 +08:00
|
|
|
|
2014-05-30 18:56:22 +08:00
|
|
|
dev_set_drvdata(&pdev->dev, dpi);
|
|
|
|
|
|
|
|
mutex_init(&dpi->lock);
|
2012-07-05 15:22:46 +08:00
|
|
|
|
2012-09-26 19:00:49 +08:00
|
|
|
dpi_init_output(pdev);
|
|
|
|
|
2011-02-22 21:53:46 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
OMAPDSS: componentize omapdss
omapdss kernel module contains drivers for multiple devices, one for
each DSS submodule. The probing we have at the moment is a mess, and
doesn't give us proper deferred probing nor ensure that all the devices
are probed before omapfb/omapdrm start using omapdss.
This patch solves the mess by using the component system for DSS
submodules.
The changes to all DSS submodules (dispc, dpi, dsi, hdmi4/5, rfbi, sdi,
venc) are the same: probe & remove functions are changed to bind &
unbind, and new probe & remove functions are added which call
component_add/del.
The dss_core driver (dss.c) acts as a component master. Adding and
matching the components is simple: all dss device's child devices are
added as components.
However, we do have some dependencies between the drivers. The order in
which they should be probed is reflected by the list in core.c
(dss_output_drv_reg_funcs). The drivers are registered in that order,
which causes the components to be added in that order, which makes the
components to be bound in that order. This feels a bit fragile, and we
probably should improve the code to manage binds in random order.
However, for now, this works fine.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-06-04 20:22:23 +08:00
|
|
|
static void dpi_unbind(struct device *dev, struct device *master, void *data)
|
2009-08-07 18:15:50 +08:00
|
|
|
{
|
OMAPDSS: componentize omapdss
omapdss kernel module contains drivers for multiple devices, one for
each DSS submodule. The probing we have at the moment is a mess, and
doesn't give us proper deferred probing nor ensure that all the devices
are probed before omapfb/omapdrm start using omapdss.
This patch solves the mess by using the component system for DSS
submodules.
The changes to all DSS submodules (dispc, dpi, dsi, hdmi4/5, rfbi, sdi,
venc) are the same: probe & remove functions are changed to bind &
unbind, and new probe & remove functions are added which call
component_add/del.
The dss_core driver (dss.c) acts as a component master. Adding and
matching the components is simple: all dss device's child devices are
added as components.
However, we do have some dependencies between the drivers. The order in
which they should be probed is reflected by the list in core.c
(dss_output_drv_reg_funcs). The drivers are registered in that order,
which causes the components to be added in that order, which makes the
components to be bound in that order. This feels a bit fragile, and we
probably should improve the code to manage binds in random order.
However, for now, this works fine.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-06-04 20:22:23 +08:00
|
|
|
struct platform_device *pdev = to_platform_device(dev);
|
|
|
|
|
2012-09-26 19:00:49 +08:00
|
|
|
dpi_uninit_output(pdev);
|
OMAPDSS: componentize omapdss
omapdss kernel module contains drivers for multiple devices, one for
each DSS submodule. The probing we have at the moment is a mess, and
doesn't give us proper deferred probing nor ensure that all the devices
are probed before omapfb/omapdrm start using omapdss.
This patch solves the mess by using the component system for DSS
submodules.
The changes to all DSS submodules (dispc, dpi, dsi, hdmi4/5, rfbi, sdi,
venc) are the same: probe & remove functions are changed to bind &
unbind, and new probe & remove functions are added which call
component_add/del.
The dss_core driver (dss.c) acts as a component master. Adding and
matching the components is simple: all dss device's child devices are
added as components.
However, we do have some dependencies between the drivers. The order in
which they should be probed is reflected by the list in core.c
(dss_output_drv_reg_funcs). The drivers are registered in that order,
which causes the components to be added in that order, which makes the
components to be bound in that order. This feels a bit fragile, and we
probably should improve the code to manage binds in random order.
However, for now, this works fine.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-06-04 20:22:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static const struct component_ops dpi_component_ops = {
|
|
|
|
.bind = dpi_bind,
|
|
|
|
.unbind = dpi_unbind,
|
|
|
|
};
|
2012-09-26 19:00:49 +08:00
|
|
|
|
OMAPDSS: componentize omapdss
omapdss kernel module contains drivers for multiple devices, one for
each DSS submodule. The probing we have at the moment is a mess, and
doesn't give us proper deferred probing nor ensure that all the devices
are probed before omapfb/omapdrm start using omapdss.
This patch solves the mess by using the component system for DSS
submodules.
The changes to all DSS submodules (dispc, dpi, dsi, hdmi4/5, rfbi, sdi,
venc) are the same: probe & remove functions are changed to bind &
unbind, and new probe & remove functions are added which call
component_add/del.
The dss_core driver (dss.c) acts as a component master. Adding and
matching the components is simple: all dss device's child devices are
added as components.
However, we do have some dependencies between the drivers. The order in
which they should be probed is reflected by the list in core.c
(dss_output_drv_reg_funcs). The drivers are registered in that order,
which causes the components to be added in that order, which makes the
components to be bound in that order. This feels a bit fragile, and we
probably should improve the code to manage binds in random order.
However, for now, this works fine.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-06-04 20:22:23 +08:00
|
|
|
static int dpi_probe(struct platform_device *pdev)
|
|
|
|
{
|
|
|
|
return component_add(&pdev->dev, &dpi_component_ops);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int dpi_remove(struct platform_device *pdev)
|
|
|
|
{
|
|
|
|
component_del(&pdev->dev, &dpi_component_ops);
|
2012-02-20 22:57:37 +08:00
|
|
|
return 0;
|
2009-08-07 18:15:50 +08:00
|
|
|
}
|
|
|
|
|
2012-02-20 22:57:37 +08:00
|
|
|
static struct platform_driver omap_dpi_driver = {
|
OMAPDSS: componentize omapdss
omapdss kernel module contains drivers for multiple devices, one for
each DSS submodule. The probing we have at the moment is a mess, and
doesn't give us proper deferred probing nor ensure that all the devices
are probed before omapfb/omapdrm start using omapdss.
This patch solves the mess by using the component system for DSS
submodules.
The changes to all DSS submodules (dispc, dpi, dsi, hdmi4/5, rfbi, sdi,
venc) are the same: probe & remove functions are changed to bind &
unbind, and new probe & remove functions are added which call
component_add/del.
The dss_core driver (dss.c) acts as a component master. Adding and
matching the components is simple: all dss device's child devices are
added as components.
However, we do have some dependencies between the drivers. The order in
which they should be probed is reflected by the list in core.c
(dss_output_drv_reg_funcs). The drivers are registered in that order,
which causes the components to be added in that order, which makes the
components to be bound in that order. This feels a bit fragile, and we
probably should improve the code to manage binds in random order.
However, for now, this works fine.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-06-04 20:22:23 +08:00
|
|
|
.probe = dpi_probe,
|
|
|
|
.remove = dpi_remove,
|
2012-02-20 22:57:37 +08:00
|
|
|
.driver = {
|
|
|
|
.name = "omapdss_dpi",
|
2014-10-16 14:54:25 +08:00
|
|
|
.suppress_bind_attrs = true,
|
2012-02-20 22:57:37 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2012-02-17 23:41:13 +08:00
|
|
|
int __init dpi_init_platform_driver(void)
|
2012-02-20 22:57:37 +08:00
|
|
|
{
|
2013-04-26 19:27:44 +08:00
|
|
|
return platform_driver_register(&omap_dpi_driver);
|
2012-02-20 22:57:37 +08:00
|
|
|
}
|
|
|
|
|
2015-06-04 19:12:16 +08:00
|
|
|
void dpi_uninit_platform_driver(void)
|
2012-02-20 22:57:37 +08:00
|
|
|
{
|
|
|
|
platform_driver_unregister(&omap_dpi_driver);
|
|
|
|
}
|
2013-12-16 21:13:24 +08:00
|
|
|
|
2015-06-04 19:12:16 +08:00
|
|
|
int dpi_init_port(struct platform_device *pdev, struct device_node *port)
|
2013-12-16 21:13:24 +08:00
|
|
|
{
|
2014-06-01 15:17:44 +08:00
|
|
|
struct dpi_data *dpi;
|
2013-12-16 21:13:24 +08:00
|
|
|
struct device_node *ep;
|
|
|
|
u32 datalines;
|
|
|
|
int r;
|
|
|
|
|
2014-06-01 15:17:44 +08:00
|
|
|
dpi = devm_kzalloc(&pdev->dev, sizeof(*dpi), GFP_KERNEL);
|
|
|
|
if (!dpi)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
2013-12-16 21:13:24 +08:00
|
|
|
ep = omapdss_of_get_next_endpoint(port, NULL);
|
|
|
|
if (!ep)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
r = of_property_read_u32(ep, "data-lines", &datalines);
|
|
|
|
if (r) {
|
|
|
|
DSSERR("failed to parse datalines\n");
|
|
|
|
goto err_datalines;
|
|
|
|
}
|
|
|
|
|
2014-05-30 18:56:22 +08:00
|
|
|
dpi->data_lines = datalines;
|
2013-12-16 21:13:24 +08:00
|
|
|
|
|
|
|
of_node_put(ep);
|
|
|
|
|
2014-05-30 18:56:22 +08:00
|
|
|
dpi->pdev = pdev;
|
2014-06-02 16:41:51 +08:00
|
|
|
port->data = dpi;
|
2013-12-16 21:13:24 +08:00
|
|
|
|
2014-05-30 18:56:22 +08:00
|
|
|
mutex_init(&dpi->lock);
|
2013-12-16 21:13:24 +08:00
|
|
|
|
2014-06-02 16:41:51 +08:00
|
|
|
dpi_init_output_port(pdev, port);
|
2013-12-16 21:13:24 +08:00
|
|
|
|
2014-05-30 18:56:22 +08:00
|
|
|
dpi->port_initialized = true;
|
2013-12-16 21:13:24 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
err_datalines:
|
|
|
|
of_node_put(ep);
|
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
2015-06-04 19:12:16 +08:00
|
|
|
void dpi_uninit_port(struct device_node *port)
|
2013-12-16 21:13:24 +08:00
|
|
|
{
|
2014-06-02 16:41:51 +08:00
|
|
|
struct dpi_data *dpi = port->data;
|
2014-05-30 18:56:22 +08:00
|
|
|
|
|
|
|
if (!dpi->port_initialized)
|
2013-12-16 21:13:24 +08:00
|
|
|
return;
|
|
|
|
|
2014-06-02 16:41:51 +08:00
|
|
|
dpi_uninit_output_port(port);
|
2013-12-16 21:13:24 +08:00
|
|
|
}
|