/* * Samsung Mobile. * * kernel/power/rpm_request.c * * Drivers for sending rpm dump request message and PMIC register list. * * Copyright (C) 2013, Samsung Electronics. * * This program is free software. You can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation */ #include #include #include #include #include #include #include #include #include #include "register_list.h" #define RPM_DUMP_REQ 0x77777777 #define DATA_SLEEP 1 #define DATA_FORCE 2 #define DATA_SEND 3 #define DATA_START 0x0 #define DATA_END 0xFFFF #define DATA_KEY 0x12345678 #define SEND_KEY 0x111 #define RPM_DUMP_RESOURCE_ID 0 static int atoi(const char *str){ int result = 0; int count = 0; if (str == NULL) return -EIO; while (str[count] != 0 /* NULL */ && str[count] >= '0' && str[count] <= '9'){ result = result * 10 + str[count] - '0'; ++count; } return result; } static void send_data(u16 reg_address,u8 offset){ int rc=0; struct msm_rpm_kvp kvp_active[] = { { .key = reg_address, .data = (void *)&offset, .length = sizeof(offset), } }; pr_info("[secpmic_dump][%s] data = %x\n",__func__,reg_address); rc = msm_rpm_send_message(MSM_RPM_CTX_ACTIVE_SET, RPM_DUMP_REQ, RPM_DUMP_RESOURCE_ID, kvp_active, ARRAY_SIZE(kvp_active)); if(rc < 0){ pr_info("[secpmic_dump][%s] error = %d\n",__func__,rc); } } static void send_reg_list(void){ int i; send_data(DATA_START,0x0); //Start Data for(i=0;i