/* Copyright Statement: * * (C) 2005-2016 MediaTek Inc. All rights reserved. * * This software/firmware and related documentation ("MediaTek Software") are * protected under relevant copyright laws. The information contained herein * is confidential and proprietary to MediaTek Inc. ("MediaTek") and/or its licensors. * Without the prior written permission of MediaTek and/or its licensors, * any reproduction, modification, use or disclosure of MediaTek Software, * and information contained herein, in whole or in part, shall be strictly prohibited. * You may only use, reproduce, modify, or distribute (as applicable) MediaTek Software * if you have agreed to and been bound by the applicable license agreement with * MediaTek ("License Agreement") and been granted explicit permission to do so within * the License Agreement ("Permitted User"). If you are not a Permitted User, * please cease any access or use of MediaTek Software immediately. * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES * THAT MEDIATEK SOFTWARE RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES * ARE PROVIDED TO RECEIVER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR * SUPPLIED WITH MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND * CUMULATIVE LIABILITY WITH RESPECT TO MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE MEDIATEK SOFTWARE AT ISSUE, * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. */ #ifndef __HAL_ISINK_H__ #define __HAL_ISINK_H__ #include "hal_platform.h" #ifdef HAL_ISINK_MODULE_ENABLED /** * @addtogroup HAL * @{ * @addtogroup ISINK * @{ * This section introduces the ISINK APIs including terms and acronyms, * supported features, software architecture, how to use this module, ISINK function groups, enums, structures and functions. * Users can use this API to adjust differnt current output settings through ISINK registers. For example, to adjust the backlight brightness. * * @section ISINK_Terms_Chapter Terms and acronyms * * |Terms |Details | * |------------------------------|------------------------------------------------------------------------| * |\b ISINK |Current Sink that provides different current outputs depending on the PMIC setting. | * |\b PMIC |Power Management Integrated Chip. For an introduction to the Power Management Integrated Chip, please refer to Power management integrated circuit Wikipedia | * @section ISINK_Driver_Usage_Chapter How to use this module * * - Trigger ISINK different current outputs. \n * - Step1: Call #hal_isink_init() to initialize the ISINK module. * - Step2: Call #hal_isink_set_clock_source() to set the clock source of the ISINK. * - Step3: Call #hal_isink_set_mode() to set the ISINK mode. * - Step4: Call #hal_isink_set_step_current() to set the ISINK to 4mA output current. * - Step5: Call #hal_isink_get_running_status() to get the current running status of the ISINK. * - Step6: Call #hal_isink_deinit() to de-initialize ISINK module. * - Sample code: * @code * if(HAL_ISINK_STATUS_OK != hal_isink_init(HAL_ISINK_CHANNEL_0)) { //Initialize the ISINK clock source. * //Error handler * } * if(HAL_ISINK_STATUS_OK != hal_isink_set_clock_source(HAL_ISINK_CHANNEL_0,HAL_ISINK_CLOCK_SOURCE_2MHZ)) { //Set the ISINK clock source. * //Error handler * } * if(HAL_ISINK_STATUS_OK != hal_isink_set_mode(HAL_ISINK_CHANNEL_0,HAL_ISINK_MODE_REGISTER)) { //Set the ISINK register mode. * //Error handler * } * if(HAL_ISINK_STATUS_OK != hal_isink_set_step_current(HAL_ISINK_CHANNEL_0,HAL_ISINK_OUTPUT_CURRENT_4_MA)) { //Set the ISINK to 4mA output current. * //Error handler * } * if(HAL_ISINK_STATUS_OK != hal_isink_get_running_status(HAL_ISINK_CHANNEL_0,&status)) { //Get the running status of the ISINK. * //Error handler * } * if(HAL_ISINK_STATUS_OK != hal_isink_deinit(HAL_ISINK_CHANNEL_0)) { //Deinitialize the ISINK module. * //Error handler * } * @endcode */ #ifdef __cplusplus extern "C" { #endif /** @defgroup hal_isink_enum Enum * @{ */ /** @brief ISINK channel. */ typedef enum { HAL_ISINK_CHANNEL_0 = 0, /**< The ISINK channel 0. */ HAL_ISINK_CHANNEL_1 = 1, /**< The ISINK channel 1. */ HAL_ISINK_MAX_CHANNEL /**< The ISINK maximum channel (invalid).*/ } hal_isink_channel_t; /** @brief ISINK clock source seletion. */ typedef enum { HAL_ISINK_CLOCK_SOURCE_32KHZ = 0, /**< The ISINK clock source 32kHz. */ HAL_ISINK_CLOCK_SOURCE_2MHZ = 1 /**< The ISINK clock source 2MHz. */ } hal_isink_clock_source_t ; /** @brief ISINK operating mode seletion. */ typedef enum { HAL_ISINK_MODE_PWM = 0, /**