Release 4.17 drivers/gpu/drm/omapdrm/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>
#include <linux/export.h>
#include <linux/err.h>
#include <linux/errno.h>
#include <linux/platform_device.h>
#include <linux/regulator/consumer.h>
#include <linux/string.h>
#include <linux/of.h>
#include <linux/clk.h>
#include <linux/sys_soc.h>
#include "omapdss.h"
#include "dss.h"
struct dpi_data {
	
struct platform_device *pdev;
	
enum dss_model dss_model;
	
struct dss_device *dss;
	
struct regulator *vdds_dsi_reg;
	
enum dss_clk_source clk_src;
	
struct dss_pll *pll;
	
struct mutex lock;
	
struct videomode vm;
	
struct dss_lcd_mgr_config mgr_config;
	
int data_lines;
	
struct omap_dss_device output;
};
static struct dpi_data *dpi_get_data_from_dssdev(struct omap_dss_device *dssdev)
{
	return container_of(dssdev, struct dpi_data, output);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Archit Taneja | 24 | 100.00% | 2 | 100.00% | 
| Total | 24 | 100.00% | 2 | 100.00% | 
static enum dss_clk_source dpi_get_clk_src_dra7xx(struct dpi_data *dpi,
						  enum omap_channel channel)
{
	/*
         * Possible clock sources:
         * LCD1: FCK/PLL1_1/HDMI_PLL
         * LCD2: FCK/PLL1_3/HDMI_PLL (DRA74x: PLL2_3)
         * LCD3: FCK/PLL1_3/HDMI_PLL (DRA74x: PLL2_1)
         */
	switch (channel) {
	case OMAP_DSS_CHANNEL_LCD:
	{
		if (dss_pll_find_by_src(dpi->dss, DSS_CLK_SRC_PLL1_1))
			return DSS_CLK_SRC_PLL1_1;
		break;
	}
	case OMAP_DSS_CHANNEL_LCD2:
	{
		if (dss_pll_find_by_src(dpi->dss, DSS_CLK_SRC_PLL1_3))
			return DSS_CLK_SRC_PLL1_3;
		if (dss_pll_find_by_src(dpi->dss, DSS_CLK_SRC_PLL2_3))
			return DSS_CLK_SRC_PLL2_3;
		break;
	}
	case OMAP_DSS_CHANNEL_LCD3:
	{
		if (dss_pll_find_by_src(dpi->dss, DSS_CLK_SRC_PLL2_1))
			return DSS_CLK_SRC_PLL2_1;
		if (dss_pll_find_by_src(dpi->dss, DSS_CLK_SRC_PLL1_3))
			return DSS_CLK_SRC_PLL1_3;
		break;
	}
	default:
		break;
	}
	return DSS_CLK_SRC_FCK;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Tomi Valkeinen | 91 | 78.45% | 1 | 50.00% | 
| Laurent Pinchart | 25 | 21.55% | 1 | 50.00% | 
| Total | 116 | 100.00% | 2 | 100.00% | 
static enum dss_clk_source dpi_get_clk_src(struct dpi_data *dpi)
{
	enum omap_channel channel = dpi->output.dispc_channel;
	/*
         * 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 (dpi->dss_model) {
	case DSS_MODEL_OMAP2:
	case DSS_MODEL_OMAP3:
		return DSS_CLK_SRC_FCK;
	case DSS_MODEL_OMAP4:
		switch (channel) {
		case OMAP_DSS_CHANNEL_LCD:
			return DSS_CLK_SRC_PLL1_1;
		case OMAP_DSS_CHANNEL_LCD2:
			return DSS_CLK_SRC_PLL2_1;
		default:
			return DSS_CLK_SRC_FCK;
		}
	case DSS_MODEL_OMAP5:
		switch (channel) {
		case OMAP_DSS_CHANNEL_LCD:
			return DSS_CLK_SRC_PLL1_1;
		case OMAP_DSS_CHANNEL_LCD3:
			return DSS_CLK_SRC_PLL2_1;
		case OMAP_DSS_CHANNEL_LCD2:
		default:
			return DSS_CLK_SRC_FCK;
		}
	case DSS_MODEL_DRA7:
		return dpi_get_clk_src_dra7xx(dpi, channel);
	default:
		return DSS_CLK_SRC_FCK;
	}
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Tomi Valkeinen | 78 | 72.22% | 8 | 61.54% | 
| Laurent Pinchart | 23 | 21.30% | 2 | 15.38% | 
| Archit Taneja | 6 | 5.56% | 2 | 15.38% | 
| Sathya Prakash M R | 1 | 0.93% | 1 | 7.69% | 
| Total | 108 | 100.00% | 13 | 100.00% | 
struct dpi_clk_calc_ctx {
	
struct dpi_data *dpi;
	
unsigned int clkout_idx;
	/* inputs */
	
unsigned long pck_min, pck_max;
	/* outputs */
	
struct dss_pll_clock_info pll_cinfo;
	
unsigned long fck;
	
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.
         */
	if (ctx->pck_min >= 100000000) {
		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;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Tomi Valkeinen | 107 | 100.00% | 2 | 100.00% | 
| Total | 107 | 100.00% | 2 | 100.00% | 
static bool dpi_calc_hsdiv_cb(int m_dispc, unsigned long dispc,
		void *data)
{
	struct dpi_clk_calc_ctx *ctx = data;
	ctx->pll_cinfo.mX[ctx->clkout_idx] = m_dispc;
	ctx->pll_cinfo.clkout[ctx->clkout_idx] = dispc;
	return dispc_div_calc(ctx->dpi->dss->dispc, dispc,
			      ctx->pck_min, ctx->pck_max,
			      dpi_calc_dispc_cb, ctx);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Tomi Valkeinen | 69 | 90.79% | 6 | 85.71% | 
| Laurent Pinchart | 7 | 9.21% | 1 | 14.29% | 
| Total | 76 | 100.00% | 7 | 100.00% | 
static bool dpi_calc_pll_cb(int n, int m, unsigned long fint,
		unsigned long clkdco,
		void *data)
{
	struct dpi_clk_calc_ctx *ctx = data;
	ctx->pll_cinfo.n = n;
	ctx->pll_cinfo.m = m;
	ctx->pll_cinfo.fint = fint;
	ctx->pll_cinfo.clkdco = clkdco;
	return dss_pll_hsdiv_calc_a(ctx->dpi->pll, clkdco,
		ctx->pck_min, dss_get_max_fck_rate(ctx->dpi->dss),
		dpi_calc_hsdiv_cb, ctx);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Tomi Valkeinen | 85 | 92.39% | 6 | 75.00% | 
| Laurent Pinchart | 7 | 7.61% | 2 | 25.00% | 
| Total | 92 | 100.00% | 8 | 100.00% | 
static bool dpi_calc_dss_cb(unsigned long fck, void *data)
{
	struct dpi_clk_calc_ctx *ctx = data;
	ctx->fck = fck;
	return dispc_div_calc(ctx->dpi->dss->dispc, fck,
			      ctx->pck_min, ctx->pck_max,
			      dpi_calc_dispc_cb, ctx);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Tomi Valkeinen | 46 | 86.79% | 2 | 66.67% | 
| Laurent Pinchart | 7 | 13.21% | 1 | 33.33% | 
| Total | 53 | 100.00% | 3 | 100.00% | 
static bool dpi_pll_clk_calc(struct dpi_data *dpi, unsigned long pck,
		struct dpi_clk_calc_ctx *ctx)
{
	unsigned long clkin;
	memset(ctx, 0, sizeof(*ctx));
	ctx->dpi = dpi;
	ctx->clkout_idx = dss_pll_get_clkout_idx_for_src(dpi->clk_src);
	clkin = clk_get_rate(dpi->pll->clkin);
	if (dpi->pll->hw->type == DSS_PLL_TYPE_A) {
		unsigned long pll_min, pll_max;
		ctx->pck_min = pck - 1000;
		ctx->pck_max = pck + 1000;
		pll_min = 0;
		pll_max = 0;
		return dss_pll_calc_a(ctx->dpi->pll, clkin,
				pll_min, pll_max,
				dpi_calc_pll_cb, ctx);
	} else { /* DSS_PLL_TYPE_B */
		dss_pll_calc_b(dpi->pll, clkin, pck, &ctx->pll_cinfo);
		ctx->dispc_cinfo.lck_div = 1;
		ctx->dispc_cinfo.pck_div = 1;
		ctx->dispc_cinfo.lck = ctx->pll_cinfo.clkout[0];
		ctx->dispc_cinfo.pck = ctx->dispc_cinfo.lck;
		return true;
	}
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Tomi Valkeinen | 189 | 96.92% | 7 | 87.50% | 
| Archit Taneja | 6 | 3.08% | 1 | 12.50% | 
| Total | 195 | 100.00% | 8 | 100.00% | 
static bool dpi_dss_clk_calc(struct dpi_data *dpi, 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
         * +/- ~15MHz.
         */
	for (i = 0; i < 25; ++i) {
		bool ok;
		memset(ctx, 0, sizeof(*ctx));
		ctx->dpi = dpi;
		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;
		ok = dss_div_calc(dpi->dss, pck, ctx->pck_min,
				  dpi_calc_dss_cb, ctx);
		if (ok)
			return ok;
	}
	return false;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Tomi Valkeinen | 133 | 93.66% | 4 | 80.00% | 
| Laurent Pinchart | 9 | 6.34% | 1 | 20.00% | 
| Total | 142 | 100.00% | 5 | 100.00% | 
static int dpi_set_pll_clk(struct dpi_data *dpi, enum omap_channel channel,
		unsigned long pck_req, unsigned long *fck, int *lck_div,
		int *pck_div)
{
	struct dpi_clk_calc_ctx ctx;
	int r;
	bool ok;
	ok = dpi_pll_clk_calc(dpi, pck_req, &ctx);
	if (!ok)
		return -EINVAL;
	r = dss_pll_set_config(dpi->pll, &ctx.pll_cinfo);
	if (r)
		return r;
	dss_select_lcd_clk_source(dpi->dss, channel, dpi->clk_src);
	dpi->mgr_config.clock_info = ctx.dispc_cinfo;
	*fck = ctx.pll_cinfo.clkout[ctx.clkout_idx];
	*lck_div = ctx.dispc_cinfo.lck_div;
	*pck_div = ctx.dispc_cinfo.pck_div;
	return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Tomi Valkeinen | 121 | 85.21% | 9 | 64.29% | 
| Archit Taneja | 16 | 11.27% | 3 | 21.43% | 
| Laurent Pinchart | 4 | 2.82% | 1 | 7.14% | 
| Sumit Semwal | 1 | 0.70% | 1 | 7.14% | 
| Total | 142 | 100.00% | 14 | 100.00% | 
static int dpi_set_dispc_clk(struct dpi_data *dpi, unsigned long pck_req,
		unsigned long *fck, int *lck_div, int *pck_div)
{
	struct dpi_clk_calc_ctx ctx;
	int r;
	bool ok;
	ok = dpi_dss_clk_calc(dpi, pck_req, &ctx);
	if (!ok)
		return -EINVAL;
	r = dss_set_fck_rate(dpi->dss, ctx.fck);
	if (r)
		return r;
	dpi->mgr_config.clock_info = ctx.dispc_cinfo;
	*fck = ctx.fck;
	*lck_div = ctx.dispc_cinfo.lck_div;
	*pck_div = ctx.dispc_cinfo.pck_div;
	return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Tomi Valkeinen | 100 | 85.47% | 3 | 50.00% | 
| Archit Taneja | 11 | 9.40% | 2 | 33.33% | 
| Laurent Pinchart | 6 | 5.13% | 1 | 16.67% | 
| Total | 117 | 100.00% | 6 | 100.00% | 
static int dpi_set_mode(struct dpi_data *dpi)
{
	struct videomode *vm = &dpi->vm;
	int lck_div = 0, pck_div = 0;
	unsigned long fck = 0;
	unsigned long pck;
	int r = 0;
	if (dpi->pll)
		r = dpi_set_pll_clk(dpi, dpi->output.dispc_channel,
				    vm->pixelclock, &fck, &lck_div, &pck_div);
	else
		r = dpi_set_dispc_clk(dpi, vm->pixelclock, &fck,
				&lck_div, &pck_div);
	if (r)
		return r;
	pck = fck / lck_div / pck_div;
	if (pck != vm->pixelclock) {
		DSSWARN("Could not find exact pixel clock. Requested %lu Hz, got %lu Hz\n",
			vm->pixelclock, pck);
		vm->pixelclock = pck;
	}
	dss_mgr_set_timings(&dpi->output, vm);
	return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Tomi Valkeinen | 112 | 73.20% | 6 | 37.50% | 
| Archit Taneja | 20 | 13.07% | 4 | 25.00% | 
| Peter Ujfalusi | 10 | 6.54% | 3 | 18.75% | 
| Laurent Pinchart | 9 | 5.88% | 1 | 6.25% | 
| Sumit Semwal | 2 | 1.31% | 2 | 12.50% | 
| Total | 153 | 100.00% | 16 | 100.00% | 
static void dpi_config_lcd_manager(struct dpi_data *dpi)
{
	dpi->mgr_config.io_pad_mode = DSS_IO_PAD_MODE_BYPASS;
	dpi->mgr_config.stallmode = false;
	dpi->mgr_config.fifohandcheck = false;
	dpi->mgr_config.video_port_width = dpi->data_lines;
	dpi->mgr_config.lcden_sig_polarity = 0;
	dss_mgr_set_lcd_config(&dpi->output, &dpi->mgr_config);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Archit Taneja | 52 | 78.79% | 4 | 50.00% | 
| Tomi Valkeinen | 10 | 15.15% | 3 | 37.50% | 
| Laurent Pinchart | 4 | 6.06% | 1 | 12.50% | 
| Total | 66 | 100.00% | 8 | 100.00% | 
static int dpi_display_enable(struct omap_dss_device *dssdev)
{
	struct dpi_data *dpi = dpi_get_data_from_dssdev(dssdev);
	struct omap_dss_device *out = &dpi->output;
	int r;
	mutex_lock(&dpi->lock);
	if (!out->dispc_channel_connected) {
		DSSERR("failed to enable display: no output/manager\n");
		r = -ENODEV;
		goto err_no_out_mgr;
	}
	if (dpi->vdds_dsi_reg) {
		r = regulator_enable(dpi->vdds_dsi_reg);
		if (r)
			goto err_reg_enable;
	}
	r = dispc_runtime_get(dpi->dss->dispc);
	if (r)
		goto err_get_dispc;
	r = dss_dpi_select_source(dpi->dss, out->port_num, out->dispc_channel);
	if (r)
		goto err_src_sel;
	if (dpi->pll) {
		r = dss_pll_enable(dpi->pll);
		if (r)
			goto err_pll_init;
	}
	r = dpi_set_mode(dpi);
	if (r)
		goto err_set_mode;
	dpi_config_lcd_manager(dpi);
	mdelay(2);
	r = dss_mgr_enable(&dpi->output);
	if (r)
		goto err_mgr_enable;
	mutex_unlock(&dpi->lock);
	return 0;
err_mgr_enable:
err_set_mode:
	if (dpi->pll)
		dss_pll_disable(dpi->pll);
err_pll_init:
err_src_sel:
	dispc_runtime_put(dpi->dss->dispc);
err_get_dispc:
	if (dpi->vdds_dsi_reg)
		regulator_disable(dpi->vdds_dsi_reg);
err_reg_enable:
err_no_out_mgr:
	mutex_unlock(&dpi->lock);
	return r;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Tomi Valkeinen | 160 | 60.15% | 15 | 55.56% | 
| Archit Taneja | 75 | 28.20% | 8 | 29.63% | 
| Laurent Pinchart | 31 | 11.65% | 4 | 14.81% | 
| Total | 266 | 100.00% | 27 | 100.00% | 
static void dpi_display_disable(struct omap_dss_device *dssdev)
{
	struct dpi_data *dpi = dpi_get_data_from_dssdev(dssdev);
	mutex_lock(&dpi->lock);
	dss_mgr_disable(&dpi->output);
	if (dpi->pll) {
		dss_select_lcd_clk_source(dpi->dss, dpi->output.dispc_channel,
					  DSS_CLK_SRC_FCK);
		dss_pll_disable(dpi->pll);
	}
	dispc_runtime_put(dpi->dss->dispc);
	if (dpi->vdds_dsi_reg)
		regulator_disable(dpi->vdds_dsi_reg);
	mutex_unlock(&dpi->lock);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Tomi Valkeinen | 40 | 41.24% | 10 | 50.00% | 
| Archit Taneja | 34 | 35.05% | 6 | 30.00% | 
| Laurent Pinchart | 23 | 23.71% | 4 | 20.00% | 
| Total | 97 | 100.00% | 20 | 100.00% | 
static void dpi_set_timings(struct omap_dss_device *dssdev,
			    struct videomode *vm)
{
	struct dpi_data *dpi = dpi_get_data_from_dssdev(dssdev);
	DSSDBG("dpi_set_timings\n");
	mutex_lock(&dpi->lock);
	dpi->vm = *vm;
	mutex_unlock(&dpi->lock);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Archit Taneja | 31 | 57.41% | 4 | 50.00% | 
| Tomi Valkeinen | 19 | 35.19% | 2 | 25.00% | 
| Peter Ujfalusi | 4 | 7.41% | 2 | 25.00% | 
| Total | 54 | 100.00% | 8 | 100.00% | 
static void dpi_get_timings(struct omap_dss_device *dssdev,
			    struct videomode *vm)
{
	struct dpi_data *dpi = dpi_get_data_from_dssdev(dssdev);
	mutex_lock(&dpi->lock);
	*vm = dpi->vm;
	mutex_unlock(&dpi->lock);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Tomi Valkeinen | 32 | 65.31% | 1 | 20.00% | 
| Archit Taneja | 13 | 26.53% | 2 | 40.00% | 
| Peter Ujfalusi | 4 | 8.16% | 2 | 40.00% | 
| Total | 49 | 100.00% | 5 | 100.00% | 
static int dpi_check_timings(struct omap_dss_device *dssdev,
			     struct videomode *vm)
{
	struct dpi_data *dpi = dpi_get_data_from_dssdev(dssdev);
	enum omap_channel channel = dpi->output.dispc_channel;
	int lck_div, pck_div;
	unsigned long fck;
	unsigned long pck;
	struct dpi_clk_calc_ctx ctx;
	bool ok;
	if (vm->hactive % 8 != 0)
		return -EINVAL;
	if (!dispc_mgr_timings_ok(dpi->dss->dispc, channel, vm))
		return -EINVAL;
	if (vm->pixelclock == 0)
		return -EINVAL;
	if (dpi->pll) {
		ok = dpi_pll_clk_calc(dpi, vm->pixelclock, &ctx);
		if (!ok)
			return -EINVAL;
		fck = ctx.pll_cinfo.clkout[ctx.clkout_idx];
	} else {
		ok = dpi_dss_clk_calc(dpi, vm->pixelclock, &ctx);
		if (!ok)
			return -EINVAL;
		fck = ctx.fck;
	}
	lck_div = ctx.dispc_cinfo.lck_div;
	pck_div = ctx.dispc_cinfo.pck_div;
	pck = fck / lck_div / pck_div;
	vm->pixelclock = pck;
	return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Tomi Valkeinen | 169 | 80.09% | 13 | 56.52% | 
| Archit Taneja | 25 | 11.85% | 5 | 21.74% | 
| Peter Ujfalusi | 9 | 4.27% | 3 | 13.04% | 
| Laurent Pinchart | 8 | 3.79% | 2 | 8.70% | 
| Total | 211 | 100.00% | 23 | 100.00% | 
static int dpi_verify_pll(struct dss_pll *pll)
{
	int r;
	/* do initial setup with the PLL to see if it is operational */
	r = dss_pll_enable(pll);
	if (r)
		return r;
	dss_pll_disable(pll);
	return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Tomi Valkeinen | 37 | 100.00% | 3 | 100.00% | 
| Total | 37 | 100.00% | 3 | 100.00% | 
static const struct soc_device_attribute dpi_soc_devices[] = {
	{ .machine = "OMAP3[456]*" },
	{ .machine = "[AD]M37*" },
	{ /* sentinel */ }
};
static int dpi_init_regulator(struct dpi_data *dpi)
{
	struct regulator *vdds_dsi;
	/*
         * The DPI uses the DSI VDDS on OMAP34xx, OMAP35xx, OMAP36xx, AM37xx and
         * DM37xx only.
         */
	if (!soc_device_match(dpi_soc_devices))
		return 0;
	if (dpi->vdds_dsi_reg)
		return 0;
	vdds_dsi = devm_regulator_get(&dpi->pdev->dev, "vdds_dsi");
	if (IS_ERR(vdds_dsi)) {
		if (PTR_ERR(vdds_dsi) != -EPROBE_DEFER)
			DSSERR("can't get VDDS_DSI regulator\n");
		return PTR_ERR(vdds_dsi);
	}
	dpi->vdds_dsi_reg = vdds_dsi;
	return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Tomi Valkeinen | 78 | 86.67% | 8 | 72.73% | 
| Archit Taneja | 7 | 7.78% | 1 | 9.09% | 
| Laurent Pinchart | 3 | 3.33% | 1 | 9.09% | 
| Chandrabhanu Mahapatra | 2 | 2.22% | 1 | 9.09% | 
| Total | 90 | 100.00% | 11 | 100.00% | 
static void dpi_init_pll(struct dpi_data *dpi)
{
	struct dss_pll *pll;
	if (dpi->pll)
		return;
	dpi->clk_src = dpi_get_clk_src(dpi);
	pll = dss_pll_find_by_src(dpi->dss, dpi->clk_src);
	if (!pll)
		return;
	if (dpi_verify_pll(pll)) {
		DSSWARN("PLL not operational\n");
		return;
	}
	dpi->pll = pll;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Tomi Valkeinen | 58 | 80.56% | 7 | 70.00% | 
| Archit Taneja | 10 | 13.89% | 2 | 20.00% | 
| Laurent Pinchart | 4 | 5.56% | 1 | 10.00% | 
| Total | 72 | 100.00% | 10 | 100.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.
 */
static enum omap_channel dpi_get_channel(struct dpi_data *dpi, int port_num)
{
	switch (dpi->dss_model) {
	case DSS_MODEL_OMAP2:
	case DSS_MODEL_OMAP3:
		return OMAP_DSS_CHANNEL_LCD;
	case DSS_MODEL_DRA7:
		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;
		}
	case DSS_MODEL_OMAP4:
		return OMAP_DSS_CHANNEL_LCD2;
	case DSS_MODEL_OMAP5:
		return OMAP_DSS_CHANNEL_LCD3;
	default:
		DSSWARN("unsupported DSS version\n");
		return OMAP_DSS_CHANNEL_LCD;
	}
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Tomi Valkeinen | 64 | 79.01% | 4 | 57.14% | 
| Laurent Pinchart | 13 | 16.05% | 1 | 14.29% | 
| Archit Taneja | 2 | 2.47% | 1 | 14.29% | 
| Sathya Prakash M R | 2 | 2.47% | 1 | 14.29% | 
| Total | 81 | 100.00% | 7 | 100.00% | 
static int dpi_connect(struct omap_dss_device *dssdev,
		struct omap_dss_device *dst)
{
	struct dpi_data *dpi = dpi_get_data_from_dssdev(dssdev);
	int r;
	r = dpi_init_regulator(dpi);
	if (r)
		return r;
	dpi_init_pll(dpi);
	r = dss_mgr_connect(&dpi->output, dssdev);
	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);
		dss_mgr_disconnect(&dpi->output, dssdev);
		return r;
	}
	return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Tomi Valkeinen | 84 | 78.50% | 1 | 25.00% | 
| Archit Taneja | 15 | 14.02% | 2 | 50.00% | 
| Laurent Pinchart | 8 | 7.48% | 1 | 25.00% | 
| Total | 107 | 100.00% | 4 | 100.00% | 
static void dpi_disconnect(struct omap_dss_device *dssdev,
		struct omap_dss_device *dst)
{
	struct dpi_data *dpi = dpi_get_data_from_dssdev(dssdev);
	WARN_ON(dst != dssdev->dst);
	if (dst != dssdev->dst)
		return;
	omapdss_output_unset_device(dssdev);
	dss_mgr_disconnect(&dpi->output, dssdev);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Tomi Valkeinen | 55 | 93.22% | 3 | 75.00% | 
| Laurent Pinchart | 4 | 6.78% | 1 | 25.00% | 
| Total | 59 | 100.00% | 4 | 100.00% | 
static const struct omapdss_dpi_ops dpi_ops = {
	.connect = dpi_connect,
	.disconnect = dpi_disconnect,
	.enable = dpi_display_enable,
	.disable = dpi_display_disable,
	.check_timings = dpi_check_timings,
	.set_timings = dpi_set_timings,
	.get_timings = dpi_get_timings,
};
static void dpi_init_output_port(struct dpi_data *dpi, struct device_node *port)
{
	struct omap_dss_device *out = &dpi->output;
	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;
	}
	out->dev = &dpi->pdev->dev;
	out->id = OMAP_DSS_OUTPUT_DPI;
	out->output_type = OMAP_DISPLAY_TYPE_DPI;
	out->dispc_channel = dpi_get_channel(dpi, port_num);
	out->port_num = port_num;
	out->ops.dpi = &dpi_ops;
	out->owner = THIS_MODULE;
	omapdss_register_output(out);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Archit Taneja | 143 | 95.97% | 2 | 66.67% | 
| Laurent Pinchart | 6 | 4.03% | 1 | 33.33% | 
| Total | 149 | 100.00% | 3 | 100.00% | 
static void dpi_uninit_output_port(struct device_node *port)
{
	struct dpi_data *dpi = port->data;
	struct omap_dss_device *out = &dpi->output;
	omapdss_unregister_output(out);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Archit Taneja | 35 | 100.00% | 1 | 100.00% | 
| Total | 35 | 100.00% | 1 | 100.00% | 
int dpi_init_port(struct dss_device *dss, struct platform_device *pdev,
		  struct device_node *port, enum dss_model dss_model)
{
	struct dpi_data *dpi;
	struct device_node *ep;
	u32 datalines;
	int r;
	dpi = devm_kzalloc(&pdev->dev, sizeof(*dpi), GFP_KERNEL);
	if (!dpi)
		return -ENOMEM;
	ep = of_get_next_child(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;
	}
	dpi->data_lines = datalines;
	of_node_put(ep);
	dpi->pdev = pdev;
	dpi->dss_model = dss_model;
	dpi->dss = dss;
	port->data = dpi;
	mutex_init(&dpi->lock);
	dpi_init_output_port(dpi, port);
	return 0;
err_datalines:
	of_node_put(ep);
	return r;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Tomi Valkeinen | 106 | 61.27% | 1 | 14.29% | 
| Archit Taneja | 44 | 25.43% | 3 | 42.86% | 
| Laurent Pinchart | 22 | 12.72% | 2 | 28.57% | 
| Rob Herring | 1 | 0.58% | 1 | 14.29% | 
| Total | 173 | 100.00% | 7 | 100.00% | 
void dpi_uninit_port(struct device_node *port)
{
	struct dpi_data *dpi = port->data;
	if (!dpi)
		return;
	dpi_uninit_output_port(port);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Archit Taneja | 15 | 50.00% | 3 | 75.00% | 
| Tomi Valkeinen | 15 | 50.00% | 1 | 25.00% | 
| Total | 30 | 100.00% | 4 | 100.00% | 
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Tomi Valkeinen | 2192 | 70.66% | 50 | 55.56% | 
| Archit Taneja | 604 | 19.47% | 16 | 17.78% | 
| Laurent Pinchart | 263 | 8.48% | 12 | 13.33% | 
| Peter Ujfalusi | 30 | 0.97% | 5 | 5.56% | 
| Sathya Prakash M R | 3 | 0.10% | 1 | 1.11% | 
| Paul Gortmaker | 3 | 0.10% | 1 | 1.11% | 
| Sumit Semwal | 3 | 0.10% | 2 | 2.22% | 
| Chandrabhanu Mahapatra | 2 | 0.06% | 1 | 1.11% | 
| Rob Herring | 1 | 0.03% | 1 | 1.11% | 
| Andrew F. Davis | 1 | 0.03% | 1 | 1.11% | 
| Total | 3102 | 100.00% | 90 | 100.00% | 
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.