diff options
author | Chen-Yu Tsai <wens@csie.org> | 2017-10-09 23:20:01 -0400 |
---|---|---|
committer | Maxime Ripard <maxime.ripard@free-electrons.com> | 2017-10-11 03:53:06 -0400 |
commit | 4b1c924b1fc15e68251ad0186b5004858d0f147b (patch) | |
tree | c138f600d70cd682afcc73fb76bd7fb92a4a4fe7 | |
parent | 544c5048bcdc5d5c395d99d61ab7a52964a1420b (diff) |
drm/sun4i: hdmi: create a regmap for later use
The HDMI driver is written with readl/writel I/O to the registers.
However, to support the A31 variant, which has a different layout
for the DDC registers, it was recommended to use regfields to have
a cleaner implementation. To use regfields, we need to create an
underlying regmap.
This patch only adds the regmap. It does not convert the existing
driver accesses to use regmap.
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171010032008.682-5-wens@csie.org
-rw-r--r-- | drivers/gpu/drm/sun4i/sun4i_hdmi.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 15 |
2 files changed, 16 insertions, 0 deletions
diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi.h b/drivers/gpu/drm/sun4i/sun4i_hdmi.h index a1f8cba251a2..aef157d3b659 100644 --- a/drivers/gpu/drm/sun4i/sun4i_hdmi.h +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi.h | |||
@@ -163,6 +163,7 @@ struct sun4i_hdmi { | |||
163 | struct device *dev; | 163 | struct device *dev; |
164 | 164 | ||
165 | void __iomem *base; | 165 | void __iomem *base; |
166 | struct regmap *regmap; | ||
166 | 167 | ||
167 | /* Parent clocks */ | 168 | /* Parent clocks */ |
168 | struct clk *bus_clk; | 169 | struct clk *bus_clk; |
diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c index 3cf1a6932fac..5ab811cda00e 100644 --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/iopoll.h> | 22 | #include <linux/iopoll.h> |
23 | #include <linux/platform_device.h> | 23 | #include <linux/platform_device.h> |
24 | #include <linux/pm_runtime.h> | 24 | #include <linux/pm_runtime.h> |
25 | #include <linux/regmap.h> | ||
25 | 26 | ||
26 | #include "sun4i_backend.h" | 27 | #include "sun4i_backend.h" |
27 | #include "sun4i_crtc.h" | 28 | #include "sun4i_crtc.h" |
@@ -267,6 +268,13 @@ static const struct cec_pin_ops sun4i_hdmi_cec_pin_ops = { | |||
267 | }; | 268 | }; |
268 | #endif | 269 | #endif |
269 | 270 | ||
271 | static const struct regmap_config sun4i_hdmi_regmap_config = { | ||
272 | .reg_bits = 32, | ||
273 | .val_bits = 32, | ||
274 | .reg_stride = 4, | ||
275 | .max_register = 0x580, | ||
276 | }; | ||
277 | |||
270 | static int sun4i_hdmi_bind(struct device *dev, struct device *master, | 278 | static int sun4i_hdmi_bind(struct device *dev, struct device *master, |
271 | void *data) | 279 | void *data) |
272 | { | 280 | { |
@@ -321,6 +329,13 @@ static int sun4i_hdmi_bind(struct device *dev, struct device *master, | |||
321 | goto err_disable_mod_clk; | 329 | goto err_disable_mod_clk; |
322 | } | 330 | } |
323 | 331 | ||
332 | hdmi->regmap = devm_regmap_init_mmio(dev, hdmi->base, | ||
333 | &sun4i_hdmi_regmap_config); | ||
334 | if (IS_ERR(hdmi->regmap)) { | ||
335 | dev_err(dev, "Couldn't create HDMI encoder regmap\n"); | ||
336 | return PTR_ERR(hdmi->regmap); | ||
337 | } | ||
338 | |||
324 | ret = sun4i_tmds_create(hdmi); | 339 | ret = sun4i_tmds_create(hdmi); |
325 | if (ret) { | 340 | if (ret) { |
326 | dev_err(dev, "Couldn't create the TMDS clock\n"); | 341 | dev_err(dev, "Couldn't create the TMDS clock\n"); |