1© 2014 Cisco and/or its affiliates. All rights reserved.
HDMI CEC (Consumer
Electronics Control)
Status Report
Hans Verkuil
Cisco Systems Norway
2© 2014 Cisco and/or its affiliates. All rights reserved.
Voyager 1 (launched Sep 5, 1977) @ 21 billion km (13 billion miles, 140 AU):
1400 bits/s
© 2014 Cisco and/or its affiliates. All rights reserved. 3
CEC @ 1 meter: 400 bits/s
Cisco Confidential 4© 2014 Cisco and/or its affiliates. All rights reserved.
What Is CEC?
© 2014 Cisco and/or its affiliates. All rights reserved. 5
Consumer Electronics Control
●
An optional supplement to HDMI using pin 13 of the HDMI connector.
●
Provides high-level control functions between the various audiovisual products in a user's
environment.
●
Based on the old AV.link scart standard (EN 50157-2-[123]).
●
Implemented in HDMI receivers/transmitters and USB HDMI-passthrough devices.
●
Data packets: 1 header byte + 0 to 15 data bytes.
●
Very, very slow data rate ~400 bits/s.
© 2014 Cisco and/or its affiliates. All rights reserved. 6
Physical Address
Physical address: Hierarchy placement
Range: 0.0.0.0 - F.F.F.F
Root device: 0.0.0.0: HDMI Sink, typically a TV
First device: 1.0.0.0: Device connected to HDMI port 1 on root device
Second device: 2.0.0.0: Device connected to HDMI port 2 on root device
Third device: 2.1.0.0: Device connected to HDMI port 2 on first device
Invalid: f.f.f.f: There is no physical address. CEC is typically
disabled in this case
Sources get their Physical address from the EDID which is obtained from
the sink.
© 2014 Cisco and/or its affiliates. All rights reserved. 7
Logical Address
Logical address 0-15: product type dependent.
Not really an address, more like a nickname.
0: TV (root device) 8: Playback device 2
1: Recording device 1 9: Recording device 3
2: Recording device 2 10: Tuner 4
3: Tuner 1 11: Playback device 3
4: Playback device 1 12: Backup 1
5: Audio system 13: Backup 2
6: Tuner 2 14: Specific use
7: Tuner 3 15: Unregistered (as Initiator address)
Broadcast (as Destination address)
© 2014 Cisco and/or its affiliates. All rights reserved. 8
Topology Example
© 2014 Cisco and/or its affiliates. All rights reserved. 9
Trade Names
●
Anynet+ (SAMSUNG)
●
BRAVIA Link (Sony)
●
Kuro Link (Pioneer)
●
EasyLink (Philips)
●
SimpLink (LG)
●
VIERA link (Panasonic)
Cisco Confidential 10© 2014 Cisco and/or its affiliates. All rights reserved.
Why Implement CEC?
© 2014 Cisco and/or its affiliates. All rights reserved. 11
End-User Features
●
One Touch Play: allows a device to be played and become the active source
with a single button press.
●
System Standby: enables the user to switch all devices to the Standby state
with one button press.
●
One Touch Record: offers a What You See Is What You Record (WYSIWYR)
facility, meaning that whatever is shown on the TV screen is recorded on a
selected Recording Device.
●
Timer Programming: allows the user to program the timers in a Recording
Device from an EPG running on a TV or STB.
●
Deck Control: enables a device to control (e.g. play, fast forward etc.) and
interrogate a Playback Device (a deck).
blue == well-tested by cec-compliance.
© 2014 Cisco and/or its affiliates. All rights reserved. 12
End-User Features
●
Tuner Control: allows a device to control the tuner of another
device.
●
Device Menu Control: enables a device to control the menu of
another device by passing through user interface commands.
●
Remote Control Pass Through: enables remote control
commands to be passed through to other devices within the
system.
●
System Audio Control: allows an Audio Amplifier / Receiver to be
used with the TV. The volume can be controlled using any the
remote controls of any suitably-equipped devices in the system.
© 2014 Cisco and/or its affiliates. All rights reserved. 13
Supporting Features
●
Device OSD Name Transfer: enables devices to upload their preferred OSD name
to the TV. The TV can then use this name in any menus associated with that
device.
●
Device Power Status: allows the current power status of a device to be discovered.
●
OSD Display: enables a device to use the on-screen display of the TV to display
text strings.
●
Routing Control: allows the control of CEC Switches for streaming of a new source
device.
●
System Information: queries the system to determine device addresses and
language.
●
Dynamic Audio Lipsync: used by sinks to announce their audio latency (CEC 2.0
feature, but allowed for CEC 1.4 devices as well).
© 2014 Cisco and/or its affiliates. All rights reserved. 14
Supporting Features
●
Vendor Specific Commands: allows a set of vendor-defined commands to be
used between devices of that vendor.
●
Audio Rate Control: allows an Amplifier to fractionally increase or decrease
the playback rate of an audio source.
●
Audio Return Channel Control: controls the Audio Return Channel (ARC)
part of the HDMI Ethernet and Audio Return Channel (HEAC).
●
Capability Discovery and Control: controls HDMI Ethernet Channel (HEC)
part of HEAC.
Cisco Confidential 15© 2014 Cisco and/or its affiliates. All rights reserved.
How Is CEC Implemented?
© 2014 Cisco and/or its affiliates. All rights reserved. 16
CEC Framework
●
Creates a /dev/cecX device node.
●
The driver determines the level of control userspace is allowed.
●
Drivers implement the low-level CEC adapter operations.
●
The framework deals with the details of the protocol and the asynchronous aspects.
●
The framework processes the core CEC messages automatically (unless userspace enables
passthrough mode).
●
The framework allows monitoring the CEC line.
●
Core code is in drivers/media/cec.
●
Static inlines to assemble/decode CEC messages are in include/uapi/linux/cec-funcs.h.
●
Optionally integrates with the kernel's remote control framework for the CEC Remote Control
Passthrough Feature.
© 2014 Cisco and/or its affiliates. All rights reserved. 17
CEC Adapter Driver
struct cec_adap_ops {
/* Low-level callbacks (blue == required) */
int (*adap_enable)(struct cec_adapter *adap, bool enable);
int (*adap_monitor_all_enable)(struct cec_adapter *adap, bool enable);
int (*adap_log_addr)(struct cec_adapter *adap, u8 logical_addr);
int (*adap_transmit)(struct cec_adapter *adap, u8 attempts,
u32 signal_free_time, struct cec_msg *msg);
void (*adap_status)(struct cec_adapter *adap);
void (*adap_free)(struct cec_adapter *adap);
/* Optional high-level CEC message callback */
int (*received)(struct cec_adapter *adap, struct cec_msg *msg);
};
void cec_transmit_done(struct cec_adapter *adap, u8 status, u8 arb_lost_cnt,
u8 nack_cnt, u8 low_drive_cnt, u8 error_cnt);
void cec_received_msg(struct cec_adapter *adap, struct cec_msg *msg);
© 2014 Cisco and/or its affiliates. All rights reserved. 18
CEC API
● CEC_ADAP_G_CAPS: returns the capabilities of the CEC adapter.
● CEC_ADAP_G/S_PHYS_ADDR: get/set the physical address for the CEC adapter.
● CEC_ADAP_G/S_LOG_ADDRS: get/set the logical addresses and other fixed information for the CEC
adapter.
● CEC_G/S_MODE: get/set the mode of the filehandle. Filehandles can be in initiator mode and/or in
follower mode. In initiator mode they can transmit CEC messages and receive replies. In follower
mode they can receive CEC messages and are expected to handle those messages if needed.
● CEC_RECEIVE/TRANSMIT: receive and transmit CEC messages. Optionally CEC_TRANSMIT can
wait for a reply.
● CEC_DQEVENT: event handling: when the physical or logical addresses change userspace will be
informed. Important to detect disconnect/connect changes.
● /sys/kernel/debug/cec/cecX/status: show CEC adapter status information.
© 2014 Cisco and/or its affiliates. All rights reserved. 19
CEC & Hotplug Detect
●
The CEC Physical Address of a source is set in the EDID of the sink. EDIDs can only be read by
a source if the sink pulls the HDMI Hotplug Detect pin high. So no HPD, no CEC and no CEC, no
way to wake up the sink via a CEC message.
●
However, some displays turn off the HPD when in standby, but CEC is still enabled.
●
CEC 2.0 allows for this in the small (very small) print of the spec.
●
So the CEC framework can send a CEC wake up message to the TV even when there is no
physical address. This may or may not work, there is no way to tell. Not all CEC hardware
implementations can do this! See CEC_CAP_NEEDS_HPD capability.
●
Even worse: some displays only wake up if this message is the first message they see. i.e. a poll
message followed by a wake up message might fail.
●
Also observed: switching inputs on a display (e.g. from HDMI 1 to 2) can cause the HPD to go
down, then up again. The framework will disable CEC when it goes low, and reclaim the logical
addresses when it goes up again. Any CEC application software has to be able to handle this.
© 2014 Cisco and/or its affiliates. All rights reserved. 20
CEC Utilities
●
cec-ctl supports all CEC messages (autogenerated code) and is a quick way of interactively
configuring a CEC adapter and sending, receiving and monitoring CEC messages.
●
It also supports the Hospitality Profile Next Generation CEC extension.
See http://www.htng.org/ for more information.
● It supports low-level CEC analysis (--monitor-pin option). Only available with sun4i and cec-
gpio drivers.
●
cec-follower emulates the high-level behavior of a CEC device.
●
cec-compliance tests a remote CEC device whether it is CEC compliance or not. The main focus
has been on features that Cisco needs, other features are only superficially tested. Help would
be very welcome.
© 2014 Cisco and/or its affiliates. All rights reserved. 21
Current Status for kernel 4.14
●
After two years of on-and-off development the CEC framework was merged in kernel 4.8 in
drivers/staging and moved to drivers/media in 4.10.
●
Supported USB CEC dongles: the popular Pulse-Eight USB CEC adapter and the RainShadow
Tech adapter.
●
DRM CEC support: Samsung Exynos 4 + 5, STIH4xx, stm32, Raspberry Pi, Synopsis dw-hdmi
CEC IP, amlogic AO-CEC, Allwinner A10.
●
V4L2 CEC support: adv7604, adv7842, adv7511, vivid (CEC emulation).
●
Passed official certified CEC 1.4 and 2.0 compliance tests (thanks to Jose Abreu from Synopsis).
●
Linux is the only OS that has built-in CEC support!
© 2014 Cisco and/or its affiliates. All rights reserved. 22
Work-in-Progress
●
DRM drivers: omap4, adv7511/adv7533 (Qualcomm Dragonboard), Tegra,
DisplayPort CEC-Tunneling-over-AUX.
●
V4L2 drivers: tc358743 (merged for 4.15).
●
GPIO driver: cec-gpio (merged for 4.15).
© 2014 Cisco and/or its affiliates. All rights reserved. 23
CEC To Do
●
Implement 'wake-on-CEC' feature.
●
Improve cec-compliance to increase the test coverage of the CEC API (patches are welcome!).
●
Error injection using low-level CEC pin framework used in cec-gpio and sun4i.
●
Improve low-level CEC pin analysis code in cec-ctl.
●
Use the remote control framework to also send RC messages, not just receive.
Cisco Confidential 24© 2014 Cisco and/or its affiliates. All rights reserved.
Demo!
© 2014 Cisco and/or its affiliates. All rights reserved. 25
Demo: RPi + tc358743 + 2x cec-gpio
Rpi HDMI Tx
2x CEC GPIO
2x HPD GPIO
tc358743 HDMI Rx
UART
Cisco Confidential 26© 2014 Cisco and/or its affiliates. All rights reserved.
Resources
© 2014 Cisco and/or its affiliates. All rights reserved. 27
Resources
●
HDMI/CEC Specification:
https://en.wikipedia.org/wiki/HDMI
●
Git repository for the media subsystem:
https://git.linuxtv.org/media_tree.git/
●
Git repository for the media utilities:
https://git.linuxtv.org/v4l-utils.git/
●
Media documentation:
https://www.linuxtv.org/downloads/v4l-dvb-apis-new/uapi/cec/cec-api.html
https://www.linuxtv.org/downloads/v4l-dvb-apis-new/kapi/cec-core.html
●
CEC status information:
https://hverkuil.home.xs4all.nl/cec-status.txt
●
Pulse-Eight libcec patch adding support for linux CEC framework (Jonas Karlman):
https://github.com/Pulse-Eight/libcec/pull/380
●
My email: hverkuil@xs4all.nl
Cisco Confidential 28© 2014 Cisco and/or its affiliates. All rights reserved.
Questions?

