Commit graph

589809 commits

Author SHA1 Message Date
Jean Delvare
10d295f458 [media] cec: fix Kconfig help text
MEDIA_CEC is no longer a tristate option, so the user can't actually
choose M. Whether the code is built-in or built as a module is
decided somewhere else.

Fixes: 5bb2399a4fe4 ("[media] cec: fix Kconfig dependency problems")

Change-Id: Ib996ee20c4063e01658fc8f842319bb703d855db
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: a58d1191ca04ffa8b14dcda5df0c87a2a642d3c7
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-25 11:22:12 +08:00
Hans Verkuil
e285adf424 [media] cec: fix ioctl return code when not registered
Don't return the confusing -EIO error code when the device is not registered,
instead return -ENODEV which is the proper thing to do in this situation.

Change-Id: Iaf12028cfe4d8b58d4fb09ff06ce680769188d16
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: 60815d4a78204915f5cdf79a536bc96d5d23ae5f
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-25 11:22:11 +08:00
Hans Verkuil
4901a43583 [media] cec: don't Feature Abort broadcast msgs when unregistered
If the adapter is configured as 'Unregistered', then cec_receive_notify
incorrectly thinks that broadcast messages are directed messages. The
destination for broadcast messages is 0xf, and the logical address
assigned to Unregistered devices is also 0xf and the logic didn't handle
that correctly.

Change-Id: Idaedf31ec471b5d4bbc982b714e1c08e4935ec6c
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: a179b69359feb26ddb148bb6a2c0c53a8d1dc5be
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-25 11:22:11 +08:00
Johan Fjeldtvedt
98e53e0449 [media] cec: allow configuration both from within driver and from user space
It makes sense for adapters such as the Pulse-Eight to be configurable
both from within the driver and from user space, so remove the
requirement that drivers only can call cec_s_log_addrs or
cec_s_phys_addr if they don't expose those capabilities to user space.

Change-Id: I5780af75ef005dc3d345ee981cb8289d898c997f
Signed-off-by: Johan Fjeldtvedt <jaffe1@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: a2fdc9df5e02ac3ab91d7888372cbe9512273171
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-25 11:22:10 +08:00
Markus Elfring
621f559c73 [media] cec: Delete an unnecessary check before the function call "rc_free_device"
The rc_free_device() function tests whether its argument is NULL
and then returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Change-Id: I97bf16b32365189255fd50973e330f7b8de30f32
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: d8eddb15e4e436ec44464783687f0057a38fb013
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-25 11:22:10 +08:00
Hans Verkuil
a90ab17785 [media] cec-funcs.h: add missing vendor-specific messages
The cec-funcs.h header was missing support for these three vendor-specific messages:

CEC_MSG_VENDOR_COMMAND
CEC_MSG_VENDOR_COMMAND_WITH_ID
CEC_MSG_VENDOR_REMOTE_BUTTON_DOWN

Add wrappers for these messages.

I originally postponed adding these wrappers due to the fact that the argument is
just a byte array which cec-ctl couldn't handle at the time, and then I just forgot
to add them once the CEC framework was finalized.

It wasn't until an attempt to transmit a vendor specific command was made that I
realized that these wrappers were missing.

Change-Id: I0fb17f79f179310110310d372513aea475970054
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: 4808f721627c2a23b5d749f9bbd20d4529ea2b8d
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-25 11:22:09 +08:00
Hans Verkuil
ffd4fa2c1c [media] cec-edid: check for IEEE identifier
The cec_get_edid_spa_location() function did not verify that the IEEE
identifier in the Vendor Specific Data Block matched the HDMI-LLC
identifier. This could result in the wrong VSDB block being returned.

For example, for HDMI 2.0 EDIDs there is also a HDMI Forum VSDB.

So check the IEEE identifier as well.

