#include <linux/mfd/syscon.h>
#include <linux/module.h>
#include <linux/nvmem-provider.h>
#include <linux/of_device.h>
#include <linux/regmap.h>
#define IMX6Q_SNVS_HPLR 0x00
#define IMX6Q_SNVS_LPLR 0x34
#define IMX6Q_SNVS_LPGPR 0x68
#define IMX7D_SNVS_HPLR 0x00
#define IMX7D_SNVS_LPLR 0x34
#define IMX7D_SNVS_LPGPR 0x90
#define IMX_GPR_SL BIT(5)
#define IMX_GPR_HL BIT(5)
const struct snvs_lpgpr_cfg *dcfg;
static const struct snvs_lpgpr_cfg snvs_lpgpr_cfg_imx6q = {
.offset = IMX6Q_SNVS_LPGPR,
.offset_hplr = IMX6Q_SNVS_HPLR,
.offset_lplr = IMX6Q_SNVS_LPLR,
static const struct snvs_lpgpr_cfg snvs_lpgpr_cfg_imx7d = {
.offset = IMX7D_SNVS_LPGPR,
.offset_hplr = IMX7D_SNVS_HPLR,
.offset_lplr = IMX7D_SNVS_LPLR,
static int snvs_lpgpr_write(void *context, unsigned int offset, void *val,
struct snvs_lpgpr_priv *priv = context;
const struct snvs_lpgpr_cfg *dcfg = priv->dcfg;
ret = regmap_read(priv->regmap, dcfg->offset_hplr, &lock_reg);