<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: IIO ADC example code for kernel driver in S32G</title>
    <link>https://community.nxp.com/t5/S32G/IIO-ADC-example-code-for-kernel-driver/m-p/1896842#M7401</link>
    <description>&lt;P&gt;I am using BSP 39.0 with a custom board.&lt;/P&gt;&lt;P&gt;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?&lt;/P&gt;</description>
    <pubDate>Mon, 01 Jul 2024 18:35:54 GMT</pubDate>
    <dc:creator>Tony-FM-Eng</dc:creator>
    <dc:date>2024-07-01T18:35:54Z</dc:date>
    <item>
      <title>IIO ADC example code for kernel driver</title>
      <link>https://community.nxp.com/t5/S32G/IIO-ADC-example-code-for-kernel-driver/m-p/1895446#M7359</link>
      <description>&lt;P&gt;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?&lt;/P&gt;&lt;P&gt;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,&lt;BR /&gt;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.&lt;/P&gt;&lt;P&gt;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).&lt;/P&gt;&lt;P&gt;Thanks for any assistance.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2024 22:22:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32G/IIO-ADC-example-code-for-kernel-driver/m-p/1895446#M7359</guid>
      <dc:creator>Tony-FM-Eng</dc:creator>
      <dc:date>2024-06-27T22:22:16Z</dc:date>
    </item>
    <item>
      <title>Re: IIO ADC example code for kernel driver</title>
      <link>https://community.nxp.com/t5/S32G/IIO-ADC-example-code-for-kernel-driver/m-p/1896013#M7375</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Can you let us know which BSP version are you working with?&lt;/P&gt;
&lt;P&gt;Also, are you using any NXP reference board? Or is this a custom board?&lt;/P&gt;
&lt;P&gt;Please, let us know.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2024 15:41:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32G/IIO-ADC-example-code-for-kernel-driver/m-p/1896013#M7375</guid>
      <dc:creator>Daniel-Aguirre</dc:creator>
      <dc:date>2024-06-28T15:41:49Z</dc:date>
    </item>
    <item>
      <title>Re: IIO ADC example code for kernel driver</title>
      <link>https://community.nxp.com/t5/S32G/IIO-ADC-example-code-for-kernel-driver/m-p/1896842#M7401</link>
      <description>&lt;P&gt;I am using BSP 39.0 with a custom board.&lt;/P&gt;&lt;P&gt;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?&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2024 18:35:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32G/IIO-ADC-example-code-for-kernel-driver/m-p/1896842#M7401</guid>
      <dc:creator>Tony-FM-Eng</dc:creator>
      <dc:date>2024-07-01T18:35:54Z</dc:date>
    </item>
    <item>
      <title>Re: IIO ADC example code for kernel driver</title>
      <link>https://community.nxp.com/t5/S32G/IIO-ADC-example-code-for-kernel-driver/m-p/1897593#M7413</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Thanks for your feedback. On regards of the specific IIO topic, we understand that the default dts should be good enough.&lt;/P&gt;
