int proc_comm_get_btn_type(int vset, int *voltage, int status)
{
    uint32_t smem_proc_comm_oem_cmd1    = PCOM_CUSTOMER_CMD1;
    uint32_t smem_proc_comm_oem_data1   = SMEM_PROC_COMM_OEM_GET_BTN_TYPE;
    uint32_t smem_proc_comm_oem_data2   = 0; //useless
    
    int32_t data[2];
    int32_t ret = 0;

    memset((void*)data, 0x00, sizeof(data));
    data[0] = vset;
    //status = 0:off / 1:on
    data[1] = status;
    
    ret = msm_proc_comm_oem_n(smem_proc_comm_oem_cmd1,
                                    &smem_proc_comm_oem_data1,
                                    &smem_proc_comm_oem_data2,
                                    data,
                                    2); 
    if (ret != 0){
        printk(KERN_ERR 
                "%s: SMEM_PROC_COMM_OEM_CONFIG_COIN_CELL FAILED!!\n",
                __func__);
    }
    
    *voltage = data[0];
    
    return ret; //mV
}
Example #2
0
/*--------------------------------------------------------------------------*
 * Function    : fih_write_fihdbg_config_nv
 *
 * Description :
 *     Write fih debug configuration settings into nv item (NV_FIHDBG_I).
 *
 * Parameters  :
 *     String of 16 bytes fih debug configuration setting array in
 *     unsigned char.
 *
 * Return value: Integer
 *     Zero     - Successful
 *     Not zero - Fail
 *--------------------------------------------------------------------------*/
int fih_write_fihdbg_config_nv( unsigned char* fih_debug )
{
    unsigned smem_response;
    uint32_t oem_cmd = SMEM_PROC_COMM_OEM_NV_WRITE;
    unsigned int cmd_para[FIH_DEBUG_CMD_DATA_SIZE];
    int ret = 0;

    printk(KERN_INFO "[SMEM_PROC_COMM] %s() LINE:%d \n", __func__, __LINE__);
    if ( fih_debug == NULL )
    {
        printk(KERN_ERR "[SMEM_PROC_COMM] %s() LINE:%d, ERROR: fih_debug is NULL.\n", __func__, __LINE__);
        ret = -EINVAL;
    }
    else
    {
        cmd_para[0] = NV_FIHDBG_I;
        memcpy( &cmd_para[1], fih_debug, FIH_DEBUG_CFG_LEN );
        ret = msm_proc_comm_oem_n(PCOM_CUSTOMER_CMD1, &oem_cmd, &smem_response, cmd_para, FIH_DEBUG_CMD_DATA_SIZE);
        if(ret != 0)
        {
            printk(KERN_ERR "[SMEM_PROC_COMM] %s() LINE:%d, ERROR: ret %d, cmd_para[0] %d.\n", __func__, __LINE__, ret, cmd_para[0]);
        }
    }
    return ret;
}
int proc_comm_ftm_wlanaddr_read(char * buf)
{
    uint32_t smem_proc_comm_oem_cmd1    = PCOM_CUSTOMER_CMD1;
    uint32_t smem_proc_comm_oem_data1   = SMEM_PROC_COMM_OEM_NV_READ;
    uint32_t smem_proc_comm_oem_data2   = 0; //useless
    static int32_t data[3] = {0};
    int32_t ret = 0;

    if (getwlanmac == 0) {
        memset((void*)data, 0x00, sizeof(data));
        data[0] = (uint32_t)4678;   // NV_WLAN_MAC_ADDRESS_I

        ret = msm_proc_comm_oem_n(smem_proc_comm_oem_cmd1,
                &smem_proc_comm_oem_data1,
                &smem_proc_comm_oem_data2,
                data,
                3);
        if (ret != 0) {
            printk(KERN_ERR
                    "%s: SMEM_PROC_COMM_OEM_FIH FAILED!!\n",
                    __func__);
            return ret;
        } else {
            getwlanmac = 1;
            printk(KERN_INFO "%s:Get MAC by OEM command\n", __func__);
        }
    } else {
        printk(KERN_INFO "%s:Get MAC by cached MAC\n", __func__);
    }

    memcpy(buf, &data[1], sizeof(char)*6);
    if ((data[1] == 0) && (data[2] == 0)) ret = -1;
    printk(KERN_INFO "proc_comm_ftm_wlanaddr_read() '0x%x:%x:%x:%x:%x:%x'\n", buf[5], buf[4],buf[3], buf[2],buf[1], buf[0]);
    return ret;
}
void proc_comm_ftm_wlanaddr_write(char* buf)
{
    uint32_t smem_proc_comm_oem_cmd1    = PCOM_CUSTOMER_CMD1;
    uint32_t smem_proc_comm_oem_data1   = SMEM_PROC_COMM_OEM_NV_WRITE;
    uint32_t smem_proc_comm_oem_data2   = 0; //useless
    int32_t data[3];

    printk(KERN_INFO "proc_comm_ftm_wlanaddr_write() '0x%x:%x:%x:%x:%x:%x'\n", buf[5], buf[4], buf[3], buf[2], buf[1], buf[0]);

    memset((void*)data, 0x00, sizeof(data));
    data[0] = (uint32_t)4678;   // NV_WLAN_MAC_ADDRESS_I
    memcpy((void *)&data[1],buf,6);

    if (0 != msm_proc_comm_oem_n(smem_proc_comm_oem_cmd1, 
                                    &smem_proc_comm_oem_data1,
                                    &smem_proc_comm_oem_data2,
                                    data,
                                    3)) {
        printk(KERN_ERR
                "%s: SMEM_PROC_COMM_OEM_FIH FAILED!!\n",
                __func__);
    }

    getwlanmac = 0;
}
int proc_comm_is_charger_connected(int *isConnected)
{
    uint32_t smem_proc_comm_oem_cmd1    = PCOM_CUSTOMER_CMD1;
    uint32_t smem_proc_comm_oem_data1   = SMEM_PROC_COMM_OEM_IS_CHARGER_CONNECTED;
    uint32_t smem_proc_comm_oem_data2   = 0; //useless
    
    int32_t data[2];
    int32_t ret = 0;

    memset((void*)data, 0x00, sizeof(data));
    data[0] = 0;
    data[1] = 0;
    
    ret = msm_proc_comm_oem_n(smem_proc_comm_oem_cmd1,
                                    &smem_proc_comm_oem_data1,
                                    &smem_proc_comm_oem_data2,
                                    data,
                                    2); 
    if (ret != 0){
        printk(KERN_ERR 
                "%s: SMEM_PROC_COMM_OEM_CONFIG_COIN_CELL FAILED!!\n",
                __func__);
    }
    
    *isConnected = data[0];
    return ret;
}
int	smem_proc_oem_light_control( int32_t *data, int number )
{
	uint32_t smem_proc_comm_oem_cmd1    = PCOM_CUSTOMER_CMD1;
	uint32_t smem_proc_comm_oem_data1   = SMEM_PROC_COMM_OEM_LIGHT_CONTROL;
	uint32_t smem_proc_comm_oem_data2   = 0;

	if( msm_proc_comm_oem_n( smem_proc_comm_oem_cmd1, &smem_proc_comm_oem_data1, &smem_proc_comm_oem_data2, data, number ) ) //MTD-BSP-REXER-PROC-00*
	{
		printk( KERN_ERR "LED : SMEM_PROC_COMM_OEM_LIGHT_CONTROL failed!!!\n" );
		return 0;
	}
       
	return 1;
}
Example #7
0
/*--------------------------------------------------------------------------*
 * Function    : fih_read_fihdbg_config_nv
 *
 * Description :
 *     Read fih debug configuration settings from nv item (NV_FIHDBG_I).
 *
 * Parameters  :
 *     String of 16 bytes fih debug configuration setting array in
 *     unsigned char.
 *
 * Return value: Integer
 *     Zero     - Successful
 *     Not zero - Fail
 *--------------------------------------------------------------------------*/
