Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
2
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
80503b2
Documentation
LICENSES
arch
block
certs
crypto
drivers
accessibility
acpi
amba
android
ata
atm
auxdisplay
base
bcma
block
bluetooth
bus
cdrom
char
clk
clocksource
connector
counter
cpufreq
cpuidle
crypto
dax
dca
devfreq
dio
dma-buf
dma
edac
eisa
extcon
firewire
firmware
fmc
fpga
fsi
gnss
gpio
gpu
hid
hsi
hv
hwmon
hwspinlock
hwtracing
i2c
i3c
ide
idle
iio
infiniband
input
gameport
joystick
keyboard
misc
88pm80x_onkey.c
88pm860x_onkey.c
Kconfig
Makefile
ab8500-ponkey.c
ad714x-i2c.c
ad714x-spi.c
ad714x.c
ad714x.h
adxl34x-i2c.c
adxl34x-spi.c
adxl34x.c
adxl34x.h
apanel.c
arizona-haptics.c
ati_remote2.c
atlas_btns.c
atmel_captouch.c
axp20x-pek.c
bma150.c
cm109.c
cma3000_d0x.c
cma3000_d0x.h
cma3000_d0x_i2c.c
cobalt_btns.c
cpcap-pwrbutton.c
da9052_onkey.c
da9055_onkey.c
da9063_onkey.c
dm355evm_keys.c
drv260x.c
drv2665.c
drv2667.c
e3x0-button.c
gp2ap002a00f.c
gpio-beeper.c
gpio-vibra.c
gpio_decoder.c
hisi_powerkey.c
hp_sdc_rtc.c
ideapad_slidebar.c
ims-pcu.c
ixp4xx-beeper.c
keyspan_remote.c
kxtj9.c
m68kspkr.c
max77650-onkey.c
max77693-haptic.c
max8925_onkey.c
max8997_haptic.c
mc13783-pwrbutton.c
mma8450.c
msm-vibrator.c
palmas-pwrbutton.c
pcap_keys.c
pcf50633-input.c
pcf8574_keypad.c
pcspkr.c
pm8941-pwrkey.c
pm8xxx-vibrator.c
pmic8xxx-pwrkey.c
powermate.c
pwm-beeper.c
pwm-vibra.c
rave-sp-pwrbutton.c
rb532_button.c
regulator-haptic.c
retu-pwrbutton.c
rk805-pwrkey.c
rotary_encoder.c
sc27xx-vibra.c
sgi_btns.c
sirfsoc-onkey.c
soc_button_array.c
sparcspkr.c
stpmic1_onkey.c
tps65218-pwrbutton.c
twl4030-pwrbutton.c
twl4030-vibra.c
twl6040-vibra.c
uinput.c
wistron_btns.c
wm831x-on.c
xen-kbdfront.c
yealink.c
yealink.h
mouse
rmi4
serio
tablet
touchscreen
Kconfig
Makefile
apm-power.c
evbug.c
evdev.c
ff-core.c
ff-memless.c
input-compat.c
input-compat.h
input-leds.c
input-mt.c
input-polldev.c
input.c
joydev.c
matrix-keymap.c
mousedev.c
sparse-keymap.c
interconnect
iommu
ipack
irqchip
isdn
leds
lightnvm
macintosh
mailbox
mcb
md
media
memory
memstick
message
mfd
misc
mmc
mtd
mux
net
nfc
ntb
nubus
nvdimm
nvme
nvmem
of
opp
oprofile
parisc
parport
pci
pcmcia
perf
phy
pinctrl
platform
pnp
power
powercap
pps
ps3
ptp
pwm
rapidio
ras
regulator
remoteproc
reset
rpmsg
rtc
s390
sbus
scsi
sfi
sh
siox
slimbus
sn
soc
soundwire
spi
spmi
ssb
staging
target
tc
tee
thermal
thunderbolt
tty
uio
usb
uwb
vfio
vhost
video
virt
virtio
visorbus
vlynq
vme
w1
watchdog
xen
zorro
Kconfig
Makefile
fs
include
init
ipc
kernel
lib
mm
net
samples
scripts
security
sound
tools
usr
virt
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README
Breadcrumbs
linux
/
drivers
/
input
/
misc
/
ad714x-i2c.c
Copy path
Blame
Blame
Latest commit
History
History
110 lines (88 loc) · 2.6 KB
Breadcrumbs
linux
/
drivers
/
input
/
misc
/
ad714x-i2c.c
Top
File metadata and controls
Code
Blame
110 lines (88 loc) · 2.6 KB
Raw
// SPDX-License-Identifier: GPL-2.0-or-later /* * AD714X CapTouch Programmable Controller driver (I2C bus) * * Copyright 2009-2011 Analog Devices Inc. */ #include <linux/input.h> /* BUS_I2C */ #include <linux/i2c.h> #include <linux/module.h> #include <linux/types.h> #include <linux/pm.h> #include "ad714x.h" static int __maybe_unused ad714x_i2c_suspend(struct device *dev) { return ad714x_disable(i2c_get_clientdata(to_i2c_client(dev))); } static int __maybe_unused ad714x_i2c_resume(struct device *dev) { return ad714x_enable(i2c_get_clientdata(to_i2c_client(dev))); } static SIMPLE_DEV_PM_OPS(ad714x_i2c_pm, ad714x_i2c_suspend, ad714x_i2c_resume); static int ad714x_i2c_write(struct ad714x_chip *chip, unsigned short reg, unsigned short data) { struct i2c_client *client = to_i2c_client(chip->dev); int error; chip->xfer_buf[0] = cpu_to_be16(reg); chip->xfer_buf[1] = cpu_to_be16(data); error = i2c_master_send(client, (u8 *)chip->xfer_buf, 2 * sizeof(*chip->xfer_buf)); if (unlikely(error < 0)) { dev_err(&client->dev, "I2C write error: %d\n", error); return error; } return 0; } static int ad714x_i2c_read(struct ad714x_chip *chip, unsigned short reg, unsigned short *data, size_t len) { struct i2c_client *client = to_i2c_client(chip->dev); int i; int error; chip->xfer_buf[0] = cpu_to_be16(reg); error = i2c_master_send(client, (u8 *)chip->xfer_buf, sizeof(*chip->xfer_buf)); if (error >= 0) error = i2c_master_recv(client, (u8 *)chip->xfer_buf, len * sizeof(*chip->xfer_buf)); if (unlikely(error < 0)) { dev_err(&client->dev, "I2C read error: %d\n", error); return error; } for (i = 0; i < len; i++) data[i] = be16_to_cpu(chip->xfer_buf[i]); return 0; } static int ad714x_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct ad714x_chip *chip; chip = ad714x_probe(&client->dev, BUS_I2C, client->irq, ad714x_i2c_read, ad714x_i2c_write); if (IS_ERR(chip)) return PTR_ERR(chip); i2c_set_clientdata(client, chip); return 0; } static const struct i2c_device_id ad714x_id[] = { { "ad7142_captouch", 0 }, { "ad7143_captouch", 0 }, { "ad7147_captouch", 0 }, { "ad7147a_captouch", 0 }, { "ad7148_captouch", 0 }, { } }; MODULE_DEVICE_TABLE(i2c, ad714x_id); static struct i2c_driver ad714x_i2c_driver = { .driver = { .name = "ad714x_captouch", .pm = &ad714x_i2c_pm, }, .probe = ad714x_i2c_probe, .id_table = ad714x_id, }; module_i2c_driver(ad714x_i2c_driver); MODULE_DESCRIPTION("Analog Devices AD714X Capacitance Touch Sensor I2C Bus Driver"); MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); MODULE_LICENSE("GPL");
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
You can’t perform that action at this time.