public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Kamil Debski <k.debski@samsung.com>,
	dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org
Cc: m.szyprowski@samsung.com, mchehab@osg.samsung.com,
	kyungmin.park@samsung.com, thomas@tommie-lie.de, sean@mess.org,
	dmitry.torokhov@gmail.com, linux-input@vger.kernel.org,
	'Hans Verkuil' <hansverk@cisco.com>
Subject: Re: [RFC v3 5/9] cec: add new driver for cec support.
Date: Fri, 17 Apr 2015 14:16:59 +0200	[thread overview]
Message-ID: <5530F9BB.5010208@xs4all.nl> (raw)
In-Reply-To: <049901d075ec$7caabbc0$76003340$%debski@samsung.com>

On 04/13/2015 03:19 PM, Kamil Debski wrote:
> Hi Hans,
> 
> Thank you so much for the review. 
> 
> From: linux-media-owner@vger.kernel.org [mailto:linux-media-
> owner@vger.kernel.org] On Behalf Of Hans Verkuil
> Sent: Friday, March 20, 2015 7:08 PM
>>

<snip>

>>> +In order for a CEC adapter to be configured it needs a physical
>> address.
>>> +This is normally assigned by the driver. It is either 0.0.0.0 for a
>> TV (aka
>>> +video receiver) or it is derived from the EDID that the source
>> received
>>> +from the sink. This is normally set by the driver before enabling
>> the CEC
>>> +adapter, or it is set from userspace in the case of CEC USB dongles
>> (although
>>> +embedded systems might also want to set this manually).
>>
>> I would actually expect that USB dongles read out the EDID from the
>> source.
>> I might be wrong, though.
> 
> EDID is communicated to the device by the TV on a different bus than
> CEC, it is DDC. It is possible that the dongle also reads DDC messages.
> My initial understanding was that a CEC USB dongle handles only CEC
> messages and is passing through all other signals, such as DDC.

I checked against the libcec code (see link here: http://libcec.pulse-eight.com/)
for my usb-cec dongle and it turns out the library reads out the edid from the
monitor using xrandr (I think, see src/libcec/platform/X11/randr-edid.cpp) in
order to get the physical address. So it is not using the dongle itself for
that. Makes sense.

>  
>>> +
>>> +After enabling the CEC adapter it has to be configured. The CEC
>> adapter has
>>> +to be informed for which CEC device types a logical address has to
>> be found.
>>
>> I would say: 'a free (unused) logical address'.
>>
>>> +The CEC framework will attempt to find such logical addresses. If
>> none are
>>
>> And here: 'find and claim'
>>
>>> +found, then it will fall back to logical address Unregistered (15).
>>
>> You probably need to add some documentation regarding
>> cec_claim_log_addrs()
>> and how drivers can use it. Also, while logical addresses are being
>> claimed,
>> are drivers or userspace allowed to transmit/receive other messages? Or
>> just
>> stall until this is finished?
> 
> When sending a message the user space is free to set any source and
> destination address. Hence, I see no need to wait until the logical
> address is claimed.
> 
> If the user space is not waiting until the address and is sending
> messages, then I guess it is done with full responsibility on the user
> space.
> 
> Regarding receiving, I guess it should be possible to receive broadcast
> messages.
> 
> What do you think?

Fair enough, it just needs to be documented.

<snip>

>>> +Promiscuous mode
>>> +----------------
>>> +
>>> +The promiscuous mode enables the userspace applications to read all
>>> +messages on the CEC bus. This is similar to the promiscuous mode in
>>> +network devices. In the normal mode messages not directed to the
>> device
>>> +(differentiated by the logical address of the CEC device) are not
>>> +forwarded to the userspace. Same rule applies to the messages
>> contailning
>>> +remote control key codes. When promiscuous mode is enabled all
>> messages
>>> +can be read by userspace. Processing of the messages is still done,
>> thus
>>> +key codes will be both interpreted by the framework and available as
>> an
>>> +input device, but also raw messages containing these codes are sent
>> to
>>> +the userspace.
>>
>> Will messages that are processed by the driver or cec framework also be
>> relayed to userspace in promiscuous mode? Will userspace be able to
>> tell
>> that it has been processed already?
> 
> All messages will be relayed to the user space and no there is no
> possibility
> to check whether the message was processed by the kernel already.

Should we add that? To be honest, I'm not sure about that myself.

Once thing I notice is that there are no reserved fields at the end of
struct cec_msg. We should add that. Same with the other structs. It served
us well with v4l2, and we should do the same with the cec API.

Another upcoming problem is the use of struct timespec: this will have
to change in the near future to one that is year 2038-safe. Unfortunately,
there is no public 'struct timespec64' type yet. This mailinglist might
provide answers w.r.t. the precise plans with timespec:
http://lwn.net/Articles/640284/

Also, we don't have 32-bit compat code for CEC. I wonder if it is a good
idea to improve the layout of the structs to minimize 64/32-bit layout
differences. I never paid attention to that when I made these structs as
I always planned to do that at the end.

Regards,

	Hans

  reply	other threads:[~2015-04-17 12:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-20 16:52 [RFC v3 0/9] HDMI CEC framework Kamil Debski
2015-03-20 16:52 ` [RFC v3 1/9] dts: add hdmi-cec to to pinctrl definitions Kamil Debski
2015-03-20 16:52 ` [RFC v3 2/9] dts: add s5p-cec to exynos4412-odroidu3 Kamil Debski
2015-03-20 16:52 ` [RFC v3 3/9] Input: add key codes specific to the HDMI CEC bus Kamil Debski
2015-03-20 16:52 ` [RFC v3 4/9] rc: add a map for devices communicating over " Kamil Debski
2015-03-20 16:52 ` [RFC v3 5/9] cec: add new driver for cec support Kamil Debski
2015-03-20 18:08   ` Hans Verkuil
2015-04-13 13:19     ` Kamil Debski
2015-04-17 12:16       ` Hans Verkuil [this message]
2015-04-20 13:10         ` Kamil Debski
2015-03-20 16:52 ` [RFC v3 6/9] v4l2-subdev: add cec ops Kamil Debski
2015-03-20 16:52 ` [RFC v3 7/9] adv7604: add cec support Kamil Debski
2015-03-20 16:52 ` [RFC v3 8/9] adv7511: " Kamil Debski
2015-03-20 16:52 ` [RFC v3 9/9] s5p-cec: Add s5p-cec driver Kamil Debski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5530F9BB.5010208@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=dmitry.torokhov@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hansverk@cisco.com \
    --cc=k.debski@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=mchehab@osg.samsung.com \
    --cc=sean@mess.org \
    --cc=thomas@tommie-lie.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox