/* SPDX-License-Identifier: LGPL-2.1-only OR BSD-3-Clause */
/******************************************************************************
 *
 * This file is provided under a dual license.  When you use or
 * distribute this software, you may choose to be licensed under
 * version 2.1 of the GNU Lesser General Public License
 * ("LGPLv2.1 License") or BSD License.
 *
 * LGPLv2.1 License
 *
 * Copyright(C) 2019 MediaTek Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of version 2.1 of the GNU Lesser General Public
 * License as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html for more
 * details.
 *
 * BSD LICENSE
 *
 * Copyright(C) 2019 MediaTek Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 *  * Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *  * Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *  * Neither the name of the copyright holder nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 *****************************************************************************/


#ifndef MTK_IR_NEC_H
#define MTK_IR_NEC_H

// The MTK TV controller IRRX key map
static const KEYUNIT_T _arMtkTvKeyMap[] =
{
    { 0x00, BTN_GREEN },            /* 0x00, Green Key */
    { 0x01, BTN_YELLOW },           /* 0x01, Yellow Key */
//    { 0x02, BTN_SMARTPIC },         /* 0x02, Smart PIC */
    { 0x03, BTN_DIGIT_0 },          /* 0x03, Num0 */
    { 0x04, BTN_DIGIT_DOT },        /* 0x04, Blank button */
    { 0x05, BTN_TTX },              /* 0x05, TT/TV */
    #ifdef CC_ANDROID_TWO_WORLDS
        { 0x06, BTN_ROOT_MENU },             /* 0x06, Menu */
    #else
        { 0x06, BTN_MENU },             /* 0x06, Menu */
    #endif
    { 0x07, BTN_MUTE },             /* 0x07, Mute */
    { 0x08, BTN_DIGIT_8 },          /* 0x08, Num8 */
    { 0x09, BTN_DIGIT_9 },          /* 0x09, Num9 */
    { 0x0a, BTN_ASPECT },           /* 0x0a, Active Control */
    { 0x0b, BTN_DIGIT_7 },          /* 0x0b, Num7 */
    { 0x0c, BTN_DIGIT_5 },          /* 0x0c, Num5 */
    { 0x0d, BTN_DIGIT_6 },          /* 0x0d, Num6 */
    { 0x0e, BTN_POWER },            /* 0x0e, Power */
    { 0x0f, BTN_DIGIT_4 },          /* 0x0f, Num4 */
    { 0x10, BTN_DIGIT_2 },          /* 0x10, Num2 */
    { 0x11, BTN_DIGIT_3 },          /* 0x11, Num3 */
    { 0x12, BTN_POP },              /* 0x12, POP */
    { 0x13, BTN_DIGIT_1 },          /* 0x13, Num1 */
    { 0x14, BTN_RED },              /* 0x14, Red Key */
    { 0x15, BTN_CC },               /* 0x15, CC */
    { 0x16, /*BTN_PIP_POS*/BTN_CUSTOM_61 },          /* 0x16, PIP POS */
    { 0x17, BTN_TV },               /* 0x17, Color System */
    { 0x18, BTN_PREV_PRG },         /* 0x18, Alternate Channel */
    { 0x19, /*BTN_FAV_CH*/BTN_STOP },           /* 0x19, Favorite Channel */
    { 0x1a, BTN_FAVORITE },         /* 0x1a, Favorite */
//    { 0x1b, BTN_CAPTURE },          /* 0x1b, Capture */
    { 0x1c, BTN_CURSOR_LEFT },      /* 0x1c, Left Key */
    { 0x1d, BTN_CURSOR_DOWN },      /* 0x1d, Down Key */
    { 0x1e, BTN_INPUT_SRC },        /* 0x1e, Input */
    { 0x1f, BTN_PRG_INFO },         /* 0x1f, OSD */
    { 0x40, /*BTN_SLEEP*/BTN_WIDGET },            /* 0x40, Sleep */
    { 0x41, BTN_ZOOM },             /* 0x41, Zoom */
    { 0x42, BTN_BLUE },             /* 0x42, Blue Key */
    { 0x43, BTN_EXIT },             /* 0x43, CE */
    { 0x44, BTN_CURSOR_UP },        /* 0x44, Up Key */
    { 0x45, BTN_VOL_DOWN },         /* 0x45, Volume Down */
    { 0x47, BTN_INDEX },            /* 0x47, Index */
    { 0x48, BTN_CURSOR_RIGHT },     /* 0x48, Right Key */
    { 0x49, BTN_VOL_UP },           /* 0x49, Volume Up */
    { 0x4b, BTN_EPG },              /* 0x4b, Clock */
    { 0x4c, /*BTN_TIMER*/BTN_CUSTOM_90 },            /* 0x4c, Timer */
    { 0x4d, BTN_PRG_DOWN },         /* 0x4d, Channel Down */
    { 0x4f, BTN_MEM_CARD },         /* 0x4f, Update */
    { 0x50, BTN_ADD_ERASE },        /* 0x50, ADD/Erase */
    { 0x51, BTN_PRG_UP },           /* 0x51, Channel Up */
    #ifdef CC_ANDROID_TWO_WORLDS
        { 0x54, /*BTN_FREEZE*/BTN_MENU },           /* 0x54, Freeze */
    #else
        { 0x54, /*BTN_FREEZE*/BTN_TOOLS },           /* 0x54, Freeze */
    #endif
//    { 0x55, BTN_VCHIP  },           /* 0x55, V-Chip */
    { 0x58, /*BTN_PIP_SIZE*/BTN_CUSTOM_34 },         /* 0x58, PIC SIZE */
    { 0x59, BTN_S_EFFECT },         /* 0x59, Sound Effect */
    { 0x5c, BTN_SELECT },           /* 0x5c, Enter Key */
    { 0x5d, BTN_MTS }               /* 0x5d, MTS/Lang */
};