Change-Id: I4e8ea260ffd38846ec977a0a6c6b855afa2edeec
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: 8ac6a1a53e9f195e8c4336a7edfba2e102fc14bb
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-25 11:22:08 +08:00
Hans Verkuil
14af6dc683 [media] cec: ignore messages when log_addr_mask == 0
Most CEC adapters will still receive broadcast messages, even if no logical
addresses are claimed. But those messages should only be passed on for
monitoring purposes, but not for processing by either kernel or userspace
if userspace didn't call CEC_ADAP_S_LOG_ADDRS first.

So if adap->log_addrs.log_addr_mask is 0, then just return before passing
the received message on to the processing code.

Change-Id: I2f7099c4f67db9f3f83ebeb181ad2956099c29ab
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: 3e92d8b238e48dfb539e8112bb2cc463e35e1b71
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-25 11:22:08 +08:00
Hans Verkuil
96c5a32e58 [media] cec: add item to TODO
Change-Id: Ie7d8cbc24df16887abca783defaf4796558a5701
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: 260ff1144a9dd1afb85cf5da462672d68412cbc4
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-25 11:22:07 +08:00
Hans Verkuil
bbb3e5fd19 [media] cec: set unclaimed addresses to CEC_LOG_ADDR_INVALID
Up to 4 logical addresses can be claimed. Make sure that any
unclaimed logical addresses are set to CEC_LOG_ADDR_INVALID as
per the documentation.

Take special care in the unregistered case: when falling back to
unregistered num_log_addrs may be > 1, so mark those as invalid.

Change-Id: Ice29d220b658a942ddbec09afc89777178681904
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: 0c1d61b0e4ed68d125b21fed375c38b6e3c2a658
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-25 11:22:07 +08:00
Hans Verkuil
a86a0e6978 [media] cec: add CEC_LOG_ADDRS_FL_ALLOW_UNREG_FALLBACK flag
Currently if none of the requested logical addresses can be claimed, the
framework will fall back to the Unregistered logical address.

Add a flag to enable this explicitly. By default it will just go back to
the unconfigured state.

Usually Unregistered is not something you want since the functionality is
very limited. Unless the application has support for this, it will fail
to work correctly. So require that the application explicitly requests
this.

Change-Id: Ic658a6cf7bdd127172701a5a5354222dbacdc7ea
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: dcceb1eaf210096831b14471bc87678375b086ed
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
[rayz@codeaurora.org: remove the documents in original patch to fix conflicts]
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-25 11:22:06 +08:00
Hans Verkuil
ddce08c665 [media] cec-funcs.h: add reply argument for Record On/Off
A reply parameter is added to the cec_msg_record_on/off functions in
cec-funcs.h. The standard mandates that Record Status shall be replied
to Record On, and it may be replied to Record Off.

Change-Id: Ic143eb3706b4da9d414390b14ab93307eec25a40
Signed-off-by: Johan Fjeldtvedt <jaffe1@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: 31dc8b7302f1e48952ec8e90cd49dca843146cd0
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-25 11:22:06 +08:00
Hans Verkuil
3079fa0f0b [media] cec-funcs.h: fix typo: && should be &
Fix typo where logical AND was used instead of bitwise AND.

Change-Id: Ic184559541646f87052b78d54efedcd1b0a2ce40
Reported-by: David Binderman <linuxdev.baldrick@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: 9ebf1945d757433a089ab3ee940673503e3e11ec
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-25 11:22:05 +08:00
Hans Verkuil
f7d8be4b2c [media] cec: improve locking
- The global lock was used in cec_get_device when it should have
  used the devnode lock.
- cec_put_device also took the global lock, but since the release
  function takes that lock as well this could lead to a deadlock.
  Just don't take the lock here since there is no reason for it.
- cec_devnode_register() should take the global lock when clearing
  the bit in the global bitmap.
- In cec_devnode_unregister() place the devnode->(un)register tests
  and assignments under the devnode lock as well: this has to be
  in a critical block.

