Skip to content

Commit

Permalink
drm/tegra: Tightly bind RGB output to DC
Browse files Browse the repository at this point in the history
Previously the association to a DC was done via the encoder's .crtc
field. That has the disadvantage that when an encoder is detached from
its CRTC, that field is set to NULL, leading to situations where it is
impossible to access the DC registers required by the RGB output.

However, the coupling between DC and RGB output is really fixed on
Tegra. While they can be detached logically in DRM, the RGB output can
rely on the DC's existence.

Signed-off-by: Thierry Reding <treding@nvidia.com>
  • Loading branch information
Thierry Reding committed Dec 3, 2013
1 parent 3782651 commit 7602fa1
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions drivers/gpu/drm/tegra/rgb.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

struct tegra_rgb {
struct tegra_output output;
struct tegra_dc *dc;

struct clk *clk_parent;
struct clk *clk;
};
Expand Down Expand Up @@ -84,18 +86,18 @@ static void tegra_dc_write_regs(struct tegra_dc *dc,

static int tegra_output_rgb_enable(struct tegra_output *output)
{
struct tegra_dc *dc = to_tegra_dc(output->encoder.crtc);
struct tegra_rgb *rgb = to_rgb(output);

tegra_dc_write_regs(dc, rgb_enable, ARRAY_SIZE(rgb_enable));
tegra_dc_write_regs(rgb->dc, rgb_enable, ARRAY_SIZE(rgb_enable));

return 0;
}

static int tegra_output_rgb_disable(struct tegra_output *output)
{
struct tegra_dc *dc = to_tegra_dc(output->encoder.crtc);
struct tegra_rgb *rgb = to_rgb(output);

tegra_dc_write_regs(dc, rgb_disable, ARRAY_SIZE(rgb_disable));
tegra_dc_write_regs(rgb->dc, rgb_disable, ARRAY_SIZE(rgb_disable));

return 0;
}
Expand Down Expand Up @@ -146,6 +148,7 @@ int tegra_dc_rgb_probe(struct tegra_dc *dc)

rgb->output.dev = dc->dev;
rgb->output.of_node = np;
rgb->dc = dc;

err = tegra_output_probe(&rgb->output);
if (err < 0)
Expand Down

0 comments on commit 7602fa1

Please sign in to comment.