I am attempting to use a TCA8418 keypad (which operates over I2C) and I have the driver loaded into the kernel, but the device was not recognized so I am instantiating it myself and am unable to bind the driver. I get the following error:
# echo -n "1-0034" > /sys/bus/i2c/drivers/tca8418_keypad/bind
-bash: echo: write error: No such device
This is after having tried the following (as root):
# echo -n "tca8418_keypad" 0x34 > /sys/bus/i2c/devices/i2c-1/new_device
I have the following device and driver trees, respectively:
/sys/bus/i2c/devices/1-0034
|-- modalias
|-- name
|-- power
| |-- autosuspend_delay_ms
| |-- control
| |-- runtime_active_time
| |-- runtime_status
| `-- runtime_suspended_time
|-- subsystem -> ../../../../../bus/i2c
`-- uevent
/sys/bus/i2c/drivers/tca8418_keypad
|-- bind
|-- module -> ../../../../module/tca8418_keypad
|-- uevent
`-- unbind
I have used the following for reference thus far, but neither seems to work completely:
I have run out of ideas and could use some suggestions. Am I even approaching this the right way?
I'm running Debian on an ARM single board computer if that matters.
Edit:
I have since discovered that I am receiving the following error when I instantiate the new device:
tca8418_keypad: probe of 1-0034 failed with error -22
Best Answer
I was missing platform data for this device.
I was able to get it working by inserting the platform data directly into the code for the driver module:
Then adding this to the __init function:
This is not the most elegant of fixes, but it worked for me. I would have preferred a userspace solution, but I was unable to find one.