&lt;P&gt;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]:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DanielAguirre_0-1719932262044.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/286669i21F1235F26F391EA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DanielAguirre_0-1719932262044.png" alt="DanielAguirre_0-1719932262044.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Please, let us know.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2024 14:58:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32G/IIO-ADC-example-code-for-kernel-driver/m-p/1897593#M7413</guid>
      <dc:creator>Daniel-Aguirre</dc:creator>
      <dc:date>2024-07-02T14:58:06Z</dc:date>
    </item>
    <item>
      <title>Re: IIO ADC example code for kernel driver</title>
      <link>https://community.nxp.com/t5/S32G/IIO-ADC-example-code-for-kernel-driver/m-p/1897620#M7415</link>
      <description>&lt;P&gt;Thanks for the update and the example, but this is from sysfs user space and not for a kernel driver.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am looking for an example that utilizes the dts file and references to obtaining data within the kernel driver.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For reference, this is what I have tried without success:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;In myboard.dts&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Using this as a ROOT node?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;amp;adc0 {&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;#io-channel-cells = &amp;lt;1&amp;gt;;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;status = "okay";&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;adc0_capture {status = "okay";&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;compatible = "my-adc-driver";&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;io-channels = &amp;lt;&amp;amp;adc0 3&amp;gt;;&lt;/DIV&gt;&lt;DIV&gt;};&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Or using the following as a SOC node?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;iio_map {&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ch0 {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; nxp,adc-channel-number = &amp;lt;0x0&amp;gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; nxp,adc-consumer-device = "adc-input.1";&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; nxpi,adc-consumer-channel = "vin1";&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; };&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ch1 {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;nxp,adc-channel-number = &amp;lt;0x1&amp;gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;nxp,adc-consumer-device = "adc-input.2";&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;nxp,adc-consumer-channel = "vin2";&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; };&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;};&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;In my_adc_driver.c:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;// Get the instance of the channel from iio_map?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;iio_channel *adc_vin1= iio_channel_get(&amp;amp;pdev-&amp;gt;dev, "ch0");&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;// Read ADC value &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ret = iio_read_channel_raw(adc_vin1, &amp;amp;value);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;Thanks again for any additional assistance.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2024 15:55:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32G/IIO-ADC-example-code-for-kernel-driver/m-p/1897620#M7415</guid>
      <dc:creator>Tony-FM-Eng</dc:creator>
      <dc:date>2024-07-02T15:55:27Z</dc:date>
    </item>
    <item>
      <title>Re: IIO ADC example code for kernel driver</title>
      <link>https://community.nxp.com/t5/S32G/IIO-ADC-example-code-for-kernel-driver/m-p/1897678#M7416</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;We will confirm with the related team if there is any information we might be missing.&lt;/P&gt;
&lt;P&gt;We apologize for any delay from our side.&lt;/P&gt;
&lt;P&gt;Please, let us know.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2024 17:14:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32G/IIO-ADC-example-code-for-kernel-driver/m-p/1897678#M7416</guid>
      <dc:creator>Daniel-Aguirre</dc:creator>
      <dc:date>2024-07-02T17:14:57Z</dc:date>
    </item>
    <item>
      <title>Re: IIO ADC example code for kernel driver</title>
      <link>https://community.nxp.com/t5/S32G/IIO-ADC-example-code-for-kernel-driver/m-p/1899609#M7442</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;We apologize for the delay. We have received the following update:&lt;/P&gt;
&lt;P&gt;"&lt;/P&gt;
&lt;P&gt;I don't see such example in our reference bsp and I think such dts configuration is not required in our design.&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;Customer can reference to our kernel driver "s32cc_adc.c" to implement their driver (or hook to it) if needed.&lt;/P&gt;
&lt;P&gt;"&lt;/P&gt;
&lt;P&gt;Please, let us know.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2024 14:17:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32G/IIO-ADC-example-code-for-kernel-driver/m-p/1899609#M7442</guid>
      <dc:creator>Daniel-Aguirre</dc:creator>
      <dc:date>2024-07-04T14:17:25Z</dc:date>
    </item>
    <item>
      <title>Re: IIO ADC example code for kernel driver</title>
      <link>https://community.nxp.com/t5/S32G/IIO-ADC-example-code-for-kernel-driver/m-p/1909946#M8735</link>
      <description>As per the suggestion, I decided to implement some of the ADC code from NXP's "s32cc_adc.c" Linux driver into my new driver.</description>
      <pubDate>Tue, 16 Jul 2024 17:20:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32G/IIO-ADC-example-code-for-kernel-driver/m-p/1909946#M8735</guid>
      <dc:creator>Tony-FM-Eng</dc:creator>
      <dc:date>2024-07-16T17:20:24Z</dc:date>
    </item>
  </channel>
</rss>