// The MTK TV controller IRRX key map
static const KEYUNIT_T _arMtkTvBigKeyMap[] =
{
    { 0x00, BTN_RED },
    { 0x01, BTN_GREEN },
    { 0x02, BTN_POWER },
    { 0x03, BTN_YELLOW },
    { 0x04, BTN_ZOOM },
    { 0x05, BTN_BLUE },
    { 0x06, /*BTN_TIMER*/BTN_CUSTOM_90 },
    { 0x07, BTN_MEM_CARD },
    { 0x08, BTN_DIGIT_3 },
    { 0x09, BTN_DIGIT_2 },
    { 0x0a, BTN_DIGIT_1 },
    { 0x0b, BTN_SELECT },       // ENTER
    { 0x0c, BTN_DIGIT_9 },
    { 0x0d, BTN_DIGIT_8 },
    { 0x0e, BTN_DIGIT_7 },
    { 0x0f, /*BTN_FAV_CH*/BTN_STOP },       // STOP, FAV_CH
    { 0x10, BTN_DIGIT_6 },
    { 0x11, BTN_DIGIT_5 },
    { 0x12, BTN_DIGIT_4 },
    { 0x13, BTN_CURSOR_DOWN },
    #ifdef CC_ANDROID_TWO_WORLDS
        { 0x14, BTN_ROOT_MENU },
    #else
        { 0x14, BTN_MENU },
    #endif
    { 0x15, BTN_DIGIT_0 },
    #ifdef CC_ANDROID_TWO_WORLDS
        { 0x16, /*BTN_FREEZE*/BTN_MENU },
    #else
        { 0x16, /*BTN_FREEZE*/BTN_TOOLS },
    #endif
    { 0x17, BTN_RECORD },       // RECORD, CAPTURE
    { 0x18, BTN_PRG_INFO },     // INFO
    { 0x19, BTN_EPG },          // GUIDE
    { 0x1a, BTN_EXIT },
    { 0x1b, BTN_PREV },         // DVD previous, REVEAL
    { 0x1c, BTN_CURSOR_RIGHT },
    { 0x1d, BTN_CURSOR_UP },
    { 0x1e, BTN_CURSOR_LEFT },
    { 0x1f, BTN_P_EFFECT },     // P.EFFECT
    { 0x40, BTN_S_EFFECT },     // S.EFFECT
    { 0x42, /*BTN_PIP_SIZE*/BTN_CUSTOM_34 },
    { 0x43, BTN_MTS },          // MTS/Audio
    { 0x44, /*BTN_REPEAT*/BTN_NETFLIX },       // DVD REPEAT, WIDE MODE
    { 0x45, BTN_SUB_TITLE },    // SUB_TITLE
    { 0x46, /*BTN_TITLE_PBC*/BTN_CUSTOM_91 },    // DVD TITLE/PBC, MIX
    { 0x47, BTN_SWAP },
    { 0x48, BTN_FAVORITE },     // DVD PLAY_PAUSE, Favorite
    { 0x49, BTN_ADD_ERASE },    // DVD Eject, ADD_ERASE
    { 0x4a, BTN_NEXT },         // DVD next, SIZE
    { 0x4c, BTN_VOL_UP },
    { 0x4d, BTN_FR },           // DVD backward, TTX
    { 0x4e, BTN_PRG_DOWN },
    { 0x50, BTN_FF },           // DVD forward, SUBPAGE
    { 0x54, BTN_VOL_DOWN },
    { 0x55, BTN_PRG_UP },
    { 0x56, BTN_MUTE },
    { 0x57, BTN_PREV_PRG },
    { 0x58, BTN_PIP_POP },      // PIP/POP
    { 0x59, BTN_INPUT_SRC },    // Source
    { 0x5a, BTN_DIGIT_DOT },
    #ifdef CC_ANDROID_TWO_WORLDS
        { 0x5b, BTN_CUSTOM_47 },    // i-MANUAL; translate to BTN_MENU while highlevel APK
    #else
        { 0x5b, BTN_ROOT_MENU },    // DVD Root menu, INDEX
    #endif
    { 0x5c, /*BTN_PIP_POS*/BTN_CUSTOM_61 },      // PIP POS
    { 0x5d, BTN_ASPECT },
    { 0x5e, BTN_CC },
    { 0x5f, /*BTN_SLEEP*/BTN_WIDGET },
};

#endif /* MTK_IR_NEC_H */