More Related Content

PDF
Androidの新ビルドシステム
PDF
Djangoアプリのデプロイに関するプラクティス / Deploy django application
PDF
オトナのTDD(テスト駆動開発)入門
PPTX
自動テストの品質とテストパターン
PDF
用十分鐘 向jserv學習作業系統設計
PDF
File System Modules
PDF
Linux-Internals-and-Networking
PDF
Xeon dとlagopusと、pktgen dpdk
Androidの新ビルドシステム
Djangoアプリのデプロイに関するプラクティス / Deploy django application
オトナのTDD(テスト駆動開発)入門
自動テストの品質とテストパターン
用十分鐘 向jserv學習作業系統設計
File System Modules
Linux-Internals-and-Networking
Xeon dとlagopusと、pktgen dpdk

What's hot (20)

PPT
Learning AOSP - Android Linux Device Driver
PDF
Android起動周りのノウハウ
PPT
Learning AOSP - Android Booting Process
PPTX
How to install windows 7
PDF
Project meeting: Android Graphics Architecture Overview
PDF
Linux Interview Questions And Answers | Linux Administration Tutorial | Linux...
PDF
Robot Framework with Python | Edureka
PDF
강좌 06 부트로더
PPTX
Windows 10 ppt
PDF
X / DRM (Direct Rendering Manager) Architectural Overview
PDF
from Source to Binary: How GNU Toolchain Works
PDF
LCA13: Combining Runtime PM and suspend/resume
PPT
linux device driver
PPTX
이카루스 튜토리얼 TC
PDF
Introdução ao Software Livre
PDF
Présentation ubuntu 12.10 PDF
PDF
Meet cute-between-ebpf-and-tracing
PPTX
File permission in linux
ODP
Basics of boot-loader
PDF
うちのRedmineの使い方(2)
Learning AOSP - Android Linux Device Driver
Android起動周りのノウハウ
Learning AOSP - Android Booting Process
How to install windows 7
Project meeting: Android Graphics Architecture Overview
Linux Interview Questions And Answers | Linux Administration Tutorial | Linux...
Robot Framework with Python | Edureka
강좌 06 부트로더
Windows 10 ppt
X / DRM (Direct Rendering Manager) Architectural Overview
from Source to Binary: How GNU Toolchain Works
LCA13: Combining Runtime PM and suspend/resume
linux device driver
이카루스 튜토리얼 TC
Introdução ao Software Livre
Présentation ubuntu 12.10 PDF
Meet cute-between-ebpf-and-tracing
File permission in linux
Basics of boot-loader
うちのRedmineの使い方(2)
Ad

