Lines Matching refs:sdam
34 static bool sdam_is_valid(struct sdam_chip *sdam, unsigned int offset, in sdam_is_valid() argument
37 unsigned int sdam_mem_end = SDAM_MEM_START + sdam->size - 1; in sdam_is_valid()
66 struct sdam_chip *sdam = priv; in sdam_read() local
67 struct device *dev = sdam->sdam_config.dev; in sdam_read()
70 if (!sdam_is_valid(sdam, offset, bytes)) { in sdam_read()
76 rc = regmap_bulk_read(sdam->regmap, sdam->base + offset, val, bytes); in sdam_read()
87 struct sdam_chip *sdam = priv; in sdam_write() local
88 struct device *dev = sdam->sdam_config.dev; in sdam_write()
91 if (!sdam_is_valid(sdam, offset, bytes)) { in sdam_write()
103 rc = regmap_bulk_write(sdam->regmap, sdam->base + offset, val, bytes); in sdam_write()
113 struct sdam_chip *sdam; in sdam_probe() local
118 sdam = devm_kzalloc(&pdev->dev, sizeof(*sdam), GFP_KERNEL); in sdam_probe()
119 if (!sdam) in sdam_probe()
122 sdam->regmap = dev_get_regmap(pdev->dev.parent, NULL); in sdam_probe()
123 if (!sdam->regmap) { in sdam_probe()
128 rc = of_property_read_u32(pdev->dev.of_node, "reg", &sdam->base); in sdam_probe()
134 rc = regmap_read(sdam->regmap, sdam->base + SDAM_SIZE, &val); in sdam_probe()
139 sdam->size = val * 32; in sdam_probe()
141 sdam->sdam_config.dev = &pdev->dev; in sdam_probe()
142 sdam->sdam_config.name = "spmi_sdam"; in sdam_probe()
143 sdam->sdam_config.id = NVMEM_DEVID_AUTO; in sdam_probe()
144 sdam->sdam_config.owner = THIS_MODULE; in sdam_probe()
145 sdam->sdam_config.stride = 1; in sdam_probe()
146 sdam->sdam_config.word_size = 1; in sdam_probe()
147 sdam->sdam_config.reg_read = sdam_read; in sdam_probe()
148 sdam->sdam_config.reg_write = sdam_write; in sdam_probe()
149 sdam->sdam_config.priv = sdam; in sdam_probe()
151 nvmem = devm_nvmem_register(&pdev->dev, &sdam->sdam_config); in sdam_probe()
160 sdam->base, sdam->size); in sdam_probe()