Skip to content

Commit

Permalink
Merge tag 'LA.UM.9.3.r1-02800-sdm845.0' of https://source.codeaurora.…
Browse files Browse the repository at this point in the history
…org/quic/la/kernel/msm-4.9 into HEAD

"LA.UM.9.3.r1-02800-sdm845.0"

Change-Id: I41f4c8398ae77c94aa9e9f1c0a2344cbbcb5d41c
  • Loading branch information
YumeMichi committed Oct 8, 2021
2 parents 479fa38 + 9d849b4 commit d170031
Show file tree
Hide file tree
Showing 8 changed files with 274 additions and 12 deletions.
19 changes: 15 additions & 4 deletions drivers/char/adsprpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ struct fastrpc_mmap {
int uncached;
int secure;
uintptr_t attr;
bool is_filemap; /*flag to indicate map used in process init*/
};

enum fastrpc_perfkeys {
Expand Down Expand Up @@ -417,6 +418,7 @@ struct fastrpc_file {
struct mutex perf_mutex;
struct pm_qos_request pm_qos_req;
int qos_request;
struct mutex pm_qos_mutex;
struct mutex map_mutex;
struct mutex fl_map_mutex;
int refcount;
Expand Down Expand Up @@ -710,9 +712,10 @@ static int fastrpc_mmap_remove(struct fastrpc_file *fl, uintptr_t va,

spin_lock(&me->hlock);
hlist_for_each_entry_safe(map, n, &me->maps, hn) {
if (map->raddr == va &&
if (map->refs == 1 && map->raddr == va &&
map->raddr + map->len == va + len &&
map->refs == 1) {
/*Remove map if not used in process initialization*/
!map->is_filemap) {
match = map;
hlist_del_init(&map->hn);
break;
Expand All @@ -724,9 +727,10 @@ static int fastrpc_mmap_remove(struct fastrpc_file *fl, uintptr_t va,
return 0;
}
hlist_for_each_entry_safe(map, n, &fl->maps, hn) {
if (map->raddr == va &&
if (map->refs == 1 && map->raddr == va &&
map->raddr + map->len == va + len &&
map->refs == 1) {
/*Remove map if not used in process initialization*/
!map->is_filemap) {
match = map;
hlist_del_init(&map->hn);
break;
Expand Down Expand Up @@ -872,6 +876,7 @@ static int fastrpc_mmap_create(struct fastrpc_file *fl, int fd,
map->fl = fl;
map->fd = fd;
map->attr = attr;
map->is_filemap = false;
if (mflags == ADSP_MMAP_HEAP_ADDR ||
mflags == ADSP_MMAP_REMOTE_HEAP_ADDR) {
unsigned long dma_attrs = DMA_ATTR_SKIP_ZEROING |
Expand Down Expand Up @@ -2284,6 +2289,8 @@ static int fastrpc_init_process(struct fastrpc_file *fl,
mutex_lock(&fl->fl_map_mutex);
VERIFY(err, !fastrpc_mmap_create(fl, init->filefd, 0,
init->file, init->filelen, mflags, &file));
if (file)
file->is_filemap = true;
mutex_unlock(&fl->fl_map_mutex);
if (err)
goto bail;
Expand Down Expand Up @@ -3265,6 +3272,7 @@ static int fastrpc_file_free(struct fastrpc_file *fl)
mutex_destroy(&fl->perf_mutex);
mutex_destroy(&fl->fl_map_mutex);
mutex_destroy(&fl->map_mutex);
mutex_destroy(&fl->pm_qos_mutex);
kfree(fl);
return 0;
}
Expand Down Expand Up @@ -3767,6 +3775,7 @@ static int fastrpc_device_open(struct inode *inode, struct file *filp)
hlist_add_head(&fl->hn, &me->drivers);
spin_unlock(&me->hlock);
mutex_init(&fl->perf_mutex);
mutex_init(&fl->pm_qos_mutex);
return 0;
}

Expand Down Expand Up @@ -3872,12 +3881,14 @@ static int fastrpc_internal_control(struct fastrpc_file *fl,
VERIFY(err, latency != 0);
if (err)
goto bail;
mutex_lock(&fl->pm_qos_mutex);
if (!fl->qos_request) {
pm_qos_add_request(&fl->pm_qos_req,
PM_QOS_CPU_DMA_LATENCY, latency);
fl->qos_request = 1;
} else
pm_qos_update_request(&fl->pm_qos_req, latency);
mutex_unlock(&fl->pm_qos_mutex);
break;
case FASTRPC_CONTROL_SMMU:
if (!me->legacy)
Expand Down
5 changes: 4 additions & 1 deletion drivers/gpu/drm/msm/dp/dp_display.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) 2017-2021, 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
Expand Down Expand Up @@ -780,6 +780,9 @@ static int dp_display_usbpd_attention_cb(struct device *dev)
return -ENODEV;
}

if (dp->usbpd->hpd_high && dp->usbpd->hpd_irq)
drm_dp_cec_irq(dp->aux->drm_aux);

if (dp->usbpd->hpd_irq && dp->usbpd->hpd_high &&
dp->power_on) {
dp->link->process_request(dp->link);
Expand Down
4 changes: 1 addition & 3 deletions drivers/gpu/drm/msm/dp/dp_link.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2018, 2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2018,2020-2021, 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
Expand Down Expand Up @@ -790,8 +790,6 @@ static int dp_link_parse_request(struct dp_link_private *link)

pr_debug("device service irq vector = 0x%x\n", data);

drm_dp_cec_irq(link->aux->drm_aux);

if (!(data & DP_AUTOMATED_TEST_REQUEST)) {
pr_debug("no test requested\n");
return 0;
Expand Down
20 changes: 16 additions & 4 deletions drivers/soc/qcom/msm_minidump.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2017-2018,2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2018,2021 The Linux Foundation. All rights reserved.
*/
#define pr_fmt(fmt) "Minidump: " fmt

Expand Down Expand Up @@ -214,6 +214,7 @@ EXPORT_SYMBOL(msm_minidump_update_region);
int msm_minidump_add_region(const struct md_region *entry)
{
u32 entries;
u32 toc_init;
struct md_region *mdr;

if (validate_region(entry))
Expand All @@ -232,6 +233,19 @@ int msm_minidump_add_region(const struct md_region *entry)
return -ENOMEM;
}

toc_init = 0;
if (minidump_table.md_ss_toc &&
(minidump_table.md_ss_toc->md_ss_enable_status ==
MD_SS_ENABLED)) {
toc_init = 1;
if (minidump_table.md_ss_toc->ss_region_count >=
MAX_NUM_ENTRIES) {
spin_unlock(&mdt_lock);
pr_err("Maximum regions in minidump table reached.\n");
return -ENOMEM;
}
}

mdr = &minidump_table.entry[entries];
strlcpy(mdr->name, entry->name, sizeof(mdr->name));
mdr->virt_addr = entry->virt_addr;
Expand All @@ -241,9 +255,7 @@ int msm_minidump_add_region(const struct md_region *entry)

minidump_table.num_regions = entries + 1;

if (minidump_table.md_ss_toc &&
(minidump_table.md_ss_toc->md_ss_enable_status ==
MD_SS_ENABLED))
if (toc_init)
md_update_ss_toc(entry);
else
pendings++;
Expand Down
2 changes: 2 additions & 0 deletions gen_headers_arm.bp
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,8 @@ gen_headers_out_arm = [
"linux/qcota.h",
"linux/qg-profile.h",
"linux/qg.h",
"linux/qbg-profile.h",
"linux/qbg.h",
"linux/qnx4_fs.h",
"linux/qnxtypes.h",
"linux/qrng.h",
Expand Down
2 changes: 2 additions & 0 deletions gen_headers_arm64.bp
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,8 @@ gen_headers_out_arm64 = [
"linux/qcota.h",
"linux/qg-profile.h",
"linux/qg.h",
"linux/qbg-profile.h",
"linux/qbg.h",
"linux/qnx4_fs.h",
"linux/qnxtypes.h",
"linux/qrng.h",
Expand Down
55 changes: 55 additions & 0 deletions include/uapi/linux/qbg-profile.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
/*
* Copyright (c) 2021, The Linux Foundation. All rights reserved.
*/

#ifndef __QBG_PROFILE_H__
#define __QBG_PROFILE_H__

#define MAX_BP_LUT_ROWS 35
#define MAX_BP_LUT_COLS 8
#define MAX_PROFILE_NAME_LENGTH 256

enum profile_table_type {
CHARGE_TABLE = 0,
DISCHARGE_TABLE,
};

struct battery_data_table {
unsigned short int table[MAX_BP_LUT_ROWS][MAX_BP_LUT_COLS];
int unit_conv_factor[MAX_BP_LUT_COLS];
unsigned short int nrows;
unsigned short int ncols;
};

struct battery_config {
char bp_profile_name[MAX_PROFILE_NAME_LENGTH];
int bp_batt_id;
int capacity;
int bp_checksum;
int soh_range_high;
int soh_range_low;
int normal_impedance;
int aged_impedance;
int normal_capacity;
int aged_capacity;
int recharge_soc_delta;
int recharge_vflt_delta;
int recharge_iterm;
};

struct battery_profile_table {
enum profile_table_type table_type;
int table_index;
struct battery_data_table *table;
};

/* IOCTLs to query battery profile data */
/* Battery configuration */
#define BPIOCXBP \
_IOWR('B', 0x01, struct battery_config)
/* Battery profile table */
#define BPIOCXBPTABLE \
_IOWR('B', 0x02, struct battery_profile_table)

#endif
Loading

0 comments on commit d170031

Please sign in to comment.