xref: /OK3568_Linux_fs/kernel/drivers/soc/rockchip/rk_vendor_storage.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
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 #include <linux/module.h>
12 #include <linux/soc/rockchip/rk_vendor_storage.h>
13 
14 static int (*_vendor_read)(u32 id, void *pbuf, u32 size);
15 static int (*_vendor_write)(u32 id, void *pbuf, u32 size);
16 
rk_vendor_read(u32 id,void * pbuf,u32 size)17 int rk_vendor_read(u32 id, void *pbuf, u32 size)
18 {
19 	if (_vendor_read)
20 		return _vendor_read(id, pbuf, size);
21 	return -1;
22 }
23 EXPORT_SYMBOL(rk_vendor_read);
24 
rk_vendor_write(u32 id,void * pbuf,u32 size)25 int rk_vendor_write(u32 id, void *pbuf, u32 size)
26 {
27 	if (_vendor_write)
28 		return _vendor_write(id, pbuf, size);
29 	return -1;
30 }
31 EXPORT_SYMBOL(rk_vendor_write);
32 
rk_vendor_register(void * read,void * write)33 int rk_vendor_register(void *read, void *write)
34 {
35 	_vendor_read = read;
36 	_vendor_write =  write;
37 
38 	return 0;
39 }
40 EXPORT_SYMBOL(rk_vendor_register);
41 
is_rk_vendor_ready(void)42 bool is_rk_vendor_ready(void)
43 {
44 	if (_vendor_read)
45 		return true;
46 	return false;
47 }
48 EXPORT_SYMBOL(is_rk_vendor_ready);
49 
50 MODULE_LICENSE("GPL");
51