How to access SPI from reboot.c file

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

How to access SPI from reboot.c file

988 次查看
lalabhaidesai
Contributor I

Hello,

I am using i.MX6UL and i want to access the SPI from "void kernel_power_off(void)" function before shutdown process. so please guide me that how can i access SPI from this function which is in reboot.c file. I want to send some data to my slave device using SPI from this function. I have accessed SPI from user space using spidev and it is working fine. But i could not able to access it from reboot.c file so please guide me ASAP. Thanks in advance.

标签 (1)
0 项奖励
回复
2 回复数

782 次查看
igorpadykov
NXP Employee
NXP Employee

Hi Lalabhai

please refer to spi ioctls described in linux/Documentation/spi/spidev

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!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复

782 次查看
lalabhaidesai
Contributor I

Hello sir,

Thanks for your quick response, but I still not able to access SPI from reboot.c kernel file. I want to access the SPI from kernel's file "reboot.c" directly, not from user space. So what should I have to do? please guide.

Function from where I want to access SPI is shown below,

/**
 * kernel_power_off - power_off the system
 *
 * Shutdown everything and perform a clean system power_off.
 */
void kernel_power_off(void)
{
 kernel_shutdown_prepare(SYSTEM_POWER_OFF);
 if (pm_power_off_prepare)
  pm_power_off_prepare();
 migrate_to_reboot_cpu();
 syscore_shutdown();
 pr_emerg("Power down");
 kmsg_dump(KMSG_DUMP_POWEROFF);
 machine_power_off();
}
0 项奖励
回复