On 2012-05-25, at 22:09, Alan Stern wrote: > On Fri, 25 May 2012, [iso-8859-1] Jean-François Dagenais wrote: > >> ... >> I have my CP2112 eval kit with me and I'm ready to get started but I'd like >> some pointers to get on the right track ASAP. >> >> - as per device driver customs, which existing driver (patch or already merged) >> should be used as template? > > I don't really know. There are drivers that do roughly the same sort > of thing, but they may not be all that similar to what you want. Well, which driver has the least amount of very device specific hacks and best demonstrates the use of the HID interface? (I can probably figure that out myself too, just want an opinion here.) > >> - where does such a driver belong? I'm guessing drivers/i2c/busses/i2c-cp2112.c > > Or else under drivers/usb/misc/. You're talking about writing a driver > for a USB device that registers an i2c controller as a child, right? Right, and a gpio_chip too. > >> - would I use the same internal APIs that the IOCTLs of hiddev use for example? > > Why would you want to? You're not writing an hiddev driver -- you're > writing a USB-i2c bridge driver. I'm just saying I want to make code that would have the same interactions with the hid device as if I were to code it in user-space on top of hiddev, that's why I said that. Basically I was thinking of inspecting hiddev.c to see where it turns to to implement all it's IOCTLs. > >> - what else should I read/look-at/consider? >> >> Note that aside from i2c, the chip has GPIOs. I want to properly register those >> with the GPIO subsystem and implement an interrupt controller (like >> gpio-adp5588.c) with these GPIOs. I know it's going to have latency, but this >> would be acceptable for the i2c slaves we would put on it. Problem it, the >> CP2112 doesn't have any described feature in it's API which suggests this would >> be possible. Being a USB noob, my hardware guy told me something like "the USB >> host controller can poll the chip for what you want and report if there's a >> change". I still have some generic USB homework to do obviously, but can anyone >> push me in the right direction for this? > > That question is pretty vague. Right direction for what? I am going through the HID spec right now so I don't fully understand all the concepts yet. This is why I want to get some directions so I can focus on the right APIs quicker. I have a very limited time budget for this (so says my employer), but I want to try to get this chip in the kernel. The chip spec (link above) says it has some control reports and interrupt reports. The GPIO set and get are said to be "control" reports. All the smbus/i2c reports are in/out interrupt reports. So basically to implement an interrupt controller feature using the GPIOs, I would need a callback when the control report 0x03 ("get GPIO") of the chip changes value so I can inspect if I need to invoke a nested interrupt handler, without burdening the CPU with polling the report of course. I am told the host controller can provide such a service, is this true? If so, which API(s) must I use to get this functionality? (I don't need long explanations here, just keywords or API names, example code perhaps) > > Alan Stern > Thanks for the help!-- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html