mirror of
https://github.com/joel16/android_kernel_sony_msm8994.git
synced 2024-12-02 17:26:48 +00:00
32.2.A.0.305
This commit is contained in:
parent
4a63544d02
commit
0bb5717c41
@ -4,45 +4,58 @@ Configuration files can be found in arch/arm64/configs.
|
||||
msm8994-perf_defconfig
|
||||
|
||||
diffconfigs for each product:
|
||||
Xperia Z3+ E6553 => ivy_diffconfig
|
||||
Xperia Z3+ Dual E6533 => ivy_dsds_diffconfig
|
||||
Xperia Z4 Tablet SGP771 => karin_diffconfig
|
||||
Xperia Z4 Tablet SGP712 => karin_windy_diffconfig
|
||||
Xperia Z5 Compact E5803/E5823 => suzuran_diffconfig
|
||||
Xperia Z5 E6653 => sumire_diffconfig
|
||||
Xperia Z5 Dual E6683 => sumire_dsds_diffconfig
|
||||
Xperia Z5 Premium E6853 => satsuki_diffconfig
|
||||
Xperia Z5 Premium Dual E6883 => satsuki_dsds_diffconfig
|
||||
Xperia Z3+ E6553 => ivy_diffconfig
|
||||
Xperia Z3+ Dual E6533 => ivy_dsds_diffconfig
|
||||
Xperia Z4 Tablet SGP771 => karin_diffconfig
|
||||
Xperia Z4 Tablet SGP712 => karin_windy_diffconfig
|
||||
Xperia Z5 E6603/E6653 => sumire_diffconfig
|
||||
Xperia Z5 Dual E6633/E6683 => sumire_dsds_diffconfig
|
||||
Xperia Z5 Compact E5803/E5823 => suzuran_diffconfig
|
||||
Xperia Z5 Premium E6853 => satsuki_diffconfig
|
||||
Xperia Z5 Premium Dual E6833/E6883 => satsuki_dsds_diffconfig
|
||||
|
||||
|
||||
How to build your kernel:
|
||||
|
||||
Prerequisites:
|
||||
|
||||
* ramdisk.img - root fs
|
||||
|
||||
* mkbootimg - boot.img generator
|
||||
|
||||
* The ARM cross-compiler
|
||||
You can use prebuild executable binary which is included in
|
||||
standard Android repository. Please visit to external site.
|
||||
In case of this platform, we recommend to use gcc 4.9 or later
|
||||
such as aarch64-linux-android-4.9 to avoid known issues.
|
||||
|
||||
|
||||
Step 1: Build Your Kernel
|
||||
$ cd kernel
|
||||
|
||||
$ export ARCH=arm64
|
||||
|
||||
$ export PATH=<path-to-cross-compiler-executables>:$PATH
|
||||
NOTE: Please set the location of the ARM cross-compiler.
|
||||
|
||||
$ export CROSS_COMPILE=<toolchain-prefix>
|
||||
NOTE: Please set the prefix of the ARM cross-compiler.
|
||||
ex) aarch64-linux-android-
|
||||
|
||||
$ export KBUILD_DIFFCONFIG=sumire_diffconfig
|
||||
NOTE: Please set a configuration file you want to build.
|
||||
|
||||
$ make msm8994-perf_defconfig
|
||||
|
||||
$ make
|
||||
You can see arch/arm64/boot/Image.gz-dtb if you succeed in building.
|
||||
|
||||
You can see arch/arm64/boot/Image-dtb if you succeed in building.
|
||||
|
||||
|
||||
Step 2: Assembling the boot.img
|
||||
(In the Linux Kernel directory)
|
||||
$ mkbootimg \
|
||||
--kernel arch/arm64/boot/Image.gz-dtb \
|
||||
--kernel arch/arm64/boot/Image-dtb \
|
||||
--ramdisk ramdisk.img \
|
||||
--cmdline "androidboot.hardware=qcom user_debug=31 msm_rtb.filter=0x237 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 boot_cpus=0-5 dwc3_msm.prop_chg_detect=Y coherent_pool=2M dwc3_msm.hvdcp_max_current=1500" \
|
||||
--base 0x00000000 \
|
||||
|
@ -1,59 +0,0 @@
|
||||
/* Copyright (c) 2013-2014, 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
|
||||
* only version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2015 Sony Mobile Communications Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
qcom,kitakami-aoi-send {
|
||||
qcom,max-voltage-uv = <4350000>;
|
||||
qcom,v-cutoff-uv = <3400000>;
|
||||
qcom,chg-term-ua = <100000>;
|
||||
qcom,batt-id-kohm = <222>;
|
||||
qcom,battery-type = "1292-1008";
|
||||
qcom,fg-profile-data = [
|
||||
F2 83 3A 7D
|
||||
0D 81 22 77
|
||||
38 83 DF 6B
|
||||
43 71 1C 7F
|
||||
02 82 4D 99
|
||||
6E B7 49 C3
|
||||
64 0F 6B 82
|
||||
D3 7B 85 7F
|
||||
33 78 1E 83
|
||||
43 7A 2B 87
|
||||
83 82 38 82
|
||||
A6 98 64 B6
|
||||
F0 C1 82 19
|
||||
20 0C 16 5B
|
||||
CE 6E 29 FC
|
||||
C8 08 8F 44
|
||||
6E 3B 00 00
|
||||
ED 3C 25 2A
|
||||
E5 35 00 00
|
||||
00 00 00 00
|
||||
00 00 00 00
|
||||
A5 70 E6 70
|
||||
5C 7C 1C 7B
|
||||
6C 75 5B 62
|
||||
F6 74 FC 7B
|
||||
E1 75 E1 63
|
||||
6A 86 05 A8
|
||||
1F E0 59 47
|
||||
4E A0 71 0C
|
||||
28 00 FF 36
|
||||
F0 11 30 03
|
||||
00 00 00 00
|
||||
];
|
||||
};
|
@ -591,7 +591,6 @@ CONFIG_CRYPTO_XCBC=y
|
||||
CONFIG_CRYPTO_CTR=y
|
||||
CONFIG_CRYPTO_SHA256=y
|
||||
CONFIG_QMI_ENCDEC=y
|
||||
CONFIG_MSM_BUSPM_DEV=m
|
||||
CONFIG_MEDIA_RADIO_SUPPORT=y
|
||||
CONFIG_RADIO_IRIS=y
|
||||
CONFIG_RADIO_IRIS_TRANSPORT=m
|
||||
|
@ -45,6 +45,7 @@ CONFIG_MSM_RTB=y
|
||||
CONFIG_MSM_TZ_LOG=y
|
||||
# CONFIG_NFC_QNCI is not set
|
||||
CONFIG_NLS_UTF8=y
|
||||
# CONFIG_PFT is not set
|
||||
# CONFIG_PHYLIB is not set
|
||||
CONFIG_PINCTRL_SOMC=y
|
||||
CONFIG_PMI8994_FLASH=y
|
||||
|
@ -458,7 +458,6 @@ CONFIG_PFT=y
|
||||
CONFIG_MSM_BUS_SCALING=y
|
||||
CONFIG_BUS_TOPOLOGY_ADHOC=y
|
||||
CONFIG_DEBUG_BUS_VOTER=y
|
||||
CONFIG_MSM_BUSPM_DEV=m
|
||||
CONFIG_QPNP_HAPTIC=y
|
||||
CONFIG_SEEMP_CORE=y
|
||||
CONFIG_MSM_MDSS_PLL=y
|
||||
|
@ -481,7 +481,6 @@ CONFIG_RMNET_IPA=y
|
||||
CONFIG_MSM_AVTIMER=y
|
||||
CONFIG_PFT=y
|
||||
CONFIG_MSM_BUS_SCALING=y
|
||||
CONFIG_MSM_BUSPM_DEV=m
|
||||
CONFIG_BUS_TOPOLOGY_ADHOC=y
|
||||
CONFIG_DEBUG_BUS_VOTER=y
|
||||
CONFIG_QPNP_HAPTIC=y
|
||||
|
@ -90,7 +90,6 @@ extern pgprot_t pgprot_default;
|
||||
#define __PAGE_COPY_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN)
|
||||
#define __PAGE_READONLY __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_UXN)
|
||||
#define __PAGE_READONLY_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN)
|
||||
#define __PAGE_EXECONLY __pgprot(_PAGE_DEFAULT | PTE_NG | PTE_PXN)
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
@ -98,7 +97,7 @@ extern pgprot_t pgprot_default;
|
||||
#define __P001 __PAGE_READONLY
|
||||
#define __P010 __PAGE_COPY
|
||||
#define __P011 __PAGE_COPY
|
||||
#define __P100 __PAGE_EXECONLY
|
||||
#define __P100 __PAGE_READONLY_EXEC
|
||||
#define __P101 __PAGE_READONLY_EXEC
|
||||
#define __P110 __PAGE_COPY_EXEC
|
||||
#define __P111 __PAGE_COPY_EXEC
|
||||
@ -107,7 +106,7 @@ extern pgprot_t pgprot_default;
|
||||
#define __S001 __PAGE_READONLY
|
||||
#define __S010 __PAGE_SHARED
|
||||
#define __S011 __PAGE_SHARED
|
||||
#define __S100 __PAGE_EXECONLY
|
||||
#define __S100 __PAGE_READONLY_EXEC
|
||||
#define __S101 __PAGE_READONLY_EXEC
|
||||
#define __S110 __PAGE_SHARED_EXEC
|
||||
#define __S111 __PAGE_SHARED_EXEC
|
||||
@ -144,8 +143,6 @@ extern struct page *empty_zero_page;
|
||||
#define pte_write(pte) (!!(pte_val(pte) & PTE_WRITE))
|
||||
#define pte_exec(pte) (!(pte_val(pte) & PTE_UXN))
|
||||
|
||||
#define pte_valid_ng(pte) \
|
||||
((pte_val(pte) & (PTE_VALID | PTE_NG)) == (PTE_VALID | PTE_NG))
|
||||
#define pte_valid_user(pte) \
|
||||
((pte_val(pte) & (PTE_VALID | PTE_USER)) == (PTE_VALID | PTE_USER))
|
||||
#define pte_valid_not_user(pte) \
|
||||
@ -224,7 +221,7 @@ extern void __sync_icache_dcache(pte_t pteval, unsigned long addr);
|
||||
static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
|
||||
pte_t *ptep, pte_t pte)
|
||||
{
|
||||
if (pte_valid_ng(pte)) {
|
||||
if (pte_valid_user(pte)) {
|
||||
if (!pte_special(pte) && pte_exec(pte))
|
||||
__sync_icache_dcache(pte, addr);
|
||||
if (pte_dirty(pte) && pte_write(pte))
|
||||
|
@ -178,7 +178,8 @@ static int __do_page_fault(struct mm_struct *mm, unsigned long addr,
|
||||
good_area:
|
||||
/*
|
||||
* Check that the permissions on the VMA allow for the fault which
|
||||
* occurred.
|
||||
* occurred. If we encountered a write or exec fault, we must have
|
||||
* appropriate permissions, otherwise we allow any permission.
|
||||
*/
|
||||
if (!(vma->vm_flags & vm_flags)) {
|
||||
fault = VM_FAULT_BADACCESS;
|
||||
@ -200,7 +201,7 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr,
|
||||
struct task_struct *tsk;
|
||||
struct mm_struct *mm;
|
||||
int fault, sig, code;
|
||||
unsigned long vm_flags = VM_READ | VM_WRITE;
|
||||
unsigned long vm_flags = VM_READ | VM_WRITE | VM_EXEC;
|
||||
unsigned int mm_flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
|
||||
|
||||
tsk = current;
|
||||
|
@ -451,7 +451,7 @@ int adreno_perfcounter_query_group(struct adreno_device *adreno_dev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
t = min_t(int, group->reg_count, count);
|
||||
t = min_t(unsigned int, group->reg_count, count);
|
||||
|
||||
buf = kmalloc(t * sizeof(unsigned int), GFP_KERNEL);
|
||||
if (buf == NULL) {
|
||||
|
@ -296,18 +296,13 @@ kgsl_mem_entry_destroy(struct kref *kref)
|
||||
EXPORT_SYMBOL(kgsl_mem_entry_destroy);
|
||||
|
||||
/**
|
||||
* kgsl_mem_entry_track_gpuaddr - Insert a mem_entry in the address tree and
|
||||
* assign it with a gpu address space before insertion
|
||||
* kgsl_mem_entry_track_gpuaddr - Get the entry gpu address space before
|
||||
* insertion to the process
|
||||
* @process: the process that owns the memory
|
||||
* @entry: the memory entry
|
||||
*
|
||||
* @returns - 0 on succcess else error code
|
||||
* @returns - 0 on success else error code
|
||||
*
|
||||
* Insert the kgsl_mem_entry in to the rb_tree for searching by GPU address.
|
||||
* The assignment of gpu address and insertion into list needs to
|
||||
* happen with the memory lock held to avoid race conditions between
|
||||
* gpu address being selected and some other thread looking through the
|
||||
* rb list in search of memory based on gpuaddr
|
||||
* This function should be called with processes memory spinlock held
|
||||
*/
|
||||
static int
|
||||
@ -315,8 +310,6 @@ kgsl_mem_entry_track_gpuaddr(struct kgsl_process_private *process,
|
||||
struct kgsl_mem_entry *entry)
|
||||
{
|
||||
int ret = 0;
|
||||
struct rb_node **node;
|
||||
struct rb_node *parent = NULL;
|
||||
struct kgsl_pagetable *pagetable = process->pagetable;
|
||||
|
||||
assert_spin_locked(&process->mem_lock);
|
||||
@ -337,25 +330,6 @@ kgsl_mem_entry_track_gpuaddr(struct kgsl_process_private *process,
|
||||
pagetable = pagetable->mmu->securepagetable;
|
||||
|
||||
ret = kgsl_mmu_get_gpuaddr(pagetable, &entry->memdesc);
|
||||
if (ret)
|
||||
goto done;
|
||||
|
||||
node = &process->mem_rb.rb_node;
|
||||
|
||||
while (*node) {
|
||||
struct kgsl_mem_entry *cur;
|
||||
|
||||
parent = *node;
|
||||
cur = rb_entry(parent, struct kgsl_mem_entry, node);
|
||||
|
||||
if (entry->memdesc.gpuaddr < cur->memdesc.gpuaddr)
|
||||
node = &parent->rb_left;
|
||||
else
|
||||
node = &parent->rb_right;
|
||||
}
|
||||
|
||||
rb_link_node(&entry->node, parent, node);
|
||||
rb_insert_color(&entry->node, &process->mem_rb);
|
||||
|
||||
done:
|
||||
return ret;
|
||||
@ -381,6 +355,47 @@ kgsl_mem_entry_untrack_gpuaddr(struct kgsl_process_private *process,
|
||||
}
|
||||
}
|
||||
|
||||
static void kgsl_mem_entry_commit_mem_list(struct kgsl_process_private *process,
|
||||
struct kgsl_mem_entry *entry)
|
||||
{
|
||||
struct rb_node **node;
|
||||
struct rb_node *parent = NULL;
|
||||
|
||||
if (!entry->memdesc.gpuaddr)
|
||||
return;
|
||||
|
||||
/* Insert mem entry in mem_rb tree */
|
||||
node = &process->mem_rb.rb_node;
|
||||
while (*node) {
|
||||
struct kgsl_mem_entry *cur;
|
||||
|
||||
parent = *node;
|
||||
cur = rb_entry(parent, struct kgsl_mem_entry, node);
|
||||
|
||||
if (entry->memdesc.gpuaddr < cur->memdesc.gpuaddr)
|
||||
node = &parent->rb_left;
|
||||
else
|
||||
node = &parent->rb_right;
|
||||
}
|
||||
|
||||
rb_link_node(&entry->node, parent, node);
|
||||
rb_insert_color(&entry->node, &process->mem_rb);
|
||||
}
|
||||
|
||||
static void kgsl_mem_entry_commit_process(struct kgsl_process_private *process,
|
||||
struct kgsl_mem_entry *entry)
|
||||
{
|
||||
if (!entry)
|
||||
return;
|
||||
|
||||
spin_lock(&entry->priv->mem_lock);
|
||||
/* Insert mem entry in mem_rb tree */
|
||||
kgsl_mem_entry_commit_mem_list(process, entry);
|
||||
/* Replace mem entry in mem_idr using id */
|
||||
idr_replace(&entry->priv->mem_idr, entry, entry->id);
|
||||
spin_unlock(&entry->priv->mem_lock);
|
||||
}
|
||||
|
||||
/**
|
||||
* kgsl_mem_entry_attach_process - Attach a mem_entry to its owner process
|
||||
* @entry: the memory entry
|
||||
@ -407,7 +422,8 @@ kgsl_mem_entry_attach_process(struct kgsl_mem_entry *entry,
|
||||
return -EBADF;
|
||||
idr_preload(GFP_KERNEL);
|
||||
spin_lock(&process->mem_lock);
|
||||
id = idr_alloc(&process->mem_idr, entry, 1, 0, GFP_NOWAIT);
|
||||
/* Allocate the ID but don't attach the pointer just yet */
|
||||
id = idr_alloc(&process->mem_idr, NULL, 1, 0, GFP_NOWAIT);
|
||||
spin_unlock(&process->mem_lock);
|
||||
idr_preload_end();
|
||||
|
||||
@ -2757,6 +2773,20 @@ static int kgsl_setup_phys_file(struct kgsl_mem_entry *entry,
|
||||
}
|
||||
#endif
|
||||
|
||||
static int check_vma_flags(struct vm_area_struct *vma,
|
||||
unsigned int flags)
|
||||
{
|
||||
unsigned long flags_requested = (VM_READ | VM_WRITE);
|
||||
|
||||
if (flags & KGSL_MEMFLAGS_GPUREADONLY)
|
||||
flags_requested &= ~VM_WRITE;
|
||||
|
||||
if ((vma->vm_flags & flags_requested) == flags_requested)
|
||||
return 0;
|
||||
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
static int check_vma(struct vm_area_struct *vma, struct file *vmfile,
|
||||
struct kgsl_memdesc *memdesc)
|
||||
{
|
||||
@ -2770,7 +2800,7 @@ static int check_vma(struct vm_area_struct *vma, struct file *vmfile,
|
||||
if (vma->vm_start != memdesc->useraddr ||
|
||||
(memdesc->useraddr + memdesc->size) != vma->vm_end)
|
||||
return -EINVAL;
|
||||
return 0;
|
||||
return check_vma_flags(vma, memdesc->flags);
|
||||
}
|
||||
|
||||
static int memdesc_sg_virt(struct kgsl_memdesc *memdesc, struct file *vmfile)
|
||||
@ -2779,7 +2809,7 @@ static int memdesc_sg_virt(struct kgsl_memdesc *memdesc, struct file *vmfile)
|
||||
long npages = 0, i;
|
||||
unsigned long sglen = memdesc->size / PAGE_SIZE;
|
||||
struct page **pages = NULL;
|
||||
int write = (memdesc->flags & KGSL_MEMFLAGS_GPUREADONLY) != 0;
|
||||
int write = ((memdesc->flags & KGSL_MEMFLAGS_GPUREADONLY) ? 0 : 1);
|
||||
|
||||
if (sglen == 0 || sglen >= LONG_MAX)
|
||||
return -EINVAL;
|
||||
@ -2881,6 +2911,12 @@ static int kgsl_setup_useraddr(struct kgsl_mem_entry *entry,
|
||||
if (vma && vma->vm_file) {
|
||||
int fd;
|
||||
|
||||
int ret = check_vma_flags(vma, entry->memdesc.flags);
|
||||
if (ret) {
|
||||
up_read(¤t->mm->mmap_sem);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check to see that this isn't our own memory that we have
|
||||
* already mapped
|
||||
@ -3226,6 +3262,7 @@ long kgsl_ioctl_map_user_mem(struct kgsl_device_private *dev_priv,
|
||||
|
||||
trace_kgsl_mem_map(entry, param->fd);
|
||||
|
||||
kgsl_mem_entry_commit_process(private, entry);
|
||||
return result;
|
||||
|
||||
error_attach:
|
||||
@ -3580,6 +3617,7 @@ long kgsl_ioctl_gpumem_alloc(struct kgsl_device_private *dev_priv,
|
||||
param->gpuaddr = entry->memdesc.gpuaddr;
|
||||
param->size = entry->memdesc.size;
|
||||
param->flags = entry->memdesc.flags;
|
||||
kgsl_mem_entry_commit_process(private, entry);
|
||||
return result;
|
||||
err:
|
||||
kgsl_sharedmem_free(&entry->memdesc);
|
||||
@ -3625,6 +3663,7 @@ long kgsl_ioctl_gpumem_alloc_id(struct kgsl_device_private *dev_priv,
|
||||
param->size = entry->memdesc.size;
|
||||
param->mmapsize = kgsl_memdesc_mmapsize(&entry->memdesc);
|
||||
param->gpuaddr = entry->memdesc.gpuaddr;
|
||||
kgsl_mem_entry_commit_process(private, entry);
|
||||
return result;
|
||||
err:
|
||||
if (entry)
|
||||
@ -4148,6 +4187,11 @@ static int kgsl_check_gpu_addr_collision(
|
||||
spin_lock(&private->mem_lock);
|
||||
kgsl_mem_entry_untrack_gpuaddr(private, entry);
|
||||
spin_unlock(&private->mem_lock);
|
||||
} else {
|
||||
/* Insert mem entry in mem_rb tree */
|
||||
spin_lock(&private->mem_lock);
|
||||
kgsl_mem_entry_commit_mem_list(private, entry);
|
||||
spin_unlock(&private->mem_lock);
|
||||
}
|
||||
} else {
|
||||
trace_kgsl_mem_unmapped_area_collision(entry, addr, len,
|
||||
|
@ -10,6 +10,11 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* NOTE: This file has been modified by Sony Mobile Communications Inc.
|
||||
* Modifications are Copyright (c) 2016 Sony Mobile Communications Inc,
|
||||
* and licensed under the license of the file.
|
||||
*/
|
||||
|
||||
#include <linux/export.h>
|
||||
#include <linux/vmalloc.h>
|
||||
@ -625,7 +630,8 @@ _kgsl_sharedmem_page_alloc(struct kgsl_memdesc *memdesc,
|
||||
size_t size)
|
||||
{
|
||||
int ret = 0;
|
||||
int len, page_size, sglen_alloc, sglen = 0;
|
||||
int page_size, sglen_alloc, sglen = 0;
|
||||
size_t len;
|
||||
unsigned int align;
|
||||
|
||||
align = (memdesc->flags & KGSL_MEMALIGN_MASK) >> KGSL_MEMALIGN_SHIFT;
|
||||
@ -753,7 +759,7 @@ kgsl_sharedmem_page_alloc_user(struct kgsl_memdesc *memdesc,
|
||||
size_t size)
|
||||
{
|
||||
size = PAGE_ALIGN(size);
|
||||
if (size == 0)
|
||||
if (size == 0 || size > UINT_MAX)
|
||||
return -EINVAL;
|
||||
|
||||
return _kgsl_sharedmem_page_alloc(memdesc, pagetable, size);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2012-2016, 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
|
||||
@ -10,6 +10,11 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* NOTE: This file has been modified by Sony Mobile Communications Inc.
|
||||
* Modifications are Copyright (c) 2016 Sony Mobile Communications Inc,
|
||||
* and licensed under the license of the file.
|
||||
*/
|
||||
|
||||
#include <linux/err.h>
|
||||
#include <linux/file.h>
|
||||
@ -473,23 +478,23 @@ long kgsl_ioctl_syncsource_create(struct kgsl_device_private *dev_priv,
|
||||
goto out;
|
||||
}
|
||||
|
||||
kref_init(&syncsource->refcount);
|
||||
syncsource->private = private;
|
||||
|
||||
idr_preload(GFP_KERNEL);
|
||||
spin_lock(&private->syncsource_lock);
|
||||
id = idr_alloc(&private->syncsource_idr, syncsource, 1, 0, GFP_NOWAIT);
|
||||
spin_unlock(&private->syncsource_lock);
|
||||
idr_preload_end();
|
||||
|
||||
if (id > 0) {
|
||||
kref_init(&syncsource->refcount);
|
||||
syncsource->id = id;
|
||||
syncsource->private = private;
|
||||
|
||||
param->id = id;
|
||||
ret = 0;
|
||||
} else {
|
||||
ret = id;
|
||||
}
|
||||
|
||||
spin_unlock(&private->syncsource_lock);
|
||||
idr_preload_end();
|
||||
|
||||
out:
|
||||
if (ret) {
|
||||
if (syncsource && syncsource->oneshot)
|
||||
@ -547,25 +552,23 @@ long kgsl_ioctl_syncsource_destroy(struct kgsl_device_private *dev_priv,
|
||||
{
|
||||
struct kgsl_syncsource_destroy *param = data;
|
||||
struct kgsl_syncsource *syncsource = NULL;
|
||||
struct kgsl_process_private *private;
|
||||
struct kgsl_process_private *private = dev_priv->process_priv;
|
||||
|
||||
syncsource = kgsl_syncsource_get(dev_priv->process_priv,
|
||||
param->id);
|
||||
spin_lock(&private->syncsource_lock);
|
||||
syncsource = idr_find(&private->syncsource_idr, param->id);
|
||||
|
||||
if (syncsource) {
|
||||
idr_remove(&private->syncsource_idr, param->id);
|
||||
syncsource->id = 0;
|
||||
}
|
||||
|
||||
spin_unlock(&private->syncsource_lock);
|
||||
|
||||
if (syncsource == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
private = syncsource->private;
|
||||
|
||||
spin_lock(&private->syncsource_lock);
|
||||
idr_remove(&private->syncsource_idr, param->id);
|
||||
syncsource->id = 0;
|
||||
spin_unlock(&private->syncsource_lock);
|
||||
|
||||
/* put reference from syncsource creation */
|
||||
kgsl_syncsource_put(syncsource);
|
||||
/* put reference from getting the syncsource above */
|
||||
kgsl_syncsource_put(syncsource);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -16,11 +16,9 @@
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2014 Sony Mobile Communications Inc.
|
||||
*
|
||||
* 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.
|
||||
* NOTE: This file has been modified by Sony Mobile Communications Inc.
|
||||
* Modifications are Copyright (c) 2014 Sony Mobile Communications Inc,
|
||||
* and licensed under the license of the file.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
|
@ -46,6 +46,7 @@ struct msm_isp_bufq *msm_isp_get_bufq(
|
||||
|
||||
/* bufq_handle cannot be 0 */
|
||||
if ((bufq_handle == 0) ||
|
||||
bufq_index >= BUF_MGR_NUM_BUF_Q ||
|
||||
(bufq_index > buf_mgr->num_buf_q))
|
||||
return NULL;
|
||||
|
||||
|
@ -32,7 +32,7 @@ int msm_isp_axi_create_stream(
|
||||
struct msm_vfe_axi_shared_data *axi_data,
|
||||
struct msm_vfe_axi_stream_request_cmd *stream_cfg_cmd)
|
||||
{
|
||||
int i = stream_cfg_cmd->stream_src;
|
||||
uint32_t i = stream_cfg_cmd->stream_src;
|
||||
if (i >= VFE_AXI_SRC_MAX) {
|
||||
pr_err("%s:%d invalid stream_src %d\n", __func__, __LINE__,
|
||||
stream_cfg_cmd->stream_src);
|
||||
@ -2273,6 +2273,7 @@ static int msm_isp_return_empty_buffer(struct vfe_device *vfe_dev,
|
||||
&vfe_dev->axi_data.src_info[frame_src].time_stamp, frame_id,
|
||||
stream_info->runtime_output_format);
|
||||
|
||||
memset(&error_event, 0, sizeof(error_event));
|
||||
error_event.frame_id = frame_id;
|
||||
error_event.timestamp =
|
||||
vfe_dev->axi_data.src_info[frame_src].time_stamp;
|
||||
|
@ -725,6 +725,7 @@ static long msm_isp_ioctl_unlocked(struct v4l2_subdev *sd,
|
||||
unsigned int cmd, void *arg)
|
||||
{
|
||||
long rc = 0;
|
||||
long rc2 = 0;
|
||||
struct vfe_device *vfe_dev = v4l2_get_subdevdata(sd);
|
||||
|
||||
if (!vfe_dev || !vfe_dev->vfe_base) {
|
||||
@ -791,13 +792,17 @@ static long msm_isp_ioctl_unlocked(struct v4l2_subdev *sd,
|
||||
case VIDIOC_MSM_ISP_AXI_RESET:
|
||||
mutex_lock(&vfe_dev->core_mutex);
|
||||
rc = msm_isp_stats_reset(vfe_dev);
|
||||
rc |= msm_isp_axi_reset(vfe_dev, arg);
|
||||
rc2 = msm_isp_axi_reset(vfe_dev, arg);
|
||||
if (!rc && rc2)
|
||||
rc = rc2;
|
||||
mutex_unlock(&vfe_dev->core_mutex);
|
||||
break;
|
||||
case VIDIOC_MSM_ISP_AXI_RESTART:
|
||||
mutex_lock(&vfe_dev->core_mutex);
|
||||
rc = msm_isp_stats_restart(vfe_dev);
|
||||
rc |= msm_isp_axi_restart(vfe_dev, arg);
|
||||
rc2 = msm_isp_axi_restart(vfe_dev, arg);
|
||||
if (!rc && rc2)
|
||||
rc = rc2;
|
||||
mutex_unlock(&vfe_dev->core_mutex);
|
||||
break;
|
||||
case VIDIOC_MSM_ISP_INPUT_CFG:
|
||||
@ -1568,8 +1573,6 @@ void msm_isp_update_error_frame_count(struct vfe_device *vfe_dev)
|
||||
{
|
||||
struct msm_vfe_error_info *error_info = &vfe_dev->error_info;
|
||||
error_info->info_dump_frame_count++;
|
||||
if (error_info->info_dump_frame_count == 0)
|
||||
error_info->info_dump_frame_count++;
|
||||
}
|
||||
|
||||
|
||||
@ -1680,6 +1683,7 @@ static void msm_isp_process_overflow_irq(
|
||||
*irq_status0 = 0;
|
||||
*irq_status1 = 0;
|
||||
|
||||
memset(&error_event, 0, sizeof(error_event));
|
||||
error_event.frame_id =
|
||||
vfe_dev->axi_data.src_info[VFE_PIX_0].frame_id;
|
||||
error_event.u.error_info.err_type = ISP_ERROR_BUS_OVERFLOW;
|
||||
@ -1695,8 +1699,7 @@ void msm_isp_reset_burst_count_and_frame_drop(
|
||||
stream_info->stream_type != BURST_STREAM) {
|
||||
return;
|
||||
}
|
||||
if (stream_info->stream_type == BURST_STREAM &&
|
||||
stream_info->num_burst_capture != 0) {
|
||||
if (stream_info->num_burst_capture != 0) {
|
||||
framedrop_period = msm_isp_get_framedrop_period(
|
||||
stream_info->frame_skip_pattern);
|
||||
stream_info->burst_frame_count =
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2013-2016, 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
|
||||
@ -362,23 +362,23 @@ static void msm_ispif_sel_csid_core(struct ispif_device *ispif,
|
||||
switch (intftype) {
|
||||
case PIX0:
|
||||
data &= ~(BIT(1) | BIT(0));
|
||||
data |= csid;
|
||||
data |= (uint32_t) csid;
|
||||
break;
|
||||
case RDI0:
|
||||
data &= ~(BIT(5) | BIT(4));
|
||||
data |= (csid << 4);
|
||||
data |= ((uint32_t) csid) << 4;
|
||||
break;
|
||||
case PIX1:
|
||||
data &= ~(BIT(9) | BIT(8));
|
||||
data |= (csid << 8);
|
||||
data |= ((uint32_t) csid) << 8;
|
||||
break;
|
||||
case RDI1:
|
||||
data &= ~(BIT(13) | BIT(12));
|
||||
data |= (csid << 12);
|
||||
data |= ((uint32_t) csid) << 12;
|
||||
break;
|
||||
case RDI2:
|
||||
data &= ~(BIT(21) | BIT(20));
|
||||
data |= (csid << 20);
|
||||
data |= ((uint32_t) csid) << 20;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -454,9 +454,9 @@ static void msm_ispif_enable_intf_cids(struct ispif_device *ispif,
|
||||
|
||||
data = msm_camera_io_r(ispif->base + intf_addr);
|
||||
if (enable)
|
||||
data |= cid_mask;
|
||||
data |= (uint32_t) cid_mask;
|
||||
else
|
||||
data &= ~cid_mask;
|
||||
data &= ~((uint32_t) cid_mask);
|
||||
msm_camera_io_w_mb(data, ispif->base + intf_addr);
|
||||
}
|
||||
|
||||
@ -1133,9 +1133,15 @@ static irqreturn_t msm_io_ispif_irq(int irq_num, void *data)
|
||||
static int msm_ispif_set_vfe_info(struct ispif_device *ispif,
|
||||
struct msm_ispif_vfe_info *vfe_info)
|
||||
{
|
||||
memcpy(&ispif->vfe_info, vfe_info, sizeof(struct msm_ispif_vfe_info));
|
||||
if (ispif->vfe_info.num_vfe > ispif->hw_num_isps)
|
||||
if (!vfe_info || (vfe_info->num_vfe <= 0) ||
|
||||
((uint32_t)(vfe_info->num_vfe) > ispif->hw_num_isps)) {
|
||||
pr_err("Invalid VFE info: %p %d\n", vfe_info,
|
||||
(vfe_info ? vfe_info->num_vfe : 0));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
memcpy(&ispif->vfe_info, vfe_info, sizeof(struct msm_ispif_vfe_info));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -797,7 +797,7 @@ static int32_t msm_actuator_bivcm_init_step_table(
|
||||
int16_t code_per_step = 0;
|
||||
int16_t cur_code = 0;
|
||||
int16_t cur_code_se = 0;
|
||||
int16_t step_index = 0, region_index = 0;
|
||||
uint16_t step_index = 0, region_index = 0;
|
||||
uint16_t step_boundary = 0;
|
||||
uint32_t max_code_size = 1;
|
||||
uint16_t data_size = set_info->actuator_params.data_size;
|
||||
@ -841,6 +841,15 @@ static int32_t msm_actuator_bivcm_init_step_table(
|
||||
step_boundary =
|
||||
a_ctrl->region_params[region_index].
|
||||
step_bound[MOVE_NEAR];
|
||||
if (step_boundary >
|
||||
set_info->af_tuning_params.total_steps) {
|
||||
pr_err("invalid step_boundary = %d, max_val = %d",
|
||||
step_boundary,
|
||||
set_info->af_tuning_params.total_steps);
|
||||
kfree(a_ctrl->step_position_table);
|
||||
a_ctrl->step_position_table = NULL;
|
||||
return -EINVAL;
|
||||
}
|
||||
qvalue = a_ctrl->region_params[region_index].qvalue;
|
||||
for (; step_index <= step_boundary;
|
||||
step_index++) {
|
||||
@ -878,20 +887,25 @@ static int32_t msm_actuator_init_step_table(struct msm_actuator_ctrl_t *a_ctrl,
|
||||
int16_t code_per_step = 0;
|
||||
uint32_t qvalue = 0;
|
||||
int16_t cur_code = 0;
|
||||
int16_t step_index = 0, region_index = 0;
|
||||
uint16_t step_index = 0, region_index = 0;
|
||||
uint16_t step_boundary = 0;
|
||||
uint32_t max_code_size = 1;
|
||||
uint16_t data_size = set_info->actuator_params.data_size;
|
||||
CDBG("Enter\n");
|
||||
|
||||
/* validate the actuator state */
|
||||
if (a_ctrl->actuator_state != ACT_OPS_ACTIVE) {
|
||||
pr_err("%s:%d invalid actuator_state %d\n"
|
||||
, __func__, __LINE__, a_ctrl->actuator_state);
|
||||
return -EINVAL;
|
||||
}
|
||||
for (; data_size > 0; data_size--)
|
||||
max_code_size *= 2;
|
||||
|
||||
a_ctrl->max_code_size = max_code_size;
|
||||
if ((a_ctrl->actuator_state == ACT_OPS_ACTIVE) &&
|
||||
(a_ctrl->step_position_table != NULL)) {
|
||||
kfree(a_ctrl->step_position_table);
|
||||
}
|
||||
|
||||
/* free the step_position_table to allocate a new one */
|
||||
kfree(a_ctrl->step_position_table);
|
||||
a_ctrl->step_position_table = NULL;
|
||||
|
||||
if (set_info->af_tuning_params.total_steps
|
||||
@ -920,6 +934,15 @@ static int32_t msm_actuator_init_step_table(struct msm_actuator_ctrl_t *a_ctrl,
|
||||
step_boundary =
|
||||
a_ctrl->region_params[region_index].
|
||||
step_bound[MOVE_NEAR];
|
||||
if (step_boundary >
|
||||
set_info->af_tuning_params.total_steps) {
|
||||
pr_err("invalid step_boundary = %d, max_val = %d",
|
||||
step_boundary,
|
||||
set_info->af_tuning_params.total_steps);
|
||||
kfree(a_ctrl->step_position_table);
|
||||
a_ctrl->step_position_table = NULL;
|
||||
return -EINVAL;
|
||||
}
|
||||
for (; step_index <= step_boundary;
|
||||
step_index++) {
|
||||
if (qvalue > 1 && qvalue <= MAX_QVALUE)
|
||||
|
@ -10,6 +10,11 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* NOTE: This file has been modified by Sony Mobile Communications Inc.
|
||||
* Modifications are Copyright (c) 2015 Sony Mobile Communications Inc,
|
||||
* and licensed under the license of the file.
|
||||
*/
|
||||
|
||||
#ifndef _MSM_VIDC_DCVS_H_
|
||||
#define _MSM_VIDC_DCVS_H_
|
||||
|
@ -164,7 +164,7 @@ static int audio_effects_shared_ioctl(struct file *file, unsigned cmd,
|
||||
|
||||
pr_debug("%s: dec buf size: %d, num_buf: %d, enc buf size: %d, num_buf: %d\n",
|
||||
__func__, effects->config.output.buf_size,
|
||||
effects->config.output.buf_size,
|
||||
effects->config.output.num_buf,
|
||||
effects->config.input.buf_size,
|
||||
effects->config.input.num_buf);
|
||||
rc = q6asm_audio_client_buf_alloc_contiguous(IN, effects->ac,
|
||||
@ -252,7 +252,8 @@ static int audio_effects_shared_ioctl(struct file *file, unsigned cmd,
|
||||
|
||||
bufptr = q6asm_is_cpu_buf_avail(IN, effects->ac, &size, &idx);
|
||||
if (bufptr) {
|
||||
if (copy_from_user(bufptr, (void *)arg,
|
||||
if ((effects->config.buf_cfg.output_len > size) ||
|
||||
copy_from_user(bufptr, (void *)arg,
|
||||
effects->config.buf_cfg.output_len)) {
|
||||
rc = -EFAULT;
|
||||
goto ioctl_fail;
|
||||
@ -308,7 +309,8 @@ static int audio_effects_shared_ioctl(struct file *file, unsigned cmd,
|
||||
rc = -EFAULT;
|
||||
goto ioctl_fail;
|
||||
}
|
||||
if (copy_to_user((void *)arg, bufptr,
|
||||
if ((effects->config.buf_cfg.input_len > size) ||
|
||||
copy_to_user((void *)arg, bufptr,
|
||||
effects->config.buf_cfg.input_len)) {
|
||||
rc = -EFAULT;
|
||||
goto ioctl_fail;
|
||||
|
@ -204,16 +204,6 @@ config MSM_BUS_SCALING
|
||||
for the active devices needs without keeping the clocks at max
|
||||
frequency when a slower speed is sufficient.
|
||||
|
||||
config MSM_BUSPM_DEV
|
||||
tristate "MSM Bus Performance Monitor Kernel Module"
|
||||
depends on MSM_BUS_SCALING
|
||||
default n
|
||||
help
|
||||
This kernel module is used to mmap() hardware registers for the
|
||||
performance monitors, counters, etc. The module can also be used to
|
||||
allocate physical memory which is used by bus performance hardware to
|
||||
dump performance data
|
||||
|
||||
config BUS_TOPOLOGY_ADHOC
|
||||
bool "ad-hoc bus scaling topology"
|
||||
default n
|
||||
|
@ -22,4 +22,3 @@ else
|
||||
endif
|
||||
|
||||
obj-$(CONFIG_DEBUG_FS) += msm_bus_dbg.o
|
||||
obj-$(CONFIG_MSM_BUSPM_DEV) += msm-buspm-dev.o
|
||||
|
@ -1,366 +0,0 @@
|
||||
/* Copyright (c) 2011-2014, 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
|
||||
* only version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
/* #define DEBUG */
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/miscdevice.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <soc/qcom/rpm-smd.h>
|
||||
#include <uapi/linux/msm-buspm-dev.h>
|
||||
|
||||
#define MSM_BUSPM_DRV_NAME "msm-buspm-dev"
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
static long
|
||||
msm_buspm_dev_compat_ioctl(struct file *filp, unsigned int cmd,
|
||||
unsigned long arg);
|
||||
#else
|
||||
#define msm_buspm_dev_compat_ioctl NULL
|
||||
#endif
|
||||
|
||||
static long
|
||||
msm_buspm_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
|
||||
static int msm_buspm_dev_mmap(struct file *filp, struct vm_area_struct *vma);
|
||||
static int msm_buspm_dev_release(struct inode *inode, struct file *filp);
|
||||
static int msm_buspm_dev_open(struct inode *inode, struct file *filp);
|
||||
|
||||
static const struct file_operations msm_buspm_dev_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.mmap = msm_buspm_dev_mmap,
|
||||
.open = msm_buspm_dev_open,
|
||||
.unlocked_ioctl = msm_buspm_dev_ioctl,
|
||||
.compat_ioctl = msm_buspm_dev_compat_ioctl,
|
||||
.llseek = noop_llseek,
|
||||
.release = msm_buspm_dev_release,
|
||||
};
|
||||
|
||||
struct miscdevice msm_buspm_misc = {
|
||||
.minor = MISC_DYNAMIC_MINOR,
|
||||
.name = MSM_BUSPM_DRV_NAME,
|
||||
.fops = &msm_buspm_dev_fops,
|
||||
};
|
||||
|
||||
|
||||
enum msm_buspm_spdm_res {
|
||||
SPDM_RES_ID = 0,
|
||||
SPDM_RES_TYPE = 0x63707362,
|
||||
SPDM_KEY = 0x00006e65,
|
||||
SPDM_SIZE = 4,
|
||||
};
|
||||
/*
|
||||
* Allocate kernel buffer.
|
||||
* Currently limited to one buffer per file descriptor. If alloc() is
|
||||
* called twice for the same descriptor, the original buffer is freed.
|
||||
* There is also no locking protection so the same descriptor can not be shared.
|
||||
*/
|
||||
|
||||
static inline void *msm_buspm_dev_get_vaddr(struct file *filp)
|
||||
{
|
||||
struct msm_buspm_map_dev *dev = filp->private_data;
|
||||
|
||||
return (dev) ? dev->vaddr : NULL;
|
||||
}
|
||||
|
||||
static inline unsigned int msm_buspm_dev_get_buflen(struct file *filp)
|
||||
{
|
||||
struct msm_buspm_map_dev *dev = filp->private_data;
|
||||
|
||||
return dev ? dev->buflen : 0;
|
||||
}
|
||||
|
||||
static inline unsigned long msm_buspm_dev_get_paddr(struct file *filp)
|
||||
{
|
||||
struct msm_buspm_map_dev *dev = filp->private_data;
|
||||
|
||||
return (dev) ? dev->paddr : 0L;
|
||||
}
|
||||
|
||||
static void msm_buspm_dev_free(struct file *filp)
|
||||
{
|
||||
struct msm_buspm_map_dev *dev = filp->private_data;
|
||||
|
||||
if (dev && dev->vaddr) {
|
||||
pr_debug("freeing memory at 0x%p\n", dev->vaddr);
|
||||
dma_free_coherent(msm_buspm_misc.this_device, dev->buflen,
|
||||
dev->vaddr, dev->paddr);
|
||||
dev->paddr = 0L;
|
||||
dev->vaddr = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static int msm_buspm_dev_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
struct msm_buspm_map_dev *dev;
|
||||
|
||||
if (capable(CAP_SYS_ADMIN)) {
|
||||
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
|
||||
if (dev)
|
||||
filp->private_data = dev;
|
||||
else
|
||||
return -ENOMEM;
|
||||
} else {
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
msm_buspm_dev_alloc(struct file *filp, struct buspm_alloc_params data)
|
||||
{
|
||||
dma_addr_t paddr;
|
||||
void *vaddr;
|
||||
struct msm_buspm_map_dev *dev = filp->private_data;
|
||||
|
||||
/* If buffer already allocated, then free it */
|
||||
if (dev->vaddr)
|
||||
msm_buspm_dev_free(filp);
|
||||
|
||||
/* Allocate uncached memory */
|
||||
vaddr = dma_alloc_coherent(msm_buspm_misc.this_device, data.size,
|
||||
&paddr, GFP_KERNEL);
|
||||
|
||||
if (vaddr == NULL) {
|
||||
pr_err("allocation of 0x%zu bytes failed", data.size);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
dev->vaddr = vaddr;
|
||||
dev->paddr = paddr;
|
||||
dev->buflen = data.size;
|
||||
filp->f_pos = 0;
|
||||
pr_debug("virt addr = 0x%p\n", dev->vaddr);
|
||||
pr_debug("phys addr = 0x%lx\n", dev->paddr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int msm_bus_rpm_req(u32 rsc_type, u32 key, u32 hwid,
|
||||
int ctx, u32 val)
|
||||
{
|
||||
struct msm_rpm_request *rpm_req;
|
||||
int ret, msg_id;
|
||||
|
||||
rpm_req = msm_rpm_create_request(ctx, rsc_type, SPDM_RES_ID, 1);
|
||||
if (rpm_req == NULL) {
|
||||
pr_err("RPM: Couldn't create RPM Request\n");
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
ret = msm_rpm_add_kvp_data(rpm_req, key, (const uint8_t *)&val,
|
||||
(int)(sizeof(uint32_t)));
|
||||
if (ret) {
|
||||
pr_err("RPM: Add KVP failed for RPM Req:%u\n",
|
||||
rsc_type);
|
||||
goto err;
|
||||
}
|
||||
|
||||
pr_debug("Added Key: %d, Val: %u, size: %zu\n", key,
|
||||
(uint32_t)val, sizeof(uint32_t));
|
||||
msg_id = msm_rpm_send_request(rpm_req);
|
||||
if (!msg_id) {
|
||||
pr_err("RPM: No message ID for req\n");
|
||||
ret = -ENXIO;
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret = msm_rpm_wait_for_ack(msg_id);
|
||||
if (ret) {
|
||||
pr_err("RPM: Ack failed\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
err:
|
||||
msm_rpm_free_request(rpm_req);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int msm_buspm_ioc_cmds(uint32_t arg)
|
||||
{
|
||||
switch (arg) {
|
||||
case MSM_BUSPM_SPDM_CLK_DIS:
|
||||
case MSM_BUSPM_SPDM_CLK_EN:
|
||||
return msm_bus_rpm_req(SPDM_RES_TYPE, SPDM_KEY, 0,
|
||||
MSM_RPM_CTX_ACTIVE_SET, arg);
|
||||
default:
|
||||
pr_warn("Unsupported ioctl command: %d\n", arg);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static long
|
||||
msm_buspm_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
struct buspm_xfer_req xfer;
|
||||
struct buspm_alloc_params alloc_data;
|
||||
unsigned long paddr;
|
||||
int retval = 0;
|
||||
void *buf = msm_buspm_dev_get_vaddr(filp);
|
||||
unsigned int buflen = msm_buspm_dev_get_buflen(filp);
|
||||
unsigned char *dbgbuf = buf;
|
||||
|
||||
if (_IOC_TYPE(cmd) != MSM_BUSPM_IOC_MAGIC) {
|
||||
pr_err("Wrong IOC_MAGIC.Exiting\n");
|
||||
return -ENOTTY;
|
||||
}
|
||||
|
||||
switch (cmd) {
|
||||
case MSM_BUSPM_IOC_FREE:
|
||||
pr_debug("cmd = 0x%x (FREE)\n", cmd);
|
||||
msm_buspm_dev_free(filp);
|
||||
break;
|
||||
|
||||
case MSM_BUSPM_IOC_ALLOC:
|
||||
pr_debug("cmd = 0x%x (ALLOC)\n", cmd);
|
||||
retval = __get_user(alloc_data.size, (uint32_t __user *)arg);
|
||||
|
||||
if (retval == 0)
|
||||
retval = msm_buspm_dev_alloc(filp, alloc_data);
|
||||
break;
|
||||
|
||||
case MSM_BUSPM_IOC_RD_PHYS_ADDR:
|
||||
pr_debug("Read Physical Address\n");
|
||||
paddr = msm_buspm_dev_get_paddr(filp);
|
||||
if (paddr == 0L) {
|
||||
retval = -EINVAL;
|
||||
} else {
|
||||
pr_debug("phys addr = 0x%lx\n", paddr);
|
||||
retval = __put_user(paddr,
|
||||
(unsigned long __user *)arg);
|
||||
}
|
||||
break;
|
||||
|
||||
case MSM_BUSPM_IOC_RDBUF:
|
||||
if (!buf) {
|
||||
retval = -EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
pr_debug("Read Buffer: 0x%x%x%x%x\n",
|
||||
dbgbuf[0], dbgbuf[1], dbgbuf[2], dbgbuf[3]);
|
||||
|
||||
if (copy_from_user(&xfer, (void __user *)arg, sizeof(xfer))) {
|
||||
retval = -EFAULT;
|
||||
break;
|
||||
}
|
||||
|
||||
if ((xfer.size <= buflen) &&
|
||||
(copy_to_user((void __user *)xfer.data, buf,
|
||||
xfer.size))) {
|
||||
retval = -EFAULT;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case MSM_BUSPM_IOC_WRBUF:
|
||||
pr_debug("Write Buffer\n");
|
||||
|
||||
if (!buf) {
|
||||
retval = -EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
if (copy_from_user(&xfer, (void __user *)arg, sizeof(xfer))) {
|
||||
retval = -EFAULT;
|
||||
break;
|
||||
}
|
||||
|
||||
if ((buflen <= xfer.size) &&
|
||||
(copy_from_user(buf, (void __user *)xfer.data,
|
||||
xfer.size))) {
|
||||
retval = -EFAULT;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case MSM_BUSPM_IOC_CMD:
|
||||
pr_debug("IOCTL command: cmd: %d arg: %lu\n", cmd, arg);
|
||||
retval = msm_buspm_ioc_cmds(arg);
|
||||
break;
|
||||
|
||||
default:
|
||||
pr_debug("Unknown command 0x%x\n", cmd);
|
||||
retval = -EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static int msm_buspm_dev_release(struct inode *inode, struct file *filp)
|
||||
{
|
||||
struct msm_buspm_map_dev *dev = filp->private_data;
|
||||
|
||||
msm_buspm_dev_free(filp);
|
||||
kfree(dev);
|
||||
filp->private_data = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int msm_buspm_dev_mmap(struct file *filp, struct vm_area_struct *vma)
|
||||
{
|
||||
pr_debug("vma = 0x%p\n", vma);
|
||||
|
||||
/* Mappings are uncached */
|
||||
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
|
||||
if (remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
|
||||
vma->vm_end - vma->vm_start, vma->vm_page_prot))
|
||||
return -EFAULT;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
static long
|
||||
msm_buspm_dev_compat_ioctl(struct file *filp, unsigned int cmd,
|
||||
unsigned long arg)
|
||||
{
|
||||
return msm_buspm_dev_ioctl(filp, cmd, (unsigned long)compat_ptr(arg));
|
||||
}
|
||||
#endif
|
||||
|
||||
static int __init msm_buspm_dev_init(void)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
ret = misc_register(&msm_buspm_misc);
|
||||
if (ret < 0)
|
||||
pr_err("%s: Cannot register misc device\n", __func__);
|
||||
|
||||
if (msm_buspm_misc.this_device->coherent_dma_mask == 0)
|
||||
msm_buspm_misc.this_device->coherent_dma_mask =
|
||||
DMA_BIT_MASK(32);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void __exit msm_buspm_dev_exit(void)
|
||||
{
|
||||
misc_deregister(&msm_buspm_misc);
|
||||
}
|
||||
module_init(msm_buspm_dev_init);
|
||||
module_exit(msm_buspm_dev_exit);
|
||||
|
||||
MODULE_LICENSE("GPL v2");
|
||||
MODULE_VERSION("1.0");
|
||||
MODULE_ALIAS("platform:"MSM_BUSPM_DRV_NAME);
|
@ -135,6 +135,7 @@ int msmbus_coresight_init_adhoc(struct platform_device *pdev,
|
||||
return PTR_ERR(pdata);
|
||||
|
||||
drvdata = platform_get_drvdata(pdev);
|
||||
dev_info(dev, "info: removed buspm module from kernel space\n");
|
||||
if (IS_ERR_OR_NULL(drvdata)) {
|
||||
drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
|
||||
if (!drvdata) {
|
||||
|
@ -243,6 +243,7 @@ static struct device_attribute power_supply_attrs[] = {
|
||||
POWER_SUPPLY_ATTR(stop_usb_host_function),
|
||||
POWER_SUPPLY_ATTR(vfloat_mv),
|
||||
POWER_SUPPLY_ATTR(fv_cmp_cfg),
|
||||
POWER_SUPPLY_ATTR(batt_aging),
|
||||
/* Local extensions of type int64_t */
|
||||
POWER_SUPPLY_ATTR(charge_counter_ext),
|
||||
/* Properties of type `const char *' */
|
||||
|
@ -2339,6 +2339,9 @@ static enum power_supply_property fg_power_props[] = {
|
||||
POWER_SUPPLY_PROP_VOLTAGE_MIN,
|
||||
POWER_SUPPLY_PROP_CYCLE_COUNT,
|
||||
POWER_SUPPLY_PROP_CYCLE_COUNT_ID,
|
||||
#ifdef CONFIG_QPNP_FG_EXTENSION
|
||||
POWER_SUPPLY_PROP_BATT_AGING,
|
||||
#endif
|
||||
};
|
||||
|
||||
static int fg_power_get_property(struct power_supply *psy,
|
||||
@ -2431,6 +2434,11 @@ static int fg_power_get_property(struct power_supply *psy,
|
||||
case POWER_SUPPLY_PROP_CHARGE_NOW_RAW:
|
||||
val->intval = get_sram_prop_now(chip, FG_DATA_CC_CHARGE);
|
||||
break;
|
||||
#ifdef CONFIG_QPNP_FG_EXTENSION
|
||||
case POWER_SUPPLY_PROP_BATT_AGING:
|
||||
val->intval = chip->somc_params.batt_aging;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
@ -3133,6 +3141,28 @@ static int fg_power_set_property(struct power_supply *psy,
|
||||
rc = set_prop_jeita_temp(chip,
|
||||
FG_MEM_HARD_HOT, val->intval);
|
||||
break;
|
||||
#endif
|
||||
#ifdef CONFIG_QPNP_FG_EXTENSION
|
||||
case POWER_SUPPLY_PROP_CHARGE_FULL:
|
||||
if (0 < val->intval && val->intval <= chip->nom_cap_uah) {
|
||||
chip->learning_data.learned_cc_uah = val->intval;
|
||||
fg_cap_learning_save_data(chip);
|
||||
somc_fg_set_aging_mode(&chip->somc_params, chip->dev,
|
||||
chip->learning_data.learned_cc_uah,
|
||||
chip->nom_cap_uah,
|
||||
settings[FG_MEM_RESUME_SOC].value);
|
||||
schedule_work(&chip->status_change_work);
|
||||
}
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_BATT_AGING:
|
||||
if (val->intval) {
|
||||
chip->somc_params.batt_aging = true;
|
||||
somc_fg_set_aging_mode(&chip->somc_params, chip->dev,
|
||||
chip->learning_data.learned_cc_uah,
|
||||
chip->nom_cap_uah,
|
||||
settings[FG_MEM_RESUME_SOC].value);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return -EINVAL;
|
||||
@ -3151,6 +3181,10 @@ static int fg_property_is_writeable(struct power_supply *psy,
|
||||
#ifdef CONFIG_QPNP_FG_EXTENSION
|
||||
case POWER_SUPPLY_PROP_COLD_TEMP:
|
||||
case POWER_SUPPLY_PROP_HOT_TEMP:
|
||||
#endif
|
||||
#ifdef CONFIG_QPNP_FG_EXTENSION
|
||||
case POWER_SUPPLY_PROP_CHARGE_FULL:
|
||||
case POWER_SUPPLY_PROP_BATT_AGING:
|
||||
#endif
|
||||
return 1;
|
||||
default:
|
||||
|
@ -179,7 +179,8 @@ void somc_fg_set_aging_mode(struct fg_somc_params *params, struct device *dev,
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (somc_fg_aging_mode_check(params, learned_cc_uah, nom_cap_uah)) {
|
||||
if (params->batt_aging ||
|
||||
somc_fg_aging_mode_check(params, learned_cc_uah, nom_cap_uah)) {
|
||||
if (params->aging_mode)
|
||||
return;
|
||||
pr_info("start aging mode\n");
|
||||
|
@ -62,6 +62,7 @@ struct fg_somc_params {
|
||||
u32 vfloat_arrangement_threshold;
|
||||
int soc_magnification;
|
||||
bool aging_mode;
|
||||
bool batt_aging;
|
||||
bool integrity_bit;
|
||||
u8 soc_restart;
|
||||
int capacity;
|
||||
|
@ -155,6 +155,9 @@ struct smbchg_chip {
|
||||
/* vfloat adjustment */
|
||||
int max_vbat_sample;
|
||||
int n_vbat_samples;
|
||||
#ifdef CONFIG_QPNP_SMBCHARGER_EXTENSION
|
||||
int total_trim_steps;
|
||||
#endif
|
||||
|
||||
/* status variables */
|
||||
int battchg_disabled;
|
||||
@ -3690,6 +3693,11 @@ static int vf_adjust_trim_steps_per_adjust = 1;
|
||||
#endif
|
||||
module_param(vf_adjust_trim_steps_per_adjust, int, 0644);
|
||||
|
||||
#ifdef CONFIG_QPNP_SMBCHARGER_EXTENSION
|
||||
static int vf_adjust_trim_limit = 3;
|
||||
module_param(vf_adjust_trim_limit, int, 0644);
|
||||
#endif
|
||||
|
||||
#define CENTER_TRIM_CODE 7
|
||||
#define MAX_LIN_CODE 14
|
||||
#define MAX_TRIM_CODE 15
|
||||
@ -3776,6 +3784,9 @@ static int smbchg_adjust_vfloat_mv_trim(struct smbchg_chip *chip,
|
||||
int sign, delta_steps, rc = 0;
|
||||
u8 prev_trim, new_trim;
|
||||
int i;
|
||||
#ifdef CONFIG_QPNP_SMBCHARGER_EXTENSION
|
||||
int trim_step_inc_dec;
|
||||
#endif
|
||||
|
||||
sign = delta_mv > 0 ? 1 : -1;
|
||||
delta_steps = (delta_mv + sign * VF_STEP_SIZE_MV / 2)
|
||||
@ -3798,6 +3809,18 @@ static int smbchg_adjust_vfloat_mv_trim(struct smbchg_chip *chip,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_QPNP_SMBCHARGER_EXTENSION
|
||||
trim_step_inc_dec = delta_steps > 0 ? 1 : -1;
|
||||
if (abs(chip->total_trim_steps + trim_step_inc_dec)
|
||||
> vf_adjust_trim_limit) {
|
||||
pr_info("VFloat trim is max, cannot %s VFloat\n",
|
||||
trim_step_inc_dec > 0 ?
|
||||
"increase" : "decrease");
|
||||
return -EINVAL;
|
||||
}
|
||||
chip->total_trim_steps += trim_step_inc_dec;
|
||||
#endif
|
||||
|
||||
rc = smbchg_sec_masked_write(chip, chip->misc_base + TRIM_14,
|
||||
VF_TRIM_MASK, new_trim);
|
||||
if (rc < 0) {
|
||||
|
@ -771,11 +771,28 @@ static long compat_ashmem_ioctl(struct file *file, unsigned int cmd, unsigned lo
|
||||
}
|
||||
#endif
|
||||
|
||||
static const struct file_operations ashmem_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = ashmem_open,
|
||||
.release = ashmem_release,
|
||||
.read = ashmem_read,
|
||||
.llseek = ashmem_llseek,
|
||||
.mmap = ashmem_mmap,
|
||||
.unlocked_ioctl = ashmem_ioctl,
|
||||
#ifdef CONFIG_COMPAT
|
||||
.compat_ioctl = compat_ashmem_ioctl,
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct miscdevice ashmem_misc = {
|
||||
.minor = MISC_DYNAMIC_MINOR,
|
||||
.name = "ashmem",
|
||||
.fops = &ashmem_fops,
|
||||
};
|
||||
|
||||
static int is_ashmem_file(struct file *file)
|
||||
{
|
||||
char fname[256], *name;
|
||||
name = dentry_path(file->f_dentry, fname, 256);
|
||||
return strcmp(name, "/ashmem") ? 0 : 1;
|
||||
return (file->f_op == &ashmem_fops);
|
||||
}
|
||||
|
||||
int get_ashmem_file(int fd, struct file **filp, struct file **vm_file,
|
||||
@ -824,25 +841,6 @@ void put_ashmem_file(struct file *file)
|
||||
}
|
||||
EXPORT_SYMBOL(put_ashmem_file);
|
||||
|
||||
static const struct file_operations ashmem_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = ashmem_open,
|
||||
.release = ashmem_release,
|
||||
.read = ashmem_read,
|
||||
.llseek = ashmem_llseek,
|
||||
.mmap = ashmem_mmap,
|
||||
.unlocked_ioctl = ashmem_ioctl,
|
||||
#ifdef CONFIG_COMPAT
|
||||
.compat_ioctl = compat_ashmem_ioctl,
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct miscdevice ashmem_misc = {
|
||||
.minor = MISC_DYNAMIC_MINOR,
|
||||
.name = "ashmem",
|
||||
.fops = &ashmem_fops,
|
||||
};
|
||||
|
||||
static int __init ashmem_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
@ -2574,6 +2574,28 @@ static int tiocsetd(struct tty_struct *tty, int __user *p)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* tiocgetd - get line discipline
|
||||
* @tty: tty device
|
||||
* @p: pointer to user data
|
||||
*
|
||||
* Retrieves the line discipline id directly from the ldisc.
|
||||
*
|
||||
* Locking: waits for ldisc reference (in case the line discipline
|
||||
* is changing or the tty is being hungup)
|
||||
*/
|
||||
|
||||
static int tiocgetd(struct tty_struct *tty, int __user *p)
|
||||
{
|
||||
struct tty_ldisc *ld;
|
||||
int ret;
|
||||
|
||||
ld = tty_ldisc_ref_wait(tty);
|
||||
ret = put_user(ld->ops->num, p);
|
||||
tty_ldisc_deref(ld);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* send_break - performed time break
|
||||
* @tty: device to break on
|
||||
@ -2791,7 +2813,7 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||
case TIOCGSID:
|
||||
return tiocgsid(tty, real_tty, p);
|
||||
case TIOCGETD:
|
||||
return put_user(tty->ldisc->ops->num, (int __user *)p);
|
||||
return tiocgetd(tty, p);
|
||||
case TIOCSETD:
|
||||
return tiocsetd(tty, p);
|
||||
case TIOCVHANGUP:
|
||||
|
@ -650,7 +650,7 @@ static ssize_t dwc3_store_ep_num(struct file *file, const char __user *ubuf,
|
||||
struct seq_file *s = file->private_data;
|
||||
struct dwc3 *dwc = s->private;
|
||||
char kbuf[10];
|
||||
unsigned int num, dir;
|
||||
unsigned int num, dir, temp;
|
||||
unsigned long flags;
|
||||
|
||||
memset(kbuf, 0, 10);
|
||||
@ -661,8 +661,16 @@ static ssize_t dwc3_store_ep_num(struct file *file, const char __user *ubuf,
|
||||
if (sscanf(kbuf, "%u %u", &num, &dir) != 2)
|
||||
return -EINVAL;
|
||||
|
||||
if (dir != 0 && dir != 1)
|
||||
return -EINVAL;
|
||||
|
||||
temp = (num << 1) + dir;
|
||||
if (temp >= (dwc->num_in_eps + dwc->num_out_eps) ||
|
||||
temp >= DWC3_ENDPOINTS_NUM)
|
||||
return -EINVAL;
|
||||
|
||||
spin_lock_irqsave(&dwc->lock, flags);
|
||||
ep_num = (num << 1) + dir;
|
||||
ep_num = temp;
|
||||
spin_unlock_irqrestore(&dwc->lock, flags);
|
||||
|
||||
return count;
|
||||
|
@ -109,10 +109,10 @@ static ssize_t panel_debug_base_offset_read(struct file *file,
|
||||
return 0; /* the end */
|
||||
|
||||
len = snprintf(buf, sizeof(buf), "0x%02zx %zx\n", dbg->off, dbg->cnt);
|
||||
if (len < 0)
|
||||
if (len < 0 || len >= sizeof(buf))
|
||||
return 0;
|
||||
|
||||
if (copy_to_user(buff, buf, len))
|
||||
if ((count < sizeof(buf)) || copy_to_user(buff, buf, len))
|
||||
return -EFAULT;
|
||||
|
||||
*ppos += len; /* increase offset */
|
||||
@ -231,10 +231,11 @@ static ssize_t panel_debug_base_reg_read(struct file *file,
|
||||
if (mdata->debug_inf.debug_enable_clock)
|
||||
mdata->debug_inf.debug_enable_clock(0);
|
||||
|
||||
if (len < 0)
|
||||
if (len < 0 || len >= sizeof(panel_reg_buf))
|
||||
return 0;
|
||||
|
||||
if (copy_to_user(user_buf, to_user_buf, len))
|
||||
if ((count < sizeof(panel_reg_buf))
|
||||
|| copy_to_user(user_buf, to_user_buf, len))
|
||||
return -EFAULT;
|
||||
|
||||
*ppos += len; /* increase offset */
|
||||
@ -368,7 +369,7 @@ static ssize_t mdss_debug_base_offset_read(struct file *file,
|
||||
{
|
||||
struct mdss_debug_base *dbg = file->private_data;
|
||||
int len = 0;
|
||||
char buf[24];
|
||||
char buf[24] = {'\0'};
|
||||
|
||||
if (!dbg)
|
||||
return -ENODEV;
|
||||
@ -377,10 +378,10 @@ static ssize_t mdss_debug_base_offset_read(struct file *file,
|
||||
return 0; /* the end */
|
||||
|
||||
len = snprintf(buf, sizeof(buf), "0x%08zx %zx\n", dbg->off, dbg->cnt);
|
||||
if (len < 0)
|
||||
if (len < 0 || len >= sizeof(buf))
|
||||
return 0;
|
||||
|
||||
if (copy_to_user(buff, buf, len))
|
||||
if ((count < sizeof(buf)) || copy_to_user(buff, buf, len))
|
||||
return -EFAULT;
|
||||
|
||||
*ppos += len; /* increase offset */
|
||||
@ -702,7 +703,7 @@ static ssize_t mdss_debug_factor_read(struct file *file,
|
||||
{
|
||||
struct mdss_fudge_factor *factor = file->private_data;
|
||||
int len = 0;
|
||||
char buf[32];
|
||||
char buf[32] = {'\0'};
|
||||
|
||||
if (!factor)
|
||||
return -ENODEV;
|
||||
@ -712,10 +713,10 @@ static ssize_t mdss_debug_factor_read(struct file *file,
|
||||
|
||||
len = snprintf(buf, sizeof(buf), "%d/%d\n",
|
||||
factor->numer, factor->denom);
|
||||
if (len < 0)
|
||||
if (len < 0 || len >= sizeof(buf))
|
||||
return 0;
|
||||
|
||||
if (copy_to_user(buff, buf, len))
|
||||
if ((count < sizeof(buf)) || copy_to_user(buff, buf, len))
|
||||
return -EFAULT;
|
||||
|
||||
*ppos += len; /* increase offset */
|
||||
@ -746,6 +747,8 @@ static ssize_t mdss_debug_perf_mode_write(struct file *file,
|
||||
if (copy_from_user(buf, user_buf, count))
|
||||
return -EFAULT;
|
||||
|
||||
buf[count] = 0; /* end of string */
|
||||
|
||||
if (sscanf(buf, "%d", &perf_mode) != 1)
|
||||
return -EFAULT;
|
||||
|
||||
@ -766,7 +769,7 @@ static ssize_t mdss_debug_perf_mode_read(struct file *file,
|
||||
{
|
||||
struct mdss_perf_tune *perf_tune = file->private_data;
|
||||
int len = 0;
|
||||
char buf[40];
|
||||
char buf[40] = {'\0'};
|
||||
|
||||
if (!perf_tune)
|
||||
return -ENODEV;
|
||||
@ -778,10 +781,10 @@ static ssize_t mdss_debug_perf_mode_read(struct file *file,
|
||||
|
||||
len = snprintf(buf, sizeof(buf), "min_mdp_clk %lu min_bus_vote %llu\n",
|
||||
perf_tune->min_mdp_clk, perf_tune->min_bus_vote);
|
||||
if (len < 0)
|
||||
if (len < 0 || len >= sizeof(buf))
|
||||
return 0;
|
||||
|
||||
if (copy_to_user(buff, buf, len))
|
||||
if ((count < sizeof(buf)) || copy_to_user(buff, buf, len))
|
||||
return -EFAULT;
|
||||
|
||||
*ppos += len; /* increase offset */
|
||||
@ -801,7 +804,7 @@ static ssize_t mdss_debug_perf_panic_read(struct file *file,
|
||||
{
|
||||
struct mdss_data_type *mdata = file->private_data;
|
||||
int len = 0;
|
||||
char buf[40];
|
||||
char buf[40] = {'\0'};
|
||||
|
||||
if (!mdata)
|
||||
return -ENODEV;
|
||||
@ -811,10 +814,10 @@ static ssize_t mdss_debug_perf_panic_read(struct file *file,
|
||||
|
||||
len = snprintf(buf, sizeof(buf), "%d\n",
|
||||
!mdata->has_panic_ctrl);
|
||||
if (len < 0)
|
||||
if (len < 0 || len >= sizeof(buf))
|
||||
return 0;
|
||||
|
||||
if (copy_to_user(buff, buf, len))
|
||||
if ((count < sizeof(buf)) || copy_to_user(buff, buf, len))
|
||||
return -EFAULT;
|
||||
|
||||
*ppos += len; /* increase offset */
|
||||
@ -877,9 +880,14 @@ static ssize_t mdss_debug_perf_panic_write(struct file *file,
|
||||
if (!mdata)
|
||||
return -EFAULT;
|
||||
|
||||
if (count >= sizeof(buf))
|
||||
return -EFAULT;
|
||||
|
||||
if (copy_from_user(buf, user_buf, count))
|
||||
return -EFAULT;
|
||||
|
||||
buf[count] = 0; /* end of string */
|
||||
|
||||
if (sscanf(buf, "%d", &disable_panic) != 1)
|
||||
return -EFAULT;
|
||||
|
||||
|
9
fs/aio.c
9
fs/aio.c
@ -977,12 +977,17 @@ static ssize_t aio_setup_vectored_rw(int rw, struct kiocb *kiocb, bool compat)
|
||||
|
||||
static ssize_t aio_setup_single_vector(int rw, struct kiocb *kiocb)
|
||||
{
|
||||
if (unlikely(!access_ok(!rw, kiocb->ki_buf, kiocb->ki_nbytes)))
|
||||
size_t len = kiocb->ki_nbytes;
|
||||
|
||||
if (len > MAX_RW_COUNT)
|
||||
len = MAX_RW_COUNT;
|
||||
|
||||
if (unlikely(!access_ok(!rw, kiocb->ki_buf, len)))
|
||||
return -EFAULT;
|
||||
|
||||
kiocb->ki_iovec = &kiocb->ki_inline_vec;
|
||||
kiocb->ki_iovec->iov_base = kiocb->ki_buf;
|
||||
kiocb->ki_iovec->iov_len = kiocb->ki_nbytes;
|
||||
kiocb->ki_iovec->iov_len = len;
|
||||
kiocb->ki_nr_segs = 1;
|
||||
return 0;
|
||||
}
|
||||
|
@ -5,6 +5,11 @@
|
||||
This program can be distributed under the terms of the GNU GPL.
|
||||
See the file COPYING.
|
||||
*/
|
||||
/*
|
||||
* NOTE: This file has been modified by Sony Mobile Communications Inc.
|
||||
* Modifications are Copyright (c) 2016 Sony Mobile Communications Inc,
|
||||
* and licensed under the license of the file.
|
||||
*/
|
||||
|
||||
#include "fuse_i.h"
|
||||
#include "fuse_shortcircuit.h"
|
||||
|
@ -401,6 +401,7 @@ pipe_read(struct kiocb *iocb, const struct iovec *_iov,
|
||||
void *addr;
|
||||
size_t chars = buf->len, remaining;
|
||||
int error, atomic;
|
||||
int offset;
|
||||
|
||||
if (chars > total_len)
|
||||
chars = total_len;
|
||||
@ -414,9 +415,10 @@ pipe_read(struct kiocb *iocb, const struct iovec *_iov,
|
||||
|
||||
atomic = !iov_fault_in_pages_write(iov, chars);
|
||||
remaining = chars;
|
||||
offset = buf->offset;
|
||||
redo:
|
||||
addr = ops->map(pipe, buf, atomic);
|
||||
error = pipe_iov_copy_to_user(iov, addr, &buf->offset,
|
||||
error = pipe_iov_copy_to_user(iov, addr, &offset,
|
||||
&remaining, atomic);
|
||||
ops->unmap(pipe, buf, addr);
|
||||
if (unlikely(error)) {
|
||||
@ -432,6 +434,7 @@ redo:
|
||||
break;
|
||||
}
|
||||
ret += chars;
|
||||
buf->offset += chars;
|
||||
buf->len -= chars;
|
||||
|
||||
/* Was it a packet buffer? Clean up and exit */
|
||||
|
@ -1,3 +1,8 @@
|
||||
/*
|
||||
* NOTE: This file has been modified by Sony Mobile Communications Inc.
|
||||
* Modifications are Copyright (c) 2015 Sony Mobile Communications Inc,
|
||||
* and licensed under the license of the file.
|
||||
*/
|
||||
#ifndef _LINUX_MMZONE_H
|
||||
#define _LINUX_MMZONE_H
|
||||
|
||||
|
@ -195,6 +195,7 @@ enum power_supply_property {
|
||||
POWER_SUPPLY_PROP_STOP_USB_HOST_FUNCTION,
|
||||
POWER_SUPPLY_PROP_FV_CFG,
|
||||
POWER_SUPPLY_PROP_FV_CMP_CFG,
|
||||
POWER_SUPPLY_PROP_BATT_AGING,
|
||||
/* Local extensions of type int64_t */
|
||||
POWER_SUPPLY_PROP_CHARGE_COUNTER_EXT,
|
||||
/* Properties of type `const char *' */
|
||||
|
@ -1,3 +1,8 @@
|
||||
/*
|
||||
* NOTE: This file has been modified by Sony Mobile Communications Inc.
|
||||
* Modifications are Copyright (c) 2016 Sony Mobile Communications Inc,
|
||||
* and licensed under the license of the file.
|
||||
*/
|
||||
#ifndef __ASM_GENERIC_SOCKET_H
|
||||
#define __ASM_GENERIC_SOCKET_H
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
/*
|
||||
* NOTE: This file has been modified by Sony Mobile Communications Inc.
|
||||
* Modifications are Copyright (c) 2016 Sony Mobile Communications Inc,
|
||||
* and licensed under the license of the file.
|
||||
*/
|
||||
#ifndef _UAPI_LINUX_SOCKET_H
|
||||
#define _UAPI_LINUX_SOCKET_H
|
||||
|
||||
|
@ -4,6 +4,11 @@
|
||||
* (C) Copyright 1995 Linus Torvalds
|
||||
* (C) Copyright 2002 Christoph Hellwig
|
||||
*/
|
||||
/*
|
||||
* NOTE: This file has been modified by Sony Mobile Communications Inc.
|
||||
* Modifications are Copyright (c) 2015 Sony Mobile Communications Inc,
|
||||
* and licensed under the license of the file.
|
||||
*/
|
||||
|
||||
#include <linux/capability.h>
|
||||
#include <linux/mman.h>
|
||||
|
@ -8,6 +8,11 @@
|
||||
* Copyright (C) 2006 Silicon Graphics, Inc.,
|
||||
* Christoph Lameter <christoph@lameter.com>
|
||||
*/
|
||||
/*
|
||||
* NOTE: This file has been modified by Sony Mobile Communications Inc.
|
||||
* Modifications are Copyright (c) 2015 Sony Mobile Communications Inc,
|
||||
* and licensed under the license of the file.
|
||||
*/
|
||||
#include <linux/fs.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/err.h>
|
||||
|
@ -88,6 +88,11 @@
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the License, or (at your option) any later version.
|
||||
*/
|
||||
/*
|
||||
* NOTE: This file has been modified by Sony Mobile Communications Inc.
|
||||
* Modifications are Copyright (c) 2016 Sony Mobile Communications Inc,
|
||||
* and licensed under the license of the file.
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2011-2016, 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
|
||||
@ -3380,7 +3380,7 @@ int msm_ipc_router_get_curr_pkt_size(struct msm_ipc_port *port_ptr)
|
||||
|
||||
int msm_ipc_router_bind_control_port(struct msm_ipc_port *port_ptr)
|
||||
{
|
||||
if (!port_ptr)
|
||||
if (unlikely(!port_ptr || port_ptr->type != CLIENT_PORT))
|
||||
return -EINVAL;
|
||||
|
||||
down_write(&local_ports_lock_lhc2);
|
||||
|
@ -7,6 +7,11 @@
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
/*
|
||||
* NOTE: This file has been modified by Sony Mobile Communications Inc.
|
||||
* Modifications are Copyright (c) 2016 Sony Mobile Communications Inc,
|
||||
* and licensed under the license of the file.
|
||||
*/
|
||||
|
||||
/*
|
||||
* There are run-time debug flags enabled via the debug_mask module param, or
|
||||
@ -1928,7 +1933,7 @@ static int qtaguid_ctrl_proc_show(struct seq_file *m, void *v)
|
||||
);
|
||||
f_count = atomic_long_read(
|
||||
&sock_tag_entry->socket->file->f_count);
|
||||
seq_printf(m, "sock=%p tag=0x%llx (uid=%u) pid=%u "
|
||||
seq_printf(m, "sock=%pK tag=0x%llx (uid=%u) pid=%u "
|
||||
"f_count=%lu\n",
|
||||
sock_tag_entry->sk,
|
||||
sock_tag_entry->tag, uid,
|
||||
|
@ -215,11 +215,13 @@ static void snd_timer_check_master(struct snd_timer_instance *master)
|
||||
slave->slave_id == master->slave_id) {
|
||||
list_move_tail(&slave->open_list, &master->slave_list_head);
|
||||
spin_lock_irq(&slave_active_lock);
|
||||
spin_lock(&master->timer->lock);
|
||||
slave->master = master;
|
||||
slave->timer = master->timer;
|
||||
if (slave->flags & SNDRV_TIMER_IFLG_RUNNING)
|
||||
list_add_tail(&slave->active_list,
|
||||
&master->slave_active_head);
|
||||
spin_unlock(&master->timer->lock);
|
||||
spin_unlock_irq(&slave_active_lock);
|
||||
}
|
||||
}
|
||||
@ -345,15 +347,18 @@ int snd_timer_close(struct snd_timer_instance *timeri)
|
||||
timer->hw.close)
|
||||
timer->hw.close(timer);
|
||||
/* remove slave links */
|
||||
spin_lock_irq(&slave_active_lock);
|
||||
spin_lock(&timer->lock);
|
||||
list_for_each_entry_safe(slave, tmp, &timeri->slave_list_head,
|
||||
open_list) {
|
||||
spin_lock_irq(&slave_active_lock);
|
||||
_snd_timer_stop(slave, 1, SNDRV_TIMER_EVENT_RESOLUTION);
|
||||
list_move_tail(&slave->open_list, &snd_timer_slave_list);
|
||||
slave->master = NULL;
|
||||
slave->timer = NULL;
|
||||
spin_unlock_irq(&slave_active_lock);
|
||||
list_del_init(&slave->ack_list);
|
||||
list_del_init(&slave->active_list);
|
||||
}
|
||||
spin_unlock(&timer->lock);
|
||||
spin_unlock_irq(&slave_active_lock);
|
||||
mutex_unlock(®ister_mutex);
|
||||
}
|
||||
out:
|
||||
@ -440,9 +445,12 @@ static int snd_timer_start_slave(struct snd_timer_instance *timeri)
|
||||
|
||||
spin_lock_irqsave(&slave_active_lock, flags);
|
||||
timeri->flags |= SNDRV_TIMER_IFLG_RUNNING;
|
||||
if (timeri->master)
|
||||
if (timeri->master && timeri->timer) {
|
||||
spin_lock(&timeri->timer->lock);
|
||||
list_add_tail(&timeri->active_list,
|
||||
&timeri->master->slave_active_head);
|
||||
spin_unlock(&timeri->timer->lock);
|
||||
}
|
||||
spin_unlock_irqrestore(&slave_active_lock, flags);
|
||||
return 1; /* delayed start */
|
||||
}
|
||||
@ -488,6 +496,8 @@ static int _snd_timer_stop(struct snd_timer_instance * timeri,
|
||||
if (!keep_flag) {
|
||||
spin_lock_irqsave(&slave_active_lock, flags);
|
||||
timeri->flags &= ~SNDRV_TIMER_IFLG_RUNNING;
|
||||
list_del_init(&timeri->ack_list);
|
||||
list_del_init(&timeri->active_list);
|
||||
spin_unlock_irqrestore(&slave_active_lock, flags);
|
||||
}
|
||||
goto __end;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
|
||||
* Author: Brian Swetland <swetland@google.com>
|
||||
*
|
||||
* This software is licensed under the terms of the GNU General Public
|
||||
@ -1413,6 +1413,12 @@ int q6asm_audio_client_buf_alloc_contiguous(unsigned int dir,
|
||||
|
||||
ac->port[dir].buf = buf;
|
||||
|
||||
/* check for integer overflow */
|
||||
if ((bufcnt > 0) && ((INT_MAX / bufcnt) < bufsz)) {
|
||||
pr_err("%s: integer overflow\n", __func__);
|
||||
mutex_unlock(&ac->cmd_lock);
|
||||
goto fail;
|
||||
}
|
||||
bytes_to_alloc = bufsz * bufcnt;
|
||||
|
||||
/* The size to allocate should be multiple of 4K bytes */
|
||||
|
Loading…
Reference in New Issue
Block a user