Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 798957ae authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Tomi Valkeinen
Browse files

drm: omapdrm: dss: Store the registered plls array in struct dss_device



As part of an effort to remove the usage of global variables in the
driver, store the registered plls array in the dss_device structure
instead of a global variable.

Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: default avatarSebastian Reichel <sebastian.reichel@collabora.co.uk>
parent f33656e1
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -3123,7 +3123,7 @@ static unsigned long dispc_fclk_rate(void)
		struct dss_pll *pll;
		struct dss_pll *pll;
		unsigned int clkout_idx;
		unsigned int clkout_idx;


		pll = dss_pll_find_by_src(src);
		pll = dss_pll_find_by_src(dispc.dss, src);
		clkout_idx = dss_pll_get_clkout_idx_for_src(src);
		clkout_idx = dss_pll_get_clkout_idx_for_src(src);


		r = pll->cinfo.clkout[clkout_idx];
		r = pll->cinfo.clkout[clkout_idx];
@@ -3150,7 +3150,7 @@ static unsigned long dispc_mgr_lclk_rate(enum omap_channel channel)
		struct dss_pll *pll;
		struct dss_pll *pll;
		unsigned int clkout_idx;
		unsigned int clkout_idx;


		pll = dss_pll_find_by_src(src);
		pll = dss_pll_find_by_src(dispc.dss, src);
		clkout_idx = dss_pll_get_clkout_idx_for_src(src);
		clkout_idx = dss_pll_get_clkout_idx_for_src(src);


		r = pll->cinfo.clkout[clkout_idx];
		r = pll->cinfo.clkout[clkout_idx];
+9 −8
Original line number Original line Diff line number Diff line
@@ -58,7 +58,8 @@ static struct dpi_data *dpi_get_data_from_dssdev(struct omap_dss_device *dssdev)
	return container_of(dssdev, struct dpi_data, output);
	return container_of(dssdev, struct dpi_data, output);
}
}


