i2c: first pass at write function & some clean-up.

Quick and dirty write function. Begin the clean-up.

Doing a commit now as a sort of check point so I can
go back if my clean up leads to non-functional code.

Change-Id: Ida62e2c3a61b5569801a651e5edfc97f68e549c2