Mayank Grover | 6372b6b | 2017-03-03 17:55:24 +0530 | [diff] [blame] | 1 | /* Copyright (c) 2017, The Linux Foundation. All rights reserved. |
| 2 | * Redistribution and use in source and binary forms, with or without |
| 3 | * modification, are permitted provided that the following conditions are |
| 4 | * met: |
| 5 | * * Redistributions of source code must retain the above copyright |
| 6 | * notice, this list of conditions and the following disclaimer. |
| 7 | * * Redistributions in binary form must reproduce the above |
| 8 | * copyright notice, this list of conditions and the following |
| 9 | * disclaimer in the documentation and/or other materials provided |
| 10 | * with the distribution. |
| 11 | * * Neither the name of The Linux Fundation, Inc. nor the names of its |
| 12 | * contributors may be used to endorse or promote products derive |
| 13 | * from this software without specific prior written permission. |
| 14 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED |
| 15 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT |
| 17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS |
| 18 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 19 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 20 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
| 21 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 22 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
| 23 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
| 24 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 | */ |
| 26 | #include <stdlib.h> |
| 27 | #include <regulator.h> |
| 28 | #include <rpm-ipc.h> |
| 29 | #include <bits.h> |
| 30 | |
| 31 | static uint32_t ldo4[][8]= |
| 32 | { |
| 33 | { |
| 34 | LDOA_RES_TYPE, 4, |
| 35 | KEY_SOFTWARE_ENABLE, 4, GENERIC_DISABLE, |
| 36 | KEY_MICRO_VOLT, 4, 0, |
| 37 | }, |
| 38 | |
| 39 | { |
| 40 | LDOA_RES_TYPE, 4, |
| 41 | KEY_SOFTWARE_ENABLE, 4, GENERIC_ENABLE, |
| 42 | KEY_MICRO_VOLT, 4, 3075000, |
| 43 | }, |
| 44 | }; |
| 45 | |
| 46 | void regulator_enable(uint32_t enable) |
| 47 | { |
| 48 | if(enable & REG_LDO4) |
| 49 | rpm_send_data(&ldo4[GENERIC_ENABLE][0], 36, RPM_REQUEST_TYPE); |
| 50 | |
| 51 | } |
| 52 | |
| 53 | void regulator_disable(uint32_t enable){ |
| 54 | |
| 55 | if(enable & REG_LDO4) |
| 56 | rpm_send_data(&ldo4[GENERIC_DISABLE][0], 36, RPM_REQUEST_TYPE); |
| 57 | } |