static enum dss_clk_source dpi_get_clk_src_dra7xx(enum omap_channel channel)
static enum dss_clk_source dpi_get_clk_src_dra7xx(struct dpi_data *dpi,
						  enum omap_channel channel)
{
{
	/*
	/*
	 * Possible clock sources:
	 * Possible clock sources:
@@ -70,23 +71,23 @@ static enum dss_clk_source dpi_get_clk_src_dra7xx(enum omap_channel channel)
	switch (channel) {
	switch (channel) {
	case OMAP_DSS_CHANNEL_LCD:
	case OMAP_DSS_CHANNEL_LCD:
	{
	{
		if (dss_pll_find_by_src(DSS_CLK_SRC_PLL1_1))
		if (dss_pll_find_by_src(dpi->dss, DSS_CLK_SRC_PLL1_1))
			return DSS_CLK_SRC_PLL1_1;
			return DSS_CLK_SRC_PLL1_1;
		break;
		break;
	}
	}
	case OMAP_DSS_CHANNEL_LCD2:
	case OMAP_DSS_CHANNEL_LCD2:
	{
	{
		if (dss_pll_find_by_src(DSS_CLK_SRC_PLL1_3))
		if (dss_pll_find_by_src(dpi->dss, DSS_CLK_SRC_PLL1_3))
			return DSS_CLK_SRC_PLL1_3;
			return DSS_CLK_SRC_PLL1_3;
		if (dss_pll_find_by_src(DSS_CLK_SRC_PLL2_3))
		if (dss_pll_find_by_src(dpi->dss, DSS_CLK_SRC_PLL2_3))
			return DSS_CLK_SRC_PLL2_3;
			return DSS_CLK_SRC_PLL2_3;
		break;
		break;
	}
	}
	case OMAP_DSS_CHANNEL_LCD3:
	case OMAP_DSS_CHANNEL_LCD3:
	{
	{
		if (dss_pll_find_by_src(DSS_CLK_SRC_PLL2_1))
		if (dss_pll_find_by_src(dpi->dss, DSS_CLK_SRC_PLL2_1))
			return DSS_CLK_SRC_PLL2_1;
			return DSS_CLK_SRC_PLL2_1;
		if (dss_pll_find_by_src(DSS_CLK_SRC_PLL1_3))
		if (dss_pll_find_by_src(dpi->dss, DSS_CLK_SRC_PLL1_3))
			return DSS_CLK_SRC_PLL1_3;
			return DSS_CLK_SRC_PLL1_3;
		break;
		break;
	}
	}
@@ -133,7 +134,7 @@ static enum dss_clk_source dpi_get_clk_src(struct dpi_data *dpi)
		}
		}


	case DSS_MODEL_DRA7:
	case DSS_MODEL_DRA7:
		return dpi_get_clk_src_dra7xx(channel);
		return dpi_get_clk_src_dra7xx(dpi, channel);


	default:
	default:
		return DSS_CLK_SRC_FCK;
		return DSS_CLK_SRC_FCK;
@@ -605,7 +606,7 @@ static void dpi_init_pll(struct dpi_data *dpi)


	dpi->clk_src = dpi_get_clk_src(dpi);
	dpi->clk_src = dpi_get_clk_src(dpi);


	pll = dss_pll_find_by_src(dpi->clk_src);
	pll = dss_pll_find_by_src(dpi->dss, dpi->clk_src);
	if (!pll)
	if (!pll)
		return;
		return;


+1 −2
Original line number Original line Diff line number Diff line
@@ -5353,9 +5353,8 @@ static int dsi_init_pll_data(struct dss_device *dss,
	pll->base = dsi->pll_base;
	pll->base = dsi->pll_base;
	pll->hw = dsi->data->pll_hw;
	pll->hw = dsi->data->pll_hw;
	pll->ops = &dsi_pll_ops;
	pll->ops = &dsi_pll_ops;
	pll->dss = dss;


	r = dss_pll_register(pll);
	r = dss_pll_register(dss, pll);
	if (r)
	if (r)
		return r;
		return r;


+5 −3
Original line number Original line Diff line number Diff line
@@ -267,6 +267,7 @@ struct dss_device {
		struct dss_debugfs_entry *dss;
		struct dss_debugfs_entry *dss;
	} debugfs;
	} debugfs;


	struct dss_pll *plls[4];
	struct dss_pll	*video1_pll;
	struct dss_pll	*video1_pll;
	struct dss_pll	*video2_pll;
	struct dss_pll	*video2_pll;
};
};
@@ -458,10 +459,11 @@ typedef bool (*dss_pll_calc_func)(int n, int m, unsigned long fint,
typedef bool (*dss_hsdiv_calc_func)(int m_dispc, unsigned long dispc,
typedef bool (*dss_hsdiv_calc_func)(int m_dispc, unsigned long dispc,
		void *data);
		void *data);


int dss_pll_register(struct dss_pll *pll);
int dss_pll_register(struct dss_device *dss, struct dss_pll *pll);
void dss_pll_unregister(struct dss_pll *pll);
void dss_pll_unregister(struct dss_pll *pll);
struct dss_pll *dss_pll_find(const char *name);
struct dss_pll *dss_pll_find(struct dss_device *dss, const char *name);
struct dss_pll *dss_pll_find_by_src(enum dss_clk_source src);
struct dss_pll *dss_pll_find_by_src(struct dss_device *dss,
				    enum dss_clk_source src);
unsigned int dss_pll_get_clkout_idx_for_src(enum dss_clk_source src);
unsigned int dss_pll_get_clkout_idx_for_src(enum dss_clk_source src);
int dss_pll_enable(struct dss_pll *pll);
int dss_pll_enable(struct dss_pll *pll);
void dss_pll_disable(struct dss_pll *pll);
void dss_pll_disable(struct dss_pll *pll);
+1 −2
Original line number Original line Diff line number Diff line
@@ -146,7 +146,6 @@ static int hdmi_init_pll_data(struct dss_device *dss,
	pll->id = DSS_PLL_HDMI;
	pll->id = DSS_PLL_HDMI;
	pll->base = hpll->base;
	pll->base = hpll->base;
	pll->clkin = clk;
	pll->clkin = clk;
	pll->dss = dss;


	if (hpll->wp->version == 4)
	if (hpll->wp->version == 4)
		pll->hw = &dss_omap4_hdmi_pll_hw;
		pll->hw = &dss_omap4_hdmi_pll_hw;
@@ -155,7 +154,7 @@ static int hdmi_init_pll_data(struct dss_device *dss,


	pll->ops = &hdmi_pll_ops;
	pll->ops = &hdmi_pll_ops;


	r = dss_pll_register(pll);
	r = dss_pll_register(dss, pll);
	if (r)
	if (r)
		return r;
		return r;


Loading