I'm in the process of upgrading from 3.0.35 to 4.1.15. I am new to the world of device trees, etc.. I have a gpio expander chip pca9502 that I used to configure with platform data in a board configuration file, like so:
static const char* gpio_names[PCA9502_NUM_GPIO] = { "program",
NULL,
"soft_reset",
"flash_en",
"I0_L4N_T0_12",
"done",
"init_b",
"cpudone" };
static struct pca9502_platform_data pca9502_i2c_gpio_data = {
.num_gpio = PCA9502_NUM_GPIO,
.gpio_base = -1,
.names = gpio_names
};
Now I have moved to a device tree and have the following in my dts:
pca9502: pca9502@49 {
compatible = "nxp,pca9502";
reg = <0x49>;
gpio-controller;
};
What I am not sure about is now I pass platform data to the driver, now that I am using the device tree or if that is even possible. Mainly I need .names for the gpios, and that used to get passed in platform data. I've tried adding
gpio-line-names property to my controller in the dts, but that doesn't seem to work or I misunderstand the kernel documentation in regard to it.
The gpios work fine other than they no longer have the aliased names in sysfs.
Is there a way to pass platform data without the old board descriptors in the newer kernel? Otherwise is there a way to alias the names for controllers gpio lines like I used to be able to?
Thanks in advance.
Solved! Go to Solution.
Hi Jeffrey
may be useful to check AN5125 Introduction to Device Trees
http://www.nxp.com/docs/en/application-note/AN5125.pdf
parameters from dts can be passed in probe function
using of_property_read.. function as for example in linux/drivers/gpio/gpio-pcf857x.c
linux-imx.git - i.MX Linux Kernel
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Jeffrey
may be useful to check AN5125 Introduction to Device Trees
http://www.nxp.com/docs/en/application-note/AN5125.pdf
parameters from dts can be passed in probe function
using of_property_read.. function as for example in linux/drivers/gpio/gpio-pcf857x.c
linux-imx.git - i.MX Linux Kernel
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Igor,
That worked perfectly for me!
Thank You,
Jeff