Asish Bhattacharya | 8e2277f | 2017-07-20 18:31:55 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2015-2017, The Linux Foundation. All rights reserved. |
| 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 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> |
Laxminath Kasam | 605b42f | 2017-08-01 22:02:15 +0530 | [diff] [blame] | 18 | #include "core.h" |
Asish Bhattacharya | 8e2277f | 2017-07-20 18:31:55 +0530 | [diff] [blame] | 19 | |
| 20 | typedef int (*regmap_patch_fptr)(struct regmap *, int); |
| 21 | |
| 22 | extern struct regmap_config wcd934x_regmap_config; |
| 23 | extern int wcd934x_regmap_register_patch(struct regmap *regmap, |
| 24 | int version); |
| 25 | |
| 26 | extern struct regmap_config wcd9335_regmap_config; |
| 27 | extern int wcd9335_regmap_register_patch(struct regmap *regmap, |
| 28 | int version); |
| 29 | |
| 30 | static inline struct regmap_config *wcd9xxx_get_regmap_config(int type) |
| 31 | { |
| 32 | struct regmap_config *regmap_config; |
| 33 | |
| 34 | switch (type) { |
| 35 | case WCD934X: |
| 36 | regmap_config = &wcd934x_regmap_config; |
| 37 | break; |
| 38 | case WCD9335: |
| 39 | regmap_config = &wcd9335_regmap_config; |
| 40 | break; |
| 41 | default: |
| 42 | regmap_config = NULL; |
| 43 | break; |
| 44 | }; |
| 45 | |
| 46 | return regmap_config; |
| 47 | } |
| 48 | |
| 49 | static inline regmap_patch_fptr wcd9xxx_get_regmap_reg_patch(int type) |
| 50 | { |
| 51 | regmap_patch_fptr apply_patch; |
| 52 | |
| 53 | switch (type) { |
| 54 | case WCD9335: |
| 55 | apply_patch = wcd9335_regmap_register_patch; |
| 56 | break; |
| 57 | case WCD934X: |
| 58 | apply_patch = wcd934x_regmap_register_patch; |
| 59 | break; |
| 60 | default: |
| 61 | apply_patch = NULL; |
| 62 | break; |
| 63 | } |
| 64 | |
| 65 | return apply_patch; |
| 66 | } |
| 67 | |
| 68 | #endif |