From d3548641250dba979690a143eb4b959c21910c3b Mon Sep 17 00:00:00 2001 From: LuK1337 Date: Sat, 22 Apr 2017 16:24:50 +0200 Subject: [PATCH] Import T813XXU2BQD1 kernel source changes Change-Id: I029a632786a1e30cb0067755d16b55a583c7b235 --- drivers/firmware/qcom/tz_log.c | 368 ++---------------- .../msm/camera_v2/sensor/cci/msm_cci.c | 4 +- sound/soc/codecs/msm8x16-wcd.c | 4 +- 3 files changed, 36 insertions(+), 340 deletions(-) diff --git a/drivers/firmware/qcom/tz_log.c b/drivers/firmware/qcom/tz_log.c index 466ee27020bb..9670af3aa64a 100644 --- a/drivers/firmware/qcom/tz_log.c +++ b/drivers/firmware/qcom/tz_log.c @@ -22,8 +22,6 @@ #include #include #include -#include - #include #include @@ -53,10 +51,10 @@ * Length of descriptive name associated with Interrupt */ #define TZBSP_MAX_INT_DESC 16 -/* - * TZ 3.X version info - */ -#define QSEE_VERSION_TZ_3_X 0x800000 + +#ifdef CONFIG_TIMA_GET_QSEE_LOGS_USING_RDX +extern void set_qsee_log_address(unsigned int address); +#endif /* * VMID Table */ @@ -75,19 +73,6 @@ struct tzdbg_boot_info_t { uint32_t warm_jmp_addr; /* Last Warmboot Jump Address */ uint32_t spare; /* Reserved for future use. */ }; -/* - * Boot Info Table for 64-bit - */ -struct tzdbg_boot_info64_t { - uint32_t wb_entry_cnt; /* Warmboot entry CPU Counter */ - uint32_t wb_exit_cnt; /* Warmboot exit CPU Counter */ - uint32_t pc_entry_cnt; /* Power Collapse entry CPU Counter */ - uint32_t pc_exit_cnt; /* Power Collapse exit CPU counter */ - uint32_t psci_entry_cnt;/* PSCI syscall entry CPU Counter */ - uint32_t psci_exit_cnt; /* PSCI syscall exit CPU Counter */ - uint64_t warm_jmp_addr; /* Last Warmboot Jump Address */ - uint32_t warm_jmp_instr; /* Last Warmboot Jump Address Instruction */ -}; /* * Reset Info Table */ @@ -199,40 +184,6 @@ struct tzdbg_t { struct tzdbg_log_t ring_buffer; /* TZ Ring Buffer */ }; -struct hypdbg_log_pos_t { - uint16_t wrap; - uint16_t offset; -}; - -struct hypdbg_boot_info_t { - uint32_t warm_entry_cnt; - uint32_t warm_exit_cnt; -}; - -struct hypdbg_t { - /* Magic Number */ - uint32_t magic_num; - - /* Number of CPU's */ - uint32_t cpu_count; - - /* Ring Buffer Offset */ - uint32_t ring_off; - - /* Ring buffer position mgmt */ - struct hypdbg_log_pos_t log_pos; - uint32_t log_len; - - /* S2 fault numbers */ - uint32_t s2_fault_counter; - - /* Boot Info */ - struct hypdbg_boot_info_t boot_info[TZBSP_MAX_CPU_COUNT]; - - /* Ring buffer pointer */ - uint8_t log_buf_p[]; -}; - /* * Enumeration order for VMID's */ @@ -244,8 +195,6 @@ enum tzdbg_stats_type { TZDBG_GENERAL, TZDBG_LOG, TZDBG_QSEE_LOG, - TZDBG_HYP_GENERAL, - TZDBG_HYP_LOG, TZDBG_STATS_MAX }; @@ -256,17 +205,14 @@ struct tzdbg_stat { struct tzdbg { void __iomem *virt_iobase; - void __iomem *hyp_virt_iobase; struct tzdbg_t *diag_buf; - struct hypdbg_t *hyp_diag_buf; char *disp_buf; int debug_tz[TZDBG_STATS_MAX]; struct tzdbg_stat stat[TZDBG_STATS_MAX]; - uint32_t hyp_debug_rw_buf_size; - bool is_hyplog_enabled; }; static struct tzdbg tzdbg = { + .stat[TZDBG_BOOT].name = "boot", .stat[TZDBG_RESET].name = "reset", .stat[TZDBG_INTERRUPT].name = "interrupt", @@ -274,8 +220,6 @@ static struct tzdbg tzdbg = { .stat[TZDBG_GENERAL].name = "general", .stat[TZDBG_LOG].name = "log", .stat[TZDBG_QSEE_LOG].name = "qsee_log", - .stat[TZDBG_HYP_GENERAL].name = "hyp_general", - .stat[TZDBG_HYP_LOG].name = "hyp_log", }; static struct tzdbg_log_t *g_qsee_log; @@ -335,90 +279,30 @@ static int _disp_tz_boot_stats(void) { int i; int len = 0; - struct tzdbg_boot_info_t *ptr = NULL; - struct tzdbg_boot_info64_t *ptr_64 = NULL; - int ret = 0; - uint32_t smc_id = 0; - uint32_t feature = 10; - struct qseecom_command_scm_resp resp = {}; - struct scm_desc desc = {0}; + struct tzdbg_boot_info_t *ptr; - if (!is_scm_armv8()) { - ret = scm_call(SCM_SVC_INFO, SCM_SVC_UTIL, &feature, - sizeof(feature), &resp, sizeof(resp)); - } else { - smc_id = TZ_INFO_GET_FEATURE_VERSION_ID; - desc.arginfo = TZ_INFO_GET_FEATURE_VERSION_ID_PARAM_ID; - desc.args[0] = feature; - ret = scm_call2(smc_id, &desc); - resp.result = desc.ret[0]; - } - - if (ret) { - pr_err("%s: scm_call to register log buffer failed\n", - __func__); - return 0; - } - pr_info("qsee_version = 0x%x\n", resp.result); - - if (resp.result >= QSEE_VERSION_TZ_3_X) { - ptr_64 = (struct tzdbg_boot_info64_t *)((unsigned char *) - tzdbg.diag_buf + tzdbg.diag_buf->boot_info_off); - } else { - ptr = (struct tzdbg_boot_info_t *)((unsigned char *) - tzdbg.diag_buf + tzdbg.diag_buf->boot_info_off); - } + ptr = (struct tzdbg_boot_info_t *)((unsigned char *)tzdbg.diag_buf + + tzdbg.diag_buf->boot_info_off); for (i = 0; i < tzdbg.diag_buf->cpu_count; i++) { - if (resp.result >= QSEE_VERSION_TZ_3_X) { - len += snprintf(tzdbg.disp_buf + len, - (debug_rw_buf_size - 1) - len, - " CPU #: %d\n" - " Warmboot jump address : 0x%llx\n" - " Warmboot entry CPU counter : 0x%x\n" - " Warmboot exit CPU counter : 0x%x\n" - " Power Collapse entry CPU counter : 0x%x\n" - " Power Collapse exit CPU counter : 0x%x\n" - " Psci entry CPU counter : 0x%x\n" - " Psci exit CPU counter : 0x%x\n" - " Warmboot Jump Address Instruction : 0x%x\n", - i, (uint64_t)ptr_64->warm_jmp_addr, - ptr_64->wb_entry_cnt, - ptr_64->wb_exit_cnt, - ptr_64->pc_entry_cnt, - ptr_64->pc_exit_cnt, - ptr_64->psci_entry_cnt, - ptr_64->psci_exit_cnt, - ptr_64->warm_jmp_instr); + len += snprintf(tzdbg.disp_buf + len, + (debug_rw_buf_size - 1) - len, + " CPU #: %d\n" + " Warmboot jump address : 0x%x\n" + " Warmboot entry CPU counter: 0x%x\n" + " Warmboot exit CPU counter : 0x%x\n" + " Power Collapse entry CPU counter: 0x%x\n" + " Power Collapse exit CPU counter : 0x%x\n", + i, ptr->warm_jmp_addr, ptr->wb_entry_cnt, + ptr->wb_exit_cnt, ptr->pc_entry_cnt, + ptr->pc_exit_cnt); - if (len > (debug_rw_buf_size - 1)) { - pr_warn("%s: Cannot fit all info into the buffer\n", - __func__); - break; - } - ptr_64++; - } else { - len += snprintf(tzdbg.disp_buf + len, - (debug_rw_buf_size - 1) - len, - " CPU #: %d\n" - " Warmboot jump address : 0x%x\n" - " Warmboot entry CPU counter: 0x%x\n" - " Warmboot exit CPU counter : 0x%x\n" - " Power Collapse entry CPU counter: 0x%x\n" - " Power Collapse exit CPU counter : 0x%x\n", - i, ptr->warm_jmp_addr, - ptr->wb_entry_cnt, - ptr->wb_exit_cnt, - ptr->pc_entry_cnt, - ptr->pc_exit_cnt); - - if (len > (debug_rw_buf_size - 1)) { - pr_warn("%s: Cannot fit all info into the buffer\n", - __func__); - break; - } - ptr++; + if (len > (debug_rw_buf_size - 1)) { + pr_warn("%s: Cannot fit all info into the buffer\n", + __func__); + break; } + ptr++; } tzdbg.stat[TZDBG_BOOT].data = tzdbg.disp_buf; return len; @@ -589,78 +473,6 @@ static int _disp_log_stats(struct tzdbg_log_t *log, return len; } -static int __disp_hyp_log_stats(uint8_t *log, - struct hypdbg_log_pos_t *log_start, uint32_t log_len, - size_t count, uint32_t buf_idx) -{ - struct hypdbg_t *hyp = tzdbg.hyp_diag_buf; - unsigned long t = 0; - uint32_t wrap_start; - uint32_t wrap_end; - uint32_t wrap_cnt; - int max_len; - int len = 0; - int i = 0; - - wrap_start = log_start->wrap; - wrap_end = hyp->log_pos.wrap; - - /* Calculate difference in # of buffer wrap-arounds */ - if (wrap_end >= wrap_start) { - wrap_cnt = wrap_end - wrap_start; - } else { - /* wrap counter has wrapped around, invalidate start position */ - wrap_cnt = 2; - } - - if (wrap_cnt > 1) { - /* end position has wrapped around more than once, */ - /* current start no longer valid */ - log_start->wrap = hyp->log_pos.wrap - 1; - log_start->offset = (hyp->log_pos.offset + 1) % log_len; - } else if ((wrap_cnt == 1) && - (hyp->log_pos.offset > log_start->offset)) { - /* end position has overwritten start */ - log_start->offset = (hyp->log_pos.offset + 1) % log_len; - } - - while (log_start->offset == hyp->log_pos.offset) { - /* - * No data in ring buffer, - * so we'll hang around until something happens - */ - t = msleep_interruptible(50); - if (t != 0) { - /* Some event woke us up, so let's quit */ - return 0; - } - - /* TZDBG_HYP_LOG */ - memcpy_fromio((void *)tzdbg.hyp_diag_buf, tzdbg.hyp_virt_iobase, - tzdbg.hyp_debug_rw_buf_size); - } - - max_len = (count > tzdbg.hyp_debug_rw_buf_size) ? - tzdbg.hyp_debug_rw_buf_size : count; - - /* - * Read from ring buff while there is data and space in return buff - */ - while ((log_start->offset != hyp->log_pos.offset) && (len < max_len)) { - tzdbg.disp_buf[i++] = log[log_start->offset]; - log_start->offset = (log_start->offset + 1) % log_len; - if (0 == log_start->offset) - ++log_start->wrap; - ++len; - } - - /* - * return buffer to caller - */ - tzdbg.stat[buf_idx].data = tzdbg.disp_buf; - return len; -} - static int _disp_tz_log_stats(size_t count) { static struct tzdbg_log_pos_t log_start = {0}; @@ -673,18 +485,6 @@ static int _disp_tz_log_stats(size_t count) tzdbg.diag_buf->ring_len, count, TZDBG_LOG); } -static int _disp_hyp_log_stats(size_t count) -{ - static struct hypdbg_log_pos_t log_start = {0}; - uint8_t *log_ptr; - - log_ptr = (uint8_t *)((unsigned char *)tzdbg.hyp_diag_buf + - tzdbg.hyp_diag_buf->ring_off); - - return __disp_hyp_log_stats(log_ptr, &log_start, - tzdbg.hyp_debug_rw_buf_size, count, TZDBG_HYP_LOG); -} - static int _disp_qsee_log_stats(size_t count) { static struct tzdbg_log_pos_t log_start = {0}; @@ -694,42 +494,6 @@ static int _disp_qsee_log_stats(size_t count) count, TZDBG_QSEE_LOG); } -static int _disp_hyp_general_stats(size_t count) -{ - int len = 0; - int i; - struct hypdbg_boot_info_t *ptr = NULL; - - len += snprintf((unsigned char *)tzdbg.disp_buf + len, - tzdbg.hyp_debug_rw_buf_size - 1, - " Magic Number : 0x%x\n" - " CPU Count : 0x%x\n" - " S2 Fault Counter: 0x%x\n", - tzdbg.hyp_diag_buf->magic_num, - tzdbg.hyp_diag_buf->cpu_count, - tzdbg.hyp_diag_buf->s2_fault_counter); - - ptr = tzdbg.hyp_diag_buf->boot_info; - for (i = 0; i < tzdbg.hyp_diag_buf->cpu_count; i++) { - len += snprintf((unsigned char *)tzdbg.disp_buf + len, - (tzdbg.hyp_debug_rw_buf_size - 1) - len, - " CPU #: %d\n" - " Warmboot entry CPU counter: 0x%x\n" - " Warmboot exit CPU counter : 0x%x\n", - i, ptr->warm_entry_cnt, ptr->warm_exit_cnt); - - if (len > (tzdbg.hyp_debug_rw_buf_size - 1)) { - pr_warn("%s: Cannot fit all info into the buffer\n", - __func__); - break; - } - ptr++; - } - - tzdbg.stat[TZDBG_HYP_GENERAL].data = (char *)tzdbg.disp_buf; - return len; -} - static ssize_t tzdbgfs_read(struct file *file, char __user *buf, size_t count, loff_t *offp) { @@ -738,8 +502,6 @@ static ssize_t tzdbgfs_read(struct file *file, char __user *buf, memcpy_fromio((void *)tzdbg.diag_buf, tzdbg.virt_iobase, debug_rw_buf_size); - memcpy_fromio((void *)tzdbg.hyp_diag_buf, tzdbg.hyp_virt_iobase, - tzdbg.hyp_debug_rw_buf_size); switch (*tz_id) { case TZDBG_BOOT: len = _disp_tz_boot_stats(); @@ -769,13 +531,6 @@ static ssize_t tzdbgfs_read(struct file *file, char __user *buf, len = _disp_qsee_log_stats(count); *offp = 0; break; - case TZDBG_HYP_GENERAL: - len = _disp_hyp_general_stats(count); - break; - case TZDBG_HYP_LOG: - len = _disp_hyp_log_stats(count); - *offp = 0; - break; default: break; } @@ -868,6 +623,11 @@ static void tzdbg_register_qsee_log_buf(void) goto err2; } +#ifdef CONFIG_TIMA_GET_QSEE_LOGS_USING_RDX + /* QSEE Logs */ + set_qsee_log_address((uint32_t)pa); +#endif + g_qsee_log = (struct tzdbg_log_t *)ion_map_kernel(g_ion_clnt, g_ihandle); @@ -912,8 +672,7 @@ static int tzdbgfs_init(struct platform_device *pdev) goto err; } } - tzdbg.disp_buf = kzalloc(max(debug_rw_buf_size, - tzdbg.hyp_debug_rw_buf_size), GFP_KERNEL); + tzdbg.disp_buf = kzalloc(debug_rw_buf_size, GFP_KERNEL); if (tzdbg.disp_buf == NULL) { pr_err("%s: Can't Allocate memory for tzdbg.disp_buf\n", __func__); @@ -940,51 +699,8 @@ static void tzdbgfs_exit(struct platform_device *pdev) ion_unmap_kernel(g_ion_clnt, g_ihandle); ion_free(g_ion_clnt, g_ihandle); } - ion_client_destroy(g_ion_clnt); - } + ion_client_destroy(g_ion_clnt); } - -static int __update_hypdbg_base(struct platform_device *pdev, - void __iomem *virt_iobase) -{ - phys_addr_t hypdiag_phy_iobase; - uint32_t hyp_address_offset; - uint32_t hyp_size_offset; - struct hypdbg_t *hyp; - uint32_t *ptr = NULL; - - if (of_property_read_u32((&pdev->dev)->of_node, "hyplog-address-offset", - &hyp_address_offset)) { - dev_err(&pdev->dev, "hyplog address offset is not defined\n"); - return -EINVAL; - } - if (of_property_read_u32((&pdev->dev)->of_node, "hyplog-size-offset", - &hyp_size_offset)) { - dev_err(&pdev->dev, "hyplog size offset is not defined\n"); - return -EINVAL; - } - - hypdiag_phy_iobase = readl_relaxed(virt_iobase + hyp_address_offset); - tzdbg.hyp_debug_rw_buf_size = readl_relaxed(virt_iobase + - hyp_size_offset); - - tzdbg.hyp_virt_iobase = devm_ioremap_nocache(&pdev->dev, - hypdiag_phy_iobase, - tzdbg.hyp_debug_rw_buf_size); - if (!tzdbg.hyp_virt_iobase) { - dev_err(&pdev->dev, "ERROR could not ioremap: start=%pr, len=%u\n", - &hypdiag_phy_iobase, tzdbg.hyp_debug_rw_buf_size); - return -ENXIO; - } - - ptr = kzalloc(tzdbg.hyp_debug_rw_buf_size, GFP_KERNEL); - if (!ptr) - return -ENOMEM; - - tzdbg.hyp_diag_buf = (struct hypdbg_t *)ptr; - hyp = tzdbg.hyp_diag_buf; - hyp->log_pos.wrap = hyp->log_pos.offset = 0; - return 0; } /* @@ -996,7 +712,6 @@ static int tz_log_probe(struct platform_device *pdev) void __iomem *virt_iobase; phys_addr_t tzdiag_phy_iobase; uint32_t *ptr = NULL; - int ret = 0; /* * Get address that stores the physical location diagnostic data @@ -1025,24 +740,6 @@ static int tz_log_probe(struct platform_device *pdev) (unsigned int)(debug_rw_buf_size)); return -ENXIO; } - - if (pdev->dev.of_node) { - tzdbg.is_hyplog_enabled = of_property_read_bool( - (&pdev->dev)->of_node, "qcom,hyplog-enabled"); - if (tzdbg.is_hyplog_enabled) { - ret = __update_hypdbg_base(pdev, virt_iobase); - if (ret) { - dev_err(&pdev->dev, "%s() failed to get device tree data ret = %d\n", - __func__, ret); - return -EINVAL; - } - } else { - dev_info(&pdev->dev, "Hyp log service is not supported\n"); - } - } else { - dev_dbg(&pdev->dev, "Device tree data is not found\n"); - } - /* * Retrieve the address of diagnostic data */ @@ -1085,8 +782,6 @@ err: static int tz_log_remove(struct platform_device *pdev) { kzfree(tzdbg.diag_buf); - if (tzdbg.hyp_diag_buf) - kzfree(tzdbg.hyp_diag_buf); tzdbgfs_exit(pdev); return 0; @@ -1123,4 +818,5 @@ module_exit(tz_log_exit); MODULE_LICENSE("GPL v2"); MODULE_DESCRIPTION("TZ Log driver"); +MODULE_VERSION("1.1"); MODULE_ALIAS("platform:tz_log"); diff --git a/drivers/media/platform/msm/camera_v2/sensor/cci/msm_cci.c b/drivers/media/platform/msm/camera_v2/sensor/cci/msm_cci.c index 566d1a67c3c0..7e4d1d632e47 100644 --- a/drivers/media/platform/msm/camera_v2/sensor/cci/msm_cci.c +++ b/drivers/media/platform/msm/camera_v2/sensor/cci/msm_cci.c @@ -58,8 +58,6 @@ static int32_t msm_cci_set_clk_param(struct cci_device *cci_dev, enum cci_i2c_master_t master = c_ctrl->cci_info->cci_i2c_master; enum i2c_freq_mode_t i2c_freq_mode = c_ctrl->cci_info->i2c_freq_mode; - clk_params = &cci_dev->cci_clk_params[i2c_freq_mode]; - if ((i2c_freq_mode >= I2C_MAX_MODES) || (i2c_freq_mode < 0)) { pr_err("%s:%d invalid i2c_freq_mode = %d", __func__, __LINE__, i2c_freq_mode); @@ -67,6 +65,8 @@ static int32_t msm_cci_set_clk_param(struct cci_device *cci_dev, } if (cci_dev->i2c_freq_mode[master] == i2c_freq_mode) return 0; + + clk_params = &cci_dev->cci_clk_params[i2c_freq_mode]; if (MASTER_0 == master) { msm_camera_io_w_mb(clk_params->hw_thigh << 16 | clk_params->hw_tlow, diff --git a/sound/soc/codecs/msm8x16-wcd.c b/sound/soc/codecs/msm8x16-wcd.c index c3b215450832..9a7279d9b8ae 100644 --- a/sound/soc/codecs/msm8x16-wcd.c +++ b/sound/soc/codecs/msm8x16-wcd.c @@ -3508,7 +3508,7 @@ static int msm8x16_wcd_codec_enable_micbias(struct snd_soc_dapm_widget *w, snd_soc_update_bits(codec, micb_int_reg, 0x08, 0x08); msm8x16_notifier_call(codec, WCD_EVENT_POST_MICBIAS_2_ON); - } else if (strnstr(w->name, internal3_text, 30)) { + } else if (strnstr(w->name, internal3_text, strlen(w->name))) { snd_soc_update_bits(codec, micb_int_reg, 0x01, 0x01); } else if (strnstr(w->name, external2_text, strlen(w->name))) { msm8x16_notifier_call(codec, @@ -3536,7 +3536,7 @@ static int msm8x16_wcd_codec_enable_micbias(struct snd_soc_dapm_widget *w, } else if (strnstr(w->name, internal2_text, strlen(w->name))) { msm8x16_notifier_call(codec, WCD_EVENT_POST_MICBIAS_2_OFF); - } else if (strnstr(w->name, internal3_text, 30)) { + } else if (strnstr(w->name, internal3_text, strlen(w->name))) { snd_soc_update_bits(codec, micb_int_reg, 0x2, 0x0); } else if (strnstr(w->name, external2_text, strlen(w->name))) { /*