2

I am attempting to enable a platform device in Linux, but the device I am trying to use does not have any platform data. Is it possible to add this from userspace?

Other thoughts I've had:

Would I have to compile this platform data into the kernel instead? If so can I put this in a loadable module? Can I use udev? Do I have to put this in device tree (I am using an Allwinner SoC which does not appear to support the device tree)?

Pengor
  • 27
  • 1
  • 7
  • You can create module which registers platform device and load it from user-space. It should work. See [this doc](https://www.kernel.org/doc/Documentation/driver-model/platform.txt) for details. – Sam Protsenko Oct 31 '16 at 12:12
  • @SamProtsenko Thanks for the suggestion, that seems to be going alright, but I'm trying to instantiate the platform device as an i2c device and I'm getting an error nearly identical to [this](http://stackoverflow.com/questions/23195032/i2c-registering-macro-not-found) one. – Pengor Nov 01 '16 at 00:13
  • Seems like your kernel doesn't have the function for registering i2c device anymore. What is your kernel version, exactly? – Sam Protsenko Nov 01 '16 at 14:55
  • @SamProtsenko It's a Linux-Sunxi build, [3.4.103](https://github.com/linux-sunxi/linux-sunxi/tree/9a1cd034181af628d4145202289e1993c1687db6). I wasn't able to get a custom module working, but I just managed to get it working by adding the platform data directly to the driver that wanted it. Not elegant, but it worked. – Pengor Nov 08 '16 at 01:08

0 Answers0