Similar to Kernel Recipes 2017 - HDMI CEC: Status Report - Hans Verkuil (20)

DOC
SudheerV_resume_a
PPTX
ENSA_Module_10.pptx
PDF
SDI to IP 2110 Transition Part 2
PPTX
ECI OpenFlow 2.0 the Future of SDN
DOC
CLV_Viswanath_K
PDF
Door_Control_Unit_User_Manual_2.pdf
PPTX
2014/09/02 Cisco UCS HPC @ ANL
PPTX
Gefen: Video over IP and Cascading Retail Wall
PDF
DEFCON 23 - Joshua Smith - high def fuzzing - exploitation over HDMI-CEC
PDF
Secure 4-Port, Single-Head DP/HDMI KVM Switch with Dedicated CAC Port and 4K ...
PPTX
Barry Hesk: Cisco Unified Communications Manager training deck 1
PDF
PPT
Videoconferencing Technology Workshop
PPTX
Siemens PXC Controller Series Part-2
PPTX
CCNA R&S-11-Troubleshooting Ethernet LANs
PDF
versa router teletronics
PPT
chapter 5 - Manage_Cisco_Internetwork.ppt
PPT
chapter 5 - Manage_Cisco_Internetwork.ppt
PDF
Building PoC ready ODM Platforms with Arm SystemReady v5.2.pdf
PPTX
CCNA_RSE_Chp10-01 for Networking Engineer.pptx
SudheerV_resume_a
ENSA_Module_10.pptx
SDI to IP 2110 Transition Part 2
ECI OpenFlow 2.0 the Future of SDN
CLV_Viswanath_K
Door_Control_Unit_User_Manual_2.pdf
2014/09/02 Cisco UCS HPC @ ANL
Gefen: Video over IP and Cascading Retail Wall
DEFCON 23 - Joshua Smith - high def fuzzing - exploitation over HDMI-CEC
Secure 4-Port, Single-Head DP/HDMI KVM Switch with Dedicated CAC Port and 4K ...
Barry Hesk: Cisco Unified Communications Manager training deck 1
Videoconferencing Technology Workshop
Siemens PXC Controller Series Part-2
CCNA R&S-11-Troubleshooting Ethernet LANs
versa router teletronics
chapter 5 - Manage_Cisco_Internetwork.ppt
chapter 5 - Manage_Cisco_Internetwork.ppt
Building PoC ready ODM Platforms with Arm SystemReady v5.2.pdf
CCNA_RSE_Chp10-01 for Networking Engineer.pptx
Ad

