This is dirt simple, so please don't kill me.

I am new to linux drivers and want see if my approach is correct
here. I need to write a little bit banging device driver to a custom
CPLD 3-Wire serial interface. This is a one way communication meaning
we are only writing to the device over the serial interface.

So, I think what i need to do is write a character driver will
implement an open, release, and write methods and of course the init
and exit to setup the character driver. Is the correct approach?

In my write method in the driver, when i receive the 3 bytes of data
that I need to bit-bang over 3 gpios I will enable the chip select
gpio and start the clocking gpio and transmitting the the bits on the
data gpio.

Anyone have a sample driver of something similar? I just basically
want to see how the correct way to implement the timer for the clock
in the kernel. I am sure I can figure it out and will, but would like
to see an example from someone who is not as new to linux as I am.

i know the pseudo code is something like the following, but maybe a
timer (i assume there are timers in the kernel) is the better approach
which is the whole reason I am asking about this.

bbserial_write(....)
{
enable the chip select gpio (set low)
while (bits to write)
{
set clk gpio low
wait 1/2 bit time
set data gpio
wait 1/2 bit time
set clk gpio high
}
disable the chip select gpio (set high)
}