Merge android-4.9.170 (1ef64da) into msm-4.9
* refs/heads/tmp-1ef64da: Linux 4.9.170 appletalk: Fix compile regression net: stmmac: Set dma ring length before enabling the DMA tpm/tpm_crb: Avoid unaligned reads in crb_recv() include/linux/swap.h: use offsetof() instead of custom __swapoffset macro lib/div64.c: off by one in shift appletalk: Fix use-after-free in atalk_proc_exit ARM: 8839/1: kprobe: make patch_lock a raw_spinlock_t lkdtm: Add tests for NULL pointer dereference soc/tegra: pmc: Drop locking from tegra_powergate_is_powered() iommu/dmar: Fix buffer overflow during PCI bus notification crypto: sha512/arm - fix crash bug in Thumb2 build crypto: sha256/arm - fix crash bug in Thumb2 build kernel: hung_task.c: disable on suspend cifs: fallback to older infolevels on findfirst queryinfo retry ACPI / SBS: Fix GPE storm on recent MacBookPro's ARM: samsung: Limit SAMSUNG_PM_CHECK config option to non-Exynos platforms HID: i2c-hid: override HID descriptors for certain devices serial: uartps: console_setup() can't be placed to init section f2fs: fix to do sanity check with current segment number 9p locks: add mount option for lock retry interval 9p: do not trust pdu content for stat item size rsi: improve kernel thread handling to fix kernel panic gpio: pxa: handle corner case of unprobed device ext4: prohibit fstrim in norecovery mode fix incorrect error code mapping for OBJECTID_NOT_FOUND x86/hw_breakpoints: Make default case in hw_breakpoint_arch_parse() return an error iommu/vt-d: Check capability before disabling protected memory x86/cpu/cyrix: Use correct macros for Cyrix calls on Geode processors x86/hpet: Prevent potential NULL pointer dereference irqchip/mbigen: Don't clear eventid when freeing an MSI perf tests: Fix a memory leak in test__perf_evsel__tp_sched_test() perf tests: Fix a memory leak of cpu_map object in the openat_syscall_event_on_all_cpus test perf evsel: Free evsel->counts in perf_evsel__exit() perf hist: Add missing map__put() in error case perf top: Fix error handling in cmd_top() perf build-id: Fix memory leak in print_sdt_events() perf config: Fix a memory leak in collect_config() perf config: Fix an error in the config template documentation tools/power turbostat: return the exit status of a command thermal/int340x_thermal: fix mode setting thermal/int340x_thermal: Add additional UUIDs ALSA: opl3: fix mismatch between snd_opl3_drum_switch definition and declaration mmc: davinci: remove extraneous __init annotation IB/mlx4: Fix race condition between catas error reset and aliasguid flows ALSA: sb8: add a check for request_region ALSA: echoaudio: add a check for ioremap_nocache ext4: report real fs size after failed resize ext4: add missing brelse() in add_new_gdb_meta_bg() perf/core: Restore mmap record type correctly ARC: u-boot args: check that magic number is correct ANDROID: cuttlefish_defconfig: Enable L2TP/PPTP ANDROID: Makefile: Properly resolve 4.9.169 merge Make arm64 serial port config compatible with crosvm Change-Id: If6d1962cc2aaf4dccc1e3b4495e9bb77ae6dadac Signed-off-by: jianzhou <jianzhou@codeaurora.org>
This commit is contained in:
commit
7b323f5e90
64 changed files with 770 additions and 135 deletions
8
Makefile
8
Makefile
|
|
@ -1,6 +1,6 @@
|
|||
VERSION = 4
|
||||
PATCHLEVEL = 9
|
||||
SUBLEVEL = 169
|
||||
SUBLEVEL = 170
|
||||
EXTRAVERSION =
|
||||
NAME = Roaring Lionus
|
||||
|
||||
|
|
@ -511,7 +511,11 @@ endif
|
|||
|
||||
ifeq ($(cc-name),clang)
|
||||
ifneq ($(CROSS_COMPILE),)
|
||||
CLANG_FLAGS := --target=$(notdir $(CROSS_COMPILE:%-=%))
|
||||
CLANG_TRIPLE ?= $(CROSS_COMPILE)
|
||||
CLANG_FLAGS := --target=$(notdir $(CLANG_TRIPLE:%-=%))
|
||||
ifeq ($(shell $(srctree)/scripts/clang-android.sh $(CC) $(CLANG_FLAGS)), y)
|
||||
$(error "Clang with Android --target detected. Did you specify CLANG_TRIPLE?")
|
||||
endif
|
||||
GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit))
|
||||
CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)
|
||||
GCC_TOOLCHAIN := $(realpath $(GCC_TOOLCHAIN_DIR)/..)
|
||||
|
|
|
|||
|
|
@ -107,6 +107,7 @@ ENTRY(stext)
|
|||
; r2 = pointer to uboot provided cmdline or external DTB in mem
|
||||
; These are handled later in handle_uboot_args()
|
||||
st r0, [@uboot_tag]
|
||||
st r1, [@uboot_magic]
|
||||
st r2, [@uboot_arg]
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ unsigned int intr_to_DE_cnt;
|
|||
|
||||
/* Part of U-boot ABI: see head.S */
|
||||
int __initdata uboot_tag;
|
||||
int __initdata uboot_magic;
|
||||
char __initdata *uboot_arg;
|
||||
|
||||
const struct machine_desc *machine_desc;
|
||||
|
|
@ -400,6 +401,8 @@ static inline bool uboot_arg_invalid(unsigned long addr)
|
|||
#define UBOOT_TAG_NONE 0
|
||||
#define UBOOT_TAG_CMDLINE 1
|
||||
#define UBOOT_TAG_DTB 2
|
||||
/* We always pass 0 as magic from U-boot */
|
||||
#define UBOOT_MAGIC_VALUE 0
|
||||
|
||||
void __init handle_uboot_args(void)
|
||||
{
|
||||
|
|
@ -415,6 +418,11 @@ void __init handle_uboot_args(void)
|
|||
goto ignore_uboot_args;
|
||||
}
|
||||
|
||||
if (uboot_magic != UBOOT_MAGIC_VALUE) {
|
||||
pr_warn(IGNORE_ARGS "non zero uboot magic\n");
|
||||
goto ignore_uboot_args;
|
||||
}
|
||||
|
||||
if (uboot_tag != UBOOT_TAG_NONE &&
|
||||
uboot_arg_invalid((unsigned long)uboot_arg)) {
|
||||
pr_warn(IGNORE_ARGS "invalid uboot arg: '%px'\n", uboot_arg);
|
||||
|
|
|
|||
|
|
@ -205,10 +205,11 @@ K256:
|
|||
.global sha256_block_data_order
|
||||
.type sha256_block_data_order,%function
|
||||
sha256_block_data_order:
|
||||
.Lsha256_block_data_order:
|
||||
#if __ARM_ARCH__<7
|
||||
sub r3,pc,#8 @ sha256_block_data_order
|
||||
#else
|
||||
adr r3,sha256_block_data_order
|
||||
adr r3,.Lsha256_block_data_order
|
||||
#endif
|
||||
#if __ARM_MAX_ARCH__>=7 && !defined(__KERNEL__)
|
||||
ldr r12,.LOPENSSL_armcap
|
||||
|
|
|
|||
|
|
@ -86,10 +86,11 @@ K256:
|
|||
.global sha256_block_data_order
|
||||
.type sha256_block_data_order,%function
|
||||
sha256_block_data_order:
|
||||
.Lsha256_block_data_order:
|
||||
#if __ARM_ARCH__<7
|
||||
sub r3,pc,#8 @ sha256_block_data_order
|
||||
#else
|
||||
adr r3,sha256_block_data_order
|
||||
adr r3,.Lsha256_block_data_order
|
||||
#endif
|
||||
#if __ARM_MAX_ARCH__>=7 && !defined(__KERNEL__)
|
||||
ldr r12,.LOPENSSL_armcap
|
||||
|
|
|
|||
|
|
@ -267,10 +267,11 @@ WORD64(0x5fcb6fab,0x3ad6faec, 0x6c44198c,0x4a475817)
|
|||
.global sha512_block_data_order
|
||||
.type sha512_block_data_order,%function
|
||||
sha512_block_data_order:
|
||||
.Lsha512_block_data_order:
|
||||
#if __ARM_ARCH__<7
|
||||
sub r3,pc,#8 @ sha512_block_data_order
|
||||
#else
|
||||
adr r3,sha512_block_data_order
|
||||
adr r3,.Lsha512_block_data_order
|
||||
#endif
|
||||
#if __ARM_MAX_ARCH__>=7 && !defined(__KERNEL__)
|
||||
ldr r12,.LOPENSSL_armcap
|
||||
|
|
|
|||
|
|
@ -134,10 +134,11 @@ WORD64(0x5fcb6fab,0x3ad6faec, 0x6c44198c,0x4a475817)
|
|||
.global sha512_block_data_order
|
||||
.type sha512_block_data_order,%function
|
||||
sha512_block_data_order:
|
||||
.Lsha512_block_data_order:
|
||||
#if __ARM_ARCH__<7
|
||||
sub r3,pc,#8 @ sha512_block_data_order
|
||||
#else
|
||||
adr r3,sha512_block_data_order
|
||||
adr r3,.Lsha512_block_data_order
|
||||
#endif
|
||||
#if __ARM_MAX_ARCH__>=7 && !defined(__KERNEL__)
|
||||
ldr r12,.LOPENSSL_armcap
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ struct patch {
|
|||
unsigned int insn;
|
||||
};
|
||||
|
||||
static DEFINE_SPINLOCK(patch_lock);
|
||||
static DEFINE_RAW_SPINLOCK(patch_lock);
|
||||
|
||||
static void __kprobes *patch_map(void *addr, int fixmap, unsigned long *flags)
|
||||
__acquires(&patch_lock)
|
||||
|
|
@ -32,7 +32,7 @@ static void __kprobes *patch_map(void *addr, int fixmap, unsigned long *flags)
|
|||
return addr;
|
||||
|
||||
if (flags)
|
||||
spin_lock_irqsave(&patch_lock, *flags);
|
||||
raw_spin_lock_irqsave(&patch_lock, *flags);
|
||||
else
|
||||
__acquire(&patch_lock);
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ static void __kprobes patch_unmap(int fixmap, unsigned long *flags)
|
|||
clear_fixmap(fixmap);
|
||||
|
||||
if (flags)
|
||||
spin_unlock_irqrestore(&patch_lock, *flags);
|
||||
raw_spin_unlock_irqrestore(&patch_lock, *flags);
|
||||
else
|
||||
__release(&patch_lock);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -258,7 +258,7 @@ config S3C_PM_DEBUG_LED_SMDK
|
|||
|
||||
config SAMSUNG_PM_CHECK
|
||||
bool "S3C2410 PM Suspend Memory CRC"
|
||||
depends on PM
|
||||
depends on PM && (PLAT_S3C24XX || ARCH_S3C64XX || ARCH_S5PV210)
|
||||
select CRC32
|
||||
help
|
||||
Enable the PM code's memory area checksum over sleep. This option
|
||||
|
|
|
|||
|
|
@ -58,8 +58,6 @@ CONFIG_SETEND_EMULATION=y
|
|||
CONFIG_ARM64_SW_TTBR0_PAN=y
|
||||
CONFIG_ARM64_LSE_ATOMICS=y
|
||||
CONFIG_RANDOMIZE_BASE=y
|
||||
CONFIG_CMDLINE="console=ttyAMA0"
|
||||
CONFIG_CMDLINE_EXTEND=y
|
||||
# CONFIG_EFI is not set
|
||||
# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
|
||||
CONFIG_COMPAT=y
|
||||
|
|
@ -285,6 +283,7 @@ CONFIG_SERIAL_8250_NR_UARTS=48
|
|||
CONFIG_SERIAL_8250_EXTENDED=y
|
||||
CONFIG_SERIAL_8250_MANY_PORTS=y
|
||||
CONFIG_SERIAL_8250_SHARE_IRQ=y
|
||||
CONFIG_SERIAL_OF_PLATFORM=y
|
||||
CONFIG_SERIAL_AMBA_PL011=y
|
||||
CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
|
||||
CONFIG_VIRTIO_CONSOLE=y
|
||||
|
|
@ -386,6 +385,7 @@ CONFIG_MMC=y
|
|||
# CONFIG_MMC_BLOCK is not set
|
||||
CONFIG_RTC_CLASS=y
|
||||
# CONFIG_RTC_SYSTOHC is not set
|
||||
CONFIG_RTC_DRV_PL030=y
|
||||
CONFIG_RTC_DRV_PL031=y
|
||||
CONFIG_VIRTIO_PCI=y
|
||||
# CONFIG_VIRTIO_PCI_LEGACY is not set
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ CONFIG_IP_ADVANCED_ROUTER=y
|
|||
CONFIG_IP_MULTIPLE_TABLES=y
|
||||
CONFIG_IP_ROUTE_MULTIPATH=y
|
||||
CONFIG_IP_ROUTE_VERBOSE=y
|
||||
CONFIG_NET_IPGRE_DEMUX=y
|
||||
CONFIG_IP_MROUTE=y
|
||||
CONFIG_IP_PIMSM_V1=y
|
||||
CONFIG_IP_PIMSM_V2=y
|
||||
|
|
@ -153,6 +154,7 @@ CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y
|
|||
CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=y
|
||||
CONFIG_NETFILTER_XT_MATCH_HELPER=y
|
||||
CONFIG_NETFILTER_XT_MATCH_IPRANGE=y
|
||||
# CONFIG_NETFILTER_XT_MATCH_L2TP is not set
|
||||
CONFIG_NETFILTER_XT_MATCH_LENGTH=y
|
||||
CONFIG_NETFILTER_XT_MATCH_LIMIT=y
|
||||
CONFIG_NETFILTER_XT_MATCH_MAC=y
|
||||
|
|
@ -193,6 +195,7 @@ CONFIG_IP6_NF_FILTER=y
|
|||
CONFIG_IP6_NF_TARGET_REJECT=y
|
||||
CONFIG_IP6_NF_MANGLE=y
|
||||
CONFIG_IP6_NF_RAW=y
|
||||
CONFIG_L2TP=y
|
||||
CONFIG_NET_SCHED=y
|
||||
CONFIG_NET_SCH_HTB=y
|
||||
CONFIG_NET_SCH_NETEM=y
|
||||
|
|
@ -247,8 +250,8 @@ CONFIG_PPP=y
|
|||
CONFIG_PPP_BSDCOMP=y
|
||||
CONFIG_PPP_DEFLATE=y
|
||||
CONFIG_PPP_MPPE=y
|
||||
CONFIG_PPPOLAC=y
|
||||
CONFIG_PPPOPNS=y
|
||||
CONFIG_PPTP=y
|
||||
CONFIG_PPPOL2TP=y
|
||||
CONFIG_USB_RTL8152=y
|
||||
CONFIG_USB_USBNET=y
|
||||
# CONFIG_USB_NET_AX8817X is not set
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ static void set_cx86_reorder(void)
|
|||
setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10); /* enable MAPEN */
|
||||
|
||||
/* Load/Store Serialize to mem access disable (=reorder it) */
|
||||
setCx86_old(CX86_PCR0, getCx86_old(CX86_PCR0) & ~0x80);
|
||||
setCx86(CX86_PCR0, getCx86(CX86_PCR0) & ~0x80);
|
||||
/* set load/store serialize from 1GB to 4GB */
|
||||
ccr3 |= 0xe0;
|
||||
setCx86(CX86_CCR3, ccr3);
|
||||
|
|
@ -132,11 +132,11 @@ static void set_cx86_memwb(void)
|
|||
pr_info("Enable Memory-Write-back mode on Cyrix/NSC processor.\n");
|
||||
|
||||
/* CCR2 bit 2: unlock NW bit */
|
||||
setCx86_old(CX86_CCR2, getCx86_old(CX86_CCR2) & ~0x04);
|
||||
setCx86(CX86_CCR2, getCx86(CX86_CCR2) & ~0x04);
|
||||
/* set 'Not Write-through' */
|
||||
write_cr0(read_cr0() | X86_CR0_NW);
|
||||
/* CCR2 bit 2: lock NW bit and set WT1 */
|
||||
setCx86_old(CX86_CCR2, getCx86_old(CX86_CCR2) | 0x14);
|
||||
setCx86(CX86_CCR2, getCx86(CX86_CCR2) | 0x14);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -150,14 +150,14 @@ static void geode_configure(void)
|
|||
local_irq_save(flags);
|
||||
|
||||
/* Suspend on halt power saving and enable #SUSP pin */
|
||||
setCx86_old(CX86_CCR2, getCx86_old(CX86_CCR2) | 0x88);
|
||||
setCx86(CX86_CCR2, getCx86(CX86_CCR2) | 0x88);
|
||||
|
||||
ccr3 = getCx86(CX86_CCR3);
|
||||
setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10); /* enable MAPEN */
|
||||
|
||||
|
||||
/* FPU fast, DTE cache, Mem bypass */
|
||||
setCx86_old(CX86_CCR4, getCx86_old(CX86_CCR4) | 0x38);
|
||||
setCx86(CX86_CCR4, getCx86(CX86_CCR4) | 0x38);
|
||||
setCx86(CX86_CCR3, ccr3); /* disable MAPEN */
|
||||
|
||||
set_cx86_memwb();
|
||||
|
|
@ -293,7 +293,7 @@ static void init_cyrix(struct cpuinfo_x86 *c)
|
|||
/* GXm supports extended cpuid levels 'ala' AMD */
|
||||
if (c->cpuid_level == 2) {
|
||||
/* Enable cxMMX extensions (GX1 Datasheet 54) */
|
||||
setCx86_old(CX86_CCR7, getCx86_old(CX86_CCR7) | 1);
|
||||
setCx86(CX86_CCR7, getCx86(CX86_CCR7) | 1);
|
||||
|
||||
/*
|
||||
* GXm : 0x30 ... 0x5f GXm datasheet 51
|
||||
|
|
@ -316,7 +316,7 @@ static void init_cyrix(struct cpuinfo_x86 *c)
|
|||
if (dir1 > 7) {
|
||||
dir0_msn++; /* M II */
|
||||
/* Enable MMX extensions (App note 108) */
|
||||
setCx86_old(CX86_CCR7, getCx86_old(CX86_CCR7)|1);
|
||||
setCx86(CX86_CCR7, getCx86(CX86_CCR7)|1);
|
||||
} else {
|
||||
/* A 6x86MX - it has the bug. */
|
||||
set_cpu_bug(c, X86_BUG_COMA);
|
||||
|
|
|
|||
|
|
@ -914,6 +914,8 @@ int __init hpet_enable(void)
|
|||
return 0;
|
||||
|
||||
hpet_set_mapping();
|
||||
if (!hpet_virt_address)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* Read the period and check for a sane value:
|
||||
|
|
|
|||
|
|
@ -352,6 +352,7 @@ int arch_validate_hwbkpt_settings(struct perf_event *bp)
|
|||
#endif
|
||||
default:
|
||||
WARN_ON_ONCE(1);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -443,9 +443,13 @@ static int acpi_ac_get_present(struct acpi_sbs *sbs)
|
|||
|
||||
/*
|
||||
* The spec requires that bit 4 always be 1. If it's not set, assume
|
||||
* that the implementation doesn't support an SBS charger
|
||||
* that the implementation doesn't support an SBS charger.
|
||||
*
|
||||
* And on some MacBooks a status of 0xffff is always returned, no
|
||||
* matter whether the charger is plugged in or not, which is also
|
||||
* wrong, so ignore the SBS charger for those too.
|
||||
*/
|
||||
if (!((status >> 4) & 0x1))
|
||||
if (!((status >> 4) & 0x1) || status == 0xffff)
|
||||
return -ENODEV;
|
||||
|
||||
sbs->charger_present = (status >> 15) & 0x1;
|
||||
|
|
|
|||
|
|
@ -102,19 +102,29 @@ static int crb_recv(struct tpm_chip *chip, u8 *buf, size_t count)
|
|||
struct crb_priv *priv = dev_get_drvdata(&chip->dev);
|
||||
unsigned int expected;
|
||||
|
||||
/* sanity check */
|
||||
if (count < 6)
|
||||
/* A sanity check that the upper layer wants to get at least the header
|
||||
* as that is the minimum size for any TPM response.
|
||||
*/
|
||||
if (count < TPM_HEADER_SIZE)
|
||||
return -EIO;
|
||||
|
||||
/* If this bit is set, according to the spec, the TPM is in
|
||||
* unrecoverable condition.
|
||||
*/
|
||||
if (ioread32(&priv->cca->sts) & CRB_CTRL_STS_ERROR)
|
||||
return -EIO;
|
||||
|
||||
memcpy_fromio(buf, priv->rsp, 6);
|
||||
expected = be32_to_cpup((__be32 *) &buf[2]);
|
||||
if (expected > count || expected < 6)
|
||||
/* Read the first 8 bytes in order to get the length of the response.
|
||||
* We read exactly a quad word in order to make sure that the remaining
|
||||
* reads will be aligned.
|
||||
*/
|
||||
memcpy_fromio(buf, priv->rsp, 8);
|
||||
|
||||
expected = be32_to_cpup((__be32 *)&buf[2]);
|
||||
if (expected > count || expected < TPM_HEADER_SIZE)
|
||||
return -EIO;
|
||||
|
||||
memcpy_fromio(&buf[6], &priv->rsp[6], expected - 6);
|
||||
memcpy_fromio(&buf[8], &priv->rsp[8], expected - 8);
|
||||
|
||||
return expected;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -774,6 +774,9 @@ static int pxa_gpio_suspend(void)
|
|||
struct pxa_gpio_bank *c;
|
||||
int gpio;
|
||||
|
||||
if (!pchip)
|
||||
return 0;
|
||||
|
||||
for_each_gpio_bank(gpio, c, pchip) {
|
||||
c->saved_gplr = readl_relaxed(c->regbase + GPLR_OFFSET);
|
||||
c->saved_gpdr = readl_relaxed(c->regbase + GPDR_OFFSET);
|
||||
|
|
@ -792,6 +795,9 @@ static void pxa_gpio_resume(void)
|
|||
struct pxa_gpio_bank *c;
|
||||
int gpio;
|
||||
|
||||
if (!pchip)
|
||||
return;
|
||||
|
||||
for_each_gpio_bank(gpio, c, pchip) {
|
||||
/* restore level with set/clear */
|
||||
writel_relaxed(c->saved_gplr, c->regbase + GPSR_OFFSET);
|
||||
|
|
|
|||
|
|
@ -3,3 +3,6 @@
|
|||
#
|
||||
|
||||
obj-$(CONFIG_I2C_HID) += i2c-hid.o
|
||||
|
||||
i2c-hid-objs = i2c-hid-core.o
|
||||
i2c-hid-$(CONFIG_DMI) += i2c-hid-dmi-quirks.o
|
||||
|
|
|
|||
1359
drivers/hid/i2c-hid/i2c-hid-core.c
Normal file
1359
drivers/hid/i2c-hid/i2c-hid-core.c
Normal file
File diff suppressed because it is too large
Load diff
376
drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c
Normal file
376
drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c
Normal file
|
|
@ -0,0 +1,376 @@
|
|||
// SPDX-License-Identifier: GPL-2.0+
|
||||
|
||||
/*
|
||||
* Quirks for I2C-HID devices that do not supply proper descriptors
|
||||
*
|
||||
* Copyright (c) 2018 Julian Sax <jsbc@gmx.de>
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/dmi.h>
|
||||
#include <linux/mod_devicetable.h>
|
||||
|
||||
#include "i2c-hid.h"
|
||||
|
||||
|
||||
struct i2c_hid_desc_override {
|
||||
union {
|
||||
struct i2c_hid_desc *i2c_hid_desc;
|
||||
uint8_t *i2c_hid_desc_buffer;
|
||||
};
|
||||
uint8_t *hid_report_desc;
|
||||
unsigned int hid_report_desc_size;
|
||||
uint8_t *i2c_name;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* descriptors for the SIPODEV SP1064 touchpad
|
||||
*
|
||||
* This device does not supply any descriptors and on windows a filter
|
||||
* driver operates between the i2c-hid layer and the device and injects
|
||||
* these descriptors when the device is prompted. The descriptors were
|
||||
* extracted by listening to the i2c-hid traffic that occurs between the
|
||||
* windows filter driver and the windows i2c-hid driver.
|
||||
*/
|
||||
|
||||
static const struct i2c_hid_desc_override sipodev_desc = {
|
||||
.i2c_hid_desc_buffer = (uint8_t [])
|
||||
{0x1e, 0x00, /* Length of descriptor */
|
||||
0x00, 0x01, /* Version of descriptor */
|
||||
0xdb, 0x01, /* Length of report descriptor */
|
||||
0x21, 0x00, /* Location of report descriptor */
|
||||
0x24, 0x00, /* Location of input report */
|
||||
0x1b, 0x00, /* Max input report length */
|
||||
0x25, 0x00, /* Location of output report */
|
||||
0x11, 0x00, /* Max output report length */
|
||||
0x22, 0x00, /* Location of command register */
|
||||
0x23, 0x00, /* Location of data register */
|
||||
0x11, 0x09, /* Vendor ID */
|
||||
0x88, 0x52, /* Product ID */
|
||||
0x06, 0x00, /* Version ID */
|
||||
0x00, 0x00, 0x00, 0x00 /* Reserved */
|
||||
},
|
||||
|
||||
.hid_report_desc = (uint8_t [])
|
||||
{0x05, 0x01, /* Usage Page (Desktop), */
|
||||
0x09, 0x02, /* Usage (Mouse), */
|
||||
0xA1, 0x01, /* Collection (Application), */
|
||||
0x85, 0x01, /* Report ID (1), */
|
||||
0x09, 0x01, /* Usage (Pointer), */
|
||||
0xA1, 0x00, /* Collection (Physical), */
|
||||
0x05, 0x09, /* Usage Page (Button), */
|
||||
0x19, 0x01, /* Usage Minimum (01h), */
|
||||
0x29, 0x02, /* Usage Maximum (02h), */
|
||||
0x25, 0x01, /* Logical Maximum (1), */
|
||||
0x75, 0x01, /* Report Size (1), */
|
||||
0x95, 0x02, /* Report Count (2), */
|
||||
0x81, 0x02, /* Input (Variable), */
|
||||
0x95, 0x06, /* Report Count (6), */
|
||||
0x81, 0x01, /* Input (Constant), */
|
||||
0x05, 0x01, /* Usage Page (Desktop), */
|
||||
0x09, 0x30, /* Usage (X), */
|
||||
0x09, 0x31, /* Usage (Y), */
|
||||
0x15, 0x81, /* Logical Minimum (-127), */
|
||||
0x25, 0x7F, /* Logical Maximum (127), */
|
||||
0x75, 0x08, /* Report Size (8), */
|
||||
0x95, 0x02, /* Report Count (2), */
|
||||
0x81, 0x06, /* Input (Variable, Relative), */
|
||||
0xC0, /* End Collection, */
|
||||
0xC0, /* End Collection, */
|
||||
0x05, 0x0D, /* Usage Page (Digitizer), */
|
||||
0x09, 0x05, /* Usage (Touchpad), */
|
||||
0xA1, 0x01, /* Collection (Application), */
|
||||
0x85, 0x04, /* Report ID (4), */
|
||||
0x05, 0x0D, /* Usage Page (Digitizer), */
|
||||
0x09, 0x22, /* Usage (Finger), */
|
||||
0xA1, 0x02, /* Collection (Logical), */
|
||||
0x15, 0x00, /* Logical Minimum (0), */
|
||||
0x25, 0x01, /* Logical Maximum (1), */
|
||||
0x09, 0x47, /* Usage (Touch Valid), */
|
||||
0x09, 0x42, /* Usage (Tip Switch), */
|
||||
0x95, 0x02, /* Report Count (2), */
|
||||
0x75, 0x01, /* Report Size (1), */
|
||||
0x81, 0x02, /* Input (Variable), */
|
||||
0x95, 0x01, /* Report Count (1), */
|
||||
0x75, 0x03, /* Report Size (3), */
|
||||
0x25, 0x05, /* Logical Maximum (5), */
|
||||
0x09, 0x51, /* Usage (Contact Identifier), */
|
||||
0x81, 0x02, /* Input (Variable), */
|
||||
0x75, 0x01, /* Report Size (1), */
|
||||
0x95, 0x03, /* Report Count (3), */
|
||||
0x81, 0x03, /* Input (Constant, Variable), */
|
||||
0x05, 0x01, /* Usage Page (Desktop), */
|
||||
0x26, 0x44, 0x0A, /* Logical Maximum (2628), */
|
||||
0x75, 0x10, /* Report Size (16), */
|
||||
0x55, 0x0E, /* Unit Exponent (14), */
|
||||
0x65, 0x11, /* Unit (Centimeter), */
|
||||
0x09, 0x30, /* Usage (X), */
|
||||
0x46, 0x1A, 0x04, /* Physical Maximum (1050), */
|
||||
0x95, 0x01, /* Report Count (1), */
|
||||
0x81, 0x02, /* Input (Variable), */
|
||||
0x46, 0xBC, 0x02, /* Physical Maximum (700), */
|
||||
0x26, 0x34, 0x05, /* Logical Maximum (1332), */
|
||||
0x09, 0x31, /* Usage (Y), */
|
||||
0x81, 0x02, /* Input (Variable), */
|
||||
0xC0, /* End Collection, */
|
||||
0x05, 0x0D, /* Usage Page (Digitizer), */
|
||||
0x09, 0x22, /* Usage (Finger), */
|
||||
0xA1, 0x02, /* Collection (Logical), */
|
||||
0x25, 0x01, /* Logical Maximum (1), */
|
||||
0x09, 0x47, /* Usage (Touch Valid), */
|
||||
0x09, 0x42, /* Usage (Tip Switch), */
|
||||
0x95, 0x02, /* Report Count (2), */
|
||||
0x75, 0x01, /* Report Size (1), */
|
||||
0x81, 0x02, /* Input (Variable), */
|
||||
0x95, 0x01, /* Report Count (1), */
|
||||
0x75, 0x03, /* Report Size (3), */
|
||||
0x25, 0x05, /* Logical Maximum (5), */
|
||||
0x09, 0x51, /* Usage (Contact Identifier), */
|
||||
0x81, 0x02, /* Input (Variable), */
|
||||
0x75, 0x01, /* Report Size (1), */
|
||||
0x95, 0x03, /* Report Count (3), */
|
||||
0x81, 0x03, /* Input (Constant, Variable), */
|
||||
0x05, 0x01, /* Usage Page (Desktop), */
|
||||
0x26, 0x44, 0x0A, /* Logical Maximum (2628), */
|
||||
0x75, 0x10, /* Report Size (16), */
|
||||
0x09, 0x30, /* Usage (X), */
|
||||
0x46, 0x1A, 0x04, /* Physical Maximum (1050), */
|
||||
0x95, 0x01, /* Report Count (1), */
|
||||
0x81, 0x02, /* Input (Variable), */
|
||||
0x46, 0xBC, 0x02, /* Physical Maximum (700), */
|
||||
0x26, 0x34, 0x05, /* Logical Maximum (1332), */
|
||||
0x09, 0x31, /* Usage (Y), */
|
||||
0x81, 0x02, /* Input (Variable), */
|
||||
0xC0, /* End Collection, */
|
||||
0x05, 0x0D, /* Usage Page (Digitizer), */
|
||||
0x09, 0x22, /* Usage (Finger), */
|
||||
0xA1, 0x02, /* Collection (Logical), */
|
||||
0x25, 0x01, /* Logical Maximum (1), */
|
||||
0x09, 0x47, /* Usage (Touch Valid), */
|
||||
0x09, 0x42, /* Usage (Tip Switch), */
|
||||
0x95, 0x02, /* Report Count (2), */
|
||||
0x75, 0x01, /* Report Size (1), */
|
||||
0x81, 0x02, /* Input (Variable), */
|
||||
0x95, 0x01, /* Report Count (1), */
|
||||
0x75, 0x03, /* Report Size (3), */
|
||||
0x25, 0x05, /* Logical Maximum (5), */
|
||||
0x09, 0x51, /* Usage (Contact Identifier), */
|
||||
0x81, 0x02, /* Input (Variable), */
|
||||
0x75, 0x01, /* Report Size (1), */
|
||||
0x95, 0x03, /* Report Count (3), */
|
||||
0x81, 0x03, /* Input (Constant, Variable), */
|
||||
0x05, 0x01, /* Usage Page (Desktop), */
|
||||
0x26, 0x44, 0x0A, /* Logical Maximum (2628), */
|
||||
0x75, 0x10, /* Report Size (16), */
|
||||
0x09, 0x30, /* Usage (X), */
|
||||
0x46, 0x1A, 0x04, /* Physical Maximum (1050), */
|
||||
0x95, 0x01, /* Report Count (1), */
|
||||
0x81, 0x02, /* Input (Variable), */
|
||||
0x46, 0xBC, 0x02, /* Physical Maximum (700), */
|
||||
0x26, 0x34, 0x05, /* Logical Maximum (1332), */
|
||||
0x09, 0x31, /* Usage (Y), */
|
||||
0x81, 0x02, /* Input (Variable), */
|
||||
0xC0, /* End Collection, */
|
||||
0x05, 0x0D, /* Usage Page (Digitizer), */
|
||||
0x09, 0x22, /* Usage (Finger), */
|
||||
0xA1, 0x02, /* Collection (Logical), */
|
||||
0x25, 0x01, /* Logical Maximum (1), */
|
||||
0x09, 0x47, /* Usage (Touch Valid), */
|
||||
0x09, 0x42, /* Usage (Tip Switch), */
|
||||
0x95, 0x02, /* Report Count (2), */
|
||||
0x75, 0x01, /* Report Size (1), */
|
||||
0x81, 0x02, /* Input (Variable), */
|
||||
0x95, 0x01, /* Report Count (1), */
|
||||
0x75, 0x03, /* Report Size (3), */
|
||||
0x25, 0x05, /* Logical Maximum (5), */
|
||||
0x09, 0x51, /* Usage (Contact Identifier), */
|
||||
0x81, 0x02, /* Input (Variable), */
|
||||
0x75, 0x01, /* Report Size (1), */
|
||||
0x95, 0x03, /* Report Count (3), */
|
||||
0x81, 0x03, /* Input (Constant, Variable), */
|
||||
0x05, 0x01, /* Usage Page (Desktop), */
|
||||
0x26, 0x44, 0x0A, /* Logical Maximum (2628), */
|
||||
0x75, 0x10, /* Report Size (16), */
|
||||
0x09, 0x30, /* Usage (X), */
|
||||
0x46, 0x1A, 0x04, /* Physical Maximum (1050), */
|
||||
0x95, 0x01, /* Report Count (1), */
|
||||
0x81, 0x02, /* Input (Variable), */
|
||||
0x46, 0xBC, 0x02, /* Physical Maximum (700), */
|
||||
0x26, 0x34, 0x05, /* Logical Maximum (1332), */
|
||||
0x09, 0x31, /* Usage (Y), */
|
||||
0x81, 0x02, /* Input (Variable), */
|
||||
0xC0, /* End Collection, */
|
||||
0x05, 0x0D, /* Usage Page (Digitizer), */
|
||||
0x55, 0x0C, /* Unit Exponent (12), */
|
||||
0x66, 0x01, 0x10, /* Unit (Seconds), */
|
||||
0x47, 0xFF, 0xFF, 0x00, 0x00,/* Physical Maximum (65535), */
|
||||
0x27, 0xFF, 0xFF, 0x00, 0x00,/* Logical Maximum (65535), */
|
||||
0x75, 0x10, /* Report Size (16), */
|
||||
0x95, 0x01, /* Report Count (1), */
|
||||
0x09, 0x56, /* Usage (Scan Time), */
|
||||
0x81, 0x02, /* Input (Variable), */
|
||||
0x09, 0x54, /* Usage (Contact Count), */
|
||||
0x25, 0x7F, /* Logical Maximum (127), */
|
||||
0x75, 0x08, /* Report Size (8), */
|
||||
0x81, 0x02, /* Input (Variable), */
|
||||
0x05, 0x09, /* Usage Page (Button), */
|
||||
0x09, 0x01, /* Usage (01h), */
|
||||
0x25, 0x01, /* Logical Maximum (1), */
|
||||
0x75, 0x01, /* Report Size (1), */
|
||||
0x95, 0x01, /* Report Count (1), */
|
||||
0x81, 0x02, /* Input (Variable), */
|
||||
0x95, 0x07, /* Report Count (7), */
|
||||
0x81, 0x03, /* Input (Constant, Variable), */
|
||||
0x05, 0x0D, /* Usage Page (Digitizer), */
|
||||
0x85, 0x02, /* Report ID (2), */
|
||||
0x09, 0x55, /* Usage (Contact Count Maximum), */
|
||||
0x09, 0x59, /* Usage (59h), */
|
||||
0x75, 0x04, /* Report Size (4), */
|
||||
0x95, 0x02, /* Report Count (2), */
|
||||
0x25, 0x0F, /* Logical Maximum (15), */
|
||||
0xB1, 0x02, /* Feature (Variable), */
|
||||
0x05, 0x0D, /* Usage Page (Digitizer), */
|
||||
0x85, 0x07, /* Report ID (7), */
|
||||
0x09, 0x60, /* Usage (60h), */
|
||||
0x75, 0x01, /* Report Size (1), */
|
||||
0x95, 0x01, /* Report Count (1), */
|
||||
0x25, 0x01, /* Logical Maximum (1), */
|
||||
0xB1, 0x02, /* Feature (Variable), */
|
||||
0x95, 0x07, /* Report Count (7), */
|
||||
0xB1, 0x03, /* Feature (Constant, Variable), */
|
||||
0x85, 0x06, /* Report ID (6), */
|
||||
0x06, 0x00, 0xFF, /* Usage Page (FF00h), */
|
||||
0x09, 0xC5, /* Usage (C5h), */
|
||||
0x26, 0xFF, 0x00, /* Logical Maximum (255), */
|
||||
0x75, 0x08, /* Report Size (8), */
|
||||
0x96, 0x00, 0x01, /* Report Count (256), */
|
||||
0xB1, 0x02, /* Feature (Variable), */
|
||||
0xC0, /* End Collection, */
|
||||
0x06, 0x00, 0xFF, /* Usage Page (FF00h), */
|
||||
0x09, 0x01, /* Usage (01h), */
|
||||
0xA1, 0x01, /* Collection (Application), */
|
||||
0x85, 0x0D, /* Report ID (13), */
|
||||
0x26, 0xFF, 0x00, /* Logical Maximum (255), */
|
||||
0x19, 0x01, /* Usage Minimum (01h), */
|
||||
0x29, 0x02, /* Usage Maximum (02h), */
|
||||
0x75, 0x08, /* Report Size (8), */
|
||||
0x95, 0x02, /* Report Count (2), */
|
||||
0xB1, 0x02, /* Feature (Variable), */
|
||||
0xC0, /* End Collection, */
|
||||
0x05, 0x0D, /* Usage Page (Digitizer), */
|
||||
0x09, 0x0E, /* Usage (Configuration), */
|
||||
0xA1, 0x01, /* Collection (Application), */
|
||||
0x85, 0x03, /* Report ID (3), */
|
||||
0x09, 0x22, /* Usage (Finger), */
|
||||
0xA1, 0x02, /* Collection (Logical), */
|
||||
0x09, 0x52, /* Usage (Device Mode), */
|
||||
0x25, 0x0A, /* Logical Maximum (10), */
|
||||
0x95, 0x01, /* Report Count (1), */
|
||||
0xB1, 0x02, /* Feature (Variable), */
|
||||
0xC0, /* End Collection, */
|
||||
0x09, 0x22, /* Usage (Finger), */
|
||||
0xA1, 0x00, /* Collection (Physical), */
|
||||
0x85, 0x05, /* Report ID (5), */
|
||||
0x09, 0x57, /* Usage (57h), */
|
||||
0x09, 0x58, /* Usage (58h), */
|
||||
0x75, 0x01, /* Report Size (1), */
|
||||
0x95, 0x02, /* Report Count (2), */
|
||||
0x25, 0x01, /* Logical Maximum (1), */
|
||||
0xB1, 0x02, /* Feature (Variable), */
|
||||
0x95, 0x06, /* Report Count (6), */
|
||||
0xB1, 0x03, /* Feature (Constant, Variable),*/
|
||||
0xC0, /* End Collection, */
|
||||
0xC0 /* End Collection */
|
||||
},
|
||||
.hid_report_desc_size = 475,
|
||||
.i2c_name = "SYNA3602:00"
|
||||
};
|
||||
|
||||
|
||||
static const struct dmi_system_id i2c_hid_dmi_desc_override_table[] = {
|
||||
{
|
||||
.ident = "Teclast F6 Pro",
|
||||
.matches = {
|
||||
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "TECLAST"),
|
||||
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "F6 Pro"),
|
||||
},
|
||||
.driver_data = (void *)&sipodev_desc
|
||||
},
|
||||
{
|
||||
.ident = "Teclast F7",
|
||||
.matches = {
|
||||
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "TECLAST"),
|
||||
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "F7"),
|
||||
},
|
||||
.driver_data = (void *)&sipodev_desc
|
||||
},
|
||||
{
|
||||
.ident = "Trekstor Primebook C13",
|
||||
.matches = {
|
||||
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "TREKSTOR"),
|
||||
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Primebook C13"),
|
||||
},
|
||||
.driver_data = (void *)&sipodev_desc
|
||||
},
|
||||
{
|
||||
.ident = "Trekstor Primebook C11",
|
||||
.matches = {
|
||||
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "TREKSTOR"),
|
||||
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Primebook C11"),
|
||||
},
|
||||
.driver_data = (void *)&sipodev_desc
|
||||
},
|
||||
{
|
||||
.ident = "Direkt-Tek DTLAPY116-2",
|
||||
.matches = {
|
||||
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Direkt-Tek"),
|
||||
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "DTLAPY116-2"),
|
||||
},
|
||||
.driver_data = (void *)&sipodev_desc
|
||||
},
|
||||
{
|
||||
.ident = "Mediacom Flexbook Edge 11",
|
||||
.matches = {
|
||||
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "MEDIACOM"),
|
||||
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "FlexBook edge11 - M-FBE11"),
|
||||
},
|
||||
.driver_data = (void *)&sipodev_desc
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
struct i2c_hid_desc *i2c_hid_get_dmi_i2c_hid_desc_override(uint8_t *i2c_name)
|
||||
{
|
||||
struct i2c_hid_desc_override *override;
|
||||
const struct dmi_system_id *system_id;
|
||||
|
||||
system_id = dmi_first_match(i2c_hid_dmi_desc_override_table);
|
||||
if (!system_id)
|
||||
return NULL;
|
||||
|
||||
override = system_id->driver_data;
|
||||
if (strcmp(override->i2c_name, i2c_name))
|
||||
return NULL;
|
||||
|
||||
return override->i2c_hid_desc;
|
||||
}
|
||||
|
||||
char *i2c_hid_get_dmi_hid_report_desc_override(uint8_t *i2c_name,
|
||||
unsigned int *size)
|
||||
{
|
||||
struct i2c_hid_desc_override *override;
|
||||
const struct dmi_system_id *system_id;
|
||||
|
||||
system_id = dmi_first_match(i2c_hid_dmi_desc_override_table);
|
||||
if (!system_id)
|
||||
return NULL;
|
||||
|
||||
override = system_id->driver_data;
|
||||
if (strcmp(override->i2c_name, i2c_name))
|
||||
return NULL;
|
||||
|
||||
*size = override->hid_report_desc_size;
|
||||
return override->hid_report_desc;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue