I am trying to set up several IIO ADC input channels through my kernel driver on a S32G2. I was wondering if there might be an example that I could follow?
I am not sure if I need to use the consumer functions under the 'include/linux/iio" directory to request and setup channels for the ADC? Once the channels are set up,
I would like to capture values on a regular bases through either polling or an interrupt and then write the values to my sysfs driver nodes.
Note, I could not find any examples for the S32G in any of the NXP Community forums or in the kernel documentation (kernel version 5.15).
Thanks for any assistance.
已解决! 转到解答。
Hi,
We apologize for the delay. We have received the following update:
"
I don't see such example in our reference bsp and I think such dts configuration is not required in our design.
Please reference to S32G reference manual on SAR ADC to see that channels mapping to ADCs are fixed which we only need to configure corresponding register to enable/consume the data.
In bsp user manual, from the SAR-ADC chapter, you can also see the operation through sysfs to enable each channel and read through its corresponding ADC buffer. And those ADC_CH_# are not multi-function pins for dts configure either.
Customer can reference to our kernel driver "s32cc_adc.c" to implement their driver (or hook to it) if needed.
"
Please, let us know.
I am using BSP 39.0 with a custom board.
Also, looking through some of the documentation, in order to obtain an iio_channel, there needs to be an established iio_map? Is the iio_map already generated in Yocto, or is this something that is required to be setup in the board dts file?
Hi,
Thanks for your feedback. On regards of the specific IIO topic, we understand that the default dts should be good enough.
As for ADC itself, the available examples are provided under the BSP39.0 User Manual for S32G2 platforms [BSP39.0 User Manual for S32G2 platforms]:
Please, let us know.
Thanks for the update and the example, but this is from sysfs user space and not for a kernel driver.
I am looking for an example that utilizes the dts file and references to obtaining data within the kernel driver.
For reference, this is what I have tried without success:
I'm not sure if I need a ROOT or a SOC node in myboard.dts file, and how to setup either? So, I am looking for an example on either, both for the dts and in the kernel driver file.
Thanks again for any additional assistance.
Hi,
Thanks for your feedback. Overall, we understand that there are no examples on regards of kernel driver modifications, just the ones available under the BSP39.0 User Manual.
We will confirm with the related team if there is any information we might be missing.
We apologize for any delay from our side.
Please, let us know.
Hi,
We apologize for the delay. We have received the following update:
"
I don't see such example in our reference bsp and I think such dts configuration is not required in our design.
Please reference to S32G reference manual on SAR ADC to see that channels mapping to ADCs are fixed which we only need to configure corresponding register to enable/consume the data.
In bsp user manual, from the SAR-ADC chapter, you can also see the operation through sysfs to enable each channel and read through its corresponding ADC buffer. And those ADC_CH_# are not multi-function pins for dts configure either.
Customer can reference to our kernel driver "s32cc_adc.c" to implement their driver (or hook to it) if needed.
"
Please, let us know.