GNU Linux-libre 4.19.286-gnu1
[releases.git] / drivers / gpu / drm / pl111 / pl111_nomadik.c
1 // SPDX-License-Identifier: GPL-2.0+
2 #include <linux/device.h>
3 #include <linux/regmap.h>
4 #include <linux/mfd/syscon.h>
5 #include <linux/bitops.h>
6 #include <linux/module.h>
7 #include "pl111_nomadik.h"
8
9 #define PMU_CTRL_OFFSET 0x0000
10 #define PMU_CTRL_LCDNDIF BIT(26)
11
12 void pl111_nomadik_init(struct device *dev)
13 {
14         struct regmap *pmu_regmap;
15
16         /*
17          * Just bail out of this is not found, we could be running
18          * multiplatform on something else than Nomadik.
19          */
20         pmu_regmap =
21                 syscon_regmap_lookup_by_compatible("stericsson,nomadik-pmu");
22         if (IS_ERR(pmu_regmap))
23                 return;
24
25         /*
26          * This bit in the PMU controller multiplexes the two graphics
27          * blocks found in the Nomadik STn8815. The other one is called
28          * MDIF (Master Display Interface) and gets muxed out here.
29          */
30         regmap_update_bits(pmu_regmap,
31                            PMU_CTRL_OFFSET,
32                            PMU_CTRL_LCDNDIF,
33                            0);
34         dev_info(dev, "set Nomadik PMU mux to CLCD mode\n");
35 }
36 EXPORT_SYMBOL_GPL(pl111_nomadik_init);