diff options
33 files changed, 376 insertions, 122 deletions
diff --git a/Documentation/devicetree/bindings/media/video/msm-cam.txt b/Documentation/devicetree/bindings/media/video/msm-cam.txt index 9763bf8e4051..371447cfb64e 100644 --- a/Documentation/devicetree/bindings/media/video/msm-cam.txt +++ b/Documentation/devicetree/bindings/media/video/msm-cam.txt @@ -6,10 +6,14 @@ Required properties: - reg : offset and length of msm camera device registers. - reg-names : should specify relevant names for each reg property defined. +Optional properties: +- qcom,gpu-limit : valid kgsl frequency. + Example: qcom,msm-cam@fd8c0000 { compatible = "qcom,msm-cam"; reg = <0xfd8C0000 0x10000>; reg-names = "msm-cam"; + qcom,gpu-limit = <700000000>; }; diff --git a/Documentation/devicetree/bindings/pil/pil-q6v5-mss.txt b/Documentation/devicetree/bindings/pil/pil-q6v5-mss.txt index be5633024986..47a6fdd300ca 100644 --- a/Documentation/devicetree/bindings/pil/pil-q6v5-mss.txt +++ b/Documentation/devicetree/bindings/pil/pil-q6v5-mss.txt @@ -89,6 +89,13 @@ Optional properties: - qcom,cx-ipeak-vote: Boolean- Present if we need to set bit 5 of cxip_lm_vote_clear during modem shutdown +One child node to represent the MBA image may be specified, when the MBA image +needs to be loaded in a specifically carved out memory region. + +Required properties: +- compatible: Must be "qcom,pil-mba-mem" +- memory-region: A phandle that points to a reserved memory where the MBA image will be loaded. + Example: qcom,mss@fc880000 { compatible = "qcom,pil-q6v5-mss"; @@ -128,4 +135,9 @@ Example: qcom,gpio-force-stop = <&smp2pgpio_ssr_smp2p_1_out 0 0>; qcom,ssctl-instance-id = <12>; qcom,sysmon-id = <0>; + + qcom,mba-mem@0 { + compatible = "qcom,pil-mba-mem"; + memory-region = <&peripheral_mem>; + }; }; diff --git a/arch/arm/boot/dts/qcom/dsi-panel-nt35695b-truly-fhd-cmd.dtsi b/arch/arm/boot/dts/qcom/dsi-panel-nt35695b-truly-fhd-cmd.dtsi index e3f60de3c3eb..49afd34c50e7 100644 --- a/arch/arm/boot/dts/qcom/dsi-panel-nt35695b-truly-fhd-cmd.dtsi +++ b/arch/arm/boot/dts/qcom/dsi-panel-nt35695b-truly-fhd-cmd.dtsi @@ -185,5 +185,6 @@ qcom,mdss-dsi-reset-sequence = <1 10>, <0 10>, <1 10>; qcom,mdss-dsi-tx-eot-append; qcom,mdss-dsi-post-init-delay = <1>; + qcom,ulps-enabled; }; }; diff --git a/arch/arm/boot/dts/qcom/dsi-panel-truly-1080p-cmd.dtsi b/arch/arm/boot/dts/qcom/dsi-panel-truly-1080p-cmd.dtsi index 51bb891f98d6..42e44cf838ab 100644 --- a/arch/arm/boot/dts/qcom/dsi-panel-truly-1080p-cmd.dtsi +++ b/arch/arm/boot/dts/qcom/dsi-panel-truly-1080p-cmd.dtsi @@ -1,4 +1,4 @@ -/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved. +/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -90,5 +90,6 @@ qcom,mdss-dsi-bl-pmic-control-type = "bl_ctrl_wled"; qcom,mdss-dsi-reset-sequence = <1 10>, <0 10>, <1 10>; qcom,mdss-dsi-post-init-delay = <1>; + qcom,ulps-enabled; }; }; diff --git a/arch/arm/boot/dts/qcom/sdm630-mdss.dtsi b/arch/arm/boot/dts/qcom/sdm630-mdss.dtsi index d7a0c33019f2..d236dbbad7ec 100644 --- a/arch/arm/boot/dts/qcom/sdm630-mdss.dtsi +++ b/arch/arm/boot/dts/qcom/sdm630-mdss.dtsi @@ -62,8 +62,8 @@ qcom,max-bandwidth-per-pipe-kbps = <1 3200000>, /* Default */ <2 2400000>; /* Camera */ qcom,max-clk-rate = <412500000>; - qcom,mdss-default-ot-rd-limit = <32>; - qcom,mdss-default-ot-wr-limit = <40>; + qcom,mdss-default-ot-rd-limit = <40>; + qcom,mdss-default-ot-wr-limit = <32>; qcom,mdss-dram-channels = <2>; /* Bandwidth limit settings */ @@ -480,8 +480,8 @@ qcom,mdss-rot-vbif-qos-setting = <1 1 1 1>; qcom,mdss-rot-xin-id = <14 15>; - qcom,mdss-default-ot-rd-limit = <32>; - qcom,mdss-default-ot-wr-limit = <40>; + qcom,mdss-default-ot-rd-limit = <40>; + qcom,mdss-default-ot-wr-limit = <32>; }; }; diff --git a/arch/arm/boot/dts/qcom/sdm630-qrd.dtsi b/arch/arm/boot/dts/qcom/sdm630-qrd.dtsi index 59afb993fb83..b1fed582aa1e 100644 --- a/arch/arm/boot/dts/qcom/sdm630-qrd.dtsi +++ b/arch/arm/boot/dts/qcom/sdm630-qrd.dtsi @@ -10,8 +10,19 @@ * GNU General Public License for more details. */ +#include "msm-pm660a.dtsi" #include "sdm660-pinctrl.dtsi" / { + qrd_batterydata: qcom,battery-data { + qcom,batt-id-range-pct = <15>; + + #include "fg-gen3-batterydata-qrd-skuk-4v4-3000mah.dtsi" + }; +}; + +&pm660_fg { + qcom,battery-data = <&qrd_batterydata>; + qcom,fg-jeita-thresholds = <0 5 55 55>; }; &uartblsp1dm1 { @@ -100,5 +111,31 @@ status = "ok"; }; +&pm660l_gpios { + /* GPIO 7 for VOL_UP */ + gpio@c600 { + status = "ok"; + qcom,mode = <0>; + qcom,pull = <0>; + qcom,vin-sel = <0>; + qcom,src-sel = <0>; + qcom,out-strength = <1>; + }; +}; + &soc { + gpio_keys { + compatible = "gpio-keys"; + input-name = "gpio-keys"; + status = "ok"; + + vol_up { + label = "volume_up"; + gpios = <&pm660l_gpios 7 0x1>; + linux,input-type = <1>; + linux,code = <115>; + gpio-key,wakeup; + debounce-interval = <15>; + }; + }; }; diff --git a/arch/arm/boot/dts/qcom/sdm660-camera.dtsi b/arch/arm/boot/dts/qcom/sdm660-camera.dtsi index 16127bfccf35..d6a3a143d304 100644 --- a/arch/arm/boot/dts/qcom/sdm660-camera.dtsi +++ b/arch/arm/boot/dts/qcom/sdm660-camera.dtsi @@ -19,6 +19,7 @@ status = "ok"; bus-vectors = "suspend", "svs", "nominal", "turbo"; qcom,bus-votes = <0 150000000 320000000 320000000>; + qcom,gpu-limit = <700000000>; }; qcom,csiphy@c824000 { diff --git a/arch/arm/boot/dts/qcom/sdm660-cdp.dtsi b/arch/arm/boot/dts/qcom/sdm660-cdp.dtsi index 1145bfa63cba..33303f1e2a74 100644 --- a/arch/arm/boot/dts/qcom/sdm660-cdp.dtsi +++ b/arch/arm/boot/dts/qcom/sdm660-cdp.dtsi @@ -24,11 +24,8 @@ &ufsphy1 { vdda-phy-supply = <&pm660l_l1>; vdda-pll-supply = <&pm660_l10>; - vddp-ref-clk-supply = <&pm660_l1>; vdda-phy-max-microamp = <51400>; vdda-pll-max-microamp = <14200>; - vddp-ref-clk-max-microamp = <100>; - vddp-ref-clk-always-on; status = "ok"; }; @@ -39,6 +36,9 @@ vccq2-supply = <&pm660_l8>; vcc-max-microamp = <500000>; vccq2-max-microamp = <600000>; + qcom,vddp-ref-clk-supply = <&pm660_l1>; + qcom,vddp-ref-clk-max-microamp = <100>; + status = "ok"; }; @@ -143,16 +143,12 @@ }; &dsi_dual_nt35597_video { - qcom,mdss-dsi-bl-pmic-control-type = "bl_ctrl_wled"; - qcom,mdss-dsi-bl-min-level = <1>; - qcom,mdss-dsi-bl-max-level = <4095>; + qcom,mdss-dsi-bl-pmic-control-type = "bl_ctrl_dcs"; qcom,panel-supply-entries = <&dsi_panel_pwr_supply>; }; &dsi_dual_nt35597_cmd { - qcom,mdss-dsi-bl-pmic-control-type = "bl_ctrl_wled"; - qcom,mdss-dsi-bl-min-level = <1>; - qcom,mdss-dsi-bl-max-level = <4095>; + qcom,mdss-dsi-bl-pmic-control-type = "bl_ctrl_dcs"; qcom,panel-supply-entries = <&dsi_panel_pwr_supply>; qcom,partial-update-enabled = "single_roi"; qcom,panel-roi-alignment = <720 128 720 128 1440 128>; diff --git a/arch/arm/boot/dts/qcom/sdm660-mdss-panels.dtsi b/arch/arm/boot/dts/qcom/sdm660-mdss-panels.dtsi index 2f71f2407891..0fc24dc6e72b 100644 --- a/arch/arm/boot/dts/qcom/sdm660-mdss-panels.dtsi +++ b/arch/arm/boot/dts/qcom/sdm660-mdss-panels.dtsi @@ -180,6 +180,8 @@ qcom,mdss-dsi-max-refresh-rate = <60>; qcom,mdss-dsi-pan-enable-dynamic-fps; qcom,mdss-dsi-pan-fps-update = "dfps_immediate_porch_mode_vfp"; + qcom,esd-check-enabled; + qcom,mdss-dsi-panel-status-check-mode = "bta_check"; }; &dsi_nt35597_truly_dsc_cmd { @@ -221,6 +223,8 @@ qcom,mdss-dsi-max-refresh-rate = <60>; qcom,mdss-dsi-pan-enable-dynamic-fps; qcom,mdss-dsi-pan-fps-update = "dfps_immediate_porch_mode_vfp"; + qcom,esd-check-enabled; + qcom,mdss-dsi-panel-status-check-mode = "bta_check"; }; &dsi_nt35695b_truly_fhd_cmd { @@ -229,6 +233,8 @@ 24 1e 08 09 05 03 04 a0 24 1e 08 09 05 03 04 a0 24 1a 08 09 05 03 04 a0]; + qcom,esd-check-enabled; + qcom,mdss-dsi-panel-status-check-mode = "bta_check"; }; &dsi_truly_1080_vid { @@ -241,6 +247,8 @@ qcom,mdss-dsi-max-refresh-rate = <60>; qcom,mdss-dsi-pan-enable-dynamic-fps; qcom,mdss-dsi-pan-fps-update = "dfps_immediate_porch_mode_vfp"; + qcom,esd-check-enabled; + qcom,mdss-dsi-panel-status-check-mode = "bta_check"; }; &dsi_truly_1080_cmd { @@ -249,4 +257,6 @@ 23 1e 08 09 05 03 04 a0 23 1e 08 09 05 03 04 a0 23 1a 08 09 05 03 04 a0]; + qcom,esd-check-enabled; + qcom,mdss-dsi-panel-status-check-mode = "bta_check"; }; diff --git a/arch/arm/boot/dts/qcom/sdm660-mdss.dtsi b/arch/arm/boot/dts/qcom/sdm660-mdss.dtsi index 7f82a00e9f19..8116f56642f3 100644 --- a/arch/arm/boot/dts/qcom/sdm660-mdss.dtsi +++ b/arch/arm/boot/dts/qcom/sdm660-mdss.dtsi @@ -61,8 +61,8 @@ qcom,max-bandwidth-high-kbps = <6600000>; qcom,max-bandwidth-per-pipe-kbps = <3100000>; qcom,max-clk-rate = <412500000>; - qcom,mdss-default-ot-rd-limit = <32>; - qcom,mdss-default-ot-wr-limit = <40>; + qcom,mdss-default-ot-rd-limit = <40>; + qcom,mdss-default-ot-wr-limit = <32>; qcom,mdss-dram-channels = <2>; /* Bandwidth limit settings */ @@ -577,8 +577,8 @@ qcom,mdss-rot-vbif-qos-setting = <1 1 1 1>; qcom,mdss-rot-xin-id = <14 15>; - qcom,mdss-default-ot-rd-limit = <32>; - qcom,mdss-default-ot-wr-limit = <40>; + qcom,mdss-default-ot-rd-limit = <40>; + qcom,mdss-default-ot-wr-limit = <32>; }; }; diff --git a/arch/arm/boot/dts/qcom/sdm660-mtp.dtsi b/arch/arm/boot/dts/qcom/sdm660-mtp.dtsi index 23514467ba73..24bab18cd750 100644 --- a/arch/arm/boot/dts/qcom/sdm660-mtp.dtsi +++ b/arch/arm/boot/dts/qcom/sdm660-mtp.dtsi @@ -29,11 +29,8 @@ &ufsphy1 { vdda-phy-supply = <&pm660l_l1>; vdda-pll-supply = <&pm660_l10>; - vddp-ref-clk-supply = <&pm660_l1>; vdda-phy-max-microamp = <51400>; vdda-pll-max-microamp = <14200>; - vddp-ref-clk-max-microamp = <100>; - vddp-ref-clk-always-on; status = "ok"; }; @@ -44,6 +41,9 @@ vccq2-supply = <&pm660_l8>; vcc-max-microamp = <500000>; vccq2-max-microamp = <600000>; + vddp-ref-clk-supply = <&pm660_l1>; + vddp-ref-clk-max-microamp = <100>; + status = "ok"; }; diff --git a/drivers/gpu/drm/msm/sde/sde_crtc.c b/drivers/gpu/drm/msm/sde/sde_crtc.c index 05e6da14cec0..82da4c1bc86c 100644 --- a/drivers/gpu/drm/msm/sde/sde_crtc.c +++ b/drivers/gpu/drm/msm/sde/sde_crtc.c @@ -358,7 +358,17 @@ bool sde_crtc_is_rt(struct drm_crtc *crtc) return to_sde_crtc_state(crtc->state)->is_rt; } -/* if file!=NULL, this is preclose potential cancel-flip path */ +/** + * _sde_crtc_complete_flip - signal pending page_flip events + * Any pending vblank events are added to the vblank_event_list + * so that the next vblank interrupt shall signal them. + * However PAGE_FLIP events are not handled through the vblank_event_list. + * This API signals any pending PAGE_FLIP events requested through + * DRM_IOCTL_MODE_PAGE_FLIP and are cached in the sde_crtc->event. + * if file!=NULL, this is preclose potential cancel-flip path + * @crtc: Pointer to drm crtc structure + * @file: Pointer to drm file + */ static void _sde_crtc_complete_flip(struct drm_crtc *crtc, struct drm_file *file) { @@ -395,7 +405,7 @@ static void sde_crtc_vblank_cb(void *data) sde_crtc->vblank_cb_time = ktime_get(); else sde_crtc->vblank_cb_count++; - + _sde_crtc_complete_flip(crtc, NULL); drm_crtc_handle_vblank(crtc); DRM_DEBUG_VBL("crtc%d\n", crtc->base.id); SDE_EVT32_IRQ(DRMID(crtc)); diff --git a/drivers/gpu/drm/msm/sde/sde_hw_catalog.c b/drivers/gpu/drm/msm/sde/sde_hw_catalog.c index 31a6d985c38f..519288f0dda2 100644 --- a/drivers/gpu/drm/msm/sde/sde_hw_catalog.c +++ b/drivers/gpu/drm/msm/sde/sde_hw_catalog.c @@ -1830,12 +1830,20 @@ static int sde_parse_dt(struct device_node *np, struct sde_mdss_cfg *cfg) cfg->qseed_type = SDE_SSPP_SCALER_QSEED3; else if (!rc && !strcmp(type, "qseedv2")) cfg->qseed_type = SDE_SSPP_SCALER_QSEED2; + else if (rc) { + SDE_DEBUG("qseed property not found\n"); + rc = 0; + } rc = of_property_read_string(np, sde_prop[CSC_TYPE].prop_name, &type); if (!rc && !strcmp(type, "csc")) cfg->csc_type = SDE_SSPP_CSC; else if (!rc && !strcmp(type, "csc-10bit")) cfg->csc_type = SDE_SSPP_CSC_10BIT; + else if (rc) { + SDE_DEBUG("CSC property not found\n"); + rc = 0; + } cfg->has_src_split = PROP_VALUE_ACCESS(prop_value, SRC_SPLIT, 0); end: diff --git a/drivers/media/platform/msm/camera_v2/common/cam_smmu_api.c b/drivers/media/platform/msm/camera_v2/common/cam_smmu_api.c index 1c0a10e2fbef..a0f1d5148c94 100644 --- a/drivers/media/platform/msm/camera_v2/common/cam_smmu_api.c +++ b/drivers/media/platform/msm/camera_v2/common/cam_smmu_api.c @@ -878,6 +878,8 @@ static int cam_smmu_detach_device(int idx) static int cam_smmu_attach_sec_cpp(int idx) { + int32_t rc = 0; + /* * When switching to secure, detach CPP NS, do scm call * with CPP SID and no need of attach again, because @@ -889,8 +891,12 @@ static int cam_smmu_attach_sec_cpp(int idx) return -EINVAL; } - msm_camera_tz_set_mode(MSM_CAMERA_TZ_MODE_SECURE, + rc = msm_camera_tz_set_mode(MSM_CAMERA_TZ_MODE_SECURE, MSM_CAMERA_TZ_HW_BLOCK_CPP); + if (rc != 0) { + pr_err("fail to set secure mode for cpp, rc %d", rc); + return rc; + } iommu_cb_set.cb_info[idx].state = CAM_SMMU_ATTACH; @@ -899,8 +905,14 @@ static int cam_smmu_attach_sec_cpp(int idx) static int cam_smmu_detach_sec_cpp(int idx) { - msm_camera_tz_set_mode(MSM_CAMERA_TZ_MODE_NON_SECURE, + int32_t rc = 0; + + rc = msm_camera_tz_set_mode(MSM_CAMERA_TZ_MODE_NON_SECURE, MSM_CAMERA_TZ_HW_BLOCK_CPP); + if (rc != 0) { + pr_err("fail to switch to non secure mode for cpp, rc %d", rc); + return rc; + } iommu_cb_set.cb_info[idx].state = CAM_SMMU_DETACH; @@ -917,6 +929,8 @@ static int cam_smmu_detach_sec_cpp(int idx) static int cam_smmu_attach_sec_vfe_ns_stats(int idx) { + int32_t rc = 0; + /* *When switching to secure, for secure pixel and non-secure stats *localizing scm/attach of non-secure SID's in attach secure @@ -933,16 +947,26 @@ static int cam_smmu_attach_sec_vfe_ns_stats(int idx) } } - msm_camera_tz_set_mode(MSM_CAMERA_TZ_MODE_SECURE, + rc = msm_camera_tz_set_mode(MSM_CAMERA_TZ_MODE_SECURE, MSM_CAMERA_TZ_HW_BLOCK_ISP); + if (rc != 0) { + pr_err("fail to set secure mode for vfe, rc %d", rc); + return rc; + } return 0; } static int cam_smmu_detach_sec_vfe_ns_stats(int idx) { - msm_camera_tz_set_mode(MSM_CAMERA_TZ_MODE_NON_SECURE, + int32_t rc = 0; + + rc = msm_camera_tz_set_mode(MSM_CAMERA_TZ_MODE_NON_SECURE, MSM_CAMERA_TZ_HW_BLOCK_ISP); + if (rc != 0) { + pr_err("fail to switch to non secure mode for vfe, rc %d", rc); + return rc; + } /* *While exiting from secure mode for secure pixel and non-secure stats, diff --git a/drivers/media/platform/msm/camera_v2/isp/msm_buf_mgr.c b/drivers/media/platform/msm/camera_v2/isp/msm_buf_mgr.c index de29692414d2..f7eb0f8ac5a8 100644 --- a/drivers/media/platform/msm/camera_v2/isp/msm_buf_mgr.c +++ b/drivers/media/platform/msm/camera_v2/isp/msm_buf_mgr.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2016, The Linux Foundation. All rights reserved. +/* Copyright (c) 2013-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -1179,26 +1179,6 @@ int msm_isp_smmu_attach(struct msm_isp_buf_mgr *buf_mgr, rc = msm_isp_buf_get_scratch(buf_mgr); if (rc) goto err2; - } else { - if (buf_mgr->attach_ref_cnt > 0) - buf_mgr->attach_ref_cnt--; - else - pr_err("%s: Error! Invalid ref_cnt %d\n", - __func__, buf_mgr->attach_ref_cnt); - - if (buf_mgr->attach_ref_cnt == 0) { - rc = msm_isp_buf_put_scratch(buf_mgr); - if (buf_mgr->secure_enable == SECURE_MODE) - rc |= cam_smmu_ops(buf_mgr->iommu_hdl, - CAM_SMMU_DETACH_SEC_VFE_NS_STATS); - else - rc |= cam_smmu_ops(buf_mgr->iommu_hdl, - CAM_SMMU_DETACH); - if (rc < 0) { - pr_err("%s: img/stats smmu detach error, rc :%d\n", - __func__, rc); - } - } } mutex_unlock(&buf_mgr->lock); diff --git a/drivers/media/platform/msm/camera_v2/msm.c b/drivers/media/platform/msm/camera_v2/msm.c index c6dc4b75e479..5cf5582b55ab 100644 --- a/drivers/media/platform/msm/camera_v2/msm.c +++ b/drivers/media/platform/msm/camera_v2/msm.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -53,6 +53,8 @@ spinlock_t msm_eventq_lock; static struct pid *msm_pid; spinlock_t msm_pid_lock; +static uint32_t gpu_limit; + /* * It takes 20 bytes + NULL character to write the * largest decimal value of an uint64_t @@ -442,6 +444,14 @@ int msm_create_session(unsigned int session_id, struct video_device *vdev) mutex_init(&session->lock); mutex_init(&session->lock_q); mutex_init(&session->close_lock); + + if (gpu_limit) { + session->sysfs_pwr_limit = kgsl_pwr_limits_add(KGSL_DEVICE_3D0); + if (session->sysfs_pwr_limit) + kgsl_pwr_limits_set_freq(session->sysfs_pwr_limit, + gpu_limit); + } + return 0; } EXPORT_SYMBOL(msm_create_session); @@ -607,6 +617,11 @@ int msm_destroy_session(unsigned int session_id) if (!session) return -EINVAL; + if (gpu_limit && session->sysfs_pwr_limit) { + kgsl_pwr_limits_set_default(session->sysfs_pwr_limit); + kgsl_pwr_limits_del(session->sysfs_pwr_limit); + } + msm_destroy_session_streams(session); msm_remove_session_cmd_ack_q(session); mutex_destroy(&session->lock); @@ -1290,6 +1305,9 @@ static int msm_probe(struct platform_device *pdev) goto v4l2_fail; } + of_property_read_u32(pdev->dev.of_node, + "qcom,gpu-limit", &gpu_limit); + goto probe_end; v4l2_fail: diff --git a/drivers/media/platform/msm/camera_v2/msm.h b/drivers/media/platform/msm/camera_v2/msm.h index 2b3576b8edd2..7474cb119147 100644 --- a/drivers/media/platform/msm/camera_v2/msm.h +++ b/drivers/media/platform/msm/camera_v2/msm.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -20,6 +20,7 @@ #include <linux/pm_qos.h> #include <linux/msm_ion.h> #include <linux/iommu.h> +#include <linux/msm_kgsl.h> #include <media/v4l2-dev.h> #include <media/v4l2-ioctl.h> #include <media/v4l2-device.h> @@ -110,6 +111,7 @@ struct msm_session { struct mutex lock; struct mutex lock_q; struct mutex close_lock; + struct kgsl_pwr_limit *sysfs_pwr_limit; }; static inline bool msm_is_daemon_present(void) diff --git a/drivers/media/platform/msm/camera_v2/pproc/cpp/msm_cpp.c b/drivers/media/platform/msm/camera_v2/pproc/cpp/msm_cpp.c index 7885149440f9..da31dcd84b11 100644 --- a/drivers/media/platform/msm/camera_v2/pproc/cpp/msm_cpp.c +++ b/drivers/media/platform/msm/camera_v2/pproc/cpp/msm_cpp.c @@ -834,8 +834,10 @@ static int cpp_init_mem(struct cpp_device *cpp_dev) else rc = cam_smmu_get_handle("cpp", &iommu_hdl); - if (rc < 0) + if (rc < 0) { + pr_err("smmu get handle failed\n"); return -ENODEV; + } cpp_dev->iommu_hdl = iommu_hdl; cam_smmu_reg_client_page_fault_handler( @@ -1466,10 +1468,16 @@ static int cpp_close_node(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) msm_cpp_clear_timer(cpp_dev); cpp_release_hardware(cpp_dev); if (cpp_dev->iommu_state == CPP_IOMMU_STATE_ATTACHED) { - cpp_dev->iommu_state = CPP_IOMMU_STATE_DETACHED; - rc = cam_smmu_ops(cpp_dev->iommu_hdl, CAM_SMMU_DETACH); + if (cpp_dev->security_mode == SECURE_MODE) + rc = cam_smmu_ops(cpp_dev->iommu_hdl, + CAM_SMMU_DETACH_SEC_CPP); + else + rc = cam_smmu_ops(cpp_dev->iommu_hdl, + CAM_SMMU_DETACH); + if (rc < 0) pr_err("Error: Detach fail in release\n"); + cpp_dev->iommu_state = CPP_IOMMU_STATE_DETACHED; } cam_smmu_destroy_handle(cpp_dev->iommu_hdl); msm_cpp_empty_list(processing_q, list_frame); @@ -3450,6 +3458,7 @@ STREAM_BUFF_END: rc = msm_cpp_copy_from_ioctl_ptr(&cpp_attach_info, ioctl_ptr); if (rc < 0) { + pr_err("CPP_IOMMU_ATTACH copy from user fail"); ERR_COPY_FROM_USER(); return -EINVAL; } @@ -3487,6 +3496,7 @@ STREAM_BUFF_END: rc = msm_cpp_copy_from_ioctl_ptr(&cpp_attach_info, ioctl_ptr); if (rc < 0) { + pr_err("CPP_IOMMU_DETTACH copy from user fail"); ERR_COPY_FROM_USER(); return -EINVAL; } diff --git a/drivers/media/platform/msm/sde/rotator/sde_rotator_r3.c b/drivers/media/platform/msm/sde/rotator/sde_rotator_r3.c index 89fde987d4c1..2c79ad7e45be 100644 --- a/drivers/media/platform/msm/sde/rotator/sde_rotator_r3.c +++ b/drivers/media/platform/msm/sde/rotator/sde_rotator_r3.c @@ -1599,6 +1599,7 @@ static int sde_hw_rotator_config(struct sde_rot_hw_resource *hw, u32 danger_lut = 0; /* applicable for realtime client only */ u32 safe_lut = 0; /* applicable for realtime client only */ u32 flags = 0; + u32 rststs = 0; struct sde_rotation_item *item; if (!hw || !entry) { @@ -1616,10 +1617,46 @@ static int sde_hw_rotator_config(struct sde_rot_hw_resource *hw, return -EINVAL; } + /* + * if Rotator HW is reset, but missing PM event notification, we + * need to init the SW timestamp automatically. + */ + rststs = SDE_ROTREG_READ(rot->mdss_base, REGDMA_RESET_STATUS_REG); + if (!rot->reset_hw_ts && rststs) { + u32 l_ts, h_ts, swts; + + swts = SDE_ROTREG_READ(rot->mdss_base, REGDMA_TIMESTAMP_REG); + h_ts = atomic_read(&rot->timestamp[ROT_QUEUE_HIGH_PRIORITY]); + l_ts = atomic_read(&rot->timestamp[ROT_QUEUE_LOW_PRIORITY]); + SDEROT_EVTLOG(0xbad0, rststs, swts, h_ts, l_ts); + + if (ctx->q_id == ROT_QUEUE_HIGH_PRIORITY) + h_ts = (h_ts - 1) & SDE_REGDMA_SWTS_MASK; + else + l_ts = (l_ts - 1) & SDE_REGDMA_SWTS_MASK; + + /* construct the combined timstamp */ + swts = (h_ts & SDE_REGDMA_SWTS_MASK) | + ((l_ts & SDE_REGDMA_SWTS_MASK) << + SDE_REGDMA_SWTS_SHIFT); + + SDEROT_DBG("swts:0x%x, h_ts:0x%x, l_ts;0x%x\n", + swts, h_ts, l_ts); + SDEROT_EVTLOG(0x900d, swts, h_ts, l_ts); + rot->last_hw_ts = swts; + + SDE_ROTREG_WRITE(rot->mdss_base, REGDMA_TIMESTAMP_REG, + rot->last_hw_ts); + SDE_ROTREG_WRITE(rot->mdss_base, REGDMA_RESET_STATUS_REG, 0); + /* ensure write is issued to the rotator HW */ + wmb(); + } + if (rot->reset_hw_ts) { SDEROT_EVTLOG(rot->last_hw_ts); SDE_ROTREG_WRITE(rot->mdss_base, REGDMA_TIMESTAMP_REG, rot->last_hw_ts); + SDE_ROTREG_WRITE(rot->mdss_base, REGDMA_RESET_STATUS_REG, 0); /* ensure write is issued to the rotator HW */ wmb(); rot->reset_hw_ts = false; diff --git a/drivers/media/platform/msm/sde/rotator/sde_rotator_r3_hwio.h b/drivers/media/platform/msm/sde/rotator/sde_rotator_r3_hwio.h index fedade122b88..b721ec54229d 100644 --- a/drivers/media/platform/msm/sde/rotator/sde_rotator_r3_hwio.h +++ b/drivers/media/platform/msm/sde/rotator/sde_rotator_r3_hwio.h @@ -277,5 +277,6 @@ #define REGDMA_INT_LOW_MASK 0x00000700 #define REGDMA_INT_ERR_MASK 0x000F0000 #define REGDMA_TIMESTAMP_REG ROT_SSPP_TPG_PATTERN_GEN_INIT_VAL +#define REGDMA_RESET_STATUS_REG ROT_SSPP_TPG_RGB_MAPPING #endif /*_SDE_ROTATOR_R3_HWIO_H */ diff --git a/drivers/regulator/cpr4-mmss-ldo-regulator.c b/drivers/regulator/cpr4-mmss-ldo-regulator.c index 525f9d6fcf75..6c6d112d2a6a 100644 --- a/drivers/regulator/cpr4-mmss-ldo-regulator.c +++ b/drivers/regulator/cpr4-mmss-ldo-regulator.c @@ -135,9 +135,15 @@ static const int sdm660_mmss_fuse_ref_volt[SDM660_MMSS_FUSE_CORNERS] = { #define SDM660_MMSS_VOLTAGE_FUSE_SIZE 5 #define SDM660_MMSS_CPR_SENSOR_COUNT 11 +#define SDM630_MMSS_CPR_SENSOR_COUNT 7 #define SDM660_MMSS_CPR_CLOCK_RATE 19200000 +enum { + SDM660_SOC_ID, + SDM630_SOC_ID, +}; + /** * cpr4_sdm660_mmss_read_fuse_data() - load MMSS specific fuse parameter * values @@ -594,7 +600,10 @@ static int cpr4_mmss_init_controller(struct cpr3_controller *ctrl) return rc; } - ctrl->sensor_count = SDM660_MMSS_CPR_SENSOR_COUNT; + if (ctrl->soc_revision == SDM660_SOC_ID) + ctrl->sensor_count = SDM660_MMSS_CPR_SENSOR_COUNT; + else if (ctrl->soc_revision == SDM630_SOC_ID) + ctrl->sensor_count = SDM630_MMSS_CPR_SENSOR_COUNT; /* * MMSS only has one thread (0) so the zeroed array does not need @@ -632,9 +641,23 @@ static int cpr4_mmss_init_controller(struct cpr3_controller *ctrl) return 0; } +/* Data corresponds to the SoC revision */ +static const struct of_device_id cpr4_mmss_regulator_match_table[] = { + { + .compatible = "qcom,cpr4-sdm660-mmss-ldo-regulator", + .data = (void *)(uintptr_t)SDM660_SOC_ID, + }, + { + .compatible = "qcom,cpr4-sdm630-mmss-ldo-regulator", + .data = (void *)(uintptr_t)SDM630_SOC_ID, + }, + { }, +}; + static int cpr4_mmss_regulator_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; + const struct of_device_id *match; struct cpr3_controller *ctrl; int rc; @@ -659,6 +682,12 @@ static int cpr4_mmss_regulator_probe(struct platform_device *pdev) return rc; } + match = of_match_node(cpr4_mmss_regulator_match_table, dev->of_node); + if (match) + ctrl->soc_revision = (uintptr_t)match->data; + else + cpr3_err(ctrl, "could not find compatible string match\n"); + rc = cpr3_map_fuse_base(ctrl, pdev); if (rc) { cpr3_err(ctrl, "could not map fuse base address\n"); @@ -731,19 +760,6 @@ static int cpr4_mmss_regulator_resume(struct platform_device *pdev) return cpr3_regulator_resume(ctrl); } -/* Data corresponds to the SoC revision */ -static const struct of_device_id cpr4_mmss_regulator_match_table[] = { - { - .compatible = "qcom,cpr4-sdm660-mmss-ldo-regulator", - .data = (void *)NULL, - }, - { - .compatible = "qcom,cpr4-sdm630-mmss-ldo-regulator", - .data = (void *)NULL, - }, - { }, -}; - static struct platform_driver cpr4_mmss_regulator_driver = { .driver = { .name = "qcom,cpr4-mmss-ldo-regulator", diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index f5d7cd0f4701..c891fc8d34a3 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -8603,9 +8603,13 @@ static int ufshcd_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op) goto vendor_suspend; } } else if (ufshcd_is_link_off(hba)) { - ret = ufshcd_host_reset_and_restore(hba); /* - * ufshcd_host_reset_and_restore() should have already + * A full initialization of the host and the device is required + * since the link was put to off during suspend. + */ + ret = ufshcd_reset_and_restore(hba); + /* + * ufshcd_reset_and_restore() should have already * set the link state as active */ if (ret || !ufshcd_is_link_active(hba)) diff --git a/drivers/soc/qcom/pil-msa.c b/drivers/soc/qcom/pil-msa.c index bbd77d8e0650..53bddc5987df 100644 --- a/drivers/soc/qcom/pil-msa.c +++ b/drivers/soc/qcom/pil-msa.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -332,6 +332,7 @@ int __pil_mss_deinit_image(struct pil_desc *pil, bool err_path) struct modem_data *drv = dev_get_drvdata(pil->dev); struct q6v5_data *q6_drv = container_of(pil, struct q6v5_data, desc); int ret = 0; + struct device *dma_dev = drv->mba_mem_dev_fixed ?: &drv->mba_mem_dev; s32 status; u64 val = is_timeout_disabled() ? 0 : pbl_mba_boot_timeout_ms * 1000; @@ -360,7 +361,7 @@ int __pil_mss_deinit_image(struct pil_desc *pil, bool err_path) if (pil->subsys_vmid > 0) pil_assign_mem_to_linux(pil, drv->q6->mba_dp_phys, drv->q6->mba_dp_size); - dma_free_attrs(&drv->mba_mem_dev, drv->q6->mba_dp_size, + dma_free_attrs(dma_dev, drv->q6->mba_dp_size, drv->q6->mba_dp_virt, drv->q6->mba_dp_phys, &drv->attrs_dma); drv->q6->mba_dp_virt = NULL; @@ -552,6 +553,7 @@ int pil_mss_reset_load_mba(struct pil_desc *pil) dma_addr_t mba_dp_phys, mba_dp_phys_end; int ret, count; const u8 *data; + struct device *dma_dev = md->mba_mem_dev_fixed ?: &md->mba_mem_dev; fw_name_p = drv->non_elf_image ? fw_name_legacy : fw_name; ret = request_firmware(&fw, fw_name_p, pil->dev); @@ -570,11 +572,12 @@ int pil_mss_reset_load_mba(struct pil_desc *pil) drv->mba_dp_size = SZ_1M; - arch_setup_dma_ops(&md->mba_mem_dev, 0, 0, NULL, 0); + arch_setup_dma_ops(dma_dev, 0, 0, NULL, 0); + + dma_dev->coherent_dma_mask = DMA_BIT_MASK(sizeof(dma_addr_t) * 8); - md->mba_mem_dev.coherent_dma_mask = - DMA_BIT_MASK(sizeof(dma_addr_t) * 8); init_dma_attrs(&md->attrs_dma); + dma_set_attr(DMA_ATTR_SKIP_ZEROING, &md->attrs_dma); dma_set_attr(DMA_ATTR_STRONGLY_ORDERED, &md->attrs_dma); ret = request_firmware(&dp_fw, dp_name, pil->dev); @@ -591,10 +594,10 @@ int pil_mss_reset_load_mba(struct pil_desc *pil) drv->mba_dp_size += drv->dp_size; } - mba_dp_virt = dma_alloc_attrs(&md->mba_mem_dev, drv->mba_dp_size, - &mba_dp_phys, GFP_KERNEL, &md->attrs_dma); + mba_dp_virt = dma_alloc_attrs(dma_dev, drv->mba_dp_size, &mba_dp_phys, + GFP_KERNEL, &md->attrs_dma); if (!mba_dp_virt) { - dev_err(pil->dev, "%s MBA metadata buffer allocation %zx bytes failed\n", + dev_err(pil->dev, "%s MBA/DP buffer allocation %zx bytes failed\n", __func__, drv->mba_dp_size); ret = -ENOMEM; goto err_invalid_fw; @@ -651,7 +654,7 @@ err_mss_reset: pil_assign_mem_to_linux(pil, drv->mba_dp_phys, drv->mba_dp_size); err_mba_data: - dma_free_attrs(&md->mba_mem_dev, drv->mba_dp_size, drv->mba_dp_virt, + dma_free_attrs(dma_dev, drv->mba_dp_size, drv->mba_dp_virt, drv->mba_dp_phys, &md->attrs_dma); err_invalid_fw: if (dp_fw) @@ -670,14 +673,16 @@ static int pil_msa_auth_modem_mdt(struct pil_desc *pil, const u8 *metadata, s32 status; int ret; u64 val = is_timeout_disabled() ? 0 : modem_auth_timeout_ms * 1000; + struct device *dma_dev = drv->mba_mem_dev_fixed ?: &drv->mba_mem_dev; DEFINE_DMA_ATTRS(attrs); - drv->mba_mem_dev.coherent_dma_mask = - DMA_BIT_MASK(sizeof(dma_addr_t) * 8); + + dma_dev->coherent_dma_mask = DMA_BIT_MASK(sizeof(dma_addr_t) * 8); + dma_set_attr(DMA_ATTR_SKIP_ZEROING, &attrs); dma_set_attr(DMA_ATTR_STRONGLY_ORDERED, &attrs); /* Make metadata physically contiguous and 4K aligned. */ - mdata_virt = dma_alloc_attrs(&drv->mba_mem_dev, size, &mdata_phys, - GFP_KERNEL, &attrs); + mdata_virt = dma_alloc_attrs(dma_dev, size, &mdata_phys, GFP_KERNEL, + &attrs); if (!mdata_virt) { dev_err(pil->dev, "%s MBA metadata buffer allocation %zx bytes failed\n", __func__, size); @@ -694,8 +699,8 @@ static int pil_msa_auth_modem_mdt(struct pil_desc *pil, const u8 *metadata, if (ret) { pr_err("scm_call to unprotect modem metadata mem failed(rc:%d)\n", ret); - dma_free_attrs(&drv->mba_mem_dev, size, mdata_virt, - mdata_phys, &attrs); + dma_free_attrs(dma_dev, size, mdata_virt, mdata_phys, + &attrs); goto fail; } } @@ -721,7 +726,7 @@ static int pil_msa_auth_modem_mdt(struct pil_desc *pil, const u8 *metadata, if (pil->subsys_vmid > 0) pil_assign_mem_to_linux(pil, mdata_phys, ALIGN(size, SZ_4K)); - dma_free_attrs(&drv->mba_mem_dev, size, mdata_virt, mdata_phys, &attrs); + dma_free_attrs(dma_dev, size, mdata_virt, mdata_phys, &attrs); if (!ret) return ret; @@ -733,7 +738,7 @@ fail: if (pil->subsys_vmid > 0) pil_assign_mem_to_linux(pil, drv->q6->mba_dp_phys, drv->q6->mba_dp_size); - dma_free_attrs(&drv->mba_mem_dev, drv->q6->mba_dp_size, + dma_free_attrs(dma_dev, drv->q6->mba_dp_size, drv->q6->mba_dp_virt, drv->q6->mba_dp_phys, &drv->attrs_dma); drv->q6->mba_dp_virt = NULL; @@ -785,6 +790,7 @@ static int pil_msa_mba_auth(struct pil_desc *pil) struct modem_data *drv = dev_get_drvdata(pil->dev); struct q6v5_data *q6_drv = container_of(pil, struct q6v5_data, desc); int ret; + struct device *dma_dev = drv->mba_mem_dev_fixed ?: &drv->mba_mem_dev; s32 status; u64 val = is_timeout_disabled() ? 0 : modem_auth_timeout_ms * 1000; @@ -806,9 +812,9 @@ static int pil_msa_mba_auth(struct pil_desc *pil) pil_assign_mem_to_linux(pil, drv->q6->mba_dp_phys, drv->q6->mba_dp_size); - dma_free_attrs(&drv->mba_mem_dev, drv->q6->mba_dp_size, - drv->q6->mba_dp_virt, - drv->q6->mba_dp_phys, &drv->attrs_dma); + dma_free_attrs(dma_dev, drv->q6->mba_dp_size, + drv->q6->mba_dp_virt, drv->q6->mba_dp_phys, + &drv->attrs_dma); drv->q6->mba_dp_virt = NULL; } diff --git a/drivers/soc/qcom/pil-msa.h b/drivers/soc/qcom/pil-msa.h index fea8e1f9db37..896f0c7c232b 100644 --- a/drivers/soc/qcom/pil-msa.h +++ b/drivers/soc/qcom/pil-msa.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -32,6 +32,7 @@ struct modem_data { struct clk *xo; struct pil_desc desc; struct device mba_mem_dev; + struct device *mba_mem_dev_fixed; struct dma_attrs attrs_dma; }; diff --git a/drivers/soc/qcom/pil-q6v5-mss.c b/drivers/soc/qcom/pil-q6v5-mss.c index 5f01d30de8d9..0e023a019280 100644 --- a/drivers/soc/qcom/pil-q6v5-mss.c +++ b/drivers/soc/qcom/pil-q6v5-mss.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -14,6 +14,7 @@ #include <linux/init.h> #include <linux/module.h> #include <linux/platform_device.h> +#include <linux/of_platform.h> #include <linux/io.h> #include <linux/iopoll.h> #include <linux/ioport.h> @@ -394,6 +395,11 @@ static int pil_mss_driver_probe(struct platform_device *pdev) } init_completion(&drv->stop_ack); + /* Probe the MBA mem device if present */ + ret = of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev); + if (ret) + return ret; + return pil_subsys_init(drv, pdev); } @@ -407,6 +413,33 @@ static int pil_mss_driver_exit(struct platform_device *pdev) return 0; } +static int pil_mba_mem_driver_probe(struct platform_device *pdev) +{ + struct modem_data *drv; + + if (!pdev->dev.parent) { + pr_err("No parent found.\n"); + return -EINVAL; + } + drv = dev_get_drvdata(pdev->dev.parent); + drv->mba_mem_dev_fixed = &pdev->dev; + return 0; +} + +static const struct of_device_id mba_mem_match_table[] = { + { .compatible = "qcom,pil-mba-mem" }, + {} +}; + +static struct platform_driver pil_mba_mem_driver = { + .probe = pil_mba_mem_driver_probe, + .driver = { + .name = "pil-mba-mem", + .of_match_table = mba_mem_match_table, + .owner = THIS_MODULE, + }, +}; + static struct of_device_id mss_match_table[] = { { .compatible = "qcom,pil-q6v5-mss" }, { .compatible = "qcom,pil-q6v55-mss" }, @@ -426,7 +459,12 @@ static struct platform_driver pil_mss_driver = { static int __init pil_mss_init(void) { - return platform_driver_register(&pil_mss_driver); + int ret; + + ret = platform_driver_register(&pil_mba_mem_driver); + if (!ret) + ret = platform_driver_register(&pil_mss_driver); + return ret; } module_init(pil_mss_init); diff --git a/drivers/soc/qcom/ramdump.c b/drivers/soc/qcom/ramdump.c index 08499c549b47..c712ed392b0b 100644 --- a/drivers/soc/qcom/ramdump.c +++ b/drivers/soc/qcom/ramdump.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2016, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -326,13 +326,7 @@ static int _do_ramdump(void *handle, struct ramdump_segment *segments, if (rd_dev->complete_ramdump) { for (i = 0; i < nsegments-1; i++) segments[i].size = - PAGE_ALIGN(segments[i+1].address - segments[i].address); - - segments[nsegments-1].size = - PAGE_ALIGN(segments[nsegments-1].size); - } else { - for (i = 0; i < nsegments; i++) - segments[i].size = PAGE_ALIGN(segments[i].size); + segments[i + 1].address - segments[i].address; } rd_dev->segments = segments; diff --git a/drivers/usb/gadget/function/f_gsi.c b/drivers/usb/gadget/function/f_gsi.c index 6481ee96f3e4..2f08a6c9d476 100644 --- a/drivers/usb/gadget/function/f_gsi.c +++ b/drivers/usb/gadget/function/f_gsi.c @@ -268,6 +268,7 @@ static int ipa_connect_channels(struct gsi_data_port *d_port) struct ipa_req_chan_out_params ipa_in_channel_out_params; struct ipa_req_chan_out_params ipa_out_channel_out_params; + log_event_dbg("%s: USB GSI IN OPS", __func__); usb_gsi_ep_op(d_port->in_ep, &d_port->in_request, GSI_EP_OP_PREPARE_TRBS); usb_gsi_ep_op(d_port->in_ep, &d_port->in_request, @@ -279,6 +280,8 @@ static int ipa_connect_channels(struct gsi_data_port *d_port) gsi_channel_info.ch_req = &d_port->in_request; usb_gsi_ep_op(d_port->in_ep, (void *)&gsi_channel_info, GSI_EP_OP_GET_CH_INFO); + + log_event_dbg("%s: USB GSI IN OPS Completed", __func__); in_params->client = (gsi->prot_id != IPA_USB_DIAG) ? IPA_CLIENT_USB_CONS : IPA_CLIENT_USB_DPL_CONS; @@ -307,6 +310,7 @@ static int ipa_connect_channels(struct gsi_data_port *d_port) gsi_channel_info.depcmd_hi_addr; if (d_port->out_ep) { + log_event_dbg("%s: USB GSI OUT OPS", __func__); usb_gsi_ep_op(d_port->out_ep, &d_port->out_request, GSI_EP_OP_PREPARE_TRBS); usb_gsi_ep_op(d_port->out_ep, &d_port->out_request, @@ -318,7 +322,7 @@ static int ipa_connect_channels(struct gsi_data_port *d_port) gsi_channel_info.ch_req = &d_port->out_request; usb_gsi_ep_op(d_port->out_ep, (void *)&gsi_channel_info, GSI_EP_OP_GET_CH_INFO); - + log_event_dbg("%s: USB GSI OUT OPS Completed", __func__); out_params->client = IPA_CLIENT_USB_PROD; out_params->ipa_ep_cfg.mode.mode = IPA_BASIC; out_params->teth_prot = gsi->prot_id; diff --git a/drivers/video/fbdev/msm/mdss_mdp_ctl.c b/drivers/video/fbdev/msm/mdss_mdp_ctl.c index ec37cd1d5bb0..b8f7a74ceede 100644 --- a/drivers/video/fbdev/msm/mdss_mdp_ctl.c +++ b/drivers/video/fbdev/msm/mdss_mdp_ctl.c @@ -742,7 +742,8 @@ int mdss_mdp_get_pipe_overlap_bw(struct mdss_mdp_pipe *pipe, *quota = fps * src.w * src_h; - if (pipe->src_fmt->chroma_sample == MDSS_MDP_CHROMA_420) + if (pipe->src_fmt->chroma_sample == MDSS_MDP_CHROMA_420 && + pipe->src_fmt->format != MDP_Y_CBCR_H2V2_TP10_UBWC) /* * with decimation, chroma is not downsampled, this means we * need to allocate bw for extra lines that will be fetched diff --git a/drivers/video/fbdev/msm/mdss_mdp_intf_cmd.c b/drivers/video/fbdev/msm/mdss_mdp_intf_cmd.c index c97a58c86c29..dfd6226ce602 100644 --- a/drivers/video/fbdev/msm/mdss_mdp_intf_cmd.c +++ b/drivers/video/fbdev/msm/mdss_mdp_intf_cmd.c @@ -2659,10 +2659,11 @@ static void mdss_mdp_cmd_wait4_autorefresh_done(struct mdss_mdp_ctl *ctl) struct mdss_mdp_cmd_ctx *ctx = ctl->intf_ctx[MASTER_CTX]; unsigned long flags; unsigned long autorefresh_timeout; + u32 timeout_us = 20000; line_out = mdss_mdp_pingpong_read(pp_base, MDSS_MDP_REG_PP_LINE_COUNT); - MDSS_XLOG(ctl->num, line_out, ctl->mixer_left->roi.h); + MDSS_XLOG(ctl->num, line_out, ctl->mixer_left->roi.h, 0x111); reinit_completion(&ctx->autorefresh_done); @@ -2721,6 +2722,26 @@ static void mdss_mdp_cmd_wait4_autorefresh_done(struct mdss_mdp_ctl *ctl) "dsi1_ctrl", "dsi1_phy", "vbif", "vbif_nrt", "dbg_bus", "vbif_dbg_bus", "panic"); } + + /* once autorefresh is done, wait for write pointer */ + line_out = mdss_mdp_pingpong_read(pp_base, MDSS_MDP_REG_PP_LINE_COUNT); + MDSS_XLOG(ctl->num, line_out, 0x222); + + /* wait until the first line is out to make sure transfer is on-going */ + rc = readl_poll_timeout(pp_base + + MDSS_MDP_REG_PP_LINE_COUNT, val, + (val & 0xffff) >= 1, 10, timeout_us); + + if (rc) { + pr_err("timed out waiting for line out ctl:%d val:0x%x\n", + ctl->num, val); + MDSS_XLOG(0xbad5, val); + MDSS_XLOG_TOUT_HANDLER("mdp", "dsi0_ctrl", "dsi0_phy", + "dsi1_ctrl", "dsi1_phy", "vbif", "vbif_nrt", + "dbg_bus", "vbif_dbg_bus", "panic"); + } + + MDSS_XLOG(val, 0x333); } /* caller needs to hold autorefresh_lock before calling this function */ diff --git a/drivers/video/fbdev/msm/mdss_mdp_overlay.c b/drivers/video/fbdev/msm/mdss_mdp_overlay.c index 1a9b09ca6988..da08917d334b 100644 --- a/drivers/video/fbdev/msm/mdss_mdp_overlay.c +++ b/drivers/video/fbdev/msm/mdss_mdp_overlay.c @@ -2765,6 +2765,7 @@ static int mdss_mdp_overlay_get_fb_pipe(struct msm_fb_data_type *mfd, bpp = fbi->var.bits_per_pixel / 8; req->id = MSMFB_NEW_REQUEST; + req->flags |= MDP_OV_PIPE_FORCE_DMA; req->src.format = mfd->fb_imgType; req->src.height = fbi->var.yres; req->src.width = fbi->fix.line_length / bpp; @@ -2878,7 +2879,7 @@ static void mdss_mdp_overlay_pan_display(struct msm_fb_data_type *mfd) MDSS_MDP_MIXER_MUX_LEFT, &l_pipe_allocated); if (ret) { pr_err("unable to allocate base pipe\n"); - goto iommu_disable; + goto pipe_release; } if (mdss_mdp_pipe_map(l_pipe)) { @@ -2889,20 +2890,20 @@ static void mdss_mdp_overlay_pan_display(struct msm_fb_data_type *mfd) ret = mdss_mdp_overlay_start(mfd); if (ret) { pr_err("unable to start overlay %d (%d)\n", mfd->index, ret); - goto clk_disable; + goto pipe_release; } ret = mdss_iommu_ctrl(1); if (IS_ERR_VALUE(ret)) { pr_err("IOMMU attach failed\n"); - goto clk_disable; + goto iommu_disable; } buf_l = __mdp_overlay_buf_alloc(mfd, l_pipe); if (!buf_l) { pr_err("unable to allocate memory for fb buffer\n"); mdss_mdp_pipe_unmap(l_pipe); - goto pipe_release; + goto iommu_disable; } buf_l->p[0].srcp_table = mfd->fb_table; @@ -2925,19 +2926,19 @@ static void mdss_mdp_overlay_pan_display(struct msm_fb_data_type *mfd) MDSS_MDP_MIXER_MUX_RIGHT, &r_pipe_allocated); if (ret) { pr_err("unable to allocate right base pipe\n"); - goto pipe_release; + goto iommu_disable; } if (mdss_mdp_pipe_map(r_pipe)) { pr_err("unable to map right base pipe\n"); - goto pipe_release; + goto iommu_disable; } buf_r = __mdp_overlay_buf_alloc(mfd, r_pipe); if (!buf_r) { pr_err("unable to allocate memory for fb buffer\n"); mdss_mdp_pipe_unmap(r_pipe); - goto pipe_release; + goto iommu_disable; } buf_r->p[0] = buf_l->p[0]; @@ -2955,6 +2956,9 @@ static void mdss_mdp_overlay_pan_display(struct msm_fb_data_type *mfd) mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_OFF); return; +iommu_disable: + mdss_iommu_ctrl(0); + pipe_release: if (r_pipe_allocated) mdss_mdp_overlay_release(mfd, r_pipe->ndx); @@ -2962,8 +2966,6 @@ pipe_release: __mdp_overlay_buf_free(mfd, buf_l); if (l_pipe_allocated) mdss_mdp_overlay_release(mfd, l_pipe->ndx); -iommu_disable: - mdss_iommu_ctrl(0); clk_disable: mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_OFF); mutex_unlock(&mdp5_data->ov_lock); diff --git a/drivers/video/fbdev/msm/mdss_mdp_pp.c b/drivers/video/fbdev/msm/mdss_mdp_pp.c index 38bff6b8edee..1fe8fe6f7be8 100644 --- a/drivers/video/fbdev/msm/mdss_mdp_pp.c +++ b/drivers/video/fbdev/msm/mdss_mdp_pp.c @@ -5319,8 +5319,8 @@ static int pp_hist_collect(struct mdp_histogram_data *hist, pr_err("failed to get the hist data, sum = %d\n", sum); ret = sum; } else if (expect_sum && sum != expect_sum) { - pr_err("hist error: bin sum incorrect! (%d/%d)\n", - sum, expect_sum); + pr_err_ratelimited("hist error: bin sum incorrect! (%d/%d)\n", + sum, expect_sum); ret = -EINVAL; } hist_collect_exit: @@ -5390,8 +5390,8 @@ int mdss_mdp_hist_collect(struct mdp_histogram_data *hist) ret = pp_hist_collect(hist, hists[i], ctl_base, exp_sum, DSPP); if (ret) - pr_err("hist error: dspp[%d] collect %d\n", - dspp_num, ret); + pr_err_ratelimited("hist error: dspp[%d] collect %d\n", + dspp_num, ret); } /* state of dspp histogram blocks attached to logical display * should be changed atomically to idle. This will ensure that diff --git a/fs/block_dev.c b/fs/block_dev.c index 44d4a1e9244e..ac9b7553c02a 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -1806,6 +1806,7 @@ void iterate_bdevs(void (*func)(struct block_device *, void *), void *arg) spin_lock(&blockdev_superblock->s_inode_list_lock); list_for_each_entry(inode, &blockdev_superblock->s_inodes, i_sb_list) { struct address_space *mapping = inode->i_mapping; + struct block_device *bdev; spin_lock(&inode->i_lock); if (inode->i_state & (I_FREEING|I_WILL_FREE|I_NEW) || @@ -1826,8 +1827,12 @@ void iterate_bdevs(void (*func)(struct block_device *, void *), void *arg) */ iput(old_inode); old_inode = inode; + bdev = I_BDEV(inode); - func(I_BDEV(inode), arg); + mutex_lock(&bdev->bd_mutex); + if (bdev->bd_openers) + func(bdev, arg); + mutex_unlock(&bdev->bd_mutex); spin_lock(&blockdev_superblock->s_inode_list_lock); } diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 1d0f1a1ac44c..069aa1aa82b6 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -1357,11 +1357,11 @@ void tracing_reset_all_online_cpus(void) #define SAVED_CMDLINES_DEFAULT 128 #define NO_CMDLINE_MAP UINT_MAX -static unsigned saved_tgids[SAVED_CMDLINES_DEFAULT]; static arch_spinlock_t trace_cmdline_lock = __ARCH_SPIN_LOCK_UNLOCKED; struct saved_cmdlines_buffer { unsigned map_pid_to_cmdline[PID_MAX_DEFAULT+1]; unsigned *map_cmdline_to_pid; + unsigned *saved_tgids; unsigned cmdline_num; int cmdline_idx; char *saved_cmdlines; @@ -1395,12 +1395,22 @@ static int allocate_cmdlines_buffer(unsigned int val, return -ENOMEM; } + s->saved_tgids = kmalloc_array(val, sizeof(*s->saved_tgids), + GFP_KERNEL); + if (!s->saved_tgids) { + kfree(s->map_cmdline_to_pid); + kfree(s->saved_cmdlines); + return -ENOMEM; + } + s->cmdline_idx = 0; s->cmdline_num = val; memset(&s->map_pid_to_cmdline, NO_CMDLINE_MAP, sizeof(s->map_pid_to_cmdline)); memset(s->map_cmdline_to_pid, NO_CMDLINE_MAP, val * sizeof(*s->map_cmdline_to_pid)); + memset(s->saved_tgids, 0, + val * sizeof(*s->saved_tgids)); return 0; } @@ -1596,7 +1606,7 @@ static int trace_save_cmdline(struct task_struct *tsk) } set_cmdline(idx, tsk->comm); - saved_tgids[idx] = tsk->tgid; + savedcmd->saved_tgids[idx] = tsk->tgid; arch_spin_unlock(&trace_cmdline_lock); return 1; @@ -1648,7 +1658,7 @@ int trace_find_tgid(int pid) arch_spin_lock(&trace_cmdline_lock); map = savedcmd->map_pid_to_cmdline[pid]; if (map != NO_CMDLINE_MAP) - tgid = saved_tgids[map]; + tgid = savedcmd->saved_tgids[map]; else tgid = -1; @@ -4221,13 +4231,13 @@ tracing_saved_tgids_read(struct file *file, char __user *ubuf, int pid; int i; - file_buf = kmalloc(SAVED_CMDLINES_DEFAULT*(16+1+16), GFP_KERNEL); + file_buf = kmalloc(savedcmd->cmdline_num*(16+1+16), GFP_KERNEL); if (!file_buf) return -ENOMEM; buf = file_buf; - for (i = 0; i < SAVED_CMDLINES_DEFAULT; i++) { + for (i = 0; i < savedcmd->cmdline_num; i++) { int tgid; int r; |
