blob: f44e8b1cf532efd9cbe0afccd9bfe4255dafe640 [file] [log] [blame]
Banajit Goswamide8271c2017-01-18 00:28:59 -08001/*
Karthikeyan Manieea18362017-06-27 18:09:46 -07002 * Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
Banajit Goswamide8271c2017-01-18 00:28:59 -08003 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and
6 * only version 2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14#ifndef _WCD9XXX_REGMAP_
15#define _WCD9XXX_REGMAP_
16
17#include <linux/regmap.h>
18#include <linux/mfd/wcd9xxx/core.h>
19
20typedef int (*regmap_patch_fptr)(struct regmap *, int);
21
Banajit Goswamide8271c2017-01-18 00:28:59 -080022extern struct regmap_config wcd934x_regmap_config;
23extern int wcd934x_regmap_register_patch(struct regmap *regmap,
24 int version);
Banajit Goswamide8271c2017-01-18 00:28:59 -080025
Banajit Goswamide8271c2017-01-18 00:28:59 -080026extern struct regmap_config wcd9335_regmap_config;
27extern int wcd9335_regmap_register_patch(struct regmap *regmap,
28 int version);
Banajit Goswamide8271c2017-01-18 00:28:59 -080029
30static inline struct regmap_config *wcd9xxx_get_regmap_config(int type)
31{
32 struct regmap_config *regmap_config;
33
34 switch (type) {
Banajit Goswamide8271c2017-01-18 00:28:59 -080035 case WCD934X:
36 regmap_config = &wcd934x_regmap_config;
37 break;
Banajit Goswamide8271c2017-01-18 00:28:59 -080038 case WCD9335:
39 regmap_config = &wcd9335_regmap_config;
40 break;
Banajit Goswamide8271c2017-01-18 00:28:59 -080041 default:
42 regmap_config = NULL;
43 break;
44 };
45
46 return regmap_config;
47}
48
49static inline regmap_patch_fptr wcd9xxx_get_regmap_reg_patch(int type)
50{
51 regmap_patch_fptr apply_patch;
52
53 switch (type) {
Banajit Goswamide8271c2017-01-18 00:28:59 -080054 case WCD9335:
55 apply_patch = wcd9335_regmap_register_patch;
56 break;
Banajit Goswamide8271c2017-01-18 00:28:59 -080057 case WCD934X:
58 apply_patch = wcd934x_regmap_register_patch;
59 break;
Banajit Goswamide8271c2017-01-18 00:28:59 -080060 default:
61 apply_patch = NULL;
62 break;
63 }
64
65 return apply_patch;
66}
67
68#endif