On Fri, Jul 14, 2017 at 12:47:29PM +0200, Greg Kroah-Hartman wrote:
> On Fri, Jul 14, 2017 at 10:32:49AM +0000, Chu.Mike [朱堅宜] wrote:
> > Hi Greg,
> > 
> > This patch is for adding our new chip PL2303TB (UART, 12 GPIO, PWN)
> > PID is 2304 and GPIO function codes. Attached is datasheet. Can you
> > help us?
> 
> Adding a new device is is simple, but adding custom ioctls for gpio
> control is not ok.  That needs to tie into the gpio subsystem instead.
> I think work is ongoing with some other drivers to do this, so you
> should have some examples on the mailing list to look at.
> 
> Johan would have more details about this, Johan?

Yes, you can take a look at the cp210x driver which recently gained gpio
support for an example:

         cf5276ce7867 ("USB: serial: cp210x: Adding GPIO support for
                        CP2105")

Basically you should register one (or more) gpio chips when probing the
device while taking the current pin settings into account (e.g. don't
registers gpios for pins that are currently being used for uart
functions).

Also make sure to split this up in logical changes; for example, add
support for your new device first (e.g. vid/pid entry + whatever changes
are required to talk to the new chip), and then add gpio support on top
of that.

And just let us know if you have any further questions regarding any of
this.

Thanks,
Johan
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to