Banajit Goswami | de8271c | 2017-01-18 00:28:59 -0800 | [diff] [blame] | 1 | /* |
Karthikeyan Mani | eea1836 | 2017-06-27 18:09:46 -0700 | [diff] [blame] | 2 | * Copyright (c) 2015-2017, The Linux Foundation. All rights reserved. |
Banajit Goswami | de8271c | 2017-01-18 00:28:59 -0800 | [diff] [blame] | 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> |
| 18 | #include <linux/mfd/wcd9xxx/core.h> |
| 19 | |
| 20 | typedef int (*regmap_patch_fptr)(struct regmap *, int); |
| 21 | |
Banajit Goswami | de8271c | 2017-01-18 00:28:59 -0800 | [diff] [blame] | 22 | extern struct regmap_config wcd934x_regmap_config; |
| 23 | extern int wcd934x_regmap_register_patch(struct regmap *regmap, |
| 24 | int version); |
Banajit Goswami | de8271c | 2017-01-18 00:28:59 -0800 | [diff] [blame] | 25 | |
Banajit Goswami | de8271c | 2017-01-18 00:28:59 -0800 | [diff] [blame] | 26 | extern struct regmap_config wcd9335_regmap_config; |
| 27 | extern int wcd9335_regmap_register_patch(struct regmap *regmap, |
| 28 | int version); |
Banajit Goswami | de8271c | 2017-01-18 00:28:59 -0800 | [diff] [blame] | 29 | |
| 30 | static inline struct regmap_config *wcd9xxx_get_regmap_config(int type) |
| 31 | { |
| 32 | struct regmap_config *regmap_config; |
| 33 | |
| 34 | switch (type) { |
Banajit Goswami | de8271c | 2017-01-18 00:28:59 -0800 | [diff] [blame] | 35 | case WCD934X: |
| 36 | regmap_config = &wcd934x_regmap_config; |
| 37 | break; |
Banajit Goswami | de8271c | 2017-01-18 00:28:59 -0800 | [diff] [blame] | 38 | case WCD9335: |
| 39 | regmap_config = &wcd9335_regmap_config; |
| 40 | break; |
Banajit Goswami | de8271c | 2017-01-18 00:28:59 -0800 | [diff] [blame] | 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) { |
Banajit Goswami | de8271c | 2017-01-18 00:28:59 -0800 | [diff] [blame] | 54 | case WCD9335: |
| 55 | apply_patch = wcd9335_regmap_register_patch; |
| 56 | break; |
Banajit Goswami | de8271c | 2017-01-18 00:28:59 -0800 | [diff] [blame] | 57 | case WCD934X: |
| 58 | apply_patch = wcd934x_regmap_register_patch; |
| 59 | break; |
Banajit Goswami | de8271c | 2017-01-18 00:28:59 -0800 | [diff] [blame] | 60 | default: |
| 61 | apply_patch = NULL; |
| 62 | break; |
| 63 | } |
| 64 | |
| 65 | return apply_patch; |
| 66 | } |
| 67 | |
| 68 | #endif |