<p dir="ltr"><br>
On Nov 10, 2013 4:20 AM, &quot;sanchayan maity&quot; &lt;<a href="mailto:victorascroft@gmail.com">victorascroft@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt; @Peter <br>
&gt;<br>
&gt; Yes, i have read that. It says directly addressable but it&#39;s not like i can access those addresses straight from user space. So how do i access them . In the above case how do i access the register of the wm97 codec ic which is on an AC97 bus? <br>

&gt;<br>
&gt; @Anish<br>
&gt;<br>
&gt; Yes, wm97xx-core is a touch driver falling in the input subsystem. Though i did not look at the input core, but, i guess the touch screen functionality is provided that way as it includes the input.h file. <br>
&gt;<br>
&gt; Your suggestion is not exactly clear. I understand i have to write a kernel module. I guess the functions you are referring to are already exported by that driver code. <br>
Call those in your driver and you are done.<br>
&gt; ----------------------------------------------------------------------------------------------------------------------------------------<br>
&gt;<br>
&gt; For my case, i was interested in reading the ADC values using four auxiliary ADC&#39;s provided by the WM97 codec IC. If you look at the driver code file, it has a function for reading the WM97 registers as well as the auxiliary ADC&#39;s. I wanted to use them. <br>

&gt;<br>
&gt; My specific question is how do i write a driver using this wm97xx_core.c to read the auxiliary ADC&#39;s?<br>
&gt;<br>
&gt; My general question will be how does a device use a platform driver to provide any kind of read write functionality access to it&#39;s register or any other functionality. </p>
<p dir="ltr">In your case it justs report those values to input core.If you want to read/write then you need to explicitly make a new driver as char driver and call read/write when you are told by userspace.<br>
&gt;<br>
&gt; A character driver provides explicit read write functions which are used through an open /dev node. How do i do something similar using a platform driver like the one above? <br>
&gt;<br>
&gt; Thanks &amp; Regards,<br>
&gt; Sanchayan.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; On Sun, Nov 10, 2013 at 2:02 AM, anish singh &lt;<a href="mailto:anish198519851985@gmail.com">anish198519851985@gmail.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; On Nov 9, 2013 4:18 AM, &quot;sanchayan maity&quot; &lt;<a href="mailto:victorascroft@gmail.com">victorascroft@gmail.com</a>&gt; wrote:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Can someone give me some pointers or tell me as to how can one use a platform driver for reading and writing?<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; For example, if i have a wm97xx codec IC, a core platform driver is provided (as on the below link). <br>
&gt;&gt; &gt; <a href="http://lxr.free-electrons.com/sourcep/drivers/input/touchscreen/wm97xx-core.c">http://lxr.free-electrons.com/sourcep/drivers/input/touchscreen/wm97xx-core.c</a><br>
&gt;&gt; This is a touch driver\input driver.<br>
&gt;&gt; So this driver comes under input subsystem.It interacts with input core to send events to it using report api&#39;s.<br>
&gt;&gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; If i wanted to use this core driver to read the auxilary ADC&#39;s of wm97xx codec how do i go about using the register read, write functions or read auxiliary adc functions provided by this driver file? <br>

&gt;&gt; What is the original problem you are trying to solve?You can do read\write just by a small hack.Write a kernel module and make the read\write function in this driver as exported.Use those in your own driver but make sure you export other variables also to give the right inputs for those api&#39;s.I am sure you are just looking for writing a device driver by doing an actual read\write.Remember this will just be a bad code i.e. hack.<br>

&gt;&gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; I have gone through the documentation provided here <a href="http://lxr.free-electrons.com/source/Documentation/driver-model/">http://lxr.free-electrons.com/source/Documentation/driver-model/</a> but it is still not clear to me. I understand the concept of why a platform driver is required and how each device registers itself with the pseudo platform bus, but, i do not understand how to use such a driver or make my driver based on it and then use it for reading/writing. <br>

&gt;&gt; &gt;<br>
&gt;&gt; &gt; I understand character device drivers but, i am at a loss when it comes to understand these platform drivers. I come from embedded domain and these drivers seem are ubiquitous. <br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Thanks. <br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; _______________________________________________<br>
&gt;&gt; &gt; Kernelnewbies mailing list<br>
&gt;&gt; &gt; <a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
&gt;&gt; &gt; <a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
&gt;&gt; &gt;<br>
&gt;<br>
&gt;<br>
</p>