Siddhartha Agrawal | d61f81e | 2012-12-17 19:20:35 -0800 | [diff] [blame^] | 1 | /* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. |
Deepa Dinamani | 2279965 | 2012-07-21 12:26:22 -0700 | [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. |
Channagoud Kadabi | 0e60b7d | 2012-11-01 22:56:08 +0530 | [diff] [blame] | 12 | * * Neither the name of The Linux Foundation, Inc. nor the names of its |
Deepa Dinamani | 2279965 | 2012-07-21 12:26:22 -0700 | [diff] [blame] | 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 | #ifndef _PM8x41_H_ |
| 30 | #define _PM8x41_H_ |
| 31 | |
Channagoud Kadabi | 0e60b7d | 2012-11-01 22:56:08 +0530 | [diff] [blame] | 32 | #include <sys/types.h> |
| 33 | |
Deepa Dinamani | 9a61293 | 2012-08-14 16:15:03 -0700 | [diff] [blame] | 34 | #define PM_GPIO_DIR_OUT 0x01 |
| 35 | #define PM_GPIO_DIR_IN 0x00 |
| 36 | #define PM_GPIO_DIR_BOTH 0x02 |
| 37 | |
| 38 | #define PM_GPIO_PULL_UP_30 0 |
| 39 | #define PM_GPIO_PULL_UP_1_5 1 |
| 40 | #define PM_GPIO_PULL_UP_31_5 2 |
| 41 | /* 1.5uA + 30uA boost */ |
| 42 | #define PM_GPIO_PULL_UP_1_5_30 3 |
| 43 | #define PM_GPIO_PULL_RESV_1 4 |
| 44 | #define PM_GPIO_PULL_RESV_2 5 |
| 45 | |
Siddhartha Agrawal | d61f81e | 2012-12-17 19:20:35 -0800 | [diff] [blame^] | 46 | |
| 47 | #define PM_GPIO_OUT_CMOS 0x00 |
| 48 | #define PM_GPIO_OUT_DRAIN_NMOS 0x01 |
| 49 | #define PM_GPIO_OUT_DRAIN_PMOS 0x02 |
| 50 | |
| 51 | #define PM_GPIO_OUT_DRIVE_LOW 0x01 |
| 52 | #define PM_GPIO_OUT_DRIVE_MED 0x02 |
| 53 | #define PM_GPIO_OUT_DRIVE_HIGH 0x03 |
| 54 | |
| 55 | |
| 56 | #define PM_GPIO_FUNC_LOW 0x00 |
| 57 | #define PM_GPIO_FUNC_HIGH 0x01 |
| 58 | |
| 59 | #define PM_GPIO_MODE_MASK 0x70 |
| 60 | #define PM_GPIO_OUTPUT_MASK 0x0F |
| 61 | |
Neeti Desai | 120b55d | 2012-08-20 17:15:56 -0700 | [diff] [blame] | 62 | #define PON_PSHOLD_WARM_RESET 0x1 |
| 63 | |
Deepa Dinamani | 9a61293 | 2012-08-14 16:15:03 -0700 | [diff] [blame] | 64 | struct pm8x41_gpio { |
| 65 | int direction; |
| 66 | int output_buffer; |
| 67 | int output_value; |
| 68 | int pull; |
| 69 | int vin_sel; |
| 70 | int out_strength; |
| 71 | int function; |
| 72 | int inv_int_pol; |
| 73 | int disable_pin; |
| 74 | }; |
| 75 | |
| 76 | int pm8x41_gpio_get(uint8_t gpio, uint8_t *status); |
Siddhartha Agrawal | d61f81e | 2012-12-17 19:20:35 -0800 | [diff] [blame^] | 77 | int pm8x41_gpio_set(uint8_t gpio, uint8_t value); |
Deepa Dinamani | 9a61293 | 2012-08-14 16:15:03 -0700 | [diff] [blame] | 78 | int pm8x41_gpio_config(uint8_t gpio, struct pm8x41_gpio *config); |
Deepa Dinamani | 2279965 | 2012-07-21 12:26:22 -0700 | [diff] [blame] | 79 | void pm8x41_set_boot_done(); |
Deepa Dinamani | 9a61293 | 2012-08-14 16:15:03 -0700 | [diff] [blame] | 80 | int pm8x41_vol_down_key_status(); |
Neeti Desai | 120b55d | 2012-08-20 17:15:56 -0700 | [diff] [blame] | 81 | void pm8x41_reset_configure(uint8_t); |
Channagoud Kadabi | 0e60b7d | 2012-11-01 22:56:08 +0530 | [diff] [blame] | 82 | int pm8x41_ldo_set_voltage(const char *, uint32_t); |
| 83 | int pm8x41_ldo_control(const char *, uint8_t); |
Deepa Dinamani | 2279965 | 2012-07-21 12:26:22 -0700 | [diff] [blame] | 84 | |
Channagoud Kadabi | 0e60b7d | 2012-11-01 22:56:08 +0530 | [diff] [blame] | 85 | struct pm8x41_ldo { |
| 86 | const char *name; |
| 87 | uint8_t type; |
| 88 | uint32_t base; |
| 89 | uint32_t range_reg; |
| 90 | uint32_t step_reg; |
| 91 | uint32_t enable_reg; |
| 92 | }; |
Deepa Dinamani | 2279965 | 2012-07-21 12:26:22 -0700 | [diff] [blame] | 93 | #endif |