More from Anne Nicolas (20)

PDF
Kernel Recipes 2019 - Driving the industry toward upstream first
PDF
Kernel Recipes 2019 - No NMI? No Problem! – Implementing Arm64 Pseudo-NMI
PDF
Kernel Recipes 2019 - Hunting and fixing bugs all over the Linux kernel
PDF
Kernel Recipes 2019 - Metrics are money
PDF
Kernel Recipes 2019 - Kernel documentation: past, present, and future
PDF
Embedded Recipes 2019 - Knowing your ARM from your ARSE: wading through the t...
PDF
Kernel Recipes 2019 - GNU poke, an extensible editor for structured binary data
PDF
Kernel Recipes 2019 - Analyzing changes to the binary interface exposed by th...
PDF
Embedded Recipes 2019 - Remote update adventures with RAUC, Yocto and Barebox
PDF
Embedded Recipes 2019 - Making embedded graphics less special
PDF
Embedded Recipes 2019 - Linux on Open Source Hardware and Libre Silicon
PDF
Embedded Recipes 2019 - From maintaining I2C to the big (embedded) picture
PDF
Embedded Recipes 2019 - Testing firmware the devops way
PDF
Embedded Recipes 2019 - Herd your socs become a matchmaker
PDF
Embedded Recipes 2019 - LLVM / Clang integration
PDF
Embedded Recipes 2019 - Introduction to JTAG debugging
PDF
Embedded Recipes 2019 - Pipewire a new foundation for embedded multimedia
PDF
Kernel Recipes 2019 - ftrace: Where modifying a running kernel all started
PDF
Kernel Recipes 2019 - Suricata and XDP
PDF
Kernel Recipes 2019 - Marvels of Memory Auto-configuration (SPD)
Kernel Recipes 2019 - Driving the industry toward upstream first
Kernel Recipes 2019 - No NMI? No Problem! – Implementing Arm64 Pseudo-NMI
Kernel Recipes 2019 - Hunting and fixing bugs all over the Linux kernel
Kernel Recipes 2019 - Metrics are money
Kernel Recipes 2019 - Kernel documentation: past, present, and future
Embedded Recipes 2019 - Knowing your ARM from your ARSE: wading through the t...
Kernel Recipes 2019 - GNU poke, an extensible editor for structured binary data
Kernel Recipes 2019 - Analyzing changes to the binary interface exposed by th...
Embedded Recipes 2019 - Remote update adventures with RAUC, Yocto and Barebox
Embedded Recipes 2019 - Making embedded graphics less special
Embedded Recipes 2019 - Linux on Open Source Hardware and Libre Silicon
Embedded Recipes 2019 - From maintaining I2C to the big (embedded) picture
Embedded Recipes 2019 - Testing firmware the devops way
Embedded Recipes 2019 - Herd your socs become a matchmaker
Embedded Recipes 2019 - LLVM / Clang integration
Embedded Recipes 2019 - Introduction to JTAG debugging
Embedded Recipes 2019 - Pipewire a new foundation for embedded multimedia
Kernel Recipes 2019 - ftrace: Where modifying a running kernel all started
Kernel Recipes 2019 - Suricata and XDP
Kernel Recipes 2019 - Marvels of Memory Auto-configuration (SPD)

