Commit 777f05cc authored by Tomi Valkeinen's avatar Tomi Valkeinen

OMAPDSS: DSI: simplify dsi configuration

We have a bunch of dsi functions that are used to do the basic
configuration for DSI. To simplify things, and to make sure we have all
the necessary information, create a single dsi config function, which
does the basic configuration.
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent 17518189
...@@ -919,6 +919,13 @@ static int taal_power_on(struct omap_dss_device *dssdev) ...@@ -919,6 +919,13 @@ static int taal_power_on(struct omap_dss_device *dssdev)
struct taal_data *td = dev_get_drvdata(&dssdev->dev); struct taal_data *td = dev_get_drvdata(&dssdev->dev);
u8 id1, id2, id3; u8 id1, id2, id3;
int r; int r;
struct omap_dss_dsi_config dsi_config = {
.mode = OMAP_DSS_DSI_CMD_MODE,
.pixel_format = OMAP_DSS_DSI_FMT_RGB888,
.timings = &dssdev->panel.timings,
.hs_clk = 216000000,
.lp_clk = 10000000,
};
r = omapdss_dsi_configure_pins(dssdev, &td->pin_config); r = omapdss_dsi_configure_pins(dssdev, &td->pin_config);
if (r) { if (r) {
...@@ -926,14 +933,9 @@ static int taal_power_on(struct omap_dss_device *dssdev) ...@@ -926,14 +933,9 @@ static int taal_power_on(struct omap_dss_device *dssdev)
goto err0; goto err0;
}; };
omapdss_dsi_set_size(dssdev, dssdev->panel.timings.x_res, r = omapdss_dsi_set_config(dssdev, &dsi_config);
dssdev->panel.timings.y_res);
omapdss_dsi_set_pixel_format(dssdev, OMAP_DSS_DSI_FMT_RGB888);
omapdss_dsi_set_operation_mode(dssdev, OMAP_DSS_DSI_CMD_MODE);
r = omapdss_dsi_set_clocks(dssdev, 216000000, 10000000);
if (r) { if (r) {
dev_err(&dssdev->dev, "failed to set HS and LP clocks\n"); dev_err(&dssdev->dev, "failed to configure DSI\n");
goto err0; goto err0;
} }
......
...@@ -4278,7 +4278,7 @@ int omapdss_dsi_configure_pins(struct omap_dss_device *dssdev, ...@@ -4278,7 +4278,7 @@ int omapdss_dsi_configure_pins(struct omap_dss_device *dssdev,
} }
EXPORT_SYMBOL(omapdss_dsi_configure_pins); EXPORT_SYMBOL(omapdss_dsi_configure_pins);
int omapdss_dsi_set_clocks(struct omap_dss_device *dssdev, static int dsi_set_clocks(struct omap_dss_device *dssdev,
unsigned long ddr_clk, unsigned long lp_clk) unsigned long ddr_clk, unsigned long lp_clk)
{ {
struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
...@@ -4293,8 +4293,6 @@ int omapdss_dsi_set_clocks(struct omap_dss_device *dssdev, ...@@ -4293,8 +4293,6 @@ int omapdss_dsi_set_clocks(struct omap_dss_device *dssdev,
DSSDBG("Setting DSI clocks: ddr_clk %lu, lp_clk %lu", ddr_clk, lp_clk); DSSDBG("Setting DSI clocks: ddr_clk %lu, lp_clk %lu", ddr_clk, lp_clk);
mutex_lock(&dsi->lock);
/* Calculate PLL output clock */ /* Calculate PLL output clock */
r = dsi_pll_calc_ddrfreq(dsidev, ddr_clk * 4, &cinfo); r = dsi_pll_calc_ddrfreq(dsidev, ddr_clk * 4, &cinfo);
if (r) if (r)
...@@ -4336,13 +4334,10 @@ int omapdss_dsi_set_clocks(struct omap_dss_device *dssdev, ...@@ -4336,13 +4334,10 @@ int omapdss_dsi_set_clocks(struct omap_dss_device *dssdev,
OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI : OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI :
OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI; OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI;
mutex_unlock(&dsi->lock);
return 0; return 0;
err: err:
mutex_unlock(&dsi->lock);
return r; return r;
} }
EXPORT_SYMBOL(omapdss_dsi_set_clocks);
int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel) int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
{ {
...@@ -4884,75 +4879,26 @@ int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, bool enable) ...@@ -4884,75 +4879,26 @@ int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, bool enable)
} }
EXPORT_SYMBOL(omapdss_dsi_enable_te); EXPORT_SYMBOL(omapdss_dsi_enable_te);
void omapdss_dsi_set_timings(struct omap_dss_device *dssdev, int omapdss_dsi_set_config(struct omap_dss_device *dssdev,
struct omap_video_timings *timings) const struct omap_dss_dsi_config *config)
{ {
struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
mutex_lock(&dsi->lock); mutex_lock(&dsi->lock);
dsi->timings = *timings; dsi->timings = *config->timings;
dsi->vm_timings = *config->vm_timings;
mutex_unlock(&dsi->lock); dsi->pix_fmt = config->pixel_format;
} dsi->mode = config->mode;
EXPORT_SYMBOL(omapdss_dsi_set_timings);
void omapdss_dsi_set_size(struct omap_dss_device *dssdev, u16 w, u16 h)
{
struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
mutex_lock(&dsi->lock);
dsi->timings.x_res = w; dsi_set_clocks(dssdev, config->hs_clk, config->lp_clk);
dsi->timings.y_res = h;
mutex_unlock(&dsi->lock); mutex_unlock(&dsi->lock);
}
EXPORT_SYMBOL(omapdss_dsi_set_size);
void omapdss_dsi_set_pixel_format(struct omap_dss_device *dssdev, return 0;
enum omap_dss_dsi_pixel_format fmt)
{
struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
mutex_lock(&dsi->lock);
dsi->pix_fmt = fmt;
mutex_unlock(&dsi->lock);
}
EXPORT_SYMBOL(omapdss_dsi_set_pixel_format);
void omapdss_dsi_set_operation_mode(struct omap_dss_device *dssdev,
enum omap_dss_dsi_mode mode)
{
struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
mutex_lock(&dsi->lock);
dsi->mode = mode;
mutex_unlock(&dsi->lock);
}
EXPORT_SYMBOL(omapdss_dsi_set_operation_mode);
void omapdss_dsi_set_videomode_timings(struct omap_dss_device *dssdev,
struct omap_dss_dsi_videomode_timings *timings)
{
struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
mutex_lock(&dsi->lock);
dsi->vm_timings = *timings;
mutex_unlock(&dsi->lock);
} }
EXPORT_SYMBOL(omapdss_dsi_set_videomode_timings); EXPORT_SYMBOL(omapdss_dsi_set_config);
/* /*
* Return a hardcoded channel for the DSI output. This should work for * Return a hardcoded channel for the DSI output. This should work for
......
...@@ -282,6 +282,16 @@ struct omap_dss_dsi_videomode_timings { ...@@ -282,6 +282,16 @@ struct omap_dss_dsi_videomode_timings {
int window_sync; int window_sync;
}; };
struct omap_dss_dsi_config {
enum omap_dss_dsi_mode mode;
enum omap_dss_dsi_pixel_format pixel_format;
const struct omap_video_timings *timings;
const struct omap_dss_dsi_videomode_timings *vm_timings;
unsigned long hs_clk;
unsigned long lp_clk;
};
void dsi_bus_lock(struct omap_dss_device *dssdev); void dsi_bus_lock(struct omap_dss_device *dssdev);
void dsi_bus_unlock(struct omap_dss_device *dssdev); void dsi_bus_unlock(struct omap_dss_device *dssdev);
int dsi_vc_dcs_write(struct omap_dss_device *dssdev, int channel, u8 *data, int dsi_vc_dcs_write(struct omap_dss_device *dssdev, int channel, u8 *data,
...@@ -806,15 +816,8 @@ int dispc_ovl_setup(enum omap_plane plane, const struct omap_overlay_info *oi, ...@@ -806,15 +816,8 @@ int dispc_ovl_setup(enum omap_plane plane, const struct omap_overlay_info *oi,
void omapdss_dsi_vc_enable_hs(struct omap_dss_device *dssdev, int channel, void omapdss_dsi_vc_enable_hs(struct omap_dss_device *dssdev, int channel,
bool enable); bool enable);
int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, bool enable); int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, bool enable);
void omapdss_dsi_set_timings(struct omap_dss_device *dssdev, int omapdss_dsi_set_config(struct omap_dss_device *dssdev,
struct omap_video_timings *timings); const struct omap_dss_dsi_config *config);
void omapdss_dsi_set_size(struct omap_dss_device *dssdev, u16 w, u16 h);
void omapdss_dsi_set_pixel_format(struct omap_dss_device *dssdev,
enum omap_dss_dsi_pixel_format fmt);
void omapdss_dsi_set_operation_mode(struct omap_dss_device *dssdev,
enum omap_dss_dsi_mode mode);
void omapdss_dsi_set_videomode_timings(struct omap_dss_device *dssdev,
struct omap_dss_dsi_videomode_timings *timings);
int omap_dsi_update(struct omap_dss_device *dssdev, int channel, int omap_dsi_update(struct omap_dss_device *dssdev, int channel,
void (*callback)(int, void *), void *data); void (*callback)(int, void *), void *data);
...@@ -823,8 +826,6 @@ int omap_dsi_set_vc_id(struct omap_dss_device *dssdev, int channel, int vc_id); ...@@ -823,8 +826,6 @@ int omap_dsi_set_vc_id(struct omap_dss_device *dssdev, int channel, int vc_id);
void omap_dsi_release_vc(struct omap_dss_device *dssdev, int channel); void omap_dsi_release_vc(struct omap_dss_device *dssdev, int channel);
int omapdss_dsi_configure_pins(struct omap_dss_device *dssdev, int omapdss_dsi_configure_pins(struct omap_dss_device *dssdev,
const struct omap_dsi_pin_config *pin_cfg); const struct omap_dsi_pin_config *pin_cfg);
int omapdss_dsi_set_clocks(struct omap_dss_device *dssdev,
unsigned long ddr_clk, unsigned long lp_clk);
int omapdss_dsi_display_enable(struct omap_dss_device *dssdev); int omapdss_dsi_display_enable(struct omap_dss_device *dssdev);
void omapdss_dsi_display_disable(struct omap_dss_device *dssdev, void omapdss_dsi_display_disable(struct omap_dss_device *dssdev,
......
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