Change-Id: I229e6136937003f99153028d12780c0162620bef
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: 2ab25d35a91098ef0f42d478cc37f6a5591a4ab0
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-25 11:22:05 +08:00
Hans Verkuil
6c7199a66e [media] cec: rename cec_devnode fhs_lock to just lock
This lock will be used to protect more than just the fhs list.
So rename it to just 'lock'.

Change-Id: I6a2623b1231154be2a4d764ad2086fc73015a3af
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: 62148f0930a8e9bd5c5614f8387222f0220d7d47
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-25 11:22:05 +08:00
Hans Verkuil
4b2e6bd1d6 [media] cec: fix off-by-one memset
The unused bytes of the features array should be zeroed, but the start index was one
byte too early. This caused the device features byte to be overwritten by 0.

The compliance test for the CEC_S_LOG_ADDRS ioctl didn't catch this because it tested
byte continuation with the second device features byte being 0 :-(

Change-Id: Ibe07ad9376fa7bebed57c99892ce0e5520cfa170
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: 292eaf50c7df4ae2ae8aaa9e1ce3f1240a353ee8
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-25 11:22:04 +08:00
Hans Verkuil
5a129a6e4a [media] cec: always check all_device_types and features
Even when the adapter is configured for CEC 1.4, we still check and
use the CEC 2.0 parts of struct cec_log_addrs. Although these aren't
used in CEC messages, the information contained in them is still of
use in the CEC framework itself, so keep this information.

Also zero the unused trailing features[] data and unused logical address
data so the contents isn't random data.

Change-Id: Id8f226b730188b72abe0e81a50d540beee9418e2
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: 009a620848218d521f008141c62f56bf19294dd9
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-25 11:22:04 +08:00
Hans Verkuil
fd4d3bb6fe [media] cec: poll should check if there is room in the tx queue
For POLLOUT poll only checked if the adapter was configured, not
if there was room in the transmit queue. Add that check.

Change-Id: I56fc0585999f4c5ac313305fe43c54a2a1592879
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: b7cbc892532316f2abd880186301e57239a17f28
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-25 11:22:03 +08:00
Hans Verkuil
69333ef727 [media] cec: fix test for unconfigured adapter in main message loop
The main message loop checks if the physical address was valid, and if
not it is assumed that the adapter had been unconfigured.

However, this check is no longer correct, instead it should check
that both adap->is_configured and adap->is_configuring are false.

Change-Id: I178c46bf4e7f2324786a26e4c50d31899c866bc6
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: 58ecc29b5e829c2072fe3a98a93ef163bdb36dd9
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-25 11:22:03 +08:00
Hans Verkuil
4f7db561ed [media] cec: limit the size of the transmit queue
The size of the transmit queue was unlimited, which meant that
in non-blocking mode you could flood the CEC adapter with messages
to be transmitted.

Limit this to 18 messages.

Also print the number of pending transmits and the timeout value
in the status debugfs file.

Change-Id: I5cdadee7854e62d5a823b7dc53448860ba73228a
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: 11065f8531ed33d5e847a36ad64231ee599d4996
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-25 11:22:02 +08:00
Hans Verkuil
4b7d386d20 [media] cec: zero unused msg part after msg->len
Ensure that the unused part of the msg array is zeroed. This is
required by CEC 2.0 when receiving shorter messages than expected.
In that case the remaining bytes are assumed to be 0.

There are no such CEC messages yet, but it is required to be future proof.

And since we're doing it for received messages, do it for transmitted
messages as well. It's unambiguous this way.

Change-Id: I780888724448c24f432c5d9753d6c5289f725682
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: 045344c3c1478f8d03a1a589d645fe10c3a23f77
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-25 11:22:02 +08:00
Hans Verkuil
e55c38515a [media] cec: don't set fh to NULL in CEC_TRANSMIT
The filehandle was set to NULL when in non-blocking mode or when
no reply is needed.

This is wrong: the filehandle is needed in non-blocking mode to ensure
that the result of the transmit can be obtained through CEC_RECEIVE.

And the 'reply' check was also incorrect since it should have checked the
timeout field (the reply can be 0). In any case, when in blocking mode
there is no need to set the fh to NULL either.

Change-Id: I8225959283d34f9a44439ab34ee291b87b5d4922
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: 4eef404fd91543dc82be2bd05d3b29919ec6c0e6
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-25 11:22:01 +08:00
Hans Verkuil
60238b2dd3 [media] cec: clear all status fields before transmit and always fill in sequence
Before transmitting a message clear all status fields and always fill
in the sequence number. Make sure the sequence number is never 0.

Change-Id: Ia8ad9b79935cad0e88371f00137a59326a336ffc
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: 40df3a7e586df59190547fe0e7d9928da735eada
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-25 11:22:01 +08:00
Hans Verkuil
a743a520d1 [media] cec: CEC_RECEIVE overwrote the timeout field
When CEC_RECEIVE returns a message the original timeout field
was overwritten. Restore the timeout field.

Change-Id: Ida65e37e1424745e3e4cf9d0108e10dc75e642ed
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: e883b4d02670ae83ab24e9af969de1af756959f8
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-25 11:22:00 +08:00
Hans Verkuil
b58d42ad60 [media] cec/TODO: drop comment about sphinx documentation
The CEC documentation has been converted to sphinx, so this
TODO item can be dropped.

Change-Id: I7a0fa38382a5533fd9e3643613d63595881b2b78
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: bddb4952506d0e84c443a04840143ea98b610557
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-25 11:22:00 +08:00
Hans Verkuil
5ab280ffae [media] cec: set timestamp for selfie transmits
Attempts to send CEC messages to yourself are detected in the framework and
returned with a NACK error. However, the tx_ts was never filled in that case.
So just set it.

Change-Id: Ifd8be78030778d3d99b88b353905879c2079c2c5
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: 9a3f14ea802fd0d8848d8e16566b769e4ce09d68
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-25 11:21:59 +08:00
Hans Verkuil
a293351e1c [media] cec: don't zero reply and timeout on error
There is really no reason to zero the reply and timeout fields if an
error occurs. This is a left-over from earlier versions where that
was used to signal errors, but this is now handled by the rx/tx_status
fields.

Change-Id: I2064f6b2dcb3affe4097ebdf7270eb8c6bc7e21d
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: 86e3577f11d0aa8a5d3c6199f9e3f23cdbd0c0ac
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-25 11:21:59 +08:00
Hans Verkuil
72b6c6a39f [media] cec: split the timestamp into an rx and tx timestamp
When transmitting a message and waiting for a reply it would be good
to know the time between when the message was transmitted and when
the reply arrived. With only one timestamp field it was set to when
the reply arrived and the original transmit time was overwritten.

Just taking the timestamp in userspace right before CEC_TRANSMIT is
called is not reliable, since the actual transmit can be delayed if
the CEC bus is busy. Only the driver can fill this in accurately.

So split up the ts field into an rx_ts and a tx_ts. Also move the
status fields to after the 'reply' field: they were placed in a
strange position and make much more sense when grouped with the
other status-related fields.

This patch also makes sure that the timestamp is taken as soon as
possible.

Change-Id: I643006cc32cbc6073b6ce8fa7ae03b63b3b0e266
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: 980e0b36b55985dd0a37acd25d29c8f21482db32
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-25 11:21:58 +08:00
Hans Verkuil
61423ca8a0 [media] cec: add sanity check for msg->len
Check (and warn) if the msg->len is too long or if it is 0.

Should never happen, but just in case...

Change-Id: I784aca0acdc74511b42b51ae01e57be0c04799b1
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: 52d802d65b56a399aa67a9d3f26f232116d3e256
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-25 11:21:58 +08:00
Andrew Morton
185a8562ea [media] cec-adap.c: work around gcc-4.4.4 anon union initializer bug
drivers/staging/media/cec/cec-adap.c: In function 'cec_queue_msg_fh':
drivers/staging/media/cec/cec-adap.c:141: error: unknown field 'lost_msgs' specified in initializer

Fixes: 9881fe0ca187c21 ("[media] cec: add HDMI CEC framework (adapter)")

Change-Id: I5e577cde445313876f3615666df8274d82a8e6b5
Cc: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Kamil Debski <kamil@wypas.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: 6a91d60aba671cf8756a56d6157a9c971d2a5222
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-25 11:21:57 +08:00
Hans Verkuil
0df37e07fd [media] cec: CEC_RECEIVE is allowed in monitor mode
When the device is in monitor mode, then you should always be able to
call CEC_RECEIVE, even it the device is unconfigured.

Change-Id: I1d11a8cbb26d19197b7f3a4a77ed8d6ce00f1853
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: ca00033c9fc8b5f178573a76887c89296ed5b398
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-25 11:21:57 +08:00
Hans Verkuil
468ef730e2 [media] cec: add check if adapter is unregistered
CEC USB dongles can be unplugged at any time, and at that point they will
be unregistered. Make sure that any attempt afterwards to set the physical
or logical addresses will be ignored.

Change-Id: If15d1e3f3447c6a844eaee27cfdfd65a3341062e
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: c000e5dad17d20c644bbf3ead52c334025d11ada
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-25 11:21:57 +08:00
Hans Verkuil
ae758ae16b [media] cec-funcs.h: add missing 'reply' for short audio descriptor
The cec_msg_request_short_audio_descriptor function was missing the reply
argument. That's needed if you want the framework to wait for the reply
message.

Change-Id: Id099aa3ec932beb7d49af56cd9f761ee66b2727e
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: 9ad52b4db79d168867a2ca105eca00fb9cb28fe5
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-25 11:21:56 +08:00
Hans Verkuil
dd752bd97b [media] cec-funcs.h: add missing const modifier
The cec_ops_* functions never touch cec_msg, so mark it as const.

This was done for some of the cec_ops_ functions, but not all.

Change-Id: Ibf4c85faac86588e937107bd1bc7648841060bab
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: 0c1f8569942695b7a2735301efe45ecd69e2a41f
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-25 11:21:56 +08:00
Hans Verkuil
0b7113df06 [media] cec-funcs.h: add length checks
Add msg->len sanity checks to fix static checker warning:

	include/linux/cec-funcs.h:1154 cec_ops_set_osd_string()
	warn: setting length 'msg->len - 3' to negative one

Change-Id: I3482a21f7e29b1b9f44832e598a86709f8764fe5
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: 0cb1f1e44cf5b013dd0991f509e332ac77ce2ddd
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-25 11:21:55 +08:00
Hans Verkuil
6ab0437744 [media] cec: fix Kconfig dependency problems
- Use IS_REACHABLE(RC_CORE) instead of IS_ENABLED: if cec is built-in and
  RC_CORE is a module, then CEC can't reach the RC symbols.
- Both cec and cec-edid should be bool and use the same build 'mode' as
  MEDIA_SUPPORT (just as is done for the media controller code).
- Add a note to staging that this should be changed once the cec framework
  is moved out of staging.

Change-Id: If084eab2c2bbca7b9fa5b8959b27b1894b8ec2b7
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: 5bb2399a4fe4a1703c1497b4838c5e8e869d0822
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-24 20:10:50 -07:00
Arnd Bergmann
9c77a6b3b9 [media] cec: add MEDIA_SUPPORT dependency
The MEDIA_CEC_EDID option is guarded by MEDIA_SUPPORT, so selecting
it from MEDIA_CEC produces a warning:

warning: (MEDIA_CEC) selects MEDIA_CEC_EDID which has unmet direct dependencies (MEDIA_SUPPORT)

The warning is harmless, but it's better to add an explicit
dependency to shut it up, to reduce the noise during randconfig
builds.

Fixes: ca684386e6e2 ("[media] cec: add HDMI CEC framework (api)")

Change-Id: I637ceabfcc8f311f8ca723671f954e1db060c965
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: ea8c535e30c1066a0bf8acb2d39bb3c4e643a034
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-24 20:10:38 -07:00
Hans Verkuil
f71e3abc16 [media] cec-adap: prevent write to out-of-bounds array index
CEC_MSG_REPORT_PHYSICAL_ADDR can theoretically be received from
an unregistered device, but in that case the code should not attempt
to write the received physical address to the phys_addrs array.

That would be pointless since there can be multiple unregistered
devices that report a physical address. We just ignore those.

While at it, improve the dprintk since it would attempt to read
from that array as well with the same out-of-bounds problem.

Change-Id: Ic4e969669cadd3e9f59a587d7d075e130f5cd869
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: f8db65fe4336baf818dde5d226eb3d35773e2371
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-24 20:10:26 -07:00
Hans Verkuil
d6ffac796e [media] cec.h/cec-funcs.h: add option to use BSD license
Like the videodev2.h and other headers, explicitly allow these headers
to be used with the BSD license.

Change-Id: I8f9ae52ed90337ca1f697dbf310a774f50eb154d
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: 12655445a2adc292db3352bbe80e43bd243517aa
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-24 20:10:14 -07:00
Hans Verkuil
7dbff1a435 [media] cec-adap: on reply, restore the tx_status value from the transmit
When a reply to an earlier transmit is received, the tx_status of that
transmit needs to be restored. Otherwise the status that the transmit
was successful would be lost.

Change-Id: I53fac6d2346a88a8f93503952bd9e2c3c9bae5e6
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: 7b12b47f78e458ea90cc350bc7a4b9385eef897a
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-24 20:09:52 -07:00
Hans Verkuil
d880cf55fb [media] cec/TODO: add TODO file so we know why this is still in staging
Explain why cec.c is still in staging.

Change-Id: I1ff8da66df09e8e25dc8d4c8d787a9e3d14ce48c
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: 56967c77d4c22bb31dbf18cc058147f4df433dd7
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-24 18:48:06 -07:00
Hans Verkuil
97dc968939 [media] cec: add HDMI CEC framework (api)
The added HDMI CEC framework provides a generic kernel interface for
HDMI CEC devices.

Note that the CEC framework is added to staging/media and that the
cec.h and cec-funcs.h headers are not exported yet. While the kABI
is mature, I would prefer to allow the uABI some more time before
it is mainlined in case it needs more tweaks.

This adds the cec-api.c source that deals with the public CEC API
and the Kconfig/Makefile plumbing.

The MAINTAINERS file is also updated.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
[k.debski@samsung.com: code cleanup and fixes]
Signed-off-by: Kamil Debski <kamil@wypas.org>

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: ca684386e6e21ba1511061f71577cdb6c3f2b3d3
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Change-Id: Ie0ac63f18e51cab0e920f9c6c618563faf57a83c
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-25 09:37:45 +08:00
Hans Verkuil
7b51cde1bb [media] cec: add HDMI CEC framework (adapter)
The added HDMI CEC framework provides a generic kernel interface for
HDMI CEC devices.

Note that the CEC framework is added to staging/media and that the
cec.h and cec-funcs.h headers are not exported yet. While the kABI
is mature, I would prefer to allow the uABI some more time before
it is mainlined in case it needs more tweaks.

This adds the cec-adap.c source that deals with the low-level CEC
messaging and logical address handling.

Change-Id: I0c9dfee5d78ef122a307946182f34ccf7e40d3fc
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
[k.debski@samsung.com: change kthread handling when setting logical address]
[k.debski@samsung.com: code cleanup and fixes]
[k.debski@samsung.com: add possibility to clear assigned logical addresses]
Signed-off-by: Kamil Debski <kamil@wypas.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: 9881fe0ca187c213eb3a6a8e78e45ad4d1cec171
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-22 18:54:02 -07:00
Hans Verkuil
6e0af539af [media] cec: add HDMI CEC framework (core)
The added HDMI CEC framework provides a generic kernel interface for
HDMI CEC devices.

Note that the CEC framework is added to staging/media and that the
cec.h and cec-funcs.h headers are not exported yet. While the kABI
is mature, I would prefer to allow the uABI some more time before
it is mainlined in case it needs more tweaks.

This adds the cec-core.c, media/cec.h and cec-priv.h sources.

Change-Id: Iccc9ce1e7c1c04aa7693c3ba73027d92b50b3bbc
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
[k.debski@samsung.com: Merged CEC Updates commit by Hans Verkuil]
[k.debski@samsung.com: Merged Update author commit by Hans Verkuil]
[k.debski@samsung.com: code cleanup and fixes]
[k.debski@samsung.com: add missing CEC commands to match spec]
[k.debski@samsung.com: add RC framework support]
[k.debski@samsung.com: move and edit documentation]
[k.debski@samsung.com: add vendor id reporting]
[k.debski@samsung.com: reorder of API structs and add reserved fields]
[k.debski@samsung.com: fix handling of events and fix 32/64bit timespec problem]
[k.debski@samsung.com: add sequence number handling]
[k.debski@samsung.com: add passthrough mode]
[k.debski@samsung.com: fix CEC defines, add missing CEC 2.0 commands]
Signed-off-by: Kamil Debski <kamil@wypas.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: a56960e8b406d36b612776c79134b954adc2ca18
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-22 18:52:40 -07:00
Hans Verkuil
6d1334fc98 [media] cec-funcs.h: static inlines to pack/unpack CEC messages
This public header contains static inlines to pack and unpack CEC
messages. It is for use in both the kernel and in userspace.

Since the CEC framework will initially be in staging this header is
not yet in include/uapi. Once the framework is moved out of staging
this header should be moved to uapi at the same time.

Change-Id: I3a6eaf417787e9bfd6e8dc06bedbee03f9c3552a
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: 50f7d5a65e5a31e92a9d46663770cd9509f939a2
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-22 18:52:13 -07:00
Hans Verkuil
5e0b2bbee9 [media] cec.h: add cec header
This header contains the CEC public API. Since the CEC framework will
initially be part of staging this header is kept out of include/uapi for
the time being until the CEC framework will be moved out of staging.

Change-Id: I8ad69b57531e65fc9919f92b473280dd821f1272
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: 3132583e5bd7cb56dffb2c04128ec4db12c32027
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-22 18:48:58 -07:00
Hans Verkuil
973fd92d59 [media] cec-edid: add module for EDID CEC helper functions
The cec-edid module contains helper functions to find and manipulate
the CEC physical address inside an EDID. Even if the CEC support itself
is disabled, drivers will still need these functions. Which is the
reason this is module is separate from the upcoming CEC framework.

Change-Id: Ia20fb7ef771c0455d369029738c509d59f5e4adc
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: 29fb44a58ac12bffe4c225f95afdc22364db070e
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
2017-05-22 18:48:38 -07:00
Linux Build Service Account
60be71604a Merge "qpnp-smb2: fix FV and FCC reporting" 2017-05-20 01:37:19 -07:00
Linux Build Service Account
474a2a48ad Merge "msm: vidc: Cancel userptr validation during secure decode" 2017-05-20 01:37:18 -07:00
Linux Build Service Account
9ec1caea12 Merge "ASoC: msm: qdspv2: Rename HDMI drift mixer controls" 2017-05-20 01:37:17 -07:00