Recently uploaded (20)

PDF
Early detection and classification of bone marrow changes in lumbar vertebrae...
PPTX
MuleSoft-Compete-Deck for midddleware integrations
PDF
CXOs-Are-you-still-doing-manual-DevOps-in-the-age-of-AI.pdf
PDF
A symptom-driven medical diagnosis support model based on machine learning te...
PDF
Planning-an-Audit-A-How-To-Guide-Checklist-WP.pdf
PDF
Data Virtualization in Action: Scaling APIs and Apps with FME
PDF
giants, standing on the shoulders of - by Daniel Stenberg
PDF
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
PDF
5-Ways-AI-is-Revolutionizing-Telecom-Quality-Engineering.pdf
PDF
Rapid Prototyping: A lecture on prototyping techniques for interface design
PDF
Auditboard EB SOX Playbook 2023 edition.
PPTX
future_of_ai_comprehensive_20250822032121.pptx
PDF
INTERSPEECH 2025 「Recent Advances and Future Directions in Voice Conversion」
PPTX
Microsoft User Copilot Training Slide Deck
PDF
“The Future of Visual AI: Efficient Multimodal Intelligence,” a Keynote Prese...
PDF
LMS bot: enhanced learning management systems for improved student learning e...
PDF
Transform-Your-Streaming-Platform-with-AI-Driven-Quality-Engineering.pdf
PPTX
Internet of Everything -Basic concepts details
PDF
IT-ITes Industry bjjbnkmkhkhknbmhkhmjhjkhj
PDF
Introduction to MCP and A2A Protocols: Enabling Agent Communication
Early detection and classification of bone marrow changes in lumbar vertebrae...
MuleSoft-Compete-Deck for midddleware integrations
CXOs-Are-you-still-doing-manual-DevOps-in-the-age-of-AI.pdf
A symptom-driven medical diagnosis support model based on machine learning te...
Planning-an-Audit-A-How-To-Guide-Checklist-WP.pdf
Data Virtualization in Action: Scaling APIs and Apps with FME
giants, standing on the shoulders of - by Daniel Stenberg
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
5-Ways-AI-is-Revolutionizing-Telecom-Quality-Engineering.pdf
Rapid Prototyping: A lecture on prototyping techniques for interface design
Auditboard EB SOX Playbook 2023 edition.
future_of_ai_comprehensive_20250822032121.pptx
INTERSPEECH 2025 「Recent Advances and Future Directions in Voice Conversion」
Microsoft User Copilot Training Slide Deck
“The Future of Visual AI: Efficient Multimodal Intelligence,” a Keynote Prese...
LMS bot: enhanced learning management systems for improved student learning e...
Transform-Your-Streaming-Platform-with-AI-Driven-Quality-Engineering.pdf
Internet of Everything -Basic concepts details
IT-ITes Industry bjjbnkmkhkhknbmhkhmjhjkhj
Introduction to MCP and A2A Protocols: Enabling Agent Communication

