On 07/11/16 12:17, Lars Op den Kamp wrote: > Hi Hans, > > On 11-07-16 12:02, Hans Verkuil wrote: >> Hi Lars, >> >> On 07/11/2016 11:41 AM, Lars Op den Kamp wrote: >>> Hi Hans, >>> >>> just did a quick scan of this patch. >>> >>> The code should work on any firmware >= v2 revision 8, though older >>> versions may return 0 when the build date is requested. I believe I >>> added that in v3. Might want to add a !=0 check before writing to the log. >>> >>> The CEC adapter has an "autonomous mode", used when it's not being >>> controlled by our userspace application or this kernel driver. It'll >>> respond to some basic CEC commands that allow the PC to be woken up by TV. >>> If the adapter doesn't receive a MSGCODE_PING for 30 seconds when it's >>> in "controlled mode", then it'll revert to autonomous mode and it'll >>> reset all states internally. >> Ah, that was rather obscure. Good to know. >> >> What I do now (and that seems to work) is that in the pulse8_setup I turn >> off the autonomous mode and then write that new setting to the EEPROM. After >> that it looks like the autonomous mode stays off. Is that correct? > Correct, that'll work too, but I suggest you don't do that and update the eeprom values like we do in userspace. That'll allow the adapter to wake up the PC when the kernel module isn't running. Disabling autonomous mode will prevent that from working. You can only write to the eeprom once every 10 seconds by the way. > >> >> The autonomous mode really doesn't work well with the framework as it is >> today. >> >> CEC framework support for 'wakeup on CEC command' is something that is planned >> for the future. > The autonomous mode is only really meant for waking up the PC, from S3 with the USB version and all modes with the internal version for Intel boards. It should be disabled as long as the userspace application or kernel module is running, by sending MSGCODE_SET_CONTROLLED 1 and then send a poll before the 30 second timeout times out. Then, when the kernel module stops using the module, when the system powers off or goes to standby, you send a MSGCODE_SET_CONTROLLED 0 and then close the connection. The adapter will then take over, allowing the TV to wake up the PC again. Thank you for the information, very useful. I've added this to the TODO file of the driver. I have made a pull request for the driver in the current state. It will be in drivers/staging anyway, so it doesn't have to be perfect initially. But it is very useful to 'show off' the new API for kernel 4.8. I'll work more on this driver so by the time it can be moved out of staging it should have all this functionality built-in. Regards, Hans -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html