Casey Piper | d2af07b | 2015-04-01 18:01:58 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved. |
Unnati Gandhi | f35baba | 2014-11-06 18:40:36 +0530 | [diff] [blame] | 2 | * |
| 3 | * Redistribution and use in source and binary forms, with or without |
| 4 | * modification, are permitted provided that the following conditions are |
| 5 | * met: |
| 6 | * * Redistributions of source code must retain the above copyright |
| 7 | * notice, this list of conditions and the following disclaimer. |
| 8 | * * Redistributions in binary form must reproduce the above |
| 9 | * copyright notice, this list of conditions and the following |
| 10 | * disclaimer in the documentation and/or other materials provided |
| 11 | * with the distribution. |
| 12 | * * Neither the name of The Linux Fundation, Inc. nor the names of its |
| 13 | * contributors may be used to endorse or promote products derived |
| 14 | * from this software without specific prior written permission. |
| 15 | * |
| 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED |
| 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS |
| 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
| 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
| 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
| 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | * |
| 28 | */ |
| 29 | |
| 30 | #include <regulator.h> |
| 31 | #include <rpm-smd.h> |
Casey Piper | d2af07b | 2015-04-01 18:01:58 -0700 | [diff] [blame] | 32 | #include <bits.h> |
Unnati Gandhi | f35baba | 2014-11-06 18:40:36 +0530 | [diff] [blame] | 33 | #include <debug.h> |
| 34 | |
| 35 | static uint32_t ldo2[][11]= |
| 36 | { |
| 37 | { |
| 38 | LDOA_RES_TYPE, 2, |
| 39 | KEY_SOFTWARE_ENABLE, 4, GENERIC_DISABLE, |
| 40 | KEY_MICRO_VOLT, 4, 0, |
| 41 | KEY_CURRENT, 4, 0, |
| 42 | }, |
| 43 | |
| 44 | { |
| 45 | LDOA_RES_TYPE, 2, |
| 46 | KEY_SOFTWARE_ENABLE, 4, GENERIC_ENABLE, |
| 47 | KEY_MICRO_VOLT, 4, 1200000, |
| 48 | KEY_CURRENT, 4, 40, |
| 49 | }, |
| 50 | }; |
| 51 | |
| 52 | static uint32_t ldo6[][11]= |
| 53 | { |
| 54 | { |
| 55 | LDOA_RES_TYPE, 6, |
| 56 | KEY_SOFTWARE_ENABLE, 4, GENERIC_DISABLE, |
| 57 | KEY_MICRO_VOLT, 4, 0, |
| 58 | KEY_CURRENT, 4, 0, |
| 59 | }, |
| 60 | |
| 61 | { |
| 62 | LDOA_RES_TYPE, 6, |
| 63 | KEY_SOFTWARE_ENABLE, 4, GENERIC_ENABLE, |
| 64 | KEY_MICRO_VOLT, 4, 1800000, |
| 65 | KEY_CURRENT, 4, 150, |
| 66 | }, |
| 67 | }; |
| 68 | |
| 69 | |
| 70 | static uint32_t ldo17[][11]= |
| 71 | { |
| 72 | { |
| 73 | LDOA_RES_TYPE, 17, |
| 74 | KEY_SOFTWARE_ENABLE, 4, GENERIC_DISABLE, |
| 75 | KEY_MICRO_VOLT, 4, 0, |
| 76 | KEY_CURRENT, 4, 0, |
| 77 | }, |
| 78 | |
| 79 | { |
| 80 | LDOA_RES_TYPE, 17, |
| 81 | KEY_SOFTWARE_ENABLE, 4, GENERIC_ENABLE, |
| 82 | KEY_MICRO_VOLT, 4, 2850000, |
| 83 | KEY_CURRENT, 4, 40, |
| 84 | }, |
| 85 | }; |
| 86 | |
Casey Piper | d2af07b | 2015-04-01 18:01:58 -0700 | [diff] [blame] | 87 | void regulator_enable(uint32_t enable) |
Unnati Gandhi | f35baba | 2014-11-06 18:40:36 +0530 | [diff] [blame] | 88 | { |
Casey Piper | d2af07b | 2015-04-01 18:01:58 -0700 | [diff] [blame] | 89 | if (enable & REG_LDO2) |
| 90 | rpm_send_data(&ldo2[GENERIC_ENABLE][0], 36, RPM_REQUEST_TYPE); |
Unnati Gandhi | f35baba | 2014-11-06 18:40:36 +0530 | [diff] [blame] | 91 | |
Casey Piper | d2af07b | 2015-04-01 18:01:58 -0700 | [diff] [blame] | 92 | if (enable & REG_LDO17) |
| 93 | rpm_send_data(&ldo17[GENERIC_ENABLE][0], 36, RPM_REQUEST_TYPE); |
Unnati Gandhi | f35baba | 2014-11-06 18:40:36 +0530 | [diff] [blame] | 94 | |
Casey Piper | d2af07b | 2015-04-01 18:01:58 -0700 | [diff] [blame] | 95 | if (enable & REG_LDO6) |
| 96 | rpm_send_data(&ldo6[GENERIC_ENABLE][0], 36, RPM_REQUEST_TYPE); |
| 97 | |
| 98 | |
Unnati Gandhi | f35baba | 2014-11-06 18:40:36 +0530 | [diff] [blame] | 99 | |
| 100 | } |