Kernel Recipes 2017 - HDMI CEC: Status Report - Hans Verkuil

  • 1. 1© 2014 Cisco and/or its affiliates. All rights reserved. HDMI CEC (Consumer Electronics Control) Status Report Hans Verkuil Cisco Systems Norway
  • 2. 2© 2014 Cisco and/or its affiliates. All rights reserved. Voyager 1 (launched Sep 5, 1977) @ 21 billion km (13 billion miles, 140 AU): 1400 bits/s
  • 3. © 2014 Cisco and/or its affiliates. All rights reserved. 3 CEC @ 1 meter: 400 bits/s
  • 4. Cisco Confidential 4© 2014 Cisco and/or its affiliates. All rights reserved. What Is CEC?
  • 5. © 2014 Cisco and/or its affiliates. All rights reserved. 5 Consumer Electronics Control ● An optional supplement to HDMI using pin 13 of the HDMI connector. ● Provides high-level control functions between the various audiovisual products in a user's environment. ● Based on the old AV.link scart standard (EN 50157-2-[123]). ● Implemented in HDMI receivers/transmitters and USB HDMI-passthrough devices. ● Data packets: 1 header byte + 0 to 15 data bytes. ● Very, very slow data rate ~400 bits/s.
  • 6. © 2014 Cisco and/or its affiliates. All rights reserved. 6 Physical Address Physical address: Hierarchy placement Range: 0.0.0.0 - F.F.F.F Root device: 0.0.0.0: HDMI Sink, typically a TV First device: 1.0.0.0: Device connected to HDMI port 1 on root device Second device: 2.0.0.0: Device connected to HDMI port 2 on root device Third device: 2.1.0.0: Device connected to HDMI port 2 on first device Invalid: f.f.f.f: There is no physical address. CEC is typically disabled in this case Sources get their Physical address from the EDID which is obtained from the sink.
  • 7. © 2014 Cisco and/or its affiliates. All rights reserved. 7 Logical Address Logical address 0-15: product type dependent. Not really an address, more like a nickname. 0: TV (root device) 8: Playback device 2 1: Recording device 1 9: Recording device 3 2: Recording device 2 10: Tuner 4 3: Tuner 1 11: Playback device 3 4: Playback device 1 12: Backup 1 5: Audio system 13: Backup 2 6: Tuner 2 14: Specific use 7: Tuner 3 15: Unregistered (as Initiator address) Broadcast (as Destination address)
  • 8. © 2014 Cisco and/or its affiliates. All rights reserved. 8 Topology Example
  • 9. © 2014 Cisco and/or its affiliates. All rights reserved. 9 Trade Names ● Anynet+ (SAMSUNG) ● BRAVIA Link (Sony) ● Kuro Link (Pioneer) ● EasyLink (Philips) ● SimpLink (LG) ● VIERA link (Panasonic)
  • 10. Cisco Confidential 10© 2014 Cisco and/or its affiliates. All rights reserved. Why Implement CEC?
  • 11. © 2014 Cisco and/or its affiliates. All rights reserved. 11 End-User Features ● One Touch Play: allows a device to be played and become the active source with a single button press. ● System Standby: enables the user to switch all devices to the Standby state with one button press. ● One Touch Record: offers a What You See Is What You Record (WYSIWYR) facility, meaning that whatever is shown on the TV screen is recorded on a selected Recording Device. ● Timer Programming: allows the user to program the timers in a Recording Device from an EPG running on a TV or STB. ● Deck Control: enables a device to control (e.g. play, fast forward etc.) and interrogate a Playback Device (a deck). blue == well-tested by cec-compliance.
  • 12. © 2014 Cisco and/or its affiliates. All rights reserved. 12 End-User Features ● Tuner Control: allows a device to control the tuner of another device. ● Device Menu Control: enables a device to control the menu of another device by passing through user interface commands. ● Remote Control Pass Through: enables remote control commands to be passed through to other devices within the system. ● System Audio Control: allows an Audio Amplifier / Receiver to be used with the TV. The volume can be controlled using any the remote controls of any suitably-equipped devices in the system.
  • 13. © 2014 Cisco and/or its affiliates. All rights reserved. 13 Supporting Features ● Device OSD Name Transfer: enables devices to upload their preferred OSD name to the TV. The TV can then use this name in any menus associated with that device. ● Device Power Status: allows the current power status of a device to be discovered. ● OSD Display: enables a device to use the on-screen display of the TV to display text strings. ● Routing Control: allows the control of CEC Switches for streaming of a new source device. ● System Information: queries the system to determine device addresses and language. ● Dynamic Audio Lipsync: used by sinks to announce their audio latency (CEC 2.0 feature, but allowed for CEC 1.4 devices as well).
  • 14. © 2014 Cisco and/or its affiliates. All rights reserved. 14 Supporting Features ● Vendor Specific Commands: allows a set of vendor-defined commands to be used between devices of that vendor. ● Audio Rate Control: allows an Amplifier to fractionally increase or decrease the playback rate of an audio source. ● Audio Return Channel Control: controls the Audio Return Channel (ARC) part of the HDMI Ethernet and Audio Return Channel (HEAC). ● Capability Discovery and Control: controls HDMI Ethernet Channel (HEC) part of HEAC.
  • 15. Cisco Confidential 15© 2014 Cisco and/or its affiliates. All rights reserved. How Is CEC Implemented?
  • 16. © 2014 Cisco and/or its affiliates. All rights reserved. 16 CEC Framework ● Creates a /dev/cecX device node. ● The driver determines the level of control userspace is allowed. ● Drivers implement the low-level CEC adapter operations. ● The framework deals with the details of the protocol and the asynchronous aspects. ● The framework processes the core CEC messages automatically (unless userspace enables passthrough mode). ● The framework allows monitoring the CEC line. ● Core code is in drivers/media/cec. ● Static inlines to assemble/decode CEC messages are in include/uapi/linux/cec-funcs.h. ● Optionally integrates with the kernel's remote control framework for the CEC Remote Control Passthrough Feature.
  • 17. © 2014 Cisco and/or its affiliates. All rights reserved. 17 CEC Adapter Driver struct cec_adap_ops { /* Low-level callbacks (blue == required) */ int (*adap_enable)(struct cec_adapter *adap, bool enable); int (*adap_monitor_all_enable)(struct cec_adapter *adap, bool enable); int (*adap_log_addr)(struct cec_adapter *adap, u8 logical_addr); int (*adap_transmit)(struct cec_adapter *adap, u8 attempts, u32 signal_free_time, struct cec_msg *msg); void (*adap_status)(struct cec_adapter *adap); void (*adap_free)(struct cec_adapter *adap); /* Optional high-level CEC message callback */ int (*received)(struct cec_adapter *adap, struct cec_msg *msg); }; void cec_transmit_done(struct cec_adapter *adap, u8 status, u8 arb_lost_cnt, u8 nack_cnt, u8 low_drive_cnt, u8 error_cnt); void cec_received_msg(struct cec_adapter *adap, struct cec_msg *msg);
  • 18. © 2014 Cisco and/or its affiliates. All rights reserved. 18 CEC API ● CEC_ADAP_G_CAPS: returns the capabilities of the CEC adapter. ● CEC_ADAP_G/S_PHYS_ADDR: get/set the physical address for the CEC adapter. ● CEC_ADAP_G/S_LOG_ADDRS: get/set the logical addresses and other fixed information for the CEC adapter. ● CEC_G/S_MODE: get/set the mode of the filehandle. Filehandles can be in initiator mode and/or in follower mode. In initiator mode they can transmit CEC messages and receive replies. In follower mode they can receive CEC messages and are expected to handle those messages if needed. ● CEC_RECEIVE/TRANSMIT: receive and transmit CEC messages. Optionally CEC_TRANSMIT can wait for a reply. ● CEC_DQEVENT: event handling: when the physical or logical addresses change userspace will be informed. Important to detect disconnect/connect changes. ● /sys/kernel/debug/cec/cecX/status: show CEC adapter status information.
  • 19. © 2014 Cisco and/or its affiliates. All rights reserved. 19 CEC & Hotplug Detect ● The CEC Physical Address of a source is set in the EDID of the sink. EDIDs can only be read by a source if the sink pulls the HDMI Hotplug Detect pin high. So no HPD, no CEC and no CEC, no way to wake up the sink via a CEC message. ● However, some displays turn off the HPD when in standby, but CEC is still enabled. ● CEC 2.0 allows for this in the small (very small) print of the spec. ● So the CEC framework can send a CEC wake up message to the TV even when there is no physical address. This may or may not work, there is no way to tell. Not all CEC hardware implementations can do this! See CEC_CAP_NEEDS_HPD capability. ● Even worse: some displays only wake up if this message is the first message they see. i.e. a poll message followed by a wake up message might fail. ● Also observed: switching inputs on a display (e.g. from HDMI 1 to 2) can cause the HPD to go down, then up again. The framework will disable CEC when it goes low, and reclaim the logical addresses when it goes up again. Any CEC application software has to be able to handle this.
  • 20. © 2014 Cisco and/or its affiliates. All rights reserved. 20 CEC Utilities ● cec-ctl supports all CEC messages (autogenerated code) and is a quick way of interactively configuring a CEC adapter and sending, receiving and monitoring CEC messages. ● It also supports the Hospitality Profile Next Generation CEC extension. See http://www.htng.org/ for more information. ● It supports low-level CEC analysis (--monitor-pin option). Only available with sun4i and cec- gpio drivers. ● cec-follower emulates the high-level behavior of a CEC device. ● cec-compliance tests a remote CEC device whether it is CEC compliance or not. The main focus has been on features that Cisco needs, other features are only superficially tested. Help would be very welcome.
  • 21. © 2014 Cisco and/or its affiliates. All rights reserved. 21 Current Status for kernel 4.14 ● After two years of on-and-off development the CEC framework was merged in kernel 4.8 in drivers/staging and moved to drivers/media in 4.10. ● Supported USB CEC dongles: the popular Pulse-Eight USB CEC adapter and the RainShadow Tech adapter. ● DRM CEC support: Samsung Exynos 4 + 5, STIH4xx, stm32, Raspberry Pi, Synopsis dw-hdmi CEC IP, amlogic AO-CEC, Allwinner A10. ● V4L2 CEC support: adv7604, adv7842, adv7511, vivid (CEC emulation). ● Passed official certified CEC 1.4 and 2.0 compliance tests (thanks to Jose Abreu from Synopsis). ● Linux is the only OS that has built-in CEC support!
  • 22. © 2014 Cisco and/or its affiliates. All rights reserved. 22 Work-in-Progress ● DRM drivers: omap4, adv7511/adv7533 (Qualcomm Dragonboard), Tegra, DisplayPort CEC-Tunneling-over-AUX. ● V4L2 drivers: tc358743 (merged for 4.15). ● GPIO driver: cec-gpio (merged for 4.15).
  • 23. © 2014 Cisco and/or its affiliates. All rights reserved. 23 CEC To Do ● Implement 'wake-on-CEC' feature. ● Improve cec-compliance to increase the test coverage of the CEC API (patches are welcome!). ● Error injection using low-level CEC pin framework used in cec-gpio and sun4i. ● Improve low-level CEC pin analysis code in cec-ctl. ● Use the remote control framework to also send RC messages, not just receive.
  • 24. Cisco Confidential 24© 2014 Cisco and/or its affiliates. All rights reserved. Demo!
  • 25. © 2014 Cisco and/or its affiliates. All rights reserved. 25 Demo: RPi + tc358743 + 2x cec-gpio Rpi HDMI Tx 2x CEC GPIO 2x HPD GPIO tc358743 HDMI Rx UART
  • 26. Cisco Confidential 26© 2014 Cisco and/or its affiliates. All rights reserved. Resources
  • 27. © 2014 Cisco and/or its affiliates. All rights reserved. 27 Resources ● HDMI/CEC Specification: https://en.wikipedia.org/wiki/HDMI ● Git repository for the media subsystem: https://git.linuxtv.org/media_tree.git/ ● Git repository for the media utilities: https://git.linuxtv.org/v4l-utils.git/ ● Media documentation: https://www.linuxtv.org/downloads/v4l-dvb-apis-new/uapi/cec/cec-api.html https://www.linuxtv.org/downloads/v4l-dvb-apis-new/kapi/cec-core.html ● CEC status information: https://hverkuil.home.xs4all.nl/cec-status.txt ● Pulse-Eight libcec patch adding support for linux CEC framework (Jonas Karlman): https://github.com/Pulse-Eight/libcec/pull/380 ● My email: [email protected]
  • 28. Cisco Confidential 28© 2014 Cisco and/or its affiliates. All rights reserved. Questions?