2019-03-14 06:02:48 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2017-07-06 17:42:02 +08:00
|
|
|
/*
|
|
|
|
* RTC subsystem, nvmem interface
|
|
|
|
*
|
|
|
|
* Copyright (C) 2017 Alexandre Belloni
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/err.h>
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include <linux/nvmem-consumer.h>
|
|
|
|
#include <linux/rtc.h>
|
|
|
|
|
2020-11-10 00:34:06 +08:00
|
|
|
int devm_rtc_nvmem_register(struct rtc_device *rtc,
|
2018-02-13 06:47:17 +08:00
|
|
|
struct nvmem_config *nvmem_config)
|
2017-07-06 17:42:02 +08:00
|
|
|
{
|
2018-11-11 04:29:03 +08:00
|
|
|
struct nvmem_device *nvmem;
|
2018-02-13 06:47:18 +08:00
|
|
|
|
2018-02-13 06:47:16 +08:00
|
|
|
if (!nvmem_config)
|
2018-02-13 06:47:17 +08:00
|
|
|
return -ENODEV;
|
2017-07-06 17:42:02 +08:00
|
|
|
|
2018-03-01 04:58:02 +08:00
|
|
|
nvmem_config->dev = rtc->dev.parent;
|
2018-02-13 06:47:16 +08:00
|
|
|
nvmem_config->owner = rtc->owner;
|
2018-11-11 04:29:03 +08:00
|
|
|
nvmem = devm_nvmem_register(rtc->dev.parent, nvmem_config);
|
2018-02-13 06:47:17 +08:00
|
|
|
|
2020-11-10 00:34:05 +08:00
|
|
|
return PTR_ERR_OR_ZERO(nvmem);
|
2017-07-06 17:42:02 +08:00
|
|
|
}
|
2020-11-10 00:34:06 +08:00
|
|
|
EXPORT_SYMBOL_GPL(devm_rtc_nvmem_register);
|