int fih_read_fihdbg_config_nv( unsigned char* fih_debug )
{
    unsigned smem_response;
    uint32_t oem_cmd = SMEM_PROC_COMM_OEM_NV_READ;
    unsigned int cmd_para[FIH_DEBUG_CMD_DATA_SIZE];
    int ret = 0;
    int i; //SW2-5-1-BH-DbgCfgTool-02+

    printk(KERN_INFO "[SMEM_PROC_COMM] %s() LINE:%d \n", __func__, __LINE__);
    if ( fih_debug == NULL )
    {
        printk(KERN_ERR "[SMEM_PROC_COMM] %s() LINE:%d, ERROR: fih_debug is NULL.\n", __func__, __LINE__);
        ret = -EINVAL;
    }
    else
    {
        cmd_para[0] = NV_FIHDBG_I;
        ret = msm_proc_comm_oem_n(PCOM_CUSTOMER_CMD1, &oem_cmd, &smem_response, cmd_para, FIH_DEBUG_CMD_DATA_SIZE);
        if(ret == 0)
        {
            //SW2-5-1-BH-DbgCfgTool-02*[
            i=0;
#ifdef CONFIG_FIH_PROJECT_SAX
            i=1;
#endif
            memcpy( fih_debug, &cmd_para[i], FIH_DEBUG_CFG_LEN );

            //SW2-5-1-BH-DbgCfgTool-02*]
        }
        else
        {
            printk(KERN_ERR "[SMEM_PROC_COMM] %s() LINE:%d, ERROR: ret %d, cmd_para[0] %d.\n", __func__, __LINE__, ret, cmd_para[0]);
        }
    }
    return ret;
}