1 // SPDX-License-Identifier: GPL-2.0
3 * RTC subsystem, nvmem interface
5 * Copyright (C) 2017 Alexandre Belloni
9 #include <linux/types.h>
10 #include <linux/nvmem-consumer.h>
11 #include <linux/rtc.h>
13 int devm_rtc_nvmem_register(struct rtc_device
*rtc
,
14 struct nvmem_config
*nvmem_config
)
16 struct device
*dev
= rtc
->dev
.parent
;
17 struct nvmem_device
*nvmem
;
22 nvmem_config
->dev
= dev
;
23 nvmem_config
->owner
= rtc
->owner
;
24 nvmem_config
->add_legacy_fixed_of_cells
= true;
25 nvmem
= devm_nvmem_register(dev
, nvmem_config
);
27 dev_err(dev
, "failed to register nvmem device for RTC\n");
29 return PTR_ERR_OR_ZERO(nvmem
);
31 EXPORT_SYMBOL_GPL(devm_rtc_nvmem_register
);