UPSTREAM: arm64: dts: rockchip: add powerdomain for typec on rk3399
[firefly-linux-kernel-4.4.55.git] / drivers / soc / rockchip / rk_vendor_storage.c
1 /*
2  * Copyright (c) 2016, Fuzhou Rockchip Electronics Co., Ltd
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or (at
7  * your option) any later version.
8  */
9
10 #include <linux/kernel.h>
11
12 int (*_vendor_read)(u32 id, void *pbuf, u32 size) = NULL;
13 int (*_vendor_write)(u32 id, void *pbuf, u32 size) = NULL;
14
15 int rk_vendor_read(u32 id, void *pbuf, u32 size)
16 {
17         if (_vendor_read)
18                 return _vendor_read(id, pbuf, size);
19         return -1;
20 }
21 EXPORT_SYMBOL(rk_vendor_read);
22
23 int rk_vendor_write(u32 id, void *pbuf, u32 size)
24 {
25         if (_vendor_read)
26                 return _vendor_read(id, pbuf, size);
27         return -1;
28 }
29 EXPORT_SYMBOL(rk_vendor_write);
30
31 int rk_vendor_register(void *read, void *write)
32 {
33         if (!_vendor_read) {
34                 _vendor_read = read;
35                 _vendor_write =  write;
36                 return 0;
37         }
38         return -1;
39 }
40 EXPORT_SYMBOL(rk_vendor_register);