18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0+
28c2ecf20Sopenharmony_ci#include <linux/device.h>
38c2ecf20Sopenharmony_ci#include <linux/regmap.h>
48c2ecf20Sopenharmony_ci#include <linux/mfd/syscon.h>
58c2ecf20Sopenharmony_ci#include <linux/bitops.h>
68c2ecf20Sopenharmony_ci#include <linux/module.h>
78c2ecf20Sopenharmony_ci#include "pl111_nomadik.h"
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#define PMU_CTRL_OFFSET 0x0000
108c2ecf20Sopenharmony_ci#define PMU_CTRL_LCDNDIF BIT(26)
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_civoid pl111_nomadik_init(struct device *dev)
138c2ecf20Sopenharmony_ci{
148c2ecf20Sopenharmony_ci	struct regmap *pmu_regmap;
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci	/*
178c2ecf20Sopenharmony_ci	 * Just bail out of this is not found, we could be running
188c2ecf20Sopenharmony_ci	 * multiplatform on something else than Nomadik.
198c2ecf20Sopenharmony_ci	 */
208c2ecf20Sopenharmony_ci	pmu_regmap =
218c2ecf20Sopenharmony_ci		syscon_regmap_lookup_by_compatible("stericsson,nomadik-pmu");
228c2ecf20Sopenharmony_ci	if (IS_ERR(pmu_regmap))
238c2ecf20Sopenharmony_ci		return;
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci	/*
268c2ecf20Sopenharmony_ci	 * This bit in the PMU controller multiplexes the two graphics
278c2ecf20Sopenharmony_ci	 * blocks found in the Nomadik STn8815. The other one is called
288c2ecf20Sopenharmony_ci	 * MDIF (Master Display Interface) and gets muxed out here.
298c2ecf20Sopenharmony_ci	 */
308c2ecf20Sopenharmony_ci	regmap_update_bits(pmu_regmap,
318c2ecf20Sopenharmony_ci			   PMU_CTRL_OFFSET,
328c2ecf20Sopenharmony_ci			   PMU_CTRL_LCDNDIF,
338c2ecf20Sopenharmony_ci			   0);
348c2ecf20Sopenharmony_ci	dev_info(dev, "set Nomadik PMU mux to CLCD mode\n");
358c2ecf20Sopenharmony_ci}
368c2ecf20Sopenharmony_ciEXPORT_SYMBOL_GPL(pl111_nomadik_init);
37