Skip to content

Commit

Permalink
Merge branch 'vantoman:13' into 13
Browse files Browse the repository at this point in the history
  • Loading branch information
openhoangnc authored May 21, 2023
2 parents d296900 + 8f941a4 commit 13d2ee4
Show file tree
Hide file tree
Showing 176 changed files with 30,093 additions and 4,637 deletions.
57 changes: 55 additions & 2 deletions arch/arm64/boot/dts/qcom/trinket-camera-sensor-idp.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@
};
};

&L3P {
regulator-min-microvolt = <2800000>;
regulator-max-microvolt = <3300000>;
};

&cci {
actuator0: qcom,actuator@0 {
cell-index = <0>;
Expand Down Expand Up @@ -183,6 +188,53 @@
qcom,clock-rates = <24000000 0>;
};

/*ToF imx528 sensor */
eeprom3: qcom,eeprom@3 {
cell-index = <3>;
reg = <0x3>;
compatible = "qcom,eeprom";
cam_vio-supply = <&L12A>;
cam_vana-supply = <&L3P>;
cam_vdig-supply = <&L1P>;
cam_clk-supply = <&camss_top_gdsc>;
qcom,cam-vreg-name = "cam_vio", "cam_vana", "cam_vdig",
"cam_clk";
qcom,cam-vreg-min-voltage = <1800000 3300000 1200000 0>;
qcom,cam-vreg-max-voltage = <1800000 3300000 1200000 0>;
qcom,cam-vreg-op-mode = <0 80000 105000 0>;
qcom,gpio-no-mux = <0>;
pinctrl-names = "cam_default", "cam_suspend";
pinctrl-0 = <&cam_sensor_mclk0_active
&cam_sensor_rear_active
&cam_sensor_custom1_active
&cam_sensor_custom2_active>;
pinctrl-1 = <&cam_sensor_mclk0_suspend
&cam_sensor_rear_suspend
&cam_sensor_custom1_suspend
&cam_sensor_custom2_suspend>;
gpios = <&tlmm 34 0>,
<&tlmm 48 0>,
<&tlmm 44 0>,//VILLU_3P65
<&tlmm 47 0>;//LDD_XCLR
qcom,gpio-reset = <1>;
qcom,gpio-custom1 = <2>;
qcom,gpio-custom2 = <3>;
qcom,gpio-req-tbl-num = <0 1 2 3>;
qcom,gpio-req-tbl-flags = <1 0 0 0>;
qcom,gpio-req-tbl-label = "CAMIF_MCLK0",
"CAM_RESET0",
"CUSTOM_GPIO1",//VILLU_3P65
"CUSTOM_GPIO2";//LDD_XCLR
qcom,sensor-position = <0>;
qcom,sensor-mode = <0>;
qcom,cci-master = <0>;
status = "ok";
clocks = <&clock_gcc GCC_CAMSS_MCLK0_CLK_SRC>,
<&clock_gcc GCC_CAMSS_MCLK0_CLK>;
clock-names = "cam_src_clk", "cam_clk";
qcom,clock-rates = <24000000 0>;
};

qcom,camera@0 {
cell-index = <0>;
compatible = "qcom,camera";
Expand Down Expand Up @@ -315,14 +367,15 @@
qcom,csiphy-sd-index = <0>;
qcom,csid-sd-index = <0>;
qcom,mount-angle = <90>;
qcom,eeprom-src = <&eeprom3>;
cam_vio-supply = <&L12A>;
cam_vana-supply = <&L3P>;
cam_vdig-supply = <&L1P>;
cam_clk-supply = <&camss_top_gdsc>;
qcom,cam-vreg-name = "cam_vio", "cam_vana", "cam_vdig",
"cam_clk";
qcom,cam-vreg-min-voltage = <1800000 2800000 1200000 0>;
qcom,cam-vreg-max-voltage = <1800000 2800000 1200000 0>;
qcom,cam-vreg-min-voltage = <1800000 3300000 1200000 0>;
qcom,cam-vreg-max-voltage = <1800000 3300000 1200000 0>;
qcom,cam-vreg-op-mode = <0 80000 105000 0>;
qcom,gpio-no-mux = <0>;
pinctrl-names = "cam_default", "cam_suspend";
Expand Down
10 changes: 9 additions & 1 deletion drivers/crypto/msm/qcedev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1915,7 +1915,9 @@ static inline long qcedev_ioctl(struct file *file,
goto exit_free_qcedev_areq;
}

if (map_buf.num_fds > QCEDEV_MAX_BUFFERS) {
if (map_buf.num_fds > ARRAY_SIZE(map_buf.fd)) {
pr_err("%s: err: num_fds = %d exceeds max value\n",
__func__, map_buf.num_fds);
err = -EINVAL;
goto exit_free_qcedev_areq;
}
Expand Down Expand Up @@ -1955,6 +1957,12 @@ static inline long qcedev_ioctl(struct file *file,
err = -EFAULT;
goto exit_free_qcedev_areq;
}
if (unmap_buf.num_fds > ARRAY_SIZE(unmap_buf.fd)) {
pr_err("%s: err: num_fds = %d exceeds max value\n",
__func__, unmap_buf.num_fds);
err = -EINVAL;
goto exit_free_qcedev_areq;
}

for (i = 0; i < unmap_buf.num_fds; i++) {
err = qcedev_check_and_unmap_buffer(handle,
Expand Down
73 changes: 19 additions & 54 deletions drivers/gpu/drm/msm/dp/dp_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,16 +128,18 @@ static const struct of_device_id dp_dt_match[] = {
};

static void dp_display_update_hdcp_info(struct dp_display_private *dp);
static bool dp_display_framework_ready(struct dp_display_private *dp)
{
return dp->dp_display.post_open ? false : true;
}

static inline bool dp_display_is_hdcp_enabled(struct dp_display_private *dp)
{
return dp->link->hdcp_status.hdcp_version && dp->hdcp.ops;
}

static bool is_drm_bootsplash_enabled(struct device *dev)
{
return of_property_read_bool(dev->of_node,
"qcom,sde-drm-fb-splash-logo-enabled");
}

static irqreturn_t dp_display_irq(int irq, void *dev_id)
{
struct dp_display_private *dp = dev_id;
Expand Down Expand Up @@ -349,13 +351,6 @@ static void dp_display_hdcp_cb_work(struct work_struct *work)

dp = container_of(dw, struct dp_display_private, hdcp_cb_work);

dp_display_update_hdcp_info(dp);

if (!dp_display_is_hdcp_enabled(dp))
return;

dp->link->hdcp_status.hdcp_state = HDCP_STATE_AUTHENTICATING;

if (!dp->power_on || !dp->is_connected || atomic_read(&dp->aborted) ||
dp->hdcp_abort)
return;
Expand Down Expand Up @@ -641,40 +636,11 @@ static void dp_display_send_hpd_event(struct dp_display_private *dp)
envp);
}

static void dp_display_post_open(struct dp_display *dp_display)
{
struct drm_connector *connector;
struct dp_display_private *dp;

if (!dp_display) {
pr_err("invalid input\n");
return;
}

dp = container_of(dp_display, struct dp_display_private, dp_display);
if (IS_ERR_OR_NULL(dp)) {
pr_err("invalid params\n");
return;
}

connector = dp->dp_display.base_connector;

if (!connector) {
pr_err("connector not set\n");
return;
}

/* if cable is already connected, send notification */
if (dp->hpd->hpd_high)
queue_work(dp->wq, &dp->connect_work);
else
dp_display->post_open = NULL;
}

static int dp_display_send_hpd_notification(struct dp_display_private *dp)
{
int ret = 0;
bool hpd = dp->is_connected;
static int bootsplash_count;

dp->aux->state |= DP_STATE_NOTIFICATION_SENT;

Expand All @@ -683,13 +649,12 @@ static int dp_display_send_hpd_notification(struct dp_display_private *dp)
else
dp->dp_display.is_sst_connected = false;

if (!dp_display_framework_ready(dp)) {
pr_debug("%s: dp display framework not ready\n", __func__);
if (!dp->dp_display.is_bootsplash_en) {
dp->dp_display.is_bootsplash_en = true;
drm_client_dev_register(dp->dp_display.drm_dev);
}
return ret;
if (!dp->dp_display.is_bootsplash_en
&& is_drm_bootsplash_enabled(dp->dp_display.drm_dev->dev)
&& !bootsplash_count) {
dp->dp_display.is_bootsplash_en = true;
bootsplash_count++;
drm_client_dev_register(dp->dp_display.drm_dev);
}

reinit_completion(&dp->notification_comp);
Expand Down Expand Up @@ -1258,11 +1223,6 @@ static void dp_display_connect_work(struct work_struct *work)
struct dp_display_private *dp = container_of(work,
struct dp_display_private, connect_work);

if (dp->dp_display.is_sst_connected && dp_display_framework_ready(dp)) {
pr_debug("HPD already on\n");
return;
}

if (atomic_read(&dp->aborted)) {
pr_warn("HPD off requested\n");
return;
Expand Down Expand Up @@ -1762,6 +1722,11 @@ static int dp_display_post_enable(struct dp_display *dp_display, void *panel)

mutex_lock(&dp->session_lock);

if (dp->dp_display.is_bootsplash_en) {
dp->dp_display.is_bootsplash_en = false;
goto end;
}

if (!dp->power_on) {
pr_debug("stream not setup, return\n");
goto end;
Expand Down Expand Up @@ -2841,7 +2806,7 @@ static int dp_display_probe(struct platform_device *pdev)
g_dp_display->unprepare = dp_display_unprepare;
g_dp_display->request_irq = dp_request_irq;
g_dp_display->get_debug = dp_get_debug;
g_dp_display->post_open = dp_display_post_open;
g_dp_display->post_open = NULL;
g_dp_display->post_init = dp_display_post_init;
g_dp_display->config_hdr = dp_display_config_hdr;
g_dp_display->mst_install = dp_display_mst_install;
Expand Down
5 changes: 1 addition & 4 deletions drivers/gpu/msm/adreno.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Copyright (c) 2008-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2022-2023, Qualcomm Innovation Center, Inc. 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
Expand Down Expand Up @@ -35,9 +35,6 @@
#define DEVICE_3D_NAME "kgsl-3d"
#define DEVICE_3D0_NAME "kgsl-3d0"

/* Index to preemption scratch buffer to store KMD postamble */
#define KMD_POSTAMBLE_IDX 100

/* ADRENO_DEVICE - Given a kgsl_device return the adreno device struct */
#define ADRENO_DEVICE(device) \
container_of(device, struct adreno_device, dev)
Expand Down
19 changes: 10 additions & 9 deletions drivers/gpu/msm/adreno_a6xx_preempt.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2022-2023, Qualcomm Innovation Center, Inc. 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
Expand Down Expand Up @@ -566,8 +566,8 @@ unsigned int a6xx_preemption_pre_ibsubmit(
* preemption
*/
if (!adreno_dev->perfcounter) {
u64 kmd_postamble_addr =
PREEMPT_SCRATCH_ADDR(adreno_dev, KMD_POSTAMBLE_IDX);
u64 kmd_postamble_addr = SCRATCH_POSTAMBLE_ADDR
(KGSL_DEVICE(adreno_dev));

*cmds++ = cp_type7_packet(CP_SET_AMBLE, 3);
*cmds++ = lower_32_bits(kmd_postamble_addr);
Expand Down Expand Up @@ -811,14 +811,15 @@ int a6xx_preemption_init(struct adreno_device *adreno_dev)
}

/*
* First 8 dwords of the preemption scratch buffer is used to store the
* address for CP to save/restore VPC data. Reserve 11 dwords in the
* preemption scratch buffer from index KMD_POSTAMBLE_IDX for KMD
* postamble pm4 packets
* First 28 dwords of the device scratch buffer are used to store
* shadow rb data. Reserve 11 dwords in the device scratch buffer
* from SCRATCH_POSTAMBLE_OFFSET for KMD postamble pm4 packets.
* This should be in *device->scratch* so that userspace cannot
* access it.
*/
if (!adreno_dev->perfcounter) {
u32 *postamble = preempt->scratch.hostptr +
(KMD_POSTAMBLE_IDX * sizeof(u64));
u32 *postamble = device->scratch.hostptr +
SCRATCH_POSTAMBLE_OFFSET;
u32 count = 0;

postamble[count++] = cp_type7_packet(CP_REG_RMW, 3);
Expand Down
41 changes: 33 additions & 8 deletions drivers/gpu/msm/kgsl.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Copyright (c) 2008-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2022-2023, Qualcomm Innovation Center, Inc. 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
Expand Down Expand Up @@ -2437,6 +2437,15 @@ static int kgsl_setup_anon_useraddr(struct kgsl_pagetable *pagetable,
}

#ifdef CONFIG_DMA_SHARED_BUFFER
static int match_file(const void *p, struct file *file, unsigned int fd)
{
/*
* We must return fd + 1 because iterate_fd stops searching on
* non-zero return, but 0 is a valid fd.
*/
return (p == file) ? (fd + 1) : 0;
}

static void _setup_cache_mode(struct kgsl_mem_entry *entry,
struct vm_area_struct *vma)
{
Expand Down Expand Up @@ -2474,6 +2483,8 @@ static int kgsl_setup_dmabuf_useraddr(struct kgsl_device *device,
vma = find_vma(current->mm, hostptr);

if (vma && vma->vm_file) {
int fd;

ret = check_vma_flags(vma, entry->memdesc.flags);
if (ret) {
up_read(&current->mm->mmap_sem);
Expand All @@ -2489,13 +2500,27 @@ static int kgsl_setup_dmabuf_useraddr(struct kgsl_device *device,
return -EFAULT;
}

/*
* Take a refcount because dma_buf_put() decrements the
* refcount
*/
get_file(vma->vm_file);

dmabuf = vma->vm_file->private_data;
/* Look for the fd that matches this vma file */
fd = iterate_fd(current->files, 0, match_file, vma->vm_file);
if (fd) {
dmabuf = dma_buf_get(fd - 1);
if (IS_ERR(dmabuf)) {
up_read(&current->mm->mmap_sem);
return PTR_ERR(dmabuf);
}
/*
* It is possible that the fd obtained from iterate_fd
* was closed before passing the fd to dma_buf_get().
* Hence dmabuf returned by dma_buf_get() could be
* different from vma->vm_file->private_data. Return
* failure if this happens.
*/
if (dmabuf != vma->vm_file->private_data) {
dma_buf_put(dmabuf);
up_read(&current->mm->mmap_sem);
return -EBADF;
}
}
}

if (IS_ERR_OR_NULL(dmabuf)) {
Expand Down
6 changes: 6 additions & 0 deletions drivers/gpu/msm/kgsl.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* Copyright (c) 2008-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. 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
Expand Down Expand Up @@ -83,6 +84,11 @@
#define SCRATCH_RPTR_GPU_ADDR(dev, id) \
((dev)->scratch.gpuaddr + SCRATCH_RPTR_OFFSET(id))

/* OFFSET to KMD postamble packets in scratch buffer */
#define SCRATCH_POSTAMBLE_OFFSET (100 * sizeof(u64))
#define SCRATCH_POSTAMBLE_ADDR(dev) \
((dev)->scratch.gpuaddr + SCRATCH_POSTAMBLE_OFFSET)

/* Timestamp window used to detect rollovers (half of integer range) */
#define KGSL_TIMESTAMP_WINDOW 0x80000000

Expand Down
Loading

0 comments on commit 13d2ee4

Please sign in to comment.